You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -199,6 +205,66 @@ Returns the default content of "nsconfig.json" merged with the properties provid
199
205
getNsConfigDefaultContent(data?:Object): string
200
206
```
201
207
208
+
### getAssetsStructure
209
+
Gives information about the whole assets structure for both iOS and Android. For each of the platforms, the returned object will contain icons, splashBackgrounds, splashCenterImages and splashImages (only for iOS).
210
+
* Definition:
211
+
```TypeScript
212
+
/**
213
+
* Gives information about the whole assets structure for both iOS and Android.
214
+
* For each of the platforms, the returned object will contain icons, splashBackgrounds, splashCenterImages and splashImages (only for iOS).
215
+
* @param{IProjectDir}opts Object with a single property - projectDir. This is the root directory where NativeScript project is located.
216
+
* @returns{Promise<IAssetsStructure>} An object describing the current asset structure.
.then(assetsStructure=>console.log(`The current assets structure for Android is ${JSON.stringify(assetsStructure, null, 2)}.`))
265
+
.catch(err=>console.log("Failed to get assets structure."));
266
+
```
267
+
202
268
## extensibilityService
203
269
`extensibilityService` module gives access to methods for working with CLI's extensions - list, install, uninstall, load them. The extensions add new functionality to CLI, so once an extension is loaded, all methods added to it's public API are accessible directly through CLI when it is used as a library. Extensions may also add new commands, so they are accessible through command line when using NativeScript CLI.
Contains various constants related to NativeScript.
1015
1081
1082
+
## assetsGenerationService
1083
+
`assetsGenerationService` module allows generation of assets - icons and splashes.
1084
+
1085
+
### generateIcons
1086
+
The `generateIcons` method generates icons for specified platform (or both iOS and Android in case platform is not specified) and places them on correct location in the specified project.
1087
+
1088
+
* Definition:
1089
+
```TypeScript
1090
+
/**
1091
+
* Generate icons for iOS and Android
1092
+
* @param{IResourceGenerationData}iconsGenerationData Provides the data needed for icons generation
The `generateSplashScreens` method generates icons for specified platform (or both iOS and Android in case platform is not specified) and places them on correct location in the specified project.
1109
+
1110
+
* Definition:
1111
+
```TypeScript
1112
+
/**
1113
+
* Generate splash screens for iOS and Android
1114
+
* @param{ISplashesGenerationData}splashesGenerationData Provides the data needed for splash screens generation
CLI is designed as command line tool and when it is used as a library, it does not give you access to all of the methods. This is mainly implementation detail. Most of the CLI's code is created to work in command line, not as a library, so before adding method to public API, most probably it will require some modification.
1018
1132
For example the `$options` injected module contains information about all `--` options passed on the terminal. When the CLI is used as a library, the options are not populated. Before adding method to public API, make sure its implementation does not rely on `$options`.
`$ tns resources generate icons <Path to image>` | Generate all icons for Android and iOS based on the specified image.
10
+
11
+
Generates all icons for Android and iOS platforms and places the generated images in the correct directories under `App_Resources/<platform>` directory.
12
+
13
+
### Attributes
14
+
*`<Path to image>` is a valid path to an image that will be used to generate all icons.
15
+
16
+
<% if(isHtml) { %>
17
+
### Related Commands
18
+
19
+
Command | Description
20
+
----------|----------
21
+
[install](../install.html) | Installs all platforms and dependencies described in the `package.json` file in the current directory.
22
+
[platform add](../platform-add.html) | Configures the current project to target the selected platform.
23
+
[platform remove](../platform-remove.html) | Removes the selected platform from the platforms that the project currently targets.
24
+
[platform](../platform.html) | Lists all platforms that the project currently targets.
25
+
[prepare](../prepare.html) | Copies common and relevant platform-specific content from the app directory to the subdirectory for the selected target platform in the platforms directory.
26
+
[resources update](resources-update.md) | Updates the `App_Resources/Android` internal folder structure to conform to that of an Android Studio project.
27
+
[resources generate splashes](resources-generate-splashes.md) | Generates splashscreens for Android and iOS.
`$ tns resources generate splashes <Path to image> [<background>]` | Generate all splashscreens for Android and iOS based on the specified image.
10
+
11
+
Generates all icons for Android and iOS platforms and places the generated images in the correct directories under `App_Resources/<platform>` directory.
12
+
13
+
### Attributes
14
+
*`<Path to image>` is a valid path to an image that will be used to generate all splashscreens.
15
+
*`<background>` is a valid path to an image that will be used as a background of the splashscreen. Defaults to white in case it is not specified.
16
+
17
+
<% if(isHtml) { %>
18
+
### Related Commands
19
+
20
+
Command | Description
21
+
----------|----------
22
+
[install](../install.html) | Installs all platforms and dependencies described in the `package.json` file in the current directory.
23
+
[platform add](../platform-add.html) | Configures the current project to target the selected platform.
24
+
[platform remove](../platform-remove.html) | Removes the selected platform from the platforms that the project currently targets.
25
+
[platform](../platform.html) | Lists all platforms that the project currently targets.
26
+
[prepare](../prepare.html) | Copies common and relevant platform-specific content from the app directory to the subdirectory for the selected target platform in the platforms directory.
27
+
[resources update](resources-update.md) | Updates the `App_Resources/Android` internal folder structure to conform to that of an Android Studio project.
28
+
[resources generate icons](resources-generate-icons.md) | Generates icons for Android and iOS.
Updates the App_Resources/<platform>'s internal folder structure to conform to that of an Android Studio project. Android resource files and directories will be located at the following paths:
14
-
-`drawable-*`, `values`, `raw`, etc. can be found at `App_Resources/Android/src/main/res`
14
+
-`drawable-*`, `values`, `raw`, etc. can be found at `App_Resources/Android/src/main/res`
15
15
-`AndroidManifest.xml` can be found at `App_Resources/Android/src/main/AndroidManifest.xml`
16
16
- Java source files can be dropped in at `App_Resources/Android/src/main/java` after creating the proper package subdirectory structure
17
17
- Additional arbitrary assets can be dropped in at `App_Resources/Android/src/main/assets`
publicallowedParameters: ICommandParameter[]=[this.$stringParameterBuilder.createMandatoryParameter("You have to provide path to image to generate other images based on it.")];
0 commit comments