Akinon Plugin Adapter
Akinon Plugin Adapter offers services to improve plugin development processes. Upon installing a project with the appmaker cli, the akinon-plugin-adapter package comes ready to use and is compatible with the env version of the project.
Modifiers
AppDelegateModifier
It contains the required functions for editing AppDelegate.m and AppDelegate.h files.
Usage
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { AppDelegateModifier } = Modifiers;
const { ios: { getAppDelegate } } = Paths;
const appDelegate = new AppDelegateModifier(getAppDelegate());
Methods
- addImports(imports, options)
Params
Name | Type | Description |
---|---|---|
imports (required) | array [] | The imports that need to be added are sent in string format. |
options (optional) | object {} | - |
options
{
"offset": 1 // Number
}
Example
appDelegate.addImports([‘#import "AppDelegate.h"’])
Return
Returns the final version of the app delegate file in string format.
- addFunctions(functions)
Params
Name | Type | Description |
---|---|---|
functions (required) | array [] | The functions that need to be added are sent in object format. |
functions
[
{
"name": "",
"header": "",
"body": ""
}
]
Example
appDelegate.addFunctions([
{
"name": "didRegisterUserNotificationSettings",
"header": "- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings",
"body": "
{
[PushModule didRegisterUserNotificationSettings:notificationSettings];
}
"
}
])
Return
Returns the final version of the app delegate file in string format.
- patchDidFinishLaunch(patch)
Params
Name | Type | Description |
---|---|---|
patch (required) | string "" | The code that needs to be added to the didFinishLaunchingWithOptions function is sent in string format. |
Example
appDelegate.patchDidFinishLaunch("UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];");
Return
Returns the final version of the app delegate file in string format.
- patchFunction(params)
Patches a current function in the AppDelegate file.
Params
Name | Type | Description |
---|---|---|
params (required) | object {} | Patches a current function in the AppDelegate file |
params
{
"pattern": /return YES;\s?{/g // Regex,
"offset": 1 // Number,
"declaration": "UIViewController *rootViewController = [UIViewController new];" // String
}
Example
appDelegate.patchFunction({
"pattern": /(@interface AppDelegate(.*))+(?=>)/,
"declaration": ", UNUserNotificationCenterDelegate"
})
Return
Returns the final version of the app delegate file in string format.
- writeAsync
Writes the current version of the AppDelegate file to disk.
Example
appDelegate.writeAsync();
Return
Return a promise
XcodeModifier
It parses the Xcode file into javascript. Edits are made on xcode with javascript functions, with its output also in xcode format.
Usage
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { XcodeModifier } = Modifiers;
const { ios: { getPBXProjectPaths } } = Paths;
const xcode = new XcodeModifier(getPBXProjectPaths());
Methods
- parse()
It parses the Xcode file within ./ios/akinon.xcodeproj/project.pbxproj directory into javascript. Make sure the parse method is running before using xcode methods.
Usage
xcode.parse();
- writeAsync()
Rebuilds the xcode objects that has been parsed into javascript object into xcode file and writes this to ./ios/akinon.xcodeproj/project.pbxproj directory.
Usage
xcode.writeAsync();
- getFirstProject()
Return PBXProject section
Usage
xcode.getFirstProject();
- getPbxGroup()
Brings references to files and folders registered to the akinon group.
Usage
xcode.getPbxGroup();
- getApplicationTarget()
Returns akinon target. It’s useful to access akinon target's build settings and build phase references.
- getPbxBuildFile(fileName)
Returns the reference of the related file witin files in the akinon group.
Params
Name | Type | Description |
---|---|---|
fileName (required) | string "" | - |
Usage
xcode.getPbxBuildFile("main.m");
/*
{
isa: 'PBXBuildFile',
fileRef: '13B07FB71A68108700A75B9A',
fileRef_comment: 'main.m'
}
*/
- createFile(file, groupName)
Adds a new file to akinon target.
Params
Name | Type | Description |
---|---|---|
file (required) | Object {} | - |
groupName (optional) | String "" | The name of the group where the file is desired to be added |
file
{
path: "", // String
name: "", // String
destinationPath: "" // String
pbxFilePath: "" // String (optional)
}
Return
Returnd created file information as object.
- addFileToTarget(file, target)
Add a file’s reference to the specified target. It’s useful to add a file to targets that have been added later on.
Params
Name | Type | Description |
---|---|---|
file (required) | Object {} | - |
target (required) | String "" | Target UUID |
file
{
fileRef: "", // String
}
- addFrameworks(frameworks)
Adds framework to akinon target.
Params
Name | Type | Description |
---|---|---|
frameworks (required) | Array [] | Please define the frameworks you wish to add in string format. |
Usage
xcode.addFrameworks(['AdServices.framework', 'AddSupport.framework']);
- addExtension(extension)
Adds new extension and extension files to akinon project. It’s useful to add extensions such as Notification Service Extension and Notification Content Extension.
Params
Name | Type | Description |
---|---|---|
extension (required) | Object {} | This sends the information of the extension you wish to add to the akinon project. |
Usage
xcode.addExtension({
"name": "AkinonNotificationService",
"files": [
{
"name": "NotificationService.m"
"path": "./NotificationService.m"
}
]
});
- addBuildPhase(files, type, comment, targetId)
Adds new fields and files to the Build Phases section of the specified target.
Params
Name | Type | Description |
---|---|---|
files | Array [] | Specify the files that need to be added during build phase in the string format. |
type (required) | String "" | Build phase type. Example PBXSourcesBuildPhase |
comment (required) | String "" | Build phase name. Example Sources |
targetId (required) | String "" | Target uuid |
Usage
xcode.addBuildPhase(['NotificationService.m', 'PBXSourcesBuildPhase', 'Sources', '9D322B95A1F74955A11AB75A']);
- addAttributeToTarget(attribute, value, target)
Adds new attribute to the specified target object. It’s useful for build configs that need to be added to a newly created target.
Params
Name | Type | Description |
---|---|---|
attribute (required) | String "" | Name of the new config to be added to target. Example: LastSwiftMigration |
value (required) | * | New config value to be added to target. Example: 1240 |
target (required) | Object {} | Target object |
Usage
const newTarget = xcode.addExtension({
"name": "AkinonNotificationService",
"files": [
{
"name": "NotificationService.m"
"path": "./NotificationService.m"
}
]
});
xcode.addAttributeToTarget("LastSwiftMigration", 1240, newTarget);
- updateBuildSettings(configName, value, targetName)
It’s useful to update a current build config in the specified target.
Params
Name | Type | Description |
---|---|---|
configName (required) | String "" | Build config name |
value (required) | * | Build config value |
targetName (required) | String"" | Target name |
Usage
xcode.updateBuildSettings("IPHONEOS_DEPLOYMENT_TARGET", "12.0", "AkinonNotificationService");
- generateUuid();
Returns a unique id.
Usage
const configurationUuid = xcode.generateUuid();
/*
58F828BC538AE7192B89651A
*/
- pbxBuildFileSection();
Returns the references of the files in the akinon group.
Usage
const fileSection = xcode.pbxBuildFileSection();
Return
Returns build files as object. Objectstring, BuildFileSection>>
- addPbxGroup(extensionFiles, name, path);
It’s used to create a new group.
Params
Name | Type | Description |
---|---|---|
extensionFiles (required) | Array [] | Specify the files that need to added to group in string format. |
name (required) | String "" | Group Name |
path (required) | String"" | Group Path |
Usage
const extensionGroup = xcode.addPbxGroup(
["NotificationService.m", "NotificationService.h"],
"NotificationService",
"NotificationService"
);
Return
Returns the created PbxGroup as object.
{uuid: string, pbxGroup: PbxGroup }
- addToPbxGroup(file, groupKey);
It’s used to add a new file to the specified group. It’s useful to add a new file to group.
Params
Name | Type | Description |
---|---|---|
file (required) | String "" | File uuid |
groupKey (required) | String "" | Group uuid |
Usage
xcode.addToPbxGroup(
"C625BB13ADFD413EA0CD4585",
xcode.getFirstProject().firstProject.mainGroup
);
addToPbxFileReferenceSection(file);
Creates the file reference of the sent file.
Params
Name | Type | Description |
---|---|---|
file (required) | Object {} | - |
file
{
fileRef: "", // String
basename: "", // String
path: "", //Strig
sourceTree: "", //String
fileEncoding: 0, // Number
lastKnownFileType: "", //String
explicitFileType: "", //String
includeInIndex: 0 //Number
}
Usage
const newFile = new PbxFile(filePath);
xcode.addToPbxFileReferenceSection(newFile);
- addToPbxBuildFileSection(file);
Adds the sent file to build file section.
Params
Name | Type | Description |
---|---|---|
file (required) | Object {} | - |
{
uuid: "" //String
fileRef: "", // String
basename: "", // String
settings: "", //String (Optional)
group: "" //String
}
Usage
const target = xcode.getApplicationTarget();
const newFile = new PbxFile(filePath);
newFile.uuid = xcode.generateUuid();
xcode.addToPbxBuildFileSection(newFile);
- addToPbxResourcesBuildPhase(file)
Adds the specified file to Build Phases section.
Params
Name | Type | Description |
---|---|---|
file (required) | Object {} | - |
{
uuid: "" //String
fileRef: "", // String
basename: "", // String
group: "" //String
}
Usage
const target = xcode.getApplicationTarget();
const newFile = new PbxFile(filePath);
newFile.uuid = xcode.generateUuid();
newFile.target = target.uuid;
xcode.addToPbxResourcesBuildPhase(newFile);
- addFramework(framework, options);
Adds a new framework to target.
Params
Name | Type | Description |
---|---|---|
params (required) | String "" | Please define the frameworks you wish to add. |
options (required) | Object {} | Options |
options
{
customFramework: false, // Bolean
link: false, // Boolean
embed: false, // Boolean
target: "" //String
}
Usage
const target = xcode.getApplicationTarget();
xcode.addFramework("AdServices.framework", {
target: target.uuid
});
Return
Returns the added framework as object. PbxFile
- addTarget(name, type);
Adds new Target to project.
Params
Name | Type | Description |
---|---|---|
name (required) | String "" | Target Name |
type (required) | String "" | Target Type |
Usage
const target = xcode.addTarget("NotificationService", "app_extension");
Return
Returns the added target as object.
{uuid: string, pbxNativeTarget: Target}
- pbxXCConfigurationList();
Return XCConfigurationList
Usage
xcode.pbxXCConfigurationList();
Return
Returns XCConfigurationLists as object. Objectstring, XCConfigurationList>>
Oluşturulan
- pbxXCBuildConfigurationSection();
Return XCBuildConfiguration section.
Usage
xcode.pbxXCBuildConfigurationSection();
Return
Returns XCBuildConfiguration as object. Objectstring, XCBuildConfiguration
- pbxNativeTargetSection();
Return PBXNativeTarget section.
Usage
xcode.pbxNativeTargetSection();
Returns PBXNativeTarget as object. Objectstring, Target>>
- addToLibrarySearchPaths(file);
Adds the specified file to Library Search Paths in the akinon target.
Params
Name | Type | Description |
---|---|---|
file (required) | String "" | Object {} | The file to be added to Library Search Paths |
file (object)
{
path: "", //String,
plugin: false, //Boolean,
customFramework: false, //Boolean,
dirname: "" //String
}
Usage
xcode.addToLibrarySearchPaths('Pods/react-native-tracking-transparency');
- addToHeaderSearchPaths(file);
Adds the specified file to the Header Search Paths of Targets.
Params
Name | Type | Description |
---|---|---|
file (required) | String "" | Object {} | The file to be added to Header Search Paths |
file (object)
{
path: "", //String,
plugin: false, //Boolean,
customFramework: false, //Boolean,
dirname: "" //String
}
Usage
xcode.addToHeaderSearchPaths({
path: 'Pods/react-native-tracking-transparency'
});
- removeFromHeaderSearchPaths(file);
Removes the specified file from the Header Search Paths of Targets.
Params
Name | Type | Description |
---|---|---|
file (required) | Object {} | The file to be removed from Header Search Paths |
file (object)
{
path: "", //String,
plugin: false, //Boolean,
customFramework: false, //Boolean,
dirname: "" //String
}
Usage
xcode.removeFromHeaderSearchPaths({
path: 'Pods/react-native-tracking-transparency'
});
- addToOtherLinkerFlags(flag);
Adds the specified flag to the Other Linker Flags of Targets.
Params
Name | Type | Description |
---|---|---|
flag (required) | String"" | The flag to be added to Other Linker Flags |
Usage
xcode.addToOtherLinkerFlags('-ObjC')
- removeFromOtherLinkerFlags(flag);
Removes the specified flag from the Other Linker Flags of Targets.
Params
Name | Type | Description |
---|---|---|
flag (required) | String"" | The flag to be removed from Other Linker Flags |
Usage
xcode.removeFromOtherLinkerFlags('-ObjC')
- addToBuildSettings(setting, value);
Adds the specified setting to the Build Settings of Targets.
Params
Name | Type | Description |
---|---|---|
setting (required) | String"" | The key for the setting to be added to Build Settings |
value(required) | String"" | The value for the setting to be added to Build Settings |
Usage
xcode.addToBuildSettings("MTL_ENABLE_DEBUG_INFO", 'NO');
- removeFromBuildSettings(setting, value);
Removes the specified setting from the Build Settings of Targets.
Params
Name | Type | Description |
---|---|---|
setting (required) | String"" | The key for the setting to be removed from Build Settings |
Usage
xcode.removeFromBuildSettings("MTL_ENABLE_DEBUG_INFO");
- productName
Projenin product name’ini return eder.
Usage
const productName = xcode.productName;
// $(TARGET_NAME)
- hasFile(filePath)
Checkes whether file path has file reference.
Params
Name | Type | Description |
---|---|---|
filePath (required) | String"" | The path of the file to be checked |
Usage
const file = xcode.hasFile('File.swift');
Return
If the file is not found within the file references, it returns false; if it is found, it returns the file reference.
- getFirstTarget()
Returns the first target within project.
Usage
const target = xcode.getFirstTarget();
Return
Returns the first found target as object.
{uuid: string: firstTarget: Target}
- getTarget(type);
Fetches the first target that belongs to type from among the targets within project.
Params
Name | Type | Description |
---|---|---|
type (required) | String"" | Product type to be fetched |
Usage
const target = xcode.getTarget('com.apple.product-type.application');
Return
Returns the first target obtained from type-specific filtering from among the targets within project, as object.
{uuid: string, target: Target}
- addToPbxGroupType(file, key, type);
Adds file to the type that belongs to the specified group.
Params
Name | Type | Description |
---|---|---|
file (required) | String"" | File uuid |
key (required) | String"" | Group key |
type (required) | String"" | Group type |
Usage
const firstProject = xcode.getFirstProject().firstProject;
const extensionGroup = xcode.addPbxGroup(
["NotificationService.m", "NotificationService.h"],
"NotificationService",
"NotificationService"
);
xcode.addToPbxGroupType(extensionGroup.uuid, firstProject.mainGroup, 'PBXGroup');
addToPbxVariantGroup(file, key);
removeFromPbxFrameworksBuildPhase(file)
Removes the sent file from the build phase named Frameworks.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.removeFromPbxFrameworksBuildPhase(file);
- addToPbxFrameworksBuildPhase(file)
Adds the sent file to the build phase named Frameworks.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.addToPbxFrameworksBuildPhase(file);
- removeFromPbxResourcesBuildPhase(file)
Removes the sent file from the build phase named Copy Bundle Resources.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.removeFromPbxResourcesBuildPhase(file);
- addToPbxResourcesBuildPhase(file)
Adds the sent file to the build phase named Copy Bundle Resources.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.addToPbxResourcesBuildPhase(file);
- removeFromPbxSourcesBuildPhase(file)
Removes the sent file from the build phase named Compile Sources.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.removeFromPbxSourcesBuildPhase(file);
- addToPbxSourcesBuildPhase(file)
Adds the sent file to the build phase named Compile Sources.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.addToPbxSourcesBuildPhase(file);
- removeFromProductsPbxGroup(file)
Removes the sent file from the pbx group named Products.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.addToProductsPbxGroup(file);
- addToProductsPbxGroup(file)
Adds the sent file to the pbx group named Products.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.addToProductsPbxGroup(file);
- removeFromPbxEmbedFrameworksBuildPhase(file)
Removes the sent file from the build phase named Embed Frameworks.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.removeFromPbxEmbedFrameworksBuildPhase(file);
- addToPbxEmbedFrameworksBuildPhase(file)
Adds the sent file to the build phase named Embed Frameworks.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.addToPbxEmbedFrameworksBuildPhase(file);
- removeFromFrameworksPbxGroup(file);
Removes the sent file from the pbx group named Frameworks.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.removeFromFrameworksPbxGroup(file);
- addToFrameworksPbxGroup(file);
Adds the sent file to the pbx group named Frameworks.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.addToFrameworksPbxGroup(file);
- removeFromResourcesPbxGroup(file);
Removes the sent file from the pbx group named Resources.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.removeFromResourcesPbxGroup(file);
- addToResourcesPbxGroup(file);
Adds the sent file to the pbx group named Resources.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.addToResourcesPbxGroup(file);
- removeFromPluginsPbxGroup(file);
Removes the sent file from the pbx group named Plugin.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.removeFromPluginsPbxGroup(file);
- addToPluginsPbxGroup(file);
Adds the sent file to the pbx group named Plugins.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.addToPluginsPbxGroup(file);
- removeFromPbxFileReferenceSection(path)
Removes the file in the specified target from PbxFileReferenceSection.
Param
Name | Type | Description |
---|---|---|
path (required) | string | Path of the file to be added |
Usage
xcode.PbxFileReferenceSection(file);
Return
Returns the deleted file PBXFile
- removePbxGroup(name);
Removes the specified group.
Params
Name | Type | Description |
---|---|---|
name (required) | string | - |
Usage
xcode.removePbxGroup("Frameworks")
removeFromPbxBuildFileSection(file);
Removes the sent file from the build file section.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
xcode.removeFromPbxBuildFileSection(file);
- addStaticLibrary(path, options)
Adds the file in the specified target as static library.
Param
Name | Type | Description |
---|---|---|
path (required) | string | Path of the file to be added |
options | object{} | - |
options
**{**
** lastKnownFileType: undefined, // String**
** customFramework: undefined, // String**
** defaultEncoding: undefined, // String**
** explicitFileType: undefined // String**
** sourceTree: {} // Any**
** weak: false // Boolean**
** compilerFlags: {} // Any**
** embed: false // Boolean**
** sign: false // Boolean**
**target: // String**
**plugin: false // Boolean**
**}**
Usage
xcode.removeCopyfile('File.m', undefined);
Return
Returns the added file PBXFile
- removeFromPbxCopyfilesBuildPhase(file)
Removes the specified file from within files in the CopyfilesBuildPhase object.
Param
Name | Type | Description |
---|---|---|
file (required) | pbxFile | File to be deleted |
Usage
xcode.removeFromPbxCopyfilesBuildPhase(file);
- removeCopyfile(path, options)
Returns the CopyfilesBuildPhase object in the specified target.
Param
Name | Type | Description |
---|---|---|
path (required) | string | Path of the file to be deleted |
options | object{} | - |
options
**{**
** lastKnownFileType: undefined, // String**
** customFramework: undefined, // String**
** defaultEncoding: undefined, // String**
** explicitFileType: undefined // String**
** sourceTree: {} // Any**
** weak: false // Boolean**
** compilerFlags: {} // Any**
** embed: false // Boolean**
** sign: false // Boolean**
**target: // String**
**}**
Usage
xcode.removeCopyfile('File.m', undefined);
Return
Returns the removed file PBXFile
- addToPbxCopyfilesBuildPhase(file)
Adds the specified file to files within the CopyfilesBuildPhase object.
Param
Name | Type | Description |
---|---|---|
file (required) | pbxFile | File to be added |
Usage
xcode.addToPbxCopyfilesBuildPhase(file);
- pbxCopyfilesBuildPhaseObj(target)
Returns the CopyfilesBuildPhase object in the specified target
Param
Name | Type | Description |
---|---|---|
target (required) | string | Target uuid |
Usage
xcode.pbxCopyfilesBuildPhaseObj('13B07F861A680F5B00A75B9A');
Return
Returns deleted object PBXCopyFilesBuildPhase
- addCopyfile(path, options)
ToDo: Method could not be run
- removeFramework(path, options)
Removes the file in the specified path from within Frameworks.
Param
Name | Type | Description |
---|---|---|
path (required) | string | Path of the file to be added |
options (optional) | Object{} | - |
options
{
lastKnownFileType: undefined, // String
customFramework: undefined, // String
defaultEncoding: undefined, // String
explicitFileType: undefined // String
sourceTree: {} // Any
weak: false // Boolean
compilerFlags: {} // Any
embed: false // Boolean
sign: false // Boolean
}
Usage
xcode.removeFramework('PathToHeaderFile')
Return
Returns the reference of the removed file.
- removeResourceFile(path, options, group)
Removes the specified resource file from a group.
Param
Name | Type | Description |
---|---|---|
path (required) | string | Path of the file to be removed |
options (optional) | Object{} | - |
group (optional) | string | Group where the file will be removed |
options
{
lastKnownFileType: undefined, // String
customFramework: undefined, // String
defaultEncoding: undefined, // String
explicitFileType: undefined // String
sourceTree: {} // Any
weak: false // Boolean
compilerFlags: {} // Any
embed: false // Boolean
sign: false // Boolean
}
Usage
xcode.removeResourceFile('PathToHeaderFile')
Return
Returns the reference of the removed file.
- addResourceFile(path, options, group)
Adds the specified resource file to a group.
Param | Name | Type | Description | | :--- | :----: | ---: | |path (required)|string|Path of the file to be added| |options (optional)|Object{}|-| |group (optional)|string|Group where the file will be added|
options
{
lastKnownFileType: undefined, // String
customFramework: undefined, // String
defaultEncoding: undefined, // String
explicitFileType: undefined // String
sourceTree: {} // Any
weak: false // Boolean
compilerFlags: {} // Any
embed: false // Boolean
sign: false // Boolean
}
Usage
xcode.addResourceFile('PathToHeaderFile')
Return
Returns the reference of the added file.
- removeHeaderFile(path, options, group)
Removes the specified header file from a group.
Param
Name | Type | Description |
---|---|---|
path (required) | string | Path of the file to be removed |
options (optional) | Object{} | - |
group (optional) | string | Group where the file will be removed |
options
{
lastKnownFileType: undefined, // String
customFramework: undefined, // String
defaultEncoding: undefined, // String
explicitFileType: undefined // String
sourceTree: {} // Any
weak: false // Boolean
compilerFlags: {} // Any
embed: false // Boolean
sign: false // Boolean
}
Usage
xcode.removeHeaderFile('PathToHeaderFile')
Return
Returns the reference of the deleted file.
- addHeaderFile(path, options, group)
Adds the specified header file to a group.
Param
Name | Type | Description |
---|---|---|
path (required) | string | Path of the file to be added |
options (optional) | Object{} | - |
group (optional) | string | Group where the file will be added |
options
{
lastKnownFileType: undefined, // String
customFramework: undefined, // String
defaultEncoding: undefined, // String
explicitFileType: undefined // String
sourceTree: {} // Any
weak: false // Boolean
compilerFlags: {} // Any
embed: false // Boolean
sign: false // Boolean
}
Usage
xcode.addHeaderFile('PathToHeaderFile')
Return
Returns the reference of the added file.
- removeSourceFile(path, options, group)
Removes the path source code from the specified group.
Param
Name | Type | Description |
---|---|---|
path (required) | string | Path of the file to be removed |
options (optional) | Object{} | - |
group (optional) | string | Group where the file will be removed |
options
{
lastKnownFileType: undefined, // String
customFramework: undefined, // String
defaultEncoding: undefined, // String
explicitFileType: undefined // String
sourceTree: {} // Any
weak: false // Boolean
compilerFlags: {} // Any
embed: false // Boolean
sign: false // Boolean
}
Usage
xcode.addSourceFile('Pods/VisilabsIOS/Sources/TargetingAction/InAppNotification/Views/VisilabsFullNotificationViewController.xib', undefined, "Products")
Return
Returns the reference of the deleted file.
- addSourceFile(path, options, group)
Adds the path source code to the specified group.
Param
Name | Type | Description |
---|---|---|
path (required) | string | Path of the file to be added |
options (optional) | Object{} | - |
group (optional) | string | Group where the file will be added |
options
{
lastKnownFileType: undefined, // String
customFramework: undefined, // String
defaultEncoding: undefined, // String
explicitFileType: undefined // String
sourceTree: {} // Any
weak: false // Boolean
compilerFlags: {} // Any
embed: false // Boolean
sign: false // Boolean
}
Usage
xcode.addSourceFile('Pods/VisilabsIOS/Sources/TargetingAction/InAppNotification/Views/VisilabsFullNotificationViewController.xib', undefined, "Products")
Return
Returns the reference of the added file.
- removeProductFile(path, options)
Removes the file in the specified path from products in the project.
Params
Name | Type | Description |
---|---|---|
path (required) | string | Path of the file to be deleted |
options (optional) | Object{} | - |
options
{
lastKnownFileType: undefined, // String
customFramework: undefined, // String
defaultEncoding: undefined, // String
explicitFileType: undefined // String
sourceTree: {} // Any
weak: false // Boolean
compilerFlags: {} // Any
embed: false // Boolean
sign: false // Boolean
}
Usage
xcode.removeProductFile('Pods/VisilabsIOS/Sources/TargetingAction/InAppNotification/Views/VisilabsFullNotificationViewController.xib')
Return
Returns the reference of the deleted file.
- addProductFile(targetPath, options)
Adds the file in the specified path to products in the project.
Params
Name | Type | Description |
---|---|---|
targetPath (required) | string | Path of the file to be added |
options (optional) | Object{} | - |
options
{
lastKnownFileType: undefined, // String
customFramework: undefined, // String
defaultEncoding: undefined, // String
explicitFileType: undefined // String
sourceTree: {} // Any
weak: false // Boolean
compilerFlags: {} // Any
embed: false // Boolean
sign: false // Boolean
}
Usage
xcode.addProductFile('Pods/VisilabsIOS/Sources/TargetingAction/InAppNotification/Views/VisilabsFullNotificationViewController.xib')
Return
Returns the reference of the added file.
- removePluginFile(path, options)
Removes the specified data from the plugins group.
Params
Name | Type | Description |
---|---|---|
path (required) | string | Path of the file to be deleted |
options (optional) | Object{} | - |
options
{
lastKnownFileType: undefined, // String
customFramework: undefined, // String
defaultEncoding: undefined, // String
explicitFileType: undefined // String
sourceTree: {} // Any
weak: false // Boolean
compilerFlags: {} // Any
embed: false // Boolean
sign: false // Boolean
}
Usage
xcode.removePluginFile('Pods/VisilabsIOS/Sources/TargetingAction/InAppNotification/Views/VisilabsFullNotificationViewController.xib')
Return
Returns the reference of the deleted file.
- addPluginFile(path, options)
Adds the specified data to the plugins group.
Params
Name | Type | Description |
---|---|---|
path (required) | string | Path of the file to be added |
options (optional) | Object{} | - |
options
{
lastKnownFileType: undefined, // String
customFramework: undefined, // String
defaultEncoding: undefined, // String
explicitFileType: undefined // String
sourceTree: {} // Any
weak: false // Boolean
compilerFlags: {} // Any
embed: false // Boolean
sign: false // Boolean
}
Usage
xcode.addPluginFile('Pods/VisilabsIOS/Sources/TargetingAction/InAppNotification/Views/VisilabsFullNotificationViewController.xib')
Return
Returns the reference of the added file.
- addToPbxSourcesBuildPhase(file)
Adds a new file under BuildPhase > Compile Sources for the specified target.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
const target = xcode.getApplicationTarget();
const file = new PbxFile('./files/notificationExtension/Info.plist');
file.uuid = xcode.generateUuid();
file.fileRef = xcode.generateUuid();
file.target = target.uuid;
file.group = 'Sources';
xcode.addToPbxBuildFileSection(file)
xcode.addToPbxGroup(file, xcode.getFirstProject().firstProject.mainGroup)
xcode.addToPbxFileReferenceSection(file);
xcode.addToPbxSourcesBuildPhase(file)
- removeFromPbxResourcesBuildPhase(file)
Removes a new file from under BuildPhase > Compile Sources for the specified target.
Params
Name | Type | Description |
---|---|---|
file (required) | PBXFile | - |
Usage
const target = xcode.getApplicationTarget();
const infoPlist = xcode.getPbxBuildFile('Info.plist');
const file = new PbxFile('./files/notificationExtension/Info.plist');
file.fileRef = infoPlist.fileRef;
file.target = target.uuid
file.group = 'Sources';
xcode.removeFromPbxGroup(file, xcode.getFirstProject().firstProject.mainGroup)
xcode.removeFromPbxFileReferenceSection(file);
xcode.removeFromPbxBuildFileSection(file);
xcode.removeFromPbxSourcesBuildPhase(file);
- pbxProjectSection()
return PBXProject
- pbxFileReferenceSection()
return PbxFileReferenceSection
XMLModifier
It includes the functions that are required to edit XML files.
Usage
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { XMLModifier } = Modifiers;
const { android: { getManifest } } = Paths;
const xml = new XMLModifier(getManifest());
Methods
- parseAsync();
Converts the specified XML file into json.
Example
let parsedXmlObject = await xml.parseAsync();
Return
Return a promise.
Example parsedXmlObject return
{
'manifest': {
'$': {
'xmlns:android': 'http://schemas.android.com/apk/res/android',
'xmlns:tools': 'http://schemas.android.com/tools',
'package': 'com.akinon.base',
'android:versionCode': '1',
'android:versionName': '1.0'
},
'uses-permission': [...],
'application': [...]
}
}
- writeAsync(json);
Converts json into xml format and writes it to the file.
Params
Name | Type | Description |
---|---|---|
json (required) | Object {} | The object to be converted to the xml format |
Example
await xml.writeAsync(parsedXmlObject);
Return
Return a promise.
JavaModifier
It includes the functions that are required to edit java files.
Usage
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { JavaModifier } = Modifiers;
const { android: { getMainApplication } } = Paths;
const java = new JavaModifier(getMainApplication());
Methods
- addImports(imports, options);
Adds a new import to the java file.
Params
Name | Type | Description |
---|---|---|
import (required) | array [] | The packages to be imported |
options (optional) | object {} | - |
options
{
offset: 1 // Number
}
Example
java.addImports(['import com.reactnativedengage.DengageRNCoordinator;']);
Return
Returns the latest version of the java file in string format.
- addFunctions(functions);
Adds new functions to the java file.
Params
Name | Type | Description |
---|---|---|
functions (required) | array [] | The functions to be added to main class |
functions
{
name: "" // String
declaration: "" //Strings
}
Example
java.addFunctions([
{
name: "initThirdParty",
declaration: `
private void initThirdParty() {
DengageRNCoordinator coordinator = DengageRNCoordinator.Companion.getSharedInstance();
coordinator.injectReactInstanceManager(getReactNativeHost().getReactInstanceManager());
}
`
}
]);
Return
Returns the latest version of the java file in string format.
- patchOnCreate(patch);
Used to add code to onCreate function.
Params
Name | Type | Description |
---|---|---|
functions (required) | string"" | The code to be added to onCreate function |
Example
java.patchOnCreate('initThirdParty();');
Return
Returns the latest version of the java file in string format.
- patchFunction(params);
Used to add a code to a current function in the java file.
Params
Name | Type | Description |
---|---|---|
params (required) | object{} | Contains the configurations required for the patch process |
params
{
pattern: "" //String
declaration: "" //String
offset: 1 // Number
}
Example
const integrationKeyAndroid = "XXX"
java.patchFunction({
pattern: /private void initThirdParty\(\) \{/,
declaration: `
coordinator.setupDengage(
true,
"${integrationKeyAndroid}",
null
);
`,
offset: 3
});
Return
Returns the latest version of the java file in string format.
- writeAsync
Writes the latest version of the java file to disk.
Example
java.writeAsync();
Return
Return a promise
GradleModifier
It includes the functions that are required to edit gradle files.
Usage
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { GradleModifier } = Modifiers;
const gradle = new GradleModifier({
path: "",
content: "",
});
Methods
- addRepositoriesInBuildScript(patch, options);
Makes edits on the repositories field within buildscript in the specified field.
Params
Name | Type | Description |
---|---|---|
patch (required) | string"" | Edit to be made |
options (optional) | object{} | Patch options |
options
{
force: false //Force patch. If true, it doesn't matter if the patch is in the file or not.
}
Example
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { GradleModifier } = Modifiers;
const gradle = new GradleModifier(Paths.android.getBuildGradle());
gradle.addRepositoriesInBuildScript(`
maven {url 'http://developer.huawei.com/repo/'}
`);
Return
Returns the latest version of the gradle file in string format.
- addRepositoriesInAllProjects(patch, options);
Makes edits on the repositories field within allprojects in the specified field.
Params
Name | Type | Description |
---|---|---|
patch (required) | string"" | Edit to be made |
options (optional) | object{} | Patch options |
options
{
force: false //Force patch. If true, it doesn't matter if the patch is in the file or not.
}
Example
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { GradleModifier } = Modifiers;
const gradle = new GradleModifier(Paths.android.getBuildGradle());
gradle.addRepositoriesInAllProjects(`
maven { url 'https://maven.google.com'}
maven { url 'http://developer.huawei.com/repo/' }
maven { url "https://release.netmera.com/release/android" }
`);
Return
Returns the latest version of the gradle file in string format.
- addDependencies(patch);
Makes edits on the dependencies field in the specified field.
Params
Name | Type | Description |
---|---|---|
patch (required) | string"" | Edit to be made |
Example
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { GradleModifier } = Modifiers;
const gradle = new GradleModifier(Paths.android.getBuildGradle());
gradle.addDependencies(`
classpath 'com.huawei.agconnect:agcp:1.2.1.301'
`);
Return
Returns the latest version of the gradle file in string format.
- addApply(patch);
Adds new plugins to the specified file.
Params
Name | Type | Description |
---|---|---|
patch (required) | string"" | Plugins to be added |
Example
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { GradleModifier } = Modifiers;
const gradle = new GradleModifier(Paths.android.getAppBuildGradle());
gradle.addApply(`apply plugin: 'com.huawei.agconnect'`)
Return
Returns the latest version of the gradle file in string format.
- addDefaultConfig(patch);
Adds new fields to the defaultConfig field in the specified file.
Example
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { GradleModifier } = Modifiers;
const gradle = new GradleModifier(Paths.android.getAppBuildGradle());
gradle.addDefaultConfig(`
multiDexEnabled true`);
Return
Returns the latest version of the gradle file in string format.
- writeAsync()
Writes the latest version of the gradle file to disk.
Example
gradle.writeAsync();
Return
Return a promise
PlistModifier
It includes the functions that are required to edit plist files.
Usage
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { PlistModifier } = Modifiers;
const { ios: { getInfoPlist } } = Paths;
const plist = new PlistModifier(getInfoPlist());
Methods
- readAsync();
Parses the plist file to json. Desired changes must be made on the parsed object.
Example
const parsedInfoPlistObject = await plist.readAsync();
Return
Return a promise
Example parsedInfoPlistObject return
{
CFBundleDevelopmentRegion: 'en',
CFBundleDisplayName: 'Akinon',
CFBundleExecutable: '$(EXECUTABLE_NAME)',
CFBundleIdentifier: '$(PRODUCT_BUNDLE_IDENTIFIER)',
CFBundleInfoDictionaryVersion: '6.0',
CFBundleName: '$(PRODUCT_NAME)',
CFBundlePackageType: 'APPL',
CFBundleShortVersionString: '$(MARKETING_VERSION)',
CFBundleSignature: '????',
CFBundleVersion: '1',
CodePushDeploymentKey: '$(CODEPUSH_KEY)',
LSRequiresIPhoneOS: true,
NSAppTransportSecurity: {NSExceptionDomains:{localhost:[...]} },
NSUserTrackingUsageDescription: 'This app want to trach user data for better experience.',
NSCameraUsageDescription: 'This app requires access to the camera.',
NSLocationWhenInUseUsageDescription: 'This app requires access to the location.',
NSPhotoLibraryUsageDescription: 'This app requires access to the photo library.',
UILaunchStoryboardName: 'SplashScreenn',
UIRequiredDeviceCapabilities: [ 'armv7' ],
UIRequiresFullScreen: true,
UISupportedInterfaceOrientations: [ 'UIInterfaceOrientationPortrait' ],
UIViewControllerBasedStatusBarAppearance: false,
UIUserInterfaceStyle: 'Light'
}
- writeAsync(json);
Converts json to plist format and writes it to the file.
Params
Name | Type | Description |
---|---|---|
json (required) | object{} | Object to be converted to plist format |
Example
await plist.writeAsync(parsedInfoPlistObject);
Return
Return a promise.
PodModifier
It includes the functions that are required to edit podfile files.
Usage
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { PodModifier } = Modifiers;
const { ios: { getPodfile } } = Paths;
const pod = new PodModifier(getPodfile());
Methods
- addToTarget(target, patch)
Patches a target in podfile.
Params
Name | Type | Description |
---|---|---|
target (required) | string"" | Name of a target in podfile |
patch (required) | string"" | The code that needs to be add for the target |
Example
pod.addToTarget('akinon',`
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
`);
Return
Returns the latest version of the java file in podfile format.
- writeAsync
Writes the latest version of the podfile file to disk.
Example
pod.writeAsync();
Return
Return a promise
JsonModifier
It includes the functions that are required to edit json files.
Usage
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { JsonModifier } = Modifiers;
const { project: { getRootPackageJson } } = Paths;
const json = new JsonModifier(getRootPackageJson());
Methods
- readAsync();
Converts the file content to json object.
Example
await json.readAsync();
Return
Return a promise
- addDependencies(dependencies);
Adds the desired dependencies to the dependencies field in json object.
Params
Name | Type | Description |
---|---|---|
dependencies (required) | object{} | Dependencies you wish to add |
Example
json.addDependencies({
"react-native-notifications": "4.3.1"
});
- addDevDependencies(devDependencies);
Adds the desired dependencies to the devDependencies field in json object.
Params
Name | Type | Description |
---|---|---|
devDependencies (required) | object{} | Dependencies you wish to add |
Example
json.addDevDependencies({
"@babel/core": "7.12.9",
});
- writeAsync();
Writes the latest version of the json file to disk.
Example
json.writeAsync();
Return
Return a promise
FileModifier
Edits files together with regex patterns.
Usage
const { Modifiers } = require('akinon-plugin-adapter');
const { FileModifier } = Modifiers;
const file = new FileModifier({
"content": "",
"path": ""
});
Methods
- addLines(regexPattern, offset, patch)
Is Mapped to a line in the specified file with regex pattern and makes the necessary changes.
Params
Name | Type | Description |
---|---|---|
regextPattern (required) | regex | Regex that is used for line mapping |
offset (required) | number 1 | Indicates how many lines below the change will be made |
patch (required) | string "" | The code that needs to be changed |
Example
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { FileModifier } = Modifiers;
const file = new FileModifier(Paths.android.getMainApplication());
const pattern = /^package .*;$/;
file.addLines(pattern, 1, 'import com.reactnativedengage.DengageRNCoordinator;');
Return
Returns the latest version of the file in string format.
- replaceInFile(replacements)
Is mapped to a text in the specified file with regex pattern and changes that text.
Params
Name | Type | Description |
---|---|---|
replacements (required) | array[] | List of texts to be changed |
replacements
[
{
oldContent: "" // Regular expression
newContent: "" // New code string
}
]
Example
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { FileModifier } = Modifiers;
const file = new FileModifier(Paths.android.getMainApplication());
file.replaceInFile([
{
oldContent: /com\.akinon\.base/,
newContent: 'com.akinon.shop',
}
]);
Return
Returns the latest version of the file in string format.
- applyPatch(params, options)
Is mapped to texts in the specified file with regex pattern and changes that text.
Params
Name | Type | Description |
---|---|---|
params (required) | object{} | Required parameters for patching |
options (optional) | object{} | Patch options |
params
{
pattern: "" // Regular expression
patch: "" // Code string
}
options
{
force: false //Force patch. If true, it doesn't matter if the patch is in the file or not.
}
Example
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { FileModifier } = Modifiers;
const file = new FileModifier(Paths.android.getMainApplication());
file.applyPatch({
pattern: /^(.+?)(?=import)/gs,
patch: 'import android.os.Bundle;\n'
})
Return
Returns the latest version of the file in string format.
- addToEndOfFile(params)
Adds the specified patch to the end of the file.
Params
Name | Type | Description |
---|---|---|
params | object{} | Required parameters for patching |
params
{
patch: "" // Code string
}
Example
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { FileModifier } = Modifiers;
const file = new FileModifier(Paths.android.getProguard());
file.addToEndOfFile({
patch: '-keep class com.google.firebase.* { *; }'
});
Return
Returns the latest version of the specified file in string format.
- checkApplyPatch(params)
This is used for conditional patching. It’s useful for overlapping patches. If check pattern can match the texts in the file, the check patch is applied. If it cannot match, the same process is repeated for pattern and patch fields.
Params
Name | Type | Description |
---|---|---|
params (required) | object{} | Required parameters for patching |
params
{
check: {
pattern: "" // Regular expression
patch: "" // Code string
}
pattern: "" // Regular expression
patch: "" // Code string
}
Example
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { FileModifier } = Modifiers;
const file = new FileModifier(Paths.ios.getAppDelegate());
file.checkApplyPatch({
check: {
pattern: /.+(application didFailToRegisterForRemoteNotificationsWithError)+.+[.\n]*.*/,
patch: '[RNNotifications didFailToRegisterForRemoteNotificationsWithError:error];',
},
pattern: /return extraModules.*\s}\s/,
patch: `
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
[RNNotifications didFailToRegisterForRemoteNotificationsWithError:error];
}
`,
});
Return
Returns the latest version of the specified file in string format.
- copyFile(source, destination)
Is used to copy a file to a different path.
Params
Name | Type | Description |
---|---|---|
source (required) | string "" | Path of the file to be copied |
destination (required) | string "" | Path of the destination where the file will be copied |
Example
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const path = require("path");
const { FileModifier } = Modifiers;
const file = new FileModifier();
file.copyFile(
path.join(
__dirname,
`./files/notificationExtension/NotificationService.m`
),
path.join(
Paths.ios.getIosFolderPath().path,
`NotificationExtension/NotificationService.m`
)
);
- checkDirecytory(destination)
Checks the specified path. If not found, it creates a new directory.
Params
Name | Type | Description |
---|---|---|
destination (required) | string "" | Path of the file to be checked |
Example
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const path = require("path");
const { FileModifier } = Modifiers;
const file = new FileModifier();
file.checkDirectory(path.join(
Paths.ios.getIosFolderPath().path,
`NotificationExtension/File.swift`
));
- write(path, file)
Writes file content to the specified path.
Params
Name | Type | Description |
---|---|---|
path (optional) | string "" | File path |
file (optional) | string "" | File content |
Example
await file.write(file.path, file.content);
Return
Return a promise
- removeSync(path)
Deletes a file or folder.
Param
Name | Type | Description |
---|---|---|
path (required) | string "" | Path of the file or folder to be deleted |
Example
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const path = require("path");
const { FileModifier } = Modifiers;
const file = new FileModifier();
file.removeSync(path.join(
Paths.ios.getIosFolderPath().path,
`NotificationExtension/NotificationService.m`
));
- copySync(source, destination, options)
Copies a file or a folder.
Params
Name | Type | Description |
---|---|---|
source (required) | string "" | Path of the file or folder to be copied |
destination (required) | string "" | Path of the destination where it will be copied |
options (optional) | object{} | Copying options |
options
{
overwrite: true // Boolean
errorOnExist: false // Boolean
dereference: false // Boolean,
preserveTimestamps: false // Boolean
filter: Function // Function
}
Example
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const path = require("path");
const { FileModifier } = Modifiers;
const file = new FileModifier();
file.copySync(
path.join(
__dirname,
`./files/notificationExtension/`
),
path.join(
Paths.ios.getIosFolderPath().path,
`NotificationExtension/`
)
);
Paths
project
Methods
- getPath(filePath, options);
It is being used to get the path of the file.
Params
Name | Type | Description |
---|---|---|
filePath (required) | string "" | Path of the file |
options (optional) | object {} | - |
options
{
projectPath: String // Default "./",
absolute: Boolean // Default false
}
Example
const { Paths } = require('akinon-plugin-adapter');
const { project: { getPath } } = Paths;
const akinonJsonPath = getPath('akinon.json', { projectPath: "./" })
Example path return
"./akinon.json"
- getRootPackageJson(projectPath);
Returns the package.json file in the specified projectPath directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { project: { getRootPackageJson } } = Paths;
const rootPackageJson = getRootPackageJson();
Example rootPackageJson return
{
path: 'package.json',
content: 'package.json file content'
}
- getAkinonConfig(projectPath);
Returns the akinon.json file in the specified projectPath directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { project: { getAkinonConfig } } = Paths;
const akinonConfig = getAkinonConfig();
Example akinonConfig return
{
path: 'akinon.json',
content: 'akinon.json file content'
}
- getPluginDirectory(projectPath);
Returns the .plugins directory in the specified projectPath directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { project: { getPluginDirectory } } = Paths;
const pluginDirectory = getPluginDirectory();
Example pluginDirectory return
{
path: '.plugins'
}
- getPluginPath(plugin, projectPath);
Returns the path of plugin folder.
Params
Name | Type | Description |
---|---|---|
plugin (required) | object {} | Plugin config |
projectPath (optional) | string "" | Project path |
plugin
{
name: "" //Plugin folder name
}
Example
const { Paths } = require('akinon-plugin-adapter');
const { project: { getPluginPath } } = Paths;
const pluginPath = await getPluginPath({name: "testPlugin"});
Example pluginPath return
".plugins/testPlugin"
- getPlugins(projectPath);
Returns the dependencies/plugins.js file in the specified projectPath directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { project: { getPlugins } } = Paths;
const plugins = getPlugins();
Example plugins return
{
path: 'dependencies/plugins.js',
content: "plugins.js file content"
}
- getTempFolder(projectPath);
Returns the .temp directory in the specified projectPath directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { project: { getTempFolder } } = Paths;
const tempDirectory = getTempFolder();
Example tempDirectory return
{
path: '.temp'
}
android
Methods
- getManifest(projectPath)
Returns the AndroidManifest.xml file in the specified projectPath/android directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { android: { getManifest } } = Paths;
const manifest = getManifest();
Example manifest return
{
path: 'android/app/src/main/AndroidManifest.xml',
content: 'AndroidManifest.xml file content'
}
- getBuildGradle(projectPath)
Returns the build.gradle file in the specified projectPath/android directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { android: { getBuildGradle } } = Paths;
const buildGradle = getBuildGradle();
Example buildGradle return
{
path: 'android/build.gradle',
content: 'build.gradle file content'
}
- getAppBuildGradle(projectPath)
Returns the build.gradle file in the specified projectPath/android/app directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { android: { getAppBuildGradle } } = Paths;
const appBuildGradle = getAppBuildGradle();
Example appBuildGradle return
{
path: 'android/app/build.gradle',
content: 'build.gradle file content'
}
- getMainActivity(projectPath)
Returns the MainActivity.java file in the specified projectPath/android directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { android: { getMainActivity } } = Paths;
const mainActivity = getMainActivity();
Example mainActivity return
{
path: 'android/app/src/main/java/com/akinon/base/MainActivity.java',
content: 'MainActivity.java file content'
}
- getMainApplication(projectPath)
Returns the MainApplication.java file in the specified projectPath/android directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { android: { getMainApplication } } = Paths;
const mainApplication = getMainApplication();
Example mainApplication return
{
path: 'android/app/src/main/java/com/akinon/base/MainApplication.java',
content: 'MainApplication.java file content'
}
- getProguard(projectPath)
Returns the proguard-rules.pro file in the specified projectPath/android directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { android: { getProguard } } = Paths;
const proguard = getProguard();
Example proguard return
{
path: 'android/app/proguard-rules.pro',
content: 'proguard-rules.pro file content'
}
- getSettingsGradle(projectPath)
Returns the settings.gradle file in the specified projectPath/android directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { android: { getSettingsGradle } } = Paths;
const settingsGradle = getSettingsGradle();
Example settingsGradle return
{
path: 'android/settings.gradle',
content: 'settings.gradlew file content'
}
- getRes(projectPath)
Returns the specified projectPath/android/app/src/main/res directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { android: { getRes } } = Paths;
const res = getRes();
Example res return
{
path: 'android/app/src/main/res'
}
- getJavaPath(projectPath)
Returns the path of the package name in the android/app/src/main/java directory under the specified projectPath directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { android: { getJavaPath } } = Paths;
const javaPath = getJavaPath();
Example javaPath return
"android/app/src/main/java/com/akinon/base"
ios
Methods
- getAppDelegate(projectPath)
Returns the AppDelegate.m file in the ios/akinon directory under the specified projectPath directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { ios: { getAppDelegate } } = Paths;
const appDelegate = getAppDelegate();
Example appDelegate return
{
path: 'ios/akinon/AppDelegate.m',
content: 'AppDelegate.m file content'
}
- getAppDelegateHeader(projectPath)
Returns the AppDelegate.h file in the ios/akinon directory under the specified projectPath directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { ios: { getAppDelegateHeader } } = Paths;
const appDelegateHeader = getAppDelegateHeader();
Example appDelegateHeader return
{
path: 'ios/akinon/AppDelegate.h',
content: 'AppDelegate.h file content'
}
- getAppFolder(projectPath)
Returns the ios/akinon directory under the specified projectPath directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { ios: { getAppFolder } } = Paths;
const appFolder = getAppFolder();
Example appFolder return
{
path: 'ios/akinon'
}
- getIosFolder(projectPath)
Returns the ios directory under the specified projectPath directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { ios: { getIosFolder } } = Paths;
const iosFolder = getIosFolder();
Example iosFolder return
{
path: 'ios'
}
- getEntitlements(projectPath)
Returns the akinon/akinon.entitlements file under the specified projectPath/ios directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { ios: { getEntitlements } } = Paths;
const entitlements = getEntitlements();
Example entitlements return
{
path: 'ios/akinon/akinon.entitlements',
content: 'akinon.entitlements file content'
}
- getInfoPlist(projectPath);
Returns the ios/akinon/Info.plist file under the specified projectPath directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { ios: { getInfoPlist } } = Paths;
const infoPlist = getInfoPlist();
Example infoPlist return
{
path: 'ios/akinon/Info.plist',
content: 'Info.plist file content'
}
- getAllXcodeProjectPaths(projectPath);
Returns all .xcodeproj folders under the specified projectPath/ios directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { ios: { getAllXcodeProjectPaths } } = Paths;
const xcodeProjectPaths = getAllXcodeProjectPaths();
Example xcodeProjectPaths return
['ios/akinon.xcodeproj']
- getXcodeProject(projectPath);
Returns the akinpn.xcodeproj folder under the specified projectPath/ios directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { ios: { getXcodeProject } } = Paths;
const xcodeProject = getXcodeProject();
Example xcodeProject return
{
path: 'ios/akinon.xcodeproj'
}
- getAllPBXProjectPaths(projectPath);
Returns all project.pbxproj files under the specified projectPath/ios directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { ios: { getAllPBXProjectPaths } } = Paths;
const pbxProjectPaths = getAllPBXProjectPaths();
Example pbxProjectPaths return
['ios/akinon.xcodeproj/project.pbxproj']
- getPBXProjectPaths(projectPath);
Returns the project.pbxproj file under the specified projectPath/ios directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { ios: { getPBXProjectPaths } } = Paths;
const pbxProjectPaths = getPBXProjectPaths();
Example pbxProjectPaths return
{
path: 'ios/akinon.xcodeproj/project.pbxproj',
content: 'project.pbxproj file content'
}
- getPodfile(projectPath)
Returns the Podfile file under the specified projectPath/ios directory in object format.
Params
Name | Type | Description |
---|---|---|
projectPath (optional) | string "" | Project path |
Example
const { Paths } = require('akinon-plugin-adapter');
const { ios: { getPodfile } } = Paths;
const podfile = getPodfile();
Example podfile return
{
path: 'ios/Podfile',
content: 'Podfile file content'
}
Types
Xcode
Target
Name | Type |
---|---|
isa | string |
name | string |
productName | string |
productReference | string |
productType | string |
buildConfigurationList | string |
buildPhases | Array |
buildRules | Array |
dependencies | Array |
BuildFileSection
Name | Type |
---|---|
isa | string |
fileRef | string |
fileRef_comment | string |
PbxGroup
Name | Type |
---|---|
isa | string |
children | array |
name | string |
path | string |
sourceTree | string |
children
{
value: "" // String
comment: "" //String
}
PbxFile
Name | Type |
---|---|
basename | string |
lastKnownFileType | string |
group | string |
path | string |
defaultEncoding | number |
fileEncoding | number |
sourceTree | string |
includeInIndex | number |
fileRef | string |
XCConfigurationList
Name | Type |
---|---|
isa | string |
buildConfigurations | array |
defaultConfigurationIsVisible | number |
defaultConfigurationName | string |
XCConfigurationSection
Name | Type |
---|---|
isa | string |
buildConfigurations | array |
name | string |
PBXProject
Name | Type |
---|---|
isa | String |
attributes | Object |
buildConfigurationList | String |
buildConfigurationList_comment | String |
compatibilityVersion | String |
developmentRegion | String |
hasScannedForEncodings | Number |
knownRegions | Array |
mainGroup | String |
productRefGroup | String |
productRefGroup_comment | String |
projectDirPath | String |
projectRoot | String |
targets | Array |
PBXCopyFilesBuildPhase
Name | Type |
---|---|
buildActionMask | String |
dstPath | String |
dstSubfolderSpec | Number |
files | Array |
isa | String |
name | String |
runOnlyForDeploymentPostprocessing | Number |