declapract-typescript-ehmpathy 0.24.0 → 0.25.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.
- package/dist/practices/cicd-package/best-practice/.github/workflows/.publish-npm.yml +14 -3
- package/dist/practices/cicd-service/best-practice/.github/workflows/.deploy-sls.yml +112 -1
- package/dist/practices/cicd-service/best-practice/.github/workflows/.sql-schema-control.yml +22 -6
- package/dist/practices/errors/best-practice/src/utils/errors/UnexpectedCodePathError.ts +1 -1
- package/dist/practices/linting/best-practice/.depcheckrc.yml +1 -0
- package/dist/practices/package-json-order/best-practice/package.json.declapract.ts +2 -0
- package/dist/practices/serverless/best-practice/package.json +2 -0
- package/dist/practices/serverless/best-practice/serverless.yml +3 -0
- package/package.json +1 -2
|
@@ -14,15 +14,26 @@ jobs:
|
|
|
14
14
|
- name: checkout
|
|
15
15
|
uses: actions/checkout@v3
|
|
16
16
|
|
|
17
|
-
- name: set node
|
|
17
|
+
- name: set node-version
|
|
18
18
|
uses: actions/setup-node@v3
|
|
19
19
|
with:
|
|
20
20
|
registry-url: 'https://registry.npmjs.org/'
|
|
21
21
|
node-version-file: '.nvmrc'
|
|
22
22
|
cache: 'npm'
|
|
23
23
|
|
|
24
|
-
- name:
|
|
25
|
-
|
|
24
|
+
- name: node-modules cache get
|
|
25
|
+
uses: actions/cache/restore@v3
|
|
26
|
+
id: cache
|
|
27
|
+
with:
|
|
28
|
+
path: ./node_modules
|
|
29
|
+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
30
|
+
|
|
31
|
+
- name: node-modules cache miss install
|
|
32
|
+
if: steps.cache.outputs.cache-hit != 'true'
|
|
33
|
+
run: npm ci --ignore-scripts --prefer-offline --no-audit
|
|
34
|
+
|
|
35
|
+
- name: build
|
|
36
|
+
run: npm run build
|
|
26
37
|
|
|
27
38
|
- name: publish
|
|
28
39
|
run: npm publish
|
|
@@ -19,6 +19,11 @@ on:
|
|
|
19
19
|
type: string
|
|
20
20
|
description: the id of the account the credentials are expected to access
|
|
21
21
|
required: true
|
|
22
|
+
needs-vpn-for-acceptance:
|
|
23
|
+
type: boolean
|
|
24
|
+
description: whether or not this environment needs vpn access for acceptance tests
|
|
25
|
+
required: false
|
|
26
|
+
default: false
|
|
22
27
|
secrets:
|
|
23
28
|
aws-access-key-id:
|
|
24
29
|
required: true
|
|
@@ -26,6 +31,9 @@ on:
|
|
|
26
31
|
aws-secret-access-key:
|
|
27
32
|
required: true
|
|
28
33
|
description: required credentials to authenticate with aws provider and state persistance
|
|
34
|
+
open-vpn-config:
|
|
35
|
+
required: false
|
|
36
|
+
description: complete openvpn config required to enter the vpn, if needed
|
|
29
37
|
|
|
30
38
|
jobs:
|
|
31
39
|
deploy:
|
|
@@ -34,7 +42,7 @@ jobs:
|
|
|
34
42
|
- name: checkout
|
|
35
43
|
uses: actions/checkout@v3
|
|
36
44
|
|
|
37
|
-
- name: set node
|
|
45
|
+
- name: set node-version
|
|
38
46
|
uses: actions/setup-node@v3
|
|
39
47
|
with:
|
|
40
48
|
node-version-file: '.nvmrc'
|
|
@@ -68,5 +76,108 @@ jobs:
|
|
|
68
76
|
- name: deploy
|
|
69
77
|
run: STAGE=${{ inputs.stage }} DEPLOYER_NAME=$GITHUB_ACTOR npm run deploy
|
|
70
78
|
|
|
79
|
+
assure:
|
|
80
|
+
runs-on: ubuntu-latest
|
|
81
|
+
needs: [deploy]
|
|
82
|
+
steps:
|
|
83
|
+
- name: checkout
|
|
84
|
+
uses: actions/checkout@v3
|
|
85
|
+
|
|
86
|
+
- name: set node-version
|
|
87
|
+
uses: actions/setup-node@v3
|
|
88
|
+
with:
|
|
89
|
+
node-version-file: '.nvmrc'
|
|
90
|
+
cache: 'npm'
|
|
91
|
+
|
|
92
|
+
- name: configure aws credentials
|
|
93
|
+
uses: aws-actions/configure-aws-credentials@v1
|
|
94
|
+
id: credentials
|
|
95
|
+
with:
|
|
96
|
+
aws-access-key-id: ${{ secrets.aws-access-key-id }}
|
|
97
|
+
aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
|
|
98
|
+
aws-region: ${{ inputs.aws-region }}
|
|
99
|
+
|
|
100
|
+
- name: confirm aws credentials
|
|
101
|
+
run: |
|
|
102
|
+
[[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
|
|
103
|
+
&& echo 'wrong aws account' && exit 1 \
|
|
104
|
+
|| echo 'correct aws account';
|
|
105
|
+
|
|
106
|
+
- name: node-modules cache get
|
|
107
|
+
uses: actions/cache/restore@v3
|
|
108
|
+
id: cache
|
|
109
|
+
with:
|
|
110
|
+
path: ./node_modules
|
|
111
|
+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
112
|
+
|
|
113
|
+
- name: node-modules cache miss install
|
|
114
|
+
if: steps.cache.outputs.cache-hit != 'true'
|
|
115
|
+
run: npm ci --ignore-scripts --prefer-offline --no-audit
|
|
116
|
+
|
|
117
|
+
- name: vpn:prepare
|
|
118
|
+
if: inputs.needs-vpn-for-acceptance
|
|
119
|
+
run: |
|
|
120
|
+
sudo apt update \
|
|
121
|
+
&& sudo apt-get install openvpn openvpn-systemd-resolved \
|
|
122
|
+
&& mkdir ~/.vpn \
|
|
123
|
+
&& echo "${{ secrets.open-vpn-config }}" | base64 -d > ~/.vpn/vpn.connection.ovpn
|
|
124
|
+
|
|
125
|
+
- name: vpn:connect
|
|
126
|
+
if: inputs.needs-vpn-for-acceptance
|
|
127
|
+
run: |
|
|
128
|
+
# create the log file, so that we have permissions to read it
|
|
129
|
+
touch openvpn.log
|
|
130
|
+
|
|
131
|
+
# start openvpn in the background
|
|
132
|
+
sudo openvpn --config ~/.vpn/vpn.connection.ovpn --daemon --log openvpn.log
|
|
133
|
+
|
|
134
|
+
# wait until we've confirmed that it successfully connected; https://superuser.com/a/900134/425694
|
|
135
|
+
( tail -f -n0 openvpn.log & ) | grep -q "Initialization Sequence Completed"
|
|
136
|
+
|
|
71
137
|
- name: test:acceptance
|
|
72
138
|
run: STAGE=${{ inputs.stage }} npm run test:acceptance
|
|
139
|
+
|
|
140
|
+
- name: vpn:disconnect
|
|
141
|
+
if: inputs.needs-vpn-for-acceptance
|
|
142
|
+
run: sudo killall openvpn
|
|
143
|
+
|
|
144
|
+
prune:
|
|
145
|
+
runs-on: ubuntu-latest
|
|
146
|
+
needs: [deploy]
|
|
147
|
+
steps:
|
|
148
|
+
- name: checkout
|
|
149
|
+
uses: actions/checkout@v3
|
|
150
|
+
|
|
151
|
+
- name: set node-version
|
|
152
|
+
uses: actions/setup-node@v3
|
|
153
|
+
with:
|
|
154
|
+
node-version-file: '.nvmrc'
|
|
155
|
+
cache: 'npm'
|
|
156
|
+
|
|
157
|
+
- name: configure aws credentials
|
|
158
|
+
uses: aws-actions/configure-aws-credentials@v1
|
|
159
|
+
id: credentials
|
|
160
|
+
with:
|
|
161
|
+
aws-access-key-id: ${{ secrets.aws-access-key-id }}
|
|
162
|
+
aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
|
|
163
|
+
aws-region: ${{ inputs.aws-region }}
|
|
164
|
+
|
|
165
|
+
- name: confirm aws credentials
|
|
166
|
+
run: |
|
|
167
|
+
[[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
|
|
168
|
+
&& echo 'wrong aws account' && exit 1 \
|
|
169
|
+
|| echo 'correct aws account';
|
|
170
|
+
|
|
171
|
+
- name: node-modules cache get
|
|
172
|
+
uses: actions/cache/restore@v3
|
|
173
|
+
id: cache
|
|
174
|
+
with:
|
|
175
|
+
path: ./node_modules
|
|
176
|
+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
177
|
+
|
|
178
|
+
- name: node-modules cache miss install
|
|
179
|
+
if: steps.cache.outputs.cache-hit != 'true'
|
|
180
|
+
run: npm ci --ignore-scripts --prefer-offline --no-audit
|
|
181
|
+
|
|
182
|
+
- name: prune
|
|
183
|
+
run: STAGE=${{ inputs.stage }} DEPLOYER_NAME=$GITHUB_ACTOR npm run deploy:prune
|
|
@@ -40,14 +40,22 @@ jobs:
|
|
|
40
40
|
- name: checkout
|
|
41
41
|
uses: actions/checkout@v3
|
|
42
42
|
|
|
43
|
-
- name: set node
|
|
43
|
+
- name: set node-version
|
|
44
44
|
uses: actions/setup-node@v3
|
|
45
45
|
with:
|
|
46
46
|
node-version-file: '.nvmrc'
|
|
47
47
|
cache: 'npm'
|
|
48
48
|
|
|
49
|
-
- name:
|
|
50
|
-
|
|
49
|
+
- name: node-modules cache get
|
|
50
|
+
uses: actions/cache/restore@v3
|
|
51
|
+
id: cache
|
|
52
|
+
with:
|
|
53
|
+
path: ./node_modules
|
|
54
|
+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
55
|
+
|
|
56
|
+
- name: node-modules cache miss install
|
|
57
|
+
if: steps.cache.outputs.cache-hit != 'true'
|
|
58
|
+
run: npm ci --ignore-scripts --prefer-offline --no-audit
|
|
51
59
|
|
|
52
60
|
- name: configure aws credentials
|
|
53
61
|
uses: aws-actions/configure-aws-credentials@v1
|
|
@@ -117,14 +125,22 @@ jobs:
|
|
|
117
125
|
- name: checkout
|
|
118
126
|
uses: actions/checkout@v3
|
|
119
127
|
|
|
120
|
-
- name: set node
|
|
128
|
+
- name: set node-version
|
|
121
129
|
uses: actions/setup-node@v3
|
|
122
130
|
with:
|
|
123
131
|
node-version-file: '.nvmrc'
|
|
124
132
|
cache: 'npm'
|
|
125
133
|
|
|
126
|
-
- name:
|
|
127
|
-
|
|
134
|
+
- name: node-modules cache get
|
|
135
|
+
uses: actions/cache/restore@v3
|
|
136
|
+
id: cache
|
|
137
|
+
with:
|
|
138
|
+
path: ./node_modules
|
|
139
|
+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
140
|
+
|
|
141
|
+
- name: node-modules cache miss install
|
|
142
|
+
if: steps.cache.outputs.cache-hit != 'true'
|
|
143
|
+
run: npm ci --ignore-scripts --prefer-offline --no-audit
|
|
128
144
|
|
|
129
145
|
- name: configure aws credentials
|
|
130
146
|
uses: aws-actions/configure-aws-credentials@v1
|
|
@@ -8,7 +8,7 @@ export class UnexpectedCodePathError extends Error {
|
|
|
8
8
|
constructor(message: string, metadata?: Record<string, any>) {
|
|
9
9
|
const fullMessage = `UnexpectedCodePath: ${message}${
|
|
10
10
|
metadata ? `\n\n${JSON.stringify(metadata)}` : ''
|
|
11
|
-
}
|
|
11
|
+
}`;
|
|
12
12
|
super(fullMessage);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"devDependencies": {
|
|
3
3
|
"serverless": "@declapract{check.minVersion('2.57.0')}",
|
|
4
|
+
"serverless-prune-plugin": "@declapract{check.minVersion('2.0.2')}",
|
|
4
5
|
"if-env": "@declapract{check.minVersion('1.0.4')}"
|
|
5
6
|
},
|
|
6
7
|
"scripts": {
|
|
8
|
+
"deploy:prune": "npx sls prune -n 7 --stage $STAGE",
|
|
7
9
|
"deploy:release": "npm run build && sls deploy --verbose --stage $STAGE",
|
|
8
10
|
"deploy:send-notification": "curl -X POST -H 'Content-type: application/json' --data \"{\\\"text\\\":\\\"$([ -z $DEPLOYER_NAME ] && git config user.name || echo $DEPLOYER_NAME) has deployed $npm_package_name@v$npm_package_version:\nhttps://github.com/@declapract{variable.organizationName}/$npm_package_name/tree/v$npm_package_version\\\"}\" @declapract{variable.slackWebhookUrl}",
|
|
9
11
|
"deploy:dev": "STAGE=dev npm run deploy:release",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "declapract-typescript-ehmpathy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.1",
|
|
4
4
|
"description": "declapract best practices declarations for typescript",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"repository": "ehmpathy/declapract-typescript-ehmpathy",
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"license": "ISC",
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"domain-objects": "0.7.5",
|
|
35
|
-
"dynamodb-dao-generator": "1.0.0",
|
|
36
35
|
"expect": "29.4.2",
|
|
37
36
|
"flat": "5.0.2",
|
|
38
37
|
"lodash.uniq": "4.5.0",
|