Skip to content

Commit 8f32865

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 2a8a4b5 commit 8f32865

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

README.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ 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 link`)
4747

4848

4949
If you wish to develop `scratch-gui` alongside other scratch repositories that depend on it, you may wish
@@ -82,6 +82,31 @@ If you can't get linking to work right, try:
8282
repositories, make sure to use the same node version in all of them.
8383
* If nothing else works, unlink the repositories by running `npm unlink` in both, and start over.
8484

85+
##### Getting another repo to point to this code (using `npm pack`)
86+
87+
If you struggle to get npm link working then this alternative approach might be for you.
88+
89+
1. Make your code changes to the scratch-gui code.
90+
2. Rebuild the scratch-gui project:
91+
92+
```
93+
BUILD_MODE=dist npm run build
94+
```
95+
96+
3. Build the scratch-gui npm package locally (this will create a gzipped tarball e.g ScratchFoundation-scratch-gui-4.1.0-beta.1.tgz).
97+
98+
```
99+
npm pack
100+
```
101+
102+
4. npm install and rebuild your other project (using the gzipped tarball):
103+
104+
```
105+
cd ../other-project
106+
npm install ../scratch-gui/RaspberryPiFoundation-scratch-gui-4.1.0-beta.1.tgz --force
107+
npm run build
108+
```
109+
85110
## Testing
86111

87112
### Documentation

0 commit comments

Comments
 (0)