js-build-tools 4.0.0 → 4.0.1

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.
Files changed (42) hide show
  1. package/README.md +267 -267
  2. package/dist/build.js +58 -58
  3. package/dist/bundle.js +17 -17
  4. package/dist/bundleLint.js +21 -21
  5. package/dist/bundleMinify.js +14 -14
  6. package/dist/compileReadme.js +10 -10
  7. package/dist/copyFonts.js +14 -14
  8. package/dist/default.js +19 -19
  9. package/dist/dist.js +10 -10
  10. package/dist/distLint.js +21 -21
  11. package/dist/distMinify.js +14 -14
  12. package/dist/images.js +10 -10
  13. package/dist/partials/addToReadme.js +18 -18
  14. package/dist/partials/beginWatcher.js +13 -13
  15. package/dist/partials/clean.js +16 -16
  16. package/dist/partials/copyFor.js +9 -9
  17. package/dist/partials/distFor.js +26 -26
  18. package/dist/partials/distForSrc.js +15 -15
  19. package/dist/partials/distSeries.js +23 -23
  20. package/dist/partials/imagesFor.js +26 -26
  21. package/dist/partials/minifyFor.js +16 -16
  22. package/dist/partials/readmeTemplate.js +15 -15
  23. package/dist/partials/removeDirectory.js +11 -11
  24. package/dist/partials/runOnChange.js +29 -29
  25. package/dist/partials/sassFor.js +27 -27
  26. package/dist/partials/tsFor.js +23 -23
  27. package/dist/partials.js +103 -103
  28. package/dist/sass.js +10 -10
  29. package/dist/test-helpers/setUp.js +67 -67
  30. package/dist/testFull.js +22 -22
  31. package/dist/testHelpers.js +11 -11
  32. package/dist/testQuick.js +24 -24
  33. package/dist/typeScript.js +9 -9
  34. package/dist/utilities/dotGet.js +44 -44
  35. package/dist/utilities/dotNotate.js +52 -52
  36. package/dist/utilities/dotSet.js +38 -38
  37. package/dist/utilities/isObject.js +8 -8
  38. package/dist/utilities/strAfter.js +11 -11
  39. package/dist/utilities/strBefore.js +11 -11
  40. package/dist/watchFull.js +10 -10
  41. package/dist/watchTest.js +17 -17
  42. package/package.json +11 -3
