with-zephyr 0.1.2 → 0.1.3-next.2
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.
- package/README.md +19 -27
- package/dist/index.js +8 -2
- package/dist/zephyr-manifest.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -93,9 +93,6 @@ This will:
|
|
|
93
93
|
# Show what would be changed without modifying files
|
|
94
94
|
npx with-zephyr --dry-run
|
|
95
95
|
|
|
96
|
-
# Automatically install missing plugin packages
|
|
97
|
-
npx with-zephyr --install
|
|
98
|
-
|
|
99
96
|
# Specify a different directory
|
|
100
97
|
npx with-zephyr ./my-project
|
|
101
98
|
|
|
@@ -103,10 +100,10 @@ npx with-zephyr ./my-project
|
|
|
103
100
|
npx with-zephyr --bundlers webpack vite
|
|
104
101
|
|
|
105
102
|
# Combine options
|
|
106
|
-
npx with-zephyr ./src --dry-run --bundlers rollup
|
|
103
|
+
npx with-zephyr ./src --dry-run --bundlers rollup
|
|
107
104
|
|
|
108
105
|
# Use with other package managers
|
|
109
|
-
pnpm dlx with-zephyr
|
|
106
|
+
pnpm dlx with-zephyr
|
|
110
107
|
yarn dlx with-zephyr --dry-run
|
|
111
108
|
bunx with-zephyr --bundlers vite rollup
|
|
112
109
|
```
|
|
@@ -116,7 +113,8 @@ bunx with-zephyr --bundlers vite rollup
|
|
|
116
113
|
- `[directory]` - Directory to search for config files (default: current directory)
|
|
117
114
|
- `-d, --dry-run` - Show what would be changed without modifying files
|
|
118
115
|
- `-b, --bundlers <bundlers...>` - Only process specific bundlers
|
|
119
|
-
|
|
116
|
+
|
|
117
|
+
> The codemod automatically installs missing Zephyr plugins using your detected package manager (npm/yarn/pnpm/bun). In `--dry-run` it will only list what would be installed.
|
|
120
118
|
|
|
121
119
|
## Examples
|
|
122
120
|
|
|
@@ -193,7 +191,7 @@ module.exports = (config) => {
|
|
|
193
191
|
|
|
194
192
|
## Package Management
|
|
195
193
|
|
|
196
|
-
The codemod
|
|
194
|
+
The codemod automatically installs missing Zephyr plugin packages when not running in `--dry-run` mode.
|
|
197
195
|
|
|
198
196
|
### Package Manager Detection
|
|
199
197
|
|
|
@@ -217,21 +215,10 @@ The tool automatically detects your package manager by checking for:
|
|
|
217
215
|
- **pnpm**: `pnpm add --save-dev <package>`
|
|
218
216
|
- **bun**: `bun add --dev <package>`
|
|
219
217
|
|
|
220
|
-
###
|
|
221
|
-
|
|
222
|
-
```bash
|
|
223
|
-
# Install packages and update configs in one command
|
|
224
|
-
npx with-zephyr --install
|
|
218
|
+
### Package Installation Behavior
|
|
225
219
|
|
|
226
|
-
|
|
227
|
-
npx with-zephyr --dry-run
|
|
228
|
-
|
|
229
|
-
# The tool will show you which packages need to be installed if you don't use --install
|
|
230
|
-
npx with-zephyr
|
|
231
|
-
# Output: 💡 Tip: Use --install to automatically install missing packages:
|
|
232
|
-
# vite-plugin-zephyr
|
|
233
|
-
# zephyr-webpack-plugin
|
|
234
|
-
```
|
|
220
|
+
- `npx with-zephyr` will install any required Zephyr plugins that are missing.
|
|
221
|
+
- `npx with-zephyr --dry-run` will list the packages it would install without making changes.
|
|
235
222
|
|
|
236
223
|
## Configuration File Detection
|
|
237
224
|
|
|
@@ -306,7 +293,7 @@ Refer to the individual plugin documentation for specific setup instructions.
|
|
|
306
293
|
|
|
307
294
|
### Building
|
|
308
295
|
|
|
309
|
-
The codemod is written in TypeScript and
|
|
296
|
+
The codemod is written in TypeScript and built with Rspack/RSLib:
|
|
310
297
|
|
|
311
298
|
```bash
|
|
312
299
|
# Install dependencies
|
|
@@ -320,17 +307,22 @@ pnpm run dev
|
|
|
320
307
|
|
|
321
308
|
# Type checking
|
|
322
309
|
pnpm run typecheck
|
|
310
|
+
|
|
311
|
+
# Run the locally built CLI (no publish needed)
|
|
312
|
+
pnpm nx build with-zephyr
|
|
313
|
+
node ./libs/with-zephyr/dist/index.js --bundlers rspack /path/to/project
|
|
314
|
+
node ./libs/with-zephyr/dist/index.js --bundlers repack /path/to/react-native-project
|
|
323
315
|
```
|
|
324
316
|
|
|
325
317
|
### Project Structure
|
|
326
318
|
|
|
327
319
|
```
|
|
328
320
|
src/
|
|
329
|
-
├──
|
|
330
|
-
├──
|
|
331
|
-
├──
|
|
332
|
-
├──
|
|
333
|
-
└──
|
|
321
|
+
├── bundlers/ # Per-bundler configs + registry
|
|
322
|
+
├── transformers/ # AST transforms (imports, plugin arrays, wrappers, etc.)
|
|
323
|
+
├── package-manager.ts # Package management utilities
|
|
324
|
+
├── index.ts # CLI entry point and orchestration
|
|
325
|
+
└── types.ts # Shared types
|
|
334
326
|
```
|
|
335
327
|
|
|
336
328
|
## Contributing
|
package/dist/index.js
CHANGED
|
@@ -48114,6 +48114,11 @@ const rspack_rspackConfig = {
|
|
|
48114
48114
|
matcher: /export\s+default\s+withZephyr\s*\(\s*\)\s*\(/,
|
|
48115
48115
|
transform: 'skipAlreadyWrapped'
|
|
48116
48116
|
},
|
|
48117
|
+
{
|
|
48118
|
+
type: 'define-config',
|
|
48119
|
+
matcher: /export\s+default\s+defineConfig\s*\(/,
|
|
48120
|
+
transform: 'wrapExportDefault'
|
|
48121
|
+
},
|
|
48117
48122
|
{
|
|
48118
48123
|
type: 'compose-plugins',
|
|
48119
48124
|
matcher: /composePlugins\s*\(/,
|
|
@@ -48612,8 +48617,9 @@ function wrapModuleExports(ast) {
|
|
|
48612
48617
|
function wrapExportDefault(ast) {
|
|
48613
48618
|
(0, traverse_lib["default"])(ast, {
|
|
48614
48619
|
ExportDefaultDeclaration (path) {
|
|
48615
|
-
|
|
48616
|
-
|
|
48620
|
+
const declaration = path.node.declaration;
|
|
48621
|
+
if (types_lib.isObjectExpression(declaration) || types_lib.isCallExpression(declaration) || types_lib.isAwaitExpression(declaration)) path.node.declaration = types_lib.callExpression(types_lib.callExpression(types_lib.identifier('withZephyr'), []), [
|
|
48622
|
+
declaration
|
|
48617
48623
|
]);
|
|
48618
48624
|
}
|
|
48619
48625
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "with-zephyr",
|
|
3
|
-
"version": "0.1.2",
|
|
3
|
+
"version": "0.1.3-next.2",
|
|
4
4
|
"description": "A codemod to automatically add withZephyr plugin to bundler configurations",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@types/node": "^24.5.2",
|
|
39
39
|
"@rslib/core": "^0.13.3",
|
|
40
40
|
"typescript": "^5.9.2",
|
|
41
|
-
"zephyr-rsbuild-plugin": "0.1.2"
|
|
41
|
+
"zephyr-rsbuild-plugin": "0.1.3-next.2"
|
|
42
42
|
},
|
|
43
43
|
"keywords": [
|
|
44
44
|
"zephyr",
|