Skip to content
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

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

Merged
merged 1 commit into from
Jan 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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**.

Expand Down
2 changes: 1 addition & 1 deletion docs/design/docker-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/documentation/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions docs/documentation/init.md → docs/documentation/update.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion packages/angular-cli/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
10 changes: 5 additions & 5 deletions tests/acceptance/init.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -176,15 +176,15 @@ 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');
expect(existsSync(templateFile)).to.equal(false);
});
});

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');
Expand Down