Skip to content

Commit 72bcaca

Browse files
authored
Merge pull request #8 from RaspberryPiFoundation/seb-testing-locally-instructions
**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.
2 parents b22da21 + 276c402 commit 72bcaca

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

README.md

+26-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +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
47-
46+
### Getting another repo to point to this code (using `npm link`)
4847

4948
If you wish to develop `scratch-gui` alongside other scratch repositories that depend on it, you may wish
5049
to have the other repositories use your local `scratch-gui` build instead of fetching the current production
@@ -82,6 +81,31 @@ If you can't get linking to work right, try:
8281
repositories, make sure to use the same node version in all of them.
8382
* If nothing else works, unlink the repositories by running `npm unlink` in both, and start over.
8483

84+
##### Getting another repo to point to this code (using `npm pack`)
85+
86+
If you struggle to get npm link working then this alternative approach might be for you.
87+
88+
1. Make your code changes to the scratch-gui code.
89+
2. Rebuild the scratch-gui project:
90+
91+
```
92+
BUILD_MODE=dist npm run build
93+
```
94+
95+
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).
96+
97+
```
98+
npm pack
99+
```
100+
101+
4. npm install and rebuild your other project (using the gzipped tarball):
102+
103+
```
104+
cd ../other-project
105+
npm install ../scratch-gui/RaspberryPiFoundation-scratch-gui-4.1.0-beta.1.tgz --force
106+
npm run build
107+
```
108+
85109
## Testing
86110

87111
### Documentation

0 commit comments

Comments
 (0)