@naturalcycles/dev-lib 20.18.1 → 20.19.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/vitest.config.js +13 -13
- package/dist/bin/dev-lib.js +16 -17
- package/package.json +4 -4
- package/cfg/commitlint.config.js +0 -9
- package/cfg/init/commitlint.config.js +0 -5
package/cfg/vitest.config.js
CHANGED
|
@@ -47,19 +47,19 @@ export function defineVitestConfig(config, cwd) {
|
|
|
47
47
|
|
|
48
48
|
const { silent, pool, maxWorkers, isolate } = mergedConfig.test
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
50
|
+
// In workspace mode, cwd differs from process.cwd() (which is the monorepo root)
|
|
51
|
+
const isWorkspaceMode = cwd && process.cwd() !== cwd
|
|
52
|
+
if (!isWorkspaceMode) {
|
|
53
|
+
console.log({
|
|
54
|
+
testType,
|
|
55
|
+
silent,
|
|
56
|
+
isCI,
|
|
57
|
+
runsInIDE,
|
|
58
|
+
pool,
|
|
59
|
+
isolate,
|
|
60
|
+
maxWorkers,
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
63
|
|
|
64
64
|
return mergedConfig
|
|
65
65
|
}
|
package/dist/bin/dev-lib.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { select, Separator } from '@inquirer/prompts';
|
|
3
2
|
import { _by } from '@naturalcycles/js-lib/array/array.util.js';
|
|
4
3
|
import { _assert } from '@naturalcycles/js-lib/error/assert.js';
|
|
5
4
|
import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
|
|
@@ -9,7 +8,6 @@ import { runCommitlint } from '../commitlint.js';
|
|
|
9
8
|
import { eslintAll, lintAllCommand, lintStagedCommand, requireOxlintConfig, runBiome, runOxlint, runPrettier, stylelintAll, } from '../lint.util.js';
|
|
10
9
|
import { runTest } from '../test.util.js';
|
|
11
10
|
const commands = [
|
|
12
|
-
new Separator(), // build
|
|
13
11
|
{ name: 'check', fn: check, desc: '"Run all possible checks": lint, typecheck, then test.' },
|
|
14
12
|
{ name: 'bt', fn: bt, desc: 'Build & Test: run "typecheck" (via oxlint) and then "test".' },
|
|
15
13
|
{
|
|
@@ -42,7 +40,6 @@ const commands = [
|
|
|
42
40
|
fn: cleanBuild,
|
|
43
41
|
desc: 'Cleans ./dist, then runs the build.',
|
|
44
42
|
},
|
|
45
|
-
new Separator(), // test
|
|
46
43
|
{ name: 'test', fn: runTest, desc: 'Run vitest for *.test.ts files.' },
|
|
47
44
|
{
|
|
48
45
|
name: 'test-integration',
|
|
@@ -59,7 +56,6 @@ const commands = [
|
|
|
59
56
|
fn: () => runTest({ leaks: true }),
|
|
60
57
|
desc: 'Run vitest --detectLeaks for *.test.ts files.',
|
|
61
58
|
},
|
|
62
|
-
new Separator(), // lint
|
|
63
59
|
{
|
|
64
60
|
name: 'lint',
|
|
65
61
|
fn: lintAllCommand,
|
|
@@ -107,7 +103,6 @@ const commands = [
|
|
|
107
103
|
},
|
|
108
104
|
{ name: 'stylelint-no-fix', cliOnly: true, fn: () => stylelintAll(false) },
|
|
109
105
|
{ name: 'commitlint', fn: runCommitlint, desc: 'Run commitlint.', cliOnly: true },
|
|
110
|
-
new Separator(), // interactive-only
|
|
111
106
|
{
|
|
112
107
|
name: 'exit',
|
|
113
108
|
fn: () => console.log('see you!'),
|
|
@@ -127,27 +122,31 @@ const commands = [
|
|
|
127
122
|
// })
|
|
128
123
|
// },
|
|
129
124
|
];
|
|
130
|
-
const commandMap = _by(commands
|
|
125
|
+
const commandMap = _by(commands, c => c.name);
|
|
131
126
|
const { CI } = process.env;
|
|
132
127
|
runScript(async () => {
|
|
133
128
|
let cmd = process.argv.find(s => commandMap[s] && !commandMap[s].interactiveOnly);
|
|
134
129
|
if (!cmd) {
|
|
135
130
|
// interactive mode
|
|
136
131
|
_assert(!CI, 'interactive dev-lib should not be run in CI');
|
|
137
|
-
|
|
132
|
+
const { default: prompts } = await import('prompts');
|
|
133
|
+
const response = await prompts({
|
|
134
|
+
type: 'select',
|
|
135
|
+
name: 'cmd',
|
|
138
136
|
message: 'Select command',
|
|
139
|
-
|
|
137
|
+
// @ts-expect-error types are wrong
|
|
138
|
+
optionsPerPage: 30,
|
|
140
139
|
choices: commands
|
|
141
|
-
.filter(c =>
|
|
142
|
-
.map(c => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
description: c.desc,
|
|
148
|
-
};
|
|
149
|
-
}),
|
|
140
|
+
.filter(c => !c.cliOnly)
|
|
141
|
+
.map(c => ({
|
|
142
|
+
title: c.name,
|
|
143
|
+
value: c.name,
|
|
144
|
+
description: c.desc,
|
|
145
|
+
})),
|
|
150
146
|
});
|
|
147
|
+
cmd = response.cmd;
|
|
148
|
+
if (!cmd)
|
|
149
|
+
return; // user cancelled
|
|
151
150
|
}
|
|
152
151
|
await commandMap[cmd].fn();
|
|
153
152
|
});
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/dev-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "20.
|
|
4
|
+
"version": "20.19.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@biomejs/biome": "^2",
|
|
7
7
|
"@eslint/js": "^9",
|
|
8
|
-
"
|
|
8
|
+
"prompts": "^2",
|
|
9
9
|
"@naturalcycles/js-lib": "^15",
|
|
10
10
|
"@naturalcycles/nodejs-lib": "^15",
|
|
11
11
|
"@vitest/coverage-v8": "^4",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/mitm": "^1",
|
|
45
|
-
"@types/node": "^25"
|
|
45
|
+
"@types/node": "^25",
|
|
46
|
+
"@types/prompts": "^2"
|
|
46
47
|
},
|
|
47
48
|
"exports": {
|
|
48
49
|
"./cfg/": "./cfg/",
|
|
49
50
|
"./cfg/biome.jsonc": "./cfg/biome.jsonc",
|
|
50
|
-
"./cfg/commitlint.config.js": "./cfg/commitlint.config.js",
|
|
51
51
|
"./cfg/eslint.config.js": "./cfg/eslint.config.js",
|
|
52
52
|
"./cfg/oxlint.config.json": "./cfg/oxlint.config.json",
|
|
53
53
|
"./cfg/prettier.config.js": "./cfg/prettier.config.js",
|
package/cfg/commitlint.config.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
extends: ['@commitlint/config-conventional'],
|
|
3
|
-
rules: {
|
|
4
|
-
// Overriding to allow 'start-case', 'upper-case', 'sentense-case', 'pascal-case'
|
|
5
|
-
// Example to allow now (which weren't allowed before):
|
|
6
|
-
// feat: POST /qa/smth
|
|
7
|
-
'subject-case': [0],
|
|
8
|
-
},
|
|
9
|
-
}
|