@maniumek/suwgate 0.1.0 → 0.1.1

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.
@@ -23,7 +23,7 @@ export const REQUIRED_BY_PROFILE = {
23
23
  "pnpm-workspace.yaml": "pnpm's settings, such as the minimum age of a new release",
24
24
  "tsconfig.json": "the strict TypeScript options the typecheck step uses",
25
25
  "eslint.config.js": "the lint rules, including no comments and the feature boundaries",
26
- ".prettierrc.json": "the formatting the format step checks",
26
+ ".prettierrc.json": "the formatting the format step checks (prettier.config.js instead, when a plugin needs the preset spread)",
27
27
  "knip.config.ts": "knip's config, one line that extends @maniumek/suwgate/knip, so dead code is found",
28
28
  },
29
29
  library: {
@@ -44,6 +44,14 @@ export const REQUIRED_BY_PROFILE = {
44
44
  "compose.yaml": "the local PostgreSQL the server and its tests run against",
45
45
  },
46
46
  };
47
+ const ALTERNATIVES = {
48
+ ".prettierrc.json": ["prettier.config.js"],
49
+ };
50
+ function isPresent(file, present) {
51
+ const directory = file.slice(0, file.lastIndexOf("/") + 1);
52
+ const name = file.slice(directory.length);
53
+ return [name, ...(ALTERNATIVES[name] ?? [])].some((candidate) => present.has(directory + candidate));
54
+ }
47
55
  function required(context, settings) {
48
56
  const files = new Map();
49
57
  for (const [file, purpose] of Object.entries(EVERY_REPOSITORY))
@@ -69,7 +77,7 @@ export const requiredFiles = {
69
77
  check(context) {
70
78
  const present = new Set(context.files);
71
79
  return [...required(context, (context.settings ?? {}))]
72
- .filter(([file]) => !present.has(file))
80
+ .filter(([file]) => !isPresent(file, present))
73
81
  .map(([file, purpose]) => ({
74
82
  target: file,
75
83
  message: `missing: ${purpose}, or add an exception with the reason it does not apply`,
@@ -2,7 +2,7 @@ import { changedIn, filesIn, has, read, withChanged } from "./shell.js";
2
2
  const CODE = /\.(ts|tsx|js|jsx|mjs|cjs|mts|cts)$/;
3
3
  const TSCONFIG = /^tsconfig(\..+)?\.json$/;
4
4
  const VITEST_CONFIG = /^vitest\.config\.(ts|mts|js|mjs)$/;
5
- const UNIT_PROJECT = /\bname:\s*["'`]unit["'`]/;
5
+ const UNIT_PROJECT = /\bname:\s*["'`]unit["'`]|\bunitTests\(/;
6
6
  export const PNPM_INSTALL = "pnpm-install";
7
7
  function install(context) {
8
8
  return has(context, "node_modules") ? null : "pnpm install --frozen-lockfile --silent";
@@ -8,7 +8,9 @@ const NODE_GATE = [
8
8
  "**/vitest.config.ts",
9
9
  "**/playwright.config.ts",
10
10
  "**/knip.json",
11
+ "**/knip.config.{ts,js}",
11
12
  "**/.prettierrc.json",
13
+ "**/prettier.config.{js,mjs,ts}",
12
14
  ];
13
15
  const LISTS = {
14
16
  every: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maniumek/suwgate",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "One quality gate for every repository: suwgate check runs the steps of the repository's profiles and its guards, configured in suwgate.yml",
5
5
  "license": "MIT",
6
6
  "author": "Manomenu",