declapract-typescript-ehmpathy 0.49.0 → 0.49.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.
- package/dist/practices/cicd-service/best-practice/.github/workflows/.deploy-sls.yml +5 -0
- package/dist/practices/environments/best-practice/package.json +1 -1
- package/dist/practices/logs/bad-practices/simple-log-methods/src/<star><star>/<star>.ts.declapract.ts +36 -5
- package/dist/practices/logs/best-practice/package.json +1 -0
- package/dist/practices/logs/best-practice/src/utils/logger.ts +4 -1
- package/package.json +1 -1
|
@@ -90,6 +90,11 @@ jobs:
|
|
|
90
90
|
key: ${{ needs.install.outputs.node-modules-cache-key }}
|
|
91
91
|
fail-on-cache-miss: true
|
|
92
92
|
|
|
93
|
+
# .why = keyrack.yml can extend other manifests via symlinks (e.g., .agent/repo=ehmpathy/role=mechanic/keyrack.yml)
|
|
94
|
+
# prepare:rhachet creates these symlinks so keyrack.source() can hydrate extended keys
|
|
95
|
+
- name: prepare:rhachet
|
|
96
|
+
run: npm run prepare:rhachet --if-present
|
|
97
|
+
|
|
93
98
|
- name: vpc:tunnel:open
|
|
94
99
|
if: inputs.needs-vpn-for-acceptance
|
|
95
100
|
run: ACCESS=${{ inputs.stage }} .agent/repo=.this/skills/use.vpc.tunnel.ts
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"@aws-sdk/client-account": "@declapract{check.minVersion('3.1042.0')}",
|
|
4
4
|
"@aws-sdk/client-iam": "@declapract{check.minVersion('3.1042.0')}",
|
|
5
|
-
"sdk-environment": "@declapract{check.minVersion('0.1.
|
|
5
|
+
"sdk-environment": "@declapract{check.minVersion('0.1.5')}"
|
|
6
6
|
}
|
|
7
7
|
}
|
|
@@ -1,15 +1,46 @@
|
|
|
1
1
|
import type { FileCheckFunction, FileFixFunction } from 'declapract';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* .what = migrates simple-log-methods to sdk-logs with commit flow
|
|
5
|
+
* .why = sdk-logs with commit flow enables traceability in production logs
|
|
6
|
+
*
|
|
7
|
+
* .note = declapract semantics:
|
|
8
|
+
* - check returns = bad practice detected (file will be flagged)
|
|
9
|
+
* - check throws = bad practice not detected (file will be skipped)
|
|
10
|
+
* - fix returns {} = no changes needed
|
|
11
|
+
*/
|
|
12
|
+
|
|
3
13
|
export const check: FileCheckFunction = (contents) => {
|
|
14
|
+
// detect files that import from simple-log-methods
|
|
4
15
|
if (contents?.includes("from 'simple-log-methods'")) return;
|
|
5
16
|
throw new Error('does not match bad practice');
|
|
6
17
|
};
|
|
7
18
|
|
|
8
19
|
export const fix: FileFixFunction = (contents) => {
|
|
20
|
+
// no contents means no file to fix
|
|
9
21
|
if (!contents) return {};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
22
|
+
|
|
23
|
+
// step 1: replace package import and method name
|
|
24
|
+
const withSdkLogs = contents
|
|
25
|
+
.replace(/from 'simple-log-methods'/g, "from 'sdk-logs'")
|
|
26
|
+
.replace(/generateLogMethods/g, 'genLogMethods');
|
|
27
|
+
|
|
28
|
+
// step 2: add sdk-environment import if not already present (idempotent)
|
|
29
|
+
const needsEnvImport = !withSdkLogs.includes("from 'sdk-environment'");
|
|
30
|
+
const withEnvImport = needsEnvImport
|
|
31
|
+
? withSdkLogs.replace(
|
|
32
|
+
/import { genLogMethods } from 'sdk-logs';/g,
|
|
33
|
+
"import { getEnvironment } from 'sdk-environment';\nimport { genLogMethods } from 'sdk-logs';",
|
|
34
|
+
)
|
|
35
|
+
: withSdkLogs;
|
|
36
|
+
|
|
37
|
+
// step 3: flow commit through env (only for no-arg calls)
|
|
38
|
+
const withCommitFlow = withEnvImport.replace(
|
|
39
|
+
/genLogMethods\(\)/g,
|
|
40
|
+
`genLogMethods({
|
|
41
|
+
env: { commit: getEnvironment.static().commit },
|
|
42
|
+
})`,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return { contents: withCommitFlow };
|
|
15
46
|
};
|
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.49.
|
|
5
|
+
"version": "0.49.2",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "src/index.js",
|
|
8
8
|
"repository": "ehmpathy/declapract-typescript-ehmpathy",
|