Добавил сборку под платформы linux и win

This commit is contained in:
Book Pauk
2019-01-04 23:03:47 +07:00
parent abd92b2f1d
commit 32b6038deb
5 changed files with 197 additions and 5 deletions

View File

@@ -0,0 +1,33 @@
const path = require("path");
const webpack = require("webpack");
const CleanWebpackPlugin = require('clean-webpack-plugin');
const DisableOutputWebpackPlugin = require('disable-output-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const distDir = path.resolve(__dirname, '../dist');
const outDir = `${distDir}/linux`;
module.exports = {
mode: 'production',
entry: `${distDir}/public/index.html`,
output: {
path: outDir
},
module: {
rules: [
{
test: /\.html$/,
use: 'null-loader'
}
]
},
plugins: [
new CleanWebpackPlugin([outDir], {root: distDir}),
new DisableOutputWebpackPlugin(),
new CopyWebpackPlugin([
{ from: `${distDir}/public`, to: `${outDir}/public` }
]
),
]
};

View File

@@ -36,7 +36,7 @@ module.exports = merge(baseWpConfig, {
]
},
plugins: [
new CleanWebpackPlugin([`${publicDir}`], {root: path.resolve(__dirname, '..')}),
new CleanWebpackPlugin([publicDir], {root: path.resolve(__dirname, '..')}),
new MiniCssExtractPlugin({
filename: "[name].[contenthash].css"
}),

View File

@@ -0,0 +1,33 @@
const path = require("path");
const webpack = require("webpack");
const CleanWebpackPlugin = require('clean-webpack-plugin');
const DisableOutputWebpackPlugin = require('disable-output-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const distDir = path.resolve(__dirname, '../dist');
const outDir = `${distDir}/win`;
module.exports = {
mode: 'production',
entry: `${distDir}/public/index.html`,
output: {
path: outDir
},
module: {
rules: [
{
test: /\.html$/,
use: 'null-loader'
}
]
},
plugins: [
new CleanWebpackPlugin([outDir], {root: distDir}),
new DisableOutputWebpackPlugin(),
new CopyWebpackPlugin([
{ from: `${distDir}/public`, to: `${outDir}/public` }
]
),
]
};

124
package-lock.json generated
View File

@@ -2329,6 +2329,118 @@
"integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=",
"dev": true
},
"copy-webpack-plugin": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-4.6.0.tgz",
"integrity": "sha512-Y+SQCF+0NoWQryez2zXn5J5knmr9z/9qSQt7fbL78u83rxmigOy8X5+BFn8CFSuX+nKT8gpYwJX68ekqtQt6ZA==",
"dev": true,
"requires": {
"cacache": "^10.0.4",
"find-cache-dir": "^1.0.0",
"globby": "^7.1.1",
"is-glob": "^4.0.0",
"loader-utils": "^1.1.0",
"minimatch": "^3.0.4",
"p-limit": "^1.0.0",
"serialize-javascript": "^1.4.0"
},
"dependencies": {
"cacache": {
"version": "10.0.4",
"resolved": "https://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz",
"integrity": "sha512-Dph0MzuH+rTQzGPNT9fAnrPmMmjKfST6trxJeK7NQuHRaVw24VzPRWTmg9MpcwOVQZO0E1FBICUlFeNaKPIfHA==",
"dev": true,
"requires": {
"bluebird": "^3.5.1",
"chownr": "^1.0.1",
"glob": "^7.1.2",
"graceful-fs": "^4.1.11",
"lru-cache": "^4.1.1",
"mississippi": "^2.0.0",
"mkdirp": "^0.5.1",
"move-concurrently": "^1.0.1",
"promise-inflight": "^1.0.1",
"rimraf": "^2.6.2",
"ssri": "^5.2.4",
"unique-filename": "^1.1.0",
"y18n": "^4.0.0"
}
},
"globby": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/globby/-/globby-7.1.1.tgz",
"integrity": "sha1-+yzP+UAfhgCUXfral0QMypcrhoA=",
"dev": true,
"requires": {
"array-union": "^1.0.1",
"dir-glob": "^2.0.0",
"glob": "^7.1.2",
"ignore": "^3.3.5",
"pify": "^3.0.0",
"slash": "^1.0.0"
}
},
"ignore": {
"version": "3.3.10",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz",
"integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==",
"dev": true
},
"lru-cache": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
"integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==",
"dev": true,
"requires": {
"pseudomap": "^1.0.2",
"yallist": "^2.1.2"
}
},
"mississippi": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/mississippi/-/mississippi-2.0.0.tgz",
"integrity": "sha512-zHo8v+otD1J10j/tC+VNoGK9keCuByhKovAvdn74dmxJl9+mWHnx6EMsDN4lgRoMI/eYo2nchAxniIbUPb5onw==",
"dev": true,
"requires": {
"concat-stream": "^1.5.0",
"duplexify": "^3.4.2",
"end-of-stream": "^1.1.0",
"flush-write-stream": "^1.0.0",
"from2": "^2.1.0",
"parallel-transform": "^1.1.0",
"pump": "^2.0.1",
"pumpify": "^1.3.3",
"stream-each": "^1.1.0",
"through2": "^2.0.0"
}
},
"pump": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz",
"integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==",
"dev": true,
"requires": {
"end-of-stream": "^1.1.0",
"once": "^1.3.1"
}
},
"ssri": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz",
"integrity": "sha512-XRSIPqLij52MtgoQavH/x/dU1qVKtWUAAZeOHsR9c2Ddi4XerFy3mc1alf+dLJKl9EUIm/Ht+EowFkTUOA6GAQ==",
"dev": true,
"requires": {
"safe-buffer": "^5.1.1"
}
},
"yallist": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=",
"dev": true
}
}
},
"core-js": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.1.tgz",
@@ -3019,6 +3131,12 @@
"path-type": "^3.0.0"
}
},
"disable-output-webpack-plugin": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/disable-output-webpack-plugin/-/disable-output-webpack-plugin-1.0.1.tgz",
"integrity": "sha512-fT4qiosyTqteTKDbYLXISMKzMVbl2dMXbMpUN3VPAUxX9JL81MmOilisbX555W1XS4B6FRzQt9zMtqg1T6Jx9Q==",
"dev": true
},
"doctrine": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
@@ -6293,6 +6411,12 @@
"boolbase": "~1.0.0"
}
},
"null-loader": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/null-loader/-/null-loader-0.1.1.tgz",
"integrity": "sha1-F76av80/8OFRL2/Er8sfUDk3j64=",
"dev": true
},
"number-is-nan": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",

