Skip to content

Commit cce52a6

Browse files
authored
Pack up removal and replacement (#103)
* feat: wip pack up removal and replacement * feat: wip pack up removal and replacement * feat: upgrade to version 6.0.0 and replace pack-up with vite * feat: add target option to ViteConfigOptions for customizable build targets * docs: add command descriptions and usage details for plugin build, watch, and validation utilities * chore: update @strapi/sdk-plugin dependency to version 6.0.0 in package.json and file-generator.ts * chore: rename validation check to verify * chore: update Vite build target to node20 * chore: replace 'check' function with 'verify' * chore: built-in module check using 'builtinModules' * chore: legacy packup config warning update changelog * chore: correct changeset workflow * chore: support non standard exports
1 parent 4bec86c commit cce52a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+4372
-1241
lines changed

.changeset/early-cherries-leave.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@strapi/sdk-plugin': major
3+
---
4+
5+
### Breaking Changes
6+
7+
- Removed `@strapi/pack-up` dependency - build system now uses Vite v6 directly
8+
- `packup.config.ts` is no longer used (can be safely deleted)
9+
- Sourcemaps now default to `false` (use `--sourcemap` flag to enable)
10+
11+
### Migration
12+
13+
1. Delete `packup.config.ts` from your plugin (it's no longer read)
14+
2. If you need sourcemaps, add `--sourcemap` to your build command
15+
16+
### Why This Change?
17+
18+
- Resolves Vite security vulnerability (CVE) that existed in pack-up's dependencies
19+
- Simplifies the build system with direct Vite configuration
20+
- Reduces maintenance overhead by removing the pack-up abstraction layer

jest.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
*/
44
export default {
55
modulePathIgnorePatterns: ['dist'],
6-
testMatch: ['**/__tests__/**/*.{js,ts}'],
6+
testMatch: ['**/__tests__/**/*.test.{js,ts}'],
7+
testPathIgnorePatterns: ['__tests__/fixtures/'],
78
transform: {
89
'^.+\\.(t|j)sx?$': ['@swc/jest'],
910
},

package.json

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
"exports": {
2929
".": {
3030
"source": "./src/index.ts",
31-
"import": "./dist/index.mjs",
32-
"require": "./dist/index.js",
33-
"default": "./dist/index.js"
31+
"import": "./dist/cli.mjs",
32+
"require": "./dist/cli.js",
33+
"default": "./dist/cli.js"
3434
},
3535
"./package.json": "./package.json"
3636
},
@@ -42,8 +42,8 @@
4242
"dist"
4343
],
4444
"scripts": {
45-
"build": "pack-up build",
46-
"check": "pack-up check",
45+
"build": "vite build",
46+
"check": "pnpm lint && pnpm test:ts && pnpm test:unit",
4747
"lint": "eslint .",
4848
"prepare": "husky",
4949
"prerelease:enter": "changeset pre enter",
@@ -55,15 +55,16 @@
5555
"release:version": "changeset version && pnpm install",
5656
"test:ts": "tsc --noEmit",
5757
"test:unit": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
58-
"watch": "pack-up watch"
58+
"watch": "vite build --watch"
5959
},
6060
"dependencies": {
61-
"@strapi/pack-up": "^5.1.1",
6261
"@types/prompts": "2.4.9",
62+
"@vitejs/plugin-react": "^4.3.4",
6363
"boxen": "5.1.2",
6464
"chalk": "4.1.2",
6565
"commander": "12.1.0",
6666
"concurrently": "^8.2.2",
67+
"esbuild": "^0.24.0",
6768
"execa": "^9.3.1",
6869
"get-latest-version": "5.1.0",
6970
"git-url-parse": "13.1.1",
@@ -72,7 +73,10 @@
7273
"outdent": "0.8.0",
7374
"pkg-up": "3.1.0",
7475
"prettier": "2.8.8",
76+
"prompts": "^2.4.2",
7577
"typescript": "5.4.4",
78+
"vite": "^6.0.3",
79+
"vite-plugin-dts": "^4.3.0",
7680
"yup": "0.32.9"
7781
},
7882
"devDependencies": {
@@ -94,7 +98,8 @@
9498
"eslint-plugin-rxjs": "^5.0.3",
9599
"husky": "^9.0.11",
96100
"jest": "^29.7.0",
97-
"lint-staged": "^15.2.2"
101+
"lint-staged": "^15.2.2",
102+
"tsx": "^4.19.0"
98103
},
99104
"packageManager": "pnpm@9.1.0",
100105
"engines": {

packup.config.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)