@nx/web 20.5.0-beta.1 → 20.5.0-beta.3

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-beta.1",
3
+ "version": "20.5.0-beta.3",
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-beta.1",
39
- "@nx/js": "20.5.0-beta.1"
38
+ "@nx/devkit": "20.5.0-beta.3",
39
+ "@nx/js": "20.5.0-beta.3"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"
@@ -29,19 +29,22 @@ function createApplicationFiles(tree, options) {
29
29
  });
30
30
  }
31
31
  else {
32
+ const rootOffset = (0, devkit_1.offsetFromRoot)(options.appProjectRoot);
32
33
  (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files/app-webpack'), options.appProjectRoot, {
33
34
  ...options,
34
35
  ...(0, devkit_1.names)(options.name),
35
36
  tmpl: '',
36
- offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.appProjectRoot),
37
+ offsetFromRoot: rootOffset,
37
38
  rootTsConfigPath,
38
39
  webpackPluginOptions: (0, has_webpack_plugin_1.hasWebpackPlugin)(tree)
39
40
  ? {
40
41
  compiler: options.compiler,
41
42
  target: 'web',
42
- outputPath: (0, devkit_1.joinPathFragments)('dist', options.appProjectRoot != '.'
43
- ? options.appProjectRoot
44
- : options.projectName),
43
+ outputPath: options.isUsingTsSolutionConfig
44
+ ? 'dist'
45
+ : (0, devkit_1.joinPathFragments)(rootOffset, 'dist', options.appProjectRoot !== '.'
46
+ ? options.appProjectRoot
47
+ : options.projectName),
45
48
  tsConfig: './tsconfig.app.json',
46
49
  main: './src/main.ts',
47
50
  assets: ['./src/favicon.ico', './src/assets'],
@@ -100,7 +103,7 @@ async function setupBundler(tree, options) {
100
103
  addPlugin: options.addPlugin,
101
104
  });
102
105
  const project = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
103
- if (project.targets.build) {
106
+ if (project.targets?.build) {
104
107
  const prodConfig = project.targets.build.configurations.production;
105
108
  const buildOptions = project.targets.build.options;
106
109
  buildOptions.assets = assets;
@@ -212,6 +215,21 @@ async function applicationGeneratorInternal(host, schema) {
212
215
  await setupBundler(host, options);
213
216
  }
214
217
  createApplicationFiles(host, options);
218
+ if (options.linter === 'eslint') {
219
+ const { lintProjectGenerator } = (0, devkit_1.ensurePackage)('@nx/eslint', versions_2.nxVersion);
220
+ const lintTask = await lintProjectGenerator(host, {
221
+ linter: options.linter,
222
+ project: options.projectName,
223
+ tsConfigPaths: [
224
+ (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
225
+ ],
226
+ unitTestRunner: options.unitTestRunner,
227
+ skipFormat: true,
228
+ setParserOptionsProject: options.setParserOptionsProject,
229
+ addPlugin: options.addPlugin,
230
+ });
231
+ tasks.push(lintTask);
232
+ }
215
233
  if (options.bundler === 'vite') {
216
234
  const { viteConfigurationGenerator, createOrEditViteConfig } = (0, devkit_1.ensurePackage)('@nx/vite', versions_2.nxVersion);
217
235
  // We recommend users use `import.meta.env.MODE` and other variables in their code to differentiate between production and development.
@@ -259,21 +277,6 @@ async function applicationGeneratorInternal(host, schema) {
259
277
  options.inSourceTests) {
260
278
  host.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, `src/app/app.element.spec.ts`));
261
279
  }
262
- if (options.linter === 'eslint') {
263
- const { lintProjectGenerator } = (0, devkit_1.ensurePackage)('@nx/eslint', versions_2.nxVersion);
264
- const lintTask = await lintProjectGenerator(host, {
265
- linter: options.linter,
266
- project: options.projectName,
267
- tsConfigPaths: [
268
- (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
269
- ],
270
- unitTestRunner: options.unitTestRunner,
271
- skipFormat: true,
272
- setParserOptionsProject: options.setParserOptionsProject,
273
- addPlugin: options.addPlugin,
274
- });
275
- tasks.push(lintTask);
276
- }
277
280
  const nxJson = (0, devkit_1.readNxJson)(host);
278
281
  let hasPlugin;
279
282
  let buildPlugin;
@@ -4,7 +4,7 @@ const { join } = require('path');
4
4
 
5
5
  module.exports = {
6
6
  output: {
7
- path: join(__dirname, '<%= offsetFromRoot %><%= webpackPluginOptions.outputPath %>'),
7
+ path: join(__dirname, '<%= webpackPluginOptions.outputPath %>'),
8
8
  },
9
9
  devServer: {
10
10
  port: 4200