@nx/esbuild 16.4.0-beta.6 → 16.4.0-beta.7

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/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export type { EsBuildExecutorOptions, NormalizedEsBuildExecutorOptions, } from './src/executors/esbuild/schema';
2
- export * from './src/executors/esbuild/esbuild.impl';
1
+ export * from './src/generators/init/init';
2
+ export * from './src/generators/esbuild-project/esbuild-project';
3
3
  export * from './src/utils/versions';
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./src/executors/esbuild/esbuild.impl"), exports);
4
+ tslib_1.__exportStar(require("./src/generators/init/init"), exports);
5
+ tslib_1.__exportStar(require("./src/generators/esbuild-project/esbuild-project"), exports);
5
6
  tslib_1.__exportStar(require("./src/utils/versions"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/esbuild",
3
- "version": "16.4.0-beta.6",
3
+ "version": "16.4.0-beta.7",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for esbuild contains executors and generators that support building applications using esbuild",
6
6
  "repository": {
@@ -29,9 +29,9 @@
29
29
  "migrations": "./migrations.json"
30
30
  },
31
31
  "dependencies": {
32
- "@nrwl/esbuild": "16.4.0-beta.6",
33
- "@nx/devkit": "16.4.0-beta.6",
34
- "@nx/js": "16.4.0-beta.6",
32
+ "@nrwl/esbuild": "16.4.0-beta.7",
33
+ "@nx/devkit": "16.4.0-beta.7",
34
+ "@nx/js": "16.4.0-beta.7",
35
35
  "chalk": "^4.1.0",
36
36
  "dotenv": "~10.0.0",
37
37
  "fast-glob": "3.2.7",
@@ -51,5 +51,5 @@
51
51
  "access": "public"
52
52
  },
53
53
  "types": "./index.d.ts",
54
- "gitHead": "6eda3ff725a1e5ee973e71cb711b065dcc3f2a16"
54
+ "gitHead": "847d3a45b61cd2c267acb66c4165a5bb875aff4f"
55
55
  }
@@ -6,8 +6,10 @@ const devkit_1 = require("@nx/devkit");
6
6
  const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
7
7
  const init_1 = require("../init/init");
8
8
  function esbuildProjectGenerator(tree, options) {
9
+ var _a;
9
10
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
11
  const task = yield (0, init_1.esbuildInitGenerator)(tree, Object.assign(Object.assign({}, options), { skipFormat: true }));
12
+ (_a = options.buildTarget) !== null && _a !== void 0 ? _a : (options.buildTarget = 'build');
11
13
  checkForTargetConflicts(tree, options);
12
14
  addBuildTarget(tree, options);
13
15
  yield (0, devkit_1.formatFiles)(tree);
@@ -20,8 +22,8 @@ function checkForTargetConflicts(tree, options) {
20
22
  if (options.skipValidation)
21
23
  return;
22
24
  const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
23
- if ((_a = project.targets) === null || _a === void 0 ? void 0 : _a.build) {
24
- throw new Error(`Project "${options.project}" already has a build target. Pass --skipValidation to ignore this error.`);
25
+ if ((_a = project.targets) === null || _a === void 0 ? void 0 : _a[options.buildTarget]) {
26
+ throw new Error(`Project "${options.project}" already has a ${options.buildTarget} target. Pass --skipValidation to ignore this error.`);
25
27
  }
26
28
  }
27
29
  function addBuildTarget(tree, options) {
@@ -37,7 +39,7 @@ function addBuildTarget(tree, options) {
37
39
  const tsConfig = getTsConfigFile(tree, options);
38
40
  const buildOptions = {
39
41
  main: getMainFile(tree, options),
40
- outputPath: (0, devkit_1.joinPathFragments)('dist', project.root),
42
+ outputPath: (0, devkit_1.joinPathFragments)('dist', project.root === '.' ? options.project : project.root),
41
43
  outputFileName: 'main.js',
42
44
  tsConfig,
43
45
  assets: [],
@@ -56,7 +58,7 @@ function addBuildTarget(tree, options) {
56
58
  },
57
59
  ];
58
60
  }
59
- (0, devkit_1.updateProjectConfiguration)(tree, options.project, Object.assign(Object.assign({}, project), { targets: Object.assign(Object.assign({}, project.targets), { build: {
61
+ (0, devkit_1.updateProjectConfiguration)(tree, options.project, Object.assign(Object.assign({}, project), { targets: Object.assign(Object.assign({}, project.targets), { [options.buildTarget]: {
60
62
  executor: '@nx/esbuild:esbuild',
61
63
  outputs: ['{options.outputPath}'],
62
64
  defaultConfiguration: 'production',
@@ -9,4 +9,5 @@ export interface EsBuildProjectSchema {
9
9
  importPath?: string;
10
10
  esbuildConfig?: string;
11
11
  platform?: 'node' | 'browser' | 'neutral';
12
+ buildTarget?: string;
12
13
  }
@@ -55,6 +55,11 @@
55
55
  "description": "Platform target for outputs.",
56
56
  "enum": ["browser", "node", "neutral"],
57
57
  "default": "node"
58
+ },
59
+ "buildTarget": {
60
+ "description": "The build target to add.",
61
+ "type": "string",
62
+ "default": "build"
58
63
  }
59
64
  },
60
65
  "required": [],
@@ -4,9 +4,11 @@ exports.esbuildInitSchematic = exports.esbuildInitGenerator = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const versions_1 = require("@nx/js/src/utils/versions");
7
+ const versions_2 = require("../../utils/versions");
7
8
  function esbuildInitGenerator(tree, schema) {
8
9
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
10
  const task = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
11
+ '@nx/esbuild': versions_2.nxVersion,
10
12
  esbuild: versions_1.esbuildVersion,
11
13
  });
12
14
  if (!schema.skipFormat) {