fix(angular): honor buildableProjectDepsInPackageJsonType in angula… (#4760)
Fixes the angular:package builder to honor the `buildableProjectDepsInPackageJsonType` setting. It was previously ignored.
This commit is contained in:
parent
95848ca917
commit
5ee28743bc
@ -6,6 +6,16 @@ Properties can be configured in angular.json when defining the executor, or when
|
||||
|
||||
## Properties
|
||||
|
||||
### buildableProjectDepsInPackageJsonType
|
||||
|
||||
Default: `peerDependencies`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `dependencies`, `peerDependencies`
|
||||
|
||||
When updateBuildableProjectDepsInPackageJson is true, this adds dependencies to either `peerDependencies` or `dependencies`
|
||||
|
||||
### project
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -7,6 +7,16 @@ Read more about how to use executors and the CLI here: https://nx.dev/node/guide
|
||||
|
||||
## Properties
|
||||
|
||||
### buildableProjectDepsInPackageJsonType
|
||||
|
||||
Default: `peerDependencies`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `dependencies`, `peerDependencies`
|
||||
|
||||
When updateBuildableProjectDepsInPackageJson is true, this adds dependencies to either `peerDependencies` or `dependencies`
|
||||
|
||||
### project
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -7,6 +7,16 @@ Read more about how to use executors and the CLI here: https://nx.dev/react/guid
|
||||
|
||||
## Properties
|
||||
|
||||
### buildableProjectDepsInPackageJsonType
|
||||
|
||||
Default: `peerDependencies`
|
||||
|
||||
Type: `string`
|
||||
|
||||
Possible values: `dependencies`, `peerDependencies`
|
||||
|
||||
When updateBuildableProjectDepsInPackageJson is true, this adds dependencies to either `peerDependencies` or `dependencies`
|
||||
|
||||
### project
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -148,7 +148,7 @@ import { names } from '@nrwl/devkit';
|
||||
checkFilesExist(`dist/libs/${childLib}/package.json`);
|
||||
});
|
||||
|
||||
it('should properly add references to any dependency into the parent package.json', () => {
|
||||
it('aaashould properly add references to any dependency into the parent package.json', () => {
|
||||
runCLI(`build ${childLib}`);
|
||||
runCLI(`build ${childLib2}`);
|
||||
runCLI(`build ${parentLib}`);
|
||||
@ -160,11 +160,10 @@ import { names } from '@nrwl/devkit';
|
||||
);
|
||||
|
||||
const jsonFile = readJson(`dist/libs/${parentLib}/package.json`);
|
||||
// expect(jsonFile.dependencies).toEqual({ tslib: '^2.0.0' });
|
||||
|
||||
expect(jsonFile.dependencies['tslib']).toEqual('^2.0.0');
|
||||
expect(jsonFile.dependencies[`@${proj}/${childLib}`]).toBeDefined();
|
||||
expect(jsonFile.dependencies[`@${proj}/${childLib2}`]).toBeDefined();
|
||||
expect(jsonFile.peerDependencies[`@${proj}/${childLib}`]).toBeDefined();
|
||||
expect(jsonFile.peerDependencies[`@${proj}/${childLib2}`]).toBeDefined();
|
||||
expect(jsonFile.peerDependencies['@angular/common']).toBeDefined();
|
||||
expect(jsonFile.peerDependencies['@angular/core']).toBeDefined();
|
||||
});
|
||||
|
||||
@ -21,6 +21,12 @@
|
||||
"type": "boolean",
|
||||
"description": "Update buildable project dependencies in package.json",
|
||||
"default": true
|
||||
},
|
||||
"buildableProjectDepsInPackageJsonType": {
|
||||
"type": "string",
|
||||
"description": "When updateBuildableProjectDepsInPackageJson is true, this adds dependencies to either `peerDependencies` or `dependencies`",
|
||||
"enum": ["dependencies", "peerDependencies"],
|
||||
"default": "peerDependencies"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
||||
@ -90,7 +90,8 @@ export function createLibraryBuilder(
|
||||
updateBuildableProjectPackageJsonDependencies(
|
||||
context,
|
||||
target,
|
||||
dependencies
|
||||
dependencies,
|
||||
options.buildableProjectDepsInPackageJsonType
|
||||
);
|
||||
}
|
||||
}),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user