Skip to content

feat: add generate command #3870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Sep 15, 2018
Merged

feat: add generate command #3870

merged 13 commits into from
Sep 15, 2018

Conversation

sis0k0
Copy link
Contributor

@sis0k0 sis0k0 commented Sep 6, 2018

PR Checklist

tns generate

This PR introduces a new command - tns generate. The command uses schematics-executor for performing project modifications. The modifications are described with schematic rules, which are part of schematic collections. Each collection is distributed inside a node package. The default collection used by the tns generate command is @nativescript/schematics.

Usage

Arguments

The command has one required argument - the name of the executed schematic. For example, if we want to run the component schematic, the executed command is:

tns generate component

Schematic options

The executed schematic may have options. They are provided without the '--' prefix.
In the following example, the command generates a component using the component schematic and specifies the name and module options.

tns generate component name=my-component module=app 

The schematic options are specified with a schema that's different for each schematic. I couldn't find a way to execute the CLI command with dynamic options ( with --). That's why the schematic options are provided as arguments (without --) and then are validated against the schema by the schematic executor.

Specifying collection

The default collection is @nativescript/schematics. Different collection can be specified with the --collection option:

tns generate component --collection=@schematics/angular name=my-component module=app

Implements one of the features described in #3860.

Copy link
Contributor

@rosen-vladimirov rosen-vladimirov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After fixing the shrinkwrap

@sis0k0
Copy link
Contributor Author

sis0k0 commented Sep 14, 2018

run ci

@sis0k0 sis0k0 merged commit 76ff072 into master Sep 15, 2018
@sis0k0 sis0k0 deleted the sis0k0/generate-2 branch September 15, 2018 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants