fix(nx): create-nx-workspace creates an extra yarn.lock
This commit is contained in:
parent
6dea3f05d0
commit
82f53c94fc
@ -100,21 +100,24 @@ function addDependencies(options: Schema) {
|
|||||||
{
|
{
|
||||||
'@nrwl/angular': nxVersion
|
'@nrwl/angular': nxVersion
|
||||||
},
|
},
|
||||||
{}
|
{},
|
||||||
|
false
|
||||||
);
|
);
|
||||||
} else if (options.preset === 'react') {
|
} else if (options.preset === 'react') {
|
||||||
return addDepsToPackageJson(
|
return addDepsToPackageJson(
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
'@nrwl/react': nxVersion
|
'@nrwl/react': nxVersion
|
||||||
}
|
},
|
||||||
|
false
|
||||||
);
|
);
|
||||||
} else if (options.preset === 'web-components') {
|
} else if (options.preset === 'web-components') {
|
||||||
return addDepsToPackageJson(
|
return addDepsToPackageJson(
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
'@nrwl/web': nxVersion
|
'@nrwl/web': nxVersion
|
||||||
}
|
},
|
||||||
|
false
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return addDepsToPackageJson(
|
return addDepsToPackageJson(
|
||||||
@ -123,7 +126,8 @@ function addDependencies(options: Schema) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'@nrwl/nest': nxVersion
|
'@nrwl/nest': nxVersion
|
||||||
}
|
},
|
||||||
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,6 +93,7 @@ export function getSourceNodes(sourceFile: ts.SourceFile): ts.Node[] {
|
|||||||
|
|
||||||
export interface Change {
|
export interface Change {
|
||||||
apply(host: any): Promise<void>;
|
apply(host: any): Promise<void>;
|
||||||
|
|
||||||
readonly type: string;
|
readonly type: string;
|
||||||
readonly path: string | null;
|
readonly path: string | null;
|
||||||
readonly order: number;
|
readonly order: number;
|
||||||
@ -104,6 +105,7 @@ export class NoopChange implements Change {
|
|||||||
description = 'No operation.';
|
description = 'No operation.';
|
||||||
order = Infinity;
|
order = Infinity;
|
||||||
path = null;
|
path = null;
|
||||||
|
|
||||||
apply() {
|
apply() {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
@ -392,7 +394,11 @@ export function updateJsonInTree<T = any, O = T>(
|
|||||||
|
|
||||||
let installAdded = false;
|
let installAdded = false;
|
||||||
|
|
||||||
export function addDepsToPackageJson(deps: any, devDeps: any): Rule {
|
export function addDepsToPackageJson(
|
||||||
|
deps: any,
|
||||||
|
devDeps: any,
|
||||||
|
addInstall = true
|
||||||
|
): Rule {
|
||||||
return updateJsonInTree('package.json', (json, context: SchematicContext) => {
|
return updateJsonInTree('package.json', (json, context: SchematicContext) => {
|
||||||
json.dependencies = {
|
json.dependencies = {
|
||||||
...deps,
|
...deps,
|
||||||
@ -402,7 +408,7 @@ export function addDepsToPackageJson(deps: any, devDeps: any): Rule {
|
|||||||
...devDeps,
|
...devDeps,
|
||||||
...(json.devDependencies || {})
|
...(json.devDependencies || {})
|
||||||
};
|
};
|
||||||
if (!installAdded) {
|
if (addInstall && !installAdded) {
|
||||||
context.addTask(new NodePackageInstallTask());
|
context.addTask(new NodePackageInstallTask());
|
||||||
installAdded = true;
|
installAdded = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user