@nx/js 18.2.4 → 18.3.0-beta.1

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": "18.2.4",
3
+ "version": "18.3.0-beta.1",
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": {
@@ -57,9 +57,9 @@
57
57
  "semver": "^7.5.3",
58
58
  "source-map-support": "0.5.19",
59
59
  "tslib": "^2.3.0",
60
- "@nx/devkit": "18.2.4",
61
- "@nx/workspace": "18.2.4",
62
- "@nrwl/js": "18.2.4"
60
+ "@nx/devkit": "18.3.0-beta.1",
61
+ "@nx/workspace": "18.3.0-beta.1",
62
+ "@nrwl/js": "18.3.0-beta.1"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "verdaccio": "^5.0.4"
@@ -13,6 +13,7 @@ const buildable_libs_utils_1 = require("../../utils/buildable-libs-utils");
13
13
  const kill_tree_1 = require("./lib/kill-tree");
14
14
  const fileutils_1 = require("nx/src/utils/fileutils");
15
15
  const get_main_file_dir_1 = require("../../utils/get-main-file-dir");
16
+ const utils_1 = require("nx/src/tasks-runner/utils");
16
17
  function debounce(fn, wait) {
17
18
  let timeoutId;
18
19
  return () => {
@@ -36,6 +37,7 @@ async function* nodeExecutor(options, context) {
36
37
  const buildOptions = {
37
38
  ...(0, devkit_1.readTargetOptions)(buildTarget, context),
38
39
  ...options.buildTargetOptions,
40
+ target: buildTarget.target,
39
41
  };
40
42
  if (options.waitUntilTargets && options.waitUntilTargets.length > 0) {
41
43
  const results = await runWaitUntilTargets(options, context);
@@ -263,6 +265,18 @@ function getFileToRun(context, project, buildOptions, buildTargetExecutor) {
263
265
  // If using run-commands or another custom executor, then user should set
264
266
  // outputFileName, but we can try the default value that we use.
265
267
  if (!buildOptions?.outputPath && !buildOptions?.outputFileName) {
268
+ // If we are using crystal for infering the target, we can use the output path from the target.
269
+ // Since the output path has a token for the project name, we need to interpolate it.
270
+ // {workspaceRoot}/dist/{projectRoot} -> dist/my-app
271
+ const outputPath = project.data.targets[buildOptions.target]?.outputs?.[0];
272
+ if (outputPath) {
273
+ const outputFilePath = (0, utils_1.interpolate)(outputPath, {
274
+ projectName: project.name,
275
+ projectRoot: project.data.root,
276
+ workspaceRoot: '',
277
+ });
278
+ return path.join(outputFilePath, 'main.js');
279
+ }
266
280
  const fallbackFile = path.join('dist', project.data.root, 'main.js');
267
281
  devkit_1.logger.warn(`Build option ${chalk.bold('outputFileName')} not set for ${chalk.bold(project.name)}. Using fallback value of ${chalk.bold(fallbackFile)}.`);
268
282
  return (0, path_1.join)(context.root, fallbackFile);