Skip to content
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

schematics-cli: running a schematic does not commit it to disk #12599

Closed
Splaktar opened this issue Oct 15, 2018 · 2 comments · Fixed by #12607
Closed

schematics-cli: running a schematic does not commit it to disk #12599

Splaktar opened this issue Oct 15, 2018 · 2 comments · Fixed by #12607

Comments

@Splaktar
Copy link
Member

Splaktar commented Oct 15, 2018

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
- [x] schematics

Versions

Angular CLI: 7.0.0-rc.3
Node: 10.11.0
OS: darwin x64
Angular: undefined
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.9.0-rc.3 (cli-only)
@angular-devkit/core         7.0.0-rc.3
@angular-devkit/schematics   7.0.0-rc.3
@schematics/angular          7.0.0-rc.3 (cli-only)
@schematics/update           0.9.0-rc.3 (cli-only)
rxjs                         6.3.3
typescript                   2.9.2
npm ls -g --depth=0
/Users/splaktar/.nvm/versions/node/v10.11.0/lib
├── @angular-devkit/schematics-cli@0.9.0-rc.3
├── @angular/cli@7.0.0-rc.3

Repro steps

  1. Create a new schematics project using schematics schematic --name=test-schematic.
  2. cd test-schematic
  3. npm i
  4. npm run build
  5. schematics .:my-full-schematic --name=test

The log given by the failure

schematics .:my-full-schematic --name=test
    My Full Schematic: {"name":"test","index":1}
            My Other Schematic: {"option":true}
                        My Schematic: {"option":true}
CREATE /hola (5 bytes)
CREATE /allo (5 bytes)
CREATE /test2 (34 bytes)
CREATE /test1 (18 bytes)

You can see above that is at least outputs the --dryRun results, but since I didn't specify --dryRun, it should commit them to disk. I also tried with --dryRun=false but the behavior was the same.

devintent:test-schematic splaktar$ ls
README.md               node_modules            package-lock.json       package.json            src                     tsconfig.json
devintent:test-schematic splaktar$ ls /
Applications                    System                          Volumes                         dev                             installer.failurerequests       private                         usr
Library                         User Information                bin                             etc                             net                             sbin                            var
Network                         Users                           cores                           home                            opt                             tmp

You can see above that there are no files named hola, allo, etc.

Desired functionality

I should be able to run a schematic locally when authoring/testing a schematic and see the output get committed to disk if there are no errors.

Mention any other details that might be useful

I also saw this with @angular-devkit/schematics-cli@0.9.0-rc.2.

@alan-agius4
Copy link
Collaborator

@Splaktar I have looked into this, and since the you are running the schematic locally, by default it will be running in a dry run To disable this you need to use --dry-run=false.

I noticed that at the moment only kebab case args are available, I'll do a PR to address this.

kyliau pushed a commit that referenced this issue Oct 23, 2018
…ents

At the moment, only kebab case args works, and this might be misleading if you come from the Angular CLI. As for instance `--dryRun` will have no effect.

Fixes #12599
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants