diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-07-08 09:21:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 12:51:39 +0530 |
commit | 4817b83394bc901c02d619f16d74cfbc3a5d294c (patch) | |
tree | 019e83ebaacfb0d15627c3405478be8d683af180 /gulpfile.babel.js | |
parent | Including the '@meetfranz' node modules in the packed artefact (since its cau... (diff) | |
download | ferdium-app-4817b83394bc901c02d619f16d74cfbc3a5d294c.tar.gz ferdium-app-4817b83394bc901c02d619f16d74cfbc3a5d294c.tar.zst ferdium-app-4817b83394bc901c02d619f16d74cfbc3a5d294c.zip |
chore: run security audit on node modules (#1621)
- changed electron target for @babel/preset-env from 4 to 13
- added .prettierrc.js with conforming settings to current code style
- upgraded gulp-sass to v5 to fix CVE and adapted code to breaking changes
- refreshed package-lock.json of packages/forms and packages/ui
- upgraded normalize-url to fix CVE
- removed unnecessary @types/color-convert
- fixed ToggleComponent breaking tsc compilation
Diffstat (limited to 'gulpfile.babel.js')
-rw-r--r-- | gulpfile.babel.js | 59 |
1 files changed, 39 insertions, 20 deletions
diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 9a04732b7..ed5245ee1 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js | |||
@@ -1,8 +1,8 @@ | |||
1 | /* eslint max-len: 0 */ | ||
2 | import gulp from 'gulp'; | 1 | import gulp from 'gulp'; |
3 | import gulpIf from 'gulp-if'; | 2 | import gulpIf from 'gulp-if'; |
4 | import babel from 'gulp-babel'; | 3 | import babel from 'gulp-babel'; |
5 | import sass from 'gulp-sass'; | 4 | import dartSass from 'sass'; |
5 | import gulpSass from 'gulp-sass'; | ||
6 | import csso from 'gulp-csso'; | 6 | import csso from 'gulp-csso'; |
7 | import terser from 'terser'; | 7 | import terser from 'terser'; |
8 | import composer from 'gulp-uglify/composer'; | 8 | import composer from 'gulp-uglify/composer'; |
@@ -22,19 +22,18 @@ import * as rawStyleConfig from './src/theme/default/legacy.js'; | |||
22 | 22 | ||
23 | dotenv.config(); | 23 | dotenv.config(); |
24 | 24 | ||
25 | const sass = gulpSass(dartSass); | ||
25 | const uglify = composer(terser, console); | 26 | const uglify = composer(terser, console); |
26 | 27 | ||
27 | const isDevBuild = process.env.NODE_ENV === 'development'; | 28 | const isDevBuild = process.env.NODE_ENV === 'development'; |
28 | 29 | ||
29 | const getTargetEnv = isDevBuild ? 'development' : 'production'; | 30 | const getTargetEnv = isDevBuild ? 'development' : 'production'; |
30 | 31 | ||
31 | const styleConfig = Object.keys(rawStyleConfig).map((key) => { | 32 | const styleConfig = Object.keys(rawStyleConfig).map(key => { |
32 | const isHex = /^#[0-9A-F]{6}$/i.test(rawStyleConfig[key]); | 33 | const isHex = /^#[0-9A-F]{6}$/i.test(rawStyleConfig[key]); |
33 | return { | 34 | return { |
34 | [`$raw_${kebabCase(key)}`]: isHex | 35 | [`$raw_${kebabCase(key)}`]: isHex |
35 | ? hexRgb(rawStyleConfig[key], { format: 'array' }) | 36 | ? hexRgb(rawStyleConfig[key], { format: 'array' }).splice(0, 3).join(',') |
36 | .splice(0, 3) | ||
37 | .join(',') | ||
38 | : rawStyleConfig[key], | 37 | : rawStyleConfig[key], |
39 | }; | 38 | }; |
40 | }); | 39 | }); |
@@ -107,7 +106,7 @@ function _shell(cmd, cb) { | |||
107 | ); | 106 | ); |
108 | } | 107 | } |
109 | 108 | ||
110 | const clean = (done) => { | 109 | const clean = done => { |
111 | removeSync(paths.tmp); | 110 | removeSync(paths.tmp); |
112 | removeSync(paths.dest); | 111 | removeSync(paths.dest); |
113 | removeSync(paths.dist); | 112 | removeSync(paths.dist); |
@@ -140,7 +139,7 @@ export function mvLernaPackages() { | |||
140 | } | 139 | } |
141 | 140 | ||
142 | export function exportBuildInfo() { | 141 | export function exportBuildInfo() { |
143 | var buildInfoData = { | 142 | const buildInfoData = { |
144 | timestamp: buildInfo.timestamp, | 143 | timestamp: buildInfo.timestamp, |
145 | gitHashShort: buildInfo.gitHashShort, | 144 | gitHashShort: buildInfo.gitHashShort, |
146 | gitBranch: buildInfo.gitBranch, | 145 | gitBranch: buildInfo.gitBranch, |
@@ -151,10 +150,16 @@ export function exportBuildInfo() { | |||
151 | export function html() { | 150 | export function html() { |
152 | return gulp | 151 | return gulp |
153 | .src(paths.html.src, { since: gulp.lastRun(html) }) | 152 | .src(paths.html.src, { since: gulp.lastRun(html) }) |
154 | .pipe(gulpIf(!isDevBuild, htmlMin({ // Only minify in production to speed up dev builds | 153 | .pipe( |
155 | collapseWhitespace: true, | 154 | gulpIf( |
156 | removeComments: true, | 155 | !isDevBuild, |
157 | }))) | 156 | htmlMin({ |
157 | // Only minify in production to speed up dev builds | ||
158 | collapseWhitespace: true, | ||
159 | removeComments: true, | ||
160 | }), | ||
161 | ), | ||
162 | ) | ||
158 | .pipe(gulp.dest(paths.html.dest)) | 163 | .pipe(gulp.dest(paths.html.dest)) |
159 | .pipe(connect.reload()); | 164 | .pipe(connect.reload()); |
160 | } | 165 | } |
@@ -177,9 +182,15 @@ export function styles() { | |||
177 | includePaths: ['./node_modules', '../node_modules'], | 182 | includePaths: ['./node_modules', '../node_modules'], |
178 | }).on('error', sass.logError), | 183 | }).on('error', sass.logError), |
179 | ) | 184 | ) |
180 | .pipe((gulpIf(!isDevBuild, csso({ // Only minify in production to speed up dev builds | 185 | .pipe( |
181 | restructure: false, // Don't restructure CSS, otherwise it will break the styles | 186 | gulpIf( |
182 | })))) | 187 | !isDevBuild, |
188 | csso({ | ||
189 | // Only minify in production to speed up dev builds | ||
190 | restructure: false, // Don't restructure CSS, otherwise it will break the styles | ||
191 | }), | ||
192 | ), | ||
193 | ) | ||
183 | .pipe(gulp.dest(paths.styles.dest)) | 194 | .pipe(gulp.dest(paths.styles.dest)) |
184 | .pipe(connect.reload()); | 195 | .pipe(connect.reload()); |
185 | } | 196 | } |
@@ -202,9 +213,15 @@ export function verticalStyle() { | |||
202 | includePaths: ['./node_modules', '../node_modules'], | 213 | includePaths: ['./node_modules', '../node_modules'], |
203 | }).on('error', sass.logError), | 214 | }).on('error', sass.logError), |
204 | ) | 215 | ) |
205 | .pipe((gulpIf(!isDevBuild, csso({ // Only minify in production to speed up dev builds | 216 | .pipe( |
206 | restructure: false, // Don't restructure CSS, otherwise it will break the styles | 217 | gulpIf( |
207 | })))) | 218 | !isDevBuild, |
219 | csso({ | ||
220 | // Only minify in production to speed up dev builds | ||
221 | restructure: false, // Don't restructure CSS, otherwise it will break the styles | ||
222 | }), | ||
223 | ), | ||
224 | ) | ||
208 | .pipe(gulp.dest(paths.verticalStyle.dest)) | 225 | .pipe(gulp.dest(paths.verticalStyle.dest)) |
209 | .pipe(connect.reload()); | 226 | .pipe(connect.reload()); |
210 | } | 227 | } |
@@ -240,11 +257,13 @@ export function webserver() { | |||
240 | } | 257 | } |
241 | 258 | ||
242 | export function recipes() { | 259 | export function recipes() { |
243 | return gulp.src(paths.recipes.src, { since: gulp.lastRun(recipes) }) | 260 | return gulp |
261 | .src(paths.recipes.src, { since: gulp.lastRun(recipes) }) | ||
244 | .pipe(gulp.dest(paths.recipes.dest)); | 262 | .pipe(gulp.dest(paths.recipes.dest)); |
245 | } | 263 | } |
246 | export function recipeInfo() { | 264 | export function recipeInfo() { |
247 | return gulp.src(paths.recipeInfo.src, { since: gulp.lastRun(recipeInfo) }) | 265 | return gulp |
266 | .src(paths.recipeInfo.src, { since: gulp.lastRun(recipeInfo) }) | ||
248 | .pipe(gulp.dest(paths.recipeInfo.dest)); | 267 | .pipe(gulp.dest(paths.recipeInfo.dest)); |
249 | } | 268 | } |
250 | 269 | ||