@nx/js 16.9.0-beta.2 → 16.9.0-beta.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/js",
3
- "version": "16.9.0-beta.2",
3
+ "version": "16.9.0-beta.4",
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,6 @@
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.2",
43
- "@nx/devkit": "16.9.0-beta.2",
44
- "@nx/workspace": "16.9.0-beta.2",
45
42
  "@phenomnomnominal/tsquery": "~5.0.1",
46
43
  "babel-plugin-const-enum": "^1.0.1",
47
44
  "babel-plugin-macros": "^2.8.0",
@@ -51,17 +48,20 @@
51
48
  "detect-port": "^1.5.1",
52
49
  "fast-glob": "3.2.7",
53
50
  "fs-extra": "^11.1.0",
51
+ "npm-package-arg": "11.0.1",
52
+ "npm-run-path": "^4.0.1",
53
+ "ts-node": "10.9.1",
54
+ "tsconfig-paths": "^4.1.2",
54
55
  "ignore": "^5.0.4",
55
56
  "js-tokens": "^4.0.0",
56
57
  "minimatch": "3.0.5",
57
- "npm-package-arg": "11.0.1",
58
- "npm-run-path": "^4.0.1",
59
58
  "ora": "5.3.0",
60
59
  "semver": "7.5.3",
61
60
  "source-map-support": "0.5.19",
62
- "ts-node": "10.9.1",
63
- "tsconfig-paths": "^4.1.2",
64
- "tslib": "^2.3.0"
61
+ "tslib": "^2.3.0",
62
+ "@nx/devkit": "16.9.0-beta.4",
63
+ "@nx/workspace": "16.9.0-beta.4",
64
+ "@nrwl/js": "*"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "verdaccio": "^5.0.4"
@@ -74,6 +74,5 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "type": "commonjs",
78
- "gitHead": "e11d538fa2c7266066d554d9405abab8e0a65040"
77
+ "type": "commonjs"
79
78
  }
@@ -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.projectGraph);
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.projectGraph);
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.projectGraph);
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
- console.log(`Published to ${registry} with tag "${tag}"`);
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
  };
@@ -2,4 +2,5 @@ export interface PublishExecutorSchema {
2
2
  packageRoot?: string;
3
3
  registry?: string;
4
4
  tag?: string;
5
+ dryRun?: boolean;
5
6
  }
@@ -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.projectGraph);
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.projectGraph);
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.projectGraph);
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.projectGraph);
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.projectGraph);
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.projectGraph).project,
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.readProjectFileMapCache)()?.projectFileMap || {};
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, {
package/CHANGELOG.md DELETED
@@ -1,8 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
-
7
-
8
- **Note:** Version bump only for package @nx/js