Skip to content

Commit 3bf6410

Browse files
authored
chore(*): Publish packages with npm provenance (clerk#1891)
* chore(repo): Add provenance to .npmrc * chore(*): Add directory to "repository" key * chore(repo): Typo fix * chore(*): Use publishConfig instead * chore(repo): Add missing permissions * chore(*): Normalize repository.url * chore(repo): Try not to use provenance in verdaccio * chore(*): Use env var * chore(repo): Move env var around * Revert "chore(repo): Move env var around" This reverts commit 9ff9834. * chore(repo): Adjust npm scripts
1 parent 0dbff05 commit 3bf6410

File tree

20 files changed

+71
-23
lines changed

20 files changed

+71
-23
lines changed

Diff for: .changeset/fast-planes-talk.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'gatsby-plugin-clerk': patch
3+
'@clerk/chrome-extension': patch
4+
'@clerk/localizations': patch
5+
'@clerk/clerk-js': patch
6+
'@clerk/clerk-sdk-node': patch
7+
'@clerk/backend': patch
8+
'@clerk/fastify': patch
9+
'@clerk/nextjs': patch
10+
'@clerk/shared': patch
11+
'@clerk/themes': patch
12+
'@clerk/clerk-react': patch
13+
'@clerk/remix': patch
14+
'@clerk/types': patch
15+
'@clerk/clerk-expo': patch
16+
---
17+
18+
Publish packages with [npm provenance](https://docs.npmjs.com/generating-provenance-statements) enabled

Diff for: .github/workflows/release-prod.yml

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
name: Release
1616
if: ${{ github.repository == 'clerkinc/javascript' }}
1717
runs-on: ${{ vars.RUNNER_LARGE }}
18+
permissions:
19+
contents: read
20+
id-token: write
1821
steps:
1922
- name: Echo github context
2023
run: echo "$GITHUB_CONTEXT"
@@ -38,6 +41,7 @@ jobs:
3841
GITHUB_TOKEN: ${{ secrets.CLERK_COOKIE_PAT }}
3942
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4043
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
44+
NPM_CONFIG_PROVENANCE: true
4145

4246
- name: Trigger workflows on related repos
4347
if: steps.changesets.outputs.published == 'true'

Diff for: .github/workflows/release-snapshot.yml

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
env:
1717
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
1818
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
19+
permissions:
20+
contents: read
21+
id-token: write
1922
steps:
2023
- name: Limit action to Clerk members
2124
uses: actions/github-script@v6
@@ -62,6 +65,7 @@ jobs:
6265
run: npm run release:snapshot
6366
env:
6467
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
68+
NPM_CONFIG_PROVENANCE: true
6569

6670
- name: Package info
6771
if: steps.version-packages.outputs.success == '1'

Diff for: .github/workflows/release-staging.yml

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ jobs:
1818
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
1919
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
2020
TURBO_REMOTE_ONLY: true
21+
permissions:
22+
contents: read
23+
id-token: write
2124
steps:
2225
- name: Checkout repo
2326
uses: actions/checkout@v3
@@ -34,6 +37,7 @@ jobs:
3437
run: npm run release:staging
3538
env:
3639
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
40+
NPM_CONFIG_PROVENANCE: true
3741

3842
- name: Trigger workflows on related repos
3943
uses: actions/github-script@v6

Diff for: commitlint.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ module.exports = {
1717
'subject-case': [2, 'always', ['sentence-case']],
1818
'body-max-line-length': [1, 'always', '150'],
1919
'scope-empty': [2, 'never'],
20-
'scope-enum': [2, 'always', [...getPackageNames(), 'repo', 'release']],
20+
'scope-enum': [2, 'always', [...getPackageNames(), 'repo', 'release', '*']],
2121
},
2222
};

Diff for: package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,20 @@
7878
"lint:attw": "FORCE_COLOR=1 turbo lint:attw",
7979
"lint:fix": "FORCE_COLOR=1 turbo lint -- --fix",
8080
"bundlewatch": "turbo bundlewatch",
81-
"format": "npx prettier --write .",
82-
"format:check": "npx prettier --cache --check .",
81+
"format": "prettier --write .",
82+
"format:check": "prettier --cache --check .",
8383
"nuke": "./scripts/nuke.sh",
8484
"yalc:all": "for d in packages/*/; do echo $d; cd $d; yalc push --replace --sig; cd '../../'; done",
8585
"prepare": "husky install",
86-
"changeset": "npx changeset",
86+
"changeset": "changeset",
8787
"changeset:empty": "npm run changeset -- --empty",
88-
"version": "npx changeset version && ./scripts/version-info.sh",
88+
"version": "changeset version && ./scripts/version-info.sh",
8989
"version:snapshot": "./scripts/snapshot.mjs",
9090
"version:staging": "./scripts/staging.mjs",
91-
"release": "FORCE_COLOR=1 npm run build -- --force && npx changeset publish && git push --follow-tags",
92-
"release:snapshot": "FORCE_COLOR=1 npm run build && npx changeset publish --tag snapshot --no-git-tag",
93-
"release:staging": "FORCE_COLOR=1 npm run build && npx changeset publish --tag staging --no-git-tag",
94-
"release:verdaccio": "if [ \"$(npm config get registry)\" = \"https://registry.npmjs.org/\" ]; then echo 'Error: Using default registry' && exit 1; else TURBO_CONCURRENCY=4 npm run build && npx changeset publish --no-git-tag; fi",
91+
"release": "FORCE_COLOR=1 npm run build -- --force && changeset publish && git push --follow-tags",
92+
"release:snapshot": "FORCE_COLOR=1 npm run build && changeset publish --tag snapshot --no-git-tag",
93+
"release:staging": "FORCE_COLOR=1 npm run build && changeset publish --tag staging --no-git-tag",
94+
"release:verdaccio": "if [ \"$(npm config get registry)\" = \"https://registry.npmjs.org/\" ]; then echo 'Error: Using default registry' && exit 1; else TURBO_CONCURRENCY=4 npm run build && changeset publish --no-git-tag; fi",
9595
"update:lockfile": "npm run nuke && npm install -D --arch=x64 --platform=linux turbo && npm install -D --arch=arm64 --platform=darwin turbo"
9696
}
9797
}

