Skip to content

Commit

Permalink
fix(angular): change --preserveAngularCLILayout to --preserve-angular…
Browse files Browse the repository at this point in the history
…-cli-layout (#9051)
  • Loading branch information
leosvelperez committed Feb 21, 2022
1 parent dfcc853 commit 33c9ca9
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/shared/migration/migration-angular.md
Expand Up @@ -10,10 +10,10 @@ using a monorepo approach. If you are currently using an Angular CLI workspace,

## Using ng add and preserving your existing structure

To add Nx to an existing Angular CLI workspace to an Nx workspace, with keeping your existing file structure in place, use the `ng add` command with the `--preserveAngularCLILayout` option:
To add Nx to an existing Angular CLI workspace to an Nx workspace, with keeping your existing file structure in place, use the `ng add` command with the `--preserve-angular-cli-layout` option:

```bash
ng add @nrwl/workspace --preserveAngularCLILayout
ng add @nrwl/workspace --preserve-angular-cli-layout
```

This installs the `@nrwl/workspace` package into your workspace and applies the following changes to your workspace:
Expand Down
5 changes: 2 additions & 3 deletions e2e/angular-core/src/ng-add.test.ts
Expand Up @@ -288,9 +288,8 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
// runCommand('mv src-bak src');
});

it('should support preserveAngularCLILayout', () => {
// TODO: rename this arg so it doesn't split the CLI letters
runNgAdd('--preserve-angular-c-l-i-layout');
it('should support preserveAngularCliLayout', () => {
runNgAdd('--preserve-angular-cli-layout');

const updatedAngularCLIJson = readJson('angular.json');
expect(updatedAngularCLIJson.projects[project].root).toEqual('');
Expand Down
6 changes: 3 additions & 3 deletions packages/workspace/src/generators/init/init.spec.ts
Expand Up @@ -408,7 +408,7 @@ describe('workspace', () => {
it('should update package.json', async () => {
await initGenerator(tree, {
name: 'myApp',
preserveAngularCLILayout: true,
preserveAngularCliLayout: true,
});

const d = readJson(tree, '/package.json').devDependencies;
Expand All @@ -419,7 +419,7 @@ describe('workspace', () => {
it('should create nx.json', async () => {
await initGenerator(tree, {
name: 'myApp',
preserveAngularCLILayout: true,
preserveAngularCliLayout: true,
});

const nxJson = readJson(tree, '/nx.json');
Expand All @@ -429,7 +429,7 @@ describe('workspace', () => {
it('should create decorate-angular-cli.js', async () => {
await initGenerator(tree, {
name: 'myApp',
preserveAngularCLILayout: true,
preserveAngularCliLayout: true,
});
const s = readJson(tree, '/package.json').scripts;

Expand Down
2 changes: 1 addition & 1 deletion packages/workspace/src/generators/init/init.ts
Expand Up @@ -629,7 +629,7 @@ function renameDirSyncInTree(tree: Tree, from: string, to: string) {
}

export async function initGenerator(tree: Tree, schema: Schema) {
if (schema.preserveAngularCLILayout) {
if (schema.preserveAngularCliLayout) {
addDependenciesToPackageJson(tree, {}, { '@nrwl/workspace': nxVersion });
createNxJson(tree);
decorateAngularClI(tree);
Expand Down
2 changes: 1 addition & 1 deletion packages/workspace/src/generators/init/schema.d.ts
Expand Up @@ -2,6 +2,6 @@ export interface Schema {
name: string;
skipInstall?: boolean;
npmScope?: string;
preserveAngularCLILayout?: boolean;
preserveAngularCliLayout?: boolean;
defaultBase?: string;
}
4 changes: 2 additions & 2 deletions packages/workspace/src/generators/init/schema.json
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/schema",
"$id": "SchematicsNxNgAdd",
"title": "Init Workspace",
"cli": true,
"cli": "ng",
"description": "NOTE: Does not work in the --dry-run mode",
"type": "object",
"properties": {
Expand All @@ -19,7 +19,7 @@
"description": "Skip installing after adding @nrwl/workspace",
"default": false
},
"preserveAngularCLILayout": {
"preserveAngularCliLayout": {
"type": "boolean",
"description": "Preserve the Angular CLI layout instead of moving the app into apps.",
"default": false
Expand Down

1 comment on commit 33c9ca9

@vercel
Copy link

@vercel vercel bot commented on 33c9ca9 Feb 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.