Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Schematics #1

Merged
merged 12 commits into from
Jun 7, 2017
Merged

Schematics #1

merged 12 commits into from
Jun 7, 2017

Conversation

hansl
Copy link
Contributor

@hansl hansl commented May 23, 2017

No description provided.

@hansl hansl force-pushed the schematics branch 2 times, most recently from 4312e53 to cefa68a Compare May 26, 2017 00:36
@hansl hansl force-pushed the schematics branch 2 times, most recently from 974e60a to 18b3878 Compare June 2, 2017 02:23

1. Create the Schematic Engine, and pass in a Collection and Schematic loader.
1. Understand and respect the Schematics metadata and dependencies between collections. Schematics can refer to dependencies, and it's the responsibility of the tool to honor those dependencies. The reference CLI uses NPM packages for its collections.
1. Create the Options object. Options can be anything, but the schematics can specify a JSON Schema that should be respected. The reference CLI, for example, parse the arguments as a JSON object and validate it with the Schema specified by the collection.
Copy link
Contributor

Choose a reason for hiding this comment

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

parse->parses

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

The tooling API is composed of the following pieces:

## Engine
The `SchematicEngine` is responsible for loading and constructing `Collection`s and `Schematics`'. When creating an engine, the tooling provides an `EngineHost` interface that understands how to create a `CollectionDescription` from a name, and how to create a `Schematic
Copy link
Contributor

Choose a reason for hiding this comment

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

Unclosed backtick at `Schematic

* found in the LICENSE file at https://angular.io/license
*/

export class BaseException extends Error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It works in Node, I had that discussion with a lot of folks already.

Copy link

Choose a reason for hiding this comment

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

I assume you're building down to ES2015 and requiring Node 7+ (I think), then? Because the only problems come if you're targeting ES5. If that's the case, you just need to add Object.setPrototypeof(this, BaseException.prototype) in the constructor, and you'll be fine in any version of Node.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we're targeting ES2015.


module.exports = function (config) {
config.set({
basePath: '),
Copy link
Contributor

Choose a reason for hiding this comment

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

'),->''

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Not sure how that ended up here.

Copy link
Contributor

@filipesilva filipesilva left a comment

Choose a reason for hiding this comment

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

Went through the big bits with Hans on a call, looks really good. Reference CLI has some really clean and descriptive usage patterns.

Great work on this Hans 👍

@hansl hansl force-pushed the schematics branch 5 times, most recently from 0c0a350 to 39f093d Compare June 2, 2017 22:44
hansl added 2 commits June 2, 2017 15:45
Better separation of concern between tooling and schematic library.

Engine, Collection and Schematic now take a generic type that can add tooling-specific metadata to each
parts, in a type-safe manner.

Context exposed to schematics is a context of <any, any>, while the tool should use TypedContext for
better support internally.

The Engine Host now only deals with Descriptions of collection and
schematics, does not deal with actual implementation.

Renamed CliEngineHost to NodeModulesEngineHost, since its kind of reusable if you only implement a NodeModules
schematic tool. Tempted to move this into the schematics library as its highly reusable.

Added tooling/ in the schematics package, which contains implementations
of some interfaces that should contain conventions.
hansl added 3 commits June 3, 2017 10:02
Also, separation of concern for engine host has been improved, and a simple base implementation
has been added. Tools should use this (or any subclasses provided) to implement their own
EngineHost. This includes Google, which will use the FileSystem based one, and the Workbench
which will use the Registry one.
"blueprints",
"code generation",
"schematics",
"Angular SDK"
Copy link
Contributor

Choose a reason for hiding this comment

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

sdk -> devkit
Angular SDK -> Angular DevKit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

],
"repository": {
"type": "git",
"url": "https://github.com/angular/sdk.git"
Copy link
Contributor

Choose a reason for hiding this comment

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

repo name/url has changed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

"bugs": {
"url": "https://github.com/angular/sdk/issues"
},
"homepage": "https://github.com/angular/sdk",
Copy link
Contributor

Choose a reason for hiding this comment

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

angular/devkit again

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

export * from './utility/path';


export interface TreeConstructor {
Copy link
Contributor

Choose a reason for hiding this comment

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

I find it odd to have these tree definitions inside index.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needs to be done where it's exported, but not in the interface definition (there's a circular dependency).

import {BaseException} from '../exception/exception';

import {Observable} from 'rxjs/Observable';
import 'rxjs/add/observable/fromPromise';
Copy link
Contributor

Choose a reason for hiding this comment

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

fromPromise is not used

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

c: 2
});
});
});
Copy link
Member

Choose a reason for hiding this comment

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

Newline

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Added linting too.

],
"repository": {
"type": "git",
"url": "https://github.com/angular/sdk.git"
Copy link
Member

Choose a reason for hiding this comment

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

devkit, not sdk

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

"author": "Angular Authors",
"license": "MIT",
"bugs": {
"url": "https://github.com/angular/sdk/issues"
Copy link
Member

Choose a reason for hiding this comment

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

devkit, not sdk

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

"url": "https://github.com/angular/sdk/issues"
},
"schematics": "./schematics/collection.json",
"homepage": "https://github.com/angular/sdk",
Copy link
Member

Choose a reason for hiding this comment

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

devkit, not sdk

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Also added linting and fix those and a travis configuration.
@hansl hansl merged commit 7f00fe3 into angular:master Jun 7, 2017
*/
import {FileSystemSink} from './filesystem';

import {Observable} from 'rxjs';
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer import {Observable} from 'rxjs/Observable';

@Brocco
Copy link
Contributor

Brocco commented Jun 12, 2017

@wKoza agreed, want to submit a PR for that one and the import of Subject below as well?

@wKoza wKoza mentioned this pull request Jun 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants