Skip to content

Commit c159923

Browse files
filipesilvaMRHarrison
authored andcommitted
feat(update): add ng update as alias of ng init (angular#4142)
Fix angular#4007
1 parent 8f3d6d4 commit c159923

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ The CLI supports routing in several ways:
125125

126126
The `--routing` option also generates a default component with the same name as the module.
127127

128-
- 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.
128+
- You can use the `--routing` option with `ng new` to create a `app-routing.module.ts` file when you create or initialize a project.
129129

130130
<!-- DeleteSection1 Start here to remove upon next release -->
131131
### Creating a build
@@ -440,12 +440,12 @@ Local project package:
440440
rm -rf node_modules dist # use rmdir on Windows
441441
npm install --save-dev angular-cli@latest
442442
npm install
443-
ng init
443+
ng update
444444
```
445445

446-
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).
446+
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).
447447

448-
Carefully read the diffs for each code file, and either accept the changes or incorporate them manually after `ng init` finishes.
448+
Carefully read the diffs for each code file, and either accept the changes or incorporate them manually after `ng update` finishes.
449449

450450
**The main cause of errors after an update is failing to incorporate these updates into your code**.
451451

docs/design/docker-deploy.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Provide tasks for common Docker workflows:
1515

1616
1. Requires user to have Docker CLI tools installed.
1717
(See also: ["Implementation Approaches"](#implementation-approaches))
18-
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`).
18+
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`).
1919
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.
2020
1. Don't inhibit users from using the standalone Docker CLI tools for other use cases.
2121
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.

docs/documentation/overview.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ your app.
109109

110110
### Additional Commands
111111
* [ng new](new)
112-
* [ng init](init)
112+
* [ng update](update)
113113
* [ng serve](serve)
114114
* [ng generate](generate)
115115
* [ng test](test)

docs/documentation/init.md renamed to docs/documentation/update.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!-- Links in /docs/documentation should NOT have `.md` at the end, because they end up in our wiki at release. -->
22

3-
# ng init
3+
# ng update
44

55
## Overview
6-
`ng init [name]` initializes, or re-initializes, an angular application.
6+
`ng update [name]` updates, initializes, or re-initializes, an angular application.
77

88
Initialization is done in-place, meaning that the generated application is initialized in the current directory.
99

packages/angular-cli/commands/init.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const Command = require('../ember-cli/lib/models/command');
33
const InitCommand: any = Command.extend({
44
name: 'init',
55
description: 'Creates a new angular-cli project in the current folder.',
6-
aliases: ['i'],
6+
aliases: ['u', 'update', 'i'],
77
works: 'everywhere',
88

99
availableOptions: [

tests/acceptance/init.spec.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var existsSync = require('exists-sync');
2020

2121
var defaultIgnoredFiles = Blueprint.ignoredFiles;
2222

23-
describe('Acceptance: ng init', function () {
23+
describe('Acceptance: ng update', function () {
2424
this.timeout(20000);
2525

2626
beforeEach(function () {
@@ -94,14 +94,14 @@ describe('Acceptance: ng init', function () {
9494
});
9595
}
9696

97-
it('ng init', function () {
97+
it('ng init does the same as ng update', function () {
9898
return ng([
9999
'init',
100100
'--skip-npm'
101101
]).then(confirmBlueprinted);
102102
});
103103

104-
it('ng init can run in created folder', function () {
104+
it('ng update can run in created folder', function () {
105105
return tmp.setup('./tmp/foo')
106106
.then(function () {
107107
process.chdir('./tmp/foo');
@@ -176,15 +176,15 @@ describe('Acceptance: ng init', function () {
176176
.then(confirmBlueprinted);
177177
});
178178

179-
it('ng init --inline-template does not generate a template file', () => {
179+
it('ng update --inline-template does not generate a template file', () => {
180180
return ng(['init', '--skip-npm', '--skip-git', '--inline-template'])
181181
.then(() => {
182182
const templateFile = path.join('src', 'app', 'app.component.html');
183183
expect(existsSync(templateFile)).to.equal(false);
184184
});
185185
});
186186

187-
it('ng init --inline-style does not gener a style file', () => {
187+
it('ng update --inline-style does not gener a style file', () => {
188188
return ng(['init', '--skip-npm', '--skip-git', '--inline-style'])
189189
.then(() => {
190190
const styleFile = path.join('src', 'app', 'app.component.css');

0 commit comments

Comments
 (0)