@nx/vue 19.2.0-rc.0 → 19.2.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/vue",
3
- "version": "19.2.0-rc.0",
3
+ "version": "19.2.0",
4
4
  "private": false,
5
5
  "description": "The Vue plugin for Nx contains executors and generators for managing Vue applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Vitest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -31,11 +31,11 @@
31
31
  "dependencies": {
32
32
  "minimatch": "9.0.3",
33
33
  "tslib": "^2.3.0",
34
- "@nx/devkit": "19.2.0-rc.0",
35
- "@nx/js": "19.2.0-rc.0",
36
- "@nx/eslint": "19.2.0-rc.0",
37
- "@nx/vite": "19.2.0-rc.0",
38
- "@nx/web": "19.2.0-rc.0"
34
+ "@nx/devkit": "19.2.0",
35
+ "@nx/js": "19.2.0",
36
+ "@nx/eslint": "19.2.0",
37
+ "@nx/vite": "19.2.0",
38
+ "@nx/web": "19.2.0"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
@@ -10,4 +10,4 @@ export declare function addLinting(host: Tree, options: {
10
10
  rootProject?: boolean;
11
11
  addPlugin?: boolean;
12
12
  }, projectType: 'lib' | 'app'): Promise<import("@nx/devkit").GeneratorCallback>;
13
- export declare function editEslintConfigFiles(tree: Tree, projectRoot: string, rootProject?: boolean): void;
13
+ export declare function editEslintConfigFiles(tree: Tree, projectRoot: string): void;
@@ -20,15 +20,13 @@ async function addLinting(host, options, projectType) {
20
20
  rootProject: options.rootProject,
21
21
  addPlugin: options.addPlugin,
22
22
  });
23
- if ((0, eslint_file_1.isEslintConfigSupported)(host)) {
24
- (0, eslint_file_1.addExtendsToLintConfig)(host, options.projectRoot, [
25
- 'plugin:vue/vue3-essential',
26
- 'eslint:recommended',
27
- '@vue/eslint-config-typescript',
28
- '@vue/eslint-config-prettier/skip-formatting',
29
- ]);
30
- }
31
- editEslintConfigFiles(host, options.projectRoot, options.rootProject);
23
+ (0, eslint_file_1.addExtendsToLintConfig)(host, options.projectRoot, [
24
+ 'plugin:vue/vue3-essential',
25
+ 'eslint:recommended',
26
+ '@vue/eslint-config-typescript',
27
+ '@vue/eslint-config-prettier/skip-formatting',
28
+ ]);
29
+ editEslintConfigFiles(host, options.projectRoot);
32
30
  let installTask = () => { };
33
31
  if (!options.skipPackageJson) {
34
32
  installTask = (0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, lint_1.extraEslintDependencies.devDependencies);
@@ -40,78 +38,46 @@ async function addLinting(host, options, projectType) {
40
38
  }
41
39
  }
42
40
  exports.addLinting = addLinting;
43
- function editEslintConfigFiles(tree, projectRoot, rootProject) {
44
- if (tree.exists((0, path_1.joinPathFragments)(projectRoot, 'eslint.config.js'))) {
45
- const fileName = (0, path_1.joinPathFragments)(projectRoot, 'eslint.config.js');
46
- (0, devkit_1.updateJson)(tree, fileName, (json) => {
47
- let updated = false;
48
- for (let override of json.overrides) {
49
- if (override.parserOptions) {
50
- if (!override.files.includes('*.vue')) {
51
- override.files.push('*.vue');
52
- }
53
- updated = true;
54
- }
55
- }
56
- if (!updated) {
57
- json.overrides = [
58
- {
59
- files: ['*.ts', '*.tsx', '*.js', '*.jsx', '*.vue'],
60
- rules: { 'vue/multi-word-component-names': 'off' },
61
- },
62
- ];
63
- }
64
- return json;
65
- });
66
- }
67
- else {
68
- const fileName = (0, path_1.joinPathFragments)(projectRoot, '.eslintrc.json');
69
- (0, devkit_1.updateJson)(tree, fileName, (json) => {
70
- let updated = false;
71
- for (let override of json.overrides) {
72
- if (override.parserOptions) {
73
- if (!override.files.includes('*.vue')) {
74
- override.files.push('*.vue');
75
- }
76
- updated = true;
77
- }
78
- }
79
- if (!updated) {
80
- json.overrides = [
81
- {
82
- files: ['*.ts', '*.tsx', '*.js', '*.jsx', '*.vue'],
83
- rules: { 'vue/multi-word-component-names': 'off' },
84
- },
85
- ];
86
- }
87
- return json;
88
- });
41
+ function editEslintConfigFiles(tree, projectRoot) {
42
+ const hasVueFiles = (o) => o.files &&
43
+ (Array.isArray(o.files)
44
+ ? o.files.some((f) => f.endsWith('*.vue'))
45
+ : o.files.endsWith('*.vue'));
46
+ const addVueFiles = (o) => {
47
+ if (!o.files) {
48
+ o.files = ['*.vue'];
49
+ }
50
+ else if (Array.isArray(o.files)) {
51
+ o.files.push('*.vue');
52
+ }
53
+ else {
54
+ o.files = [o.files, '*.vue'];
55
+ }
56
+ };
57
+ if ((0, eslint_file_1.isEslintConfigSupported)(tree, projectRoot)) {
58
+ if ((0, eslint_file_1.lintConfigHasOverride)(tree, projectRoot, (o) => o.parserOptions && !hasVueFiles(o), true)) {
59
+ (0, eslint_file_1.updateOverrideInLintConfig)(tree, projectRoot, (o) => !!o.parserOptions, (o) => {
60
+ addVueFiles(o);
61
+ return o;
62
+ });
63
+ }
64
+ else {
65
+ (0, eslint_file_1.replaceOverridesInLintConfig)(tree, projectRoot, [
66
+ {
67
+ files: ['*.ts', '*.tsx', '*.js', '*.jsx', '*.vue'],
68
+ rules: { 'vue/multi-word-component-names': 'off' },
69
+ },
70
+ ]);
71
+ }
89
72
  }
90
73
  // Edit root config too
91
- if (tree.exists('.eslintrc.base.json')) {
92
- (0, devkit_1.updateJson)(tree, '.eslintrc.base.json', (json) => {
93
- for (let override of json.overrides) {
94
- if (override.rules &&
95
- '@nx/enforce-module-boundaries' in override.rules) {
96
- if (!override.files.includes('*.vue')) {
97
- override.files.push('*.vue');
98
- }
99
- }
100
- }
101
- return json;
102
- });
74
+ if (!(0, eslint_file_1.isEslintConfigSupported)(tree)) {
75
+ return;
103
76
  }
104
- else if (tree.exists('.eslintrc.json') && !rootProject) {
105
- (0, devkit_1.updateJson)(tree, '.eslintrc.json', (json) => {
106
- for (let override of json.overrides) {
107
- if (override.rules &&
108
- '@nx/enforce-module-boundaries' in override.rules) {
109
- if (!override.files.includes('*.vue')) {
110
- override.files.push('*.vue');
111
- }
112
- }
113
- }
114
- return json;
77
+ if ((0, eslint_file_1.lintConfigHasOverride)(tree, '', (o) => o.rules?.['@nx/enforce-module-boundaries'] && !hasVueFiles(o), true)) {
78
+ (0, eslint_file_1.updateOverrideInLintConfig)(tree, '', (o) => !!o.rules?.['@nx/enforce-module-boundaries'], (o) => {
79
+ addVueFiles(o);
80
+ return o;
115
81
  });
116
82
  }
117
83
  }