Skip to content

Commit 886bcc9

Browse files
committed
refactor: use PNPM, WinGet & Homebrew to make installation easier & faster
1 parent 2f97b42 commit 886bcc9

19 files changed

Lines changed: 44937 additions & 46 deletions

README.md

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Feature Requests](./misc/main.jpg)](https://www.yuque.com/tinkergen-help-en/codecraft?language=en-us)
44

55
**Codecraft is a graphical programming software which is based on [Scratch 3.0](https://scratch.mit.edu/). It targets teenagers of age 7-16, compatible with WIN/MAC.**
6-
By using a drag-and-drop interface, Codecraft has been helping users program without the need to write code in traditional text-based programming languages. Since its’ launch in 2018, it’s designed to make it easier for beginners, especially STEAM classrooms, to embrace coding to create projects and prototypes. With a focus on programming microcontrollers and IoT devices, Codecraft has been adapted and trusted by thousands of users all around the world. In 2022, Codecraft was recognized as [Bett Awards Finalist](https://www.seeedstudio.com/blog/2022/04/06/seeed-studio-codecraft-recognized-finalist-by-edtech-awards-2022/) and [The Edtech Awards Cool Tool Finalist](https://www.seeedstudio.com/blog/2022/04/06/seeed-studio-codecraft-recognized-finalist-by-edtech-awards-2022/), two important and in prestigious awards the education technology industry.
6+
By using a drag-and-drop interface, Codecraft has been helping users program without the need to write code in traditional text-based programming languages. Since its’ launch in 2018, it’s designed to make it easier for beginners, especially STEAM classrooms, to embrace coding to create projects and prototypes. With a focus on programming microcontrollers and IoT devices, Codecraft has been adapted and trusted by thousands of users all around the world. In 2022, Codecraft was recognized as [Bett Awards Finalist](https://www.seeedstudio.com/blog/2022/04/06/seeed-studio-codecraft-recognized-finalist-by-edtech-awards-2022/) and [The Edtech Awards Cool Tool Finalist](https://www.seeedstudio.com/blog/2022/04/06/seeed-studio-codecraft-recognized-finalist-by-edtech-awards-2022/), two important and in prestigious awards the education technology industry.
77

88
[Codecraft help online](https://www.yuque.com/tinkergen-help-en/codecraft?language=en-us)
99

@@ -30,8 +30,11 @@ You can download the latest version from [the download page from our website](ht
3030
## Prerequisites
3131

3232
This project requires:
33+
3334
- [Node.js 16+](https://nodejs.org/)
35+
- [PNPM 9+](https://pnpm.io/)
3436
- [Python 2.x](https://www.python.org/downloads/release/python-272/), or [Python 3.x](https://www.python.org/downloads/) and make it as the default version
37+
- [Java Development Kit (JDK)](https://www.oracle.com/java/technologies/downloads/)
3538

3639
### Auto Install
3740

@@ -51,83 +54,85 @@ bash run-win64.sh
5154

5255
```bash
5356
cd ./blocks
54-
npm install && npm run build
57+
pnpm install && pnpm build
5558

5659
cd ./l10n
57-
npm install && npm run build
60+
pnpm install && pnpm build
5861

5962
cd ./vm
60-
npm install && npm run build
63+
pnpm install && pnpm build
6164

6265
cd ./gui
63-
npm install
66+
pnpm install
6467
```
6568

6669
- For mac or linux like
6770

6871
```bash
69-
npm run build-mac
72+
pnpm build-mac
7073
```
7174

7275
- For win
7376

7477
```bash
75-
npm run build-win
78+
pnpm build-win
7679
```
7780

7881
Build main app
7982

8083
```bash
8184
rm -r ../main/app/gui && cp -r ./build ../main/app/gui
8285
cd ./main/app
83-
npm install
86+
pnpm install
8487
./node_modules/.bin/electron-rebuild serialport
8588

86-
# If the error message “script is prohibited on this system” appears on the Windows
87-
# system, you need to open powershell as an administrator, and then execute
89+
# If the error message “script is prohibited on this system” appears on the Windows
90+
# system, you need to open powershell as an administrator, and then execute
8891
# Set-ExecutionPolicy RemoteSigned
8992

9093
cd ./main
91-
npm install
92-
rm -r build
94+
pnpm install
95+
rm -r build
9396
```
9497

9598
- For Mac
9699

97100
```bash
98-
npm run publish-mac
101+
pnpm publish-mac
99102
```
100103

101104
- For Linux like
102105

103106
```bash
104-
npm run publish-linux
107+
pnpm publish-linux
105108
```
106109

107110
- For Windows
108111

109112
```bash
110-
npm run publish-win64
113+
pnpm publish-win64
111114
```
112115

113116
Once you finish building, you can find the installer under main/build/
114117

115118
### Debug Mode
119+
116120
If you want to enter debug mode and debug the gui, you need to run the gui locally first. The gui depends on block, l10n, and vm, so you need to compile these three projects first.
117121

118122
```bash
119123
cd ./blocks
120-
npm install && npm run build
124+
pnpm install && pnpm build
121125

122126
cd ./l10n
123-
npm install && npm run build
127+
pnpm install && pnpm build
124128

125129
cd ./vm
126-
npm install && npm run build
130+
pnpm install && pnpm build
127131

128132
cd ./gui
129-
npm run start
133+
pnpm start
130134
```
135+
131136
At this time, a web service is running in the current terminal. localhost:8601
132137

133138
Then modify window load URL.
@@ -144,14 +149,16 @@ window.loadURL('http://localhost:8601');
144149
If you need the console, open the line.
145150
window.webContents.openDevTools();
146151
```
152+
147153
Open a new terminal
148154

149155
```bash
150156
cd ./main
151-
npm run start
157+
pnpm start
152158
```
153159

154160
## Add block and library
161+
155162
### block shape and type definition
156163

157164
block directory: blocks/blocks_vertical
@@ -161,10 +168,13 @@ block l10n directory: blocks/msg/scratch_msgs.js
161168
The block type value must start with 'argument', 'colour', 'control', 'data', 'event', 'looks', 'math', 'motion', 'operator', 'procedures', 'sensing', 'sound', 'system', 'display', 'azure', 'json', 'mqtt'. these values ​​are defined in CORE_EXTENSIONS of vm/src/serialization/sb2.js and sb3.js files
162169

163170
### block code definition
171+
164172
code directory: gui/src/lib/generators/${device}/
165173

166174
### block ui render
175+
167176
ui xml directory: gui/lib/toolboxs/toolbox-${deviceId}-xml.js
177+
168178
```bash
169179
1001: grove zero
170180
1002: arduino
@@ -178,11 +188,11 @@ ui xml directory: gui/lib/toolboxs/toolbox-${deviceId}-xml.js
178188
```
179189

180190
### arduino library
191+
181192
library directory: main/compilers/arduino-libraries/
182193

183194
You can put your arduino library in this directory
184195

185-
186196
## Contribute
187197

188198
`PR welcome`
@@ -193,5 +203,4 @@ Here, we’d also love to announce an open call for contributions to Codecraft o
193203

194204
The code contained in this repository and the executable distributions are licensed under the terms of the Apache License 2.0. The executable distributions contain third-party code licensed under other compatible licenses such as BSD-3.
195205

196-
197-
TODO: add documentation on how to create new modules
206+
TODO: add documentation on how to create new modules

blocks/.npmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
registry=https://registry.npmjs.org/
1+
node-linker = hoisted

0 commit comments

Comments
 (0)