Skip to content

Commit

Permalink
able to build n launch
Browse files Browse the repository at this point in the history
  • Loading branch information
Jing Teng committed Jul 7, 2021
1 parent afdc7eb commit 75aa709
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"type": "commonjs",
"name": "zap",
"version": "0.99.6",
"description": "Configuration tool for the Zigbee Cluster Library",
Expand All @@ -14,6 +15,7 @@
"homepage": "https://github.com/project-chip/zap",
"main": "src-electron/main-process/electron-main.js",
"scripts": {
"wp": "npm run version-stamp && webpack -c webpack.main.config.js --progress",
"lic": "node src-script/license-check.js --production",
"lint": "eslint --ext .js,.vue src src-electron src-shared src-script test",
"lintfix": "eslint --fix --ext .js,.vue src src-electron src-shared src-script test",
Expand All @@ -25,6 +27,7 @@
"test:unit:watch": "jest --watch",
"test:unit:watchAll": "jest --watchAll",
"postinstall": "electron-builder install-app-deps && husky install",
"wpzap": "quasar build && npm run wp && npx electron ./dist/electron-main.js",
"zap": "node src-script/zap-start.js --logToStdout --gen ./test/gen-template/zigbee/gen-templates.json",
"zap-dev": "npm run build-spa && quasar dev -m electron",
"zap-devserver": "node src-script/zap-start.js server --allowCors --logToStdout --gen ./test/gen-template/zigbee/gen-templates.json --reuseZapInstance",
Expand Down Expand Up @@ -141,7 +144,8 @@
"prettier": "^2.2.1",
"pretty-quick": "^3.1.0",
"quasar": "^1.15.10",
"webpack-cli": "^4.7.2"
"webpack-cli": "^4.7.2",
"webpack-node-externals": "^2.5.2"
},
"engines": {
"node": ">= 8.9.0",
Expand Down
3 changes: 0 additions & 3 deletions quasar.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ module.exports = function (ctx) {
test: /\.(sql)$/,
loader: 'file-loader',
exclude: /node_modules/,
options: {
name: '[path][name].[ext]',
},
})
},
},
Expand Down
33 changes: 30 additions & 3 deletions webpack.main.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,45 @@
const path = require('path')

const nodeExternals = require('webpack-node-externals')

const config = {
node: {
__dirname: true,
__filename: true,
},
mode: 'development',
target: 'node',
target: 'electron-main',
entry:
path.resolve(__dirname, 'src-electron') + '/main-process/electron-main.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'main.js',
filename: 'electron-main.js',
},
module: {
rules: [{ test: /\.js$/, exclude: /node_modules/, use: 'babel-loader' }],
rules: [
{
enforce: 'pre',
test: /\.js$/,
loader: 'eslint-loader',
exclude: /node_modules/,
options: {
formatter: require('eslint').CLIEngine.getFormatter('stylish'),
},
},
{ test: /\.js$/, exclude: /node_modules/, use: 'babel-loader' },
{
enforce: 'pre',
test: /\.(sql)$/,
loader: 'file-loader',
exclude: /node_modules/,
options: {
name: '[path][name].[ext]',
},
},
],
},
devtool: 'source-map',
externals: [nodeExternals()], // in order to ignore all modules in node_modules folder
}

module.exports = config

0 comments on commit 75aa709

Please sign in to comment.