js-build-tools 4.0.0 → 4.0.2
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 +269 -269
- package/dist/build.js +58 -58
- package/dist/bundle.js +17 -17
- package/dist/bundleLint.js +21 -21
- package/dist/bundleMinify.js +14 -14
- package/dist/compileReadme.js +10 -10
- package/dist/copyFonts.js +14 -14
- package/dist/default.js +19 -19
- package/dist/dist.js +10 -10
- package/dist/distLint.js +21 -21
- package/dist/distMinify.js +14 -14
- package/dist/images.js +10 -10
- package/dist/partials/addToReadme.js +18 -18
- package/dist/partials/beginWatcher.js +13 -13
- package/dist/partials/clean.js +16 -16
- package/dist/partials/copyFor.js +9 -9
- package/dist/partials/distFor.js +26 -26
- package/dist/partials/distForSrc.js +15 -15
- package/dist/partials/distSeries.js +23 -23
- package/dist/partials/imagesFor.js +26 -26
- package/dist/partials/minifyFor.js +16 -16
- package/dist/partials/readmeTemplate.js +15 -15
- package/dist/partials/removeDirectory.js +11 -11
- package/dist/partials/runOnChange.js +29 -29
- package/dist/partials/sassFor.js +27 -27
- package/dist/partials/tsFor.js +23 -23
- package/dist/partials.js +103 -103
- package/dist/sass.js +10 -10
- package/dist/test-helpers/setUp.js +91 -67
- package/dist/testFull.js +22 -22
- package/dist/testHelpers.js +11 -11
- package/dist/testQuick.js +24 -24
- package/dist/typeScript.js +9 -9
- package/dist/utilities/dotGet.js +51 -46
- package/dist/utilities/dotNotate.js +52 -52
- package/dist/utilities/dotSet.js +38 -38
- package/dist/utilities/isObject.js +8 -8
- package/dist/utilities/strAfter.js +11 -11
- package/dist/utilities/strBefore.js +11 -11
- package/dist/watchFull.js +10 -10
- package/dist/watchTest.js +17 -17
- package/functions/test-helpers/setUp.mjs +27 -3
- package/functions/testHelpers.test.mjs +1 -1
- package/functions/utilities/dotGet.mjs +6 -3
- package/gulp.config.js +2 -2
- package/package.json +18 -8
|
@@ -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;
|
package/dist/utilities/dotSet.js
CHANGED
|
@@ -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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Import the configurations and override some of them to direct to the temp directory.
|
|
2
2
|
import * as gulpConfig from '../../gulp.config.mjs'
|
|
3
|
-
import
|
|
3
|
+
import { setUp } from 'test-filesystem'
|
|
4
4
|
|
|
5
5
|
let tempDir = 'test-temp/'
|
|
6
6
|
let srcPath = `${tempDir}src`
|
|
@@ -40,7 +40,7 @@ export const setDefaults = (testDir = 'test-temp') => {
|
|
|
40
40
|
gulpConfig.set('test.watch', `${srcPath}/**/*.js`)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export { gulpConfig
|
|
43
|
+
export { gulpConfig }
|
|
44
44
|
|
|
45
45
|
export {
|
|
46
46
|
/**
|
|
@@ -61,5 +61,29 @@ export {
|
|
|
61
61
|
* @memberOf module:testHelpers
|
|
62
62
|
* @returns {Promise<*>}
|
|
63
63
|
*/
|
|
64
|
-
afterEach
|
|
64
|
+
afterEach,
|
|
65
|
+
/**
|
|
66
|
+
* Return number of occurrences of substring in another string.
|
|
67
|
+
* @memberOf module:testHelpers
|
|
68
|
+
* @returns {int}
|
|
69
|
+
*/
|
|
70
|
+
countMatches,
|
|
71
|
+
/**
|
|
72
|
+
* Returns true if the given file or directory exists, otherwise false.
|
|
73
|
+
* @memberOf module:testHelpers
|
|
74
|
+
* @returns {boolean}
|
|
75
|
+
*/
|
|
76
|
+
fileExists,
|
|
77
|
+
/**
|
|
78
|
+
* Console log objects in a readable format, returns the given object.
|
|
79
|
+
* @memberOf module:testHelpers
|
|
80
|
+
* @returns {*}
|
|
81
|
+
*/
|
|
82
|
+
logObject,
|
|
83
|
+
/**
|
|
84
|
+
* Delete a directory and subcontents.
|
|
85
|
+
* @memberOf module:testHelpers
|
|
86
|
+
* @returns {Promise<*>}
|
|
87
|
+
*/
|
|
88
|
+
removeDirectory,
|
|
65
89
|
} from 'test-filesystem'
|
|
@@ -5,12 +5,15 @@ import { strBefore } from './strBefore.mjs'
|
|
|
5
5
|
/**
|
|
6
6
|
* Get a nested property value from an object.
|
|
7
7
|
* Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/dotGet.ts Sí, funciona}
|
|
8
|
-
* @param {Object} arrayObject - The array or object to get the property from
|
|
9
|
-
* @param {string} dotNotation - The path to the property
|
|
8
|
+
* @param {Object} [arrayObject={}] - The array or object to get the property from
|
|
9
|
+
* @param {string} [dotNotation=''] - The path to the property
|
|
10
10
|
* @param {string|null} [defaultValue=null] - The default value to return if the property is not found
|
|
11
11
|
* @returns {*} The value of the property
|
|
12
12
|
*/
|
|
13
|
-
export const dotGet = (arrayObject, dotNotation, defaultValue = null) => {
|
|
13
|
+
export const dotGet = (arrayObject = {}, dotNotation= '', defaultValue = null) => {
|
|
14
|
+
if (!dotNotation) {
|
|
15
|
+
return arrayObject
|
|
16
|
+
}
|
|
14
17
|
let key = strBefore(dotNotation, '.')
|
|
15
18
|
const lastKey = !key
|
|
16
19
|
if (lastKey) {
|
package/gulp.config.js
CHANGED
|
@@ -209,8 +209,8 @@ const setDefaults = {
|
|
|
209
209
|
* @type {Configurations}
|
|
210
210
|
*/
|
|
211
211
|
let gulpConfigurations = {}
|
|
212
|
-
if (fileExists('
|
|
213
|
-
gulpConfigurations = JSON.parse(readFileSync('
|
|
212
|
+
if (fileExists(process.cwd() + '/build-tools.config.json')) {
|
|
213
|
+
gulpConfigurations = JSON.parse(readFileSync(process.cwd() + '/build-tools.config.json').toString())
|
|
214
214
|
} else {
|
|
215
215
|
if (fileExists('./build-tools.config.json')) {
|
|
216
216
|
gulpConfigurations = JSON.parse(readFileSync('./build-tools.config.json').toString())
|
package/package.json
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js-build-tools",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Standardised build process with gulp.",
|
|
5
5
|
"main": "gulpfile.base.js",
|
|
6
6
|
"exports": {
|
|
7
|
-
"
|
|
8
|
-
|
|
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",
|
|
17
|
+
"./testHelpers": "./dist/testHelpers",
|
|
18
|
+
"./testHelpers.mjs": "./functions/testHelpers.mjs"
|
|
9
19
|
},
|
|
10
20
|
"scripts": {
|
|
11
21
|
"build": "gulp build",
|
|
@@ -36,11 +46,11 @@
|
|
|
36
46
|
]
|
|
37
47
|
},
|
|
38
48
|
"dependencies": {
|
|
39
|
-
"@babel/core": "^7.24.
|
|
40
|
-
"@babel/plugin-transform-modules-commonjs": "^7.24.
|
|
41
|
-
"@babel/preset-env": "^7.24.
|
|
42
|
-
"@babel/preset-typescript": "^7.24.
|
|
43
|
-
"@babel/runtime-corejs3": "^7.24.
|
|
49
|
+
"@babel/core": "^7.24.7",
|
|
50
|
+
"@babel/plugin-transform-modules-commonjs": "^7.24.7",
|
|
51
|
+
"@babel/preset-env": "^7.24.7",
|
|
52
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
53
|
+
"@babel/runtime-corejs3": "^7.24.7",
|
|
44
54
|
"babel-jest": "^29.7.0",
|
|
45
55
|
"browserify": "^17.0.0",
|
|
46
56
|
"core-js": "^3.37.1",
|