Angular-cli: (schematics documentation) Add more sources

Created on 5 Sep 2018  路  13Comments  路  Source: angular/angular-cli

_From @MonsieurMan on January 21, 2018 19:47_

Hello, I looked over the project because it seemed to me like I could use it for a project I have in mind and couldn't really find a simple dive in introduction.
Until I found the meetup presentation introducing it.
I think it should be added to the head of the readme to help people understand the package as of now, it really helped me understand quickly and I know we're going to use it for at least two projects.

If you know of any information sources you produced like this one I think you should point them out in the head of the readme or something.

Anyway, keep up the good job, I feel like front end development is getting healthier thanks to the trust you and the react community are creating !

_Copied from original issue: angular/devkit#402_

devkischematics triage #1 docs

All 13 comments

_From @filipesilva on January 25, 2018 14:9_

@hansl I think you were working on some more Schematics docs, are they available yet?

_From @Toxicable on February 12, 2018 20:10_

There's this here
https://blog.angular.io/schematics-an-introduction-dc1dfbc2a2b2
and the source code here is well commented on how to use schematics programtically
https://github.com/angular/devkit/blob/master/packages/angular_devkit/schematics_cli/bin/schematics.ts

@alexeagle

and the source code here is well commented on how to use schematics programtically

The link is broken on master, it's available on 6.0 though:
https://github.com/angular/devkit/blob/6.1.x/packages/angular_devkit/schematics_cli/bin/schematics.ts

As for the documentation maybe they could be written in the open ?
A lot of projects are already using schematics now anyway, so even an unfinished or unpolished documentation would be great !

I also came here looking for the latest current version of the schematics docs after finding that previous links to the old minimal version of docs/markdown are now broken.

What's the current recommended resource for schematics documentation relevant to devkit 0.8.x or Angular CLI 6.2.x?

Can anyone suggest some unofficial schematics blog posts/videos that are updated in the last 2 months or so?

Hrm. So much has changed lately... Note that I am trying to use only the Schematics CLI (not Angular CLI).

schematics @schematics/angular:application tmp gives me:

Error: Could not find (undefined)
    at Object.getWorkspace (/Users/splaktar/.nvm/versions/node/v8.11.3/lib/node_modules/@schematics/angular/utility/config.js:22:15)

But https://blog.angular.io/schematics-an-introduction-dc1dfbc2a2b2 doesn't cover or mention workspaces at all. The Angular CLI has a wiki entry for workspaces, but it doesn't indicate the schematics command to create one.

Even running schematics blank my-project doesn't create a "workspace" since it creates a project for writing schematics which doesn't create an angular.json file.

schematics @schematics/angular:workspace --name=tmp gives

Error: Schematic input does not validate against the Schema: {"name":"tmp","skipInstall":false,"linkCli":false,"skipGit":false,"commit":null}
Errors:

  Data path "" should have required property 'version'.
    at MapSubscriber.registry.compile.pipe.operators_1.map.result [as project] (/Users/splaktar/.nvm/versions/node/v8.11.3/lib/node_modules/@angular-devkit/schematics-cli/node_modules/@angular-devkit/schematics/tools/schema-option-transform.js:30:27)

It's not at all clear what the version should be... but https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/workspace/schema.json#L69-L77 seems to indicate that this would be the version of the Angular CLI to use.

schematics @schematics/angular:workspace --name=tmp --version=6.2.1 finally gives me

CREATE /README.md (1020 bytes)
CREATE /angular.json (127 bytes)
CREATE /package.json (1262 bytes)
CREATE /tsconfig.json (408 bytes)
CREATE /tslint.json (2837 bytes)
CREATE /.editorconfig (245 bytes)
CREATE /.gitignore (503 bytes)

Of course this created the "workspace" in my CWD and not in tmp/ as I would have expected. So I then need to mkdir tmp && cd tmp/ and then run it again...

And finally I can run schematics @schematics/angular:application --name=tmp to create the app.

The best docs that I have found are Manfred Steyer's eBook: https://leanpub.com/angular-schematics/

It covers using the Schematics CLI (and the included schematics in @schematics/schematics) but it does not cover the details of using the schematics in an external collection like @schematics/angular (i.e. workspace, application, component, etc).

This older schematics documentation issue also has some links to resources (most are likely out of date): https://github.com/angular/angular-cli/issues/7627

Work is in progress on the official schematics documentation. I will try to post here when it is up on next.angular.io.

The first draft of the official schematics docs is about to land in Angular master: PR https://github.com/angular/angular/pull/28343 馃帀

And it's available for preview here: https://next.angular.io/guide/schematics

Closing as the initial set of schematic docs is now present on AIO (https://angular.io/guide/schematics). Further updates and improvements may be best tracked separately. The original issue is now over 2 years old.

Additional Schematics docs improvements are being tracked in https://github.com/angular/angular/issues/29241

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rajjejosefsson picture rajjejosefsson  路  3Comments

ericel picture ericel  路  3Comments

naveedahmed1 picture naveedahmed1  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

MateenKadwaikar picture MateenKadwaikar  路  3Comments