@techninja/clearstack 0.4.21 → 0.4.23
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/lib/spec-config.js +18 -8
- package/lib/watch-violations.js +1 -1
- package/package.json +1 -1
package/lib/spec-config.js
CHANGED
|
@@ -34,6 +34,14 @@ export function loadConfig(projectDir) {
|
|
|
34
34
|
const base = existsSync(envPath) ? parseEnv(readFileSync(envPath, 'utf-8')) : {};
|
|
35
35
|
const local = existsSync(localPath) ? parseEnv(readFileSync(localPath, 'utf-8')) : {};
|
|
36
36
|
const env = { ...base, ...local };
|
|
37
|
+
// List keys: merge base + local so .env.local additions don't drop .env defaults.
|
|
38
|
+
const mergeList = (key) => {
|
|
39
|
+
const b = base[key] ? base[key].split(',').map((s) => s.trim()) : [];
|
|
40
|
+
const l = local[key] ? local[key].split(',').map((s) => s.trim()) : [];
|
|
41
|
+
return [...new Set([...b, ...l])];
|
|
42
|
+
};
|
|
43
|
+
const ignoreDirs = env.SPEC_IGNORE_DIRS ? mergeList('SPEC_IGNORE_DIRS') : ['node_modules', 'src/vendor', '.git', '.configs'];
|
|
44
|
+
const watchDirs = env.SPEC_WATCH_DIRS ? mergeList('SPEC_WATCH_DIRS') : null;
|
|
37
45
|
return {
|
|
38
46
|
serverCmd: env.SPEC_SERVER_CMD || null,
|
|
39
47
|
rawEnv: env,
|
|
@@ -43,8 +51,8 @@ export function loadConfig(projectDir) {
|
|
|
43
51
|
codeExt: (env.SPEC_CODE_EXTENSIONS || '.js,.css').split(','),
|
|
44
52
|
docsExt: (env.SPEC_DOCS_EXTENSIONS || '.md').split(','),
|
|
45
53
|
testPattern: env.SPEC_TEST_PATTERN || '.test.js',
|
|
46
|
-
ignore:
|
|
47
|
-
watchDirs:
|
|
54
|
+
ignore: ignoreDirs,
|
|
55
|
+
watchDirs: watchDirs,
|
|
48
56
|
};
|
|
49
57
|
}
|
|
50
58
|
|
|
@@ -102,23 +110,25 @@ export function buildCmds(projectDir, opts) {
|
|
|
102
110
|
const audit = runner === 'pnpm exec'
|
|
103
111
|
? 'pnpm audit --prod --ignore-registry-errors'
|
|
104
112
|
: 'npm audit --omit=dev';
|
|
113
|
+
const prettier = (cmd) => `${runner} prettier --config .configs/.prettierrc --ignore-path .configs/.prettierignore --${cmd} src scripts`;
|
|
114
|
+
const stylelint = (extra = '') => `${runner} stylelint --config .configs/.stylelintrc.json "src/**/*.css" "!src/embed-dist/**"${extra}`;
|
|
105
115
|
if (opts?.watch) return {
|
|
106
116
|
lint: `${runner} eslint --config .configs/eslint.config.js .`,
|
|
107
|
-
stylelint:
|
|
108
|
-
prettier:
|
|
117
|
+
stylelint: stylelint(),
|
|
118
|
+
prettier: prettier('check'),
|
|
109
119
|
mdlint: `${runner} markdownlint-cli2 --config .configs/.markdownlint.jsonc "docs/**/*.md" "*.md"`,
|
|
110
120
|
audit,
|
|
111
121
|
fix: {
|
|
112
122
|
es: `${runner} eslint --config .configs/eslint.config.js . --fix`,
|
|
113
|
-
css:
|
|
114
|
-
prettier:
|
|
123
|
+
css: stylelint(' --fix'),
|
|
124
|
+
prettier: prettier('write'),
|
|
115
125
|
md: `${runner} markdownlint-cli2 --config .configs/.markdownlint.jsonc --fix "docs/**/*.md" "*.md"`,
|
|
116
126
|
},
|
|
117
127
|
};
|
|
118
128
|
return {
|
|
119
129
|
lint: `${runner} eslint --config .configs/eslint.config.js . --fix`,
|
|
120
|
-
stylelint:
|
|
121
|
-
prettier:
|
|
130
|
+
stylelint: stylelint(' --fix'),
|
|
131
|
+
prettier: prettier('write'),
|
|
122
132
|
mdlint: `${runner} markdownlint-cli2 --config .configs/.markdownlint.jsonc --fix "docs/**/*.md" "*.md"`,
|
|
123
133
|
audit,
|
|
124
134
|
};
|
package/lib/watch-violations.js
CHANGED
|
@@ -59,7 +59,7 @@ export function extractViolations(row, projectDir) {
|
|
|
59
59
|
const errors = row.result.errors;
|
|
60
60
|
// Prettier: [warn] src/file.js — expand each into its own entry
|
|
61
61
|
const prettierFiles = errors.map((l) => l.match(/^\[warn\]\s+(.+\.\w+)$/)?.[1]).filter(Boolean);
|
|
62
|
-
if (prettierFiles.length) return prettierFiles.map((f) => [f, 'formatting — run
|
|
62
|
+
if (prettierFiles.length) return prettierFiles.map((f) => [f, 'formatting — run `f` to fix']);
|
|
63
63
|
return [[row.label ?? row.name ?? row.key, errors.slice(0, 5).join('\n')]];
|
|
64
64
|
}
|
|
65
65
|
return [];
|
package/package.json
CHANGED