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