Skip to content

Commit 168a26e

Browse files
BroccoZhicheng Wang
authored and
Zhicheng Wang
committed
refactor(@angular/cli): rename config file from angular-cli.json to .angular-cli.json (angular#4681)
BREAKING CHANGE: The configuration file angular-cli.json has been renamed to .angular-cli.json
1 parent 977784c commit 168a26e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+266
-54
lines changed

docs/design/docker-deploy.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ If an `env` name is provided, other than "default", generate compose files with
9797

9898
If `--use-image == false` and the selected machine for the environment is a Docker Swarm machine, warn the user. Docker Swarm clusters cannot use the `build:` option in compose, since the resulting built image will not be distributed to other nodes. Swarm requires using the `image:` option in compose, pushing the image to a registry beforehand so that the Swarm nodes have a place to pull the image from (see [Swarm Limitations](https://docs.docker.com/compose/swarm/#building-images)).
9999

100-
Certain configuration values will be stored in the project's ngConfig `angular-cli.json` for use with other docker commands (ie. deploy, logs, exec). See also: [Saved State](#saved-state) section.
100+
Certain configuration values will be stored in the project's ngConfig `.angular-cli.json` for use with other docker commands (ie. deploy, logs, exec). See also: [Saved State](#saved-state) section.
101101

102102
Provide instructions on what the user can do after initialization completes (push, deploy).
103103

docs/design/ngConfig.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ Since the data is static, we only need to keep it in a static store somewhere.
1616

1717
One solution would be to keep the data in the `package.json`. Unfortunately, the metadata contains too much data and the `package.json` file would become unmanageable.
1818

19-
Instead of polluting the package file, a `angular-cli.json` file will be created that contains all the values. Access to that file will be allowed to the user if he knows the structure of the file (unknown keys will be kept but ignored), and it's easy to read and write.
19+
Instead of polluting the package file, a `.angular-cli.json` file will be created that contains all the values. Access to that file will be allowed to the user if he knows the structure of the file (unknown keys will be kept but ignored), and it's easy to read and write.
2020

2121

2222
## Fallback
2323

24-
There should be two `angular-cli.json` files; one for the project and a general one. The general one should contain information that can be useful when scaffolding new apps, or informations about the user.
24+
There should be two `.angular-cli.json` files; one for the project and a general one. The general one should contain information that can be useful when scaffolding new apps, or informations about the user.
2525

26-
The project `angular-cli.json` goes into the project root. The global configuration should live at `$HOME/.angular-cli.json`.
26+
The project `.angular-cli.json` goes into the project root. The global configuration should live at `$HOME/.angular-cli.json`.
2727

2828
## Structure
2929

docs/documentation/build.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The build artifacts will be stored in the `dist/` directory.
1919
environment file to be used with that build (`--environment=dev` or `--environment=prod`).
2020
By default, the development build target and environment are used.
2121

22-
The mapping used to determine which environment file is used can be found in `angular-cli.json`:
22+
The mapping used to determine which environment file is used can be found in `.angular-cli.json`:
2323

2424
```json
2525
"environments": {
@@ -46,7 +46,7 @@ ng build
4646

4747
You can also add your own env files other than `dev` and `prod` by doing the following:
4848
- create a `src/environments/environment.NAME.ts`
49-
- add `{ "NAME": 'src/environments/environment.NAME.ts' }` to the `apps[0].environments` object in `angular-cli.json`
49+
- add `{ "NAME": 'src/environments/environment.NAME.ts' }` to the `apps[0].environments` object in `.angular-cli.json`
5050
- use them via the `--env=NAME` flag on the build/serve commands.
5151

5252
### Base tag handling in index.html

docs/documentation/e2e.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ng e2e
1414
End-to-end tests are run via [Protractor](https://angular.github.io/protractor/).
1515

1616
## Options
17-
`--config` (`-c`) use a specific config file. Defaults to the protractor config file in `angular-cli.json`.
17+
`--config` (`-c`) use a specific config file. Defaults to the protractor config file in `.angular-cli.json`.
1818

1919
`--specs` (`-sp`) override specs in the protractor config.
2020
Can send in multiple specs by repeating flag (`ng e2e --specs=spec1.ts --specs=spec2.ts`).

docs/documentation/stories/asset-configuration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Project assets
22

3-
You use the `assets` array in `angular-cli.json` to list files or folders you want to copy as-is
3+
You use the `assets` array in `.angular-cli.json` to list files or folders you want to copy as-is
44
when building your project.
55

66
By default, the `src/assets/` folder and `src/favicon.ico` are copied over.

docs/documentation/stories/global-lib.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Some javascript libraries need to be added to the global scope, and loaded as if
44
they were in a script tag. We can do this using the `apps[0].scripts` and
5-
`apps[0].styles` properties of `angular-cli.json`.
5+
`apps[0].styles` properties of `.angular-cli.json`.
66

77
As an example, to use [Bootstrap 4](http://v4-alpha.getbootstrap.com/) this is
88
what you need to do:

docs/documentation/stories/global-scripts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Global styles
22

33
You can add Javascript files to the global scope via the `apps[0].scripts`
4-
property in `angular-cli.json`.
4+
property in `.angular-cli.json`.
55
These will be loaded exactly as if you had added them in a `<script>` tag inside `index.html`.
66

77
This is especially useful for legacy libraries or analytic snippets.

docs/documentation/stories/global-styles.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The `styles.css` file allows users to add global styles and supports
66
If the project is created with the `--style=sass` option, this will be a `.sass`
77
file instead, and the same applies to `scss/less/styl`.
88

9-
You can add more global styles via the `apps[0].styles` property in `angular-cli.json`.
9+
You can add more global styles via the `apps[0].styles` property in `.angular-cli.json`.
1010
These will be loaded exactly as if you had added them in a `<link>` tag inside `index.html`.
1111

1212
```json
@@ -25,4 +25,4 @@ You can also rename the output and lazy load it by using the object format:
2525
{ "input": "lazy-style.scss", "lazy": true },
2626
{ "input": "pre-rename-style.scss", "output": "renamed-style" },
2727
],
28-
```
28+
```

docs/documentation/stories/include-bootstrap.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ npm install bootstrap@next --save
3333

3434
Now that the project is set up it must be configured to include the bootstrap CSS.
3535

36-
- Open the file `angular-cli.json` from the root of your project.
36+
- Open the file `.angular-cli.json` from the root of your project.
3737
- Under the property `apps` the first item in that array is the default application.
3838
- There is a property `styles` which allows external global styles to be applied to your application.
3939
- Specify the path to `bootstrap.min.css`
@@ -46,7 +46,7 @@ Now that the project is set up it must be configured to include the bootstrap CS
4646
],
4747
```
4848

49-
**Note:** When you make changes to `angular-cli.json` you will need to re-start `ng serve` to pick up configuration changes.
49+
**Note:** When you make changes to `.angular-cli.json` you will need to re-start `ng serve` to pick up configuration changes.
5050

5151
### Testing Project
5252

docs/documentation/stories/include-font-awesome.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ npm install --save font-awesome
1616

1717
To add Font Awesome CSS icons to your app...
1818
```json
19-
// in angular-cli.json
19+
// in .angular-cli.json
2020

2121
"styles": [
2222
"styles.css",

docs/documentation/stories/moving-into-the-cli.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ relative paths instead.
4747
- Polyfills are listed in `./src/polyfills.ts` so remove `core-js` and `zone.js` from `index.html`.
4848
- SystemJS is not needed anymore, so remove it from `index.html` as well.
4949
- Instead of using `<script>` and `<link>` tags directly in `index.html`, use
50-
`angular-cli.json` instead.
51-
- Look for the `styles` array in `angular-cli.json` and add in any CSS files you have in
50+
`.angular-cli.json` instead.
51+
- Look for the `styles` array in `.angular-cli.json` and add in any CSS files you have in
5252
`src/index.html`. Use a relative path from `./src/`.
5353
- Do the same for any remaining script tags as well, using the `scripts` array instead.
5454

docs/documentation/stories/moving-out-of-the-cli.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Each project is unique, and even though we try to cater to most setups in Angula
44
you need a custom setup.
55

66
Even if you need to use a different build system, you can still use other Angular CLI features
7-
like `ng generate`, `ng lint`, `ng test` and `ng e2e` by leaving in `angular-cli.json` and
7+
like `ng generate`, `ng lint`, `ng test` and `ng e2e` by leaving in `.angular-cli.json` and
88
supporting files like `src/test.ts`.
99

1010
Moving out of the CLI is very similar to [Moving into the CLI](moving-into-the-cli).
@@ -40,7 +40,7 @@ You might also need to make adjustments to conform to your new build system.
4040
You might need to change these.
4141
- Polyfills are listed in `../old-awesome-app/src/polyfills.ts`. Incorporate these into the new
4242
project.
43-
- The CLI lists used `<script>` and `<link>` tags in the `angular-cli.json` `scripts`
43+
- The CLI lists used `<script>` and `<link>` tags in the `.angular-cli.json` `scripts`
4444
and `styles` array. Check import these in your new project and add them accordingly.
4545

4646
The final step is to copy your git history so you can continue working without losing anything:

packages/@angular/cli/blueprints/ng2/files/__path__/environments/environment.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// The file contents for the current environment will overwrite these during build.
22
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
33
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
4-
// The list of which env maps to which file can be found in `angular-cli.json`.
4+
// The list of which env maps to which file can be found in `.angular-cli.json`.
55

66
export const environment = {
77
production: false

packages/@angular/cli/blueprints/ng2/files/karma.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = function (config) {
2929
fixWebpackSourcePaths: true
3030
},
3131
angularCli: {
32-
config: './angular-cli.json',
32+
config: './.angular-cli.json',
3333
environment: 'dev'
3434
},
3535
reporters: config.angularCli && config.angularCli.codeCoverage

packages/@angular/cli/commands/e2e.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const E2eCommand = Command.extend({
4141
const e2eConfig = CliConfig.fromProject().config.e2e;
4242

4343
if (!e2eConfig.protractor.config) {
44-
throw new SilentError('No protractor config found in angular-cli.json.');
44+
throw new SilentError('No protractor config found in .angular-cli.json.');
4545
}
4646

4747
commandOptions.config = e2eConfig.protractor.config;

packages/@angular/cli/ember-cli/lib/models/blueprint.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,8 @@ Blueprint.list = function(options) {
12851285
@property renameFiles
12861286
*/
12871287
Blueprint.renamedFiles = {
1288-
'gitignore': '.gitignore'
1288+
'gitignore': '.gitignore',
1289+
'angular-cli.json': '.angular-cli.json'
12891290
};
12901291

12911292
/**

packages/@angular/cli/models/config.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import * as chalk from 'chalk';
55
import * as fs from 'fs';
66
import * as path from 'path';
77

8-
export const CLI_CONFIG_FILE_NAME = 'angular-cli.json';
8+
export const CLI_CONFIG_FILE_NAME = '.angular-cli.json';
9+
const CLI_CONFIG_FILE_NAME_ALT = 'angular-cli.json';
910

1011

1112
function _findUp(name: string, from: string) {
@@ -38,8 +39,11 @@ export class CliConfig extends CliConfigBase<ConfigInterface> {
3839
// Find the configuration, either where specified, in the angular-cli project
3940
// (if it's in node_modules) or from the current process.
4041
return (projectPath && _findUp(CLI_CONFIG_FILE_NAME, projectPath))
42+
|| (projectPath && _findUp(CLI_CONFIG_FILE_NAME_ALT, projectPath))
4143
|| _findUp(CLI_CONFIG_FILE_NAME, process.cwd())
42-
|| _findUp(CLI_CONFIG_FILE_NAME, __dirname);
44+
|| _findUp(CLI_CONFIG_FILE_NAME_ALT, process.cwd())
45+
|| _findUp(CLI_CONFIG_FILE_NAME, __dirname)
46+
|| _findUp(CLI_CONFIG_FILE_NAME_ALT, __dirname);
4347
}
4448

4549
static fromGlobal(): CliConfig {
@@ -66,7 +70,7 @@ export class CliConfig extends CliConfigBase<ConfigInterface> {
6670
// If any of them returned true, output a deprecation warning.
6771
if (aliases.some(x => !!x)) {
6872
console.error(chalk.yellow(oneLine`
69-
The "defaults.prefix" and "defaults.sourceDir" properties of angular-cli.json
73+
The "defaults.prefix" and "defaults.sourceDir" properties of .angular-cli.json
7074
are deprecated in favor of "apps[0].root" and "apps[0].prefix".\n
7175
Please update in order to avoid errors in future versions of Angular CLI.
7276
`));
@@ -94,7 +98,7 @@ export class CliConfig extends CliConfigBase<ConfigInterface> {
9498
// If any of them returned true, output a deprecation warning.
9599
if (aliases.some(x => !!x)) {
96100
console.error(chalk.yellow(oneLine`
97-
The "defaults.prefix" and "defaults.sourceDir" properties of angular-cli.json
101+
The "defaults.prefix" and "defaults.sourceDir" properties of .angular-cli.json
98102
are deprecated in favor of "apps[0].root" and "apps[0].prefix".\n
99103
Please update in order to avoid errors in future versions of Angular CLI.
100104
`));

packages/@angular/cli/models/config/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class CliConfig<JsonType> {
8686
content = JSON.parse(configContent);
8787
} catch (err) {
8888
throw new InvalidConfigError(
89-
'Parsing angular-cli.json failed. Please make sure your angular-cli.json'
89+
'Parsing .angular-cli.json failed. Please make sure your .angular-cli.json'
9090
+ ' is valid JSON. Error:\n' + err
9191
);
9292
}

packages/@angular/cli/models/webpack-config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export class NgCliWebpackConfig {
8888
return Object.assign({}, targetDefaults[buildOptions.target], buildOptions);
8989
}
9090

91-
// Fill in defaults from angular-cli.json
91+
// Fill in defaults from .angular-cli.json
9292
private mergeConfigs(buildOptions: BuildOptions, appConfig: any) {
9393
const mergeableOptions = {
9494
outputPath: appConfig.outDir,

packages/@angular/cli/models/webpack-configs/production.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const getProdConfig = function (wco: WebpackConfigOptions) {
2323
throw new Error(stripIndent`
2424
Your project is configured with serviceWorker = true, but @angular/service-worker
2525
is not installed. Run \`npm install --save-dev @angular/service-worker\`
26-
and try again, or run \`ng set apps.0.serviceWorker=false\` in your angular-cli.json.
26+
and try again, or run \`ng set apps.0.serviceWorker=false\` in your .angular-cli.json.
2727
`);
2828
}
2929

packages/@angular/cli/tasks/serve.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default Task.extend({
3030
rimraf.sync(path.resolve(this.project.root, outputPath));
3131

3232
const serveDefaults = {
33-
// default deployUrl to '' on serve to prevent the default from angular-cli.json
33+
// default deployUrl to '' on serve to prevent the default from .angular-cli.json
3434
deployUrl: ''
3535
};
3636

tests/e2e/tests/build/assets.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export default function () {
2222
'./src/output-asset.txt': 'output-asset.txt',
2323
'./node_modules/some-package/node_modules-asset.txt': 'node_modules-asset.txt',
2424
}))
25-
// Add asset config in angular-cli.json.
26-
.then(() => updateJsonFile('angular-cli.json', configJson => {
25+
// Add asset config in .angular-cli.json.
26+
.then(() => updateJsonFile('.angular-cli.json', configJson => {
2727
const app = configJson['apps'][0];
2828
app['assets'] = [
2929
'folder',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {ng} from '../../utils/process';
2+
import {moveFile} from '../../utils/fs';
3+
4+
5+
export default function() {
6+
return Promise.resolve()
7+
.then(() => ng('build'))
8+
.then(() => moveFile('.angular-cli.json', 'angular-cli.json'))
9+
.then(() => ng('build'));
10+
}

tests/e2e/tests/build/deploy-url.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default function () {
1818
// verify --deploy-url isn't applied to extracted css urls
1919
.then(() => expectFileToMatch('dist/styles.bundle.css', 'url\(more.svg\)'))
2020
// verify option also works in config
21-
.then(() => updateJsonFile('angular-cli.json', configJson => {
21+
.then(() => updateJsonFile('.angular-cli.json', configJson => {
2222
const app = configJson['apps'][0];
2323
app['deployUrl'] = 'config-deployUrl/';
2424
}))

tests/e2e/tests/build/filename.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {copyFile} from '../../utils/fs';
77
export default function() {
88
return Promise.resolve()
99
.then(() => copyFile('src/index.html', 'src/config-index.html'))
10-
.then(() => updateJsonFile('angular-cli.json', configJson => {
10+
.then(() => updateJsonFile('.angular-cli.json', configJson => {
1111
const app = configJson['apps'][0];
1212
app['outDir'] = 'config-build-output';
1313
app['index'] = 'config-index.html';

tests/e2e/tests/build/output-dir.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function() {
1010
.then(() => expectFileToExist('./build-output/index.html'))
1111
.then(() => expectFileToExist('./build-output/main.bundle.js'))
1212
.then(() => expectToFail(expectGitToBeClean))
13-
.then(() => updateJsonFile('angular-cli.json', configJson => {
13+
.then(() => updateJsonFile('.angular-cli.json', configJson => {
1414
const app = configJson['apps'][0];
1515
app['outDir'] = 'config-build-output';
1616
}))

tests/e2e/tests/build/scripts-array.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default function () {
1818
'src/common-entry-style.css': '.common-entry-style { color: red }',
1919
})
2020
.then(() => appendToFile('src/main.ts', 'import \'./string-script.js\';'))
21-
.then(() => updateJsonFile('angular-cli.json', configJson => {
21+
.then(() => updateJsonFile('.angular-cli.json', configJson => {
2222
const app = configJson['apps'][0];
2323
app['scripts'] = [
2424
'string-script.js',

tests/e2e/tests/build/styles/extract-css.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function () {
1919
'src/common-entry-style.css': '.common-entry-style { color: red }',
2020
'src/common-entry-script.js': 'console.log(\'common-entry-script\');'
2121
}))
22-
.then(() => updateJsonFile('angular-cli.json', configJson => {
22+
.then(() => updateJsonFile('.angular-cli.json', configJson => {
2323
const app = configJson['apps'][0];
2424
app['styles'] = [
2525
'string-style.css',

tests/e2e/tests/build/styles/imports.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default function () {
3535
h1 { background: #000; }
3636
`})
3737
// change files to use preprocessor
38-
.then(() => updateJsonFile('angular-cli.json', configJson => {
38+
.then(() => updateJsonFile('.angular-cli.json', configJson => {
3939
const app = configJson['apps'][0];
4040
app['styles'] = [`styles.${ext}`];
4141
}))
@@ -57,7 +57,7 @@ export default function () {
5757
.then(() => expectFileToMatch('dist/main.bundle.js',
5858
/h1.*background:\s*#000+/))
5959
// change files back
60-
.then(() => updateJsonFile('angular-cli.json', configJson => {
60+
.then(() => updateJsonFile('.angular-cli.json', configJson => {
6161
const app = configJson['apps'][0];
6262
app['styles'] = ['styles.css'];
6363
}))

tests/e2e/tests/build/styles/include-paths.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default function () {
3434
}))
3535
.then(() => replaceInFile('src/app/app.component.ts', `'./app.component.css\'`,
3636
`'./app.component.scss', './app.component.styl'`))
37-
.then(() => updateJsonFile('angular-cli.json', configJson => {
37+
.then(() => updateJsonFile('.angular-cli.json', configJson => {
3838
const app = configJson['apps'][0];
3939
app['styles'] = [
4040
'styles.scss',

0 commit comments

Comments
 (0)