js-build-tools 6.0.0 → 6.1.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 +45 -2
- package/dist/build.js +63 -62
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +40 -39
- package/dist/bundle.min.js +1 -1
- package/dist/bundleMinify.js +18 -17
- package/dist/bundleMinify.min.js +1 -1
- package/dist/copyFonts.js +13 -12
- package/dist/copyFonts.min.js +1 -1
- package/dist/default.js +15 -14
- package/dist/default.min.js +1 -1
- package/dist/distMinify.js +13 -12
- package/dist/distMinify.min.js +1 -1
- package/dist/partials/addToReadme.js +25 -24
- package/dist/partials/beginWatcher.js +13 -12
- package/dist/partials/clean.js +15 -14
- package/dist/partials/distFor.js +22 -21
- package/dist/partials/distForSrc.js +12 -11
- package/dist/partials/distSeries.js +20 -19
- package/dist/partials/imagesFor.js +43 -42
- package/dist/partials/neostandardLint.js +130 -111
- package/dist/partials/readmeTemplate.js +15 -14
- package/dist/partials/runOnChange.js +29 -28
- package/dist/partials/sassFor.js +29 -28
- package/dist/partials/tsFor.js +71 -70
- package/dist/partials/typeDocsFor.js +203 -202
- package/dist/sourceLint.js +26 -24
- package/dist/sourceLint.min.js +1 -1
- package/dist/test-helpers/neostandardLintWithRealNeostandard.js +49 -47
- package/dist/test-helpers/setUp.js +95 -94
- package/dist/testFull.js +20 -19
- package/dist/testFull.min.js +1 -1
- package/dist/testHelpers.js +11 -10
- package/dist/testHelpers.min.js +1 -1
- package/dist/testQuick.js +22 -21
- package/dist/testQuick.min.js +1 -1
- package/dist/utilities/dotNotate.js +48 -46
- package/dist/utilities/getBundleConfigs.js +28 -27
- package/dist/watchTest.js +16 -15
- package/dist/watchTest.min.js +1 -1
- package/functions/bundle.mjs +2 -2
- package/functions/partials/addToReadme.mjs +1 -1
- package/functions/partials/neostandardLint.mjs +19 -7
- package/functions/partials/neostandardLint.test.mjs +9 -1
- package/functions/sourceLint.mjs +1 -1
- package/functions/sourceLint.test.mjs +24 -0
- package/functions/test-helpers/neostandardLintWithRealNeostandard.mjs +7 -5
- package/functions/utilities/dotNotate.mjs +3 -1
- package/functions/utilities/dotNotate.test.mjs +34 -0
- package/functions/utilities/getBundleConfigs.mjs +1 -1
- package/gulp.config.mjs +14 -0
- package/package.json +1 -1
|
@@ -1,99 +1,100 @@
|
|
|
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
|
-
Object.defineProperty(exports, "afterEach", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _testFilesystem.afterEach;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "beforeEach", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return _testFilesystem.beforeEach;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "countMatches", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () {
|
|
22
|
-
return _testFilesystem.countMatches;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, "createTempDir", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return _testFilesystem.createTempDir;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(exports, "fileExists", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function () {
|
|
34
|
-
return _testFilesystem.fileExists;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
exports.gulpConfig = void 0;
|
|
38
|
-
Object.defineProperty(exports, "logObject", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function () {
|
|
41
|
-
return _testFilesystem.logObject;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
Object.defineProperty(exports, "removeDirectory", {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
get: function () {
|
|
47
|
-
return _testFilesystem.removeDirectory;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
exports.setDefaults = void 0;
|
|
51
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
52
|
-
exports.gulpConfig = gulpConfig;
|
|
53
|
-
var _testFilesystem = require("test-filesystem");
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
let
|
|
59
|
-
|
|
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
|
+
Object.defineProperty(exports, "afterEach", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _testFilesystem.afterEach;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "beforeEach", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _testFilesystem.beforeEach;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "countMatches", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _testFilesystem.countMatches;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "createTempDir", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _testFilesystem.createTempDir;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "fileExists", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return _testFilesystem.fileExists;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
exports.gulpConfig = void 0;
|
|
38
|
+
Object.defineProperty(exports, "logObject", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _testFilesystem.logObject;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "removeDirectory", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () {
|
|
47
|
+
return _testFilesystem.removeDirectory;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
exports.setDefaults = void 0;
|
|
51
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
52
|
+
exports.gulpConfig = gulpConfig;
|
|
53
|
+
var _testFilesystem = require("test-filesystem");
|
|
54
|
+
var cache;
|
|
55
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
56
|
+
// Import the configurations and override some of them to direct to the temp directory.
|
|
57
|
+
|
|
58
|
+
let tempDir = 'test-temp/';
|
|
59
|
+
let srcPath = `${tempDir}src`;
|
|
60
|
+
|
|
60
61
|
/**
|
|
61
62
|
* Update the gulp configurations with the test data. Set the test directory where temp files will be created for testing.
|
|
62
63
|
* @memberOf module:testHelpers
|
|
63
64
|
* @param {string} testDir
|
|
64
|
-
*/
|
|
65
|
-
const setDefaults = (testDir = 'test-temp') => {
|
|
66
|
-
tempDir = `${testDir}/`;
|
|
67
|
-
srcPath = `${tempDir}src`;
|
|
68
|
-
_testFilesystem.setUp.setDefaults(tempDir);
|
|
69
|
-
const distPath = `${tempDir}dist`;
|
|
70
|
-
const browserPath = `${tempDir}browser`;
|
|
71
|
-
const sassPath = `${tempDir}sass`;
|
|
72
|
-
gulpConfig.set('browser.from', `${distPath}/**/*.js`);
|
|
73
|
-
gulpConfig.set('browser.to', browserPath);
|
|
74
|
-
gulpConfig.set('cleanPaths', [distPath, browserPath]);
|
|
75
|
-
gulpConfig.set('dist.from', `${srcPath}/**/!(*.test).js`);
|
|
76
|
-
gulpConfig.set('dist.main', `${distPath}/main`);
|
|
77
|
-
gulpConfig.set('dist.to', distPath);
|
|
78
|
-
gulpConfig.set('fonts.from', `${srcPath}/fonts/**/*`);
|
|
79
|
-
gulpConfig.set('fonts.to', `${browserPath}/fonts`);
|
|
80
|
-
gulpConfig.set('images.from', `${srcPath}/img/**/*.+(png|jpg|jpeg|gif|svg)`);
|
|
81
|
-
gulpConfig.set('images.to', `${browserPath}/img`);
|
|
82
|
-
gulpConfig.set('readme.template', `${tempDir}MAIN.md`);
|
|
83
|
-
gulpConfig.set('readme.to', tempDir);
|
|
84
|
-
gulpConfig.set('readme.from', `${srcPath}/**/!(*.test).js`);
|
|
85
|
-
// Reset explicitly: gulpConfig is a process-wide singleton seeded once from this real project's own
|
|
86
|
-
// build-tools.config.json, so without this, this project's own real readme.fromEsm value (gulp.config.mjs)
|
|
87
|
-
// would leak into every test that exercises addToReadme/compileReadme but never sets this path itself -
|
|
88
|
-
// doing real file I/O and a real jsdoc-to-markdown parse of this project's own, much larger, config file.
|
|
89
|
-
gulpConfig.set('readme.fromEsm', []);
|
|
90
|
-
gulpConfig.set('rootPath', tempDir);
|
|
91
|
-
gulpConfig.set('sass.from', `${sassPath}/**/*.+(scss|sass)`);
|
|
92
|
-
gulpConfig.set('sass.path', sassPath);
|
|
93
|
-
gulpConfig.set('sass.to', `${browserPath}/css`);
|
|
94
|
-
gulpConfig.set('srcPath', srcPath);
|
|
95
|
-
gulpConfig.set('typescript.from', `${srcPath}/**/*.ts`);
|
|
96
|
-
gulpConfig.set('typescript.to', distPath);
|
|
97
|
-
gulpConfig.set('test.watch', `${srcPath}/**/*.js`);
|
|
98
|
-
};
|
|
65
|
+
*/
|
|
66
|
+
const setDefaults = (testDir = 'test-temp') => {
|
|
67
|
+
tempDir = `${testDir}/`;
|
|
68
|
+
srcPath = `${tempDir}src`;
|
|
69
|
+
_testFilesystem.setUp.setDefaults(tempDir);
|
|
70
|
+
const distPath = `${tempDir}dist`;
|
|
71
|
+
const browserPath = `${tempDir}browser`;
|
|
72
|
+
const sassPath = `${tempDir}sass`;
|
|
73
|
+
gulpConfig.set('browser.from', `${distPath}/**/*.js`);
|
|
74
|
+
gulpConfig.set('browser.to', browserPath);
|
|
75
|
+
gulpConfig.set('cleanPaths', [distPath, browserPath]);
|
|
76
|
+
gulpConfig.set('dist.from', `${srcPath}/**/!(*.test).js`);
|
|
77
|
+
gulpConfig.set('dist.main', `${distPath}/main`);
|
|
78
|
+
gulpConfig.set('dist.to', distPath);
|
|
79
|
+
gulpConfig.set('fonts.from', `${srcPath}/fonts/**/*`);
|
|
80
|
+
gulpConfig.set('fonts.to', `${browserPath}/fonts`);
|
|
81
|
+
gulpConfig.set('images.from', `${srcPath}/img/**/*.+(png|jpg|jpeg|gif|svg)`);
|
|
82
|
+
gulpConfig.set('images.to', `${browserPath}/img`);
|
|
83
|
+
gulpConfig.set('readme.template', `${tempDir}MAIN.md`);
|
|
84
|
+
gulpConfig.set('readme.to', tempDir);
|
|
85
|
+
gulpConfig.set('readme.from', `${srcPath}/**/!(*.test).js`);
|
|
86
|
+
// Reset explicitly: gulpConfig is a process-wide singleton seeded once from this real project's own
|
|
87
|
+
// build-tools.config.json, so without this, this project's own real readme.fromEsm value (gulp.config.mjs)
|
|
88
|
+
// would leak into every test that exercises addToReadme/compileReadme but never sets this path itself -
|
|
89
|
+
// doing real file I/O and a real jsdoc-to-markdown parse of this project's own, much larger, config file.
|
|
90
|
+
gulpConfig.set('readme.fromEsm', []);
|
|
91
|
+
gulpConfig.set('rootPath', tempDir);
|
|
92
|
+
gulpConfig.set('sass.from', `${sassPath}/**/*.+(scss|sass)`);
|
|
93
|
+
gulpConfig.set('sass.path', sassPath);
|
|
94
|
+
gulpConfig.set('sass.to', `${browserPath}/css`);
|
|
95
|
+
gulpConfig.set('srcPath', srcPath);
|
|
96
|
+
gulpConfig.set('typescript.from', `${srcPath}/**/*.ts`);
|
|
97
|
+
gulpConfig.set('typescript.to', distPath);
|
|
98
|
+
gulpConfig.set('test.watch', `${srcPath}/**/*.js`);
|
|
99
|
+
};
|
|
99
100
|
exports.setDefaults = setDefaults;
|
package/dist/testFull.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
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.testFull = void 0;
|
|
8
|
-
var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
|
|
9
|
-
var _jest = require("jest");
|
|
10
|
-
|
|
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.testFull = void 0;
|
|
8
|
+
var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
|
|
9
|
+
var _jest = require("jest");
|
|
10
|
+
var cache;
|
|
11
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
11
12
|
/**
|
|
12
13
|
* Run all tests with jest.
|
|
13
14
|
* Configure where tests are located by using 'testPath'.
|
|
14
15
|
* @memberOf module:js-build-tools
|
|
15
16
|
* @returns {Promise<*>}
|
|
16
|
-
*/
|
|
17
|
-
const testFull = () => {
|
|
18
|
-
let testPath = gulpConfig.get('test.path');
|
|
19
|
-
if (!Array.isArray(testPath)) {
|
|
20
|
-
// The testPath must be an array of strings
|
|
21
|
-
testPath = [testPath];
|
|
22
|
-
}
|
|
23
|
-
return (0, _jest.runCLI)(gulpConfig.get('test.options'), testPath);
|
|
24
|
-
};
|
|
17
|
+
*/
|
|
18
|
+
const testFull = () => {
|
|
19
|
+
let testPath = gulpConfig.get('test.path');
|
|
20
|
+
if (!Array.isArray(testPath)) {
|
|
21
|
+
// The testPath must be an array of strings
|
|
22
|
+
testPath = [testPath];
|
|
23
|
+
}
|
|
24
|
+
return (0, _jest.runCLI)(gulpConfig.get('test.options'), testPath);
|
|
25
|
+
};
|
|
25
26
|
exports.testFull = testFull;
|
package/dist/testFull.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.testFull=void 0;var gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_jest=require("jest");function _interopRequireWildcard(e,t){if(
|
|
1
|
+
"use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.testFull=void 0;var cache,gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_jest=require("jest");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var r,s,u=Object.defineProperty,c={__proto__:null,default:e};if(Object(e)!==e)return c;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,c)}for(s in e)"default"!==s&&{}.hasOwnProperty.call(e,s)&&((r=u&&Object.getOwnPropertyDescriptor(e,s))&&(r.get||r.set)?u(c,s,r):c[s]=e[s]);return c}const testFull=()=>{let e=gulpConfig.get("test.path");return Array.isArray(e)||(e=[e]),(0,_jest.runCLI)(gulpConfig.get("test.options"),e)};exports.testFull=testFull;
|
package/dist/testHelpers.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
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.testHelpers = void 0;
|
|
8
|
-
var _testHelpers = _interopRequireWildcard(require("./test-helpers/setUp.js"));
|
|
9
|
-
exports.testHelpers = _testHelpers;
|
|
10
|
-
|
|
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.testHelpers = void 0;
|
|
8
|
+
var _testHelpers = _interopRequireWildcard(require("./test-helpers/setUp.js"));
|
|
9
|
+
exports.testHelpers = _testHelpers;
|
|
10
|
+
var cache;
|
|
11
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
package/dist/testHelpers.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.testHelpers=void 0;var _testHelpers=_interopRequireWildcard(require("./test-helpers/setUp.js"));function _interopRequireWildcard(e,t){if(
|
|
1
|
+
"use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.testHelpers=void 0;var cache,_testHelpers=_interopRequireWildcard(require("./test-helpers/setUp.js"));function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var r,s,c=Object.defineProperty,a={__proto__:null,default:e};if(Object(e)!==e)return a;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,a)}for(s in e)"default"!==s&&{}.hasOwnProperty.call(e,s)&&((r=c&&Object.getOwnPropertyDescriptor(e,s))&&(r.get||r.set)?c(a,s,r):a[s]=e[s]);return a}exports.testHelpers=_testHelpers;
|
package/dist/testQuick.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
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.testQuick = void 0;
|
|
8
|
-
var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
|
|
9
|
-
var _jest = require("jest");
|
|
10
|
-
|
|
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.testQuick = void 0;
|
|
8
|
+
var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
|
|
9
|
+
var _jest = require("jest");
|
|
10
|
+
var cache;
|
|
11
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
11
12
|
/**
|
|
12
13
|
* Run the Jest tests for files which have been modified (based on git status).
|
|
13
14
|
* Configure where tests are located by using 'testPath'.
|
|
14
15
|
* @memberOf module:js-build-tools
|
|
15
16
|
* @returns {Promise<*>}
|
|
16
|
-
*/
|
|
17
|
-
const testQuick = () => {
|
|
18
|
-
let testPath = gulpConfig.get('test.path');
|
|
19
|
-
if (!Array.isArray(testPath)) {
|
|
20
|
-
// The testPath must be an array of strings
|
|
21
|
-
testPath = [testPath];
|
|
22
|
-
}
|
|
23
|
-
return (0, _jest.runCLI)({
|
|
24
|
-
onlyChanged: true
|
|
25
|
-
}, testPath);
|
|
26
|
-
};
|
|
17
|
+
*/
|
|
18
|
+
const testQuick = () => {
|
|
19
|
+
let testPath = gulpConfig.get('test.path');
|
|
20
|
+
if (!Array.isArray(testPath)) {
|
|
21
|
+
// The testPath must be an array of strings
|
|
22
|
+
testPath = [testPath];
|
|
23
|
+
}
|
|
24
|
+
return (0, _jest.runCLI)({
|
|
25
|
+
onlyChanged: true
|
|
26
|
+
}, testPath);
|
|
27
|
+
};
|
|
27
28
|
exports.testQuick = testQuick;
|
package/dist/testQuick.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.testQuick=void 0;var gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_jest=require("jest");function _interopRequireWildcard(e,t){if(
|
|
1
|
+
"use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.testQuick=void 0;var cache,gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_jest=require("jest");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var r,c,i=Object.defineProperty,a={__proto__:null,default:e};if(Object(e)!==e)return a;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,a)}for(c in e)"default"!==c&&{}.hasOwnProperty.call(e,c)&&((r=i&&Object.getOwnPropertyDescriptor(e,c))&&(r.get||r.set)?i(a,c,r):a[c]=e[c]);return a}const testQuick=()=>{let e=gulpConfig.get("test.path");return Array.isArray(e)||(e=[e]),(0,_jest.runCLI)({onlyChanged:!0},e)};exports.testQuick=testQuick;
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.dotNotate = void 0;
|
|
7
|
-
require("core-js/modules/esnext.iterator.constructor.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.iterator.constructor.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 = (retainObjects = []) => {
|
|
16
|
-
if (!retainObjects.length) {
|
|
14
|
+
*/
|
|
15
|
+
const handleRetainObjects = (retainObjects = []) => {
|
|
16
|
+
if (!retainObjects.length) {
|
|
17
17
|
/**
|
|
18
18
|
* Bypass the test function if there are no retainObjects.
|
|
19
19
|
* @returns {false}
|
|
20
|
-
*/
|
|
21
|
-
return (currentKey, value, results) => false;
|
|
22
|
-
}
|
|
23
|
-
retainObjects = retainObjects.map(key => key.replace('\.', '\\.'));
|
|
24
|
-
const retainRegex = new RegExp(`(${retainObjects.join('|')})$`);
|
|
20
|
+
*/
|
|
21
|
+
return (currentKey, value, results) => false;
|
|
22
|
+
}
|
|
23
|
+
retainObjects = retainObjects.map(key => key.replace('\.', '\\.'));
|
|
24
|
+
const retainRegex = new RegExp(`(${retainObjects.join('|')})$`);
|
|
25
25
|
/**
|
|
26
26
|
* Test if a key should be retained as an object.
|
|
27
27
|
* @param {string} currentKey - The key to test
|
|
28
28
|
* @param {*} value - The value of the key
|
|
29
29
|
* @param {Object} results - The result object to add to
|
|
30
30
|
* @returns {boolean}
|
|
31
|
-
*/
|
|
32
|
-
return (currentKey, value, results) => {
|
|
33
|
-
if (!currentKey.match(retainRegex)) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
results[currentKey] = value;
|
|
37
|
-
return true;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
|
|
31
|
+
*/
|
|
32
|
+
return (currentKey, value, results) => {
|
|
33
|
+
if (!currentKey.match(retainRegex)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
results[currentKey] = value;
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
41
|
/**
|
|
42
42
|
* The underlying logic function for converting arrays to dot-notation.
|
|
43
43
|
* @param {Object} arrayObject - The array or object to dot-notate
|
|
@@ -45,29 +45,31 @@ const handleRetainObjects = (retainObjects = []) => {
|
|
|
45
45
|
* @param {string} [prepend=''] - The path for the property being processed
|
|
46
46
|
* @param {Object<string, *>} [results={}] - The final notated object to return
|
|
47
47
|
* @returns {Object<string, *>} The dot-notated object
|
|
48
|
-
*/
|
|
49
|
-
const performDotNotate = (arrayObject, didRetain, prepend = '', results = {}) => {
|
|
50
|
-
for (let key in arrayObject) {
|
|
51
|
-
const value = arrayObject[key];
|
|
52
|
-
const currentKey = `${prepend}${key}`;
|
|
53
|
-
if (didRetain(currentKey, value, results)) {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
48
|
+
*/
|
|
49
|
+
const performDotNotate = (arrayObject, didRetain, prepend = '', results = {}) => {
|
|
50
|
+
for (let key in arrayObject) {
|
|
51
|
+
const value = arrayObject[key];
|
|
52
|
+
const currentKey = `${prepend}${key}`;
|
|
53
|
+
if (didRetain(currentKey, value, results)) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
// An empty object/array has no keys to flatten into - recursing into one would silently drop currentKey
|
|
57
|
+
// from the result entirely, rather than keeping it as the empty value it actually is. Treat it as a leaf.
|
|
58
|
+
if ((0, _isObject.isObject)(value) && Object.keys(value).length) {
|
|
59
|
+
performDotNotate(value, didRetain, `${currentKey}.`, results);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
results[currentKey] = value;
|
|
63
|
+
}
|
|
64
|
+
return results;
|
|
65
|
+
};
|
|
66
|
+
|
|
65
67
|
/**
|
|
66
68
|
* Convert an array or object to a single dimensional associative array with dot notation.
|
|
67
69
|
* Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/dotNotate.ts Sí, funciona}
|
|
68
70
|
* @param {Object} arrayObject - The array or object to dot-notate
|
|
69
71
|
* @param {Array.<string>} [retainObjects=[]] - An array of keys to retain as objects
|
|
70
72
|
* @returns {Object<string, *>} The dot-notated object
|
|
71
|
-
*/
|
|
72
|
-
const dotNotate = (arrayObject, retainObjects = []) => performDotNotate(arrayObject, handleRetainObjects(retainObjects));
|
|
73
|
+
*/
|
|
74
|
+
const dotNotate = (arrayObject, retainObjects = []) => performDotNotate(arrayObject, handleRetainObjects(retainObjects));
|
|
73
75
|
exports.dotNotate = dotNotate;
|
|
@@ -1,14 +1,15 @@
|
|
|
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.getBundleConfigs = void 0;
|
|
8
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
9
|
-
require("core-js/modules/esnext.iterator.map.js");
|
|
10
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
11
|
-
|
|
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.getBundleConfigs = void 0;
|
|
8
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
9
|
+
require("core-js/modules/esnext.iterator.map.js");
|
|
10
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
11
|
+
var cache;
|
|
12
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
12
13
|
/**
|
|
13
14
|
* Build the full list of bundles to produce for this project: the primary bundle (browser.name /
|
|
14
15
|
* dist.main / browser.ignore / browser.exclude, exactly as before browser.bundles existed) plus
|
|
@@ -17,20 +18,20 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
17
18
|
* specify what's actually different about it.
|
|
18
19
|
* @memberOf module:utilities
|
|
19
20
|
* @returns {Array<{name: string, main: string, ignore: Array, exclude: Array}>}
|
|
20
|
-
*/
|
|
21
|
-
const getBundleConfigs = () => {
|
|
22
|
-
const primary = {
|
|
23
|
-
name: gulpConfig.get('browser.name'),
|
|
24
|
-
main: gulpConfig.get('dist.main'),
|
|
25
|
-
ignore: gulpConfig.get('browser.ignore'),
|
|
26
|
-
exclude: gulpConfig.get('browser.exclude')
|
|
27
|
-
};
|
|
28
|
-
const additional = gulpConfig.get('browser.bundles')
|
|
29
|
-
return [primary, ...additional.map(bundleConfig => ({
|
|
30
|
-
name: bundleConfig.name,
|
|
31
|
-
main: bundleConfig.main || primary.main,
|
|
32
|
-
ignore: bundleConfig.ignore || primary.ignore,
|
|
33
|
-
exclude: bundleConfig.exclude || primary.exclude
|
|
34
|
-
}))];
|
|
35
|
-
};
|
|
21
|
+
*/
|
|
22
|
+
const getBundleConfigs = () => {
|
|
23
|
+
const primary = {
|
|
24
|
+
name: gulpConfig.get('browser.name'),
|
|
25
|
+
main: gulpConfig.get('dist.main'),
|
|
26
|
+
ignore: gulpConfig.get('browser.ignore'),
|
|
27
|
+
exclude: gulpConfig.get('browser.exclude')
|
|
28
|
+
};
|
|
29
|
+
const additional = gulpConfig.get('browser.bundles');
|
|
30
|
+
return [primary, ...additional.map(bundleConfig => ({
|
|
31
|
+
name: bundleConfig.name,
|
|
32
|
+
main: bundleConfig.main || primary.main,
|
|
33
|
+
ignore: bundleConfig.ignore || primary.ignore,
|
|
34
|
+
exclude: bundleConfig.exclude || primary.exclude
|
|
35
|
+
}))];
|
|
36
|
+
};
|
|
36
37
|
exports.getBundleConfigs = getBundleConfigs;
|
package/dist/watchTest.js
CHANGED
|
@@ -1,20 +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
|
-
|
|
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
|
+
var cache;
|
|
12
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
12
13
|
/**
|
|
13
14
|
* Watch for changes and run the tests.
|
|
14
15
|
* @memberOf module:js-build-tools
|
|
15
16
|
* @returns {*}
|
|
16
|
-
*/
|
|
17
|
-
const watchTest = () => (0, _gulp.watch)(gulpConfig.get('test.watch'), {
|
|
18
|
-
ignoreInitial: false
|
|
19
|
-
}, _testQuick.testQuick);
|
|
17
|
+
*/
|
|
18
|
+
const watchTest = () => (0, _gulp.watch)(gulpConfig.get('test.watch'), {
|
|
19
|
+
ignoreInitial: false
|
|
20
|
+
}, _testQuick.testQuick);
|
|
20
21
|
exports.watchTest = watchTest;
|
package/dist/watchTest.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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 _interopRequireWildcard(e,t){if(
|
|
1
|
+
"use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.watchTest=void 0;var cache,gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_gulp=require("gulp"),_testQuick=require("./testQuick.js");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var r,c,i=Object.defineProperty,a={__proto__:null,default:e};if(Object(e)!==e)return a;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,a)}for(c in e)"default"!==c&&{}.hasOwnProperty.call(e,c)&&((r=i&&Object.getOwnPropertyDescriptor(e,c))&&(r.get||r.set)?i(a,c,r):a[c]=e[c]);return a}const watchTest=()=>(0,_gulp.watch)(gulpConfig.get("test.watch"),{ignoreInitial:!1},_testQuick.testQuick);exports.watchTest=watchTest;
|
package/functions/bundle.mjs
CHANGED
|
@@ -28,10 +28,10 @@ import { getBundleConfigs } from './utilities/getBundleConfigs.mjs'
|
|
|
28
28
|
export const bundle = () => mergeStream(
|
|
29
29
|
getBundleConfigs().map(({ name, main, ignore, exclude }) => {
|
|
30
30
|
const bundler = browserify(main, { standalone: name })
|
|
31
|
-
if (ignore
|
|
31
|
+
if (ignore.length) {
|
|
32
32
|
bundler.ignore(ignore)
|
|
33
33
|
}
|
|
34
|
-
if (exclude
|
|
34
|
+
if (exclude.length) {
|
|
35
35
|
bundler.exclude(exclude)
|
|
36
36
|
}
|
|
37
37
|
return bundler
|
|
@@ -15,7 +15,7 @@ import { convertMjsFilesForDocs } from '../utilities/convertMjsFilesForDocs.mjs'
|
|
|
15
15
|
* @returns {string|Uint8Array}
|
|
16
16
|
*/
|
|
17
17
|
export const addToReadme = () => {
|
|
18
|
-
const { filePaths: esmFilePaths, cleanUp } = convertMjsFilesForDocs(globSync(gulpConfig.get('readme.fromEsm')
|
|
18
|
+
const { filePaths: esmFilePaths, cleanUp } = convertMjsFilesForDocs(globSync(gulpConfig.get('readme.fromEsm')))
|
|
19
19
|
return jsdoc2md
|
|
20
20
|
.render({ files: [...globSync(gulpConfig.get('readme.from')), ...esmFilePaths] })
|
|
21
21
|
.finally(cleanUp)
|