Skip to content

feat(@angular/cli): Update generate & new to use schematics #7090

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 1 commit into from
Aug 16, 2017

Conversation

Brocco
Copy link
Contributor

@Brocco Brocco commented Jul 21, 2017

This feature is related to #6593

}
],

anonymousOptions: [
'<blueprint>'
'<schemtatic>'
Copy link
Contributor

Choose a reason for hiding this comment

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

schemtatic -> schematic

Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix.

@@ -34,117 +60,109 @@ export default Command.extend({
description: 'Run through without making any changes.'
},
{
name: 'lint-fix',
Copy link
Contributor

Choose a reason for hiding this comment

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

--lint-fix still needs to exist as an option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is in and working

},

beforeRun: function(rawArgs: string[]) {
const collection = getCollection(this.getCollectionName(rawArgs));

const isHelp = ['--help', '-h'].includes(rawArgs[0]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you printing schematic description on --help?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Possibly, I want to get it all working first before worrying about tweaking the help output.

Copy link
Contributor

Choose a reason for hiding this comment

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

We definitely want this.

@@ -58,7 +58,7 @@ export default function () {
`))
.then(() => silentExec(normalize('node'), 'index.js'))
.then(() => expectFileToMatch('dist/index.html',
new RegExp('<h2 _ngcontent-c0="">Here are some links to help you start: </h2>')))
new RegExp('<h2>Here are some links to help you start: </h2>')))
Copy link
Contributor

Choose a reason for hiding this comment

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

I looked at this with @Brocco and as far as I could tell, _ngcontent-c0="" wasn't in the output of prerendering for the versions I tested. Prerendering was still happening correctly though.

@zeiv
Copy link

zeiv commented Jul 22, 2017

I've been following this feature and addon support for a while now. This looks fantastic! Can't wait to try this out. 👍 👍

Copy link
Contributor

@hansl hansl left a comment

Choose a reason for hiding this comment

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

early comments.

@@ -32,7 +32,7 @@ export class CliConfig extends CliConfigBase<ConfigInterface> {
const projectConfig = CliConfig.fromProject();
if (projectConfig) {
value = projectConfig.get(jsonPath);
} else if (CliConfig.globalConfigFilePath() !== CliConfig.configFilePath()) {
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious about this change. Why is this different now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should be in a new PR... it breaks the way we pull config values.

}
],

anonymousOptions: [
'<blueprint>'
'<schemtatic>'
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix.

import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import { cyan, yellow } from 'chalk';
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like this should be a task, rather than changing the build command directly, and that the new commands should reuse the task and pass in the different name for the schematics from the config.

@Brocco Brocco force-pushed the schematics branch 2 times, most recently from 1d38827 to 276f73d Compare August 8, 2017 21:45
let error = false;
const loggingQueue: string[] = [];

dryRunSink.reporter.subscribe((event: DryRunEvent) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should stick to the current format for logging:
image

@hansl
Copy link
Contributor

hansl commented Aug 8, 2017

I'm going to have to add comments about schematics themselves here, unfortunately.

New e2e are generated with MyProjectPage instead of AppPage. We want to at least document that change in the commit and the release notes.

@Brocco Any reason the baseUrl value in tsconfig.app.json and tsconfig.spec.json changed? This can have a real impact on the development workflow for apps.

@hansl
Copy link
Contributor

hansl commented Aug 8, 2017

And help remains a big factor. We need to support help right away.

@cyrilletuzi
Copy link
Contributor

@hansl I don't see any baseUrl change in this commit, but maybe you mean some relative changes. And as you mention this, I would like to point your attention to this : baseUrl has already been changed twice. Each time, issues emerged (see #5875 for the first change, and #7135).

baseUrl can't change everytime, it should be stable.

@Brocco Brocco force-pushed the schematics branch 2 times, most recently from 83eba07 to f1e5b13 Compare August 9, 2017 20:08
@@ -92,6 +92,7 @@ export default Task.extend({
});

return new Promise((resolve, reject) => {
console.log(opts);
Copy link
Contributor

Choose a reason for hiding this comment

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

debugging info?

@Brocco Brocco force-pushed the schematics branch 6 times, most recently from 32f4ec1 to d314b8a Compare August 16, 2017 12:37
@Brocco Brocco removed the state: WIP label Aug 16, 2017
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.

Minor non-blocking comments, other than that LGTM.

filipesilva
filipesilva previously approved these changes Aug 16, 2017
};
preppedOptions = {
...preppedOptions,
...normalizeOptions(schematic.description.name, keys, options)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be part of the previous declaration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, because the options may have been updated from one statement to the next.

if (!commandOptions.dryRun) {
process.chdir(commandOptions.directory);
}
})
.then(function () {
if (!commandOptions.skipInstall) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like a lapse that install still happens on a dry run. If only schematicRunTask.run is meant to happen on dry runs, it sounds better to wholly skip the promise chain after that when dry run is on.

}
})
.then(() => ng('generate', 'component', 'test-component'))
.then((output) => {
if (!output.stdout.match(/identical src[\\|\/]app[\\|\/]app.module.ts/)) {
if (!output.stdout.match(/ERROR! src[\\|\/]app[\\|\/]test-component[\\|\/]test-component.component.ts already exists./)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be a merge strategy problem in Schematics itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The merge strategy is being passed in via the CLI... the only change to force (pun intended) this behavior is to change --force's default to be true.

Copy link
Contributor

@hansl hansl left a comment

Choose a reason for hiding this comment

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

LGTM

@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 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants