Skip to content

Commit 02a7e1a

Browse files
docs: local package dev with workspace deps (#1100)
1 parent 0b6c4f6 commit 02a7e1a

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

docs/workspace-dependencies.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Local Package Development: Managing Workspace Dependencies
2+
3+
When developing and testing Gasket packages locally, you'll need to handle workspace dependencies differently. The `replace-ws-aliases` script is essential for this process.
4+
5+
## Why It's Necessary
6+
7+
When creating a preset that uses workspace packages (marked with `workspace:*`), these dependencies won't work outside your local workspace. This becomes problematic when:
8+
9+
- Testing the preset locally with `--preset-path`
10+
- Troubleshooting preset issues
11+
- Sharing the preset with others
12+
- Using the preset in CI/CD environments
13+
14+
## How It Works
15+
16+
The script converts workspace dependencies to actual version numbers:
17+
18+
```json
19+
// Before
20+
{
21+
"dependencies": {
22+
"@gasket/plugin-1": "workspace:*",
23+
"@gasket/plugin-2": "workspace:*"
24+
}
25+
}
26+
27+
// After
28+
{
29+
"dependencies": {
30+
"@gasket/plugin-1": "^1.2.3",
31+
"@gasket/plugin-2": "^2.0.0"
32+
}
33+
}
34+
```
35+
36+
## Usage
37+
38+
1. Run the script from your workspace root:
39+
40+
```bash
41+
pnpm run replace-ws-aliases
42+
```
43+
44+
2. The script will:
45+
- Scan all package.json files in your workspace
46+
- Find all `workspace:*` references
47+
- Replace them with actual version numbers from your workspace
48+
- Update the files in place
49+
50+
3. After running the script, your preset will be ready for local testing with:
51+
52+
```bash
53+
pnpm create gasket my-app --preset-path ./path/to/preset
54+
```
55+
56+
## When to Use
57+
58+
- Before testing a preset locally
59+
- When troubleshooting preset issues
60+
- Before sharing a preset with others
61+
- When preparing a preset for CI/CD
62+
63+
## Important Notes
64+
65+
- Always run this script before testing a preset locally
66+
- The script handles all dependency types (dependencies, devDependencies, peerDependencies, optionalDependencies)
67+
- After testing, you may want to revert the changes if you're still developing the preset
68+
- The script preserves the `^` version prefix to allow for minor version updates

0 commit comments

Comments
 (0)