From 73308038ab9fd2e04973b45a0ed250a42bb543ad Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Wed, 12 Dec 2018 11:10:37 +0100 Subject: Simplify dictionary step --- build-helpers/installDictionaries.js | 24 ------------------------ gulpfile.babel.js | 18 ++++++++++++++++++ package-lock.json | 2 +- package.json | 6 ++---- 4 files changed, 21 insertions(+), 29 deletions(-) delete mode 100755 build-helpers/installDictionaries.js diff --git a/build-helpers/installDictionaries.js b/build-helpers/installDictionaries.js deleted file mode 100755 index 8d209356e..000000000 --- a/build-helpers/installDictionaries.js +++ /dev/null @@ -1,24 +0,0 @@ -const { execSync } = require('child_process'); -const { SPELLCHECKER_LOCALES } = require('../build/i18n/languages'); - -const path = './build/dictionaries'; - -let packages = ''; -Object.keys(SPELLCHECKER_LOCALES).forEach((key) => { packages = `${packages} hunspell-dict-${key}`; }); - -function exec(cmd) { - execSync(cmd, - (error, stdout, stderr) => { - console.log(`stdout: ${stdout}`); - console.log(`stderr: ${stderr}`); - if (error !== null) { - console.log(`exec error: ${error}`); - } - }); -} - -exec(` -rm -rf ${path} -npm install --prefix ${path} ${packages} -mv ${path}/node_modules/* ${path} -rm -rf ${path}/node_modules ${path}/package-lock.json`); diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 2ab3f47b1..e732f991a 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -25,6 +25,7 @@ const paths = { src: 'src', dest: 'build', tmp: '.tmp', + dictionaries: 'build/dictionaries', package: `out/${config.version}`, html: { src: 'src/**/*.html', @@ -132,13 +133,30 @@ export function webserver() { })); } +export function dictionaries(done) { + const { SPELLCHECKER_LOCALES } = require('./build/i18n/languages'); + + let packages = ''; + Object.keys(SPELLCHECKER_LOCALES).forEach((key) => { packages = `${packages} hunspell-dict-${key}`; }); + + _shell(` + rm -rf ${paths.dictionaries} + npm install --prefix ${paths.dictionaries} ${packages} + mv ${paths.dictionaries}/node_modules/* ${paths.dictionaries} + rm -rf ${paths.dictionaries}/node_modules ${paths.dictionaries}/package-lock.json`, + done, + ); +} + export function sign(done) { _shell(`codesign --verbose=4 --deep --strict --force --sign "${process.env.SIGNING_IDENTITY}" "${__dirname}/node_modules/electron/dist/Electron.app"`, done); } const build = gulp.series( + clean, gulp.parallel(mvSrc, mvPackageJson), gulp.parallel(html, scripts, styles), + dictionaries, ); export { build }; diff --git a/package-lock.json b/package-lock.json index abd4f9266..16fe71944 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "franz", - "version": "5.0.0-beta.20", + "version": "5.0.0-beta.21", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 447aebd8b..551727ca9 100644 --- a/package.json +++ b/package.json @@ -17,14 +17,12 @@ "dev": "cross-env NODE_ENV=development gulp dev", "lint": "eslint src", "sign": "gulp sign", - "compile": "gulp clean && gulp build", - "prebuild": "npm run compile && npm run dictionaries", + "prebuild": "gulp build", "build": "node_modules/.bin/electron-builder --publish onTag", "rebuild": "node_modules/.bin/electron-rebuild", "commit": "git-cz", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", - "reformat-files": "./node_modules/.bin/prettier --ignore-path .eslintignore --write --require-pragma \"**/*.{js,jsx,scss}\"", - "dictionaries": "node ./build-helpers/installDictionaries.js" + "reformat-files": "./node_modules/.bin/prettier --ignore-path .eslintignore --write --require-pragma \"**/*.{js,jsx,scss}\"" }, "keywords": [], "author": "Stefan Malzner ", -- cgit v1.2.3-54-g00ecf