Diff for: packages/backend/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@
8080
"homepage": "https://clerk.com/",
8181
"repository": {
8282
"type": "git",
83-
"url": "https://github.com/clerkinc/javascript.git"
83+
"url": "git+https://github.com/clerkinc/javascript.git",
84+
"directory": "packages/backend"
8485
},
8586
"bugs": {
8687
"url": "https://github.com/clerkinc/javascript/issues"

Diff for: packages/chrome-extension/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
},
5454
"repository": {
5555
"type": "git",
56-
"url": "https://github.com/clerkinc/javascript.git"
56+
"url": "git+https://github.com/clerkinc/javascript.git",
57+
"directory": "packages/chrome-extension"
5758
},
5859
"bugs": {
5960
"url": "https://github.com/clerkinc/javascript/issues"

Diff for: packages/clerk-js/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
"browserslist": "last 2 versions, ios_saf > 12, Safari > 12, > 1%, not dead, not ie > 0",
9494
"repository": {
9595
"type": "git",
96-
"url": "https://github.com/clerkinc/javascript.git"
96+
"url": "git+https://github.com/clerkinc/javascript.git",
97+
"directory": "packages/clerk-js"
9798
},
9899
"homepage": "https://clerk.com/",
99100
"bugs": {

Diff for: packages/expo/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
},
6161
"repository": {
6262
"type": "git",
63-
"url": "https://github.com/clerkinc/javascript.git"
63+
"url": "git+https://github.com/clerkinc/javascript.git",
64+
"directory": "packages/expo"
6465
},
6566
"bugs": {
6667
"url": "https://github.com/clerkinc/javascript/issues"

Diff for: packages/fastify/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
},
5151
"repository": {
5252
"type": "git",
53-
"url": "https://github.com/clerkinc/javascript.git"
53+
"url": "git+https://github.com/clerkinc/javascript.git",
54+
"directory": "packages/fastify"
5455
},
5556
"bugs": {
5657
"url": "https://github.com/clerkinc/javascript/issues"

Diff for: packages/gatsby-plugin-clerk/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
},
6060
"repository": {
6161
"type": "git",
62-
"url": "https://github.com/clerkinc/javascript.git"
62+
"url": "git+https://github.com/clerkinc/javascript.git",
63+
"directory": "packages/gatsby-plugin-clerk"
6364
},
6465
"bugs": {
6566
"url": "https://github.com/clerkinc/javascript/issues"

Diff for: packages/localizations/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
},
4646
"repository": {
4747
"type": "git",
48-
"url": "https://github.com/clerkinc/javascript.git"
48+
"url": "git+https://github.com/clerkinc/javascript.git",
49+
"directory": "packages/localizations"
4950
},
5051
"bugs": {
5152
"url": "https://github.com/clerkinc/javascript/issues"

Diff for: packages/nextjs/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@
106106
},
107107
"repository": {
108108
"type": "git",
109-
"url": "https://github.com/clerkinc/javascript.git"
109+
"url": "git+https://github.com/clerkinc/javascript.git",
110+
"directory": "packages/nextjs"
110111
},
111112
"bugs": {
112113
"url": "https://github.com/clerkinc/javascript/issues"

Diff for: packages/react/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
},
6868
"repository": {
6969
"type": "git",
70-
"url": "https://github.com/clerkinc/javascript.git"
70+
"url": "git+https://github.com/clerkinc/javascript.git",
71+
"directory": "packages/react"
7172
},
7273
"homepage": "https://clerk.com/",
7374
"bugs": {

Diff for: packages/remix/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@
9090
},
9191
"repository": {
9292
"type": "git",
93-
"url": "https://github.com/clerkinc/javascript.git"
93+
"url": "git+https://github.com/clerkinc/javascript.git",
94+
"directory": "packages/remix"
9495
},
9596
"bugs": {
9697
"url": "https://github.com/clerkinc/javascript/issues"

Diff for: packages/sdk-node/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"author": {
5151
"name": "Clerk, Inc.",
5252
"email": "support@clerk.com",
53-
"url": "https://github.com/clerkinc/clerk-sdk-node"
53+
"url": "git+https://github.com/clerkinc/javascript.git"
5454
},
5555
"devDependencies": {
5656
"nock": "^13.0.7",
@@ -73,7 +73,8 @@
7373
"description": "Clerk server SDK for usage with node",
7474
"repository": {
7575
"type": "git",
76-
"url": "https://github.com/clerkinc/javascript.git"
76+
"url": "git+https://github.com/clerkinc/javascript.git",
77+
"directory": "packages/sdk-node"
7778
},
7879
"keywords": [
7980
"clerk",

Diff for: packages/shared/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,10 @@
5454
"license": "MIT",
5555
"publishConfig": {
5656
"access": "public"
57+
},
58+
"repository": {
59+
"type": "git",
60+
"url": "git+https://github.com/clerkinc/javascript.git",
61+
"directory": "packages/shared"
5762
}
5863
}

Diff for: packages/themes/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
},
4343
"repository": {
4444
"type": "git",
45-
"url": "https://github.com/clerkinc/javascript.git"
45+
"url": "git+https://github.com/clerkinc/javascript.git",
46+
"directory": "packages/themes"
4647
},
4748
"bugs": {
4849
"url": "https://github.com/clerkinc/javascript/issues"

Diff for: packages/types/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
},
4040
"repository": {
4141
"type": "git",
42-
"url": "https://github.com/clerkinc/javascript.git"
42+
"url": "git+https://github.com/clerkinc/javascript.git",
43+
"directory": "packages/types"
4344
},
4445
"homepage": "https://clerk.com/",
4546
"bugs": {

0 commit comments

Comments
 (0)