@space-arch/nx-plugin-std 1.7.0 → 1.7.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/dist/generators/pkg/__snapshots__/pkg-generator.spec.ts.snap +2 -2
- package/dist/generators/pkg/lib/tsReferenceBased.d.ts.map +1 -1
- package/dist/generators/pkg/lib/util/deleteTsModuleSettings.d.ts +3 -0
- package/dist/generators/pkg/lib/util/deleteTsModuleSettings.d.ts.map +1 -0
- package/dist/generators/pkg/lib/util/deleteTsModuleSettings.js +14 -0
- package/dist/generators/pkg/lib/util/setJsTsOptions.d.ts.map +1 -1
- package/dist/generators/pkg/lib/util/setJsTsOptions.js +2 -8
- package/dist/generators/pkg/lib/util/setReactTsOptions.d.ts.map +1 -1
- package/dist/generators/pkg/lib/util/setReactTsOptions.js +2 -4
- package/dist/generators/zed-eslint/schema.d.ts +1 -0
- package/dist/generators/zed-eslint/schema.json +8 -0
- package/dist/generators/zed-eslint/zed-eslint.d.ts +5 -0
- package/dist/generators/zed-eslint/zed-eslint.d.ts.map +1 -0
- package/dist/generators/zed-eslint/zed-eslint.js +37 -0
- package/generators.json +5 -0
- package/package.json +1 -1
|
@@ -123,7 +123,7 @@ exports[`ts-reference-based not publishable package > should generate expected p
|
|
|
123
123
|
"{options.reportsDirectory}"
|
|
124
124
|
],
|
|
125
125
|
"options": {
|
|
126
|
-
"reportsDirectory": "
|
|
126
|
+
"reportsDirectory": "coverage/packages/foo/bar-baz"
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
@@ -210,7 +210,7 @@ exports[`ts-reference-based publishable package > should generate expected packa
|
|
|
210
210
|
"{options.reportsDirectory}"
|
|
211
211
|
],
|
|
212
212
|
"options": {
|
|
213
|
-
"reportsDirectory": "
|
|
213
|
+
"reportsDirectory": "coverage/packages/foo/bar-baz"
|
|
214
214
|
}
|
|
215
215
|
},
|
|
216
216
|
"lint": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsReferenceBased.d.ts","sourceRoot":"","sources":["../../../../src/generators/pkg/lib/tsReferenceBased.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAiC,MAAM,YAAY,CAAC;AAMtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAUzD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,EACZ,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"tsReferenceBased.d.ts","sourceRoot":"","sources":["../../../../src/generators/pkg/lib/tsReferenceBased.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAiC,MAAM,YAAY,CAAC;AAMtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAUzD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,EACZ,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,kBAAkB,iBA6ElE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteTsModuleSettings.d.ts","sourceRoot":"","sources":["../../../../../src/generators/pkg/lib/util/deleteTsModuleSettings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKvC,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAW9D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { updateTsConfigLibJson } from "./updateTsConfigLibJson.js";
|
|
2
|
+
import { updateTsConfigSpecJson } from "./updateTsConfigSpecJson.js";
|
|
3
|
+
export function deleteTsModuleSettings(tree, path) {
|
|
4
|
+
updateTsConfigLibJson(tree, path, json => {
|
|
5
|
+
delete json.compilerOptions.module;
|
|
6
|
+
delete json.compilerOptions.moduleResolution;
|
|
7
|
+
return json;
|
|
8
|
+
});
|
|
9
|
+
updateTsConfigSpecJson(tree, path, json => {
|
|
10
|
+
delete json.compilerOptions.module;
|
|
11
|
+
delete json.compilerOptions.moduleResolution;
|
|
12
|
+
return json;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setJsTsOptions.d.ts","sourceRoot":"","sources":["../../../../../src/generators/pkg/lib/util/setJsTsOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAMvC,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"setJsTsOptions.d.ts","sourceRoot":"","sources":["../../../../../src/generators/pkg/lib/util/setJsTsOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAMvC,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAMtD"}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
+
import { deleteTsModuleSettings } from "./deleteTsModuleSettings.js";
|
|
1
2
|
import { updateArrayProperty } from "./updateArrayProperty.js";
|
|
2
3
|
import { updateTsConfigLibJson } from "./updateTsConfigLibJson.js";
|
|
3
|
-
import { updateTsConfigSpecJson } from "./updateTsConfigSpecJson.js";
|
|
4
4
|
export function setJsTsOptions(tree, path) {
|
|
5
|
-
|
|
6
|
-
json.compilerOptions.module = 'nodenext';
|
|
7
|
-
json.compilerOptions.moduleResolution = 'nodenext';
|
|
8
|
-
return json;
|
|
9
|
-
});
|
|
5
|
+
deleteTsModuleSettings(tree, path);
|
|
10
6
|
updateTsConfigLibJson(tree, path, json => {
|
|
11
|
-
json.compilerOptions.module = 'nodenext';
|
|
12
|
-
json.compilerOptions.moduleResolution = 'nodenext';
|
|
13
7
|
updateArrayProperty(json.compilerOptions, 'types', ['node', 'vite/client']);
|
|
14
8
|
return json;
|
|
15
9
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setReactTsOptions.d.ts","sourceRoot":"","sources":["../../../../../src/generators/pkg/lib/util/setReactTsOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAqB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"setReactTsOptions.d.ts","sourceRoot":"","sources":["../../../../../src/generators/pkg/lib/util/setReactTsOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAqB,MAAM,YAAY,CAAC;AAsB1D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAiDzD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { joinPathFragments } from '@nx/devkit';
|
|
2
|
+
import { deleteTsModuleSettings } from "./deleteTsModuleSettings.js";
|
|
2
3
|
import { updateArrayProperty } from "./updateArrayProperty.js";
|
|
3
4
|
import { updateTsConfigLibJson } from "./updateTsConfigLibJson.js";
|
|
4
5
|
import { updateTsConfigSpecJson } from "./updateTsConfigSpecJson.js";
|
|
@@ -18,16 +19,13 @@ const BABELRC = `
|
|
|
18
19
|
`.trim();
|
|
19
20
|
export function setReactTsOptions(tree, path) {
|
|
20
21
|
tree.write(joinPathFragments(path, '.babelrc'), BABELRC);
|
|
22
|
+
deleteTsModuleSettings(tree, path);
|
|
21
23
|
updateTsConfigSpecJson(tree, path, json => {
|
|
22
24
|
json.compilerOptions.jsx = 'react-jsx';
|
|
23
|
-
json.compilerOptions.module = 'esnext';
|
|
24
|
-
json.compilerOptions.moduleResolution = 'bundler';
|
|
25
25
|
return json;
|
|
26
26
|
});
|
|
27
27
|
updateTsConfigLibJson(tree, path, json => {
|
|
28
28
|
json.compilerOptions.jsx = 'react-jsx';
|
|
29
|
-
json.compilerOptions.module = 'esnext';
|
|
30
|
-
json.compilerOptions.moduleResolution = 'bundler';
|
|
31
29
|
updateArrayProperty(json.compilerOptions, 'types', [
|
|
32
30
|
'node',
|
|
33
31
|
'@nx/react/typings/cssmodule.d.ts',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ZedEslintGeneratorSchema = object;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Tree } from '@nx/devkit';
|
|
2
|
+
import type { ZedEslintGeneratorSchema } from './schema.js';
|
|
3
|
+
export declare function zedEslintGenerator(tree: Tree, _options: ZedEslintGeneratorSchema): Promise<void>;
|
|
4
|
+
export default zedEslintGenerator;
|
|
5
|
+
//# sourceMappingURL=zed-eslint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zed-eslint.d.ts","sourceRoot":"","sources":["../../../src/generators/zed-eslint/zed-eslint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,wBAAwB,iBAqBnC;AAoDD,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { getProjects, joinPathFragments, logger } from '@nx/devkit';
|
|
2
|
+
export async function zedEslintGenerator(tree, _options) {
|
|
3
|
+
const projects = getProjects(tree);
|
|
4
|
+
logger.info('Listing all projects..');
|
|
5
|
+
const projectDirsSet = new Set(['./']);
|
|
6
|
+
for (const p of projects.values()) {
|
|
7
|
+
if (p.root === '.')
|
|
8
|
+
continue;
|
|
9
|
+
if (hasEslintConfig(tree, p.root)) {
|
|
10
|
+
projectDirsSet.add(`./${p.root}/`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
logger.info(`Collected directories: ${projectDirsSet.size}`);
|
|
14
|
+
writeDirs(tree, [...projectDirsSet].sort((a, b) => a.localeCompare(b)));
|
|
15
|
+
}
|
|
16
|
+
function hasEslintConfig(tree, dir) {
|
|
17
|
+
const exts = ['js', 'mjs', 'cjs', 'ts', 'mts', 'cts', 'json'];
|
|
18
|
+
return exts.some(ext => tree.exists(joinPathFragments(dir, `eslint.config.${ext}`)));
|
|
19
|
+
}
|
|
20
|
+
function writeDirs(tree, dirs) {
|
|
21
|
+
logger.info('Reading local zed settings.json');
|
|
22
|
+
const settings = getSettings(tree);
|
|
23
|
+
logger.info('Writing local zed settings.json');
|
|
24
|
+
Object.assign(settings.lsp.eslint.settings, { workingDirectories: dirs });
|
|
25
|
+
tree.write(joinPathFragments('.zed', 'settings.json'), JSON.stringify(settings, null, 2));
|
|
26
|
+
}
|
|
27
|
+
function getSettings(tree) {
|
|
28
|
+
const settingsString = tree.read(joinPathFragments('.zed', 'settings.json'), 'utf-8');
|
|
29
|
+
if (!settingsString) {
|
|
30
|
+
return { lsp: { eslint: { settings: { workingDirectories: [] } } } };
|
|
31
|
+
}
|
|
32
|
+
return JSON.parse(removeComments(settingsString));
|
|
33
|
+
}
|
|
34
|
+
function removeComments(jsoncString) {
|
|
35
|
+
return jsoncString.replace(/\/\/.*$/gm, '').trim();
|
|
36
|
+
}
|
|
37
|
+
export default zedEslintGenerator;
|
package/generators.json
CHANGED
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
"factory": "./dist/generators/mv/mv-generator",
|
|
20
20
|
"schema": "./dist/generators/mv/schema.json",
|
|
21
21
|
"description": "mv generator"
|
|
22
|
+
},
|
|
23
|
+
"zed-eslint": {
|
|
24
|
+
"factory": "./dist/generators/zed-eslint/zed-eslint",
|
|
25
|
+
"schema": "./dist/generators/zed-eslint/schema.json",
|
|
26
|
+
"description": "zed-eslint generator"
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
}
|