Skip to content

Commit

Permalink
fix(data): update the package name for replacement to ngrx-data (#1805)
Browse files Browse the repository at this point in the history
Closes #1802
  • Loading branch information
timdeschryver authored and brandonroberts committed Apr 26, 2019
1 parent 63e4926 commit 00c00e0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions modules/data/schematics/ng-add/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,29 +98,29 @@ describe('Data ng-add Schematic', () => {
expect(content).toMatch(/EntityDataModuleWithoutEffects\n/);
});

describe('Migration of angular-ngrx-data', () => {
it('should remove angular-ngrx-data from package.json', () => {
describe('Migration of ngrx-data', () => {
it('should remove ngrx-data from package.json', () => {
const options = { ...defaultOptions, migrateNgrxData: true };

const packageJsonBefore = JSON.parse(
appTree.readContent('/package.json')
);
packageJsonBefore['dependencies']['angular-ngrx-data'] = '1.0.0';
packageJsonBefore['dependencies']['ngrx-data'] = '1.0.0';
appTree.overwrite(
'/package.json',
JSON.stringify(packageJsonBefore, null, 2)
);

expect(
JSON.parse(appTree.readContent('/package.json'))['dependencies'][
'angular-ngrx-data'
'ngrx-data'
]
).toBeDefined();

const tree = schematicRunner.runSchematic('ng-add', options, appTree);
const packageJson = JSON.parse(tree.readContent('/package.json'));

expect(packageJson.dependencies['angular-ngrx-data']).not.toBeDefined();
expect(packageJson.dependencies['ngrx-data']).not.toBeDefined();
});

it('should rename NgrxDataModule', () => {
Expand Down
4 changes: 2 additions & 2 deletions modules/data/schematics/ng-add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ function removeAngularNgRxDataFromPackageJson() {
const sourceText = host.read('package.json')!.toString('utf-8');
const json = JSON.parse(sourceText);

if (json['dependencies'] && json['dependencies']['angular-ngrx-data']) {
delete json['dependencies']['angular-ngrx-data'];
if (json['dependencies'] && json['dependencies']['ngrx-data']) {
delete json['dependencies']['ngrx-data'];
}

host.overwrite('package.json', JSON.stringify(json, null, 2));
Expand Down
2 changes: 1 addition & 1 deletion modules/data/schematics/ng-add/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"migrateNgrxData": {
"type": "boolean",
"default": false,
"description": "Migrate from angular-ngrx-data, will rename modules.",
"description": "Migrate from ngrx-data, will rename modules.",
"alias": "migrate"
}
},
Expand Down
6 changes: 3 additions & 3 deletions projects/ngrx.io/content/guide/data/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ng add @ngrx/data
* project - name of the project defined in your `angular.json` to help locating the module to add the `EntityDataModule` to.
* module - name of file containing the module that you wish to add the import for the `EntityDataModule` to. Can also include the relative path to the file. For example, `src/app/app.module.ts`.
* effects - if `false` it will use the `EntityDataModuleWithoutEffects` module instead of the default `EntityDataModule`.
* migrateNgRxData - if `true` it will replace the `angular-ngrx-data` module with the `@ngrx/data` module.
* migrateNgRxData - if `true` it will replace the `ngrx-data` module with the `@ngrx/data` module.

This command will automate the following steps:

Expand All @@ -39,5 +39,5 @@ This command will automate the following steps:

With the `migrateNgRxData` flag the following will also take place:

1. Remove `angular-ngrx-data` from `package.json` > `dependencies`.
2. Rename `angular-ngrx-data` types to the matching `@ngrx/data` types.
1. Remove `ngrx-data` from `package.json` > `dependencies`.
2. Rename `ngrx-data` types to the matching `@ngrx/data` types.
2 changes: 1 addition & 1 deletion projects/ngrx.io/content/guide/migration/v8.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,6 @@ To stay consistent with the other `@ngrx/*` packages, the following has been ren

<div class="alert is-helpful">

The installation of `@ngrx/data` package via `ng add @ngrx/data` will remove `angular-ngrx-data` from the `package.json` and will also perform these renames.
The installation of `@ngrx/data` package via `ng add @ngrx/data` will remove `ngrx-data` from the `package.json` and will also perform these renames.

</div>

0 comments on commit 00c00e0

Please sign in to comment.