@nx/js 16.4.0 → 16.5.0-beta.0

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.4.0",
3
+ "version": "16.5.0-beta.0",
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.15.0",
40
40
  "@babel/preset-typescript": "^7.15.0",
41
41
  "@babel/runtime": "^7.14.8",
42
- "@nrwl/js": "16.4.0",
43
- "@nx/devkit": "16.4.0",
44
- "@nx/workspace": "16.4.0",
42
+ "@nrwl/js": "16.5.0-beta.0",
43
+ "@nx/devkit": "16.5.0-beta.0",
44
+ "@nx/workspace": "16.5.0-beta.0",
45
45
  "@phenomnomnominal/tsquery": "~5.0.1",
46
46
  "babel-plugin-const-enum": "^1.0.1",
47
47
  "babel-plugin-macros": "^2.8.0",
@@ -69,5 +69,5 @@
69
69
  "access": "public"
70
70
  },
71
71
  "types": "./src/index.d.ts",
72
- "gitHead": "ae698a72748d9f33aa5395aeeaa7b7af436a1dc5"
72
+ "gitHead": "376d656cfc7f6390ff1cd6d9de348baf7bccbf33"
73
73
  }
@@ -21,10 +21,10 @@ function debounce(fn, wait) {
21
21
  };
22
22
  }
23
23
  function nodeExecutor(options, context) {
24
- var _a, _b, _c, _d;
25
- var _e;
24
+ var _a, _b, _c;
25
+ var _d;
26
26
  return tslib_1.__asyncGenerator(this, arguments, function* nodeExecutor_1() {
27
- (_a = (_e = process.env).NODE_ENV) !== null && _a !== void 0 ? _a : (_e.NODE_ENV = (_b = context === null || context === void 0 ? void 0 : context.configurationName) !== null && _b !== void 0 ? _b : 'development');
27
+ (_a = (_d = process.env).NODE_ENV) !== null && _a !== void 0 ? _a : (_d.NODE_ENV = (_b = context === null || context === void 0 ? void 0 : context.configurationName) !== null && _b !== void 0 ? _b : 'development');
28
28
  const project = context.projectGraph.nodes[context.projectName];
29
29
  const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context.projectGraph);
30
30
  let buildOptions;
@@ -44,12 +44,19 @@ function nodeExecutor(options, context) {
44
44
  }
45
45
  // Re-map buildable workspace projects to their output directory.
46
46
  const mappings = calculateResolveMappings(context, options);
47
- const outputFileName = (_d = buildOptions.outputFileName) !== null && _d !== void 0 ? _d : `${path.parse(buildOptions.main).name}.js`;
47
+ let outputFileName = buildOptions.outputFileName || `${path.parse(buildOptions.main).name}.js`;
48
+ if (!buildOptions.outputFileName) {
49
+ const matches = buildOptions.main.match(/^(?!.*src)(.*)\/([^/]*)$/); //ignore strings that contain src and split paths into [folders before main, main.ts]
50
+ if (matches) {
51
+ const [mainFolder, mainFileName] = matches.slice(1);
52
+ outputFileName = path.join(mainFolder, `${path.parse(mainFileName).name}.js`);
53
+ }
54
+ }
48
55
  const fileToRun = (0, path_1.join)(context.root, buildOptions.outputPath, outputFileName);
49
56
  const tasks = [];
50
57
  let currentTask = null;
51
58
  yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues((0, async_iterable_1.createAsyncIterable)(({ done, next, error }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
52
- var _f;
59
+ var _e;
53
60
  const processQueue = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
54
61
  if (tasks.length === 0)
55
62
  return;
@@ -59,7 +66,7 @@ function nodeExecutor(options, context) {
59
66
  yield (previousTask === null || previousTask === void 0 ? void 0 : previousTask.stop('SIGTERM'));
60
67
  yield task.start();
61
68
  });
62
- const debouncedProcessQueue = debounce(processQueue, (_f = options.debounce) !== null && _f !== void 0 ? _f : 1000);
69
+ const debouncedProcessQueue = debounce(processQueue, (_e = options.debounce) !== null && _e !== void 0 ? _e : 1000);
63
70
  const addToQueue = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
64
71
  const task = {
65
72
  id: (0, crypto_1.randomUUID)(),
@@ -143,13 +150,13 @@ function nodeExecutor(options, context) {
143
150
  watchProjects: [context.projectName],
144
151
  includeDependentProjects: true,
145
152
  }, (err, data) => tslib_1.__awaiter(this, void 0, void 0, function* () {
146
- var _g;
153
+ var _f;
147
154
  if (err === 'closed') {
148
155
  devkit_1.logger.error(`Watch error: Daemon closed the connection`);
149
156
  process.exit(1);
150
157
  }
151
158
  else if (err) {
152
- devkit_1.logger.error(`Watch error: ${(_g = err === null || err === void 0 ? void 0 : err.message) !== null && _g !== void 0 ? _g : 'Unknown'}`);
159
+ devkit_1.logger.error(`Watch error: ${(_f = err === null || err === void 0 ? void 0 : err.message) !== null && _f !== void 0 ? _f : 'Unknown'}`);
153
160
  }
154
161
  else {
155
162
  devkit_1.logger.info(`NX File change detected. Restarting...`);
@@ -24,6 +24,14 @@ function setupVerdaccio(tree, options) {
24
24
  };
25
25
  if (!tree.exists('project.json')) {
26
26
  const { name } = (0, devkit_1.readJson)(tree, 'package.json');
27
+ (0, devkit_1.updateJson)(tree, 'package.json', (json) => {
28
+ if (!json.nx) {
29
+ json.nx = {
30
+ includedScripts: [],
31
+ };
32
+ }
33
+ return json;
34
+ });
27
35
  (0, devkit_1.addProjectConfiguration)(tree, name, {
28
36
  root: '.',
29
37
  targets: {