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
fix: plugin create command needs more args for plugin seed
There are two new prompts in the plugin seed which require new command line options to be passed from CLI. Handle the new prompts and pass the new options. They can be used in automation scripts.
In order to prevent such issue in the future, ensure the spawned process's stdout and stdin are inherited, so if there's a prompt in the plugin seed, CLI will show it to the user.
Copy file name to clipboardExpand all lines: docs/man_pages/lib-management/plugin-create.md
+2
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,8 @@ Create from a custom plugin seed | `$ tns plugin create <Plugin Repository Name>
28
28
*`--path` - Specifies the directory where you want to create the project, if different from the current directory.
29
29
*`--username` - Specifies the Github username, which will be used to build the URLs in the plugin's package.json file.
30
30
*`--pluginName` - Used to set the default file and class names in the plugin source.
31
+
*`--includeTypeScriptDemo` - Specifies if TypeScript demo should be created. Default value is `y` (i.e. `demo` will be created), in case you do not want to create this demo, pass `--includeTypeScriptDemo=n`
32
+
*`--includeAngularDemo` - Specifies if Angular demo should be created. Default value is `y` (i.e. `demo-angular` will be created), in case you do not want to create this demo, pass `--includeAngularDemo=n`
31
33
*`--template` - Specifies the custom seed archive, which you want to use to create your plugin. If `--template` is not set, the NativeScript CLI creates the plugin from the default NativeScript Plugin Seed. `<Template>` can be a URL or a local path to a `.tar.gz` file with the contents of a seed repository.<% if(isHtml) { %> This must be a clone of the [NativeScript Plugin Seed](https://github.com/NativeScript/nativescript-plugin-seed) and must contain a `src` directory with a package.json file and a script at `src/scripts/postclone.js`. After the archive is extracted, the postclone script will be executed with the username (`gitHubUsername`) and plugin name (`pluginName`) parameters given to the `tns plugin create` command prompts. For more information, visit the default plugin seed repository and [examine the source script](https://github.com/NativeScript/nativescript-plugin-seed/blob/master/src/scripts/postclone.js) there. Examples:
Copy file name to clipboardExpand all lines: lib/commands/plugin/create-plugin.ts
+27-6
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,8 @@ export class CreatePluginCommand implements ICommand {
5
5
publicallowedParameters: ICommandParameter[]=[];
6
6
publicuserMessage="What is your GitHub username?\n(will be used to update the Github URLs in the plugin's package.json)";
7
7
publicnameMessage="What will be the name of your plugin?\n(use lowercase characters and dashes only)";
8
+
publicincludeTypeScriptDemoMessage='Do you want to include a "TypeScript NativeScript" application linked with your plugin to make development easier?';
9
+
publicincludeAngularDemoMessage='Do you want to include an "Angular NativeScript" application linked with your plugin to make development easier?';
8
10
publicpathAlreadyExistsMessageTemplate="Path already exists and is not empty %s";
9
11
constructor(private$options: IOptions,
10
12
private$errors: IErrors,
@@ -62,15 +64,25 @@ export class CreatePluginCommand implements ICommand {
it("should pass with project name, username and pluginName set with no prompt in interactive shell.",async()=>{
161
+
it("should pass when includeTypeScriptDemo is passed with command line option and all other options are populated with prompts in interactive shell.",async()=>{
it("should pass when includeAngularDemo is passed with command line option and all other options are populated with prompts in interactive shell.",async()=>{
0 commit comments