1、需要先安装npm,安装过程不作过多介绍了。
2、直接介绍打包成exe流程。
(1)首先在scratch-gui目录下
cd scratch-gui
npm install
设置静态文件路径
set BUILD_MODE=dist
set STATIC_PATH=static
build scratch-gui
npm run build
设置链接
npm link
(2)进入scratch-desktop目录。
cd scratch-desktop
npm install
链接scratch-gui
npm link scratch-gui
npm run build-gui
生成dist文件
npm start
(3)然后打开scratch-desktop目录下的*scripts->electron-builder-wrapper.js*文件将:注释掉(49行左右)
If ((targetGroup === 'nsis') && !(childEnvironment.CSC_LINK || childEnvironment.WIN_CSC_LINK)) {
throw new Error(NSIS build requires CSC_LINK or WIN_CSC_LINK);
}
(4)最后在刚才scratch-desktop目录下
npm run dist
完成后在scratch-desktop下的dist文件夹中即可看到scratch的安装包。