@techninja/clearstack 0.4.22 → 0.4.24
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 +20 -4
- 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,8 +110,16 @@ 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';
|
|
105
|
-
const
|
|
106
|
-
const
|
|
113
|
+
const cfg = loadConfig(projectDir);
|
|
114
|
+
const extraIgnoreGlobs = cfg.rawEnv.SPEC_PRETTIER_IGNORE
|
|
115
|
+
? cfg.rawEnv.SPEC_PRETTIER_IGNORE.split(',').map((p) => `"!${p.trim()}"`).join(' ')
|
|
116
|
+
: '';
|
|
117
|
+
const prettier = (cmd) => `${runner} prettier --config .configs/.prettierrc --ignore-path .configs/.prettierignore --${cmd} "src/**/*.{js,css}" "!src/vendor/**" "!src/icons.json"${extraIgnoreGlobs ? ' ' + extraIgnoreGlobs : ''} scripts`;
|
|
118
|
+
const stylelintIgnore = cfg.ignore
|
|
119
|
+
.filter((d) => d.startsWith('src/'))
|
|
120
|
+
.map((d) => ` "!${d.endsWith('/**') ? d : d + '/**'}"`)
|
|
121
|
+
.join('');
|
|
122
|
+
const stylelint = (extra = '') => `${runner} stylelint --config .configs/.stylelintrc.json "src/**/*.css"${stylelintIgnore}${extra}`;
|
|
107
123
|
if (opts?.watch) return {
|
|
108
124
|
lint: `${runner} eslint --config .configs/eslint.config.js .`,
|
|
109
125
|
stylelint: stylelint(),
|
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