mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-14 03:52:07 +08:00
1
This commit is contained in:
10
package.json
10
package.json
@@ -12,7 +12,8 @@
|
||||
"build-l": "electron-builder -l",
|
||||
"web-start": "egg-scripts start --daemon --title=electron-egg --ignore-stderr --env=prod --workers=1",
|
||||
"web-stop": "egg-scripts stop --title=electron-egg",
|
||||
"web-dev": "egg-bin dev"
|
||||
"web-dev": "egg-bin dev",
|
||||
"rd": "node ./tools/replace_dist --dist_dir=./frontend/dist"
|
||||
},
|
||||
"build": {
|
||||
"productName": "electron-egg",
|
||||
@@ -87,17 +88,18 @@
|
||||
"author": "wallace5303",
|
||||
"license": "Apache",
|
||||
"devDependencies": {
|
||||
"devtron": "^1.4.0",
|
||||
"electron": "^8.4.1",
|
||||
"electron-builder": "^22.7.0",
|
||||
"autod": "^3.0.1",
|
||||
"autod-egg": "^1.1.0",
|
||||
"devtron": "^1.4.0",
|
||||
"egg-bin": "^4.12.3",
|
||||
"egg-ci": "^1.11.0",
|
||||
"egg-mock": "^3.21.0",
|
||||
"electron": "^8.4.1",
|
||||
"electron-builder": "^22.7.0",
|
||||
"eslint": "^5.13.0",
|
||||
"eslint-config-egg": "^7.1.0",
|
||||
"eslint-plugin-prettier": "^3.0.1",
|
||||
"fs-extra": "^9.1.0",
|
||||
"prettier": "^1.16.4",
|
||||
"webstorm-disable-index": "^1.2.0"
|
||||
},
|
||||
|
||||
30
tools/replace_dist.js
Normal file
30
tools/replace_dist.js
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const fsPro = require('fs-extra');
|
||||
|
||||
console.log('moving frontend asset to egg public dir');
|
||||
|
||||
// argv
|
||||
let distDir = '';
|
||||
for (let i = 0; i < process.argv.length; i++) {
|
||||
const tmpArgv = process.argv[i]
|
||||
if (tmpArgv.indexOf('--dist_dir=') !== -1) {
|
||||
distDir = tmpArgv.substr(11)
|
||||
}
|
||||
}
|
||||
|
||||
const sourceDir = path.normalize(distDir);
|
||||
distDir = path.normalize('./app/public');
|
||||
|
||||
// del dir and move
|
||||
fs.rmdirSync(distDir, {recursive: true});
|
||||
fsPro.copySync(sourceDir, distDir);
|
||||
|
||||
// replace ejs
|
||||
const sourceFile = path.normalize(distDir + '/index.html');
|
||||
const distFile = path.normalize( './app/view/index.ejs');
|
||||
fsPro.copySync(sourceFile, distFile);
|
||||
|
||||
console.log('Move over');
|
||||
|
||||
Reference in New Issue
Block a user