Compare commits

...

20 Commits

Author SHA1 Message Date
Jason Jean 5541b6ce6f Release 10.4.12 2021-01-29 11:11:30 -05:00
Victor Savkin 1893ebc7b6 fix(core): add missing deps to support running old migrations 2021-01-29 10:44:23 -05:00
Victor Savkin 3aab3ffab6 cleanup(misc): clarify ng update warning message 2021-01-27 15:28:33 -05:00
minijus 917a1cae87 fix(core): wrap cache read to try/catch
Instead of failure in cache read return `false` allowing the process to proceed as if cache was not found.

Part of #4470
2021-01-27 15:27:30 -05:00
Victor Savkin 9ce3c8f2ce fix(core): use tmp folder instead of npx to get latest tao 2021-01-12 20:01:12 -05:00
Victor Savkin f3992ea76a feat(core): run migration script using npx by default 2021-01-12 11:41:40 -05:00
mehrad-rafigh 421a83ea45 chore(repo): update axios to 0.21.1
ISSUES CLOSED: #4439
2021-01-11 14:17:04 -05:00
Jason Jean 9707d87b86 Release 10.4.7 2020-12-10 17:40:09 -05:00
Jason Jean 61e6c332d5 fix(core): fix migrations for adding tao and cli (#4249) 2020-12-10 17:34:46 -05:00
Jason Jean b030a761a8 Release 10.4.6 2020-12-10 15:28:38 -05:00
Jason Jean 6b9942f5af fix(core): decorate angular cli to error when ng update is used 2020-12-10 15:24:33 -05:00
Jason Jean ceac479da3 Release 10.4.5 2020-12-10 14:59:28 -05:00
Victor Savkin 5f0bf8a37d feat(core): update the update npm script to invoke nx migrate 2020-12-09 15:15:14 -05:00
Victor Savkin da05843b84 feat(core): show a warning about using ng update insteda of nx migrate 2020-12-09 14:42:21 -05:00
Jonathan Cammisuli 021c842677 feat(node): add generatePackageJson option to build executor
(cherry picked from commit 2ec6848dd3)
2020-12-09 10:41:54 -05:00
Victor Savkin cb81c1cd62 Release 10.4.4 2020-11-18 10:27:10 -05:00
Victor Savkin 344e16005d cleanup(core): update the error message when migration fails 2020-11-18 10:25:35 -05:00
Victor Savkin 5023a8bf59 Release 10.4.3 2020-11-18 10:06:01 -05:00
Victor Savkin cbd404ccd1 fix(core): add explicit dep on cli if missing 2020-11-18 10:03:26 -05:00
Victor Savkin 95889a2447 fix(core): migration should fetch packages using cwd instead of prefix 2020-11-18 10:03:24 -05:00
28 changed files with 394 additions and 73 deletions
+8
View File
@@ -54,6 +54,14 @@ Type: `string`
undefined
### generatePackageJson
Default: `false`
Type: `boolean`
Generates a package.json file with the project's node_module dependencies populated for installing in a container. If a package.json exists in the project's directory, it will be reused with dependencies populated.
### main
Type: `string`
+8
View File
@@ -55,6 +55,14 @@ Type: `string`
undefined
### generatePackageJson
Default: `false`
Type: `boolean`
Generates a package.json file with the project's node_module dependencies populated for installing in a container. If a package.json exists in the project's directory, it will be reused with dependencies populated.
### main
Type: `string`
+8
View File
@@ -55,6 +55,14 @@ Type: `string`
undefined
### generatePackageJson
Default: `false`
Type: `boolean`
Generates a package.json file with the project's node_module dependencies populated for installing in a container. If a package.json exists in the project's directory, it will be reused with dependencies populated.
### main
Type: `string`
+25
View File
@@ -246,6 +246,31 @@ forEachCli((currentCLIName) => {
}, 120000);
});
describe('Build Node apps', () => {
it('should generate a package.json with the `--generatePackageJson` flag', async () => {
ensureProject();
const nestapp = uniq('nestapp');
runCLI(`generate @nrwl/nest:app ${nestapp} --linter=eslint`);
await runCLIAsync(`build ${nestapp} --generatePackageJson`);
checkFilesExist(`dist/apps/${nestapp}/package.json`);
const packageJson = JSON.parse(
readFile(`dist/apps/${nestapp}/package.json`)
);
expect(packageJson).toEqual(
expect.objectContaining({
dependencies: {
'@nestjs/common': '^7.0.0',
'@nestjs/core': '^7.0.0',
},
main: 'main.js',
name: expect.any(String),
version: '0.0.1',
})
);
});
});
describe('Node Libraries', () => {
it('should be able to generate a node library', async () => {
ensureProject();
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@nrwl/nx-source",
"version": "10.4.2",
"version": "10.4.12",
"description": "Extensible Dev Tools for Monorepos",
"homepage": "https://nx.dev",
"main": "index.js",
@@ -112,7 +112,7 @@
"angular": "1.8.0",
"app-root-path": "^2.0.1",
"autoprefixer": "9.7.4",
"axios": "0.19.2",
"axios": "0.21.1",
"babel-loader": "8.1.0",
"babel-plugin-const-enum": "^1.0.1",
"babel-plugin-emotion": "^10.0.29",
+27 -1
View File
@@ -9,6 +9,7 @@ import { parseRunOneOptions } from './parse-run-one-options';
* @param workspace Relevant local workspace properties
*/
process.env.NX_CLI_SET = 'true';
export function initLocal(workspace: Workspace) {
require('@nrwl/workspace/' + 'src/utils/perf-logging');
const supportedNxCommands = require('@nrwl/workspace/' +
@@ -24,7 +25,32 @@ export function initLocal(workspace: Workspace) {
.argv;
} else {
if (runOpts === false || process.env.NX_SKIP_TASKS_RUNNER) {
loadCli(workspace);
if (workspace.type === 'angular' && process.argv[2] === 'update') {
console.log(
`Nx provides a much improved version of "ng update". It runs the same migrations, but allows you to:`
);
console.log(`- rerun the same migration multiple times`);
console.log(`- reorder migrations, skip migrations`);
console.log(`- fix migrations that "almost work"`);
console.log(`- commit a partially migrated state`);
console.log(
`- change versions of packages to match organizational requirements`
);
console.log(
`And, in general, it is lot more reliable for non-trivial workspaces. Read more at: https://nx.dev/latest/angular/workspace/update`
);
console.log(
`Run "nx migrate latest" to update to the latest version of Nx.`
);
console.log(
`Running "ng update" can still be useful in some dev workflows, so we aren't planning to remove it.`
);
console.log(
`If you need to use it, run "FORCE_NG_UPDATE=true ng update".`
);
} else {
loadCli(workspace);
}
} else {
require('@nrwl/workspace' + '/src/command-line/run-one').runOne(runOpts);
}
+28 -17
View File
@@ -4,10 +4,10 @@ import { runWebpack, BuildResult } from '@angular-devkit/build-webpack';
import { Observable, from } from 'rxjs';
import { join, resolve } from 'path';
import { map, concatMap } from 'rxjs/operators';
import { concatMap, map, tap } from 'rxjs/operators';
import { getNodeWebpackConfig } from '../../utils/node.config';
import { OUT_FILENAME } from '../../utils/config';
import { BuildBuilderOptions } from '../../utils/types';
import { BuildNodeBuilderOptions } from '../../utils/types';
import { normalizeBuildOptions } from '../../utils/normalize';
import { NodeJsSyncHost } from '@angular-devkit/core/node';
import { createProjectGraph } from '@nrwl/workspace/src/core/project-graph';
@@ -15,18 +15,12 @@ import {
calculateProjectDependencies,
createTmpTsConfig,
} from '@nrwl/workspace/src/utils/buildable-libs-utils';
import { generatePackageJson } from '../../utils/generate-package-json';
try {
require('dotenv').config();
} catch (e) {}
export interface BuildNodeBuilderOptions extends BuildBuilderOptions {
optimization?: boolean;
sourceMap?: boolean;
externalDependencies: 'all' | 'none' | string[];
buildLibsFromSource?: boolean;
}
export type NodeBuildEvent = BuildResult & {
outfile: string;
};
@@ -37,8 +31,8 @@ function run(
options: JsonObject & BuildNodeBuilderOptions,
context: BuilderContext
): Observable<NodeBuildEvent> {
const projGraph = createProjectGraph();
if (!options.buildLibsFromSource) {
const projGraph = createProjectGraph();
const { target, dependencies } = calculateProjectDependencies(
projGraph,
context
@@ -51,10 +45,24 @@ function run(
);
}
return from(getSourceRoot(context)).pipe(
map((sourceRoot) =>
normalizeBuildOptions(options, context.workspaceRoot, sourceRoot)
return from(getRoots(context)).pipe(
map(({ sourceRoot, projectRoot }) =>
normalizeBuildOptions(
options,
context.workspaceRoot,
sourceRoot,
projectRoot
)
),
tap((normalizedOptions) => {
if (normalizedOptions.generatePackageJson) {
generatePackageJson(
context.target.project,
projGraph,
normalizedOptions
);
}
}),
map((options) => {
let config = getNodeWebpackConfig(options);
if (options.webpackConfig) {
@@ -84,17 +92,20 @@ function run(
);
}
async function getSourceRoot(context: BuilderContext) {
async function getRoots(
context: BuilderContext
): Promise<{ sourceRoot: string; projectRoot: string }> {
const workspaceHost = workspaces.createWorkspaceHost(new NodeJsSyncHost());
const { workspace } = await workspaces.readWorkspace(
context.workspaceRoot,
workspaceHost
);
if (workspace.projects.get(context.target.project).sourceRoot) {
return workspace.projects.get(context.target.project).sourceRoot;
const project = workspace.projects.get(context.target.project);
if (project.sourceRoot && project.root) {
return { sourceRoot: project.sourceRoot, projectRoot: project.root };
} else {
context.reportStatus('Error');
const message = `${context.target.project} does not have a sourceRoot. Please define one.`;
const message = `${context.target.project} does not have a sourceRoot or root. Please define one.`;
context.logger.error(message);
throw new Error(message);
}
@@ -117,6 +117,11 @@
"type": "boolean",
"description": "Read buildable libraries from source instead of building them separately.",
"default": false
},
"generatePackageJson": {
"type": "boolean",
"description": "Generates a package.json file with the project's node_module dependencies populated for installing in a container. If a package.json exists in the project's directory, it will be reused with dependencies populated.",
"default": false
}
},
"required": ["tsConfig", "main"],
@@ -0,0 +1,73 @@
import { ProjectGraph, readJsonFile } from '@nrwl/workspace';
import { BuildNodeBuilderOptions } from './types';
import { writeJsonFile } from '@nrwl/workspace/src/utils/fileutils';
import { OUT_FILENAME } from './config';
/**
* Creates a package.json in the output directory for support to install dependencies within containers.
*
* If a package.json exists in the project, it will reuse that.
*
* @param projectName
* @param graph
* @param options
* @constructor
*/
export function generatePackageJson(
projectName: string,
graph: ProjectGraph,
options: BuildNodeBuilderOptions
) {
const npmDeps = findAllNpmDeps(projectName, graph);
// default package.json if one does not exist
let packageJson = {
name: projectName,
version: '0.0.1',
main: OUT_FILENAME,
dependencies: {},
};
try {
packageJson = readJsonFile(`${options.projectRoot}/package.json`);
if (!packageJson.dependencies) {
packageJson.dependencies = {};
}
} catch (e) {}
const rootPackageJson = readJsonFile(`${options.root}/package.json`);
Object.entries(npmDeps).forEach(([packageName, version]) => {
// don't include devDeps
if (rootPackageJson.devDependencies?.[packageName]) {
return;
}
packageJson.dependencies[packageName] = version;
});
writeJsonFile(`${options.outputPath}/package.json`, packageJson);
}
function findAllNpmDeps(
projectName: string,
graph: ProjectGraph,
list: { [packageName: string]: string } = {},
seen = new Set<string>()
) {
if (seen.has(projectName)) {
return list;
}
seen.add(projectName);
const node = graph.nodes[projectName];
if (node.type === 'npm') {
list[node.data.packageName] = node.data.version;
}
graph.dependencies[projectName]?.forEach((dep) => {
findAllNpmDeps(dep.target, graph, list, seen);
});
return list;
}
+1 -2
View File
@@ -1,8 +1,7 @@
import { getNodeWebpackConfig } from './node.config';
import { BannerPlugin } from 'webpack';
jest.mock('tsconfig-paths-webpack-plugin');
import TsConfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
import { BuildNodeBuilderOptions } from '../builders/build/build.impl';
import { BuildNodeBuilderOptions } from './types';
describe('getNodePartial', () => {
let input: BuildNodeBuilderOptions;
+2 -2
View File
@@ -1,9 +1,9 @@
import { Configuration, BannerPlugin } from 'webpack';
import { Configuration } from 'webpack';
import * as mergeWebpack from 'webpack-merge';
import * as nodeExternals from 'webpack-node-externals';
import { BuildNodeBuilderOptions } from '../builders/build/build.impl';
import { getBaseWebpackPartial } from './config';
import { BuildNodeBuilderOptions } from './types';
function getNodePartial(options: BuildNodeBuilderOptions) {
const webpackConfig: Configuration = {
+34 -6
View File
@@ -8,6 +8,7 @@ describe('normalizeBuildOptions', () => {
let testOptions: BuildBuilderOptions;
let root: string;
let sourceRoot: Path;
let projectRoot: string;
beforeEach(() => {
testOptions = {
@@ -29,24 +30,45 @@ describe('normalizeBuildOptions', () => {
};
root = '/root';
sourceRoot = normalize('apps/nodeapp/src');
projectRoot = 'apps/nodeapp';
});
it('should add the root', () => {
const result = normalizeBuildOptions(testOptions, root, sourceRoot);
const result = normalizeBuildOptions(
testOptions,
root,
sourceRoot,
projectRoot
);
expect(result.root).toEqual('/root');
});
it('should resolve main from root', () => {
const result = normalizeBuildOptions(testOptions, root, sourceRoot);
const result = normalizeBuildOptions(
testOptions,
root,
sourceRoot,
projectRoot
);
expect(result.main).toEqual('/root/apps/nodeapp/src/main.ts');
});
it('should resolve the output path', () => {
const result = normalizeBuildOptions(testOptions, root, sourceRoot);
const result = normalizeBuildOptions(
testOptions,
root,
sourceRoot,
projectRoot
);
expect(result.outputPath).toEqual('/root/dist/apps/nodeapp');
});
it('should resolve the tsConfig path', () => {
const result = normalizeBuildOptions(testOptions, root, sourceRoot);
const result = normalizeBuildOptions(
testOptions,
root,
sourceRoot,
projectRoot
);
expect(result.tsConfig).toEqual('/root/apps/nodeapp/tsconfig.app.json');
});
@@ -69,7 +91,8 @@ describe('normalizeBuildOptions', () => {
],
},
root,
sourceRoot
sourceRoot,
projectRoot
);
expect(result.assets).toEqual([
{
@@ -87,7 +110,12 @@ describe('normalizeBuildOptions', () => {
});
it('should resolve the file replacement paths', () => {
const result = normalizeBuildOptions(testOptions, root, sourceRoot);
const result = normalizeBuildOptions(
testOptions,
root,
sourceRoot,
projectRoot
);
expect(result.fileReplacements).toEqual([
{
replace: '/root/apps/environment/environment.ts',
+6 -4
View File
@@ -1,4 +1,4 @@
import { Path, normalize } from '@angular-devkit/core';
import { normalize } from '@angular-devkit/core';
import { resolve, dirname, relative, basename } from 'path';
import { BuildBuilderOptions } from './types';
import { statSync } from 'fs';
@@ -11,12 +11,14 @@ export interface FileReplacement {
export function normalizeBuildOptions<T extends BuildBuilderOptions>(
options: T,
root: string,
sourceRoot: string
sourceRoot: string,
projectRoot: string
): T {
return {
...options,
root: root,
sourceRoot: sourceRoot,
root,
sourceRoot,
projectRoot,
main: resolve(root, options.main),
outputPath: resolve(root, options.outputPath),
tsConfig: resolve(root, options.tsConfig),
+9
View File
@@ -41,4 +41,13 @@ export interface BuildBuilderOptions {
root?: string;
sourceRoot?: Path;
projectRoot?: string;
}
export interface BuildNodeBuilderOptions extends BuildBuilderOptions {
optimization?: boolean;
sourceMap?: boolean;
externalDependencies: 'all' | 'none' | string[];
buildLibsFromSource?: boolean;
generatePackageJson?: boolean;
}
+3 -16
View File
@@ -419,8 +419,9 @@ function createFetcher(packageManager: string, logger: logging.Logger) {
const dir = dirSync().name;
logger.info(`Fetching ${packageName}@${packageVersion}`);
const install = getPackageManagerInstallCommand(packageManager);
execSync(`${install} ${packageName}@${packageVersion} --prefix=${dir}`, {
execSync(`${install} ${packageName}@${packageVersion}`, {
stdio: [],
cwd: dir,
});
const packageJsonPath = require.resolve(`${packageName}/package.json`, {
paths: [dir],
@@ -564,21 +565,7 @@ async function generateMigrationsJsonAndUpdatePackageJson(
);
}
} catch (e) {
const startVersion = versions(root, {})('@nrwl/workspace');
const installDev = getPackageManagerInstallCommand(packageManager, true);
logger.error(
`NX The migrate command failed. Try the following to migrate your workspace:`
);
logger.error(`> ${installDev} @nrwl/workspace@latest`);
logger.error(
`> nx migrate ${opts.targetPackage}@${opts.targetVersion} --from="@nrwl/workspace@${startVersion}"`
);
logger.error(
`This will use the newest version of the migrate functionality, which might have your issue resolved.`
);
logger.error(
`----------------------------------------------------------------------------------------------------`
);
logger.error(`NX The migrate command failed.`);
throw e;
}
}
+10
View File
@@ -134,6 +134,16 @@
"version": "10.4.0-beta.5",
"description": "Add an explicit dependency on @nrwl/tao",
"factory": "./src/migrations/update-10-4-0/add-explicit-dep-on-tao"
},
"update-script-to-invoke-nx-migrate": {
"version": "10.4.5",
"description": "Update the 'update' npm script to invoke nx migrate",
"factory": "./src/migrations/update-10-4-0/update-script-to-invoke-nx-migrate"
},
"update-decorate-angular-cli": {
"version": "10.4.6",
"description": "Update the decoration script when using Angular CLI",
"factory": "./src/migrations/update-10-4-0/update-decorate-angular-cli"
}
},
"packageJsonUpdates": {
+1 -1
View File
@@ -69,7 +69,7 @@
"yargs": "15.4.1",
"yargs-parser": "20.0.0",
"chalk": "2.4.2",
"axios": "0.19.2",
"axios": "0.21.1",
"flat": "^5.0.2",
"minimatch": "3.0.4",
"inquirer": "^6.3.1",
@@ -1,6 +1,5 @@
#!/usr/bin/env node
import { execSync } from 'child_process';
import { getPackageManagerExecuteCommand } from '../utils/detect-package-manager';
import * as yargs from 'yargs';
import { nxVersion } from '../utils/versions';
import { generateGraph } from './dep-graph';
@@ -11,6 +10,13 @@ import { report } from './report';
import { workspaceSchematic } from './workspace-schematic';
import { affected } from './affected';
import { runMany } from './run-many';
import { dirSync } from 'tmp';
import * as path from 'path';
import { writeFileSync } from 'fs-extra';
import {
detectPackageManager,
getPackageManagerExecuteCommand,
} from '@nrwl/workspace/src/utils/detect-package-manager';
const noop = (yargs: yargs.Argv): yargs.Argv => yargs;
@@ -179,10 +185,17 @@ export const commandsObject = yargs
`,
(yargs) => yargs,
() => {
const executable = `${getPackageManagerExecuteCommand()} tao`;
execSync(`${executable} migrate ${process.argv.slice(3).join(' ')}`, {
stdio: ['inherit', 'inherit', 'inherit'],
});
if (process.env.NX_MIGRATE_USE_LOCAL === undefined) {
const p = taoPath();
execSync(`${p} migrate ${process.argv.slice(3).join(' ')}`, {
stdio: ['inherit', 'inherit', 'inherit'],
});
} else {
const pmc = getPackageManagerExecuteCommand();
execSync(`${pmc} tao migrate ${process.argv.slice(3).join(' ')}`, {
stdio: ['inherit', 'inherit', 'inherit'],
});
}
}
)
.command(report)
@@ -411,3 +424,30 @@ function withTarget(yargs: yargs.Argv): yargs.Argv {
global: false,
});
}
function taoPath() {
const packageManager = detectPackageManager();
const tmpDir = dirSync().name;
writeFileSync(
path.join(tmpDir, 'package.json'),
JSON.stringify({
dependencies: {
'@nrwl/tao': 'latest',
// these deps are required for migrations written using angular devkit
'@angular-devkit/architect': 'latest',
'@angular-devkit/schematics': 'latest',
'@angular-devkit/core': 'latest',
},
license: 'MIT',
})
);
execSync(`${packageManager} install`, {
cwd: tmpDir,
stdio: ['ignore', 'ignore', 'ignore'],
});
return path.join(tmpDir, `node_modules`, '.bin', 'tao');
}
@@ -48,7 +48,17 @@ export function readCache(): false | ProjectGraphCache {
}
}
const data = fileExists(nxDepsPath) ? readJsonFile(nxDepsPath) : null;
let data = null;
try {
if (fileExists(nxDepsPath)) {
data = readJsonFile(nxDepsPath);
}
} catch (error) {
console.log(
`Error reading cache file: ${nxDepsPath}. Process will continue as if cache would not exists.`
);
console.log(error);
}
performance.mark('read cache:end');
performance.measure('read cache', 'read cache:start', 'read cache:end');
@@ -1,10 +1,23 @@
import { chain, Rule } from '@angular-devkit/schematics';
import { formatFiles, addDepsToPackageJson } from '@nrwl/workspace';
import { nxVersion } from '../../../src/utils/versions';
import { formatFiles } from '../../utils/rules/format-files';
import { nxVersion } from '../../utils/versions';
import { sortObjectByKeys, updateJsonInTree } from '../../utils/ast-utils';
export default function update(): Rule {
return chain([
addDepsToPackageJson({}, { '@nrwl/cli': nxVersion }),
updateJsonInTree('package.json', (json) => {
json.dependencies = json.dependencies || {};
json.devDependencies = json.devDependencies || {};
delete json.dependencies['@nrwl/cli'];
json.devDependencies['@nrwl/cli'] = nxVersion;
json.dependencies = sortObjectByKeys(json.dependencies);
json.devDependencies = sortObjectByKeys(json.devDependencies);
return json;
}),
formatFiles(),
]);
}
@@ -1,10 +1,25 @@
import { chain, Rule } from '@angular-devkit/schematics';
import { formatFiles, addDepsToPackageJson } from '@nrwl/workspace';
import { nxVersion } from '../../../src/utils/versions';
import { formatFiles } from '../../utils/rules/format-files';
import { nxVersion } from '../../utils/versions';
import { sortObjectByKeys, updateJsonInTree } from '../../utils/ast-utils';
export default function update(): Rule {
return chain([
addDepsToPackageJson({}, { '@nrwl/tao': nxVersion }),
updateJsonInTree('package.json', (json) => {
json.dependencies = json.dependencies || {};
json.devDependencies = json.devDependencies || {};
delete json.dependencies['@nrwl/cli'];
json.devDependencies['@nrwl/cli'] = nxVersion;
delete json.dependencies['@nrwl/tao'];
json.devDependencies['@nrwl/tao'] = nxVersion;
json.dependencies = sortObjectByKeys(json.dependencies);
json.devDependencies = sortObjectByKeys(json.devDependencies);
return json;
}),
formatFiles(),
]);
}
@@ -0,0 +1,21 @@
import { join as pathJoin } from 'path';
import { readFileSync } from 'fs';
import { Tree } from '@angular-devkit/schematics';
export default function update() {
return (host: Tree) => {
const decorateCli = readFileSync(
pathJoin(
__dirname as any,
'..',
'..',
'schematics',
'utils',
'decorate-angular-cli.js__tmpl__'
)
).toString();
if (host.exists('/decorate-angular-cli.js')) {
host.overwrite('/decorate-angular-cli.js', decorateCli);
}
};
}
@@ -0,0 +1,11 @@
import { Rule } from '@angular-devkit/schematics';
import { updateJsonInTree } from '@nrwl/workspace';
export default function update(): Rule {
return updateJsonInTree('package.json', (json) => {
if (json.scripts && json.scripts.update) {
json.scripts.update = 'nx migrate latest';
}
return json;
});
}
@@ -50,6 +50,14 @@ if (!process.env['NX_CLI_SET']) {
const { output } = require('@nrwl/workspace');
output.warn({ title: 'The Angular CLI was invoked instead of the Nx CLI. Use "npx ng [command]" or "nx [command]" instead.' });
}
if (process.argv[2] === 'update') {
const { output } = require('@nrwl/workspace');
output.error({
title: '"ng update" is deprecated in favor of "nx migrate". Read more: https://nx.dev/latest/angular/workspace/update'
});
throw new Error();
}
${angularCLIInit}
`);
}
@@ -24,15 +24,7 @@
"format": "nx format:write",
"format:write": "nx format:write",
"format:check": "nx format:check",
<% if(cli === 'angular') { %>
"update": "ng update @nrwl/workspace",
<% } %>
<% if(cli === 'nx') { %>
"update": "nx migrate latest",
<% } %>
"workspace-schematic": "nx workspace-schematic",
"dep-graph": "nx dep-graph",
"help": "nx help"
+1 -1
View File
@@ -60,7 +60,7 @@ function insertAfterLastOccurrence(
return new InsertChange(file, lastItemPosition, toInsert);
}
function sortObjectByKeys(obj: unknown) {
export function sortObjectByKeys(obj: unknown) {
return Object.keys(obj)
.sort()
.reduce((result, key) => {
+1 -1
View File
@@ -217,7 +217,7 @@ if (parsedArgs.local) {
process.exit(0);
return;
}
const npmTag = parsedVersion.isPrerelease ? 'next' : 'latest';
const npmTag = parsedVersion.isPrerelease ? 'next' : 'previous';
const npmPublishCommand = `./scripts/publish.sh ${output.version} ${npmTag}`;
console.log('Executing publishing script for all packages:');
console.log(`> ${npmPublishCommand}`);
+12
View File
@@ -5692,6 +5692,13 @@ axios@0.19.2, axios@^0.19.0:
dependencies:
follow-redirects "1.5.10"
axios@0.21.1:
version "0.21.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
dependencies:
follow-redirects "^1.10.0"
axobject-query@^2.0.2, axobject-query@^2.1.2:
version "2.2.0"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be"
@@ -11602,6 +11609,11 @@ follow-redirects@^1.0.0:
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.12.1.tgz#de54a6205311b93d60398ebc01cf7015682312b6"
integrity sha512-tmRv0AVuR7ZyouUHLeNSiO6pqulF7dYa3s19c6t+wz9LD69/uSzdMxJ2S91nTI9U3rt/IldxpzMOFejp6f0hjg==
follow-redirects@^1.10.0:
version "1.13.1"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.1.tgz#5f69b813376cee4fd0474a3aba835df04ab763b7"
integrity sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==
for-in@^0.1.3:
version "0.1.8"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.8.tgz#d8773908e31256109952b1fdb9b3fa867d2775e1"