Skip to content

Commit f26c213

Browse files
chore: align package.json (#431)
Co-authored-by: Arnaud Barré <[email protected]>
1 parent 45fdf89 commit f26c213

File tree

6 files changed

+58
-23
lines changed

6 files changed

+58
-23
lines changed

.github/workflows/publish.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ jobs:
3030
env:
3131
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"
3232

33-
- name: Publish package
34-
run: pnpm run ci-publish ${{ github.ref_name }}
35-
env:
36-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37-
3833
- name: Get pkgName for tag
3934
id: tag
4035
run: |
@@ -49,6 +44,15 @@ jobs:
4944
5045
echo "pkgName=$pkgName" >> $GITHUB_OUTPUT
5146
47+
- if: steps.tag.outputs.pkgName == 'plugin-react-swc'
48+
working-directory: packages/plugin-react-swc
49+
run: pnpm build
50+
51+
- name: Publish package
52+
run: pnpm run ci-publish ${{ github.ref_name }}
53+
env:
54+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
55+
5256
- # only run if tag is not alpha
5357
if: steps.tag.outputs.pkgName
5458
uses: ArnaudBarre/github-release@e8d55cf5b215f7cf998ad2387044b9e7d5dd8112 # v1

packages/plugin-react-swc/package.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
{
22
"name": "@vitejs/plugin-react-swc",
33
"version": "3.8.1",
4+
"license": "MIT",
5+
"author": "Arnaud Barré (https://github.com/ArnaudBarre)",
6+
"description": "Speed up your Vite dev server with SWC",
7+
"keywords": [
8+
"vite",
9+
"vite-plugin",
10+
"react",
11+
"swc",
12+
"react-refresh",
13+
"fast refresh"
14+
],
415
"type": "module",
516
"private": true,
617
"scripts": {
@@ -9,7 +20,15 @@
920
"test": "playwright test",
1021
"release": "pnpm build && tsx scripts/release.ts"
1122
},
12-
"packageManager": "[email protected]",
23+
"repository": {
24+
"type": "git",
25+
"url": "git+https://github.com/vitejs/vite-plugin-react.git",
26+
"directory": "packages/plugin-react-swc"
27+
},
28+
"bugs": {
29+
"url": "https://github.com/vitejs/vite-plugin-react/issues"
30+
},
31+
"homepage": "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc#readme",
1332
"dependencies": {
1433
"@swc/core": "^1.11.11"
1534
},

packages/plugin-react-swc/scripts/bundle.ts

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ module.exports.default = react;`,
6565
'dist/package.json',
6666
JSON.stringify(
6767
{
68-
name: '@vitejs/plugin-react-swc',
69-
description: 'Speed up your Vite dev server with SWC',
70-
version: packageJSON.version,
71-
author: 'Arnaud Barré (https://github.com/ArnaudBarre)',
72-
license: 'MIT',
73-
repository: 'github:vitejs/vite-plugin-react-swc',
74-
type: 'module',
68+
...Object.fromEntries(
69+
Object.entries(packageJSON).filter(
70+
([key, _val]) =>
71+
key !== 'devDependencies' &&
72+
key !== 'scripts' &&
73+
key !== 'private',
74+
),
75+
),
7576
main: 'index.cjs',
7677
types: 'index.d.ts',
7778
module: 'index.mjs',
@@ -82,16 +83,6 @@ module.exports.default = react;`,
8283
import: './index.mjs',
8384
},
8485
},
85-
keywords: [
86-
'vite',
87-
'vite-plugin',
88-
'react',
89-
'swc',
90-
'react-refresh',
91-
'fast refresh',
92-
],
93-
peerDependencies: packageJSON.peerDependencies,
94-
dependencies: packageJSON.dependencies,
9586
},
9687
null,
9788
2,

packages/plugin-react/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
"version": "4.3.4",
44
"license": "MIT",
55
"author": "Evan You",
6+
"description": "The default Vite plugin for React projects",
7+
"keywords": [
8+
"vite",
9+
"vite-plugin",
10+
"react",
11+
"babel",
12+
"react-refresh",
13+
"fast refresh"
14+
],
615
"contributors": [
716
"Alec Larson",
817
"Arnaud Barré"

scripts/publishCI.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,10 @@ import { publish } from '@vitejs/release-scripts'
33
publish({
44
defaultPackage: 'plugin-react',
55
provenance: true,
6+
getPkgDir(pkg) {
7+
if (pkg === 'plugin-react-swc') {
8+
return `packages/${pkg}/dist`
9+
}
10+
return `packages/${pkg}`
11+
},
612
})

scripts/release.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import colors from 'picocolors'
55
release({
66
repo: 'vite-plugin-react',
77
packages: ['plugin-react', 'plugin-react-swc'],
8+
getPkgDir(pkg) {
9+
if (pkg === 'plugin-react-swc') {
10+
return `packages/${pkg}/dist`
11+
}
12+
return `packages/${pkg}`
13+
},
814
toTag: (pkg, version) => `${pkg}@${version}`,
915
logChangelog: async (pkgName) => {
1016
const changelog = readFileSync(`packages/${pkgName}/CHANGELOG.md`, 'utf-8')

0 commit comments

Comments
 (0)