You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-16Lines changed: 25 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,29 +30,38 @@ Then go to [http://localhost:8601/](http://localhost:8601/) - the playground out
30
30
31
31
## Developing alongside other Scratch repositories
32
32
33
-
### Linking this code to another project's `node_modules/scratch-gui`
33
+
### Getting another repo to point to this code
34
34
35
-
#### Configuration
36
35
37
-
If you wish to develop scratch-gui alongside other scratch repositories that depend on it, you may wish
38
-
to have the other repositories use your local scratch-gui build instead of fetching the current production
36
+
If you wish to develop `scratch-gui` alongside other scratch repositories that depend on it, you may wish
37
+
to have the other repositories use your local `scratch-gui` build instead of fetching the current production
39
38
version of the scratch-gui that is found by default using `npm install`.
40
39
41
-
To do this:
42
-
1. Make sure you have run `npm install` from this (scratch-gui) repository's top level
43
-
2. Make sure you have run `npm install` from the top level of each repository (such as scratch-www) that depends on scratch-gui
44
-
3. From this (scratch-gui) repository's top level, build the `dist` directory by running `BUILD_MODE=dist npm run build`
45
-
4. From this (scratch-gui) repository's top level, establish a link to this repository by running `npm link`
46
-
5. From the top level of each repository that depends on scratch-gui, run `npm link scratch-gui`
47
-
6. Build or run the repositories that depend on scratch-gui
40
+
Here's how to link your local `scratch-gui` code to another project's `node_modules/scratch-gui`.
41
+
42
+
#### Configuration
43
+
44
+
1. In your local `scratch-gui` repository's top level:
45
+
1. Make sure you have run `npm install`
46
+
2. Build the `dist` directory by running `BUILD_MODE=dist npm run build`
47
+
3. Establish a link to this repository by running `npm link`
48
48
49
-
Instead of `BUILD_MODE=dist npm run build` you can also use `BUILD_MODE=dist npm run watch`, however this may be unreliable.
49
+
2. From the top level of each repository (such as `scratch-www`) that depends on `scratch-gui`:
50
+
1. Make sure you have run `npm install`
51
+
2. Run `npm link scratch-gui`
52
+
3. Build or run the repositoriy
53
+
54
+
#### Using `npm run watch`
55
+
56
+
Instead of `BUILD_MODE=dist npm run build`, you can use `BUILD_MODE=dist npm run watch` instead. This will watch for changes to your `scratch-gui` code, and automatically rebuild when there are changes. Sometimes this has been unreliable; if you are having problems, try going back to `BUILD_MODE=dist npm run build` until you resolve them.
50
57
51
58
#### Oh no! It didn't work!
52
-
* Follow the recipe above step by step and don't change the order. It is especially important to run npm first because installing after the linking will reset the linking.
53
-
* Make sure the repositories are siblings on your machine's file tree.
54
-
* If you have multiple Terminal tabs or windows open for the different Scratch repositories, make sure to use the same node version in all of them.
55
-
* In the worst case unlink the repositories by running `npm unlink` in both, and start over.
59
+
60
+
If you can't get linking to work right, try:
61
+
* Follow the recipe above step by step and don't change the order. It is especially important to run `npm install`_before_`npm link`, because installing after the linking will reset the linking.
62
+
* Make sure the repositories are siblings on your machine's file tree, like `.../.../MY_SCRATCH_DEV_DIRECTORY/scratch-gui/` and `.../.../MY_SCRATCH_DEV_DIRECTORY/scratch-www/`.
63
+
* Consistent node.js version: If you have multiple Terminal tabs or windows open for the different Scratch repositories, make sure to use the same node version in all of them.
64
+
* If nothing else works, unlink the repositories by running `npm unlink` in both, and start over.
0 commit comments