mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-02 18:39:05 +01:00
update packaging to create a packaged electron app for frontend
This commit is contained in:
parent
7b11999d29
commit
56a91a9601
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ node_modules/
|
||||
*.log
|
||||
out/
|
||||
.DS_Store
|
||||
bin
|
@ -1,5 +1,54 @@
|
||||
var AllowedFirstParts = {
|
||||
"package.json": true,
|
||||
"dist": true,
|
||||
"static": true,
|
||||
"node_modules": true,
|
||||
};
|
||||
|
||||
var AllowedNodeModules = {
|
||||
"lzma-native": true,
|
||||
"fs-ext": true,
|
||||
"fsevents": true,
|
||||
};
|
||||
|
||||
var modCache = {};
|
||||
|
||||
function ignoreFn(path) {
|
||||
let parts = path.split("/");
|
||||
if (parts.length <= 1) {
|
||||
return false;
|
||||
}
|
||||
let firstPart = parts[1];
|
||||
if (!AllowedFirstParts[firstPart]) {
|
||||
return true;
|
||||
}
|
||||
if (firstPart == "node_modules") {
|
||||
if (parts.length <= 2) {
|
||||
return false;
|
||||
}
|
||||
let nodeModule = parts[2];
|
||||
if (!modCache[nodeModule]) {
|
||||
modCache[nodeModule] = true;
|
||||
}
|
||||
if (!AllowedNodeModules[nodeModule]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
packagerConfig: {},
|
||||
packagerConfig: {
|
||||
ignore: ignoreFn,
|
||||
files: [
|
||||
"package.json",
|
||||
"dist/*",
|
||||
"static/*",
|
||||
"node_modules/lzma-native/**",
|
||||
"node_modules/fs-ext/**",
|
||||
"node_modules/fsevents/**",
|
||||
],
|
||||
},
|
||||
rebuildConfig: {},
|
||||
makers: [
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "sh2",
|
||||
"name": "ScriptHaus",
|
||||
"version": "1.0.0",
|
||||
"main": "dist/emain-dev.js",
|
||||
"license": "Proprietary",
|
||||
|
@ -6,12 +6,25 @@
|
||||
node_modules/.bin/webpack --watch --config webpack.dev.js
|
||||
```
|
||||
|
||||
```bash
|
||||
# @scripthaus command webpack-build
|
||||
# @scripthaus cd :playbook
|
||||
node_modules/.bin/webpack --config webpack.dev.js
|
||||
```
|
||||
|
||||
|
||||
```bash
|
||||
# @scripthaus command webpack-electron-watch
|
||||
# @scripthaus cd :playbook
|
||||
node_modules/.bin/webpack --watch --config webpack.electron.js
|
||||
```
|
||||
|
||||
```bash
|
||||
# @scripthaus command webpack-electron-build
|
||||
# @scripthaus cd :playbook
|
||||
node_modules/.bin/webpack --config webpack.electron.js
|
||||
```
|
||||
|
||||
```bash
|
||||
# @scripthaus command electron-rebuild
|
||||
# @scripthaus cd :playbook
|
||||
@ -37,8 +50,9 @@ node_modules/.bin/tsc --jsx preserve --noEmit --esModuleInterop --target ES5 --e
|
||||
```
|
||||
|
||||
```bash
|
||||
# @scripthaus command build-js
|
||||
# @scripthaus command build-package
|
||||
# @scripthaus cd :playbook
|
||||
node_modules/.bin/webpack --config webpack.dev.js
|
||||
node_modules/.bin/webpack --config webpack.electron.js
|
||||
node_modules/.bin/electron-forge make
|
||||
```
|
||||
|
@ -115,7 +115,7 @@ function createMainWindow(clientData) {
|
||||
width: bounds.width,
|
||||
height: bounds.height,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, "../src/preload.js"),
|
||||
preload: path.join(__dirname, "../dist/preload.js"),
|
||||
},
|
||||
});
|
||||
win.loadFile(path.join(__dirname, "../static/index.html"));
|
||||
|
@ -57,7 +57,7 @@ module.exports = {
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new MiniCssExtractPlugin({filename: "[name].css", ignoreOrder: true})
|
||||
new MiniCssExtractPlugin({filename: "[name].css", ignoreOrder: true}),
|
||||
],
|
||||
resolve: {
|
||||
extensions: ['.ts', '.tsx', '.js', '.mjs', '.cjs', '.wasm', '.json', '.less', '.css']
|
||||
|
@ -1,4 +1,5 @@
|
||||
const path = require("path");
|
||||
const CopyPlugin = require("copy-webpack-plugin");
|
||||
|
||||
module.exports = {
|
||||
mode: "development",
|
||||
@ -45,6 +46,11 @@ module.exports = {
|
||||
},
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new CopyPlugin({
|
||||
patterns: [{from: "src/preload.js", to: "preload.js"}],
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
extensions: ['.ts', '.tsx', '.js']
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user