nx 13.8.8 → 13.9.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/nx.d.ts +1 -0
- package/bin/nx.js +78 -1
- package/bin/nx.js.map +1 -1
- package/package.json +19 -2
- package/src/cli/decorate-cli.d.ts +1 -0
- package/src/cli/decorate-cli.js +19 -0
- package/src/cli/decorate-cli.js.map +1 -0
- package/src/cli/find-workspace-root.d.ts +8 -0
- package/src/cli/find-workspace-root.js +25 -0
- package/src/cli/find-workspace-root.js.map +1 -0
- package/src/cli/index.d.ts +3 -0
- package/src/cli/index.js +74 -0
- package/src/cli/index.js.map +1 -0
- package/src/cli/init-local.d.ts +2 -0
- package/src/cli/init-local.js +109 -0
- package/src/cli/init-local.js.map +1 -0
- package/src/cli/is_ci.d.ts +1 -0
- package/src/cli/is_ci.js +20 -0
- package/src/cli/is_ci.js.map +1 -0
- package/src/cli/output.d.ts +58 -0
- package/src/cli/output.js +129 -0
- package/src/cli/output.js.map +1 -0
- package/src/cli/parse-run-one-options.d.ts +6 -0
- package/src/cli/parse-run-one-options.js +139 -0
- package/src/cli/parse-run-one-options.js.map +1 -0
- package/src/cli/run-cli.d.ts +1 -0
- package/src/cli/run-cli.js +69 -0
- package/src/cli/run-cli.js.map +1 -0
- package/src/cli/workspace.d.ts +4 -0
- package/src/cli/workspace.js +3 -0
- package/src/cli/workspace.js.map +1 -0
- package/src/commands/generate.d.ts +15 -0
- package/src/commands/generate.js +170 -0
- package/src/commands/generate.js.map +1 -0
- package/src/commands/help.d.ts +1 -0
- package/src/commands/help.js +34 -0
- package/src/commands/help.js.map +1 -0
- package/src/commands/migrate.d.ts +77 -0
- package/src/commands/migrate.js +584 -0
- package/src/commands/migrate.js.map +1 -0
- package/src/commands/ngcli-adapter.d.ts +111 -0
- package/src/commands/ngcli-adapter.js +940 -0
- package/src/commands/ngcli-adapter.js.map +1 -0
- package/src/commands/run.d.ts +51 -0
- package/src/commands/run.js +224 -0
- package/src/commands/run.js.map +1 -0
- package/src/compat/compat.d.ts +1 -0
- package/src/compat/compat.js +86 -0
- package/src/compat/compat.js.map +1 -0
- package/src/shared/logger.d.ts +11 -0
- package/src/shared/logger.js +48 -0
- package/src/shared/logger.js.map +1 -0
- package/src/shared/nx-plugin.d.ts +18 -0
- package/src/shared/nx-plugin.js +53 -0
- package/src/shared/nx-plugin.js.map +1 -0
- package/src/shared/nx.d.ts +110 -0
- package/src/shared/nx.js +3 -0
- package/src/shared/nx.js.map +1 -0
- package/src/shared/package-json.d.ts +28 -0
- package/src/shared/package-json.js +10 -0
- package/src/shared/package-json.js.map +1 -0
- package/src/shared/package-manager.d.ts +32 -0
- package/src/shared/package-manager.js +83 -0
- package/src/shared/package-manager.js.map +1 -0
- package/src/shared/params.d.ts +113 -0
- package/src/shared/params.js +587 -0
- package/src/shared/params.js.map +1 -0
- package/src/shared/print-help.d.ts +2 -0
- package/src/shared/print-help.js +32 -0
- package/src/shared/print-help.js.map +1 -0
- package/src/shared/project-graph.d.ts +135 -0
- package/src/shared/project-graph.js +22 -0
- package/src/shared/project-graph.js.map +1 -0
- package/src/shared/tasks.d.ts +82 -0
- package/src/shared/tasks.js +3 -0
- package/src/shared/tasks.js.map +1 -0
- package/src/shared/tree.d.ts +115 -0
- package/src/shared/tree.js +259 -0
- package/src/shared/tree.js.map +1 -0
- package/src/shared/workspace.d.ts +257 -0
- package/src/shared/workspace.js +522 -0
- package/src/shared/workspace.js.map +1 -0
- package/src/utils/app-root.d.ts +2 -0
- package/src/utils/app-root.js +30 -0
- package/src/utils/app-root.js.map +1 -0
- package/src/utils/fileutils.d.ts +31 -0
- package/src/utils/fileutils.js +45 -0
- package/src/utils/fileutils.js.map +1 -0
- package/src/utils/json.d.ts +39 -0
- package/src/utils/json.js +48 -0
- package/src/utils/json.js.map +1 -0
- package/src/utils/object-sort.d.ts +1 -0
- package/src/utils/object-sort.js +12 -0
- package/src/utils/object-sort.js.map +1 -0
- package/src/utils/register.d.ts +9 -0
- package/src/utils/register.js +36 -0
- package/src/utils/register.js.map +1 -0
- package/src/utils/split-target.d.ts +1 -0
- package/src/utils/split-target.js +26 -0
- package/src/utils/split-target.js.map +1 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseRunOneOptions = void 0;
|
|
4
|
+
const yargsParser = require("yargs-parser");
|
|
5
|
+
const fileutils_1 = require("../utils/fileutils");
|
|
6
|
+
function calculateDefaultProjectName(cwd, root, workspaceConfiguration) {
|
|
7
|
+
var _a;
|
|
8
|
+
let relativeCwd = cwd.replace(/\\/g, '/').split(root.replace(/\\/g, '/'))[1];
|
|
9
|
+
if (relativeCwd) {
|
|
10
|
+
relativeCwd = relativeCwd.startsWith('/')
|
|
11
|
+
? relativeCwd.substring(1)
|
|
12
|
+
: relativeCwd;
|
|
13
|
+
const matchingProject = Object.keys(workspaceConfiguration.projects).find((p) => {
|
|
14
|
+
const projectRoot = workspaceConfiguration.projects[p].root;
|
|
15
|
+
return (relativeCwd == projectRoot ||
|
|
16
|
+
relativeCwd.startsWith(`${projectRoot}/`));
|
|
17
|
+
});
|
|
18
|
+
if (matchingProject)
|
|
19
|
+
return matchingProject;
|
|
20
|
+
}
|
|
21
|
+
return (((_a = workspaceConfiguration.cli) === null || _a === void 0 ? void 0 : _a.defaultProjectName) ||
|
|
22
|
+
workspaceConfiguration.defaultProject ||
|
|
23
|
+
workspaceConfiguration.defaultProject);
|
|
24
|
+
}
|
|
25
|
+
const invalidTargetNames = [
|
|
26
|
+
'g',
|
|
27
|
+
'generate',
|
|
28
|
+
'update',
|
|
29
|
+
'migrate',
|
|
30
|
+
'add',
|
|
31
|
+
'affected',
|
|
32
|
+
'run-many',
|
|
33
|
+
'affected:apps',
|
|
34
|
+
'affected:libs',
|
|
35
|
+
'affected:build',
|
|
36
|
+
'affected:test',
|
|
37
|
+
'affected:e2e',
|
|
38
|
+
'affected:dep-graph',
|
|
39
|
+
'affected:lint',
|
|
40
|
+
'print-affected',
|
|
41
|
+
'daemon',
|
|
42
|
+
'format:check',
|
|
43
|
+
'format',
|
|
44
|
+
'format:write',
|
|
45
|
+
'workspace-lint',
|
|
46
|
+
'workspace-generator',
|
|
47
|
+
'workspace-schematic',
|
|
48
|
+
'connect-to-nx-cloud',
|
|
49
|
+
'clear-cache',
|
|
50
|
+
'reset',
|
|
51
|
+
'report',
|
|
52
|
+
'list',
|
|
53
|
+
];
|
|
54
|
+
const targetAliases = {
|
|
55
|
+
b: 'build',
|
|
56
|
+
e: 'e2e',
|
|
57
|
+
'i18n-extract': 'extract-i18n',
|
|
58
|
+
xi18n: 'extract-i18n',
|
|
59
|
+
l: 'lint',
|
|
60
|
+
s: 'serve',
|
|
61
|
+
t: 'test',
|
|
62
|
+
};
|
|
63
|
+
function parseRunOneOptions(root, workspaceConfiguration, args) {
|
|
64
|
+
var _a, _b, _c;
|
|
65
|
+
const defaultProjectName = calculateDefaultProjectName(process.cwd(), root, workspaceConfiguration);
|
|
66
|
+
const parsedArgs = yargsParser(args, {
|
|
67
|
+
boolean: ['prod', 'help'],
|
|
68
|
+
string: ['configuration', 'project'],
|
|
69
|
+
alias: {
|
|
70
|
+
c: 'configuration',
|
|
71
|
+
},
|
|
72
|
+
configuration: {
|
|
73
|
+
'strip-dashed': true,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
if (parsedArgs['help']) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
let project;
|
|
80
|
+
let target;
|
|
81
|
+
let configuration;
|
|
82
|
+
if (parsedArgs._[0] === 'run') {
|
|
83
|
+
[project, target, configuration] = parsedArgs._[1].split(':');
|
|
84
|
+
parsedArgs._ = parsedArgs._.slice(2);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
target = parsedArgs._[0];
|
|
88
|
+
project = parsedArgs._[1];
|
|
89
|
+
parsedArgs._ = parsedArgs._.slice(2);
|
|
90
|
+
}
|
|
91
|
+
if (parsedArgs.project) {
|
|
92
|
+
project = parsedArgs.project;
|
|
93
|
+
}
|
|
94
|
+
const projectIsNotSetExplicitly = !project;
|
|
95
|
+
if (!project && defaultProjectName) {
|
|
96
|
+
project = defaultProjectName;
|
|
97
|
+
}
|
|
98
|
+
// we need both to be able to run a target, no tasks runner
|
|
99
|
+
if (!project || !target) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
// we need both to be able to run a target, no tasks runner
|
|
103
|
+
const p = (_a = workspaceConfiguration.projects) === null || _a === void 0 ? void 0 : _a[project];
|
|
104
|
+
if (!p)
|
|
105
|
+
return false;
|
|
106
|
+
let targets;
|
|
107
|
+
if (typeof p === 'string') {
|
|
108
|
+
targets = (0, fileutils_1.readJsonFile)(`${p}/project.json`).targets;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
targets = (_b = p.architect) !== null && _b !== void 0 ? _b : p.targets;
|
|
112
|
+
}
|
|
113
|
+
// if it doesn't match an existing target, try to find an alias
|
|
114
|
+
if (!(targets === null || targets === void 0 ? void 0 : targets[target]) && targetAliases[target]) {
|
|
115
|
+
target = targetAliases[target];
|
|
116
|
+
}
|
|
117
|
+
// for backwards compat we require targets to be set when use defaultProjectName
|
|
118
|
+
if ((!targets || !targets[target]) && projectIsNotSetExplicitly)
|
|
119
|
+
return false;
|
|
120
|
+
if (invalidTargetNames.indexOf(target) > -1)
|
|
121
|
+
return false;
|
|
122
|
+
if (parsedArgs.configuration) {
|
|
123
|
+
configuration = parsedArgs.configuration;
|
|
124
|
+
}
|
|
125
|
+
else if (parsedArgs.prod) {
|
|
126
|
+
configuration = 'production';
|
|
127
|
+
}
|
|
128
|
+
else if (!configuration && ((_c = targets === null || targets === void 0 ? void 0 : targets[target]) === null || _c === void 0 ? void 0 : _c.defaultConfiguration)) {
|
|
129
|
+
configuration = targets[target].defaultConfiguration;
|
|
130
|
+
}
|
|
131
|
+
const res = { project, target, configuration, parsedArgs };
|
|
132
|
+
delete parsedArgs['c'];
|
|
133
|
+
delete parsedArgs['configuration'];
|
|
134
|
+
delete parsedArgs['prod'];
|
|
135
|
+
delete parsedArgs['project'];
|
|
136
|
+
return res;
|
|
137
|
+
}
|
|
138
|
+
exports.parseRunOneOptions = parseRunOneOptions;
|
|
139
|
+
//# sourceMappingURL=parse-run-one-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-run-one-options.js","sourceRoot":"","sources":["../../../../../packages/nx/src/cli/parse-run-one-options.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAC7C,kDAAkD;AAIlD,SAAS,2BAA2B,CAClC,GAAW,EACX,IAAY,EACZ,sBAAwE;;IAExE,IAAI,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7E,IAAI,WAAW,EAAE;QACf,WAAW,GAAG,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC;YACvC,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;YAC1B,CAAC,CAAC,WAAW,CAAC;QAChB,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC,IAAI,CACvE,CAAC,CAAC,EAAE,EAAE;YACJ,MAAM,WAAW,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAC5D,OAAO,CACL,WAAW,IAAI,WAAW;gBAC1B,WAAW,CAAC,UAAU,CAAC,GAAG,WAAW,GAAG,CAAC,CAC1C,CAAC;QACJ,CAAC,CACF,CAAC;QACF,IAAI,eAAe;YAAE,OAAO,eAAe,CAAC;KAC7C;IACD,OAAO,CACL,CAAA,MAAC,sBAAsB,CAAC,GAAsC,0CAC1D,kBAAkB;QACt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AA,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;QAC/C,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;KAChC;IAED,gFAAgF;IAChF,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,yBAAyB;QAAE,OAAO,KAAK,CAAC;IAC9E,IAAI,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAE1D,IAAI,UAAU,CAAC,aAAa,EAAE;QAC5B,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;KAC1C;SAAM,IAAI,UAAU,CAAC,IAAI,EAAE;QAC1B,aAAa,GAAG,YAAY,CAAC;KAC9B;SAAM,IAAI,CAAC,aAAa,KAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,MAAM,CAAC,0CAAE,oBAAoB,CAAA,EAAE;QACpE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,oBAAoB,CAAC;KACtD;IAED,MAAM,GAAG,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC;IAC3D,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC;IACvB,OAAO,UAAU,CAAC,eAAe,CAAC,CAAC;IACnC,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;IAC1B,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC;IAE7B,OAAO,GAAG,CAAC;AACb,CAAC;AAvFD,gDAuFC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fs_1 = require("fs");
|
|
4
|
+
if (process.env.NX_TERMINAL_OUTPUT_PATH) {
|
|
5
|
+
setUpOutputWatching(process.env.NX_TERMINAL_CAPTURE_STDERR === 'true', process.env.NX_FORWARD_OUTPUT === 'true');
|
|
6
|
+
}
|
|
7
|
+
if (!process.env.NX_WORKSPACE_ROOT) {
|
|
8
|
+
console.error('Invalid Nx command invocation');
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
requireCli();
|
|
12
|
+
function requireCli() {
|
|
13
|
+
process.env.NX_CLI_SET = 'true';
|
|
14
|
+
try {
|
|
15
|
+
const cli = require.resolve('nx/src/cli/index.js', {
|
|
16
|
+
paths: [process.env.NX_WORKSPACE_ROOT],
|
|
17
|
+
});
|
|
18
|
+
require(cli);
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
console.error(`Could not find 'nx' module in this workspace.`, e);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* We need to collect all stdout and stderr and store it, so the caching mechanism
|
|
27
|
+
* could store it.
|
|
28
|
+
*
|
|
29
|
+
* Writing stdout and stderr into different stream is too risky when using TTY.
|
|
30
|
+
*
|
|
31
|
+
* So we are simply monkey-patching the Javascript object. In this case the actual output will always be correct.
|
|
32
|
+
* And the cached output should be correct unless the CLI bypasses process.stdout or console.log and uses some
|
|
33
|
+
* C-binary to write to stdout.
|
|
34
|
+
*/
|
|
35
|
+
function setUpOutputWatching(captureStderr, forwardOutput) {
|
|
36
|
+
const stdoutWrite = process.stdout._write;
|
|
37
|
+
const stderrWrite = process.stderr._write;
|
|
38
|
+
// The terminal output file gets out and err
|
|
39
|
+
const outputPath = process.env.NX_TERMINAL_OUTPUT_PATH;
|
|
40
|
+
const stdoutAndStderrLogFileHandle = (0, fs_1.openSync)(outputPath, 'w');
|
|
41
|
+
const onlyStdout = [];
|
|
42
|
+
process.stdout._write = (chunk, encoding, callback) => {
|
|
43
|
+
onlyStdout.push(chunk);
|
|
44
|
+
(0, fs_1.appendFileSync)(stdoutAndStderrLogFileHandle, chunk);
|
|
45
|
+
if (forwardOutput) {
|
|
46
|
+
stdoutWrite.apply(process.stdout, [chunk, encoding, callback]);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
callback();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
process.stderr._write = (chunk, encoding, callback) => {
|
|
53
|
+
(0, fs_1.appendFileSync)(stdoutAndStderrLogFileHandle, chunk);
|
|
54
|
+
if (forwardOutput) {
|
|
55
|
+
stderrWrite.apply(process.stderr, [chunk, encoding, callback]);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
callback();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
process.on('exit', (code) => {
|
|
62
|
+
// when the process exits successfully, and we are not asked to capture stderr
|
|
63
|
+
// override the file with only stdout
|
|
64
|
+
if (code === 0 && !captureStderr) {
|
|
65
|
+
(0, fs_1.writeFileSync)(outputPath, onlyStdout.join(''));
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=run-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-cli.js","sourceRoot":"","sources":["../../../../../packages/nx/src/cli/run-cli.ts"],"names":[],"mappings":";;AAAA,2BAAwE;AAExE,IAAI,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE;IACvC,mBAAmB,CACjB,OAAO,CAAC,GAAG,CAAC,0BAA0B,KAAK,MAAM,EACjD,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,MAAM,CACzC,CAAC;CACH;AAED,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;IAClC,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AACD,UAAU,EAAE,CAAC;AAEb,SAAS,UAAU;IACjB,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,MAAM,CAAC;IAChC,IAAI;QACF,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,C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ACjB,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;SAChE;aAAM;YACL,QAAQ,EAAE,CAAC;SACZ;IACH,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QAC1B,8EAA8E;QAC9E,qCAAqC;QACrC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE;YAChC,IAAA,kBAAa,EAAC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;SAChD;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../../../packages/nx/src/cli/workspace.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Options, Schema } from '../shared/params';
|
|
2
|
+
export interface GenerateOptions {
|
|
3
|
+
collectionName: string;
|
|
4
|
+
generatorName: string;
|
|
5
|
+
generatorOptions: Options;
|
|
6
|
+
help: boolean;
|
|
7
|
+
debug: boolean;
|
|
8
|
+
dryRun: boolean;
|
|
9
|
+
force: boolean;
|
|
10
|
+
interactive: boolean;
|
|
11
|
+
defaults: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function printGenHelp(opts: GenerateOptions, schema: Schema): void;
|
|
14
|
+
export declare function newWorkspace(cwd: string, args: string[], isVerbose?: boolean): Promise<any>;
|
|
15
|
+
export declare function generate(cwd: string, root: string, args: string[], isVerbose?: boolean): Promise<any>;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generate = exports.newWorkspace = exports.printGenHelp = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const yargsParser = require("yargs-parser");
|
|
6
|
+
const params_1 = require("../shared/params");
|
|
7
|
+
const print_help_1 = require("../shared/print-help");
|
|
8
|
+
const workspace_1 = require("../shared/workspace");
|
|
9
|
+
const tree_1 = require("../shared/tree");
|
|
10
|
+
const logger_1 = require("../shared/logger");
|
|
11
|
+
const chalk = require("chalk");
|
|
12
|
+
function throwInvalidInvocation() {
|
|
13
|
+
throw new Error(`Specify the generator name (e.g., nx generate @nrwl/workspace:library)`);
|
|
14
|
+
}
|
|
15
|
+
function parseGenerateOpts(args, mode, defaultCollection) {
|
|
16
|
+
const generatorOptions = (0, params_1.convertToCamelCase)(yargsParser(args, {
|
|
17
|
+
boolean: ['help', 'dryRun', 'debug', 'force', 'interactive', 'defaults'],
|
|
18
|
+
alias: {
|
|
19
|
+
dryRun: 'dry-run',
|
|
20
|
+
d: 'dryRun',
|
|
21
|
+
},
|
|
22
|
+
default: {
|
|
23
|
+
debug: false,
|
|
24
|
+
dryRun: false,
|
|
25
|
+
interactive: true,
|
|
26
|
+
},
|
|
27
|
+
}));
|
|
28
|
+
// TODO: vsavkin remove defaults in Nx 13
|
|
29
|
+
if (generatorOptions.defaults) {
|
|
30
|
+
logger_1.logger.warn(`Use --no-interactive instead of --defaults. The --defaults option will be removed in Nx 13.`);
|
|
31
|
+
generatorOptions.interactive = false;
|
|
32
|
+
}
|
|
33
|
+
let collectionName = null;
|
|
34
|
+
let generatorName = null;
|
|
35
|
+
if (mode === 'generate') {
|
|
36
|
+
if (!generatorOptions['_'] ||
|
|
37
|
+
generatorOptions['_'].length === 0) {
|
|
38
|
+
throwInvalidInvocation();
|
|
39
|
+
}
|
|
40
|
+
const generatorDescriptor = generatorOptions['_'].shift();
|
|
41
|
+
const separatorIndex = generatorDescriptor.lastIndexOf(':');
|
|
42
|
+
if (separatorIndex > 0) {
|
|
43
|
+
collectionName = generatorDescriptor.substr(0, separatorIndex);
|
|
44
|
+
generatorName = generatorDescriptor.substr(separatorIndex + 1);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
collectionName = defaultCollection;
|
|
48
|
+
generatorName = generatorDescriptor;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
collectionName = generatorOptions.collection;
|
|
53
|
+
generatorName = 'new';
|
|
54
|
+
}
|
|
55
|
+
if (!collectionName) {
|
|
56
|
+
throwInvalidInvocation();
|
|
57
|
+
}
|
|
58
|
+
const res = {
|
|
59
|
+
collectionName,
|
|
60
|
+
generatorName,
|
|
61
|
+
generatorOptions,
|
|
62
|
+
help: generatorOptions.help,
|
|
63
|
+
debug: generatorOptions.debug,
|
|
64
|
+
dryRun: generatorOptions.dryRun,
|
|
65
|
+
force: generatorOptions.force,
|
|
66
|
+
interactive: generatorOptions.interactive,
|
|
67
|
+
defaults: generatorOptions.defaults,
|
|
68
|
+
};
|
|
69
|
+
delete generatorOptions.debug;
|
|
70
|
+
delete generatorOptions.d;
|
|
71
|
+
delete generatorOptions.dryRun;
|
|
72
|
+
delete generatorOptions.force;
|
|
73
|
+
delete generatorOptions.interactive;
|
|
74
|
+
delete generatorOptions.defaults;
|
|
75
|
+
delete generatorOptions.help;
|
|
76
|
+
delete generatorOptions.collection;
|
|
77
|
+
delete generatorOptions['--'];
|
|
78
|
+
return res;
|
|
79
|
+
}
|
|
80
|
+
function printGenHelp(opts, schema) {
|
|
81
|
+
(0, print_help_1.printHelp)(`nx generate ${opts.collectionName}:${opts.generatorName}`, Object.assign(Object.assign({}, schema), { properties: Object.assign(Object.assign({}, schema.properties), { dryRun: {
|
|
82
|
+
type: 'boolean',
|
|
83
|
+
default: false,
|
|
84
|
+
description: `Runs through and reports activity without writing to disk.`,
|
|
85
|
+
} }) }));
|
|
86
|
+
}
|
|
87
|
+
exports.printGenHelp = printGenHelp;
|
|
88
|
+
function readDefaultCollection(nxConfig) {
|
|
89
|
+
return nxConfig.cli ? nxConfig.cli.defaultCollection : null;
|
|
90
|
+
}
|
|
91
|
+
function printChanges(fileChanges) {
|
|
92
|
+
fileChanges.forEach((f) => {
|
|
93
|
+
if (f.type === 'CREATE') {
|
|
94
|
+
console.log(`${chalk.green('CREATE')} ${f.path}`);
|
|
95
|
+
}
|
|
96
|
+
else if (f.type === 'UPDATE') {
|
|
97
|
+
console.log(`${chalk.white('UPDATE')} ${f.path}`);
|
|
98
|
+
}
|
|
99
|
+
else if (f.type === 'DELETE') {
|
|
100
|
+
console.log(`${chalk.yellow('DELETE')} ${f.path}`);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function newWorkspace(cwd, args, isVerbose = false) {
|
|
105
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
106
|
+
const ws = new workspace_1.Workspaces(null);
|
|
107
|
+
return (0, params_1.handleErrors)(isVerbose, () => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
108
|
+
const opts = parseGenerateOpts(args, 'new', null);
|
|
109
|
+
const { normalizedGeneratorName, schema, implementationFactory } = ws.readGenerator(opts.collectionName, opts.generatorName);
|
|
110
|
+
const combinedOpts = yield (0, params_1.combineOptionsForGenerator)(opts.generatorOptions, opts.collectionName, normalizedGeneratorName, null, schema, opts.interactive, null, null, isVerbose);
|
|
111
|
+
if (ws.isNxGenerator(opts.collectionName, normalizedGeneratorName)) {
|
|
112
|
+
const host = new tree_1.FsTree(cwd, isVerbose);
|
|
113
|
+
const implementation = implementationFactory();
|
|
114
|
+
const task = yield implementation(host, combinedOpts);
|
|
115
|
+
const changes = host.listChanges();
|
|
116
|
+
printChanges(changes);
|
|
117
|
+
if (!opts.dryRun) {
|
|
118
|
+
(0, tree_1.flushChanges)(cwd, changes);
|
|
119
|
+
if (task) {
|
|
120
|
+
yield task();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
logger_1.logger.warn(`\nNOTE: The "dryRun" flag means no changes were made.`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
return (yield Promise.resolve().then(() => require('./ngcli-adapter'))).generate(cwd, Object.assign(Object.assign({}, opts), { generatorOptions: combinedOpts }), isVerbose);
|
|
129
|
+
}
|
|
130
|
+
}));
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
exports.newWorkspace = newWorkspace;
|
|
134
|
+
function generate(cwd, root, args, isVerbose = false) {
|
|
135
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
136
|
+
const ws = new workspace_1.Workspaces(root);
|
|
137
|
+
return (0, params_1.handleErrors)(isVerbose, () => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
138
|
+
const workspaceDefinition = ws.readWorkspaceConfiguration();
|
|
139
|
+
const opts = parseGenerateOpts(args, 'generate', readDefaultCollection(workspaceDefinition));
|
|
140
|
+
const { normalizedGeneratorName, schema, implementationFactory } = ws.readGenerator(opts.collectionName, opts.generatorName);
|
|
141
|
+
if (opts.help) {
|
|
142
|
+
printGenHelp(opts, schema);
|
|
143
|
+
return 0;
|
|
144
|
+
}
|
|
145
|
+
const combinedOpts = yield (0, params_1.combineOptionsForGenerator)(opts.generatorOptions, opts.collectionName, normalizedGeneratorName, workspaceDefinition, schema, opts.interactive, ws.calculateDefaultProjectName(cwd, workspaceDefinition), ws.relativeCwd(cwd), isVerbose);
|
|
146
|
+
if (ws.isNxGenerator(opts.collectionName, normalizedGeneratorName)) {
|
|
147
|
+
const host = new tree_1.FsTree(root, isVerbose);
|
|
148
|
+
const implementation = implementationFactory();
|
|
149
|
+
const task = yield implementation(host, combinedOpts);
|
|
150
|
+
const changes = host.listChanges();
|
|
151
|
+
printChanges(changes);
|
|
152
|
+
if (!opts.dryRun) {
|
|
153
|
+
(0, tree_1.flushChanges)(root, changes);
|
|
154
|
+
if (task) {
|
|
155
|
+
yield task();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
logger_1.logger.warn(`\nNOTE: The "dryRun" flag means no changes were made.`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
require('../compat/compat');
|
|
164
|
+
return (yield Promise.resolve().then(() => require('./ngcli-adapter'))).generate(root, Object.assign(Object.assign({}, opts), { generatorOptions: combinedOpts }), isVerbose);
|
|
165
|
+
}
|
|
166
|
+
}));
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
exports.generate = generate;
|
|
170
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../../../packages/nx/src/commands/generate.ts"],"names":[],"mappings":";;;;AAAA,4CAA4C;AAC5C,6CAM0B;AAC1B,qDAAiD;AACjD,mDAAiD;AACjD,yCAAkE;AAClE,6CAA0C;AAC1C,+BAA+B;AAe/B,SAAS,sBAAsB;IAC7B,MAAM,IAAI,KAAK,CACb,wEAAwE,CACzE,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CACxB,IAAc,EACd,IAAwB,EACxB,iBAAgC;IAEhC,MAAM,gBAAgB,GAAG,IAAA,2BAAkB,EACzC,WAAW,CAAC,IAAI,EAAE;QAChB,OAAO,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,CAAC;QACxE,KAAK,EAAE;YACL,MAAM,EAAE,SAAS;YACjB,CAAC,EAAE,QAAQ;SACZ;QACD,OAAO,EAAE;YACP,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,KAAK;YACb,WAAW,EAAE,IAAI;SAClB;KACF,CAAC,CACH,CAAC;IAEF,yCAAyC;IACzC,IAAI,gBAAgB,CAAC,QAAQ,EAAE;QAC7B,eAAM,CAAC,IAAI,CACT,6FAA6F,CAC9F,CAAC;QACF,gBAAgB,CAAC,WAAW,GAAG,KAAK,CAAC;KACtC;IAED,IAAI,cAAc,GAAkB,IAAI,CAAC;IACzC,IAAI,aAAa,GAAkB,IAAI,CAAC;IACxC,IAAI,IAAI,K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AuB,CAAC,EAAE;gBAClE,MAAM,IAAI,GAAG,IAAI,aAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;gBACzC,MAAM,cAAc,GAAG,qBAAqB,EAAE,CAAC;gBAC/C,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;gBACtD,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;gBAEnC,YAAY,CAAC,OAAO,CAAC,CAAC;gBACtB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;oBAChB,IAAA,mBAAY,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;oBAC5B,IAAI,IAAI,EAAE;wBACR,MAAM,IAAI,EAAE,CAAC;qBACd;iBACF;qBAAM;oBACL,eAAM,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;iBACtE;aACF;iBAAM;gBACL,OAAO,CAAC,kBAAkB,CAAC,CAAC;gBAC5B,OAAO,CAAC,2CAAa,iBAAiB,EAAC,CAAC,CAAC,QAAQ,CAC/C,IAAI,kCAEC,IAAI,KACP,gBAAgB,EAAE,YAAY,KAEhC,SAAS,CACV,CAAC;aACH;QACH,CAAC,CAAA,CAAC,CAAC;IACL,CAAC;CAAA;AA9DD,4BA8DC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function help(): number;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.help = void 0;
|
|
4
|
+
const chalk = require("chalk");
|
|
5
|
+
const logger_1 = require("../shared/logger");
|
|
6
|
+
function help() {
|
|
7
|
+
logger_1.logger.info((0, logger_1.stripIndent)(`
|
|
8
|
+
${chalk.bold('Nx - Smart, Fast and Extensible Build System')}
|
|
9
|
+
|
|
10
|
+
${chalk.bold('Create a new project.')}
|
|
11
|
+
nx new ${chalk.grey('[project-name] [--collection=collection] [options, ...]')}
|
|
12
|
+
|
|
13
|
+
${chalk.bold('Generate code.')}
|
|
14
|
+
nx generate ${chalk.grey('[collection:][generator] [options, ...]')}
|
|
15
|
+
nx g ${chalk.grey('[collection:][generator] [options, ...]')}
|
|
16
|
+
|
|
17
|
+
${chalk.bold('Run target.')}
|
|
18
|
+
nx run ${chalk.grey('[project][:target][:configuration] [options, ...]')}
|
|
19
|
+
nx r ${chalk.grey('[project][:target][:configuration] [options, ...]')}
|
|
20
|
+
|
|
21
|
+
You can also use the infix notation to run a target:
|
|
22
|
+
nx [target] [project] [options, ...]
|
|
23
|
+
|
|
24
|
+
${chalk.bold('Migrate packages and create migrations.json.')}
|
|
25
|
+
nx migrate ${chalk.grey('[package-name]')}
|
|
26
|
+
|
|
27
|
+
${chalk.bold('Run migrations.')}
|
|
28
|
+
nx migrate ${chalk.grey('--run-migrations=[filename]')}
|
|
29
|
+
|
|
30
|
+
`));
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
exports.help = help;
|
|
34
|
+
//# sourceMappingURL=help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../../../../packages/nx/src/commands/help.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,6CAAuD;AAEvD,SAAgB,IAAI;IAClB,eAAM,CAAC,IAAI,CACT,IAAA,oBAAW,EAAC;MACV,KAAK,CAAC,IAAI,CAAC,8CAA8C,CAAC;;MAE1D,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC;cAC3B,KAAK,CAAC,IAAI,CACjB,yDAAyD,CAC1D;;MAEA,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC;mBACf,KAAK,CAAC,IAAI,CAAC,yCAAyC,CAAC;YAC5D,KAAK,CAAC,IAAI,CAAC,yCAAyC,CAAC;;MAE3D,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC;cACjB,KAAK,CAAC,IAAI,CAAC,mDAAmD,CAAC;YACjE,KAAK,CAAC,IAAI,CAAC,mDAAmD,CAAC;;;;;MAKrE,KAAK,CAAC,IAAI,CAAC,8CAA8C,CAAC;kBAC9C,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC;;MAExC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC;kBACjB,KAAK,CAAC,IAAI,CAAC,6BAA6B,CAAC;;GAExD,CAAC,CACD,CAAC;IACF,OAAO,CAAC,CAAC;AACX,CAAC;AA9BD,oBA8BC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
declare type Dependencies = 'dependencies' | 'devDependencies';
|
|
2
|
+
export declare type MigrationsJson = {
|
|
3
|
+
version: string;
|
|
4
|
+
collection?: string;
|
|
5
|
+
generators?: {
|
|
6
|
+
[name: string]: {
|
|
7
|
+
version: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
cli?: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
packageJsonUpdates?: {
|
|
13
|
+
[name: string]: {
|
|
14
|
+
version: string;
|
|
15
|
+
packages: {
|
|
16
|
+
[p: string]: {
|
|
17
|
+
version: string;
|
|
18
|
+
ifPackageInstalled?: string;
|
|
19
|
+
alwaysAddToPackageJson?: boolean;
|
|
20
|
+
addToPackageJson?: Dependencies;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare function normalizeVersion(version: string): string;
|
|
27
|
+
export declare class Migrator {
|
|
28
|
+
private readonly packageJson;
|
|
29
|
+
private readonly versions;
|
|
30
|
+
private readonly fetch;
|
|
31
|
+
private readonly from;
|
|
32
|
+
private readonly to;
|
|
33
|
+
constructor(opts: {
|
|
34
|
+
packageJson: any;
|
|
35
|
+
versions: (p: string) => string;
|
|
36
|
+
fetch: (p: string, v: string) => Promise<MigrationsJson>;
|
|
37
|
+
from: {
|
|
38
|
+
[p: string]: string;
|
|
39
|
+
};
|
|
40
|
+
to: {
|
|
41
|
+
[p: string]: string;
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
updatePackageJson(targetPackage: string, targetVersion: string): Promise<{
|
|
45
|
+
packageJson: any;
|
|
46
|
+
migrations: {
|
|
47
|
+
package: string;
|
|
48
|
+
name: string;
|
|
49
|
+
version: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
cli?: string;
|
|
52
|
+
}[];
|
|
53
|
+
}>;
|
|
54
|
+
private _createMigrateJson;
|
|
55
|
+
private _updatePackageJson;
|
|
56
|
+
private collapsePackages;
|
|
57
|
+
private gt;
|
|
58
|
+
private lte;
|
|
59
|
+
}
|
|
60
|
+
declare type GenerateMigrations = {
|
|
61
|
+
type: 'generateMigrations';
|
|
62
|
+
targetPackage: string;
|
|
63
|
+
targetVersion: string;
|
|
64
|
+
from: {
|
|
65
|
+
[k: string]: string;
|
|
66
|
+
};
|
|
67
|
+
to: {
|
|
68
|
+
[k: string]: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
declare type RunMigrations = {
|
|
72
|
+
type: 'runMigrations';
|
|
73
|
+
runMigrations: string;
|
|
74
|
+
};
|
|
75
|
+
export declare function parseMigrationsOptions(args: string[]): GenerateMigrations | RunMigrations;
|
|
76
|
+
export declare function migrate(root: string, args: string[], isVerbose?: boolean): Promise<any>;
|
|
77
|
+
export {};
|