Skip to content

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

@Splaktar

Description

@Splaktar

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions