declapract-typescript-ehmpathy 0.43.12 → 0.43.17

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.
@@ -2,10 +2,9 @@ name: .publish-npm
2
2
 
3
3
  on:
4
4
  workflow_call:
5
- secrets:
6
- npm-auth-token:
7
- required: true
8
- description: required credentials to authenticate with the aws account under which to publish
5
+
6
+ permissions:
7
+ id-token: write # required for oidc
9
8
 
10
9
  jobs:
11
10
  install:
@@ -31,10 +30,32 @@ jobs:
31
30
  path: ./node_modules
32
31
  key: ${{ needs.install.outputs.node-modules-cache-key }}
33
32
 
33
+ - name: verify oidc auth
34
+ run: |
35
+ OIDC_TOKEN=$(curl -sS -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=npm:registry.npmjs.org" | jq -r '.value')
36
+ PACKAGE_NAME_PLAIN=$(jq -r '.name' package.json)
37
+ PACKAGE_NAME_ENCODED=$(printf '%s' "$PACKAGE_NAME_PLAIN" | jq -sRr @uri)
38
+ HTTP_CODE=$(curl -sS -o /dev/null -w '%{http_code}' -X POST -H "Authorization: Bearer $OIDC_TOKEN" "https://registry.npmjs.org/-/npm/v1/oidc/token/exchange/package/$PACKAGE_NAME_ENCODED")
39
+ if [[ "$HTTP_CODE" =~ ^2 ]]; then
40
+ echo "oidc: configured for $PACKAGE_NAME_PLAIN"
41
+ else
42
+ echo "::error::oidc: not configured for $PACKAGE_NAME_PLAIN (http $HTTP_CODE). add oidc by-hand at https://www.npmjs.com/package/$PACKAGE_NAME_ENCODED/access"
43
+ exit 1
44
+ fi
45
+
46
+ - name: verify oidc compat
47
+ run: |
48
+ NPM_VERSION=$(npm --version)
49
+ MIN_VERSION="11.5.1"
50
+ if [ "$(printf '%s\n' "$MIN_VERSION" "$NPM_VERSION" | sort -V | head -n1)" != "$MIN_VERSION" ]; then
51
+ echo "npm $NPM_VERSION < $MIN_VERSION, will upgrade npm now to support oidc..."
52
+ npm install -g npm@latest
53
+ else
54
+ echo "npm $NPM_VERSION >= $MIN_VERSION, ready to use!"
55
+ fi
56
+
34
57
  - name: build
35
58
  run: npm run build
36
59
 
37
60
  - name: publish
38
- run: npm publish --access public
39
- env:
40
- NODE_AUTH_TOKEN: ${{ secrets.npm-auth-token }}
61
+ run: npm publish --access public --provenance
@@ -16,5 +16,3 @@ jobs:
16
16
  publish:
17
17
  uses: ./.github/workflows/.publish-npm.yml
18
18
  needs: [test]
19
- secrets:
20
- npm-auth-token: ${{ secrets.NPM_TOKEN }}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "domain-objects": "@declapract{check.minVersion('0.31.3')}",
3
+ "domain-objects": "@declapract{check.minVersion('0.31.7')}",
4
4
  "joi": "@declapract{check.minVersion('17.4.0')}",
5
5
  "type-fns": "@declapract{check.minVersion('1.21.0')}"
6
6
  }
@@ -8,12 +8,13 @@
8
8
  "files": {
9
9
  "includes": [
10
10
  "**/src/**/*.ts",
11
+ "**/provision/**/*.ts",
11
12
  "!**/dist",
12
13
  "!**/coverage",
13
14
  "!**/node_modules",
14
15
  "!**/.artifact",
15
- "!**/.generated/**",
16
- "!**/.test*/**"
16
+ "!**/.generated",
17
+ "!**/.test*"
17
18
  ]
18
19
  },
19
20
  "formatter": {
@@ -4,11 +4,11 @@
4
4
  "@biomejs/biome": "2.3.8"
5
5
  },
6
6
  "scripts": {
7
- "fix:format:biome": "biome check --write src",
8
- "fix:lint": "biome check --write src",
9
- "test:format:biome": "biome format src",
10
- "test:lint:biome": "biome check src --diagnostic-level=error",
11
- "test:lint:biome:all": "biome check src",
7
+ "fix:format:biome": "biome check --write",
8
+ "fix:lint": "biome check --write",
9
+ "test:format:biome": "biome format",
10
+ "test:lint:biome": "biome check --diagnostic-level=error",
11
+ "test:lint:biome:all": "biome check",
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 +1 @@
1
- v20.12.2
1
+ v22.21.0
@@ -0,0 +1,3 @@
1
+ joi has been replaced by zod as the preferred runtime type-checking library.
2
+
3
+ zod provides better TypeScript integration with automatic type inference, smaller bundle size, and a more modern API.
@@ -0,0 +1,5 @@
1
+ {
2
+ "dependencies": {
3
+ "joi": "@declapract{check.minVersion('0.0.0')}"
4
+ }
5
+ }
@@ -0,0 +1,19 @@
1
+ import { FileCheckType, type FileFixFunction } from 'declapract';
2
+
3
+ export const check = FileCheckType.CONTAINS;
4
+
5
+ export const fix: FileFixFunction = (contents) => {
6
+ if (!contents) return { contents };
7
+ const packageJSON = JSON.parse(contents);
8
+ const updatedPackageJSON = {
9
+ ...packageJSON,
10
+ dependencies: {
11
+ ...packageJSON.dependencies,
12
+ joi: undefined,
13
+ zod: packageJSON.dependencies?.zod ?? '^3.24.0',
14
+ },
15
+ };
16
+ return {
17
+ contents: JSON.stringify(updatedPackageJSON, null, 2),
18
+ };
19
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "dependencies": {
3
- "joi": "@declapract{check.minVersion('17.4.0')}"
3
+ "zod": "@declapract{check.minVersion('3.24.0')}"
4
4
  }
5
5
  }
@@ -8,7 +8,7 @@ plugins:
8
8
 
9
9
  provider:
10
10
  name: aws
11
- runtime: nodejs16.x
11
+ runtime: nodejs22.x
12
12
  memorySize: 1024 # optional, in mb, default is 1024
13
13
  timeout: 60 # default timeout to 1min, for resilience against increased cold start times; individual functions can override this
14
14
  stage: ${opt:stage}
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.12",
5
+ "version": "0.43.17",
6
6
  "license": "MIT",
7
7
  "main": "src/index.js",
8
8
  "repository": "ehmpathy/declapract-typescript-ehmpathy",