js-build-tools 2.4.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +334 -205
- package/dist/build.js +16 -5
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +1 -2
- package/dist/bundle.min.js +1 -1
- package/dist/bundleLint.js +2 -3
- package/dist/bundleLint.min.js +1 -1
- package/dist/bundleMinify.js +1 -2
- package/dist/bundleMinify.min.js +1 -1
- package/dist/copyFonts.js +12 -0
- package/dist/copyFonts.min.js +1 -0
- package/dist/default.js +15 -15
- package/dist/default.min.js +1 -1
- package/dist/dist.js +7 -8
- package/dist/distLint.js +2 -3
- package/dist/distLint.min.js +1 -1
- package/dist/distMinify.js +1 -2
- package/dist/distMinify.min.js +1 -1
- package/dist/images.js +11 -0
- package/dist/images.min.js +1 -0
- package/dist/partials/addToReadme.js +2 -3
- package/dist/partials/beginWatcher.js +1 -2
- package/dist/partials/clean.js +10 -11
- package/dist/partials/copyFor.js +16 -0
- package/dist/partials/distFor.js +1 -2
- package/dist/partials/distForSrc.js +2 -3
- package/dist/partials/distSeries.js +3 -4
- package/dist/partials/imagesFor.js +34 -0
- package/dist/partials/minifyFor.js +15 -16
- package/dist/partials/readmeTemplate.js +1 -2
- package/dist/partials/removeDirectory.js +11 -12
- package/dist/partials/runOnChange.js +7 -7
- package/dist/partials/sassFor.js +2 -3
- package/dist/partials/tsFor.js +4 -5
- package/dist/partials.js +5 -1
- package/dist/partials.min.js +1 -1
- package/dist/test-helpers/setUp.js +31 -39
- package/dist/testFull.js +2 -3
- package/dist/testFull.min.js +1 -1
- package/dist/testHelpers.js +2 -20
- package/dist/testHelpers.min.js +1 -1
- package/dist/testQuick.js +1 -2
- package/dist/testQuick.min.js +1 -1
- package/dist/typeScript.js +7 -8
- package/dist/utilities/dotGet.js +50 -0
- package/dist/utilities/dotNotate.js +77 -0
- package/dist/utilities/dotSet.js +44 -0
- package/dist/utilities/isObject.js +10 -0
- package/dist/watchFull.js +10 -11
- package/dist/watchTest.js +1 -2
- package/dist/watchTest.min.js +1 -1
- package/functions/build.js +15 -5
- package/functions/build.test.js +278 -42
- package/functions/bundle.js +3 -4
- package/functions/bundle.test.js +6 -6
- package/functions/bundleLint.js +2 -3
- package/functions/bundleLint.test.js +5 -5
- package/functions/bundleMinify.js +1 -2
- package/functions/bundleMinify.test.js +1 -1
- package/functions/copyFonts.js +11 -0
- package/functions/copyFonts.test.js +31 -0
- package/functions/default.js +1 -1
- package/functions/default.test.js +2 -2
- package/functions/dist.js +0 -1
- package/functions/dist.test.js +1 -1
- package/functions/distLint.js +2 -3
- package/functions/distLint.test.js +3 -3
- package/functions/distMinify.js +1 -2
- package/functions/distMinify.test.js +1 -1
- package/functions/images.js +10 -0
- package/functions/images.test.js +138 -0
- package/functions/partials/addToReadme.js +2 -3
- package/functions/partials/addToReadme.test.js +2 -2
- package/functions/partials/beginWatcher.js +1 -2
- package/functions/partials/beginWatcher.test.js +1 -1
- package/functions/partials/clean.js +0 -1
- package/functions/partials/copyFor.js +13 -0
- package/functions/partials/copyFor.test.js +34 -0
- package/functions/partials/distFor.js +1 -2
- package/functions/partials/distFor.test.js +4 -4
- package/functions/partials/distForSrc.js +3 -4
- package/functions/partials/distForSrc.test.js +6 -6
- package/functions/partials/distSeries.js +2 -3
- package/functions/partials/distSeries.test.js +5 -5
- package/functions/partials/imagesFor.js +33 -0
- package/functions/partials/imagesFor.test.js +143 -0
- package/functions/partials/minifyFor.js +0 -1
- package/functions/partials/minifyFor.test.js +1 -1
- package/functions/partials/readmeTemplate.js +3 -4
- package/functions/partials/readmeTemplate.test.js +2 -2
- package/functions/partials/removeDirectory.js +0 -1
- package/functions/partials/runOnChange.js +5 -6
- package/functions/partials/runOnChange.test.js +9 -9
- package/functions/partials/sassFor.js +1 -2
- package/functions/partials/sassFor.test.js +3 -3
- package/functions/partials/tsFor.js +3 -4
- package/functions/partials/tsFor.test.js +2 -2
- package/functions/partials.js +5 -1
- package/functions/partials.test.js +1 -1
- package/functions/sass.test.js +2 -2
- package/functions/test-helpers/setUp.js +24 -32
- package/functions/testFull.js +2 -3
- package/functions/testFull.test.js +1 -1
- package/functions/testHelpers.js +3 -20
- package/functions/testHelpers.test.js +1 -1
- package/functions/testQuick.js +1 -2
- package/functions/testQuick.test.js +1 -1
- package/functions/typeScript.js +0 -1
- package/functions/typeScript.test.js +0 -2
- package/functions/utilities/dotGet.js +47 -0
- package/functions/utilities/dotNotate.js +68 -0
- package/functions/utilities/dotSet.js +41 -0
- package/functions/utilities/isObject.js +9 -0
- package/functions/watchFull.js +0 -1
- package/functions/watchFull.test.js +1 -1
- package/functions/watchTest.js +1 -2
- package/functions/watchTest.test.js +1 -1
- package/gulp.config.js +153 -79
- package/gulpfile.base.js +5 -1
- package/jsdoc.base.js +1 -1
- package/package.json +13 -9
- package/vendor/array-union/index.js +31 -0
- package/vendor/easy-transform-stream/index.js +58 -0
- package/vendor/globby/gitignore.js +100 -0
- package/vendor/globby/index.js +195 -0
- package/vendor/globby/node_modules/slash/index.js +16 -0
- package/vendor/globby/stream-utils.js +58 -0
- package/vendor/globby/to-path.js +20 -0
- package/vendor/gulp-imagemin/index.js +128 -0
- package/vendor/gulp-imagemin/node_modules/chalk/source/index.js +265 -0
- package/vendor/gulp-imagemin/node_modules/chalk/source/utilities.js +36 -0
- package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/ansi-styles/index.js +217 -0
- package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/supports-color/index.js +154 -0
- package/vendor/gulp-plugin-extras/index.js +46 -0
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/index.js +265 -0
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/utilities.js +36 -0
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/ansi-styles/index.js +217 -0
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/supports-color/index.js +154 -0
- package/vendor/gulp-plugin-extras/plugin-error.js +145 -0
- package/vendor/ignore/index.js +468 -0
- package/vendor/imagemin/index.js +94 -0
- package/vendor/imagemin-gifsicle/index.js +37 -0
- package/vendor/imagemin-mozjpeg/index.js +104 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/index.js +264 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/command.js +47 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/error.js +102 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/kill.js +123 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/promise.js +47 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stdio.js +50 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stream.js +128 -0
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/core.js +238 -0
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/main.js +89 -0
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/realtime.js +24 -0
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/signals.js +44 -0
- package/vendor/imagemin-mozjpeg/node_modules/is-stream/index.js +25 -0
- package/vendor/imagemin-mozjpeg/node_modules/mimic-fn/index.js +70 -0
- package/vendor/imagemin-mozjpeg/node_modules/npm-run-path/index.js +52 -0
- package/vendor/imagemin-mozjpeg/node_modules/onetime/index.js +43 -0
- package/vendor/imagemin-mozjpeg/node_modules/path-key/index.js +20 -0
- package/vendor/imagemin-mozjpeg/node_modules/strip-final-newline/index.js +17 -0
- package/vendor/imagemin-optipng/index.js +44 -0
- package/vendor/imagemin-svgo/index.js +27 -0
- package/vendor/is-jpg/index.js +12 -0
- package/vendor/junk/index.js +49 -0
- package/vendor/mozjpeg/index.js +9 -0
- package/vendor/mozjpeg/lib/index.js +18 -0
- package/vendor/mozjpeg/package.json +50 -0
- package/vendor/p-pipe/index.js +26 -0
- package/vendor/plur/index.js +32 -0
- package/vendor/pretty-bytes/index.js +71 -0
- package/vendor/slash/index.js +12 -0
- package/dist/test-helpers/circularObject.js +0 -50
- package/dist/test-helpers/countMatches.js +0 -12
- package/dist/test-helpers/deepReferenceObject.js +0 -20
- package/dist/test-helpers/domItem.js +0 -33
- package/dist/test-helpers/jsonDom.js +0 -20
- package/dist/test-helpers/linkedList.js +0 -23
- package/dist/test-helpers/logObject.js +0 -21
- package/dist/test-helpers/multiReferenceObject.js +0 -20
- package/dist/test-helpers/nodeTree.js +0 -28
- package/functions/test-helpers/circularObject.js +0 -28
- package/functions/test-helpers/circularObject.test.js +0 -14
- package/functions/test-helpers/countMatches.js +0 -11
- package/functions/test-helpers/countMatches.test.js +0 -9
- package/functions/test-helpers/deepReferenceObject.js +0 -25
- package/functions/test-helpers/deepReferenceObject.test.js +0 -7
- package/functions/test-helpers/domItem.js +0 -31
- package/functions/test-helpers/domItem.test.js +0 -12
- package/functions/test-helpers/jsonDom.js +0 -16
- package/functions/test-helpers/jsonDom.test.js +0 -12
- package/functions/test-helpers/linkedList.js +0 -10
- package/functions/test-helpers/linkedList.test.js +0 -22
- package/functions/test-helpers/logObject.js +0 -18
- package/functions/test-helpers/logObject.test.js +0 -20
- package/functions/test-helpers/multiReferenceObject.js +0 -25
- package/functions/test-helpers/multiReferenceObject.test.js +0 -14
- package/functions/test-helpers/nodeTree.js +0 -11
- package/functions/test-helpers/nodeTree.test.js +0 -18
package/functions/build.test.js
CHANGED
|
@@ -4,9 +4,8 @@ setUp.setDefaults('test-build')
|
|
|
4
4
|
const gulpConfig = setUp.gulpConfig
|
|
5
5
|
const build = require('./build')
|
|
6
6
|
const clean = require('./partials/clean')
|
|
7
|
-
const sass = require('./sass')
|
|
8
7
|
const testFull = require('./testFull')
|
|
9
|
-
const { countMatches } = require('
|
|
8
|
+
const { countMatches } = require('test-filesystem')
|
|
10
9
|
|
|
11
10
|
const genericFunction = () => Promise.resolve(true)
|
|
12
11
|
|
|
@@ -53,7 +52,7 @@ const mainFileContents = '/**\n' +
|
|
|
53
52
|
' * Some test functions for usage with build tests.\n' +
|
|
54
53
|
' * @file\n' +
|
|
55
54
|
' * @author John Doe <john.doe@example.com>\n' +
|
|
56
|
-
' * @version
|
|
55
|
+
' * @version 3.0.0\n' +
|
|
57
56
|
' * @module test-build\n' +
|
|
58
57
|
' */\n' +
|
|
59
58
|
'\n' +
|
|
@@ -79,6 +78,123 @@ const tsConfigContents = '{\n' +
|
|
|
79
78
|
' }\n' +
|
|
80
79
|
'}'
|
|
81
80
|
|
|
81
|
+
const fontContent = 'comic sans'
|
|
82
|
+
|
|
83
|
+
const fontPath = gulpConfig.get('srcPath') + '/fonts'
|
|
84
|
+
|
|
85
|
+
const imageContent = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n' +
|
|
86
|
+
'<!-- Created with Inkscape (http://www.inkscape.org/) -->\n' +
|
|
87
|
+
'\n' +
|
|
88
|
+
'<svg\n' +
|
|
89
|
+
' xmlns:dc="http://purl.org/dc/elements/1.1/"\n' +
|
|
90
|
+
' xmlns:cc="http://creativecommons.org/ns#"\n' +
|
|
91
|
+
' xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n' +
|
|
92
|
+
' xmlns:svg="http://www.w3.org/2000/svg"\n' +
|
|
93
|
+
' xmlns="http://www.w3.org/2000/svg"\n' +
|
|
94
|
+
' xmlns:xlink="http://www.w3.org/1999/xlink"\n' +
|
|
95
|
+
' xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n' +
|
|
96
|
+
' xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n' +
|
|
97
|
+
' id="svg2"\n' +
|
|
98
|
+
' version="1.1"\n' +
|
|
99
|
+
' inkscape:version="0.91 r13725"\n' +
|
|
100
|
+
' width="600"\n' +
|
|
101
|
+
' height="600"\n' +
|
|
102
|
+
' viewBox="0 0 600 600"\n' +
|
|
103
|
+
' sodipodi:docname="logo.svg">\n' +
|
|
104
|
+
' <metadata\n' +
|
|
105
|
+
' id="metadata8">\n' +
|
|
106
|
+
' <rdf:RDF>\n' +
|
|
107
|
+
' <cc:Work\n' +
|
|
108
|
+
' rdf:about="">\n' +
|
|
109
|
+
' <dc:format>image/svg+xml</dc:format>\n' +
|
|
110
|
+
' <dc:type\n' +
|
|
111
|
+
' rdf:resource="http://purl.org/dc/dcmitype/StillImage" />\n' +
|
|
112
|
+
' <dc:title></dc:title>\n' +
|
|
113
|
+
' </cc:Work>\n' +
|
|
114
|
+
' </rdf:RDF>\n' +
|
|
115
|
+
' </metadata>\n' +
|
|
116
|
+
' <defs\n' +
|
|
117
|
+
' id="defs6" />\n' +
|
|
118
|
+
' <sodipodi:namedview\n' +
|
|
119
|
+
' pagecolor="#ffffff"\n' +
|
|
120
|
+
' bordercolor="#666666"\n' +
|
|
121
|
+
' borderopacity="1"\n' +
|
|
122
|
+
' objecttolerance="10"\n' +
|
|
123
|
+
' gridtolerance="10"\n' +
|
|
124
|
+
' guidetolerance="10"\n' +
|
|
125
|
+
' inkscape:pageopacity="0"\n' +
|
|
126
|
+
' inkscape:pageshadow="2"\n' +
|
|
127
|
+
' inkscape:window-width="1280"\n' +
|
|
128
|
+
' inkscape:window-height="737"\n' +
|
|
129
|
+
' id="namedview4"\n' +
|
|
130
|
+
' showgrid="false"\n' +
|
|
131
|
+
' inkscape:zoom="0.39333333"\n' +
|
|
132
|
+
' inkscape:cx="300"\n' +
|
|
133
|
+
' inkscape:cy="300"\n' +
|
|
134
|
+
' inkscape:window-x="-8"\n' +
|
|
135
|
+
' inkscape:window-y="-8"\n' +
|
|
136
|
+
' inkscape:window-maximized="1"\n' +
|
|
137
|
+
' inkscape:current-layer="svg2" />\n' +
|
|
138
|
+
' <image\n' +
|
|
139
|
+
' width="600"\n' +
|
|
140
|
+
' height="600"\n' +
|
|
141
|
+
' preserveAspectRatio="none"\n' +
|
|
142
|
+
' xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAACgCAYAAACLz2ctAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\n' +
|
|
143
|
+
'A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G0+6+mHE50hLbA2jA14CHSHt6Zg54EfiLu9f5ZRuZMO8K4NadxdeHPUzx7UZVP8+9\n' +
|
|
179
|
+
'TBG6F919vnKHMtF6BnDrQbNZ4LMU3yY1w84v7naKX6C+QXFRwhubk7vfyNGwTJaBAdzxZLMDwBGK\n' +
|
|
180
|
+
'g4glYMVHKSCyzUgBFEmtzd+OJRNAAZRQCqCEUgAllAIooRRACaUASigFUEIpgBJKAZRQCqCEUgAl\n' +
|
|
181
|
+
'lAIooRRACaUASigFUEIpgBJKAZRQCqCEUgAllAIooRRACaUASigFUEL9D1MqMi7YkUEVAAAAAElF\n' +
|
|
182
|
+
'TkSuQmCC\n' +
|
|
183
|
+
'"\n' +
|
|
184
|
+
' id="image10"\n' +
|
|
185
|
+
' x="0"\n' +
|
|
186
|
+
' y="0" />\n' +
|
|
187
|
+
' <path\n' +
|
|
188
|
+
' style="fill:#000000"\n' +
|
|
189
|
+
' d="M 19.039097,494.38241 C 2.0018627,482.75861 -2.8301068,468.02182 5.0071177,451.587 8.2776829,444.72855 15.162733,436.35919 20.307229,432.98839 c 8.904129,-5.83422 9.948263,-5.67522 21.727331,3.30915 28.014638,21.3678 44.091105,18.882 51.54879,-7.97059 C 99.533959,406.9008 98.83533,123.18555 92.8125,115.28305 90.196335,111.85041 81.496733,108.63382 73.125,108.00381 58.734191,106.92084 58.077731,106.30388 56.961131,92.8125 L 55.797259,78.75 l 163.053411,0 163.05342,0 2.57381,11.71845 c 2.93006,13.34047 -1.71086,18.13302 -17.64754,18.22413 C 347.54041,108.80285 345,115.82292 345,169.01786 l 0,48.48214 67.5,0 67.5,0 0,-48.1688 c 0,-41.90267 -0.89209,-48.97614 -6.85778,-54.37499 C 469.37044,111.54279 462.75847,108.75 458.44894,108.75 443.44309,108.75 438.75,104.6341 438.75,91.473791 l 0,-12.723791 80.85139,0 80.85135,0 -1.16385,14.0625 c -1.13201,13.67745 -1.60515,14.09431 -17.27948,15.22432 -13.44982,0.96964 -16.73767,2.79799 -19.87627,11.0531 -5.80185,15.26002 -2.83763,249.42009 3.25016,256.74719 2.61705,3.14985 11.47643,6.80123 19.6875,8.11425 14.52533,2.32268 14.9292,2.79386 14.9292,17.41755 l 0,15.03026 -79.6875,-1.01208 -79.6875,-1.01209 -1.1367,-13.60684 c -1.13565,-13.59401 -1.11975,-13.60939 16.875,-16.30515 9.90645,-1.4841 19.25149,-4.64227 20.76679,-7.01816 1.5153,-2.37593 2.78092,-30.05423 2.8125,-61.50735 L 480,258.75 l -67.59289,0 -67.5929,0 1.0304,60.9375 1.03039,60.9375 19.6875,3.3399 c 20.4921,3.4764 22.16576,5.78036 17.32391,23.8476 -2.25337,8.40847 -2.53065,8.4375 -80.57378,8.4375 l -78.31263,0 0,-14.95567 c 0,-14.53673 0.41823,-15.02258 14.9292,-17.34297 8.21107,-1.31302 17.07044,-4.96657 19.6875,-8.11909 3.63727,-4.38139 4.7583,-35.56081 4.7583,-132.34294 0,-69.63615 -1.23091,-127.84279 -2.73535,-129.3481 -9.73748,-9.7431 -68.9232,-8.34789 -79.15408,1.86593 -3.08612,3.08097 -4.99292,46.77065 -6.52417,149.48557 -1.45514,97.60931 -3.64592,149.67975 -6.6905,159.01994 -13.55129,41.57292 -61.40288,74.9124 -111.000242,77.33685 -22.754302,1.11229 -28.166407,0.0821 -39.231561,-7.46711 z"\n' +
|
|
190
|
+
' id="path3338"\n' +
|
|
191
|
+
' inkscape:connector-curvature="0" />\n' +
|
|
192
|
+
'</svg>\n'
|
|
193
|
+
|
|
194
|
+
const imageCompressed = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="600"><image width="600" height="600" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAACgCAYAAACLz2ctAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz AAADsQAAA7EB9YPtSQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAh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8CdZvaEu4/6925PUu9zzW5/TFRHxsTWLri8 gvVx+l8JfBT4gZl9fsRlpLqy+DV3/1eiWjImut8DnqYY6QbpAI+a2eNmtn+34uWu+/4a/XXT6DeB OgDlZeKfG2G+B4ATZvZbdz/f6wlmdj/F7jyFl/otR9rN3B0z+z5wb8Ual4CzwBvAMsWVxg9S7HpT fPrxNvCzKgdAMv46Znac6uGD4tLu04n62e4m8ITCN7mmgLuimxjgyQpH3dIiHXZeqz8OHHjK3Z+P bkTy6pDuHF0qDvzG3c9GNyL5TQEXopvosg78QuHbOzrAq9FNlK4Cv3L3l6MbkeZ03P2qmV1mhC+U yeAcxQHHcmAPEmDzk5AzQcu/QXGa5ZcK395kxe9qg5mdAk41tNw14FngaXdfamiZMoa2AghgZl8H vphxee9Q/E7G0+6+mHE50hLbA2jA14CHSHt6Zg54EfiLu9f5ZRuZMO8K4NadxdeHPUzx7UZVP8+9 TBG6F919vnKHMtF6BnDrQbNZ4LMU3yY1w84v7naKX6C+QXFRwhubk7vfyNGwTJaBAdzxZLMDwBGK g4glYMVHKSCyzUgBFEmtzd+OJRNAAZRQCqCEUgAllAIooRRACaUASigFUEIpgBJKAZRQCqCEUgAl lAIooRRACaUASigFUEIpgBJKAZRQCqCEUgAllAIooRRACaUASigFUEL9D1MqMi7YkUEVAAAAAElF TkSuQmCC"/><path d="M19.04 494.382C2.001 482.76-2.83 468.022 5.006 451.587c3.27-6.858 10.156-15.228 15.3-18.599 8.904-5.834 9.948-5.675 21.728 3.31 28.014 21.367 44.09 18.882 51.548-7.971 5.951-21.426 5.252-305.141-.77-313.044-2.617-3.433-11.316-6.65-19.688-7.28-14.39-1.082-15.047-1.7-16.164-15.19L55.797 78.75h326.107l2.574 11.718c2.93 13.34-1.711 18.133-17.648 18.225-19.29.11-21.83 7.13-21.83 60.325V217.5h135v-48.169c0-41.902-.892-48.976-6.858-54.375-3.772-3.413-10.384-6.206-14.693-6.206-15.006 0-19.699-4.116-19.699-17.276V78.75h161.703l-1.164 14.063c-1.132 13.677-1.605 14.094-17.28 15.224-13.45.97-16.737 2.798-19.876 11.053-5.802 15.26-2.837 249.42 3.25 256.747 2.617 3.15 11.477 6.801 19.688 8.114C599.596 386.274 600 386.745 600 401.37v15.03l-79.687-1.012-79.688-1.012-1.137-13.607c-1.135-13.594-1.12-13.61 16.875-16.305 9.907-1.484 19.252-4.642 20.767-7.018 1.515-2.376 2.781-30.054 2.813-61.508L480 258.75H344.814l1.03 60.938 1.031 60.937 19.688 3.34c20.492 3.476 22.165 5.78 17.323 23.848-2.253 8.408-2.53 8.437-80.573 8.437H225v-14.956c0-14.536.418-15.022 14.93-17.343 8.21-1.313 17.07-4.966 19.687-8.119 3.637-4.381 4.758-35.56 4.758-132.343 0-69.636-1.23-127.842-2.735-129.348-9.738-9.743-68.924-8.348-79.154 1.866-3.087 3.081-4.993 46.77-6.525 149.486-1.455 97.609-3.646 149.68-6.69 159.02-13.551 41.573-61.403 74.912-111 77.337-22.755 1.112-28.167.082-39.232-7.468z"/></svg>'
|
|
195
|
+
|
|
196
|
+
const imagePath = gulpConfig.get('srcPath') + '/img'
|
|
197
|
+
|
|
82
198
|
const sassContents = 'html\n' +
|
|
83
199
|
' font-size: 62.5%\n' +
|
|
84
200
|
' color: #444\n' +
|
|
@@ -98,16 +214,18 @@ const sassContents = 'html\n' +
|
|
|
98
214
|
' outline: none\n' +
|
|
99
215
|
' text-decoration: none'
|
|
100
216
|
|
|
101
|
-
const sassPath = gulpConfig.get('
|
|
217
|
+
const sassPath = gulpConfig.get('sass.path')
|
|
102
218
|
|
|
103
219
|
beforeEach(
|
|
104
220
|
() => setUp.beforeEach()
|
|
105
221
|
.then(
|
|
106
222
|
async () => {
|
|
107
223
|
const srcPath = gulpConfig.get('srcPath')
|
|
108
|
-
const readmePath = gulpConfig.get('
|
|
224
|
+
const readmePath = gulpConfig.get('readme.to')
|
|
109
225
|
const sourcesPath = `${srcPath}/sources`
|
|
110
226
|
await fs.mkdirSync(sourcesPath)
|
|
227
|
+
await fs.mkdirSync(fontPath, { recursive: true })
|
|
228
|
+
await fs.mkdirSync(imagePath, { recursive: true })
|
|
111
229
|
await fs.mkdirSync(sassPath, { recursive: true })
|
|
112
230
|
return fs.writeFileSync(`${readmePath}/MAIN.md`, mainMd)
|
|
113
231
|
}
|
|
@@ -117,17 +235,17 @@ beforeEach(
|
|
|
117
235
|
afterEach(setUp.afterEach)
|
|
118
236
|
|
|
119
237
|
describe('build', () => {
|
|
120
|
-
test('when
|
|
238
|
+
test('when browser.enabled false: calls clean, distSeries, distLint, distMinify, compileReadme, testFull', done => {
|
|
121
239
|
const srcPath = gulpConfig.get('srcPath')
|
|
122
240
|
const sourcesPath = `${srcPath}/sources`
|
|
123
|
-
const distPath = gulpConfig.get('
|
|
241
|
+
const distPath = gulpConfig.get('dist.to')
|
|
124
242
|
const distSourcesPath = `${distPath}/sources`
|
|
125
|
-
const readmePath = gulpConfig.get('
|
|
126
|
-
const readmeFile = gulpConfig.get('
|
|
243
|
+
const readmePath = gulpConfig.get('readme.to')
|
|
244
|
+
const readmeFile = gulpConfig.get('readme.file')
|
|
127
245
|
fs.writeFileSync(`${sourcesPath}/file1.js`, file1Contents)
|
|
128
246
|
fs.writeFileSync(`${sourcesPath}/file2.js`, file2Contents)
|
|
129
247
|
fs.writeFileSync(`${srcPath}/main.js`, mainFileContents)
|
|
130
|
-
gulpConfig.set('
|
|
248
|
+
gulpConfig.set('browser.enabled', false)
|
|
131
249
|
expect.assertions(13)
|
|
132
250
|
build(() => {
|
|
133
251
|
// Called 'clean'
|
|
@@ -163,19 +281,19 @@ describe('build', () => {
|
|
|
163
281
|
})
|
|
164
282
|
}, 30000)
|
|
165
283
|
|
|
166
|
-
test('when
|
|
284
|
+
test('when browser.enabled true: calls clean, distSeries, distLint, distMinify, bundle, bundleLint, bundleMinify, compileReadme, testFull', done => {
|
|
167
285
|
const srcPath = gulpConfig.get('srcPath')
|
|
168
286
|
const sourcesPath = `${srcPath}/sources`
|
|
169
|
-
const distPath = gulpConfig.get('
|
|
170
|
-
const browserFile = gulpConfig.get('
|
|
171
|
-
const browserPath = gulpConfig.get('
|
|
287
|
+
const distPath = gulpConfig.get('dist.to')
|
|
288
|
+
const browserFile = gulpConfig.get('browser.name')
|
|
289
|
+
const browserPath = gulpConfig.get('browser.to')
|
|
172
290
|
const bundledFile = `${browserPath}/${browserFile}.js`
|
|
173
|
-
const readmePath = gulpConfig.get('
|
|
174
|
-
const readmeFile = gulpConfig.get('
|
|
291
|
+
const readmePath = gulpConfig.get('readme.to')
|
|
292
|
+
const readmeFile = gulpConfig.get('readme.file')
|
|
175
293
|
fs.writeFileSync(`${sourcesPath}/file1.js`, file1Contents)
|
|
176
294
|
fs.writeFileSync(`${sourcesPath}/file2.js`, file2Contents)
|
|
177
295
|
fs.writeFileSync(`${srcPath}/main.js`, mainFileContents)
|
|
178
|
-
gulpConfig.set('
|
|
296
|
+
gulpConfig.set('browser.enabled', true)
|
|
179
297
|
expect.assertions(13)
|
|
180
298
|
build(() => {
|
|
181
299
|
// Called 'clean'
|
|
@@ -212,22 +330,138 @@ describe('build', () => {
|
|
|
212
330
|
})
|
|
213
331
|
}, 30000)
|
|
214
332
|
|
|
215
|
-
test('when
|
|
333
|
+
test('when browser.enabled true and fonts.enabled true: calls clean, distSeries, distLint, distMinify, bundle, bundleLint, bundleMinify, compileReadme, testFull, copyFonts', done => {
|
|
334
|
+
const srcPath = gulpConfig.get('srcPath')
|
|
335
|
+
const sourcesPath = `${srcPath}/sources`
|
|
336
|
+
const distPath = gulpConfig.get('dist.to')
|
|
337
|
+
const browserFile = gulpConfig.get('browser.name')
|
|
338
|
+
const browserPath = gulpConfig.get('browser.to')
|
|
339
|
+
const bundledFile = `${browserPath}/${browserFile}.js`
|
|
340
|
+
const readmePath = gulpConfig.get('readme.to')
|
|
341
|
+
const readmeFile = gulpConfig.get('readme.file')
|
|
342
|
+
const fontFile = `${fontPath}/comic-sans.woff`
|
|
343
|
+
fs.writeFileSync(fontFile, fontContent)
|
|
344
|
+
fs.writeFileSync(`${sourcesPath}/file1.js`, file1Contents)
|
|
345
|
+
fs.writeFileSync(`${sourcesPath}/file2.js`, file2Contents)
|
|
346
|
+
fs.writeFileSync(`${srcPath}/main.js`, mainFileContents)
|
|
347
|
+
gulpConfig.set('browser.enabled', true)
|
|
348
|
+
gulpConfig.set('fonts.enabled', true)
|
|
349
|
+
expect.assertions(14)
|
|
350
|
+
build(() => {
|
|
351
|
+
// Called 'clean'
|
|
352
|
+
expect(clean).toHaveBeenCalled()
|
|
353
|
+
|
|
354
|
+
// Created dist directory (distSeries)
|
|
355
|
+
expect(fs.existsSync(distPath)).toBeTruthy()
|
|
356
|
+
|
|
357
|
+
// Minify the dist files (distMinify)
|
|
358
|
+
expect(fs.existsSync(`${distPath}/main.min.js`)).toBeTruthy()
|
|
359
|
+
const babelifiedMain = fs.readFileSync(`${distPath}/main.js`).toString()
|
|
360
|
+
// Used single quotes because of distLint
|
|
361
|
+
expect(countMatches(babelifiedMain, '\'use strict\'')).toEqual(1)
|
|
362
|
+
|
|
363
|
+
// Created browser directory (bundle)
|
|
364
|
+
expect(fs.existsSync(browserPath)).toBeTruthy()
|
|
365
|
+
|
|
366
|
+
// Minify the browser files (bundleMinify)
|
|
367
|
+
expect(fs.existsSync(`${browserPath}/${browserFile}.min.js`)).toBeTruthy()
|
|
368
|
+
const bundledContents = fs.readFileSync(bundledFile).toString()
|
|
369
|
+
expect(countMatches(bundledContents, 'file1')).toEqual(7)
|
|
370
|
+
expect(countMatches(bundledContents, 'file2')).toEqual(7)
|
|
371
|
+
|
|
372
|
+
// Generated README.md (compileReadme)
|
|
373
|
+
const readmeContents = fs.readFileSync(`${readmePath}/${readmeFile}`).toString()
|
|
374
|
+
expect(countMatches(readmeContents, mainMd)).toEqual(1)
|
|
375
|
+
expect(countMatches(readmeContents, 'test-build')).toEqual(4)
|
|
376
|
+
expect(countMatches(readmeContents, 'file1')).toEqual(4)
|
|
377
|
+
expect(countMatches(readmeContents, 'file2')).toEqual(4)
|
|
378
|
+
|
|
379
|
+
// Ran 'testFull'
|
|
380
|
+
expect(testFull).toHaveBeenCalled()
|
|
381
|
+
|
|
382
|
+
// Ran 'fonts'
|
|
383
|
+
const fontDest = gulpConfig.get('fonts.to')
|
|
384
|
+
const movedFont = fs.readFileSync(`${fontDest}/comic-sans.woff`).toString()
|
|
385
|
+
expect(movedFont).toEqual(fontContent)
|
|
386
|
+
|
|
387
|
+
done()
|
|
388
|
+
})
|
|
389
|
+
}, 30000)
|
|
390
|
+
|
|
391
|
+
test('when browser.enabled true and images.enabled true: calls clean, distSeries, distLint, distMinify, bundle, bundleLint, bundleMinify, compileReadme, testFull, images', done => {
|
|
392
|
+
const srcPath = gulpConfig.get('srcPath')
|
|
393
|
+
const sourcesPath = `${srcPath}/sources`
|
|
394
|
+
const distPath = gulpConfig.get('dist.to')
|
|
395
|
+
const browserFile = gulpConfig.get('browser.name')
|
|
396
|
+
const browserPath = gulpConfig.get('browser.to')
|
|
397
|
+
const bundledFile = `${browserPath}/${browserFile}.js`
|
|
398
|
+
const readmePath = gulpConfig.get('readme.to')
|
|
399
|
+
const readmeFile = gulpConfig.get('readme.file')
|
|
400
|
+
const imageFile = `${imagePath}/logo.svg`
|
|
401
|
+
fs.writeFileSync(imageFile, imageContent)
|
|
402
|
+
fs.writeFileSync(`${sourcesPath}/file1.js`, file1Contents)
|
|
403
|
+
fs.writeFileSync(`${sourcesPath}/file2.js`, file2Contents)
|
|
404
|
+
fs.writeFileSync(`${srcPath}/main.js`, mainFileContents)
|
|
405
|
+
gulpConfig.set('browser.enabled', true)
|
|
406
|
+
gulpConfig.set('images.enabled', true)
|
|
407
|
+
expect.assertions(14)
|
|
408
|
+
build(() => {
|
|
409
|
+
// Called 'clean'
|
|
410
|
+
expect(clean).toHaveBeenCalled()
|
|
411
|
+
|
|
412
|
+
// Created dist directory (distSeries)
|
|
413
|
+
expect(fs.existsSync(distPath)).toBeTruthy()
|
|
414
|
+
|
|
415
|
+
// Minify the dist files (distMinify)
|
|
416
|
+
expect(fs.existsSync(`${distPath}/main.min.js`)).toBeTruthy()
|
|
417
|
+
const babelifiedMain = fs.readFileSync(`${distPath}/main.js`).toString()
|
|
418
|
+
// Used single quotes because of distLint
|
|
419
|
+
expect(countMatches(babelifiedMain, '\'use strict\'')).toEqual(1)
|
|
420
|
+
|
|
421
|
+
// Created browser directory (bundle)
|
|
422
|
+
expect(fs.existsSync(browserPath)).toBeTruthy()
|
|
423
|
+
|
|
424
|
+
// Minify the browser files (bundleMinify)
|
|
425
|
+
expect(fs.existsSync(`${browserPath}/${browserFile}.min.js`)).toBeTruthy()
|
|
426
|
+
const bundledContents = fs.readFileSync(bundledFile).toString()
|
|
427
|
+
expect(countMatches(bundledContents, 'file1')).toEqual(7)
|
|
428
|
+
expect(countMatches(bundledContents, 'file2')).toEqual(7)
|
|
429
|
+
|
|
430
|
+
// Generated README.md (compileReadme)
|
|
431
|
+
const readmeContents = fs.readFileSync(`${readmePath}/${readmeFile}`).toString()
|
|
432
|
+
expect(countMatches(readmeContents, mainMd)).toEqual(1)
|
|
433
|
+
expect(countMatches(readmeContents, 'test-build')).toEqual(4)
|
|
434
|
+
expect(countMatches(readmeContents, 'file1')).toEqual(4)
|
|
435
|
+
expect(countMatches(readmeContents, 'file2')).toEqual(4)
|
|
436
|
+
|
|
437
|
+
// Ran 'testFull'
|
|
438
|
+
expect(testFull).toHaveBeenCalled()
|
|
439
|
+
|
|
440
|
+
// Ran 'images'
|
|
441
|
+
const imageDest = gulpConfig.get('images.to')
|
|
442
|
+
const movedImage = fs.readFileSync(`${imageDest}/logo.svg`).toString()
|
|
443
|
+
expect(movedImage).toEqual(imageCompressed)
|
|
444
|
+
|
|
445
|
+
done()
|
|
446
|
+
})
|
|
447
|
+
}, 30000)
|
|
448
|
+
|
|
449
|
+
test('when browser.enabled true and sass.enabled true: calls clean, distSeries, distLint, distMinify, bundle, bundleLint, bundleMinify, compileReadme, testFull, sass', done => {
|
|
216
450
|
const srcPath = gulpConfig.get('srcPath')
|
|
217
451
|
const sourcesPath = `${srcPath}/sources`
|
|
218
|
-
const distPath = gulpConfig.get('
|
|
219
|
-
const browserFile = gulpConfig.get('
|
|
220
|
-
const browserPath = gulpConfig.get('
|
|
452
|
+
const distPath = gulpConfig.get('dist.to')
|
|
453
|
+
const browserFile = gulpConfig.get('browser.name')
|
|
454
|
+
const browserPath = gulpConfig.get('browser.to')
|
|
221
455
|
const bundledFile = `${browserPath}/${browserFile}.js`
|
|
222
|
-
const readmePath = gulpConfig.get('
|
|
223
|
-
const readmeFile = gulpConfig.get('
|
|
456
|
+
const readmePath = gulpConfig.get('readme.to')
|
|
457
|
+
const readmeFile = gulpConfig.get('readme.file')
|
|
224
458
|
const sassFile = `${sassPath}/sassFor.sass`
|
|
225
459
|
fs.writeFileSync(sassFile, sassContents)
|
|
226
460
|
fs.writeFileSync(`${sourcesPath}/file1.js`, file1Contents)
|
|
227
461
|
fs.writeFileSync(`${sourcesPath}/file2.js`, file2Contents)
|
|
228
462
|
fs.writeFileSync(`${srcPath}/main.js`, mainFileContents)
|
|
229
|
-
gulpConfig.set('
|
|
230
|
-
gulpConfig.set('
|
|
463
|
+
gulpConfig.set('browser.enabled', true)
|
|
464
|
+
gulpConfig.set('sass.enabled', true)
|
|
231
465
|
expect.assertions(16)
|
|
232
466
|
build(() => {
|
|
233
467
|
// Called 'clean'
|
|
@@ -262,7 +496,7 @@ describe('build', () => {
|
|
|
262
496
|
expect(testFull).toHaveBeenCalled()
|
|
263
497
|
|
|
264
498
|
// Ran 'sass'
|
|
265
|
-
const cssPath = gulpConfig.get('
|
|
499
|
+
const cssPath = gulpConfig.get('sass.to')
|
|
266
500
|
const cssContents = fs.readFileSync(`${cssPath}/sassFor.css`).toString()
|
|
267
501
|
expect(countMatches(cssContents, ';')).toEqual(13)
|
|
268
502
|
expect(countMatches(cssContents, '{')).toEqual(3)
|
|
@@ -272,18 +506,19 @@ describe('build', () => {
|
|
|
272
506
|
})
|
|
273
507
|
}, 30000)
|
|
274
508
|
|
|
275
|
-
test('when
|
|
509
|
+
test('when browser.enabled false and typescript.enabled set: calls clean, tsFor, distFor, distLint, distMinify, compileReadme, testFull', done => {
|
|
276
510
|
const srcPath = gulpConfig.get('srcPath')
|
|
277
511
|
const rootPath = gulpConfig.get('rootPath')
|
|
278
512
|
const tsConfig = `${rootPath}/tsconfig.json`
|
|
279
|
-
const distPath = gulpConfig.get('
|
|
280
|
-
const readmePath = gulpConfig.get('
|
|
281
|
-
const readmeFile = gulpConfig.get('
|
|
513
|
+
const distPath = gulpConfig.get('dist.to')
|
|
514
|
+
const readmePath = gulpConfig.get('readme.to')
|
|
515
|
+
const readmeFile = gulpConfig.get('readme.file')
|
|
282
516
|
fs.writeFileSync(`${srcPath}/main.ts`, mainTypescript)
|
|
283
517
|
fs.writeFileSync(tsConfig, tsConfigContents)
|
|
284
|
-
gulpConfig.set('
|
|
285
|
-
gulpConfig.set('
|
|
286
|
-
gulpConfig.set('
|
|
518
|
+
gulpConfig.set('browser.enabled', false)
|
|
519
|
+
gulpConfig.set('typescript.config', tsConfig)
|
|
520
|
+
gulpConfig.set('typescript.enabled', true)
|
|
521
|
+
gulpConfig.set('readme.from', `${distPath}/**/*.js`)
|
|
287
522
|
expect.assertions(8)
|
|
288
523
|
build(() => {
|
|
289
524
|
// Called 'clean'
|
|
@@ -311,21 +546,22 @@ describe('build', () => {
|
|
|
311
546
|
})
|
|
312
547
|
}, 30000)
|
|
313
548
|
|
|
314
|
-
test('when
|
|
549
|
+
test('when browser.enabled true and typescript.enabled set: calls clean, tsFor, distFor, distLint, distMinify, bundle, bundleLint, bundleMinify, compileReadme, testFull', done => {
|
|
315
550
|
const srcPath = gulpConfig.get('srcPath')
|
|
316
551
|
const rootPath = gulpConfig.get('rootPath')
|
|
317
552
|
const tsConfig = `${rootPath}/tsconfig.json`
|
|
318
|
-
const distPath = gulpConfig.get('
|
|
319
|
-
const browserFile = gulpConfig.get('
|
|
320
|
-
const browserPath = gulpConfig.get('
|
|
553
|
+
const distPath = gulpConfig.get('dist.to')
|
|
554
|
+
const browserFile = gulpConfig.get('browser.name')
|
|
555
|
+
const browserPath = gulpConfig.get('browser.to')
|
|
321
556
|
const bundledFile = `${browserPath}/${browserFile}.js`
|
|
322
|
-
const readmePath = gulpConfig.get('
|
|
323
|
-
const readmeFile = gulpConfig.get('
|
|
557
|
+
const readmePath = gulpConfig.get('readme.to')
|
|
558
|
+
const readmeFile = gulpConfig.get('readme.file')
|
|
324
559
|
fs.writeFileSync(`${srcPath}/main.ts`, mainTypescript)
|
|
325
560
|
fs.writeFileSync(tsConfig, tsConfigContents)
|
|
326
|
-
gulpConfig.set('
|
|
327
|
-
gulpConfig.set('
|
|
328
|
-
gulpConfig.set('
|
|
561
|
+
gulpConfig.set('browser.enabled', true)
|
|
562
|
+
gulpConfig.set('typescript.config', tsConfig)
|
|
563
|
+
gulpConfig.set('typescript.enabled', true)
|
|
564
|
+
gulpConfig.set('readme.from', `${distPath}/**/*.js`)
|
|
329
565
|
expect.assertions(11)
|
|
330
566
|
build(() => {
|
|
331
567
|
// Called 'clean'
|
package/functions/bundle.js
CHANGED
|
@@ -5,13 +5,12 @@ const source = require('vinyl-source-stream')
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Starting at the distribution entry point, bundle all the files into a single file and store them in the specified output directory.
|
|
8
|
-
* @function
|
|
9
8
|
* @memberOf module:js-build-tools
|
|
10
9
|
* @returns {stream.Stream}
|
|
11
10
|
*/
|
|
12
|
-
const bundle = () => browserify(gulpConfig.get('
|
|
11
|
+
const bundle = () => browserify(gulpConfig.get('dist.main'))
|
|
13
12
|
.bundle()
|
|
14
|
-
.pipe(source(`${gulpConfig.get('
|
|
15
|
-
.pipe(dest(gulpConfig.get('
|
|
13
|
+
.pipe(source(`${gulpConfig.get('browser.name')}.js`))
|
|
14
|
+
.pipe(dest(gulpConfig.get('browser.to')))
|
|
16
15
|
|
|
17
16
|
module.exports = bundle
|
package/functions/bundle.test.js
CHANGED
|
@@ -3,7 +3,7 @@ const setUp = require('./test-helpers/setUp')
|
|
|
3
3
|
setUp.setDefaults('test-bundle')
|
|
4
4
|
const gulpConfig = setUp.gulpConfig
|
|
5
5
|
const bundle = require('./bundle')
|
|
6
|
-
const { countMatches } = require('
|
|
6
|
+
const { countMatches } = require('test-filesystem')
|
|
7
7
|
|
|
8
8
|
const file1Contents = 'function file1 () {\n' +
|
|
9
9
|
' console.log(\'Hello from file1\')\n' +
|
|
@@ -27,8 +27,8 @@ beforeEach(
|
|
|
27
27
|
() => setUp.beforeEach()
|
|
28
28
|
.then(
|
|
29
29
|
async () => {
|
|
30
|
-
const distPath = gulpConfig.get('
|
|
31
|
-
const mainFile = gulpConfig.get('
|
|
30
|
+
const distPath = gulpConfig.get('dist.to')
|
|
31
|
+
const mainFile = gulpConfig.get('dist.main')
|
|
32
32
|
const sourcesPath = `${distPath}/sources`
|
|
33
33
|
await fs.mkdirSync(distPath)
|
|
34
34
|
await fs.mkdirSync(sourcesPath)
|
|
@@ -43,9 +43,9 @@ afterEach(setUp.afterEach)
|
|
|
43
43
|
|
|
44
44
|
describe('bundle', () => {
|
|
45
45
|
test('copies all the dist contents into a single file for browsers', done => {
|
|
46
|
-
const distPath = gulpConfig.get('
|
|
47
|
-
const destFile = `${gulpConfig.get('
|
|
48
|
-
const destPath = gulpConfig.get('
|
|
46
|
+
const distPath = gulpConfig.get('dist.to')
|
|
47
|
+
const destFile = `${gulpConfig.get('browser.name')}.js`
|
|
48
|
+
const destPath = gulpConfig.get('browser.to')
|
|
49
49
|
const bundledFile = `${destPath}/${destFile}`
|
|
50
50
|
const sourcesPath = `${distPath}/sources`
|
|
51
51
|
const file1Path = `${sourcesPath}/file1.js`
|
package/functions/bundleLint.js
CHANGED
|
@@ -4,16 +4,15 @@ const standard = require('gulp-standard')
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Applies Standard code style linting to bundled file.
|
|
7
|
-
* @function
|
|
8
7
|
* @memberOf module:js-build-tools
|
|
9
8
|
* @returns {stream.Stream}
|
|
10
9
|
*/
|
|
11
|
-
const bundleLint = () => src(`${gulpConfig.get('
|
|
10
|
+
const bundleLint = () => src(`${gulpConfig.get('browser.to')}/${gulpConfig.get('browser.name')}.js`)
|
|
12
11
|
.pipe(standard({ fix: true }))
|
|
13
12
|
.pipe(standard.reporter('default', {
|
|
14
13
|
fix: true,
|
|
15
14
|
quiet: true
|
|
16
15
|
}))
|
|
17
|
-
.pipe(dest(gulpConfig.get('
|
|
16
|
+
.pipe(dest(gulpConfig.get('browser.to')))
|
|
18
17
|
|
|
19
18
|
module.exports = bundleLint
|
|
@@ -3,7 +3,7 @@ const setUp = require('./test-helpers/setUp')
|
|
|
3
3
|
setUp.setDefaults('test-bundle-lint')
|
|
4
4
|
const gulpConfig = setUp.gulpConfig
|
|
5
5
|
const bundleLint = require('./bundleLint')
|
|
6
|
-
const { countMatches } = require('
|
|
6
|
+
const { countMatches } = require('test-filesystem')
|
|
7
7
|
|
|
8
8
|
const lintableContents = 'const gulpConfig = require("../gulp.config.js");\n' +
|
|
9
9
|
'const { dest, src } = require("gulp");\n' +
|
|
@@ -27,8 +27,8 @@ beforeEach(
|
|
|
27
27
|
() => setUp.beforeEach()
|
|
28
28
|
.then(
|
|
29
29
|
async () => {
|
|
30
|
-
const browserPath = gulpConfig.get('
|
|
31
|
-
const browserName = gulpConfig.get('
|
|
30
|
+
const browserPath = gulpConfig.get('browser.to')
|
|
31
|
+
const browserName = gulpConfig.get('browser.name')
|
|
32
32
|
await fs.mkdirSync(browserPath)
|
|
33
33
|
return fs.writeFileSync(`${browserPath}/${browserName}.js`, lintableContents)
|
|
34
34
|
}
|
|
@@ -39,8 +39,8 @@ afterEach(setUp.afterEach)
|
|
|
39
39
|
|
|
40
40
|
describe('bundleLint', () => {
|
|
41
41
|
test('copies the src directory and babelifies it into the dist directory', done => {
|
|
42
|
-
const browserPath = gulpConfig.get('
|
|
43
|
-
const browserName = gulpConfig.get('
|
|
42
|
+
const browserPath = gulpConfig.get('browser.to')
|
|
43
|
+
const browserName = gulpConfig.get('browser.name')
|
|
44
44
|
const fullPath = `${browserPath}/${browserName}.js`
|
|
45
45
|
const oldContents = fs.readFileSync(fullPath).toString()
|
|
46
46
|
expect.assertions(4)
|
|
@@ -3,10 +3,9 @@ const minifyFor = require('./partials/minifyFor')
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Creates the minified bundle file.
|
|
6
|
-
* @function
|
|
7
6
|
* @memberOf module:js-build-tools
|
|
8
7
|
* @returns {*}
|
|
9
8
|
*/
|
|
10
|
-
const bundleMinify = () => minifyFor(`${gulpConfig.get('
|
|
9
|
+
const bundleMinify = () => minifyFor(`${gulpConfig.get('browser.to')}/${gulpConfig.get('browser.name')}.js`, gulpConfig.get('browser.to'))
|
|
11
10
|
|
|
12
11
|
module.exports = bundleMinify
|
|
@@ -9,6 +9,6 @@ describe('bundleMinify', () => {
|
|
|
9
9
|
test('calls minifyFor with configurations', () => {
|
|
10
10
|
expect.assertions(1)
|
|
11
11
|
bundleMinify()
|
|
12
|
-
expect(minifyFor).toHaveBeenCalledWith(`${gulpConfig.get('
|
|
12
|
+
expect(minifyFor).toHaveBeenCalledWith(`${gulpConfig.get('browser.to')}/${gulpConfig.get('browser.name')}.js`, gulpConfig.get('browser.to'))
|
|
13
13
|
})
|
|
14
14
|
})
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const copyFor = require('./partials/copyFor.js')
|
|
2
|
+
const gulpConfig = require('../gulp.config.js')
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Move the font files into the browser directory.
|
|
6
|
+
* @memberOf module:js-build-tools
|
|
7
|
+
* @return {stream.Stream}
|
|
8
|
+
*/
|
|
9
|
+
const copyFonts = () => copyFor(gulpConfig.get('fonts.from'), gulpConfig.get('fonts.to'))
|
|
10
|
+
|
|
11
|
+
module.exports = copyFonts
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const setUp = require('./test-helpers/setUp')
|
|
3
|
+
setUp.setDefaults('test-copy-fonts')
|
|
4
|
+
const gulpConfig = setUp.gulpConfig
|
|
5
|
+
const copyFonts = require('./copyFonts')
|
|
6
|
+
|
|
7
|
+
const fontContent = 'comic sans'
|
|
8
|
+
|
|
9
|
+
beforeEach(setUp.beforeEach)
|
|
10
|
+
|
|
11
|
+
afterEach(setUp.afterEach)
|
|
12
|
+
|
|
13
|
+
describe('copyFonts', () => {
|
|
14
|
+
test('uses the configured paths', done => {
|
|
15
|
+
const srcPath = gulpConfig.get('srcPath') + '/fonts'
|
|
16
|
+
fs.mkdirSync(srcPath, { recursive: true })
|
|
17
|
+
const fontFile = `${srcPath}/comic-sans.woff`
|
|
18
|
+
fs.writeFileSync(fontFile, fontContent)
|
|
19
|
+
const fontPath = gulpConfig.get('fonts.to')
|
|
20
|
+
expect.assertions(1)
|
|
21
|
+
copyFonts()
|
|
22
|
+
.on('finish', () => {
|
|
23
|
+
expect(fs.existsSync(fontPath)).toBeTruthy()
|
|
24
|
+
done()
|
|
25
|
+
})
|
|
26
|
+
.on('error', error => {
|
|
27
|
+
console.error('Encountered error', error)
|
|
28
|
+
done()
|
|
29
|
+
})
|
|
30
|
+
}, 10000)
|
|
31
|
+
})
|
package/functions/default.js
CHANGED
|
@@ -9,6 +9,6 @@ const { series } = require('gulp')
|
|
|
9
9
|
* @param {function} [done=null]
|
|
10
10
|
* @returns {stream.Stream}
|
|
11
11
|
*/
|
|
12
|
-
const defaultCmd = (done = null) => gulpConfig.get('
|
|
12
|
+
const defaultCmd = (done = null) => gulpConfig.get('browser.enabled') ? series(dist, bundle)(done) : series(dist)(done)
|
|
13
13
|
|
|
14
14
|
module.exports = defaultCmd
|
|
@@ -10,7 +10,7 @@ jest.mock('./dist', () => jest.fn(genericFunction))
|
|
|
10
10
|
|
|
11
11
|
describe('distMinify', () => {
|
|
12
12
|
test('calls dist for nodeOnly true', done => {
|
|
13
|
-
gulpConfig.set('
|
|
13
|
+
gulpConfig.set('browser.enabled', false)
|
|
14
14
|
expect.assertions(1)
|
|
15
15
|
defaultCmd()
|
|
16
16
|
setTimeout(() => {
|
|
@@ -20,7 +20,7 @@ describe('distMinify', () => {
|
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
test('calls dist and bundle for nodeOnly false', done => {
|
|
23
|
-
gulpConfig.set('
|
|
23
|
+
gulpConfig.set('browser.enabled', true)
|
|
24
24
|
expect.assertions(2)
|
|
25
25
|
defaultCmd()
|
|
26
26
|
setTimeout(() => {
|