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
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,4 +3,5 @@ node_modules/
|
|||||||
*~
|
*~
|
||||||
*.log
|
*.log
|
||||||
out/
|
out/
|
||||||
.DS_Store
|
.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 = {
|
module.exports = {
|
||||||
packagerConfig: {},
|
packagerConfig: {
|
||||||
|
ignore: ignoreFn,
|
||||||
|
files: [
|
||||||
|
"package.json",
|
||||||
|
"dist/*",
|
||||||
|
"static/*",
|
||||||
|
"node_modules/lzma-native/**",
|
||||||
|
"node_modules/fs-ext/**",
|
||||||
|
"node_modules/fsevents/**",
|
||||||
|
],
|
||||||
|
},
|
||||||
rebuildConfig: {},
|
rebuildConfig: {},
|
||||||
makers: [
|
makers: [
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "sh2",
|
"name": "ScriptHaus",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "dist/emain-dev.js",
|
"main": "dist/emain-dev.js",
|
||||||
"license": "Proprietary",
|
"license": "Proprietary",
|
||||||
|
@ -6,12 +6,25 @@
|
|||||||
node_modules/.bin/webpack --watch --config webpack.dev.js
|
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
|
```bash
|
||||||
# @scripthaus command webpack-electron-watch
|
# @scripthaus command webpack-electron-watch
|
||||||
# @scripthaus cd :playbook
|
# @scripthaus cd :playbook
|
||||||
node_modules/.bin/webpack --watch --config webpack.electron.js
|
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
|
```bash
|
||||||
# @scripthaus command electron-rebuild
|
# @scripthaus command electron-rebuild
|
||||||
# @scripthaus cd :playbook
|
# @scripthaus cd :playbook
|
||||||
@ -37,8 +50,9 @@ node_modules/.bin/tsc --jsx preserve --noEmit --esModuleInterop --target ES5 --e
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# @scripthaus command build-js
|
# @scripthaus command build-package
|
||||||
# @scripthaus cd :playbook
|
# @scripthaus cd :playbook
|
||||||
node_modules/.bin/webpack --config webpack.dev.js
|
node_modules/.bin/webpack --config webpack.dev.js
|
||||||
node_modules/.bin/webpack --config webpack.electron.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,
|
width: bounds.width,
|
||||||
height: bounds.height,
|
height: bounds.height,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(__dirname, "../src/preload.js"),
|
preload: path.join(__dirname, "../dist/preload.js"),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
win.loadFile(path.join(__dirname, "../static/index.html"));
|
win.loadFile(path.join(__dirname, "../static/index.html"));
|
||||||
|
@ -57,7 +57,7 @@ module.exports = {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new MiniCssExtractPlugin({filename: "[name].css", ignoreOrder: true})
|
new MiniCssExtractPlugin({filename: "[name].css", ignoreOrder: true}),
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.ts', '.tsx', '.js', '.mjs', '.cjs', '.wasm', '.json', '.less', '.css']
|
extensions: ['.ts', '.tsx', '.js', '.mjs', '.cjs', '.wasm', '.json', '.less', '.css']
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const CopyPlugin = require("copy-webpack-plugin");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
mode: "development",
|
mode: "development",
|
||||||
@ -45,6 +46,11 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
plugins: [
|
||||||
|
new CopyPlugin({
|
||||||
|
patterns: [{from: "src/preload.js", to: "preload.js"}],
|
||||||
|
}),
|
||||||
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.ts', '.tsx', '.js']
|
extensions: ['.ts', '.tsx', '.js']
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user