Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function setDefault(): Rule {
return updateWorkspace(workspace => {
// Set workspace default collection to 'react' if not already set.
workspace.extensions.cli = workspace.extensions.cli || {};
const defaultCollection: string =
workspace.extensions.cli &&
((workspace.extensions.cli as JsonObject).defaultCollection as string);
if (!defaultCollection || defaultCollection === '@nrwl/workspace') {
(workspace.extensions.cli as JsonObject).defaultCollection = '@nrwl/next';
}
});
}
function addStorybookTask(projectName: string, uiFramework: string): Rule {
return updateWorkspace(workspace => {
const projectConfig = workspace.projects.get(projectName);
projectConfig.targets.set('storybook', {
builder: '@nrwl/storybook:storybook',
options: {
uiFramework,
port: 4400,
config: {
configFolder: `${projectConfig.root}/.storybook`
}
},
configurations: {
ci: {
quiet: true
}
}
});
function setDefault(): Rule {
return updateWorkspace(workspace => {
workspace.extensions.cli = workspace.extensions.cli || {};
const defaultCollection: string =
workspace.extensions.cli &&
((workspace.extensions.cli as JsonObject).defaultCollection as string);
if (!defaultCollection || defaultCollection === '@nrwl/workspace') {
(workspace.extensions.cli as JsonObject).defaultCollection = 'nx-electron';
}
});
}
function setDefault(): Rule {
return updateWorkspace(workspace => {
workspace.extensions.cli = workspace.extensions.cli || {};
const defaultCollection: string =
workspace.extensions.cli &&
((workspace.extensions.cli as JsonObject).defaultCollection as string);
if (!defaultCollection || defaultCollection === '@nrwl/workspace') {
(workspace.extensions.cli as JsonObject).defaultCollection = '@nrwl/nest';
}
});
}
export function setDefaults(options: Schema): Rule {
return updateWorkspace(workspace => {
workspace.extensions.schematics = workspace.extensions.schematics || {};
workspace.extensions.schematics['@nrwl/angular:application'] =
workspace.extensions.schematics['@nrwl/angular:application'] || {};
workspace.extensions.schematics[
'@nrwl/angular:application'
].unitTestRunner =
workspace.extensions.schematics['@nrwl/angular:application']
.unitTestRunner || options.unitTestRunner;
workspace.extensions.schematics['@nrwl/angular:application'].e2eTestRunner =
workspace.extensions.schematics['@nrwl/angular:application']
.e2eTestRunner || options.e2eTestRunner;
workspace.extensions.schematics['@nrwl/angular:library'] =
workspace.extensions.schematics['@nrwl/angular:library'] || {};
workspace.extensions.schematics['@nrwl/angular:library'].unitTestRunner =
function setDefault(): Rule {
return updateWorkspace(workspace => {
workspace.extensions.cli = workspace.extensions.cli || {};
const defaultCollection: string =
workspace.extensions.cli &&
((workspace.extensions.cli as JsonObject).defaultCollection as string);
if (!defaultCollection || defaultCollection === '@nrwl/workspace') {
(workspace.extensions.cli as JsonObject).defaultCollection =
'@nrwl/express';
}
});
}
return chain([
host => {
if (host.read(`${e2eProjectRoot}/src/app.e2e-spec.ts`)) {
host.delete(`${e2eProjectRoot}/src/app.e2e-spec.ts`);
}
if (host.read(`${e2eProjectRoot}/src/app.po.ts`)) {
host.delete(`${e2eProjectRoot}/src/app.po.ts`);
}
if (host.read(`${e2eProjectRoot}/protractor.conf.js`)) {
host.delete(`${e2eProjectRoot}/protractor.conf.js`);
}
if (host.read(`${e2eProjectRoot}/tsconfig.json`)) {
host.delete(`${e2eProjectRoot}/tsconfig.json`);
}
},
updateWorkspace(workspace => {
workspace.projects.get(options.name).targets.delete('e2e');
})
]);
}
function setDefault(): Rule {
return updateWorkspace(workspace => {
workspace.extensions.cli = workspace.extensions.cli || {};
const defaultCollection: string =
workspace.extensions.cli &&
((workspace.extensions.cli as JsonObject).defaultCollection as string);
if (!defaultCollection || defaultCollection === '@nrwl/workspace') {
(workspace.extensions.cli as JsonObject).defaultCollection = '@nrwl/web';
}
});
}