Skip to content

Commit ea2c69c

Browse files
authored
Prepare npm trusted publishing release
1 parent c75b67c commit ea2c69c

6 files changed

Lines changed: 58 additions & 23 deletions

File tree

.github/workflows/publish.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ jobs:
7171
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.task == 'release' && github.ref == 'refs/heads/main' }}
7272
runs-on: ubuntu-latest
7373
permissions:
74+
contents: read
7475
id-token: write
7576

7677
steps:
@@ -88,11 +89,6 @@ jobs:
8889
- name: Install dependencies
8990
run: bun install --frozen-lockfile
9091

91-
- name: Verify npm authentication
92-
run: npm whoami
93-
env:
94-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
95-
9692
- name: Build
9793
run: bun run build
9894

@@ -127,8 +123,6 @@ jobs:
127123
128124
- name: Publish to npm
129125
run: npm publish --provenance --tag "${{ steps.publish_tag.outputs.tag }}"
130-
env:
131-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
132126

133127
unpublish:
134128
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.task == 'unpublish' && github.ref == 'refs/heads/main' }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ dist/
77
coverage/
88
*.tgz
99
.vite/
10+
.claude/worktrees/

.npmignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Keep this file so npm does not fall back to .gitignore.
2+
# The package intentionally publishes generated files from dist/.
3+
node_modules/
4+
.claude/worktrees/
5+
.env
6+
.env.*
7+
*.log
8+
.DS_Store
9+
coverage/
10+
*.tgz
11+
.vite/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Visual CSS editor for React. Edit styles in the browser, then copy agent-ready edits with component and file context.
66

77
<p align="center">
8-
<img src=".github/screenshot.png" alt="handmade visual editor" width="720" />
8+
<img src="https://raw.githubusercontent.com/rezailmi/made-refine/main/.github/screenshot.png" alt="handmade visual editor" width="720" />
99
</p>
1010

1111
## Quick start

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
"./preload.iife": "./dist/preload/preload.js"
3535
},
3636
"bin": {
37-
"made-refine": "./dist/cli.cjs"
37+
"made-refine": "dist/cli.cjs"
3838
},
3939
"sideEffects": true,
4040
"files": [
4141
"dist",
4242
"README.md",
43-
"LICENSE"
43+
"LICENSE.md"
4444
],
4545
"keywords": [
4646
"react",

src/package-portability.test.ts

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,60 @@ function getPackedFiles(): string[] {
3535
.filter((file): file is string => Boolean(file))
3636
}
3737

38+
function getNpmPackedFiles(): string[] {
39+
const output = execSync('npm pack --dry-run --json', {
40+
cwd: root,
41+
encoding: 'utf8',
42+
})
43+
const [pack] = JSON.parse(output) as Array<{ files: Array<{ path: string }> }>
44+
return pack.files.map((file) => file.path)
45+
}
46+
3847
describe('package portability', () => {
3948
beforeAll(() => {
4049
ensureDistArtifacts()
4150
})
4251

52+
const requiredPackageFiles = [
53+
'dist/index.js',
54+
'dist/index.mjs',
55+
'dist/index.d.ts',
56+
'dist/utils.js',
57+
'dist/utils.mjs',
58+
'dist/styles.css',
59+
'dist/preload/preload.js',
60+
'dist/vite.mjs',
61+
'dist/vite.d.ts',
62+
'dist/babel.cjs',
63+
'README.md',
64+
'LICENSE.md',
65+
] as const
66+
4367
it('ships required runtime artifacts in bun pack output', () => {
44-
const files = getPackedFiles()
68+
expect(getPackedFiles()).toEqual(expect.arrayContaining([...requiredPackageFiles]))
69+
})
70+
71+
it('ships required runtime artifacts in npm pack output', () => {
72+
const files = getNpmPackedFiles()
4573
expect(files).toEqual(
4674
expect.arrayContaining([
47-
'dist/index.js',
48-
'dist/index.mjs',
49-
'dist/index.d.ts',
50-
'dist/utils.js',
51-
'dist/utils.mjs',
52-
'dist/styles.css',
53-
'dist/preload/preload.js',
54-
'dist/vite.mjs',
55-
'dist/vite.d.ts',
56-
'dist/babel.cjs',
57-
'README.md',
58-
'LICENSE.md',
75+
...requiredPackageFiles,
76+
'dist/cli.cjs',
77+
'package.json',
5978
]),
6079
)
6180
})
6281

82+
it('can run npm publish dry-run without package metadata corrections', () => {
83+
const output = execSync('npm publish --dry-run --tag latest 2>&1', {
84+
cwd: root,
85+
encoding: 'utf8',
86+
})
87+
88+
expect(output).toContain('made-refine@')
89+
expect(output).not.toContain('auto-corrected')
90+
})
91+
6392
it('loads built cjs/esm/vite entrypoints', async () => {
6493
const cjsPath = path.join(root, 'dist/index.js')
6594
const esmPath = path.join(root, 'dist/index.mjs')

0 commit comments

Comments
 (0)