js-build-tools 3.0.3 → 4.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 +431 -691
- package/babel.config.js +1 -1
- package/dist/build.js +58 -59
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +17 -12
- package/dist/bundle.min.js +1 -1
- package/dist/bundleLint.js +21 -17
- package/dist/bundleLint.min.js +1 -1
- package/dist/bundleMinify.js +14 -8
- package/dist/bundleMinify.min.js +1 -1
- package/dist/compileReadme.js +10 -13
- package/dist/compileReadme.min.js +1 -1
- package/dist/copyFonts.js +14 -8
- package/dist/copyFonts.min.js +1 -1
- package/dist/default.js +19 -15
- package/dist/default.min.js +1 -1
- package/dist/dist.js +10 -7
- package/dist/dist.min.js +1 -1
- package/dist/distLint.js +21 -17
- package/dist/distLint.min.js +1 -1
- package/dist/distMinify.js +14 -8
- package/dist/distMinify.min.js +1 -1
- package/dist/images.js +10 -7
- package/dist/images.min.js +1 -1
- package/dist/partials/addToReadme.js +19 -14
- package/dist/partials/beginWatcher.js +14 -10
- package/dist/partials/clean.js +17 -11
- package/dist/partials/copyFor.js +10 -10
- package/dist/partials/distFor.js +27 -17
- package/dist/partials/distForSrc.js +16 -10
- package/dist/partials/distSeries.js +24 -20
- package/dist/partials/imagesFor.js +27 -28
- package/dist/partials/minifyFor.js +17 -16
- package/dist/partials/readmeTemplate.js +16 -12
- package/dist/partials/removeDirectory.js +12 -12
- package/dist/partials/runOnChange.js +30 -28
- package/dist/partials/sassFor.js +28 -21
- package/dist/partials/tsFor.js +24 -21
- package/dist/partials.js +103 -41
- package/dist/partials.min.js +1 -1
- package/dist/sass.js +10 -7
- package/dist/sass.min.js +1 -1
- package/dist/test-helpers/setUp.js +68 -65
- package/dist/testFull.js +22 -17
- package/dist/testFull.min.js +1 -1
- package/dist/testHelpers.js +11 -15
- package/dist/testHelpers.min.js +1 -1
- package/dist/testQuick.js +24 -19
- package/dist/testQuick.min.js +1 -1
- package/dist/typeScript.js +9 -7
- package/dist/typeScript.min.js +1 -1
- package/dist/utilities/dotGet.js +45 -43
- package/dist/utilities/dotNotate.js +53 -51
- package/dist/utilities/dotSet.js +39 -37
- package/dist/utilities/isObject.js +9 -5
- package/dist/utilities/strAfter.js +18 -14
- package/dist/utilities/strBefore.js +18 -14
- package/dist/watchFull.js +10 -10
- package/dist/watchFull.min.js +1 -1
- package/dist/watchTest.js +17 -13
- package/dist/watchTest.min.js +1 -1
- package/functions/{build.js → build.mjs} +14 -16
- package/functions/{build.test.js → build.test.mjs} +9 -8
- package/functions/{bundle.js → bundle.mjs} +5 -7
- package/functions/{bundle.test.js → bundle.test.mjs} +5 -4
- package/functions/{bundleLint.js → bundleLint.mjs} +4 -6
- package/functions/{bundleLint.test.js → bundleLint.test.mjs} +5 -4
- package/functions/bundleMinify.mjs +9 -0
- package/functions/bundleMinify.test.mjs +15 -0
- package/functions/compileReadme.mjs +9 -0
- package/functions/{compileReadme.test.js → compileReadme.test.mjs} +4 -4
- package/functions/copyFonts.mjs +9 -0
- package/functions/{copyFonts.test.js → copyFonts.test.mjs} +4 -3
- package/functions/default.mjs +12 -0
- package/functions/{default.test.js → default.test.mjs} +8 -7
- package/functions/{dist.js → dist.mjs} +2 -4
- package/functions/{dist.test.js → dist.test.mjs} +4 -3
- package/functions/{distLint.js → distLint.mjs} +4 -6
- package/functions/{distLint.test.js → distLint.test.mjs} +5 -4
- package/functions/distMinify.mjs +9 -0
- package/functions/distMinify.test.mjs +15 -0
- package/functions/{images.js → images.mjs} +2 -4
- package/functions/{images.test.js → images.test.mjs} +4 -3
- package/functions/partials/{addToReadme.js → addToReadme.mjs} +5 -7
- package/functions/partials/{addToReadme.test.js → addToReadme.test.mjs} +4 -3
- package/functions/partials/beginWatcher.mjs +9 -0
- package/functions/partials/{beginWatcher.test.js → beginWatcher.test.mjs} +4 -3
- package/functions/partials/clean.mjs +13 -0
- package/functions/partials/{clean.test.js → clean.test.mjs} +4 -3
- package/functions/partials/{copyFor.js → copyFor.mjs} +2 -4
- package/functions/partials/{copyFor.test.js → copyFor.test.mjs} +4 -3
- package/functions/partials/distFor.mjs +22 -0
- package/functions/partials/{distFor.test.js → distFor.test.mjs} +49 -8
- package/functions/partials/{distForSrc.js → distForSrc.mjs} +2 -4
- package/functions/partials/{distForSrc.test.js → distForSrc.test.mjs} +3 -2
- package/functions/partials/{distSeries.js → distSeries.mjs} +6 -8
- package/functions/partials/{distSeries.test.js → distSeries.test.mjs} +7 -6
- package/functions/partials/{imagesFor.js → imagesFor.mjs} +5 -13
- package/functions/partials/{imagesFor.test.js → imagesFor.test.mjs} +4 -3
- package/functions/partials/minifyFor.mjs +15 -0
- package/functions/partials/{minifyFor.test.js → minifyFor.test.mjs} +5 -4
- package/functions/partials/readmeTemplate.mjs +12 -0
- package/functions/partials/{readmeTemplate.test.js → readmeTemplate.test.mjs} +4 -3
- package/functions/partials/{removeDirectory.js → removeDirectory.mjs} +2 -4
- package/functions/partials/{removeDirectory.test.js → removeDirectory.test.mjs} +28 -28
- package/functions/partials/{runOnChange.js → runOnChange.mjs} +6 -8
- package/functions/partials/{runOnChange.test.js → runOnChange.test.mjs} +12 -11
- package/functions/partials/sassFor.mjs +22 -0
- package/functions/partials/{sassFor.test.js → sassFor.test.mjs} +5 -4
- package/functions/partials/{tsFor.js → tsFor.mjs} +4 -6
- package/functions/partials/{tsFor.test.js → tsFor.test.mjs} +5 -4
- package/functions/partials.mjs +23 -0
- package/functions/{partials.test.js → partials.test.mjs} +1 -1
- package/functions/sass.mjs +4 -0
- package/functions/{sass.test.js → sass.test.mjs} +4 -3
- package/functions/test-helpers/{setUp.js → setUp.mjs} +25 -27
- package/functions/test-helpers/setUp.test.mjs +19 -0
- package/functions/{testFull.js → testFull.mjs} +4 -6
- package/functions/testFull.test.mjs +17 -0
- package/functions/{testHelpers.js → testHelpers.mjs} +1 -6
- package/functions/testHelpers.test.mjs +7 -0
- package/functions/{testQuick.js → testQuick.mjs} +4 -6
- package/functions/testQuick.test.mjs +17 -0
- package/functions/{typeScript.js → typeScript.mjs} +2 -4
- package/functions/typeScript.test.mjs +11 -0
- package/functions/utilities/{dotGet.js → dotGet.mjs} +4 -6
- package/functions/utilities/{dotNotate.js → dotNotate.mjs} +2 -4
- package/functions/utilities/{dotSet.js → dotSet.mjs} +4 -6
- package/functions/utilities/{isObject.js → isObject.mjs} +1 -3
- package/functions/utilities/{strAfter.js → strAfter.mjs} +11 -13
- package/functions/utilities/{strBefore.js → strBefore.mjs} +11 -13
- package/functions/{watchFull.js → watchFull.mjs} +2 -4
- package/functions/{watchFull.test.js → watchFull.test.mjs} +8 -7
- package/functions/watchTest.mjs +10 -0
- package/functions/{watchTest.test.js → watchTest.test.mjs} +7 -6
- package/gulp.config.js +20 -19
- package/gulp.config.mjs +252 -0
- package/gulpfile.base.js +20 -20
- package/gulpfile.base.mjs +27 -0
- package/package.json +20 -14
- package/functions/bundleMinify.js +0 -11
- package/functions/bundleMinify.test.js +0 -14
- package/functions/compileReadme.js +0 -11
- package/functions/copyFonts.js +0 -11
- package/functions/default.js +0 -14
- package/functions/distMinify.js +0 -11
- package/functions/distMinify.test.js +0 -14
- package/functions/partials/beginWatcher.js +0 -11
- package/functions/partials/clean.js +0 -15
- package/functions/partials/distFor.js +0 -17
- package/functions/partials/minifyFor.js +0 -15
- package/functions/partials/readmeTemplate.js +0 -14
- package/functions/partials/sassFor.js +0 -21
- package/functions/partials.js +0 -40
- package/functions/sass.js +0 -6
- package/functions/test-helpers/setUp.test.js +0 -18
- package/functions/testFull.test.js +0 -16
- package/functions/testHelpers.test.js +0 -7
- package/functions/testQuick.test.js +0 -16
- package/functions/typeScript.test.js +0 -10
- package/functions/watchTest.js +0 -12
- package/vendor/array-union/index.js +0 -31
- package/vendor/easy-transform-stream/index.js +0 -54
- package/vendor/globby/gitignore.js +0 -96
- package/vendor/globby/index.js +0 -191
- package/vendor/globby/node_modules/slash/index.js +0 -16
- package/vendor/globby/stream-utils.js +0 -58
- package/vendor/globby/to-path.js +0 -20
- package/vendor/gulp-imagemin/index.js +0 -124
- package/vendor/gulp-imagemin/node_modules/chalk/source/index.js +0 -265
- package/vendor/gulp-imagemin/node_modules/chalk/source/utilities.js +0 -36
- package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -217
- package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/supports-color/index.js +0 -154
- package/vendor/gulp-plugin-extras/index.js +0 -42
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/index.js +0 -265
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/utilities.js +0 -36
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -217
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/supports-color/index.js +0 -154
- package/vendor/gulp-plugin-extras/plugin-error.js +0 -145
- package/vendor/ignore/index.js +0 -468
- package/vendor/imagemin/index.js +0 -90
- package/vendor/imagemin-gifsicle/index.js +0 -33
- package/vendor/imagemin-mozjpeg/index.js +0 -100
- package/vendor/imagemin-mozjpeg/node_modules/execa/index.js +0 -260
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/command.js +0 -47
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/error.js +0 -102
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/kill.js +0 -123
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/promise.js +0 -47
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stdio.js +0 -50
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stream.js +0 -124
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/core.js +0 -238
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/main.js +0 -89
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/realtime.js +0 -24
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/signals.js +0 -44
- package/vendor/imagemin-mozjpeg/node_modules/is-stream/index.js +0 -25
- package/vendor/imagemin-mozjpeg/node_modules/mimic-fn/index.js +0 -70
- package/vendor/imagemin-mozjpeg/node_modules/npm-run-path/index.js +0 -52
- package/vendor/imagemin-mozjpeg/node_modules/onetime/index.js +0 -43
- package/vendor/imagemin-mozjpeg/node_modules/path-key/index.js +0 -20
- package/vendor/imagemin-mozjpeg/node_modules/strip-final-newline/index.js +0 -17
- package/vendor/imagemin-optipng/index.js +0 -44
- package/vendor/imagemin-svgo/index.js +0 -27
- package/vendor/is-jpg/index.js +0 -12
- package/vendor/junk/index.js +0 -49
- package/vendor/mozjpeg/index.js +0 -9
- package/vendor/mozjpeg/lib/index.js +0 -18
- package/vendor/mozjpeg/package.json +0 -49
- package/vendor/mozjpeg/vendor/cjpeg +0 -0
- package/vendor/mozjpeg/vendor/source/mozjpeg.tar.gz +0 -0
- package/vendor/p-pipe/index.js +0 -22
- package/vendor/plur/index.js +0 -32
- package/vendor/pretty-bytes/index.js +0 -71
- package/vendor/slash/index.js +0 -12
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.dotNotate = void 0;
|
|
7
|
+
require("core-js/modules/esnext.async-iterator.map.js");
|
|
8
|
+
require("core-js/modules/esnext.iterator.map.js");
|
|
9
|
+
var _isObject = require("./isObject.js");
|
|
8
10
|
/**
|
|
9
11
|
* Convert an array of keys into a regex, return a function to test if incoming keys match.
|
|
10
12
|
* @param {Array.<string>} [retainObjects=[]] - An array of keys to retain as objects
|
|
11
13
|
* @returns {Function} The dot-notated array
|
|
12
|
-
*/
|
|
13
|
-
const handleRetainObjects = function () {
|
|
14
|
-
let retainObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
15
|
-
if (!retainObjects.length) {
|
|
14
|
+
*/
|
|
15
|
+
const handleRetainObjects = function () {
|
|
16
|
+
let retainObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
17
|
+
if (!retainObjects.length) {
|
|
16
18
|
/**
|
|
17
19
|
* Bypass the test function if there are no retainObjects.
|
|
18
20
|
* @returns {false}
|
|
19
|
-
*/
|
|
20
|
-
return (currentKey, value, results) => false;
|
|
21
|
-
}
|
|
22
|
-
retainObjects = retainObjects.map(key => key.replace('\.', '\\.'));
|
|
23
|
-
const retainRegex = new RegExp(
|
|
21
|
+
*/
|
|
22
|
+
return (currentKey, value, results) => false;
|
|
23
|
+
}
|
|
24
|
+
retainObjects = retainObjects.map(key => key.replace('\.', '\\.'));
|
|
25
|
+
const retainRegex = new RegExp(`(${retainObjects.join('|')})$`);
|
|
24
26
|
/**
|
|
25
27
|
* Test if a key should be retained as an object.
|
|
26
28
|
* @param {string} currentKey - The key to test
|
|
27
29
|
* @param {*} value - The value of the key
|
|
28
30
|
* @param {Object} results - The result object to add to
|
|
29
31
|
* @returns {boolean}
|
|
30
|
-
*/
|
|
31
|
-
return (currentKey, value, results) => {
|
|
32
|
-
if (!currentKey.match(retainRegex)) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
results[currentKey] = value;
|
|
36
|
-
return true;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
|
|
32
|
+
*/
|
|
33
|
+
return (currentKey, value, results) => {
|
|
34
|
+
if (!currentKey.match(retainRegex)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
results[currentKey] = value;
|
|
38
|
+
return true;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
40
42
|
/**
|
|
41
43
|
* The underlying logic function for converting arrays to dot-notation.
|
|
42
44
|
* @param {Object} arrayObject - The array or object to dot-notate
|
|
@@ -44,34 +46,34 @@ const handleRetainObjects = function () {
|
|
|
44
46
|
* @param {string} [prepend=''] - The path for the property being processed
|
|
45
47
|
* @param {Object<string, *>} [results={}] - The final notated object to return
|
|
46
48
|
* @returns {Object<string, *>} The dot-notated object
|
|
47
|
-
*/
|
|
48
|
-
const performDotNotate = function (arrayObject, didRetain) {
|
|
49
|
-
let prepend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
50
|
-
let results = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
51
|
-
for (let key in arrayObject) {
|
|
52
|
-
const value = arrayObject[key];
|
|
53
|
-
const currentKey =
|
|
54
|
-
if (didRetain(currentKey, value, results)) {
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (isObject(value)) {
|
|
58
|
-
performDotNotate(value, didRetain,
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
results[currentKey] = value;
|
|
62
|
-
}
|
|
63
|
-
return results;
|
|
64
|
-
};
|
|
65
|
-
|
|
49
|
+
*/
|
|
50
|
+
const performDotNotate = function (arrayObject, didRetain) {
|
|
51
|
+
let prepend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
52
|
+
let results = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
53
|
+
for (let key in arrayObject) {
|
|
54
|
+
const value = arrayObject[key];
|
|
55
|
+
const currentKey = `${prepend}${key}`;
|
|
56
|
+
if (didRetain(currentKey, value, results)) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if ((0, _isObject.isObject)(value)) {
|
|
60
|
+
performDotNotate(value, didRetain, `${currentKey}.`, results);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
results[currentKey] = value;
|
|
64
|
+
}
|
|
65
|
+
return results;
|
|
66
|
+
};
|
|
67
|
+
|
|
66
68
|
/**
|
|
67
69
|
* Convert an array or object to a single dimensional associative array with dot notation.
|
|
68
70
|
* Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/dotNotate.ts Sí, funciona}
|
|
69
71
|
* @param {Object} arrayObject - The array or object to dot-notate
|
|
70
72
|
* @param {Array.<string>} [retainObjects=[]] - An array of keys to retain as objects
|
|
71
73
|
* @returns {Object<string, *>} The dot-notated object
|
|
72
|
-
*/
|
|
73
|
-
const dotNotate = function (arrayObject) {
|
|
74
|
-
let retainObjects = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
75
|
-
return performDotNotate(arrayObject, handleRetainObjects(retainObjects));
|
|
76
|
-
};
|
|
77
|
-
|
|
74
|
+
*/
|
|
75
|
+
const dotNotate = function (arrayObject) {
|
|
76
|
+
let retainObjects = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
77
|
+
return performDotNotate(arrayObject, handleRetainObjects(retainObjects));
|
|
78
|
+
};
|
|
79
|
+
exports.dotNotate = dotNotate;
|
package/dist/utilities/dotSet.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.dotSet = void 0;
|
|
7
|
+
var _isObject = require("./isObject.js");
|
|
8
|
+
var _strAfter = require("./strAfter.js");
|
|
9
|
+
var _strBefore = require("./strBefore.js");
|
|
7
10
|
/**
|
|
8
11
|
* Set a nested property value an object.
|
|
9
12
|
* Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/dotSet.ts Sí, funciona}
|
|
@@ -11,34 +14,33 @@ const strBefore = require('./strBefore');
|
|
|
11
14
|
* @param {string} dotNotation - The path for the property
|
|
12
15
|
* @param {*} value - The default value to return if the property is not found
|
|
13
16
|
* @returns {Object} The modified object
|
|
14
|
-
*/
|
|
15
|
-
const dotSet = function (arrayObject, dotNotation) {
|
|
16
|
-
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
arrayObject
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
arrayObject
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
module.exports = dotSet;
|
|
17
|
+
*/
|
|
18
|
+
const dotSet = function (arrayObject, dotNotation) {
|
|
19
|
+
let value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
20
|
+
let key = (0, _strBefore.strBefore)(dotNotation, '.');
|
|
21
|
+
const lastKey = !key;
|
|
22
|
+
if (lastKey) {
|
|
23
|
+
key = dotNotation;
|
|
24
|
+
}
|
|
25
|
+
if (key === '*') {
|
|
26
|
+
for (let wildKey in arrayObject) {
|
|
27
|
+
if (lastKey) {
|
|
28
|
+
arrayObject[wildKey] = value;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (!(0, _isObject.isObject)(arrayObject[wildKey])) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
dotSet(arrayObject[wildKey], (0, _strAfter.strAfter)(dotNotation, '.'), value);
|
|
35
|
+
}
|
|
36
|
+
return arrayObject;
|
|
37
|
+
}
|
|
38
|
+
if (lastKey) {
|
|
39
|
+
arrayObject[dotNotation] = value;
|
|
40
|
+
return arrayObject;
|
|
41
|
+
}
|
|
42
|
+
const next = arrayObject[key] ?? [];
|
|
43
|
+
arrayObject[key] = dotSet(next, (0, _strAfter.strAfter)(dotNotation, '.'), value);
|
|
44
|
+
return arrayObject;
|
|
45
|
+
};
|
|
46
|
+
exports.dotSet = dotSet;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isObject = void 0;
|
|
3
7
|
/**
|
|
4
8
|
* Check if the provided thing is an object / array.
|
|
5
9
|
* Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/isObject.ts Sí, funciona}
|
|
6
10
|
* @param {*} object
|
|
7
11
|
* @returns {boolean}
|
|
8
|
-
*/
|
|
9
|
-
const isObject = object => typeof object === 'object' && object !== null;
|
|
10
|
-
|
|
12
|
+
*/
|
|
13
|
+
const isObject = object => typeof object === 'object' && object !== null;
|
|
14
|
+
exports.isObject = isObject;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.strAfter = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Retrieve the string part after the search match.
|
|
9
|
+
* Original source from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/strings/strAfter.ts Sí, funciona}
|
|
10
|
+
* @param {string} str
|
|
11
|
+
* @param {string} search
|
|
12
|
+
* @returns {string}
|
|
13
|
+
*/
|
|
14
|
+
const strAfter = (str, search) => {
|
|
15
|
+
const index = str.indexOf(search);
|
|
16
|
+
return index === -1 ? '' : str.substring(index + search.length);
|
|
17
|
+
};
|
|
18
|
+
exports.strAfter = strAfter;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.strBefore = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Retrieve the string part before the search match.
|
|
9
|
+
* Original source from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/strings/strBefore.ts Sí, funciona}
|
|
10
|
+
* @param {string} str
|
|
11
|
+
* @param {string} search
|
|
12
|
+
* @returns {string}
|
|
13
|
+
*/
|
|
14
|
+
const strBefore = (str, search) => {
|
|
15
|
+
const index = str.indexOf(search);
|
|
16
|
+
return index === -1 ? '' : str.slice(0, index);
|
|
17
|
+
};
|
|
18
|
+
exports.strBefore = strBefore;
|
package/dist/watchFull.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.watchFull = void 0
|
|
7
|
+
var _partials = require('./partials.js')
|
|
8
8
|
/**
|
|
9
9
|
* Watch for changes and run the distribution for the changed files, then bundle and test the changed files.
|
|
10
10
|
* @memberOf module:js-build-tools
|
|
11
11
|
* @returns {FSWatcher}
|
|
12
|
-
*/
|
|
13
|
-
const watchFull = () => beginWatcher().on('change', runOnChange)
|
|
14
|
-
|
|
12
|
+
*/
|
|
13
|
+
const watchFull = () => (0, _partials.beginWatcher)().on('change', _partials.runOnChange)
|
|
14
|
+
exports.watchFull = watchFull
|
package/dist/watchFull.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.watchFull=void 0;var _partials=require("./partials.js");const watchFull=()=>(0,_partials.beginWatcher)().on("change",_partials.runOnChange);exports.watchFull=watchFull;
|
package/dist/watchTest.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/esnext.weak-map.delete-all.js')
|
|
4
|
+
Object.defineProperty(exports, '__esModule', {
|
|
5
|
+
value: true
|
|
6
|
+
})
|
|
7
|
+
exports.watchTest = void 0
|
|
8
|
+
var gulpConfig = _interopRequireWildcard(require('../gulp.config.js'))
|
|
9
|
+
var _gulp = require('gulp')
|
|
10
|
+
var _testQuick = require('./testQuick.js')
|
|
11
|
+
function _getRequireWildcardCache (e) { if (typeof WeakMap !== 'function') return null; var r = new WeakMap(); var t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r })(e) }
|
|
12
|
+
function _interopRequireWildcard (e, r) { if (!r && e && e.__esModule) return e; if (e === null || typeof e !== 'object' && typeof e !== 'function') return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }; var a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (u !== 'default' && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u] } return n.default = e, t && t.set(e, n), n }
|
|
9
13
|
/**
|
|
10
14
|
* Watch for changes and run the tests.
|
|
11
15
|
* @memberOf module:js-build-tools
|
|
12
16
|
* @returns {*}
|
|
13
|
-
*/
|
|
14
|
-
const watchTest = () => watch(gulpConfig.get('test.watch'), {
|
|
15
|
-
ignoreInitial: false
|
|
16
|
-
}, testQuick)
|
|
17
|
-
|
|
17
|
+
*/
|
|
18
|
+
const watchTest = () => (0, _gulp.watch)(gulpConfig.get('test.watch'), {
|
|
19
|
+
ignoreInitial: false
|
|
20
|
+
}, _testQuick.testQuick)
|
|
21
|
+
exports.watchTest = watchTest
|
package/dist/watchTest.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.watchTest=void 0;var gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_gulp=require("gulp"),_testQuick=require("./testQuick.js");function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(_getRequireWildcardCache=function(e){return e?r:t})(e)}function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=_getRequireWildcardCache(t);if(r&&r.has(e))return r.get(e);var i={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if("default"!==n&&{}.hasOwnProperty.call(e,n)){var a=u?Object.getOwnPropertyDescriptor(e,n):null;a&&(a.get||a.set)?Object.defineProperty(i,n,a):i[n]=e[n]}return i.default=e,r&&r.set(e,i),i}const watchTest=()=>(0,_gulp.watch)(gulpConfig.get("test.watch"),{ignoreInitial:!1},_testQuick.testQuick);exports.watchTest=watchTest;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { bundle } from './bundle.mjs'
|
|
2
|
+
import { bundleLint } from './bundleLint.mjs'
|
|
3
|
+
import { bundleMinify } from './bundleMinify.mjs'
|
|
4
|
+
import { clean, distSeries } from './partials.mjs'
|
|
5
|
+
import { compileReadme } from './compileReadme.mjs'
|
|
6
|
+
import { distLint } from './distLint.mjs'
|
|
7
|
+
import { distMinify } from './distMinify.mjs'
|
|
8
|
+
import { parallel, series } from 'gulp'
|
|
9
|
+
import * as gulpConfig from '../gulp.config.mjs'
|
|
10
|
+
import { copyFonts } from './copyFonts.mjs'
|
|
11
|
+
import { images } from './images.mjs'
|
|
12
|
+
import { sass } from './sass.mjs'
|
|
13
|
+
import { testFull } from './testFull.mjs'
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Runs several processes to build and validate the project.
|
|
@@ -18,7 +18,7 @@ const testFull = require('./testFull')
|
|
|
18
18
|
* @memberOf module:js-build-tools
|
|
19
19
|
* @returns {stream.Stream}
|
|
20
20
|
*/
|
|
21
|
-
const build = (done = null) => {
|
|
21
|
+
export const build = (done = null) => {
|
|
22
22
|
const distLintMinify = parallel(distLint, distMinify)
|
|
23
23
|
const bundleLintMinify = parallel(bundleLint, bundleMinify)
|
|
24
24
|
const buildActions = [clean, distSeries(), distLintMinify]
|
|
@@ -55,5 +55,3 @@ const build = (done = null) => {
|
|
|
55
55
|
...runActions
|
|
56
56
|
)(done)
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
module.exports = build
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import * as setUp from './test-helpers/setUp.mjs'
|
|
3
|
+
import { build } from './build.mjs'
|
|
4
|
+
import { clean } from './partials/clean.mjs'
|
|
5
|
+
import { testFull } from './testFull.mjs'
|
|
6
|
+
import { countMatches } from 'test-filesystem'
|
|
7
|
+
|
|
3
8
|
setUp.setDefaults('test-build')
|
|
4
9
|
const gulpConfig = setUp.gulpConfig
|
|
5
|
-
const build = require('./build')
|
|
6
|
-
const clean = require('./partials/clean')
|
|
7
|
-
const testFull = require('./testFull')
|
|
8
|
-
const { countMatches } = require('test-filesystem')
|
|
9
10
|
|
|
10
11
|
const genericFunction = () => Promise.resolve(true)
|
|
11
12
|
|
|
12
|
-
jest.mock('./partials/clean', () => jest.fn(genericFunction))
|
|
13
|
-
jest.mock('./testFull', () => jest.fn(genericFunction))
|
|
13
|
+
jest.mock('./partials/clean.mjs', () => ({ clean: jest.fn(genericFunction) }))
|
|
14
|
+
jest.mock('./testFull.mjs', () => ({ testFull: jest.fn(genericFunction) }))
|
|
14
15
|
|
|
15
16
|
const file1Contents = '/**\n' +
|
|
16
17
|
' * Console log out a greeting with given input.\n' +
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import browserify from 'browserify'
|
|
2
|
+
import { dest } from 'gulp'
|
|
3
|
+
import * as gulpConfig from '../gulp.config.mjs'
|
|
4
|
+
import source from '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
8
|
* @memberOf module:js-build-tools
|
|
9
9
|
* @returns {stream.Stream}
|
|
10
10
|
*/
|
|
11
|
-
const bundle = () => browserify(gulpConfig.get('dist.main'))
|
|
11
|
+
export const bundle = () => browserify(gulpConfig.get('dist.main'))
|
|
12
12
|
.bundle()
|
|
13
13
|
.pipe(source(`${gulpConfig.get('browser.name')}.js`))
|
|
14
14
|
.pipe(dest(gulpConfig.get('browser.to')))
|
|
15
|
-
|
|
16
|
-
module.exports = bundle
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import * as setUp from './test-helpers/setUp.mjs'
|
|
3
|
+
import { bundle } from './bundle.mjs'
|
|
4
|
+
import { countMatches } from 'test-filesystem'
|
|
5
|
+
|
|
3
6
|
setUp.setDefaults('test-bundle')
|
|
4
7
|
const gulpConfig = setUp.gulpConfig
|
|
5
|
-
const bundle = require('./bundle')
|
|
6
|
-
const { countMatches } = require('test-filesystem')
|
|
7
8
|
|
|
8
9
|
const file1Contents = 'function file1 () {\n' +
|
|
9
10
|
' console.log(\'Hello from file1\')\n' +
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { dest, src } from 'gulp'
|
|
2
|
+
import * as gulpConfig from '../gulp.config.mjs'
|
|
3
|
+
import standard from 'gulp-standard'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Applies Standard code style linting to bundled file.
|
|
7
7
|
* @memberOf module:js-build-tools
|
|
8
8
|
* @returns {stream.Stream}
|
|
9
9
|
*/
|
|
10
|
-
const bundleLint = () => src(`${gulpConfig.get('browser.to')}/${gulpConfig.get('browser.name')}.js`)
|
|
10
|
+
export const bundleLint = () => src(`${gulpConfig.get('browser.to')}/${gulpConfig.get('browser.name')}.js`)
|
|
11
11
|
.pipe(standard({ fix: true }))
|
|
12
12
|
.pipe(standard.reporter('default', {
|
|
13
13
|
fix: true,
|
|
14
14
|
quiet: true
|
|
15
15
|
}))
|
|
16
16
|
.pipe(dest(gulpConfig.get('browser.to')))
|
|
17
|
-
|
|
18
|
-
module.exports = bundleLint
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import * as setUp from './test-helpers/setUp.mjs'
|
|
3
|
+
import { bundleLint } from './bundleLint.mjs'
|
|
4
|
+
import { countMatches } from 'test-filesystem'
|
|
5
|
+
|
|
3
6
|
setUp.setDefaults('test-bundle-lint')
|
|
4
7
|
const gulpConfig = setUp.gulpConfig
|
|
5
|
-
const bundleLint = require('./bundleLint')
|
|
6
|
-
const { countMatches } = require('test-filesystem')
|
|
7
8
|
|
|
8
9
|
const lintableContents = 'const gulpConfig = require("../gulp.config.js");\n' +
|
|
9
10
|
'const { dest, src } = require("gulp");\n' +
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as gulpConfig from '../gulp.config.mjs'
|
|
2
|
+
import { minifyFor } from './partials/minifyFor.mjs'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates the minified bundle file.
|
|
6
|
+
* @memberOf module:js-build-tools
|
|
7
|
+
* @returns {*}
|
|
8
|
+
*/
|
|
9
|
+
export const bundleMinify = () => minifyFor(`${gulpConfig.get('browser.to')}/${gulpConfig.get('browser.name')}.js`, gulpConfig.get('browser.to'))
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { testHelpers } from './testHelpers.mjs'
|
|
2
|
+
import { bundleMinify } from './bundleMinify.mjs'
|
|
3
|
+
import { minifyFor } from './partials/minifyFor.mjs'
|
|
4
|
+
|
|
5
|
+
const gulpConfig = testHelpers.gulpConfig
|
|
6
|
+
|
|
7
|
+
jest.mock('./partials/minifyFor.mjs', () => ({ minifyFor: jest.fn(() => Promise.resolve(true)) }))
|
|
8
|
+
|
|
9
|
+
describe('bundleMinify', () => {
|
|
10
|
+
test('calls minifyFor with configurations', () => {
|
|
11
|
+
expect.assertions(1)
|
|
12
|
+
bundleMinify()
|
|
13
|
+
expect(minifyFor).toHaveBeenCalledWith(`${gulpConfig.get('browser.to')}/${gulpConfig.get('browser.name')}.js`, gulpConfig.get('browser.to'))
|
|
14
|
+
})
|
|
15
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { addToReadme, readmeTemplate } from './partials.mjs'
|
|
2
|
+
import { series } from 'gulp'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generate the README.md file based off of the template, then append the generated documentation.
|
|
6
|
+
* @memberOf module:js-build-tools
|
|
7
|
+
* @returns {stream.Stream}
|
|
8
|
+
*/
|
|
9
|
+
export const compileReadme = series(readmeTemplate, addToReadme)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { compileReadme } from './compileReadme.mjs'
|
|
2
|
+
import { addToReadme, readmeTemplate } from './partials.mjs'
|
|
3
3
|
|
|
4
4
|
const genericFunction = () => Promise.resolve(true)
|
|
5
|
-
jest.mock('./partials/addToReadme', () => jest.fn(genericFunction))
|
|
6
|
-
jest.mock('./partials/readmeTemplate', () => jest.fn(genericFunction))
|
|
5
|
+
jest.mock('./partials/addToReadme.mjs', () => ({ addToReadme: jest.fn(genericFunction) }))
|
|
6
|
+
jest.mock('./partials/readmeTemplate.mjs', () => ({ readmeTemplate: jest.fn(genericFunction) }))
|
|
7
7
|
|
|
8
8
|
describe('compileReadme', () => {
|
|
9
9
|
test('calls readmeTemplate and addToReadme', done => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { copyFor } from './partials/copyFor.mjs'
|
|
2
|
+
import * as gulpConfig from '../gulp.config.mjs'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Move the font files into the browser directory.
|
|
6
|
+
* @memberOf module:js-build-tools
|
|
7
|
+
* @return {stream.Stream}
|
|
8
|
+
*/
|
|
9
|
+
export const copyFonts = () => copyFor(gulpConfig.get('fonts.from'), gulpConfig.get('fonts.to'))
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import * as setUp from './test-helpers/setUp.mjs'
|
|
3
|
+
import { copyFonts } from './copyFonts.mjs'
|
|
4
|
+
|
|
3
5
|
setUp.setDefaults('test-copy-fonts')
|
|
4
6
|
const gulpConfig = setUp.gulpConfig
|
|
5
|
-
const copyFonts = require('./copyFonts')
|
|
6
7
|
|
|
7
8
|
const fontContent = 'comic sans'
|
|
8
9
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { dist } from './dist.mjs'
|
|
2
|
+
import { bundle } from './bundle.mjs'
|
|
3
|
+
import * as gulpConfig from '../gulp.config.mjs'
|
|
4
|
+
import { series } from 'gulp'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Recommended as the default task, runs the simple dist and bundle tasks.
|
|
8
|
+
* @memberOf module:js-build-tools
|
|
9
|
+
* @param {function} [done=null]
|
|
10
|
+
* @returns {stream.Stream}
|
|
11
|
+
*/
|
|
12
|
+
export const defaultCmd = (done = null) => gulpConfig.get('browser.enabled') ? series(dist, bundle)(done) : series(dist)(done)
|