mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-22 17:10:26 +03:00
Added zipt dist generation to build script
This commit is contained in:
parent
f3233f845d
commit
16141ccdb3
3 changed files with 35 additions and 3 deletions
|
@ -35,6 +35,7 @@
|
|||
"uuid": "^3.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"adm-zip": "^0.4.11",
|
||||
"autoprefixer": "7.1.6",
|
||||
"babel-core": "6.26.0",
|
||||
"babel-eslint": "7.2.3",
|
||||
|
@ -47,7 +48,6 @@
|
|||
"css-loader": "0.28.7",
|
||||
"dotenv": "4.0.0",
|
||||
"dotenv-expand": "4.2.0",
|
||||
"extract-text-webpack-plugin": "^3.0.2",
|
||||
"enzyme": "^3.3.0",
|
||||
"enzyme-adapter-react-16": "^1.1.1",
|
||||
"eslint": "4.10.0",
|
||||
|
@ -57,6 +57,7 @@
|
|||
"eslint-plugin-import": "2.8.0",
|
||||
"eslint-plugin-jsx-a11y": "5.1.1",
|
||||
"eslint-plugin-react": "7.4.0",
|
||||
"extract-text-webpack-plugin": "^3.0.2",
|
||||
"file-loader": "1.1.5",
|
||||
"fs-extra": "3.0.1",
|
||||
"html-webpack-plugin": "2.29.0",
|
||||
|
@ -67,8 +68,8 @@
|
|||
"postcss-loader": "2.0.8",
|
||||
"raf": "3.4.0",
|
||||
"react-dev-utils": "^5.0.1",
|
||||
"sass-loader": "^7.0.1",
|
||||
"resolve": "1.6.0",
|
||||
"sass-loader": "^7.0.1",
|
||||
"style-loader": "0.19.0",
|
||||
"sw-precache-webpack-plugin": "0.11.4",
|
||||
"url-loader": "0.6.2",
|
||||
|
|
|
@ -25,6 +25,7 @@ const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
|
|||
const printHostingInstructions = require('react-dev-utils/printHostingInstructions');
|
||||
const FileSizeReporter = require('react-dev-utils/FileSizeReporter');
|
||||
const printBuildError = require('react-dev-utils/printBuildError');
|
||||
const AdmZip = require('adm-zip');
|
||||
|
||||
const measureFileSizesBeforeBuild =
|
||||
FileSizeReporter.measureFileSizesBeforeBuild;
|
||||
|
@ -98,7 +99,8 @@ measureFileSizesBeforeBuild(paths.appBuild)
|
|||
printBuildError(err);
|
||||
process.exit(1);
|
||||
}
|
||||
);
|
||||
)
|
||||
.then(zipDist);
|
||||
|
||||
// Create the production build and print the deployment instructions.
|
||||
function build(previousFileSizes) {
|
||||
|
@ -148,3 +150,28 @@ function copyPublicFolder() {
|
|||
filter: file => file !== paths.appHtml,
|
||||
});
|
||||
}
|
||||
|
||||
function zipDist() {
|
||||
// If no version was provided, do nothing
|
||||
if (process.argv.length < 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
const version = process.argv[2];
|
||||
const versionFileName = `./dist/shlink-web-client_${version}_dist.zip`;
|
||||
|
||||
console.log(chalk.cyan(`Generating dist file for version ${chalk.bold(version)}...`));
|
||||
const zip = new AdmZip();
|
||||
|
||||
try {
|
||||
if (fs.existsSync(versionFileName)) {
|
||||
fs.unlink(versionFileName);
|
||||
}
|
||||
zip.addLocalFolder('./build', `shlink-web-client_${version}_dist`);
|
||||
zip.writeZip(versionFileName);
|
||||
console.log(chalk.green('Dist file properly generated'));
|
||||
} catch (e) {
|
||||
console.log(chalk.red('An error occurred while generating dist file'));
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,10 @@ address@1.0.3, address@^1.0.1:
|
|||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/address/-/address-1.0.3.tgz#b5f50631f8d6cec8bd20c963963afb55e06cbce9"
|
||||
|
||||
adm-zip@^0.4.11:
|
||||
version "0.4.11"
|
||||
resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.11.tgz#2aa54c84c4b01a9d0fb89bb11982a51f13e3d62a"
|
||||
|
||||
ajv-keywords@^2.0.0:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762"
|
||||
|
|
Loading…
Reference in a new issue