Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
run: () => {
updateJsonFile('tslint.json', json => {
const ruleName = 'nx-enforce-module-boundaries';
const rule = ruleName in json.rules ? json.rules[ruleName] : null;
// Only modify when the rule is configured with optional arguments
if (
Array.isArray(rule) &&
typeof rule[1] === 'object' &&
rule[1] !== null
) {
rule[1].npmScope = undefined;
}
});
}
};
run: () => {
if (!existsSync('.angular-cli.json') && existsSync('angular.json')) {
console.warn(stripIndents`
You have already upgraded to Angular CLI 6.
We will not be able to recover information about your project's tags for you.
`);
return;
}
updateJsonFile('package.json', json => {
json.devDependencies['@angular/cli'] = '6.1.2';
});
updateJsonFile('package.json', json => {
delete json.scripts.postinstall;
});
try {
if (existsSync('yarn.lock')) {
execSync('yarn install', { stdio: [0, 1, 2] });
} else {
execSync('npm install', { stdio: [0, 1, 2] });
}
execSync(
'ng update @angular/cli --from 1.7.4 --to 6.0.1 --migrate-only',
{
stdio: [0, 1, 2]
}
);
run: () => {
updateJsonFile('package.json', json => {
json.dependencies = {
...json.dependencies,
'@angular/animations': '^5.2.0',
'@angular/common': '^5.2.0',
'@angular/compiler': '^5.2.0',
'@angular/core': '^5.2.0',
'@angular/forms': '^5.2.0',
'@angular/platform-browser': '^5.2.0',
'@angular/platform-browser-dynamic': '^5.2.0',
'@angular/router': '^5.2.0',
'core-js': '^2.4.1',
rxjs: '^5.5.6',
'zone.js': '^0.8.19',
'@ngrx/effects': '4.1.1',
'@ngrx/router-store': '4.1.1',
'@ngrx/store': '4.1.1'
run: () => {
updateJsonFile('package.json', json => {
json.scripts = {
...json.scripts,
'apps:affected':
'node ./node_modules/@nrwl/schematics/src/affected/run-affected.js apps',
'build:affected':
'node ./node_modules/@nrwl/schematics/src/affected/run-affected.js build',
'e2e:affected':
'node ./node_modules/@nrwl/schematics/src/affected/run-affected.js e2e'
};
});
}
};
run: () => {
updateJsonFile('package.json', json => {
json.devDependencies = {
...json.devDependencies,
['@angular-devkit/core']: '^0.0.29'
};
});
}
};
run: async () => {
updateJsonFile('.angular-cli.json', json => {
json.apps = json.apps.map(app => ({ ...app, tags: [] }));
});
updateJsonFile('tslint.json', json => {
if (json.rules['nx-enforce-module-boundaries']) {
json.rules['nx-enforce-module-boundaries'][1].depConstraints = [
{ sourceTag: '*', onlyDependOnLibsWithTags: ['*'] }
];
json.rules['nx-enforce-module-boundaries'][1].lazyLoad = undefined;
}
});
}
};
run: () => {
updateJsonFile('package.json', json => {
json.scripts = {
...json.scripts,
'apps:affected': './node_modules/.bin/nx affected apps',
'build:affected': './node_modules/.bin/nx affected build',
'e2e:affected': './node_modules/.bin/nx affected e2e',
'affected:apps': './node_modules/.bin/nx affected apps',
'affected:build': './node_modules/.bin/nx affected build',
'affected:e2e': './node_modules/.bin/nx affected e2e',
format: './node_modules/.bin/nx format write',
'format:write': './node_modules/.bin/nx format write',
'format:check': './node_modules/.bin/nx format check',
'nx-migrate': './node_modules/.bin/nx migrate'
run: () => {
updateJsonFile('package.json', json => {
json.scripts = {
...json.scripts,
'affected:apps': './node_modules/.bin/nx affected:apps',
'affected:build': './node_modules/.bin/nx affected:build',
'affected:e2e': './node_modules/.bin/nx affected:e2e',
'affected:dep-graph': './node_modules/.bin/nx affected:dep-graph',
format: './node_modules/.bin/nx format:write',
'format:write': './node_modules/.bin/nx format:write',
'format:check': './node_modules/.bin/nx format:check',
update: './node_modules/.bin/nx update',
'update:check': './node_modules/.bin/nx update:check',
'update:skip': './node_modules/.bin/nx update:skip',
'workspace-schematic': './node_modules/.bin/nx workspace-schematic',
'dep-graph': './node_modules/.bin/nx dep-graph',
help: './node_modules/.bin/nx help'
};
function cleanUpExistingConfig(resolvedExisting: ExistingPrettierConfig): void {
switch (resolvedExisting.sourceFilepath) {
case join(process.cwd(), 'package.json'):
return updateJsonFile('package.json', json => {
delete json.prettier;
});
default:
return unlinkSync(resolvedExisting.sourceFilepath);
}
}
json.devDependencies = {
...json.devDependencies,
'@angular/cli': 'file:.angular_cli165.tgz',
'@angular/compiler-cli': '^5.2.0',
'@angular/language-service': '^5.2.0',
'jasmine-core': '~2.8.0',
'jasmine-spec-reporter': '~4.2.1',
karma: '~2.0.0',
'karma-chrome-launcher': '~2.2.0',
'ts-node': '~4.1.0',
tslint: '~5.9.1',
typescript: '2.6.2'
};
});
updateJsonFile('tslint.json', json => {
json.rules['deprecation'] = { severity: 'warn' };
json.rules['typeof-compare'] = undefined;
json.rules['whitespace'] = undefined;
});
copyFile(
path.join(
__dirname,
'..',
'src',
'collection',
'application',
'files',
'__directory__',
'.angular_cli165.tgz'
),