declapract-typescript-ehmpathy 0.47.70 → 0.47.72

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.
@@ -17,7 +17,7 @@ export const check: FileCheckFunction = (contents) => {
17
17
  export const fix: FileFixFunction = (contents) => {
18
18
  if (!contents) return { contents };
19
19
 
20
- let fixed = contents
20
+ const fixed = contents
21
21
  // replace enum values with string literals
22
22
  .replace(/Stage\.PRODUCTION/g, "'prod'")
23
23
  .replace(/Stage\.DEVELOPMENT/g, "'prep'")
@@ -0,0 +1,6 @@
1
+ # dpdm exclude patterns
2
+ # each entry is joined with | to form a single regex for --exclude
3
+ #
4
+ # only exclude devDependencies here
5
+ # if you exclude a prod dependency, you ship cycles to consumers and break their builds
6
+ exclude: []
@@ -10,7 +10,7 @@
10
10
  "test:format:biome": "biome format",
11
11
  "test:lint:biome": "biome check --diagnostic-level=error",
12
12
  "test:lint:biome:all": "biome check",
13
- "test:lint:cycles": "dpdm --no-warning --no-tree --exit-code circular:1 --exclude '^$' 'src/**/*.ts'",
13
+ "test:lint:cycles": "dpdm --no-warning --no-tree --exit-code circular:1 --exclude \"$(yq -r '.exclude | if length > 0 then join(\"|\") else \"^$\" end' .dpdmrc.yaml)\" 'src/**/*.ts'",
14
14
  "test:lint:deps": "npx depcheck -c ./.depcheckrc.yml",
15
15
  "test:lint": "npm run test:lint:biome && npm run test:lint:cycles && npm run test:lint:deps"
16
16
  }
@@ -0,0 +1,41 @@
1
+ import type { FileCheckFunction, FileFixFunction } from 'declapract';
2
+ import yaml from 'yaml';
3
+
4
+ /**
5
+ * .what = removes deprecated reviewers.users variable from declapract.use.yml
6
+ * .why = production-on-else environment now uses team:releaser instead of user list
7
+ */
8
+
9
+ export const check: FileCheckFunction = (contents) => {
10
+ if (!contents) throw new Error('no file found');
11
+
12
+ const parsed = yaml.parse(contents) as {
13
+ variables?: Record<string, unknown>;
14
+ };
15
+ const variables = parsed?.variables ?? {};
16
+
17
+ // check if reviewers or reviewers.users exists
18
+ if ('reviewers' in variables) return; // bad practice detected
19
+
20
+ throw new Error('no deprecated reviewers variable found');
21
+ };
22
+
23
+ export const fix: FileFixFunction = (contents) => {
24
+ if (!contents) return { contents };
25
+
26
+ // parse with parseDocument to preserve comments and format
27
+ const doc = yaml.parseDocument(contents);
28
+ const parsed = doc.toJSON() as { variables?: Record<string, unknown> };
29
+
30
+ if (!parsed?.variables || !('reviewers' in parsed.variables)) {
31
+ return { contents };
32
+ }
33
+
34
+ // remove the reviewers key from variables
35
+ const variablesNode = doc.get('variables') as yaml.YAMLMap | undefined;
36
+ if (variablesNode) {
37
+ variablesNode.delete('reviewers');
38
+ }
39
+
40
+ return { contents: doc.toString() };
41
+ };
@@ -134,7 +134,7 @@ export const getResources = async (): Promise<DomainEntity<any>[]> => {
134
134
  const envProductionOnElse = DeclaredGithubEnvironment.as({
135
135
  repo,
136
136
  name: 'production-on-else',
137
- reviewers: { users: @declapract{variable.reviewers.users}, teams: null },
137
+ reviewers: { users: null, teams: ['releasers'] },
138
138
  waitTimer: null, // no delay once approved
139
139
  deploymentBranchPolicy: null, // any branch
140
140
  preventSelfReview: false, // self-approval allowed if in reviewers list
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "declapract-typescript-ehmpathy",
3
3
  "author": "ehmpathy",
4
4
  "description": "declapract best practices declarations for typescript",
5
- "version": "0.47.70",
5
+ "version": "0.47.72",
6
6
  "license": "MIT",
7
7
  "main": "src/index.js",
8
8
  "repository": "ehmpathy/declapract-typescript-ehmpathy",