Change tar implementation & reduce bundle (583.28kb > 471.58kb)
parent
1d8af514b0
commit
4b2a476227
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
|
@ -4,8 +4,8 @@
|
||||||
"description": "NGINX config generator on steroids",
|
"description": "NGINX config generator on steroids",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines" : {
|
"engines": {
|
||||||
"node" : "12.16.2"
|
"node": "12.16.2"
|
||||||
},
|
},
|
||||||
"main": "src/nginxconfig/mount.js",
|
"main": "src/nginxconfig/mount.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -46,12 +46,11 @@
|
||||||
"do-bulma": "git+https://github.com/do-community/do-bulma.git",
|
"do-bulma": "git+https://github.com/do-community/do-bulma.git",
|
||||||
"do-vue": "git+https://github.com/do-community/do-vue.git",
|
"do-vue": "git+https://github.com/do-community/do-vue.git",
|
||||||
"escape-html": "^1.0.3",
|
"escape-html": "^1.0.3",
|
||||||
"get-stream": "^5.1.0",
|
"pako": "^1.0.11",
|
||||||
"node-gzip": "^1.1.2",
|
|
||||||
"pretty-checkbox-vue": "^1.1.9",
|
"pretty-checkbox-vue": "^1.1.9",
|
||||||
"prismjs": "^1.20.0",
|
"prismjs": "^1.20.0",
|
||||||
"qs": "^6.9.4",
|
"qs": "^6.9.4",
|
||||||
"tar-stream": "^2.1.2",
|
"tarts": "^1.0.0",
|
||||||
"vue": "^2.6.11",
|
"vue": "^2.6.11",
|
||||||
"vue-select": "^3.10.3"
|
"vue-select": "^3.10.3"
|
||||||
},
|
},
|
||||||
|
@ -61,7 +60,7 @@
|
||||||
"duplicate-package-checker-webpack-plugin": "^3.0.0",
|
"duplicate-package-checker-webpack-plugin": "^3.0.0",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-plugin-vue": "^5.2.3",
|
"eslint-plugin-vue": "^5.2.3",
|
||||||
"sass": "^1.26.3",
|
"sass": "^1.26.7",
|
||||||
"sass-lint": "^1.13.1",
|
"sass-lint": "^1.13.1",
|
||||||
"sass-lint-auto-fix": "^0.21.0",
|
"sass-lint-auto-fix": "^0.21.0",
|
||||||
"sass-loader": "^8.0.2",
|
"sass-loader": "^8.0.2",
|
||||||
|
|
|
@ -61,9 +61,8 @@ THE SOFTWARE.
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { pack } from 'tar-stream';
|
import tar from 'tarts';
|
||||||
import getStream from 'get-stream';
|
import { gzip } from 'pako';
|
||||||
import { gzip } from 'node-gzip';
|
|
||||||
import copy from 'copy-to-clipboard';
|
import copy from 'copy-to-clipboard';
|
||||||
import i18n from '../i18n';
|
import i18n from '../i18n';
|
||||||
import * as Sections from './setup_sections';
|
import * as Sections from './setup_sections';
|
||||||
|
@ -111,26 +110,24 @@ THE SOFTWARE.
|
||||||
return undefined;
|
return undefined;
|
||||||
},
|
},
|
||||||
async tarContents() {
|
async tarContents() {
|
||||||
const tar = pack();
|
const data = [];
|
||||||
|
|
||||||
// Add all our config files to the tar
|
// Add all our config files to the tar
|
||||||
for (const fileName in this.$props.data.confFiles) {
|
for (const fileName in this.$props.data.confFiles) {
|
||||||
if (!Object.prototype.hasOwnProperty.call(this.$props.data.confFiles, fileName)) continue;
|
if (!Object.prototype.hasOwnProperty.call(this.$props.data.confFiles, fileName)) continue;
|
||||||
tar.entry({ name: fileName }, this.$props.data.confFiles[fileName]);
|
data.push({ name: fileName, content: this.$props.data.confFiles[fileName] });
|
||||||
|
|
||||||
// If symlinks are enabled and this is in sites-available, symlink to sites-enabled
|
// If symlinks are enabled and this is in sites-available, symlink to sites-enabled
|
||||||
if (this.$props.data.global.tools.symlinkVhost.computed && fileName.startsWith('sites-available'))
|
if (this.$props.data.global.tools.symlinkVhost.computed && fileName.startsWith('sites-available'))
|
||||||
tar.entry({
|
data.push({
|
||||||
name: fileName.replace(/^sites-available/, 'sites-enabled'),
|
name: fileName.replace(/^sites-available/, 'sites-enabled'),
|
||||||
type: 'symlink',
|
typeflag: '2',
|
||||||
linkname: `../${fileName}`,
|
linkname: `../${fileName}`,
|
||||||
|
content: '',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert the tar to a buffer and gzip it
|
return gzip(tar(data));
|
||||||
tar.finalize();
|
|
||||||
const raw = await getStream.buffer(tar);
|
|
||||||
return gzip(raw);
|
|
||||||
},
|
},
|
||||||
async downloadTar() {
|
async downloadTar() {
|
||||||
// Get the config files as a compressed tar
|
// Get the config files as a compressed tar
|
||||||
|
|
|
@ -25,6 +25,7 @@ THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const { LimitChunkCountPlugin } = require('webpack').optimize;
|
||||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
||||||
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
|
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
|
||||||
|
|
||||||
|
@ -32,9 +33,12 @@ module.exports = {
|
||||||
publicPath: './',
|
publicPath: './',
|
||||||
outputDir: 'dist',
|
outputDir: 'dist',
|
||||||
filenameHashing: false,
|
filenameHashing: false,
|
||||||
//productionSourceMap: false,
|
productionSourceMap: false,
|
||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
plugins: [
|
plugins: [
|
||||||
|
new LimitChunkCountPlugin({
|
||||||
|
maxChunks: 1,
|
||||||
|
}),
|
||||||
process.argv.includes('--analyze') && new BundleAnalyzerPlugin(),
|
process.argv.includes('--analyze') && new BundleAnalyzerPlugin(),
|
||||||
process.argv.includes('--analyze') && new DuplicatePackageCheckerPlugin(),
|
process.argv.includes('--analyze') && new DuplicatePackageCheckerPlugin(),
|
||||||
].filter(x => !!x),
|
].filter(x => !!x),
|
||||||
|
|
Loading…
Reference in New Issue