@nx/web 20.5.0 → 20.6.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/web",
3
- "version": "20.5.0",
3
+ "version": "20.6.0-beta.1",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Web Components contains generators for managing Web Component applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Playwright, Cypress, and Storybook.\n\n- Scaffolding for creating buildable libraries that can be published to npm.\n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -35,8 +35,8 @@
35
35
  "http-server": "^14.1.0",
36
36
  "picocolors": "^1.1.0",
37
37
  "tslib": "^2.3.0",
38
- "@nx/devkit": "20.5.0",
39
- "@nx/js": "20.5.0"
38
+ "@nx/devkit": "20.6.0-beta.1",
39
+ "@nx/js": "20.6.0-beta.1"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"
@@ -150,12 +150,12 @@ async function setupBundler(tree, options) {
150
150
  }
151
151
  }
152
152
  async function addProject(tree, options) {
153
- if (options.isUsingTsSolutionConfig) {
154
- const packageJson = {
155
- name: options.importPath,
156
- version: '0.0.1',
157
- private: true,
158
- };
153
+ const packageJson = {
154
+ name: options.importPath,
155
+ version: '0.0.1',
156
+ private: true,
157
+ };
158
+ if (!options.useProjectJson) {
159
159
  if (options.projectName !== options.importPath) {
160
160
  packageJson.nx = { name: options.projectName };
161
161
  }
@@ -163,7 +163,6 @@ async function addProject(tree, options) {
163
163
  packageJson.nx ??= {};
164
164
  packageJson.nx.tags = options.parsedTags;
165
165
  }
166
- (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
167
166
  }
168
167
  else {
169
168
  (0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
@@ -174,6 +173,9 @@ async function addProject(tree, options) {
174
173
  targets: {},
175
174
  });
176
175
  }
176
+ if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
177
+ (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
178
+ }
177
179
  }
178
180
  function setDefaults(tree, options) {
179
181
  const nxJson = (0, devkit_1.readNxJson)(tree);
@@ -196,7 +198,7 @@ async function applicationGenerator(host, schema) {
196
198
  async function applicationGeneratorInternal(host, schema) {
197
199
  const options = await normalizeOptions(host, schema);
198
200
  if (options.isUsingTsSolutionConfig) {
199
- (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
201
+ await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
200
202
  }
201
203
  const tasks = [];
202
204
  const jsInitTask = await (0, js_1.initGenerator)(host, {
@@ -310,15 +312,15 @@ async function applicationGeneratorInternal(host, schema) {
310
312
  }
311
313
  if (options.e2eTestRunner === 'cypress') {
312
314
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_2.nxVersion);
313
- if (options.isUsingTsSolutionConfig) {
314
- (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
315
- name: options.e2eProjectName,
316
- version: '0.0.1',
317
- private: true,
318
- nx: {
319
- implicitDependencies: [options.projectName],
320
- },
321
- });
315
+ const packageJson = {
316
+ name: options.e2eProjectName,
317
+ version: '0.0.1',
318
+ private: true,
319
+ };
320
+ if (!options.useProjectJson) {
321
+ packageJson.nx = {
322
+ implicitDependencies: [options.projectName],
323
+ };
322
324
  }
323
325
  else {
324
326
  (0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
@@ -330,6 +332,9 @@ async function applicationGeneratorInternal(host, schema) {
330
332
  implicitDependencies: [options.projectName],
331
333
  });
332
334
  }
335
+ if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
336
+ (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
337
+ }
333
338
  const cypressTask = await configurationGenerator(host, {
334
339
  ...options,
335
340
  project: options.e2eProjectName,
@@ -365,15 +370,15 @@ async function applicationGeneratorInternal(host, schema) {
365
370
  }
366
371
  else if (options.e2eTestRunner === 'playwright') {
367
372
  const { configurationGenerator: playwrightConfigGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_2.nxVersion);
368
- if (options.isUsingTsSolutionConfig) {
369
- (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
370
- name: options.e2eProjectName,
371
- version: '0.0.1',
372
- private: true,
373
- nx: {
374
- implicitDependencies: [options.projectName],
375
- },
376
- });
373
+ const packageJson = {
374
+ name: options.e2eProjectName,
375
+ version: '0.0.1',
376
+ private: true,
377
+ };
378
+ if (!options.useProjectJson) {
379
+ packageJson.nx = {
380
+ implicitDependencies: [options.projectName],
381
+ };
377
382
  }
378
383
  else {
379
384
  (0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
@@ -385,6 +390,9 @@ async function applicationGeneratorInternal(host, schema) {
385
390
  implicitDependencies: [options.projectName],
386
391
  });
387
392
  }
393
+ if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
394
+ (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
395
+ }
388
396
  const playwrightTask = await playwrightConfigGenerator(host, {
389
397
  project: options.e2eProjectName,
390
398
  skipFormat: true,
@@ -494,6 +502,7 @@ async function normalizeOptions(host, options) {
494
502
  parsedTags,
495
503
  names: (0, devkit_1.names)(projectName),
496
504
  isUsingTsSolutionConfig,
505
+ useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
497
506
  };
498
507
  }
499
508
  exports.default = applicationGenerator;
@@ -16,4 +16,5 @@ export interface Schema {
16
16
  setParserOptionsProject?: boolean;
17
17
  strict?: boolean;
18
18
  addPlugin?: boolean;
19
+ useProjectJson?: boolean;
19
20
  }
@@ -104,6 +104,10 @@
104
104
  "type": "boolean",
105
105
  "description": "Creates an application with strict mode and strict type checking.",
106
106
  "default": true
107
+ },
108
+ "useProjectJson": {
109
+ "type": "boolean",
110
+ "description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
107
111
  }
108
112
  },
109
113
  "required": ["directory"],