Skip to content

Commit cf638ef

Browse files
committed
docs: document alternative approach for local development
Whilst recently attempting to test some changes to the webpack config we struggled to get `npm link` to work. We ended up using an alternative approach using `npm pack` which generates a tarball of the npm package which you can then `npm install` into your other project. In order to help future developers who find themselves in a similar situation I thought it was worth documenting this alternative approach.
1 parent b22da21 commit cf638ef

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

README.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,32 @@ Then go to [http://localhost:8601/](http://localhost:8601/) - the playground out
4343

4444
## Developing alongside other Scratch repositories
4545

46-
### Getting another repo to point to this code
46+
### Getting another repo to point to this code (using `npm pack`)
4747

48+
If you struggle to get npm link working then this approach might be for you.
49+
50+
1. Make your code changes to the scratch-gui code.
51+
2. Rebuild the scratch-gui project:
52+
53+
```
54+
BUILD_MODE=dist npm run build
55+
```
56+
57+
3. Build the scratch-gui npm package locally (this will create a gzipped tarball e.g RaspberryPiFoundation-scratch-gui-4.1.0-beta.1.tgz).
58+
59+
```
60+
npm pack
61+
```
62+
63+
4. npm install and rebuild your other project (using the gzipped tarball):
64+
65+
```
66+
cd ../other-project
67+
npm install ../scratch-gui/RaspberryPiFoundation-scratch-gui-4.1.0-beta.1.tgz --force
68+
npm run build
69+
```
70+
71+
### Getting another repo to point to this code (using `npm link`)
4872

4973
If you wish to develop `scratch-gui` alongside other scratch repositories that depend on it, you may wish
5074
to have the other repositories use your local `scratch-gui` build instead of fetching the current production

0 commit comments

Comments
 (0)