@naturalcycles/dev-lib 15.15.0 → 15.17.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/cfg/_cnst.js +2 -7
- package/cfg/biome.jsonc +1 -1
- package/cfg/lint-staged.config.js +3 -3
- package/dist/bin/dev-lib.js +9 -12
- package/dist/build.util.d.ts +1 -1
- package/dist/build.util.js +8 -2
- package/dist/lint.util.js +14 -4
- package/package.json +1 -1
package/cfg/_cnst.js
CHANGED
|
@@ -5,12 +5,7 @@ module.exports = {
|
|
|
5
5
|
// ts,tsx,css,scss excluded, cause they need to run in special order (overlap between >1 tool):
|
|
6
6
|
prettierExtensionsExclusive: 'js,jsx,json,md,graphql,yml,yaml,html',
|
|
7
7
|
// everything that prettier supports:
|
|
8
|
-
prettierExtensionsAll: 'ts,tsx,css,scss,js,jsx,json,md,graphql,yml,yaml,html,vue',
|
|
8
|
+
prettierExtensionsAll: 'ts,tsx,cts,mts,css,scss,js,jsx,cjs,mjs,json,md,graphql,yml,yaml,html,vue',
|
|
9
9
|
stylelintExtensions: 'css,scss',
|
|
10
|
-
lintExclude: [
|
|
11
|
-
'./**/__exclude/**',
|
|
12
|
-
'./docs/.vitepress/dist/**',
|
|
13
|
-
'./docs/.vitepress/cache/**',
|
|
14
|
-
'./CHANGELOG.md',
|
|
15
|
-
],
|
|
10
|
+
lintExclude: ['./**/__exclude/**', './**/dist/**', './**/cache/**', './CHANGELOG.md'],
|
|
16
11
|
}
|
package/cfg/biome.jsonc
CHANGED
|
@@ -60,7 +60,7 @@ if (!stylelintCmd) {
|
|
|
60
60
|
|
|
61
61
|
const linters = {
|
|
62
62
|
// *.{ts,tsx,vue} files: biome, eslint, prettier
|
|
63
|
-
'./src/**/*.{ts,tsx,vue}': match => {
|
|
63
|
+
'./src/**/*.{ts,tsx,cts,mts,vue}': match => {
|
|
64
64
|
const filesList = getFilesList(match)
|
|
65
65
|
if (!filesList) return []
|
|
66
66
|
return [
|
|
@@ -141,7 +141,7 @@ if (fs.existsSync(`./scripts`)) {
|
|
|
141
141
|
)
|
|
142
142
|
Object.assign(linters, {
|
|
143
143
|
// biome, eslint, Prettier
|
|
144
|
-
'./scripts/**/*.{ts,tsx}': match => {
|
|
144
|
+
'./scripts/**/*.{ts,tsx,cts,mts}': match => {
|
|
145
145
|
const filesList = getFilesList(match)
|
|
146
146
|
if (!filesList) return []
|
|
147
147
|
return [
|
|
@@ -164,7 +164,7 @@ if (fs.existsSync(`./e2e`)) {
|
|
|
164
164
|
|
|
165
165
|
Object.assign(linters, {
|
|
166
166
|
// biome, eslint, Prettier
|
|
167
|
-
'./e2e/**/*.{ts,tsx}': match => {
|
|
167
|
+
'./e2e/**/*.{ts,tsx,cts,mts}': match => {
|
|
168
168
|
const filesList = getFilesList(match)
|
|
169
169
|
if (!filesList) return []
|
|
170
170
|
return [
|
package/dist/bin/dev-lib.js
CHANGED
|
@@ -12,31 +12,28 @@ const test_util_1 = require("../test.util");
|
|
|
12
12
|
const yarn_util_1 = require("../yarn.util");
|
|
13
13
|
const commands = [
|
|
14
14
|
new prompts_1.Separator(), // build
|
|
15
|
+
{
|
|
16
|
+
name: 'tsc',
|
|
17
|
+
fn: tscAll,
|
|
18
|
+
desc: 'Run tsc in folders (src, scripts, e2e, playwright) if there is tsconfig.json present',
|
|
19
|
+
},
|
|
20
|
+
{ name: 'bt', fn: bt, desc: 'Build & Test: run "tsc" and then "test".' },
|
|
21
|
+
{ name: 'lbt', fn: lbt, desc: 'Lint/Build/Test: run "lint", then "tsc", then "test".' },
|
|
15
22
|
{
|
|
16
23
|
name: 'build',
|
|
17
24
|
fn: build_util_1.buildProd,
|
|
18
|
-
desc: 'Clean ./dist, run "build-copy" then tsc with emit, using tsconfig.prod.json',
|
|
19
|
-
cliOnly: true,
|
|
25
|
+
desc: 'Clean ./dist, run "build-copy" then tsc with --emit and --noCheck, using tsconfig.prod.json',
|
|
20
26
|
},
|
|
21
27
|
{
|
|
22
28
|
name: 'build-copy',
|
|
23
29
|
fn: build_util_1.buildCopy,
|
|
24
30
|
desc: 'Copy the non-ts files from ./src to ./dist',
|
|
25
|
-
cliOnly: true,
|
|
26
31
|
},
|
|
27
32
|
{
|
|
28
33
|
name: 'build-esm-cjs',
|
|
29
34
|
fn: build_util_1.buildEsmCjs,
|
|
30
|
-
desc: 'Clean ./dist and ./dist-esm, then run "tsc" in CJS and ESM modes
|
|
31
|
-
cliOnly: true,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: 'tsc',
|
|
35
|
-
fn: tscAll,
|
|
36
|
-
desc: 'Run tsc in folders (src, scripts, e2e, playwright) if there is tsconfig.json present',
|
|
35
|
+
desc: 'Clean ./dist and ./dist-esm, then run "tsc" in CJS and ESM modes, with --emit and --noCheck',
|
|
37
36
|
},
|
|
38
|
-
{ name: 'bt', fn: bt, desc: 'Build & Test: run "build" and then "test".' },
|
|
39
|
-
{ name: 'lbt', fn: lbt, desc: 'Lint/Build/Test: run "lint", then "build", then "test".' },
|
|
40
37
|
new prompts_1.Separator(), // test
|
|
41
38
|
{ name: 'test', fn: test_util_1.runJest, desc: 'Run jest for *.test.ts files.' },
|
|
42
39
|
{
|
package/dist/build.util.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ export declare function runTSCInFolders(tsconfigPaths: string[], args?: string[]
|
|
|
8
8
|
* Pass '.' to run in root.
|
|
9
9
|
*/
|
|
10
10
|
export declare function runTSCInFolder(tsconfigPath: string, args?: string[]): Promise<void>;
|
|
11
|
-
export declare function runTSCProd(): Promise<void>;
|
|
11
|
+
export declare function runTSCProd(args?: string[]): Promise<void>;
|
|
12
12
|
export declare function buildCopy(): void;
|
package/dist/build.util.js
CHANGED
|
@@ -33,6 +33,9 @@ async function buildEsmCjs() {
|
|
|
33
33
|
'nodenext',
|
|
34
34
|
'--moduleResolution',
|
|
35
35
|
'nodenext',
|
|
36
|
+
'--noEmit',
|
|
37
|
+
'false',
|
|
38
|
+
'--noCheck',
|
|
36
39
|
],
|
|
37
40
|
shell: false,
|
|
38
41
|
}),
|
|
@@ -48,6 +51,9 @@ async function buildEsmCjs() {
|
|
|
48
51
|
'bundler',
|
|
49
52
|
'--declaration',
|
|
50
53
|
'false',
|
|
54
|
+
'--noEmit',
|
|
55
|
+
'false',
|
|
56
|
+
'--noCheck',
|
|
51
57
|
],
|
|
52
58
|
shell: false,
|
|
53
59
|
}),
|
|
@@ -84,10 +90,10 @@ async function runTSCInFolder(tsconfigPath, args = []) {
|
|
|
84
90
|
shell: false,
|
|
85
91
|
});
|
|
86
92
|
}
|
|
87
|
-
async function runTSCProd() {
|
|
93
|
+
async function runTSCProd(args = []) {
|
|
88
94
|
const tsconfigPath = [`./tsconfig.prod.json`].find(p => node_fs_1.default.existsSync(p)) || 'tsconfig.json';
|
|
89
95
|
await nodejs_lib_1.exec2.spawnAsync(`tsc`, {
|
|
90
|
-
args: ['-P', tsconfigPath],
|
|
96
|
+
args: ['-P', tsconfigPath, '--noEmit', 'false', '--noCheck', ...args],
|
|
91
97
|
shell: false,
|
|
92
98
|
});
|
|
93
99
|
}
|
package/dist/lint.util.js
CHANGED
|
@@ -87,9 +87,19 @@ async function eslintAll(opt) {
|
|
|
87
87
|
...opt,
|
|
88
88
|
};
|
|
89
89
|
const extensions = ext.split(',');
|
|
90
|
-
const eslintConfigPathRoot = ['./eslint.config.js'].find(p => node_fs_1.default.existsSync(p));
|
|
91
|
-
const eslintConfigPathScripts = [
|
|
92
|
-
|
|
90
|
+
const eslintConfigPathRoot = ['./eslint.config.js', './eslint.config.cjs'].find(p => node_fs_1.default.existsSync(p));
|
|
91
|
+
const eslintConfigPathScripts = [
|
|
92
|
+
'./scripts/eslint.config.js',
|
|
93
|
+
'./scripts/eslint.config.cjs',
|
|
94
|
+
'./eslint.config.js',
|
|
95
|
+
'./eslint.config.cjs',
|
|
96
|
+
].find(p => node_fs_1.default.existsSync(p));
|
|
97
|
+
const eslintConfigPathE2e = [
|
|
98
|
+
'./e2e/eslint.config.js',
|
|
99
|
+
'./e2e/eslint.config.cjs',
|
|
100
|
+
'./eslint.config.js',
|
|
101
|
+
'./eslint.config.cjs',
|
|
102
|
+
].find(p => node_fs_1.default.existsSync(p));
|
|
93
103
|
const eslintConfigPathPlaywright = ['./playwright/eslint.config.js', './eslint.config.js'].find(p => node_fs_1.default.existsSync(p));
|
|
94
104
|
const tsconfigPathScripts = [`./scripts/tsconfig.json`].find(p => node_fs_1.default.existsSync(p)) || `${paths_1.scriptsDir}/tsconfig.json`;
|
|
95
105
|
const tsconfigPathE2e = `./e2e/tsconfig.json`;
|
|
@@ -145,7 +155,7 @@ const prettierPaths = [
|
|
|
145
155
|
...lintExclude.map((s) => `!${s}`),
|
|
146
156
|
];
|
|
147
157
|
function runPrettier() {
|
|
148
|
-
const prettierConfigPath = [`./prettier.config.js`].find(f => node_fs_1.default.existsSync(f));
|
|
158
|
+
const prettierConfigPath = [`./prettier.config.js`, `./prettier.config.cjs`].find(f => node_fs_1.default.existsSync(f));
|
|
149
159
|
if (!prettierConfigPath)
|
|
150
160
|
return;
|
|
151
161
|
// prettier --write 'src/**/*.{js,ts,css,scss,graphql}'
|