Skip to content

Commit

Permalink
cleanup(angular): move all inline version numbers to versions.ts (nrw…
Browse files Browse the repository at this point in the history
  • Loading branch information
leosvelperez authored Jul 22, 2022
1 parent d372be0 commit 712e6dd
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 22 deletions.
18 changes: 12 additions & 6 deletions packages/angular/src/generators/init/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ import {
rxjsVersion,
tsNodeVersion,
tsLibVersion,
zoneJsVersion,
protractorVersion,
jasmineCoreVersion,
jasmineSpecReporterVersion,
typesJasmineVersion,
typesJasminewd2Version,
} from '../../utils/versions';
import { karmaGenerator } from '../karma/karma';
import { Schema } from './schema';
Expand Down Expand Up @@ -111,7 +117,7 @@ function updateDependencies(host: Tree): GeneratorCallback {
'@angular/router': angularVersion,
rxjs: rxjsVersion,
tslib: tsLibVersion,
'zone.js': '~0.11.4',
'zone.js': zoneJsVersion,
},
{
'@angular/cli': angularDevkitVersion,
Expand Down Expand Up @@ -153,12 +159,12 @@ function addE2ETestRunner(host: Tree, options: Schema): GeneratorCallback {
host,
{},
{
protractor: '~7.0.0',
'jasmine-core': '~4.2.0',
'jasmine-spec-reporter': '~7.0.0',
protractor: protractorVersion,
'jasmine-core': jasmineCoreVersion,
'jasmine-spec-reporter': jasmineSpecReporterVersion,
'ts-node': tsNodeVersion,
'@types/jasmine': '~4.0.0',
'@types/jasminewd2': '~2.0.3',
'@types/jasmine': typesJasmineVersion,
'@types/jasminewd2': typesJasminewd2Version,
}
)
: () => {};
Expand Down
29 changes: 20 additions & 9 deletions packages/angular/src/generators/karma/karma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ import {
joinPathFragments,
readJson,
} from '@nrwl/devkit';
import {
jasmineCoreVersion,
jasmineSpecReporterVersion,
karmaChromeLauncherVersion,
karmaCoverageVersion,
karmaJasmineHtmlReporterVersion,
karmaJasmineVersion,
karmaVersion,
typesJasmineVersion,
typesNodeVersion,
} from '../../utils/versions';
import { GeneratorOptions } from './schema';

export function karmaGenerator(tree: Tree, options: GeneratorOptions) {
Expand All @@ -23,15 +34,15 @@ export function karmaGenerator(tree: Tree, options: GeneratorOptions) {
tree,
{},
{
karma: '~6.4.0',
'karma-chrome-launcher': '~3.1.0',
'karma-coverage': '~2.2.0',
'karma-jasmine': '~5.1.0',
'karma-jasmine-html-reporter': '~2.0.0',
'jasmine-core': '~4.2.0',
'jasmine-spec-reporter': '~7.0.0',
'@types/jasmine': '~4.0.0',
'@types/node': '16.11.7',
karma: karmaVersion,
'karma-chrome-launcher': karmaChromeLauncherVersion,
'karma-coverage': karmaCoverageVersion,
'karma-jasmine': karmaJasmineVersion,
'karma-jasmine-html-reporter': karmaJasmineHtmlReporterVersion,
'jasmine-core': jasmineCoreVersion,
'jasmine-spec-reporter': jasmineSpecReporterVersion,
'@types/jasmine': typesJasmineVersion,
'@types/node': typesNodeVersion,
}
);
}
Expand Down
13 changes: 9 additions & 4 deletions packages/angular/src/generators/utils/dependencies.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import { addDependenciesToPackageJson, Tree } from '@nrwl/devkit';
import { postcssVersion } from '../../utils/versions';
import {
postcssImportVersion,
postcssPresetEnvVersion,
postcssUrlVersion,
postcssVersion,
} from '../../utils/versions';

export function addBuildableLibrariesPostCssDependencies(tree: Tree): void {
addDependenciesToPackageJson(
tree,
{},
{
postcss: postcssVersion,
'postcss-import': '~14.1.0',
'postcss-preset-env': '~7.5.0',
'postcss-url': '~10.1.3',
'postcss-import': postcssImportVersion,
'postcss-preset-env': postcssPresetEnvVersion,
'postcss-url': postcssUrlVersion,
}
);
}
24 changes: 21 additions & 3 deletions packages/angular/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
export const nxVersion = require('../../package.json').version;

export const angularVersion = '~14.1.0';
export const angularDevkitVersion = '~14.1.0';
export const ngPackagrVersion = '~14.1.0';
export const angularJsVersion = '1.7.9';
export const ngrxVersion = '~14.0.0';
export const rxjsVersion = '~7.4.0';
export const jestPresetAngularVersion = '~11.1.2';
export const zoneJsVersion = '~0.11.4';
export const angularJsVersion = '1.7.9';
export const tsLibVersion = '^2.3.0';

export const angularEslintVersion = '~14.0.0';
export const tailwindVersion = '^3.0.2';
export const postcssVersion = '^8.4.5';
export const postcssImportVersion = '~14.1.0';
export const postcssPresetEnvVersion = '~7.5.0';
export const postcssUrlVersion = '~10.1.3';
export const autoprefixerVersion = '^10.4.0';
export const tsLibVersion = '^2.3.0';
export const tsNodeVersion = '~10.8.0';

export const jestPresetAngularVersion = '~11.1.2';
export const protractorVersion = '~7.0.0';
export const karmaVersion = '~6.4.0';
export const karmaChromeLauncherVersion = '~3.1.0';
export const karmaCoverageVersion = '~2.2.0';
export const karmaJasmineVersion = '~5.1.0';
export const karmaJasmineHtmlReporterVersion = '~2.0.0';
export const jasmineCoreVersion = '~4.2.0';
export const jasmineSpecReporterVersion = '~7.0.0';
export const typesJasmineVersion = '~4.0.0';
export const typesJasminewd2Version = '~2.0.3';
export const typesNodeVersion = '16.11.7';

0 comments on commit 712e6dd

Please sign in to comment.