@nx/js 22.7.0-beta.1 → 22.7.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/package.json +4 -4
- package/src/executors/node/lib/detect-module-format.js +2 -1
- package/src/executors/node/lib/kill-tree.js +3 -3
- package/src/executors/node/node.impl.js +5 -4
- package/src/executors/release-publish/log-tar.js +8 -7
- package/src/executors/release-publish/release-publish.impl.js +3 -3
- package/src/executors/tsc/lib/typescript-compilation.js +2 -1
- package/src/executors/tsc/lib/typescript-diagnostic-reporters.js +2 -1
- package/src/executors/tsc/tsc.impl.js +2 -1
- package/src/executors/verdaccio/verdaccio.impl.d.ts.map +1 -1
- package/src/executors/verdaccio/verdaccio.impl.js +20 -21
- package/src/generators/library/library.js +2 -1
- package/src/generators/library/utils/add-release-config.js +2 -1
- package/src/generators/setup-verdaccio/generator.js +3 -2
- package/src/generators/typescript-sync/typescript-sync.js +3 -2
- package/src/plugins/jest/start-local-registry.js +2 -2
- package/src/release/utils/update-lock-file.js +1 -1
- package/src/release/version-actions.js +1 -1
- package/src/utils/assets/copy-assets-handler.js +4 -3
- package/src/utils/code-frames/highlight.js +4 -3
- package/src/utils/generate-globs.js +2 -1
- package/src/utils/npm-config.js +1 -1
- package/src/utils/prettier.js +36 -3
- package/src/utils/swc/compile-swc.js +2 -2
- package/src/utils/typescript/run-type-check.js +8 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "22.7.0-beta.
|
|
3
|
+
"version": "22.7.0-beta.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
|
|
6
6
|
"repository": {
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"@babel/preset-env": "^7.23.2",
|
|
40
40
|
"@babel/preset-typescript": "^7.22.5",
|
|
41
41
|
"@babel/runtime": "^7.22.6",
|
|
42
|
-
"@nx/devkit": "22.7.0-beta.
|
|
43
|
-
"@nx/workspace": "22.7.0-beta.
|
|
42
|
+
"@nx/devkit": "22.7.0-beta.2",
|
|
43
|
+
"@nx/workspace": "22.7.0-beta.2",
|
|
44
44
|
"@zkochan/js-yaml": "0.0.7",
|
|
45
45
|
"babel-plugin-const-enum": "^1.0.1",
|
|
46
46
|
"babel-plugin-macros": "^3.1.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"tslib": "^2.3.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"nx": "22.7.0-beta.
|
|
63
|
+
"nx": "22.7.0-beta.2"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"verdaccio": "^6.0.5"
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.detectModuleFormat = detectModuleFormat;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const fs_1 = require("fs");
|
|
6
7
|
const path_1 = require("path");
|
|
7
8
|
const ts_config_1 = require("../../../utils/typescript/ts-config");
|
|
8
|
-
const ts = require("typescript");
|
|
9
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
9
10
|
function detectModuleFormat(options) {
|
|
10
11
|
if (options.buildOptions?.format) {
|
|
11
12
|
const formats = Array.isArray(options.buildOptions.format)
|
|
@@ -20,7 +20,7 @@ async function killTree(pid, signal) {
|
|
|
20
20
|
switch (process.platform) {
|
|
21
21
|
case 'win32':
|
|
22
22
|
(0, child_process_1.exec)('taskkill /pid ' + pid + ' /T /F', {
|
|
23
|
-
windowsHide:
|
|
23
|
+
windowsHide: true,
|
|
24
24
|
}, (error) => {
|
|
25
25
|
// Ignore Fatal errors (128) because it might be due to the process already being killed.
|
|
26
26
|
// On Linux/Mac we can check ESRCH (no such process), but on Windows we can't.
|
|
@@ -30,7 +30,7 @@ async function killTree(pid, signal) {
|
|
|
30
30
|
case 'darwin':
|
|
31
31
|
buildProcessTree(pid, tree, pidsToProcess, function (parentPid) {
|
|
32
32
|
return (0, child_process_1.spawn)('pgrep', ['-P', parentPid], {
|
|
33
|
-
windowsHide:
|
|
33
|
+
windowsHide: true,
|
|
34
34
|
});
|
|
35
35
|
}, function () {
|
|
36
36
|
killAll(tree, signal, callback);
|
|
@@ -39,7 +39,7 @@ async function killTree(pid, signal) {
|
|
|
39
39
|
default: // Linux
|
|
40
40
|
buildProcessTree(pid, tree, pidsToProcess, function (parentPid) {
|
|
41
41
|
return (0, child_process_1.spawn)('ps', ['-o', 'pid', '--no-headers', '--ppid', parentPid], {
|
|
42
|
-
windowsHide:
|
|
42
|
+
windowsHide: true,
|
|
43
43
|
});
|
|
44
44
|
}, function () {
|
|
45
45
|
killAll(tree, signal, callback);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.nodeExecutor = nodeExecutor;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
5
6
|
const child_process_1 = require("child_process");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
8
|
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
8
9
|
const client_1 = require("nx/src/daemon/client/client");
|
|
9
10
|
const crypto_1 = require("crypto");
|
|
10
|
-
const path = require("path");
|
|
11
|
+
const path = tslib_1.__importStar(require("path"));
|
|
11
12
|
const path_1 = require("path");
|
|
12
13
|
const buildable_libs_utils_1 = require("../../utils/buildable-libs-utils");
|
|
13
14
|
const kill_tree_1 = require("./lib/kill-tree");
|
|
@@ -23,7 +24,7 @@ async function* nodeExecutor(options, context) {
|
|
|
23
24
|
const project = context.projectGraph.nodes[context.projectName];
|
|
24
25
|
const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context);
|
|
25
26
|
if (!project.data.targets[buildTarget.target]) {
|
|
26
|
-
throw new Error(`Cannot find build target ${
|
|
27
|
+
throw new Error(`Cannot find build target ${chalk_1.default.bold(options.buildTarget)} for project ${chalk_1.default.bold(context.projectName)}`);
|
|
27
28
|
}
|
|
28
29
|
const buildTargetExecutor = project.data.targets[buildTarget.target]?.executor;
|
|
29
30
|
if (buildTargetExecutor === 'nx:run-commands') {
|
|
@@ -331,7 +332,7 @@ function getFileToRun(context, project, buildOptions, buildTargetExecutor) {
|
|
|
331
332
|
return path.join(outputFilePath, 'main.js');
|
|
332
333
|
}
|
|
333
334
|
const fallbackFile = path.join('dist', project.data.root, 'main.js');
|
|
334
|
-
devkit_1.logger.warn(`Build option ${
|
|
335
|
+
devkit_1.logger.warn(`Build option ${chalk_1.default.bold('outputFileName')} not set for ${chalk_1.default.bold(project.name)}. Using fallback value of ${chalk_1.default.bold(fallbackFile)}.`);
|
|
335
336
|
return (0, path_1.join)(context.root, fallbackFile);
|
|
336
337
|
}
|
|
337
338
|
let outputFileName = buildOptions.outputFileName;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logTar = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
// Adapted from https://github.com/npm/cli/blob/c736b622b8504b07f5a19f631ade42dd40063269/lib/utils/tar.js
|
|
5
|
-
const
|
|
6
|
-
const
|
|
6
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
+
const columnify_1 = tslib_1.__importDefault(require("columnify"));
|
|
7
8
|
const format_bytes_1 = require("./format-bytes");
|
|
8
9
|
const logTar = (tarball, opts = {}) => {
|
|
9
10
|
// @ts-ignore
|
|
10
11
|
const { unicode = true } = opts;
|
|
11
12
|
console.log('');
|
|
12
13
|
console.log(`${unicode ? '📦 ' : 'package:'} ${tarball.name}@${tarball.version}`);
|
|
13
|
-
console.log(
|
|
14
|
+
console.log(chalk_1.default.magenta('=== Tarball Contents ==='));
|
|
14
15
|
if (tarball.files.length) {
|
|
15
16
|
console.log('');
|
|
16
|
-
const columnData =
|
|
17
|
+
const columnData = (0, columnify_1.default)(tarball.files
|
|
17
18
|
.map((f) => {
|
|
18
19
|
const bytes = (0, format_bytes_1.formatBytes)(f.size, false);
|
|
19
20
|
return /^node_modules\//.test(f.path)
|
|
@@ -29,11 +30,11 @@ const logTar = (tarball, opts = {}) => {
|
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
if (tarball.bundled.length) {
|
|
32
|
-
console.log(
|
|
33
|
+
console.log(chalk_1.default.magenta('=== Bundled Dependencies ==='));
|
|
33
34
|
tarball.bundled.forEach((name) => console.log('', name));
|
|
34
35
|
}
|
|
35
|
-
console.log(
|
|
36
|
-
console.log(
|
|
36
|
+
console.log(chalk_1.default.magenta('=== Tarball Details ==='));
|
|
37
|
+
console.log((0, columnify_1.default)([
|
|
37
38
|
{ name: 'name:', value: tarball.name },
|
|
38
39
|
{ name: 'version:', value: tarball.version },
|
|
39
40
|
tarball.filename && { name: 'filename:', value: tarball.filename },
|
|
@@ -151,7 +151,7 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
151
151
|
env: processEnv(true),
|
|
152
152
|
cwd: context.root,
|
|
153
153
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
154
|
-
windowsHide:
|
|
154
|
+
windowsHide: true,
|
|
155
155
|
});
|
|
156
156
|
const resultJson = JSON.parse(result.toString());
|
|
157
157
|
const distTags = resultJson['dist-tags'] || {};
|
|
@@ -173,7 +173,7 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
173
173
|
env: processEnv(true),
|
|
174
174
|
cwd: context.root,
|
|
175
175
|
stdio: 'ignore',
|
|
176
|
-
windowsHide:
|
|
176
|
+
windowsHide: true,
|
|
177
177
|
});
|
|
178
178
|
console.log(`Added the dist-tag ${tag} to v${currentVersion} for registry ${registry}.\n`);
|
|
179
179
|
}
|
|
@@ -286,7 +286,7 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
286
286
|
env: processEnv(true),
|
|
287
287
|
cwd: context.root,
|
|
288
288
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
289
|
-
windowsHide:
|
|
289
|
+
windowsHide: true,
|
|
290
290
|
});
|
|
291
291
|
// If in dry-run mode, the version on disk will not represent the version that would be published, so we scrub it from the output to avoid confusion.
|
|
292
292
|
const dryRunVersionPlaceholder = 'X.X.X-dry-run';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.compileTypescriptSolution = compileTypescriptSolution;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
5
|
-
const ts = require("typescript");
|
|
6
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
6
7
|
const get_custom_transformers_factory_1 = require("./get-custom-transformers-factory");
|
|
7
8
|
const typescript_diagnostic_reporters_1 = require("./typescript-diagnostic-reporters");
|
|
8
9
|
// https://github.com/microsoft/TypeScript/blob/d45012c5e2ab122919ee4777a7887307c5f4a1e0/src/compiler/diagnosticMessages.json#L4050-L4053
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatDiagnosticReport = formatDiagnosticReport;
|
|
4
4
|
exports.formatSolutionBuilderStatusReport = formatSolutionBuilderStatusReport;
|
|
5
|
-
const
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
6
7
|
// adapted from TS default diagnostic reporter
|
|
7
8
|
function formatDiagnosticReport(diagnostic, host) {
|
|
8
9
|
const diagnostics = new Array(1);
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.determineModuleFormatFromTsConfig = determineModuleFormatFromTsConfig;
|
|
4
4
|
exports.createTypeScriptCompilationOptions = createTypeScriptCompilationOptions;
|
|
5
5
|
exports.tscExecutor = tscExecutor;
|
|
6
|
-
const
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
7
8
|
const devkit_1 = require("@nx/devkit");
|
|
8
9
|
const fs_1 = require("fs");
|
|
9
10
|
const path_1 = require("path");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verdaccio.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/verdaccio/verdaccio.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAU,MAAM,YAAY,CAAC;AAOrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAUnD;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,eAAe;;;GAqDzB;
|
|
1
|
+
{"version":3,"file":"verdaccio.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/verdaccio/verdaccio.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAU,MAAM,YAAY,CAAC;AAOrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAUnD;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,eAAe;;;GAqDzB;AAkTD,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.verdaccioExecutor = verdaccioExecutor;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const child_process_1 = require("child_process");
|
|
7
|
-
const
|
|
8
|
+
const detect_port_1 = tslib_1.__importDefault(require("detect-port"));
|
|
8
9
|
const node_fs_1 = require("node:fs");
|
|
9
10
|
const path_1 = require("path");
|
|
10
11
|
const semver_1 = require("semver");
|
|
@@ -32,7 +33,7 @@ async function verdaccioExecutor(options, context) {
|
|
|
32
33
|
console.log(`Cleared local registry storage folder ${options.storage}`);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
const port = await
|
|
36
|
+
const port = await (0, detect_port_1.default)(options.port);
|
|
36
37
|
if (port !== options.port) {
|
|
37
38
|
devkit_1.logger.info(`Port ${options.port} was occupied. Using port ${port}.`);
|
|
38
39
|
options.port = port;
|
|
@@ -116,7 +117,7 @@ function createVerdaccioOptions(options, workspaceRoot) {
|
|
|
116
117
|
}
|
|
117
118
|
function setupNpm(options) {
|
|
118
119
|
try {
|
|
119
|
-
(0, child_process_1.execSync)('npm --version', { env, windowsHide:
|
|
120
|
+
(0, child_process_1.execSync)('npm --version', { env, windowsHide: true });
|
|
120
121
|
}
|
|
121
122
|
catch (e) {
|
|
122
123
|
return () => { };
|
|
@@ -127,13 +128,13 @@ function setupNpm(options) {
|
|
|
127
128
|
scopes.forEach((scope) => {
|
|
128
129
|
const registryName = scope ? `${scope}:registry` : 'registry';
|
|
129
130
|
try {
|
|
130
|
-
npmRegistryPaths.push((0, child_process_1.execSync)(`npm config get ${registryName} --location ${options.location}`, { env, windowsHide:
|
|
131
|
+
npmRegistryPaths.push((0, child_process_1.execSync)(`npm config get ${registryName} --location ${options.location}`, { env, windowsHide: true })
|
|
131
132
|
?.toString()
|
|
132
133
|
?.trim()
|
|
133
134
|
?.replace('\u001b[2K\u001b[1G', '') // strip out ansi codes
|
|
134
135
|
);
|
|
135
|
-
(0, child_process_1.execSync)(`npm config set ${registryName} http://${options.listenAddress}:${options.port}/ --location ${options.location}`, { env, windowsHide:
|
|
136
|
-
(0, child_process_1.execSync)(`npm config set //${options.listenAddress}:${options.port}/:_authToken="secretVerdaccioToken" --location ${options.location}`, { env, windowsHide:
|
|
136
|
+
(0, child_process_1.execSync)(`npm config set ${registryName} http://${options.listenAddress}:${options.port}/ --location ${options.location}`, { env, windowsHide: true });
|
|
137
|
+
(0, child_process_1.execSync)(`npm config set //${options.listenAddress}:${options.port}/:_authToken="secretVerdaccioToken" --location ${options.location}`, { env, windowsHide: true });
|
|
137
138
|
devkit_1.logger.info(`Set npm ${registryName} to http://${options.listenAddress}:${options.port}/`);
|
|
138
139
|
}
|
|
139
140
|
catch (e) {
|
|
@@ -142,7 +143,7 @@ function setupNpm(options) {
|
|
|
142
143
|
});
|
|
143
144
|
return () => {
|
|
144
145
|
try {
|
|
145
|
-
const currentNpmRegistryPath = (0, child_process_1.execSync)(`npm config get registry --location ${options.location}`, { env, windowsHide:
|
|
146
|
+
const currentNpmRegistryPath = (0, child_process_1.execSync)(`npm config get registry --location ${options.location}`, { env, windowsHide: true })
|
|
146
147
|
?.toString()
|
|
147
148
|
?.trim()
|
|
148
149
|
?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
|
|
@@ -150,18 +151,18 @@ function setupNpm(options) {
|
|
|
150
151
|
const registryName = scope ? `${scope}:registry` : 'registry';
|
|
151
152
|
if (npmRegistryPaths[index] &&
|
|
152
153
|
currentNpmRegistryPath.includes(options.listenAddress)) {
|
|
153
|
-
(0, child_process_1.execSync)(`npm config set ${registryName} ${npmRegistryPaths[index]} --location ${options.location}`, { env, windowsHide:
|
|
154
|
+
(0, child_process_1.execSync)(`npm config set ${registryName} ${npmRegistryPaths[index]} --location ${options.location}`, { env, windowsHide: true });
|
|
154
155
|
devkit_1.logger.info(`Reset npm ${registryName} to ${npmRegistryPaths[index]}`);
|
|
155
156
|
}
|
|
156
157
|
else {
|
|
157
158
|
(0, child_process_1.execSync)(`npm config delete ${registryName} --location ${options.location}`, {
|
|
158
159
|
env,
|
|
159
|
-
windowsHide:
|
|
160
|
+
windowsHide: true,
|
|
160
161
|
});
|
|
161
162
|
devkit_1.logger.info('Cleared custom npm registry');
|
|
162
163
|
}
|
|
163
164
|
});
|
|
164
|
-
(0, child_process_1.execSync)(`npm config delete //${options.listenAddress}:${options.port}/:_authToken --location ${options.location}`, { env, windowsHide:
|
|
165
|
+
(0, child_process_1.execSync)(`npm config delete //${options.listenAddress}:${options.port}/:_authToken --location ${options.location}`, { env, windowsHide: true });
|
|
165
166
|
}
|
|
166
167
|
catch (e) {
|
|
167
168
|
throw new Error(`Failed to reset npm registry: ${e.message}`);
|
|
@@ -176,17 +177,17 @@ function getYarnUnsafeHttpWhitelist(isYarnV1) {
|
|
|
176
177
|
return !isYarnV1
|
|
177
178
|
? new Set(JSON.parse((0, child_process_1.execSync)(`yarn config get unsafeHttpWhitelist --json`, {
|
|
178
179
|
env,
|
|
179
|
-
windowsHide:
|
|
180
|
+
windowsHide: true,
|
|
180
181
|
}).toString()))
|
|
181
182
|
: null;
|
|
182
183
|
}
|
|
183
184
|
function setYarnUnsafeHttpWhitelist(currentWhitelist, options) {
|
|
184
185
|
if (currentWhitelist.size > 0) {
|
|
185
|
-
(0, child_process_1.execSync)(`yarn config set unsafeHttpWhitelist --json '${JSON.stringify(Array.from(currentWhitelist))}'` + (options.location === 'user' ? ' --home' : ''), { env, windowsHide:
|
|
186
|
+
(0, child_process_1.execSync)(`yarn config set unsafeHttpWhitelist --json '${JSON.stringify(Array.from(currentWhitelist))}'` + (options.location === 'user' ? ' --home' : ''), { env, windowsHide: true });
|
|
186
187
|
}
|
|
187
188
|
else {
|
|
188
189
|
(0, child_process_1.execSync)(`yarn config unset unsafeHttpWhitelist` +
|
|
189
|
-
(options.location === 'user' ? ' --home' : ''), { env, windowsHide:
|
|
190
|
+
(options.location === 'user' ? ' --home' : ''), { env, windowsHide: true });
|
|
190
191
|
}
|
|
191
192
|
}
|
|
192
193
|
function setupYarn(options) {
|
|
@@ -195,9 +196,7 @@ function setupYarn(options) {
|
|
|
195
196
|
const scopes = ['', ...(options.scopes || [])];
|
|
196
197
|
try {
|
|
197
198
|
isYarnV1 =
|
|
198
|
-
(0, semver_1.major)((0, child_process_1.execSync)('yarn --version', { env, windowsHide:
|
|
199
|
-
.toString()
|
|
200
|
-
.trim()) === 1;
|
|
199
|
+
(0, semver_1.major)((0, child_process_1.execSync)('yarn --version', { env, windowsHide: true }).toString().trim()) === 1;
|
|
201
200
|
}
|
|
202
201
|
catch {
|
|
203
202
|
// This would fail if yarn is not installed which is okay
|
|
@@ -209,14 +208,14 @@ function setupYarn(options) {
|
|
|
209
208
|
const scopeName = scope ? `${scope}:` : '';
|
|
210
209
|
yarnRegistryPaths.push((0, child_process_1.execSync)(`yarn config get ${scopeName}${registryConfigName}`, {
|
|
211
210
|
env,
|
|
212
|
-
windowsHide:
|
|
211
|
+
windowsHide: true,
|
|
213
212
|
})
|
|
214
213
|
?.toString()
|
|
215
214
|
?.trim()
|
|
216
215
|
?.replace('\u001b[2K\u001b[1G', '') // strip out ansi codes
|
|
217
216
|
);
|
|
218
217
|
(0, child_process_1.execSync)(`yarn config set ${scopeName}${registryConfigName} http://${options.listenAddress}:${options.port}/` +
|
|
219
|
-
(options.location === 'user' ? ' --home' : ''), { env, windowsHide:
|
|
218
|
+
(options.location === 'user' ? ' --home' : ''), { env, windowsHide: true });
|
|
220
219
|
devkit_1.logger.info(`Set yarn ${scopeName}registry to http://${options.listenAddress}:${options.port}/`);
|
|
221
220
|
});
|
|
222
221
|
const currentWhitelist = getYarnUnsafeHttpWhitelist(isYarnV1);
|
|
@@ -229,7 +228,7 @@ function setupYarn(options) {
|
|
|
229
228
|
}
|
|
230
229
|
return () => {
|
|
231
230
|
try {
|
|
232
|
-
const currentYarnRegistryPath = (0, child_process_1.execSync)(`yarn config get ${registryConfigName}`, { env, windowsHide:
|
|
231
|
+
const currentYarnRegistryPath = (0, child_process_1.execSync)(`yarn config get ${registryConfigName}`, { env, windowsHide: true })
|
|
233
232
|
?.toString()
|
|
234
233
|
?.trim()
|
|
235
234
|
?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
|
|
@@ -242,13 +241,13 @@ function setupYarn(options) {
|
|
|
242
241
|
(0, child_process_1.execSync)(`yarn config set ${registryName} ${yarnRegistryPaths[index]}` +
|
|
243
242
|
(options.location === 'user' ? ' --home' : ''), {
|
|
244
243
|
env,
|
|
245
|
-
windowsHide:
|
|
244
|
+
windowsHide: true,
|
|
246
245
|
});
|
|
247
246
|
devkit_1.logger.info(`Reset yarn ${registryName} to ${yarnRegistryPaths[index]}`);
|
|
248
247
|
}
|
|
249
248
|
else {
|
|
250
249
|
(0, child_process_1.execSync)(`yarn config ${isYarnV1 ? 'delete' : 'unset'} ${registryName}` +
|
|
251
|
-
(options.location === 'user' ? ' --home' : ''), { env, windowsHide:
|
|
250
|
+
(options.location === 'user' ? ' --home' : ''), { env, windowsHide: true });
|
|
252
251
|
devkit_1.logger.info(`Cleared custom yarn ${registryConfigName}`);
|
|
253
252
|
}
|
|
254
253
|
});
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.libraryGenerator = libraryGenerator;
|
|
4
4
|
exports.libraryGeneratorInternal = libraryGeneratorInternal;
|
|
5
5
|
exports.addLint = addLint;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
8
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
8
9
|
const prompt_1 = require("@nx/devkit/src/generators/prompt");
|
|
@@ -21,7 +22,7 @@ const plugin_1 = require("../../utils/typescript/plugin");
|
|
|
21
22
|
const ts_config_1 = require("../../utils/typescript/ts-config");
|
|
22
23
|
const ts_solution_setup_1 = require("../../utils/typescript/ts-solution-setup");
|
|
23
24
|
const versions_1 = require("../../utils/versions");
|
|
24
|
-
const init_1 = require("../init/init");
|
|
25
|
+
const init_1 = tslib_1.__importDefault(require("../init/init"));
|
|
25
26
|
const add_release_config_1 = require("./utils/add-release-config");
|
|
26
27
|
const defaultOutputDirectory = 'dist';
|
|
27
28
|
async function libraryGenerator(tree, schema) {
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addReleaseConfigForTsSolution = addReleaseConfigForTsSolution;
|
|
4
4
|
exports.addReleaseConfigForNonTsSolution = addReleaseConfigForNonTsSolution;
|
|
5
5
|
exports.releaseTasks = releaseTasks;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
8
|
const find_matching_projects_1 = require("nx/src/utils/find-matching-projects");
|
|
8
|
-
const generator_1 = require("../../setup-verdaccio/generator");
|
|
9
|
+
const generator_1 = tslib_1.__importDefault(require("../../setup-verdaccio/generator"));
|
|
9
10
|
/**
|
|
10
11
|
* Adds release option in nx.json to build the project before versioning
|
|
11
12
|
*/
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setupVerdaccio = setupVerdaccio;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const path = require("path");
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
6
7
|
const ts_solution_setup_1 = require("../../utils/typescript/ts-solution-setup");
|
|
7
8
|
const versions_1 = require("../../utils/versions");
|
|
8
9
|
const child_process_1 = require("child_process");
|
|
@@ -10,7 +11,7 @@ async function setupVerdaccio(tree, options) {
|
|
|
10
11
|
if (!tree.exists('.verdaccio/config.yml')) {
|
|
11
12
|
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), '.verdaccio', {
|
|
12
13
|
npmUplinkRegistry: (0, child_process_1.execSync)('npm config get registry', {
|
|
13
|
-
windowsHide:
|
|
14
|
+
windowsHide: true,
|
|
14
15
|
})
|
|
15
16
|
?.toString()
|
|
16
17
|
?.trim() ?? 'https://registry.npmjs.org',
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.syncGenerator = syncGenerator;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const ignore_1 = require("ignore");
|
|
6
|
+
const ignore_1 = tslib_1.__importDefault(require("ignore"));
|
|
6
7
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
7
8
|
const posix_1 = require("node:path/posix");
|
|
8
9
|
const sync_generators_1 = require("nx/src/utils/sync-generators");
|
|
9
|
-
const ts = require("typescript");
|
|
10
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
10
11
|
const COMMON_RUNTIME_TS_CONFIG_FILE_NAMES = [
|
|
11
12
|
'tsconfig.app.json',
|
|
12
13
|
'tsconfig.lib.json',
|
|
@@ -34,7 +34,7 @@ function startLocalRegistry({ localRegistryTarget, storage, verbose, clearStorag
|
|
|
34
34
|
console.log(`Local registry started on ${registry}`);
|
|
35
35
|
process.env.npm_config_registry = registry;
|
|
36
36
|
(0, child_process_1.execSync)(`npm config set //${listenAddress}:${port}/:_authToken "${authToken}" --ws=false`, {
|
|
37
|
-
windowsHide:
|
|
37
|
+
windowsHide: true,
|
|
38
38
|
});
|
|
39
39
|
// bun
|
|
40
40
|
process.env.BUN_CONFIG_REGISTRY = registry;
|
|
@@ -48,7 +48,7 @@ function startLocalRegistry({ localRegistryTarget, storage, verbose, clearStorag
|
|
|
48
48
|
resolve(() => {
|
|
49
49
|
childProcess.kill();
|
|
50
50
|
(0, child_process_1.execSync)(`npm config delete //${listenAddress}:${port}/:_authToken --ws=false`, {
|
|
51
|
-
windowsHide:
|
|
51
|
+
windowsHide: true,
|
|
52
52
|
});
|
|
53
53
|
});
|
|
54
54
|
childProcess?.stdout?.off('data', listener);
|
|
@@ -62,7 +62,7 @@ class JsVersionActions extends release_1.VersionActions {
|
|
|
62
62
|
// Must be non-blocking async to allow spinner to render
|
|
63
63
|
currentVersion = await new Promise((resolve, reject) => {
|
|
64
64
|
(0, node_child_process_1.exec)(`npm view ${packageName} version --"${registryConfigKey}=${registry}" --tag=${tag}`, {
|
|
65
|
-
windowsHide:
|
|
65
|
+
windowsHide: true,
|
|
66
66
|
}, (error, stdout, stderr) => {
|
|
67
67
|
if (error) {
|
|
68
68
|
return reject(error);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CopyAssetsHandler = exports.defaultFileEventHandler = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const picomatch = require("picomatch");
|
|
5
6
|
const node_fs_1 = require("node:fs");
|
|
6
|
-
const pathPosix = require("node:path/posix");
|
|
7
|
-
const path = require("node:path");
|
|
8
|
-
const ignore_1 = require("ignore");
|
|
7
|
+
const pathPosix = tslib_1.__importStar(require("node:path/posix"));
|
|
8
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
9
|
+
const ignore_1 = tslib_1.__importDefault(require("ignore"));
|
|
9
10
|
const tinyglobby_1 = require("tinyglobby");
|
|
10
11
|
const devkit_1 = require("@nx/devkit");
|
|
11
12
|
const client_1 = require("nx/src/daemon/client/client");
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.highlight = highlight;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
// Adapted from https://raw.githubusercontent.com/babel/babel/4108524/packages/babel-highlight/src/index.js
|
|
5
|
-
const jsTokens = require("js-tokens");
|
|
6
|
-
const
|
|
6
|
+
const jsTokens = tslib_1.__importStar(require("js-tokens"));
|
|
7
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
8
|
const identifiers_1 = require("./identifiers");
|
|
8
9
|
/**
|
|
9
10
|
* Chalk styles for token types.
|
|
@@ -80,6 +81,6 @@ function highlightTokens(defs, text) {
|
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
function highlight(code) {
|
|
83
|
-
const defs = getDefs(
|
|
84
|
+
const defs = getDefs(chalk_1.default);
|
|
84
85
|
return highlightTokens(defs, code);
|
|
85
86
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createGlobPatternsForDependencies = createGlobPatternsForDependencies;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const workspace_root_1 = require("nx/src/utils/workspace-root");
|
|
6
7
|
const path_1 = require("path");
|
|
7
8
|
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
8
9
|
const project_graph_utils_1 = require("nx/src/utils/project-graph-utils");
|
|
9
10
|
const fs_1 = require("fs");
|
|
10
|
-
const ignore_1 = require("ignore");
|
|
11
|
+
const ignore_1 = tslib_1.__importDefault(require("ignore"));
|
|
11
12
|
const find_project_for_path_1 = require("nx/src/project-graph/utils/find-project-for-path");
|
|
12
13
|
function configureIgnore() {
|
|
13
14
|
let ig;
|
package/src/utils/npm-config.js
CHANGED
|
@@ -76,7 +76,7 @@ async function getNpmConfigValue(key, cwd) {
|
|
|
76
76
|
async function execAsync(command, cwd) {
|
|
77
77
|
// Must be non-blocking async to allow spinner to render
|
|
78
78
|
return new Promise((resolve, reject) => {
|
|
79
|
-
(0, child_process_1.exec)(command, { cwd, windowsHide:
|
|
79
|
+
(0, child_process_1.exec)(command, { cwd, windowsHide: true }, (error, stdout, stderr) => {
|
|
80
80
|
if (error) {
|
|
81
81
|
return reject((stderr ? `${stderr}\n` : '') + error);
|
|
82
82
|
}
|
package/src/utils/prettier.js
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.resolveUserExistingPrettierConfig = resolveUserExistingPrettierConfig;
|
|
4
37
|
exports.generatePrettierSetup = generatePrettierSetup;
|
|
@@ -8,7 +41,7 @@ const versions_1 = require("./versions");
|
|
|
8
41
|
async function resolveUserExistingPrettierConfig() {
|
|
9
42
|
let prettier;
|
|
10
43
|
try {
|
|
11
|
-
prettier = await Promise.resolve().then(() => require('prettier'));
|
|
44
|
+
prettier = await Promise.resolve().then(() => __importStar(require('prettier')));
|
|
12
45
|
}
|
|
13
46
|
catch {
|
|
14
47
|
return null;
|
|
@@ -78,7 +111,7 @@ function generatePrettierSetup(tree, options) {
|
|
|
78
111
|
async function resolvePrettierConfigPath(tree) {
|
|
79
112
|
let prettier;
|
|
80
113
|
try {
|
|
81
|
-
prettier = await Promise.resolve().then(() => require('prettier'));
|
|
114
|
+
prettier = await Promise.resolve().then(() => __importStar(require('prettier')));
|
|
82
115
|
}
|
|
83
116
|
catch {
|
|
84
117
|
return null;
|
|
@@ -119,7 +152,7 @@ async function resolvePrettierConfigPath(tree) {
|
|
|
119
152
|
}
|
|
120
153
|
// check the package.yaml file
|
|
121
154
|
if (tree.exists('package.yaml')) {
|
|
122
|
-
const { load } = await Promise.resolve().then(() => require('@zkochan/js-yaml'));
|
|
155
|
+
const { load } = await Promise.resolve().then(() => __importStar(require('@zkochan/js-yaml')));
|
|
123
156
|
const packageYaml = load(tree.read('package.yaml', 'utf-8'));
|
|
124
157
|
if (packageYaml.prettier) {
|
|
125
158
|
return 'package.yaml';
|
|
@@ -60,7 +60,7 @@ async function compileSwc(context, normalizedOptions, postCompilationCallback) {
|
|
|
60
60
|
const swcCmdLog = (0, node_child_process_1.execSync)(getSwcCmd(normalizedOptions), {
|
|
61
61
|
encoding: 'utf8',
|
|
62
62
|
cwd: normalizedOptions.swcCliOptions.swcCwd,
|
|
63
|
-
windowsHide:
|
|
63
|
+
windowsHide: true,
|
|
64
64
|
stdio: 'pipe',
|
|
65
65
|
});
|
|
66
66
|
devkit_1.logger.log(swcCmdLog.replace(/\n/, ''));
|
|
@@ -109,7 +109,7 @@ async function* compileSwcWatch(context, normalizedOptions, postCompilationCallb
|
|
|
109
109
|
let watcherOnExit;
|
|
110
110
|
const swcWatcher = (0, node_child_process_1.exec)(getSwcCmd(normalizedOptions, true), {
|
|
111
111
|
cwd: normalizedOptions.swcCliOptions.swcCwd,
|
|
112
|
-
windowsHide:
|
|
112
|
+
windowsHide: true,
|
|
113
113
|
});
|
|
114
114
|
processOnExit = () => {
|
|
115
115
|
swcWatcher.kill();
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.runTypeCheckWatch = runTypeCheckWatch;
|
|
4
4
|
exports.runTypeCheck = runTypeCheck;
|
|
5
5
|
exports.getFormattedDiagnostic = getFormattedDiagnostic;
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
+
const path = tslib_1.__importStar(require("path"));
|
|
8
9
|
const code_frames_1 = require("nx/src/utils/code-frames");
|
|
9
10
|
const highlight_1 = require("../code-frames/highlight");
|
|
10
11
|
const ts_config_1 = require("../../utils/typescript/ts-config");
|
|
@@ -56,7 +57,7 @@ async function runTypeCheck(options) {
|
|
|
56
57
|
return getTypeCheckResult(ts, allDiagnostics, workspaceRoot, config.fileNames.length, program.getSourceFiles().length, incremental);
|
|
57
58
|
}
|
|
58
59
|
async function setupTypeScript(options) {
|
|
59
|
-
const ts = await Promise.resolve().then(() => require('typescript'));
|
|
60
|
+
const ts = await Promise.resolve().then(() => tslib_1.__importStar(require('typescript')));
|
|
60
61
|
const { workspaceRoot, tsConfigPath, cacheDir, incremental, projectRoot } = options;
|
|
61
62
|
const config = (0, ts_config_1.readTsConfig)(tsConfigPath);
|
|
62
63
|
if (config.errors.length) {
|
|
@@ -103,17 +104,17 @@ function getFormattedDiagnostic(ts, workspaceRoot, diagnostic) {
|
|
|
103
104
|
const category = diagnostic.category;
|
|
104
105
|
switch (category) {
|
|
105
106
|
case ts.DiagnosticCategory.Warning: {
|
|
106
|
-
message += `${
|
|
107
|
+
message += `${chalk_1.default.yellow.bold('warning')} ${chalk_1.default.gray(`TS${diagnostic.code}`)}: `;
|
|
107
108
|
break;
|
|
108
109
|
}
|
|
109
110
|
case ts.DiagnosticCategory.Error: {
|
|
110
|
-
message += `${
|
|
111
|
+
message += `${chalk_1.default.red.bold('error')} ${chalk_1.default.gray(`TS${diagnostic.code}`)}: `;
|
|
111
112
|
break;
|
|
112
113
|
}
|
|
113
114
|
case ts.DiagnosticCategory.Suggestion:
|
|
114
115
|
case ts.DiagnosticCategory.Message:
|
|
115
116
|
default: {
|
|
116
|
-
message += `${
|
|
117
|
+
message += `${chalk_1.default.cyan.bold(category === 2 ? 'suggestion' : 'info')}: `;
|
|
117
118
|
break;
|
|
118
119
|
}
|
|
119
120
|
}
|
|
@@ -124,7 +125,7 @@ function getFormattedDiagnostic(ts, workspaceRoot, diagnostic) {
|
|
|
124
125
|
const column = pos.character + 1;
|
|
125
126
|
const fileName = path.relative(workspaceRoot, diagnostic.file.fileName);
|
|
126
127
|
message =
|
|
127
|
-
`${
|
|
128
|
+
`${chalk_1.default.underline.blue(`${fileName}:${line}:${column}`)} - ` + message;
|
|
128
129
|
const code = diagnostic.file.getFullText(diagnostic.file.getSourceFile());
|
|
129
130
|
message +=
|
|
130
131
|
'\n' +
|