@nx/js 16.9.0-beta.2 → 16.9.0-beta.3
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 +5 -5
- package/src/executors/node/node.impl.js +3 -3
- package/src/executors/release-publish/release-publish.impl.js +10 -1
- package/src/executors/release-publish/schema.d.ts +1 -0
- package/src/executors/release-publish/schema.json +4 -0
- package/src/executors/tsc/lib/batch/build-task-info-per-tsconfig-map.js +1 -1
- package/src/executors/tsc/lib/batch/normalize-tasks-options.js +1 -1
- package/src/executors/tsc/lib/get-tsconfig.js +5 -7
- package/src/executors/tsc/tsc.batch-impl.js +1 -1
- package/src/utils/package-json/update-package-json.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "16.9.0-beta.
|
|
3
|
+
"version": "16.9.0-beta.3",
|
|
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,9 +39,9 @@
|
|
|
39
39
|
"@babel/preset-env": "^7.22.9",
|
|
40
40
|
"@babel/preset-typescript": "^7.22.5",
|
|
41
41
|
"@babel/runtime": "^7.22.6",
|
|
42
|
-
"@nrwl/js": "16.9.0-beta.
|
|
43
|
-
"@nx/devkit": "16.9.0-beta.
|
|
44
|
-
"@nx/workspace": "16.9.0-beta.
|
|
42
|
+
"@nrwl/js": "16.9.0-beta.3",
|
|
43
|
+
"@nx/devkit": "16.9.0-beta.3",
|
|
44
|
+
"@nx/workspace": "16.9.0-beta.3",
|
|
45
45
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
46
46
|
"babel-plugin-const-enum": "^1.0.1",
|
|
47
47
|
"babel-plugin-macros": "^2.8.0",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
77
|
"type": "commonjs",
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "d5692528c089a75c76b21d2d1235d8cc5dbb1d26"
|
|
79
79
|
}
|
|
@@ -23,7 +23,7 @@ function debounce(fn, wait) {
|
|
|
23
23
|
async function* nodeExecutor(options, context) {
|
|
24
24
|
process.env.NODE_ENV ??= context?.configurationName ?? 'development';
|
|
25
25
|
const project = context.projectGraph.nodes[context.projectName];
|
|
26
|
-
const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context
|
|
26
|
+
const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context);
|
|
27
27
|
if (!project.data.targets[buildTarget.target]) {
|
|
28
28
|
throw new Error(`Cannot find build target ${chalk.bold(options.buildTarget)} for project ${chalk.bold(context.projectName)}`);
|
|
29
29
|
}
|
|
@@ -229,7 +229,7 @@ function getExecArgv(options) {
|
|
|
229
229
|
return args;
|
|
230
230
|
}
|
|
231
231
|
function calculateResolveMappings(context, options) {
|
|
232
|
-
const parsed = (0, devkit_1.parseTargetString)(options.buildTarget, context
|
|
232
|
+
const parsed = (0, devkit_1.parseTargetString)(options.buildTarget, context);
|
|
233
233
|
const { dependencies } = (0, buildable_libs_utils_1.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, parsed.project, parsed.target, parsed.configuration);
|
|
234
234
|
return dependencies.reduce((m, c) => {
|
|
235
235
|
if (c.node.type !== 'npm' && c.outputs[0] != null) {
|
|
@@ -240,7 +240,7 @@ function calculateResolveMappings(context, options) {
|
|
|
240
240
|
}
|
|
241
241
|
function runWaitUntilTargets(options, context) {
|
|
242
242
|
return Promise.all(options.waitUntilTargets.map(async (waitUntilTarget) => {
|
|
243
|
-
const target = (0, devkit_1.parseTargetString)(waitUntilTarget, context
|
|
243
|
+
const target = (0, devkit_1.parseTargetString)(waitUntilTarget, context);
|
|
244
244
|
const output = await (0, devkit_1.runExecutor)(target, {}, context);
|
|
245
245
|
return new Promise(async (resolve) => {
|
|
246
246
|
let event = await output.next();
|
|
@@ -4,6 +4,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const npm_run_path_1 = require("npm-run-path");
|
|
6
6
|
const log_tar_1 = require("./log-tar");
|
|
7
|
+
const chalk = require("chalk");
|
|
7
8
|
const LARGE_BUFFER = 1024 * 1000000;
|
|
8
9
|
function processEnv(color) {
|
|
9
10
|
const env = {
|
|
@@ -25,6 +26,9 @@ async function runExecutor(options, context) {
|
|
|
25
26
|
if (options.tag) {
|
|
26
27
|
npmPublishCommandSegments.push(`--tag=${options.tag}`);
|
|
27
28
|
}
|
|
29
|
+
if (options.dryRun) {
|
|
30
|
+
npmPublishCommandSegments.push(`--dry-run`);
|
|
31
|
+
}
|
|
28
32
|
// Resolve values using the `npm config` command so that things like environment variables and `publishConfig`s are accounted for
|
|
29
33
|
const registry = options.registry ?? (0, child_process_1.execSync)(`npm config get registry`).toString().trim();
|
|
30
34
|
const tag = options.tag ?? (0, child_process_1.execSync)(`npm config get tag`).toString().trim();
|
|
@@ -39,7 +43,12 @@ async function runExecutor(options, context) {
|
|
|
39
43
|
// If npm workspaces are in use, the publish output will nest the data under the package name, so we normalize it first
|
|
40
44
|
const normalizedStdoutData = stdoutData[context.projectName] ?? stdoutData;
|
|
41
45
|
(0, log_tar_1.logTar)(normalizedStdoutData);
|
|
42
|
-
|
|
46
|
+
if (options.dryRun) {
|
|
47
|
+
console.log(`Would publish to ${registry} with tag "${tag}", but ${chalk.keyword('orange')('[dry-run]')} was set`);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
console.log(`Published to ${registry} with tag "${tag}"`);
|
|
51
|
+
}
|
|
43
52
|
return {
|
|
44
53
|
success: true,
|
|
45
54
|
};
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"tag": {
|
|
17
17
|
"type": "string",
|
|
18
18
|
"description": "The distribution tag to apply to the published package."
|
|
19
|
+
},
|
|
20
|
+
"dryRun": {
|
|
21
|
+
"type": "boolean",
|
|
22
|
+
"description": "Whether to run the command without actually publishing the package to the registry."
|
|
19
23
|
}
|
|
20
24
|
},
|
|
21
25
|
"required": []
|
|
@@ -33,7 +33,7 @@ function processTasksAndPopulateTsConfigTaskInfoMap(tsConfigTaskInfoMap, tasksOp
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
function createTaskInfo(taskName, taskOptions, context, tsConfig) {
|
|
36
|
-
const target = (0, devkit_1.parseTargetString)(taskName, context
|
|
36
|
+
const target = (0, devkit_1.parseTargetString)(taskName, context);
|
|
37
37
|
const taskContext = {
|
|
38
38
|
...context,
|
|
39
39
|
// batch executors don't get these in the context, we provide them
|
|
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const normalize_options_1 = require("../normalize-options");
|
|
6
6
|
function normalizeTasksOptions(inputs, context) {
|
|
7
7
|
return Object.entries(inputs).reduce((tasksOptions, [taskName, options]) => {
|
|
8
|
-
const { project } = (0, devkit_1.parseTargetString)(taskName, context
|
|
8
|
+
const { project } = (0, devkit_1.parseTargetString)(taskName, context);
|
|
9
9
|
const { sourceRoot, root } = context.projectsConfigurations.projects[project];
|
|
10
10
|
tasksOptions[taskName] = (0, normalize_options_1.normalizeOptions)(options, context.root, sourceRoot, root);
|
|
11
11
|
return tasksOptions;
|
|
@@ -14,7 +14,7 @@ function getProcessedTaskTsConfigs(tasks, tasksOptions, context) {
|
|
|
14
14
|
exports.getProcessedTaskTsConfigs = getProcessedTaskTsConfigs;
|
|
15
15
|
const projectTsConfigCache = new Map();
|
|
16
16
|
function generateTaskProjectTsConfig(task, tasksOptions, context, taskInMemoryTsConfigMap) {
|
|
17
|
-
const { project } = (0, devkit_1.parseTargetString)(task, context
|
|
17
|
+
const { project } = (0, devkit_1.parseTargetString)(task, context);
|
|
18
18
|
if (projectTsConfigCache.has(project)) {
|
|
19
19
|
const { tsConfig, tsConfigPath } = projectTsConfigCache.get(project);
|
|
20
20
|
taskInMemoryTsConfigMap[task] = tsConfig;
|
|
@@ -48,13 +48,11 @@ function generateTaskProjectTsConfig(task, tasksOptions, context, taskInMemoryTs
|
|
|
48
48
|
return tsConfigPath;
|
|
49
49
|
}
|
|
50
50
|
function getDependencyTasksInOtherProjects(task, project, context) {
|
|
51
|
-
return context.taskGraph.dependencies[task].filter((t) => t !== task &&
|
|
52
|
-
(0, devkit_1.parseTargetString)(t, context.projectGraph).project !== project);
|
|
51
|
+
return context.taskGraph.dependencies[task].filter((t) => t !== task && (0, devkit_1.parseTargetString)(t, context).project !== project);
|
|
53
52
|
}
|
|
54
53
|
function getDependencyTasksInSameProject(task, context) {
|
|
55
|
-
const { project: taskProject } = (0, devkit_1.parseTargetString)(task, context
|
|
56
|
-
return Object.keys(context.taskGraph.tasks).filter((t) => t !== task &&
|
|
57
|
-
(0, devkit_1.parseTargetString)(t, context.projectGraph).project === taskProject);
|
|
54
|
+
const { project: taskProject } = (0, devkit_1.parseTargetString)(task, context);
|
|
55
|
+
return Object.keys(context.taskGraph.tasks).filter((t) => t !== task && (0, devkit_1.parseTargetString)(t, context).project === taskProject);
|
|
58
56
|
}
|
|
59
57
|
function getInMemoryTsConfig(tsConfig, taskOptions, projectReferences) {
|
|
60
58
|
const originalTsConfig = (0, devkit_1.readJsonFile)(tsConfig, {
|
|
@@ -82,7 +80,7 @@ function getInMemoryTsConfig(tsConfig, taskOptions, projectReferences) {
|
|
|
82
80
|
};
|
|
83
81
|
}
|
|
84
82
|
function hasTscExecutor(task, context) {
|
|
85
|
-
const { project, target } = (0, devkit_1.parseTargetString)(task, context
|
|
83
|
+
const { project, target } = (0, devkit_1.parseTargetString)(task, context);
|
|
86
84
|
return (context.projectGraph.nodes[project].data.targets[target].executor ===
|
|
87
85
|
'@nx/js:tsc');
|
|
88
86
|
}
|
|
@@ -170,7 +170,7 @@ function createTypescriptCompilationContext(tsConfigTaskInfoMap, taskInMemoryTsC
|
|
|
170
170
|
Object.entries(taskInMemoryTsConfigMap).forEach(([task, tsConfig]) => {
|
|
171
171
|
if (!tsCompilationContext[tsConfig.path]) {
|
|
172
172
|
tsCompilationContext[tsConfig.path] = {
|
|
173
|
-
project: (0, devkit_1.parseTargetString)(task, context
|
|
173
|
+
project: (0, devkit_1.parseTargetString)(task, context).project,
|
|
174
174
|
transformers: [],
|
|
175
175
|
tsConfig: tsConfig,
|
|
176
176
|
};
|
|
@@ -15,7 +15,7 @@ const get_main_file_dir_1 = require("../get-main-file-dir");
|
|
|
15
15
|
function updatePackageJson(options, context, target, dependencies, fileMap = null) {
|
|
16
16
|
let packageJson;
|
|
17
17
|
if (fileMap == null) {
|
|
18
|
-
fileMap = (0, nx_deps_cache_1.
|
|
18
|
+
fileMap = (0, nx_deps_cache_1.readFileMapCache)()?.fileMap?.projectFileMap || {};
|
|
19
19
|
}
|
|
20
20
|
if (options.updateBuildableProjectDepsInPackageJson) {
|
|
21
21
|
packageJson = (0, create_package_json_1.createPackageJson)(context.projectName, context.projectGraph, {
|