Skip to content

Commit d9ffbd6

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 7e28b0e commit d9ffbd6

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
@@ -100,7 +100,7 @@ Then go to [http://localhost:8601/](http://localhost:8601/) - the playground out
100100

101101
## Developing alongside other Scratch repositories
102102

103-
### Getting another repo to point to this code
103+
### Getting another repo to point to this code (using `npm link`)
104104

105105

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

142+
##### Getting another repo to point to this code (using `npm pack`)
143+
144+
If you struggle to get npm link working then this alternative approach might be for you.
145+
146+
1. Make your code changes to the scratch-gui code.
147+
2. Rebuild the scratch-gui project:
148+
149+
```
150+
BUILD_MODE=dist npm run build
151+
```
152+
153+
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).
154+
155+
```
156+
npm pack
157+
```
158+
159+
4. npm install and rebuild your other project (using the gzipped tarball):
160+
161+
```
162+
cd ../other-project
163+
npm install ../scratch-gui/RaspberryPiFoundation-scratch-gui-4.1.0-beta.1.tgz --force
164+
npm run build
165+
```
166+
142167
## Testing
143168

144169
### Documentation

0 commit comments

Comments
 (0)