@@ -1,44 +1,44 @@
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");
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");
10
10
  /**
11
11
  * Convert an array of keys into a regex, return a function to test if incoming keys match.
12
12
  * @param {Array.<string>} [retainObjects=[]] - An array of keys to retain as objects
13
13
  * @returns {Function} The dot-notated array
14
- */
15
- const handleRetainObjects = function () {
16
- let retainObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
17
- if (!retainObjects.length) {
14
+ */
15
+ const handleRetainObjects = function () {
16
+ let retainObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
17
+ if (!retainObjects.length) {
18
18
  /**
19
19
  * Bypass the test function if there are no retainObjects.
20
20
  * @returns {false}
21
- */
22
- return (currentKey, value, results) => false;
23
- }
24
- retainObjects = retainObjects.map(key => key.replace('\.', '\\.'));
25
- const retainRegex = new RegExp(`(${retainObjects.join('|')})$`);
21
+ */
22
+ return (currentKey, value, results) => false;
23
+ }
24
+ retainObjects = retainObjects.map(key => key.replace('\.', '\\.'));
25
+ const retainRegex = new RegExp(`(${retainObjects.join('|')})$`);
26
26
  /**
27
27
  * Test if a key should be retained as an object.
28
28
  * @param {string} currentKey - The key to test
29
29
  * @param {*} value - The value of the key
30
30
  * @param {Object} results - The result object to add to
31
31
  * @returns {boolean}
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
-
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
+
42
42
  /**
43
43
  * The underlying logic function for converting arrays to dot-notation.
44
44
  * @param {Object} arrayObject - The array or object to dot-notate
@@ -46,34 +46,34 @@ const handleRetainObjects = function () {
46
46
  * @param {string} [prepend=''] - The path for the property being processed
47
47
  * @param {Object<string, *>} [results={}] - The final notated object to return
48
48
  * @returns {Object<string, *>} The dot-notated object
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
-
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
+
68
68
  /**
69
69
  * Convert an array or object to a single dimensional associative array with dot notation.
70
70
  * Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/dotNotate.ts Sí, funciona}
71
71
  * @param {Object} arrayObject - The array or object to dot-notate
72
72
  * @param {Array.<string>} [retainObjects=[]] - An array of keys to retain as objects
73
73
  * @returns {Object<string, *>} The dot-notated object
74
- */
75
- const dotNotate = function (arrayObject) {
76
- let retainObjects = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
77
- return performDotNotate(arrayObject, handleRetainObjects(retainObjects));
78
- };
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
79
  exports.dotNotate = dotNotate;
@@ -1,12 +1,12 @@
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");
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");
10
10
  /**
11
11
  * Set a nested property value an object.
12
12
  * Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/dotSet.ts Sí, funciona}
@@ -14,33 +14,33 @@ var _strBefore = require("./strBefore.js");
14
14
  * @param {string} dotNotation - The path for the property
15
15
  * @param {*} value - The default value to return if the property is not found
16
16
  * @returns {Object} The modified object
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
- };
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
46
  exports.dotSet = dotSet;
@@ -1,14 +1,14 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isObject = void 0;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isObject = void 0;
7
7
  /**
8
8
  * Check if the provided thing is an object / array.
9
9
  * Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/isObject.ts Sí, funciona}
10
10
  * @param {*} object
11
11
  * @returns {boolean}
12
- */
13
- const isObject = object => typeof object === 'object' && object !== null;
12
+ */
13
+ const isObject = object => typeof object === 'object' && object !== null;
14
14
  exports.isObject = isObject;
@@ -1,18 +1,18 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.strAfter = void 0;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.strAfter = void 0;
7
7
  /**
8
8
  * Retrieve the string part after the search match.
9
9
  * Original source from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/strings/strAfter.ts Sí, funciona}
10
10
  * @param {string} str
11
11
  * @param {string} search
12
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
- };
13
+ */
14
+ const strAfter = (str, search) => {
15
+ const index = str.indexOf(search);
16
+ return index === -1 ? '' : str.substring(index + search.length);
17
+ };
18
18
  exports.strAfter = strAfter;
@@ -1,18 +1,18 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.strBefore = void 0;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.strBefore = void 0;
7
7
  /**
8
8
  * Retrieve the string part before the search match.
9
9
  * Original source from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/strings/strBefore.ts Sí, funciona}
10
10
  * @param {string} str
11
11
  * @param {string} search
12
12
  * @returns {string}
13
- */
14
- const strBefore = (str, search) => {
15
- const index = str.indexOf(search);
16
- return index === -1 ? '' : str.slice(0, index);
17
- };
13
+ */
14
+ const strBefore = (str, search) => {
15
+ const index = str.indexOf(search);
16
+ return index === -1 ? '' : str.slice(0, index);
17
+ };
18
18
  exports.strBefore = strBefore;
package/dist/watchFull.js CHANGED
@@ -1,14 +1,14 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
6
- exports.watchFull = void 0
7
- var _partials = require('./partials.js')
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 = () => (0, _partials.beginWatcher)().on('change', _partials.runOnChange)
14
- exports.watchFull = watchFull
12
+ */
13
+ const watchFull = () => (0, _partials.beginWatcher)().on('change', _partials.runOnChange)
14
+ exports.watchFull = watchFull
package/dist/watchTest.js CHANGED
@@ -1,21 +1,21 @@
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 }
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 }
13
13
  /**
14
14
  * Watch for changes and run the tests.
15
15
  * @memberOf module:js-build-tools
16
16
  * @returns {*}
17
- */
18
- const watchTest = () => (0, _gulp.watch)(gulpConfig.get('test.watch'), {
19
- ignoreInitial: false
20
- }, _testQuick.testQuick)
21
- exports.watchTest = watchTest
17
+ */
18
+ const watchTest = () => (0, _gulp.watch)(gulpConfig.get('test.watch'), {
19
+ ignoreInitial: false
20
+ }, _testQuick.testQuick)
21
+ exports.watchTest = watchTest
package/package.json CHANGED
@@ -1,11 +1,19 @@
1
1
  {
2
2
  "name": "js-build-tools",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Standardised build process with gulp.",
5
5
  "main": "gulpfile.base.js",
6
6
  "exports": {
7
- "import": "./gulpfile.base.mjs",
8
- "require": "./gulpfile.base.js"
7
+ ".": {
8
+ "node": "./gulpfile.base.js",
9
+ "default": "./gulpfile.base.mjs"
10
+ },
11
+ "./babel.config": "./babel.config.js",
12
+ "./gulp.config": "./gulp.config.js",
13
+ "./gulp.config.mjs": "./gulp.config.mjs",
14
+ "./gulpfile.base": "./gulpfile.base.js",
15
+ "./gulpfile.base.mjs": "./gulpfile.base.mjs",
16
+ "./jsdoc.base": "./jsdoc.base.js"
9
17
  },
10
18
  "scripts": {
11
19
  "build": "gulp build",