declapract-typescript-ehmpathy 0.39.10 → 0.39.12

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.
@@ -7,11 +7,10 @@ on:
7
7
  type: string
8
8
  description: the aws region within which we should run the tests
9
9
  required: false
10
+ secrets:
10
11
  aws-account-id:
11
- type: string
12
12
  description: the id of the account the credentials are expected to access
13
13
  required: false
14
- secrets:
15
14
  aws-access-key-id:
16
15
  required: false
17
16
  description: required credentials to authenticate with aws the aws account against which to run the tests
@@ -154,7 +153,7 @@ jobs:
154
153
  key: ${{ needs.install.outputs.node-modules-cache-key }}
155
154
 
156
155
  - name: configure aws credentials
157
- if: "${{ inputs.aws-account-id != '' }}"
156
+ if: "${{ inputs.aws-region != '' }}"
158
157
  uses: aws-actions/configure-aws-credentials@v1
159
158
  id: credentials
160
159
  with:
@@ -163,9 +162,9 @@ jobs:
163
162
  aws-region: ${{ inputs.aws-region }}
164
163
 
165
164
  - name: confirm aws credentials
166
- if: "${{ inputs.aws-account-id != '' }}"
165
+ if: "${{ inputs.aws-region != '' }}"
167
166
  run: |
168
- [[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
167
+ [[ ${{steps.credentials.outputs.aws-account-id}} != ${{ secrets.aws-account-id }} ]] \
169
168
  && echo 'wrong aws account' && exit 1 \
170
169
  || echo 'correct aws account';
171
170
 
@@ -194,7 +193,7 @@ jobs:
194
193
  key: ${{ needs.install.outputs.node-modules-cache-key }}
195
194
 
196
195
  - name: configure aws credentials
197
- if: "${{ inputs.aws-account-id != '' }}"
196
+ if: "${{ inputs.aws-region != '' }}"
198
197
  uses: aws-actions/configure-aws-credentials@v1
199
198
  id: credentials
200
199
  with:
@@ -203,9 +202,9 @@ jobs:
203
202
  aws-region: ${{ inputs.aws-region }}
204
203
 
205
204
  - name: confirm aws credentials
206
- if: "${{ inputs.aws-account-id != '' }}"
205
+ if: "${{ inputs.aws-region != '' }}"
207
206
  run: |
208
- [[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
207
+ [[ ${{steps.credentials.outputs.aws-account-id}} != ${{ secrets.aws-account-id }} ]] \
209
208
  && echo 'wrong aws account' && exit 1 \
210
209
  || echo 'correct aws account';
211
210
 
@@ -17,7 +17,7 @@ jobs:
17
17
  uses: ./.github/workflows/.test.yml
18
18
  with:
19
19
  aws-region: us-east-1
20
- aws-account-id: '@declapract{variable.awsAccountId.dev}'
21
20
  secrets:
21
+ aws-account-id: '@declapract{variable.awsAccountId.dev}' # not a secret for services, but is a secret generically, since .test supports packages too
22
22
  aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
23
23
  aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
@@ -0,0 +1 @@
1
+ prefer uuid-fns for a stable contract, batteries included
@@ -0,0 +1,23 @@
1
+ import { FileCheckFunction, FileFixFunction } from 'declapract';
2
+
3
+ export const check: FileCheckFunction = (contents) => {
4
+ const packageJSONObject = JSON.parse(contents!);
5
+ if (Object.keys(packageJSONObject.dependencies).includes('uuid')) return; // matches
6
+ if (Object.keys(packageJSONObject.devDependencies).includes('@types/uuid'))
7
+ return; // matches
8
+ throw new Error('does not match bad practice');
9
+ };
10
+
11
+ export const fix: FileFixFunction = (contents) => {
12
+ if (!contents) return {}; // should not occur
13
+ const packageJSONObject = JSON.parse(contents);
14
+ const fixedPackageJSONObject = {
15
+ ...packageJSONObject,
16
+ dependencies: { ...packageJSONObject.dependencies, uuid: undefined },
17
+ devDependencies: {
18
+ ...packageJSONObject.dependencies,
19
+ '@types/uuid': undefined,
20
+ },
21
+ };
22
+ return { contents: JSON.stringify(fixedPackageJSONObject, null, 2) };
23
+ };
@@ -0,0 +1,3 @@
1
+ import { FileCheckType } from 'declapract';
2
+
3
+ export const check = FileCheckType.EXISTS;
@@ -1,8 +1,5 @@
1
1
  {
2
- "dependencies": {
3
- "uuid": "@declapract{check.minVersion('9.0.0')}"
4
- },
5
2
  "devDependencies": {
6
- "@types/uuid": "@declapract{check.minVersion('9.0.0')}"
3
+ "uuid-fns": "@declapract{check.minVersion('1.0.2')}"
7
4
  }
8
5
  }
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.39.10",
5
+ "version": "0.39.12",
6
6
  "license": "MIT",
7
7
  "main": "src/index.js",
8
8
  "repository": "ehmpathy/declapract-typescript-ehmpathy",
@@ -1 +0,0 @@
1
- industry standard; the community has converged on it
@@ -1 +0,0 @@
1
- export { v4 as uuid } from 'uuid';