View File

@@ -7,11 +7,10 @@
"scripts": {
"dev": "nodemon --inspect server",
"build:client": "webpack --config build/webpack.prod.config.js",
"build:client-dev": "webpack --config build/webpack.dev.config.js",
"build:linux": "npm run build:client && pkg -t latest-linux-x64 -o dist/linux/liberama .",
"build:win": "npm run build:client && pkg -t latest-win-x64 -o dist/win/liberama .",
"build:linux": "npm run build:client && webpack --config build/webpack.linux.config.js && pkg -t latest-linux-x64 -o dist/linux/liberama .",
"build:win": "npm run build:client && webpack --config build/webpack.win.config.js && pkg -t latest-win-x64 -o dist/win/liberama .",
"lint": "eslint --ext=.js,.vue client server",
"build:client-dev": "webpack --config build/webpack.dev.config.js",
"postinstall": "npm run build:client-dev"
},
"bin": "server/index.js",
@@ -28,7 +27,9 @@
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-preset-env": "^1.3.2",
"clean-webpack-plugin": "^1.0.0",
"copy-webpack-plugin": "^4.6.0",
"css-loader": "^1.0.0",
"disable-output-webpack-plugin": "^1.0.1",
"element-theme-chalk": "^2.4.11",
"eslint": "^5.11.1",
"eslint-plugin-html": "^5.0.0",
@@ -37,6 +38,7 @@
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.5.0",
"null-loader": "^0.1.1",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"pkg": "^4.3.5",
"terser-webpack-plugin": "^1.2.1",