1
0
mirror of https://github.com/angular/angular-cli.git synced 2025-05-24 16:16:27 +08:00

feat(update): add ng update as alias of ng init ()

Fix 
This commit is contained in:
Filipe Silva 2017-01-31 00:24:13 +00:00 committed by Hans
parent 49d15b311b
commit 2211172ffb
6 changed files with 14 additions and 14 deletions
README.md
docs
packages/angular-cli/commands
tests/acceptance

@ -125,7 +125,7 @@ The CLI supports routing in several ways:
The `--routing` option also generates a default component with the same name as the module.
- You can use the `--routing` option with `ng new` or `ng init` to create a `app-routing.module.ts` file when you create or initialize a project.
- You can use the `--routing` option with `ng new` to create a `app-routing.module.ts` file when you create or initialize a project.
<!-- DeleteSection1 Start here to remove upon next release -->
### Creating a build
@ -440,12 +440,12 @@ Local project package:
rm -rf node_modules dist # use rmdir on Windows
npm install --save-dev angular-cli@latest
npm install
ng init
ng update
```
Running `ng init` will check for changes in all the auto-generated files created by `ng new` and allow you to update yours. You are offered four choices for each changed file: `y` (overwrite), `n` (don't overwrite), `d` (show diff between your file and the updated file) and `h` (help).
Running `ng update` will check for changes in all the auto-generated files created by `ng new` and allow you to update yours. You are offered four choices for each changed file: `y` (overwrite), `n` (don't overwrite), `d` (show diff between your file and the updated file) and `h` (help).
Carefully read the diffs for each code file, and either accept the changes or incorporate them manually after `ng init` finishes.
Carefully read the diffs for each code file, and either accept the changes or incorporate them manually after `ng update` finishes.
**The main cause of errors after an update is failing to incorporate these updates into your code**.

@ -15,7 +15,7 @@ Provide tasks for common Docker workflows:
1. Requires user to have Docker CLI tools installed.
(See also: ["Implementation Approaches"](#implementation-approaches))
1. User is free to use the Angular CLI without Docker (and vice versa). By default, do not generate Docker files upon creation of a new project (`ng new`, `ng init`).
1. User is free to use the Angular CLI without Docker (and vice versa). By default, do not generate Docker files upon creation of a new project (`ng new`).
1. Don't recreate the wheel. Docker CLI tools are very full featured on their own. Implement the common Docker use cases that make it convenient for Angular applications.
1. Don't inhibit users from using the standalone Docker CLI tools for other use cases.
1. Assumes 1:1 Dockerfile with the Angular project. Support for multiple services under the same project is outside the scope of this initial design.

@ -109,7 +109,7 @@ your app.
### Additional Commands
* [ng new](new)
* [ng init](init)
* [ng update](update)
* [ng serve](serve)
* [ng generate](generate)
* [ng test](test)

@ -1,9 +1,9 @@
<!-- Links in /docs/documentation should NOT have `.md` at the end, because they end up in our wiki at release. -->
# ng init
# ng update
## Overview
`ng init [name]` initializes, or re-initializes, an angular application.
`ng update [name]` updates, initializes, or re-initializes, an angular application.
Initialization is done in-place, meaning that the generated application is initialized in the current directory.

@ -3,7 +3,7 @@ const Command = require('../ember-cli/lib/models/command');
const InitCommand: any = Command.extend({
name: 'init',
description: 'Creates a new angular-cli project in the current folder.',
aliases: ['i'],
aliases: ['u', 'update', 'i'],
works: 'everywhere',
availableOptions: [

@ -20,7 +20,7 @@ var existsSync = require('exists-sync');
var defaultIgnoredFiles = Blueprint.ignoredFiles;
describe('Acceptance: ng init', function () {
describe('Acceptance: ng update', function () {
this.timeout(20000);
beforeEach(function () {
@ -94,14 +94,14 @@ describe('Acceptance: ng init', function () {
});
}
it('ng init', function () {
it('ng init does the same as ng update', function () {
return ng([
'init',
'--skip-npm'
]).then(confirmBlueprinted);
});
it('ng init can run in created folder', function () {
it('ng update can run in created folder', function () {
return tmp.setup('./tmp/foo')
.then(function () {
process.chdir('./tmp/foo');
@ -176,7 +176,7 @@ describe('Acceptance: ng init', function () {
.then(confirmBlueprinted);
});
it('ng init --inline-template does not generate a template file', () => {
it('ng update --inline-template does not generate a template file', () => {
return ng(['init', '--skip-npm', '--skip-git', '--inline-template'])
.then(() => {
const templateFile = path.join('src', 'app', 'app.component.html');
@ -184,7 +184,7 @@ describe('Acceptance: ng init', function () {
});
});
it('ng init --inline-style does not gener a style file', () => {
it('ng update --inline-style does not gener a style file', () => {
return ng(['init', '--skip-npm', '--skip-git', '--inline-style'])
.then(() => {
const styleFile = path.join('src', 'app', 'app.component.css');