@brighterly/lib-fe-codestyle 0.1.0 → 0.1.2

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.
@@ -93,7 +93,8 @@ const scssColourTokens = {
93
93
  const paletteFiles = [palette, 'app/assets/scss/_vars.scss', 'app/assets/scss/_colors.scss'];
94
94
  if (paletteFiles.some(p => file === p))
95
95
  return [];
96
- if (/\/_(?:colors|vars|palette|tokens)\.scss$/.test(file))
96
+ // `[\w-]*` covers brand variants like _colors-smartestminds.scss (cs-app is multi-brand).
97
+ if (/\/_(?:colors|vars|palette|tokens)[\w-]*\.scss$/.test(file))
97
98
  return [];
98
99
  return eachLine(code, (line, n) => {
99
100
  // `rgba($token, .5)` is correct usage — only a NUMERIC first argument is a literal.
@@ -174,7 +175,8 @@ const typographySource = {
174
175
  check: ({ file, code, settings }) => {
175
176
  const source = setting({ settings }, 'typographySource', 'the app\'s shared typography mixins or text components');
176
177
  // The files that DEFINE the typography are the one place raw declarations belong.
177
- if (/\/_?(?:mixins|vars|fonts|typography|colors)\.scss$/.test(file))
178
+ // `[\w-]*` covers brand variants like _vars-smartestminds.scss (cs-app is multi-brand).
179
+ if (/\/_?(?:mixins|vars|fonts|typography|colors)[\w-]*\.scss$/.test(file))
178
180
  return [];
179
181
  // @font-face declares a face, not a usage — _R4 polices those blocks.
180
182
  const stripped = code.replace(/@font-face\s*\{[^}]*\}/g, m => m.replace(/[^\n]/g, ' '));
@@ -363,7 +363,11 @@ export const run = async (options) => {
363
363
  : spawnSync('npx', ['vitest', ...args], { cwd: root, encoding: 'utf8' });
364
364
  return { ok: r.status === 0, output: `${r.stdout || ''}${r.stderr || ''}`.trim() };
365
365
  };
366
- const vitestResult = opts.vitest ? runVitestInvariants() : null;
366
+ // A consumer with no specs yet (a freshly wired app) must not fail on
367
+ // `vitest --project <name>` finding nothing — the spec half only runs when
368
+ // the spec dir actually holds tests.
369
+ const hasSpecs = walk(root, specDir).some(f => f.endsWith('.test.ts'));
370
+ const vitestResult = opts.vitest && hasSpecs ? runVitestInvariants() : null;
367
371
  // ---------------------------------------------------------------------------
368
372
  // report
369
373
  // ---------------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brighterly/lib-fe-codestyle",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Shared invariant-validator engine, rule pack and ESLint config for Brighterly Nuxt frontend apps",