Skip to content

Commit 11fe6e6

Browse files
committed
feat(update): add ng update as alias of ng init
Fix #4007
1 parent f4b5773 commit 11fe6e6

File tree

6 files changed

+22
-15
lines changed

6 files changed

+22
-15
lines changed

README.md

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

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

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

131131

132132
### Creating a build
@@ -441,12 +441,12 @@ Local project package:
441441
rm -rf node_modules dist # use rmdir on Windows
442442
npm install --save-dev angular-cli@latest
443443
npm install
444-
ng init
444+
ng update
445445
```
446446

447-
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).
447+
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).
448448

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

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

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
@@ -107,7 +107,7 @@ your app.
107107

108108
### Additional Commands
109109
* [ng new](new)
110-
* [ng init](init)
110+
* [ng update](update)
111111
* [ng serve](serve)
112112
* [ng generate](generate)
113113
* [ng test](test)

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# ng init
1+
# ng update
22

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

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

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

+13-6
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 () {
@@ -100,18 +100,25 @@ describe('Acceptance: ng init', function () {
100100
});
101101
}
102102

103-
it('ng init', function () {
103+
it('ng init does the same as ng update', function () {
104104
return ng([
105105
'init',
106106
'--skip-npm'
107107
]).then(confirmBlueprinted);
108108
});
109109

110-
it('ng init with mobile flag does throw exception', function () {
110+
it('ng update', function () {
111+
return ng([
112+
'init',
113+
'--skip-npm'
114+
]).then(confirmBlueprinted);
115+
});
116+
117+
it('ng update with mobile flag does throw exception', function () {
111118
expect(ng(['init', '--mobile'])).to.throw;
112119
});
113120

114-
it('ng init can run in created folder', function () {
121+
it('ng update can run in created folder', function () {
115122
return tmp.setup('./tmp/foo')
116123
.then(function () {
117124
process.chdir('./tmp/foo');
@@ -186,15 +193,15 @@ describe('Acceptance: ng init', function () {
186193
.then(confirmBlueprinted);
187194
});
188195

189-
it('ng init --inline-template does not generate a template file', () => {
196+
it('ng update --inline-template does not generate a template file', () => {
190197
return ng(['init', '--skip-npm', '--skip-git', '--inline-template'])
191198
.then(() => {
192199
const templateFile = path.join('src', 'app', 'app.component.html');
193200
expect(existsSync(templateFile)).to.equal(false);
194201
});
195202
});
196203

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

0 commit comments

Comments
 (0)