soiz1 commited on
Commit
0d9df3a
Β·
verified Β·
1 Parent(s): b18238f

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. ORIGINAL_README.md +298 -0
ORIGINAL_README.md ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ sdk: docker
3
+ app_port: 3000
4
+ ---
5
+ scratch-gui modified for use in [TurboWarp](https://turbowarp.org/) then modified for use in [PenguinMod](https://studio.penguinmod.com) πŸ˜€
6
+ [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/PenguinMod/penguinmod.github.io/)
7
+ ## Setup
8
+
9
+ See https://docs.turbowarp.org/development/getting-started to setup the complete TurboWarp environment.
10
+
11
+ If you just want to play with the GUI then it's the same process as upstream scratch-gui.
12
+
13
+ ## License
14
+
15
+ TurboWarp's modifications to Scratch are licensed under the GNU General Public License v3.0. See LICENSE or https://www.gnu.org/licenses/ for details.
16
+
17
+ The following is the original license for scratch-gui, which we are required to retain. This is NOT the license of this project.
18
+
19
+ ```
20
+ Copyright (c) 2016, Massachusetts Institute of Technology
21
+ All rights reserved.
22
+
23
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
24
+
25
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
26
+
27
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
28
+
29
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
30
+
31
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ ```
33
+
34
+ src/lib/default-project/dango.svg is based on [Twemoji](https://twemoji.twitter.com/) and is licensed under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
35
+
36
+ <!--
37
+
38
+ # scratch-gui
39
+ #### Scratch GUI is a set of React components that comprise the interface for creating and running Scratch 3.0 projects
40
+
41
+ ## Installation
42
+ This requires you to have Git and Node.js installed.
43
+
44
+ In your own node environment/application:
45
+ ```bash
46
+ npm install https://github.com/LLK/scratch-gui.git
47
+ ```
48
+ If you want to edit/play yourself:
49
+ ```bash
50
+ git clone https://github.com/LLK/scratch-gui.git
51
+ cd scratch-gui
52
+ npm install
53
+ ```
54
+
55
+ **You may want to add `--depth=1` to the `git clone` command because there are some [large files in the git repository history](https://github.com/LLK/scratch-gui/issues/5140).**
56
+
57
+ ## Getting started
58
+ Running the project requires Node.js to be installed.
59
+
60
+ ## Running
61
+ Open a Command Prompt or Terminal in the repository and run:
62
+ ```bash
63
+ npm start
64
+ ```
65
+ Then go to [http://localhost:8601/](http://localhost:8601/) - the playground outputs the default GUI component
66
+
67
+ ## Developing alongside other Scratch repositories
68
+
69
+ ### Getting another repo to point to this code
70
+
71
+
72
+ If you wish to develop `scratch-gui` alongside other scratch repositories that depend on it, you may wish
73
+ to have the other repositories use your local `scratch-gui` build instead of fetching the current production
74
+ version of the scratch-gui that is found by default using `npm install`.
75
+
76
+ Here's how to link your local `scratch-gui` code to another project's `node_modules/scratch-gui`.
77
+
78
+ #### Configuration
79
+
80
+ 1. In your local `scratch-gui` repository's top level:
81
+ 1. Make sure you have run `npm install`
82
+ 2. Build the `dist` directory by running `BUILD_MODE=dist npm run build`
83
+ 3. Establish a link to this repository by running `npm link`
84
+
85
+ 2. From the top level of each repository (such as `scratch-www`) that depends on `scratch-gui`:
86
+ 1. Make sure you have run `npm install`
87
+ 2. Run `npm link scratch-gui`
88
+ 3. Build or run the repository
89
+
90
+ #### Using `npm run watch`
91
+
92
+ 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.
93
+
94
+ #### Oh no! It didn't work!
95
+
96
+ If you can't get linking to work right, try:
97
+ * Follow the recipe above step by step and don't change the order. It is especially important to run `npm install` _before_ `npm link` as installing after the linking will reset the linking.
98
+ * 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/`.
99
+ * 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.
100
+ * If nothing else works, unlink the repositories by running `npm unlink` in both, and start over.
101
+
102
+ ## Testing
103
+ ### Documentation
104
+
105
+ You may want to review the documentation for [Jest](https://facebook.github.io/jest/docs/en/api.html) and [Enzyme](http://airbnb.io/enzyme/docs/api/) as you write your tests.
106
+
107
+ See [jest cli docs](https://facebook.github.io/jest/docs/en/cli.html#content) for more options.
108
+
109
+ ### Running tests
110
+
111
+ *NOTE: If you're a Windows user, please run these scripts in Windows `cmd.exe` instead of Git Bash/MINGW64.*
112
+
113
+ Before running any tests, make sure you have run `npm install` from this (scratch-gui) repository's top level.
114
+
115
+ #### Main testing command
116
+
117
+ To run linter, unit tests, build, and integration tests, all at once:
118
+ ```bash
119
+ npm test
120
+ ```
121
+
122
+ #### Running unit tests
123
+
124
+ To run unit tests in isolation:
125
+ ```bash
126
+ npm run test:unit
127
+ ```
128
+
129
+ To run unit tests in watch mode (watches for code changes and continuously runs tests):
130
+ ```bash
131
+ npm run test:unit -- --watch
132
+ ```
133
+
134
+ You can run a single file of integration tests (in this example, the `button` tests):
135
+
136
+ ```bash
137
+ $(npm bin)/jest --runInBand test/unit/components/button.test.jsx
138
+ ```
139
+
140
+ #### Running integration tests
141
+
142
+ Integration tests use a headless browser to manipulate the actual HTML and javascript that the repo
143
+ produces. You will not see this activity (though you can hear it when sounds are played!).
144
+
145
+ Note that integration tests require you to first create a build that can be loaded in a browser:
146
+
147
+ ```bash
148
+ npm run build
149
+ ```
150
+
151
+ Then, you can run all integration tests:
152
+
153
+ ```bash
154
+ npm run test:integration
155
+ ```
156
+
157
+ Or, you can run a single file of integration tests (in this example, the `backpack` tests):
158
+
159
+ ```bash
160
+ $(npm bin)/jest --runInBand test/integration/backpack.test.js
161
+ ```
162
+
163
+ If you want to watch the browser as it runs the test, rather than running headless, use:
164
+
165
+ ```bash
166
+ USE_HEADLESS=no $(npm bin)/jest --runInBand test/integration/backpack.test.js
167
+ ```
168
+
169
+ ## Troubleshooting
170
+
171
+ ### Ignoring optional dependencies
172
+
173
+ When running `npm install`, you can get warnings about optional dependencies:
174
+
175
+ ```
176
+ npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
177
+ npm WARN notsup Not compatible with your operating system or architecture: [email protected]
178
+ ```
179
+
180
+ You can suppress them by adding the `no-optional` switch:
181
+
182
+ ```
183
+ npm install --no-optional
184
+ ```
185
+
186
+ Further reading: [Stack Overflow](https://stackoverflow.com/questions/36725181/not-compatible-with-your-operating-system-or-architecture-fsevents1-0-11)
187
+
188
+ ### Resolving dependencies
189
+
190
+ When installing for the first time, you can get warnings that need to be resolved:
191
+
192
+ ```
193
+ npm WARN [email protected] requires a peer of babel-eslint@^8.0.1 but none was installed.
194
+ npm WARN [email protected] requires a peer of eslint@^4.0 but none was installed.
195
+ npm WARN [email protected] requires a peer of react-intl-redux@^0.7 but none was installed.
196
+ npm WARN [email protected] requires a peer of react-responsive@^4 but none was installed.
197
+ ```
198
+
199
+ You can check which versions are available:
200
+
201
+ ```
202
+ npm view react-intl-redux@0.* version
203
+ ```
204
+
205
+ You will need to install the required version:
206
+
207
+ ```
208
+ npm install --no-optional --save-dev react-intl-redux@^0.7
209
+ ```
210
+
211
+ The dependency itself might have more missing dependencies, which will show up like this:
212
+
213
+ ```
214
+ user@machine:~/sources/scratch/scratch-gui (491-translatable-library-objects)$ npm install --no-optional --save-dev react-intl-redux@^0.7
215
+ [email protected] /media/cuideigin/Linux/sources/scratch/scratch-gui
216
+ β”œβ”€β”€ [email protected]
217
+ └── UNMET PEER DEPENDENCY [email protected]
218
+ ```
219
+
220
+ You will need to install those as well:
221
+
222
+ ```
223
+ npm install --no-optional --save-dev react-responsive@^5.0.0
224
+ ```
225
+
226
+ Further reading: [Stack Overflow](https://stackoverflow.com/questions/46602286/npm-requires-a-peer-of-but-all-peers-are-in-package-json-and-node-modules)
227
+
228
+ ## Troubleshooting
229
+
230
+ If you run into npm install errors, try these steps:
231
+ 1. run `npm cache clean --force`
232
+ 2. Delete the node_modules directory
233
+ 3. Delete package-lock.json
234
+ 4. run `npm install` again
235
+
236
+ ## Publishing to GitHub Pages
237
+ You can publish the GUI to github.io so that others on the Internet can view it.
238
+ [Read the wiki for a step-by-step guide.](https://github.com/LLK/scratch-gui/wiki/Publishing-to-GitHub-Pages)
239
+
240
+ ## Understanding the project state machine
241
+
242
+ Since so much code throughout scratch-gui depends on the state of the project, which goes through many different phases of loading, displaying and saving, we created a "finite state machine" to make it clear which state it is in at any moment. This is contained in the file src/reducers/project-state.js .
243
+
244
+ It can be hard to understand the code in src/reducers/project-state.js . There are several types of data and functions used, which relate to each other:
245
+
246
+ ### Loading states
247
+
248
+ These include state constant strings like:
249
+
250
+ * `NOT_LOADED` (the default state),
251
+ * `ERROR`,
252
+ * `FETCHING_WITH_ID`,
253
+ * `LOADING_VM_WITH_ID`,
254
+ * `REMIXING`,
255
+ * `SHOWING_WITH_ID`,
256
+ * `SHOWING_WITHOUT_ID`,
257
+ * etc.
258
+
259
+ ### Transitions
260
+
261
+ These are names for the action which causes a state change. Some examples are:
262
+
263
+ * `START_FETCHING_NEW`,
264
+ * `DONE_FETCHING_WITH_ID`,
265
+ * `DONE_LOADING_VM_WITH_ID`,
266
+ * `SET_PROJECT_ID`,
267
+ * `START_AUTO_UPDATING`,
268
+
269
+ ### How transitions relate to loading states
270
+
271
+ Like this diagram of the project state machine shows, various transition actions can move us from one loading state to another:
272
+
273
+ ![Project state diagram](docs/project_state_diagram.svg)
274
+
275
+ _Note: for clarity, the diagram above excludes states and transitions relating to error handling._
276
+
277
+ #### Example
278
+
279
+ Here's an example of how states transition.
280
+
281
+ Suppose a user clicks on a project, and the page starts to load with URL https://scratch.mit.edu/projects/123456 .
282
+
283
+ Here's what will happen in the project state machine:
284
+
285
+ ![Project state example](docs/project_state_example.png)
286
+
287
+ 1. When the app first mounts, the project state is `NOT_LOADED`.
288
+ 2. The `SET_PROJECT_ID` redux action is dispatched (from src/lib/project-fetcher-hoc.jsx), with `projectId` set to `123456`. This transitions the state from `NOT_LOADED` to `FETCHING_WITH_ID`.
289
+ 3. The `FETCHING_WITH_ID` state. In src/lib/project-fetcher-hoc.jsx, the `projectId` value `123456` is used to request the data for that project from the server.
290
+ 4. When the server responds with the data, src/lib/project-fetcher-hoc.jsx dispatches the `DONE_FETCHING_WITH_ID` action, with `projectData` set. This transitions the state from `FETCHING_WITH_ID` to `LOADING_VM_WITH_ID`.
291
+ 5. The `LOADING_VM_WITH_ID` state. In src/lib/vm-manager-hoc.jsx, we load the `projectData` into Scratch's virtual machine ("the vm").
292
+ 6. When loading is done, src/lib/vm-manager-hoc.jsx dispatches the `DONE_LOADING_VM_WITH_ID` action. This transitions the state from `LOADING_VM_WITH_ID` to `SHOWING_WITH_ID`
293
+ 7. The `SHOWING_WITH_ID` state. Now the project appears normally and is playable and editable.
294
+
295
+ ## Donate
296
+ We provide [Scratch](https://scratch.mit.edu) free of charge, and want to keep it that way! Please consider making a [donation](https://secure.donationpay.org/scratchfoundation/) to support our continued engineering, design, community, and resource development efforts. Donations of any size are appreciated. Thank you!
297
+
298
+ -->