Skip to content

Commit

Permalink
Fix gulp prod build error.
Browse files Browse the repository at this point in the history
  • Loading branch information
kajmagnus committed Jan 12, 2020
1 parent 606be9c commit 93761d4
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 4 deletions.
5 changes: 3 additions & 2 deletions client/app-slim/prelude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,12 @@ function doNextFrameOrNow(something: () => void) {
namespace debiki2 {
//------------------------------------------------------------------------------

// @ifdef DEBUG
// Typescript changes this so the macro breaks somehow, in prod builds:
// x ifdef DEBUG
export function toStr(x: any, indentation: number = 2): string {
return JSON.stringify(x, undefined, indentation);
}
// @endif
// x endif


// If in an embedded comments iframe.
Expand Down
19 changes: 18 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

const gulp = require('gulp');
const gDebug = require('gulp-debug');
const plumber = require('gulp-plumber');
const newer = require('gulp-newer');
const typeScript = require('gulp-typescript');
Expand Down Expand Up @@ -582,6 +583,10 @@ gulp.task('enable-prod-stuff', (done) => {
gulp.task('minifyTranslations', gulp.series('buildTranslations', () => {
return gulp.src([`${serverDestTranslations}/**/*.js`, `!${serverDestTranslations}/**/*.min.js`])
.pipe(plumber())
.pipe(gDebug({
minimal: false,
title: `gulp-debug: minifying transl:`,
}))
.pipe(preprocess({ context: preprocessProdContext }))
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
Expand All @@ -593,14 +598,18 @@ gulp.task('minifyTranslations', gulp.series('buildTranslations', () => {
}));


gulp.task('minifyScripts', gulp.series('compileConcatAllScripts', 'minifyTranslations', () => {
gulp.task('minifyScriptsImpl', gulp.series(() => {
// preprocess() removes all @ifdef DEBUG — however (!) be sure to not place '// @endif'
// on the very last line in a {} block, because it would get removed, by... by what? the
// Typescript compiler? This results in an impossible-to-understand "Unbalanced delimiter
// found in string" error with a meaningless stacktrace, in preprocess().
function makeMinJsGzStream(sourceAndDest, gzipped) {
let stream = gulp.src([`${sourceAndDest}/*.js`, `!${sourceAndDest}/*.min.js`])
.pipe(plumber())
.pipe(gDebug({
minimal: false,
title: `gulp-debug: minifying scripts: ${JSON.stringify(sourceAndDest)}`,
}))
.pipe(preprocess({ context: preprocessProdContext })) // see comment above
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
Expand All @@ -619,6 +628,14 @@ gulp.task('minifyScripts', gulp.series('compileConcatAllScripts', 'minifyTransla
}));


gulp.task('minifyScripts', gulp.series(
'compileConcatAllScripts', 'minifyTranslations', 'minifyScriptsImpl'));


gulp.task('testProdMinify', gulp.series(
'enable-prod-stuff', 'minifyScriptsImpl'));



gulp.task('compile-stylus', () => {
const stylusOptsLeftToRight = {
Expand Down
2 changes: 1 addition & 1 deletion modules/ed-versions
Submodule ed-versions updated 1 files
+1 −0 version-tags.log
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"gulp-clean-css": "^4.0.0",
"gulp-cli": "^2.0.1",
"gulp-concat": "^2.6.1",
"gulp-debug": "^4.0.0",
"gulp-gzip": "^1.4.2",
"gulp-insert": "^0.5.0",
"gulp-newer": "^1.4.0",
Expand Down
78 changes: 78 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ ansi-styles@^3.1.0:
dependencies:
color-convert "^1.9.0"

ansi-styles@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==
dependencies:
color-convert "^1.9.0"

ansi-wrap@0.1.0, ansi-wrap@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf"
Expand Down Expand Up @@ -601,6 +608,15 @@ chalk@^2.0.0:
escape-string-regexp "^1.0.5"
supports-color "^4.0.0"

chalk@^2.3.0:
version "2.4.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
dependencies:
ansi-styles "^3.2.1"
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"

chardet@^0.4.0:
version "0.4.2"
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2"
Expand Down Expand Up @@ -1423,6 +1439,11 @@ get-caller-file@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a"

get-own-enumerable-property-symbols@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz#b5fde77f22cbe35f390b4e089922c50bce6ef664"
integrity sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g==

get-port@^3.1.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/get-port/-/get-port-3.2.0.tgz#dd7ce7de187c06c8bf353796ac71e099f0980ebc"
Expand Down Expand Up @@ -1606,6 +1627,18 @@ gulp-concat@^2.6.1:
through2 "^2.0.0"
vinyl "^2.0.0"

gulp-debug@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/gulp-debug/-/gulp-debug-4.0.0.tgz#036f9539c3fb6af720e01a9ea5c195fc73f29d5b"
integrity sha512-cn/GhMD2nVZCVxAl5vWao4/dcoZ8wUJ8w3oqTvQaGDmC1vT7swNOEbhQTWJp+/otKePT64aENcqAQXDcdj5H1g==
dependencies:
chalk "^2.3.0"
fancy-log "^1.3.2"
plur "^3.0.0"
stringify-object "^3.0.0"
through2 "^2.0.0"
tildify "^1.1.2"

gulp-gzip@^1.4.2:
version "1.4.2"
resolved "https://registry.yarnpkg.com/gulp-gzip/-/gulp-gzip-1.4.2.tgz#0422a94014248655b5b1a9eea1c2abee1d4f4337"
Expand Down Expand Up @@ -1969,6 +2002,11 @@ invert-kv@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6"

irregular-plurals@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/irregular-plurals/-/irregular-plurals-2.0.0.tgz#39d40f05b00f656d0b7fa471230dd3b714af2872"
integrity sha512-Y75zBYLkh0lJ9qxeHlMjQ7bSbyiSqNW/UOPWDmzC7cXskL1hekSITh1Oc6JV0XCWWZ9DE8VYSB71xocLk3gmGw==

is-absolute@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-absolute/-/is-absolute-1.0.0.tgz#395e1ae84b11f26ad1795e73c17378e48a301576"
Expand Down Expand Up @@ -2080,6 +2118,11 @@ is-number@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff"

is-obj@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f"
integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8=

is-path-cwd@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d"
Expand All @@ -2106,6 +2149,11 @@ is-promise@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa"

is-regexp@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069"
integrity sha1-/S2INUXEa6xaYz57mgnof6LLUGk=

is-relative@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-relative/-/is-relative-1.0.0.tgz#a1bb6935ce8c5dba1e8b9754b9b2dcc020e2260d"
Expand Down Expand Up @@ -3096,6 +3144,13 @@ plugin-error@^0.1.2:
arr-union "^2.0.1"
extend-shallow "^1.1.2"

plur@^3.0.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/plur/-/plur-3.1.1.tgz#60267967866a8d811504fe58f2faaba237546a5b"
integrity sha512-t1Ax8KUvV3FFII8ltczPn2tJdjqbd1sIzu6t4JL7nQ3EyeL/lTrj5PWKb06ic5/6XYDr65rQ4uzQEGN70/6X5w==
dependencies:
irregular-plurals "^2.0.0"

portfinder@^1.0.13:
version "1.0.13"
resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.13.tgz#bb32ecd87c27104ae6ee44b5a3ccbf0ebb1aede9"
Expand Down Expand Up @@ -3930,6 +3985,15 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

stringify-object@^3.0.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.3.0.tgz#703065aefca19300d3ce88af4f5b3956d7556629"
integrity sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw==
dependencies:
get-own-enumerable-property-symbols "^3.0.0"
is-obj "^1.0.1"
is-regexp "^1.0.0"

strip-ansi@^3.0.0, strip-ansi@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
Expand Down Expand Up @@ -3982,6 +4046,13 @@ supports-color@^4.0.0:
dependencies:
has-flag "^2.0.0"

supports-color@^5.3.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==
dependencies:
has-flag "^3.0.0"

supports-color@~5.0.0:
version "5.0.1"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.0.1.tgz#1c5331f22250c84202805b2f17adf16699f3a39a"
Expand Down Expand Up @@ -4099,6 +4170,13 @@ through@^2.3.6:
version "2.3.8"
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"

tildify@^1.1.2:
version "1.2.0"
resolved "https://registry.yarnpkg.com/tildify/-/tildify-1.2.0.tgz#dcec03f55dca9b7aa3e5b04f21817eb56e63588a"
integrity sha1-3OwD9V3Km3qj5bBPIYF+tW5jWIo=
dependencies:
os-homedir "^1.0.0"

time-stamp@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-1.1.0.tgz#764a5a11af50561921b133f3b44e618687e0f5c3"
Expand Down

0 comments on commit 93761d4

Please sign in to comment.