declapract-typescript-ehmpathy 0.43.4 → 0.43.6
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-app-react-native-expo/best-practice/.github/workflows/.deploy-expo.yml +9 -9
- package/dist/practices/cicd-common/best-practice/.github/workflows/.declastruct.yml +4 -4
- package/dist/practices/cicd-common/best-practice/.github/workflows/.install.yml +2 -2
- package/dist/practices/cicd-common/best-practice/.github/workflows/.test.yml +14 -14
- package/dist/practices/cicd-package/best-practice/.github/workflows/.publish-npm.yml +4 -8
- package/dist/practices/cicd-service/best-practice/.github/workflows/.deploy-sls.yml +6 -6
- package/dist/practices/cicd-service/best-practice/.github/workflows/.sql-schema-control.yml +4 -4
- package/dist/practices/cicd-service/best-practice/.github/workflows/.terraform.yml +2 -2
- package/dist/practices/conventional-commits/bad-practices/commitlint/package.json +5 -0
- package/dist/practices/conventional-commits/bad-practices/commitlint/package.json.declapract.ts +19 -0
- package/dist/practices/conventional-commits/best-practice/.husky/check.commit.sh +7 -1
- package/dist/practices/conventional-commits/best-practice/package.json +2 -2
- package/dist/practices/husky/best-practice/.husky/check.yalc.sh +4 -2
- package/dist/practices/lint/best-practice/package.json +2 -2
- package/dist/practices/package-json-order/best-practice/package.json.declapract.ts +1 -1
- package/dist/practices/tests/best-practice/jest.integration.env.ts +39 -3
- package/package.json +1 -1
package/dist/practices/cicd-app-react-native-expo/best-practice/.github/workflows/.deploy-expo.yml
CHANGED
|
@@ -5,15 +5,15 @@ on:
|
|
|
5
5
|
inputs:
|
|
6
6
|
stage:
|
|
7
7
|
type: string
|
|
8
|
-
description:
|
|
8
|
+
description: "the stage of infrastructure to deploy against (e.g., prod, dev)"
|
|
9
9
|
required: true
|
|
10
10
|
build:
|
|
11
11
|
type: string
|
|
12
|
-
description:
|
|
12
|
+
description: "the build to deploy (e.g., production, preview, development)"
|
|
13
13
|
required: true
|
|
14
14
|
github-environment:
|
|
15
15
|
type: string
|
|
16
|
-
description:
|
|
16
|
+
description: "the github environment that the apply step will be executed in"
|
|
17
17
|
required: true
|
|
18
18
|
aws-region:
|
|
19
19
|
type: string
|
|
@@ -59,12 +59,12 @@ jobs:
|
|
|
59
59
|
runs-on: ubuntu-latest
|
|
60
60
|
steps:
|
|
61
61
|
- name: checkout
|
|
62
|
-
uses: actions/checkout@
|
|
62
|
+
uses: actions/checkout@v4
|
|
63
63
|
|
|
64
64
|
- name: set node-version
|
|
65
|
-
uses: actions/setup-node@
|
|
65
|
+
uses: actions/setup-node@v4
|
|
66
66
|
with:
|
|
67
|
-
node-version-file:
|
|
67
|
+
node-version-file: ".nvmrc"
|
|
68
68
|
|
|
69
69
|
- name: configure aws credentials
|
|
70
70
|
uses: aws-actions/configure-aws-credentials@v1
|
|
@@ -109,12 +109,12 @@ jobs:
|
|
|
109
109
|
if: ${{ inputs.stage == 'prod' && inputs.app-web-deployment-s3-bucket }}
|
|
110
110
|
steps:
|
|
111
111
|
- name: checkout
|
|
112
|
-
uses: actions/checkout@
|
|
112
|
+
uses: actions/checkout@v4
|
|
113
113
|
|
|
114
114
|
- name: set node-version
|
|
115
|
-
uses: actions/setup-node@
|
|
115
|
+
uses: actions/setup-node@v4
|
|
116
116
|
with:
|
|
117
|
-
node-version-file:
|
|
117
|
+
node-version-file: ".nvmrc"
|
|
118
118
|
|
|
119
119
|
- name: configure aws credentials
|
|
120
120
|
uses: aws-actions/configure-aws-credentials@v1
|
|
@@ -30,10 +30,10 @@ jobs:
|
|
|
30
30
|
has-changes-planned: ${{ steps.evaluate-plan.outputs.has-changes-planned }}
|
|
31
31
|
steps:
|
|
32
32
|
- name: checkout
|
|
33
|
-
uses: actions/checkout@
|
|
33
|
+
uses: actions/checkout@v4
|
|
34
34
|
|
|
35
35
|
- name: set node-version
|
|
36
|
-
uses: actions/setup-node@
|
|
36
|
+
uses: actions/setup-node@v4
|
|
37
37
|
with:
|
|
38
38
|
node-version-file: ".nvmrc"
|
|
39
39
|
|
|
@@ -80,10 +80,10 @@ jobs:
|
|
|
80
80
|
if: ${{ inputs.allow-apply == true && needs.plan.outputs.has-changes-planned == 'true' }}
|
|
81
81
|
steps:
|
|
82
82
|
- name: checkout
|
|
83
|
-
uses: actions/checkout@
|
|
83
|
+
uses: actions/checkout@v4
|
|
84
84
|
|
|
85
85
|
- name: set node-version
|
|
86
|
-
uses: actions/setup-node@
|
|
86
|
+
uses: actions/setup-node@v4
|
|
87
87
|
with:
|
|
88
88
|
node-version-file: ".nvmrc"
|
|
89
89
|
|
|
@@ -14,7 +14,7 @@ jobs:
|
|
|
14
14
|
node-modules-cache-key: ${{ steps.cache.outputs.cache-primary-key }}
|
|
15
15
|
steps:
|
|
16
16
|
- name: checkout
|
|
17
|
-
uses: actions/checkout@
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
18
|
|
|
19
19
|
- name: node-modules deps hash
|
|
20
20
|
id: deps-hash
|
|
@@ -33,7 +33,7 @@ jobs:
|
|
|
33
33
|
|
|
34
34
|
- name: node-modules cache miss setup node
|
|
35
35
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
36
|
-
uses: actions/setup-node@
|
|
36
|
+
uses: actions/setup-node@v4
|
|
37
37
|
with:
|
|
38
38
|
node-version-file: ".nvmrc"
|
|
39
39
|
|
|
@@ -29,12 +29,12 @@ jobs:
|
|
|
29
29
|
needs: [install]
|
|
30
30
|
steps:
|
|
31
31
|
- name: checkout
|
|
32
|
-
uses: actions/checkout@
|
|
32
|
+
uses: actions/checkout@v4
|
|
33
33
|
with:
|
|
34
34
|
fetch-depth: 0 # we need all commits to test:commits
|
|
35
35
|
|
|
36
36
|
- name: set node-version
|
|
37
|
-
uses: actions/setup-node@
|
|
37
|
+
uses: actions/setup-node@v4
|
|
38
38
|
with:
|
|
39
39
|
node-version-file: ".nvmrc"
|
|
40
40
|
|
|
@@ -52,10 +52,10 @@ jobs:
|
|
|
52
52
|
needs: [install]
|
|
53
53
|
steps:
|
|
54
54
|
- name: checkout
|
|
55
|
-
uses: actions/checkout@
|
|
55
|
+
uses: actions/checkout@v4
|
|
56
56
|
|
|
57
57
|
- name: set node-version
|
|
58
|
-
uses: actions/setup-node@
|
|
58
|
+
uses: actions/setup-node@v4
|
|
59
59
|
with:
|
|
60
60
|
node-version-file: ".nvmrc"
|
|
61
61
|
|
|
@@ -73,10 +73,10 @@ jobs:
|
|
|
73
73
|
needs: [install]
|
|
74
74
|
steps:
|
|
75
75
|
- name: checkout
|
|
76
|
-
uses: actions/checkout@
|
|
76
|
+
uses: actions/checkout@v4
|
|
77
77
|
|
|
78
78
|
- name: set node version
|
|
79
|
-
uses: actions/setup-node@
|
|
79
|
+
uses: actions/setup-node@v4
|
|
80
80
|
with:
|
|
81
81
|
node-version-file: ".nvmrc"
|
|
82
82
|
|
|
@@ -97,10 +97,10 @@ jobs:
|
|
|
97
97
|
needs: [install]
|
|
98
98
|
steps:
|
|
99
99
|
- name: checkout
|
|
100
|
-
uses: actions/checkout@
|
|
100
|
+
uses: actions/checkout@v4
|
|
101
101
|
|
|
102
102
|
- name: set node-version
|
|
103
|
-
uses: actions/setup-node@
|
|
103
|
+
uses: actions/setup-node@v4
|
|
104
104
|
with:
|
|
105
105
|
node-version-file: ".nvmrc"
|
|
106
106
|
|
|
@@ -118,10 +118,10 @@ jobs:
|
|
|
118
118
|
needs: [install]
|
|
119
119
|
steps:
|
|
120
120
|
- name: checkout
|
|
121
|
-
uses: actions/checkout@
|
|
121
|
+
uses: actions/checkout@v4
|
|
122
122
|
|
|
123
123
|
- name: set node-version
|
|
124
|
-
uses: actions/setup-node@
|
|
124
|
+
uses: actions/setup-node@v4
|
|
125
125
|
with:
|
|
126
126
|
node-version-file: ".nvmrc"
|
|
127
127
|
|
|
@@ -139,10 +139,10 @@ jobs:
|
|
|
139
139
|
needs: [install]
|
|
140
140
|
steps:
|
|
141
141
|
- name: checkout
|
|
142
|
-
uses: actions/checkout@
|
|
142
|
+
uses: actions/checkout@v4
|
|
143
143
|
|
|
144
144
|
- name: set node-version
|
|
145
|
-
uses: actions/setup-node@
|
|
145
|
+
uses: actions/setup-node@v4
|
|
146
146
|
with:
|
|
147
147
|
node-version-file: ".nvmrc"
|
|
148
148
|
|
|
@@ -182,10 +182,10 @@ jobs:
|
|
|
182
182
|
needs: [install]
|
|
183
183
|
steps:
|
|
184
184
|
- name: checkout
|
|
185
|
-
uses: actions/checkout@
|
|
185
|
+
uses: actions/checkout@v4
|
|
186
186
|
|
|
187
187
|
- name: set node-version
|
|
188
|
-
uses: actions/setup-node@
|
|
188
|
+
uses: actions/setup-node@v4
|
|
189
189
|
with:
|
|
190
190
|
node-version-file: ".nvmrc"
|
|
191
191
|
|
|
@@ -16,13 +16,13 @@ jobs:
|
|
|
16
16
|
needs: [install]
|
|
17
17
|
steps:
|
|
18
18
|
- name: checkout
|
|
19
|
-
uses: actions/checkout@
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
20
|
|
|
21
21
|
- name: set node-version
|
|
22
|
-
uses: actions/setup-node@
|
|
22
|
+
uses: actions/setup-node@v4
|
|
23
23
|
with:
|
|
24
|
-
registry-url:
|
|
25
|
-
node-version-file:
|
|
24
|
+
registry-url: "https://registry.npmjs.org/" # required to publish
|
|
25
|
+
node-version-file: ".nvmrc"
|
|
26
26
|
|
|
27
27
|
- name: node-modules cache get
|
|
28
28
|
uses: actions/cache/restore@v4
|
|
@@ -31,10 +31,6 @@ jobs:
|
|
|
31
31
|
path: ./node_modules
|
|
32
32
|
key: ${{ needs.install.outputs.node-modules-cache-key }}
|
|
33
33
|
|
|
34
|
-
- name: node-modules cache miss install
|
|
35
|
-
if: steps.cache.outputs.cache-hit != 'true'
|
|
36
|
-
run: npm ci --ignore-scripts --prefer-offline --no-audit
|
|
37
|
-
|
|
38
34
|
- name: build
|
|
39
35
|
run: npm run build
|
|
40
36
|
|
|
@@ -44,10 +44,10 @@ jobs:
|
|
|
44
44
|
needs: [install]
|
|
45
45
|
steps:
|
|
46
46
|
- name: checkout
|
|
47
|
-
uses: actions/checkout@
|
|
47
|
+
uses: actions/checkout@v4
|
|
48
48
|
|
|
49
49
|
- name: set node-version
|
|
50
|
-
uses: actions/setup-node@
|
|
50
|
+
uses: actions/setup-node@v4
|
|
51
51
|
with:
|
|
52
52
|
node-version-file: ".nvmrc"
|
|
53
53
|
|
|
@@ -80,10 +80,10 @@ jobs:
|
|
|
80
80
|
needs: [install, deploy]
|
|
81
81
|
steps:
|
|
82
82
|
- name: checkout
|
|
83
|
-
uses: actions/checkout@
|
|
83
|
+
uses: actions/checkout@v4
|
|
84
84
|
|
|
85
85
|
- name: set node-version
|
|
86
|
-
uses: actions/setup-node@
|
|
86
|
+
uses: actions/setup-node@v4
|
|
87
87
|
with:
|
|
88
88
|
node-version-file: ".nvmrc"
|
|
89
89
|
|
|
@@ -129,10 +129,10 @@ jobs:
|
|
|
129
129
|
needs: [install, deploy]
|
|
130
130
|
steps:
|
|
131
131
|
- name: checkout
|
|
132
|
-
uses: actions/checkout@
|
|
132
|
+
uses: actions/checkout@v4
|
|
133
133
|
|
|
134
134
|
- name: set node-version
|
|
135
|
-
uses: actions/setup-node@
|
|
135
|
+
uses: actions/setup-node@v4
|
|
136
136
|
with:
|
|
137
137
|
node-version-file: ".nvmrc"
|
|
138
138
|
|
|
@@ -39,10 +39,10 @@ jobs:
|
|
|
39
39
|
has-changes-planned: ${{ steps.evaluate-plan.outputs.has-changes-planned }}
|
|
40
40
|
steps:
|
|
41
41
|
- name: checkout
|
|
42
|
-
uses: actions/checkout@
|
|
42
|
+
uses: actions/checkout@v4
|
|
43
43
|
|
|
44
44
|
- name: set node-version
|
|
45
|
-
uses: actions/setup-node@
|
|
45
|
+
uses: actions/setup-node@v4
|
|
46
46
|
with:
|
|
47
47
|
node-version-file: ".nvmrc"
|
|
48
48
|
|
|
@@ -101,10 +101,10 @@ jobs:
|
|
|
101
101
|
if: ${{ inputs.allow-apply == true && needs.plan.outputs.has-changes-planned == 'true' }}
|
|
102
102
|
steps:
|
|
103
103
|
- name: checkout
|
|
104
|
-
uses: actions/checkout@
|
|
104
|
+
uses: actions/checkout@v4
|
|
105
105
|
|
|
106
106
|
- name: set node-version
|
|
107
|
-
uses: actions/setup-node@
|
|
107
|
+
uses: actions/setup-node@v4
|
|
108
108
|
with:
|
|
109
109
|
node-version-file: ".nvmrc"
|
|
110
110
|
|
|
@@ -40,7 +40,7 @@ jobs:
|
|
|
40
40
|
has-changes-planned: ${{ steps.evaluate-plan.outputs.has-changes-planned }}
|
|
41
41
|
steps:
|
|
42
42
|
- name: checkout
|
|
43
|
-
uses: actions/checkout@
|
|
43
|
+
uses: actions/checkout@v4
|
|
44
44
|
|
|
45
45
|
- name: configure aws credentials
|
|
46
46
|
uses: aws-actions/configure-aws-credentials@v1
|
|
@@ -94,7 +94,7 @@ jobs:
|
|
|
94
94
|
working-directory: ${{ inputs.working-directory }}
|
|
95
95
|
steps:
|
|
96
96
|
- name: checkout
|
|
97
|
-
uses: actions/checkout@
|
|
97
|
+
uses: actions/checkout@v4
|
|
98
98
|
|
|
99
99
|
- name: configure aws credentials
|
|
100
100
|
uses: aws-actions/configure-aws-credentials@v1
|
package/dist/practices/conventional-commits/bad-practices/commitlint/package.json.declapract.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
+
import { FileCheckType, type FileFixFunction } from 'declapract';
|
|
3
|
+
|
|
4
|
+
export const check = FileCheckType.CONTAINS;
|
|
5
|
+
|
|
6
|
+
export const fix: FileFixFunction = (contents) => {
|
|
7
|
+
if (!contents) return { contents }; // do nothing if no contents
|
|
8
|
+
const packageJSON = JSON.parse(contents);
|
|
9
|
+
const updatedPackageJSON = {
|
|
10
|
+
...packageJSON,
|
|
11
|
+
devDependencies: {
|
|
12
|
+
...packageJSON.devDependencies,
|
|
13
|
+
commitlint: undefined,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
contents: JSON.stringify(updatedPackageJSON, null, 2),
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"test:commits": "LAST_TAG=$(git describe --tags --abbrev=0 @^ 2> /dev/null || git rev-list --max-parents=0 HEAD) && npx commitlint --from $LAST_TAG --to HEAD --verbose"
|
|
5
5
|
},
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"@commitlint/cli": "@declapract{check.minVersion('19.
|
|
8
|
-
"@commitlint/config-conventional": "@declapract{check.minVersion('
|
|
7
|
+
"@commitlint/cli": "@declapract{check.minVersion('19.5.0')}",
|
|
8
|
+
"@commitlint/config-conventional": "@declapract{check.minVersion('19.5.0')}",
|
|
9
9
|
"cz-conventional-changelog": "@declapract{check.minVersion('3.3.0')}",
|
|
10
10
|
"husky": "@declapract{check.minVersion('7.0.2')}"
|
|
11
11
|
},
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
3
|
# https://github.com/wclr/yalc
|
|
4
|
-
if
|
|
5
|
-
|
|
4
|
+
if command -v npx &> /dev/null; then
|
|
5
|
+
if [ "$(npx yalc check 2>/dev/null)" ]; then
|
|
6
|
+
echo "✋ package.json has yalc references. Run 'npx yalc remove --all' to remove these local testing references."
|
|
7
|
+
fi
|
|
6
8
|
fi
|
|
7
9
|
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
"fix:format:biome": "biome check --write src",
|
|
8
8
|
"fix:lint": "biome check --write src",
|
|
9
9
|
"test:format:biome": "biome format src",
|
|
10
|
-
"test:lint:biome": "biome check src",
|
|
11
|
-
"test:lint:
|
|
10
|
+
"test:lint:biome": "biome check src --diagnostic-level=error",
|
|
11
|
+
"test:lint:biome:all": "biome check src",
|
|
12
12
|
"test:lint:deps": "npx depcheck -c ./.depcheckrc.yml",
|
|
13
13
|
"test:lint": "npm run test:lint:biome && npm run test:lint:deps"
|
|
14
14
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
1
2
|
import { existsSync, readFileSync } from 'fs';
|
|
2
3
|
import { join } from 'path';
|
|
3
4
|
import util from 'util';
|
|
@@ -36,9 +37,10 @@ if (
|
|
|
36
37
|
* - prevent time wasted debugging tests which are failing due to hard-to-read missed credential errors
|
|
37
38
|
*/
|
|
38
39
|
const declapractUsePath = join(process.cwd(), 'declapract.use.yml');
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const declapractUseContent = existsSync(declapractUsePath)
|
|
41
|
+
? readFileSync(declapractUsePath, 'utf8')
|
|
42
|
+
: '';
|
|
43
|
+
const requiresAwsAuth = declapractUseContent.includes('awsAccountId');
|
|
42
44
|
if (
|
|
43
45
|
requiresAwsAuth &&
|
|
44
46
|
!(process.env.AWS_PROFILE || process.env.AWS_ACCESS_KEY_ID)
|
|
@@ -46,3 +48,37 @@ if (
|
|
|
46
48
|
throw new Error(
|
|
47
49
|
'no aws credentials present. please authenticate with aws to run integration tests',
|
|
48
50
|
);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* .what = verify that the testdb has been provisioned if a databaseUserName is declared
|
|
54
|
+
* .why =
|
|
55
|
+
* - prevent time wasted waiting on tests to fail due to missing testdb
|
|
56
|
+
* - prevent confusing "password authentication failed" errors when testdb isn't running or was provisioned for a different repo
|
|
57
|
+
*/
|
|
58
|
+
const requiresTestDb = declapractUseContent.includes('databaseUserName');
|
|
59
|
+
if (requiresTestDb) {
|
|
60
|
+
const testConfigPath = join(process.cwd(), 'config', 'test.json');
|
|
61
|
+
if (!existsSync(testConfigPath))
|
|
62
|
+
throw new Error(
|
|
63
|
+
'config/test.json not found but serviceUser is declared in declapract.use.yml',
|
|
64
|
+
);
|
|
65
|
+
const testConfig = JSON.parse(readFileSync(testConfigPath, 'utf8'));
|
|
66
|
+
if (
|
|
67
|
+
!testConfig.database?.tunnel?.local ||
|
|
68
|
+
!testConfig.database?.role?.crud ||
|
|
69
|
+
!testConfig.database?.target?.database
|
|
70
|
+
)
|
|
71
|
+
throw new Error(
|
|
72
|
+
'config/test.json database.tunnel.local, database?.role?.crud, or database?.target?.database not found but expected',
|
|
73
|
+
);
|
|
74
|
+
try {
|
|
75
|
+
execSync(
|
|
76
|
+
`PGPASSWORD="${testConfig.database.role.crud.password}" psql -h ${testConfig.database.tunnel.local.host} -p ${testConfig.database.tunnel.local.port} -U ${testConfig.database.role.crud.username} -d ${testConfig.database.target.database} -c "SELECT 1" > /dev/null 2>&1`,
|
|
77
|
+
{ timeout: 3000 },
|
|
78
|
+
);
|
|
79
|
+
} catch {
|
|
80
|
+
throw new Error(
|
|
81
|
+
`did you forget to \`npm run start:testdb\`? cant connect to database`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
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.43.
|
|
5
|
+
"version": "0.43.6",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "src/index.js",
|
|
8
8
|
"repository": "ehmpathy/declapract-typescript-ehmpathy",
|