js-build-tools 5.7.0 → 6.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 +1 -1
- package/dist/build.js +65 -64
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +40 -40
- package/dist/bundleMinify.js +18 -18
- package/dist/compileReadme.js +7 -7
- package/dist/copyFonts.js +10 -10
- package/dist/default.js +12 -12
- package/dist/dist.js +7 -7
- package/dist/distMinify.js +10 -10
- package/dist/images.js +7 -7
- package/dist/partials/addToReadme.js +24 -24
- package/dist/partials/imagesFor.js +42 -42
- package/dist/partials/loadPeer.js +70 -70
- package/dist/partials/neostandardLint.js +144 -0
- package/dist/partials/tsFor.js +70 -70
- package/dist/partials/typeDocsFor.js +202 -202
- package/dist/partials.js +136 -136
- package/dist/partials.min.js +1 -1
- package/dist/sass.js +7 -7
- package/dist/sourceLint.js +33 -0
- package/dist/sourceLint.min.js +1 -0
- package/dist/test-helpers/neostandardLintWithRealNeostandard.js +48 -0
- package/dist/test-helpers/setUp.js +94 -94
- package/dist/testFull.js +13 -13
- package/dist/testHelpers.js +8 -8
- package/dist/testQuick.js +13 -13
- package/dist/typeDocs.js +9 -9
- package/dist/typeScript.js +6 -6
- package/dist/utilities/convertMjsFilesForDocs.js +36 -36
- package/dist/utilities/esmNamedExportsToCjs.js +18 -18
- package/dist/utilities/getBundleConfigs.js +27 -27
- package/dist/watchFull.js +7 -7
- package/dist/watchTest.js +11 -11
- package/functions/build.mjs +9 -8
- package/functions/build.test.mjs +18 -25
- package/functions/partials/neostandardLint.mjs +118 -0
- package/functions/partials/neostandardLint.test.mjs +109 -0
- package/functions/partials.mjs +1 -1
- package/functions/sourceLint.mjs +24 -0
- package/functions/sourceLint.test.mjs +73 -0
- package/functions/test-helpers/neostandardLintWithRealNeostandard.mjs +38 -0
- package/gulpfile.base.js +2 -4
- package/gulpfile.base.mjs +1 -2
- package/package.json +7 -6
- package/dist/bundleLint.js +0 -28
- package/dist/bundleLint.min.js +0 -1
- package/dist/distLint.js +0 -20
- package/dist/distLint.min.js +0 -1
- package/dist/partials/standardLint.js +0 -94
- package/dist/test-helpers/standardLintWithRealStandard.js +0 -28
- package/functions/bundleLint.mjs +0 -18
- package/functions/bundleLint.test.mjs +0 -85
- package/functions/distLint.mjs +0 -12
- package/functions/distLint.test.mjs +0 -62
- package/functions/partials/standardLint.mjs +0 -78
- package/functions/partials/standardLint.test.mjs +0 -99
- package/functions/test-helpers/standardLintWithRealStandard.mjs +0 -21
package/dist/testHelpers.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
require(
|
|
4
|
-
Object.defineProperty(exports,
|
|
3
|
+
require("core-js/modules/esnext.weak-map.delete-all.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
|
-
})
|
|
7
|
-
exports.testHelpers = void 0
|
|
8
|
-
|
|
9
|
-
exports.testHelpers = _testHelpers
|
|
10
|
-
function _interopRequireWildcard
|
|
6
|
+
});
|
|
7
|
+
exports.testHelpers = void 0;
|
|
8
|
+
var _testHelpers = _interopRequireWildcard(require("./test-helpers/setUp.js"));
|
|
9
|
+
exports.testHelpers = _testHelpers;
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
package/dist/testQuick.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
require(
|
|
4
|
-
Object.defineProperty(exports,
|
|
3
|
+
require("core-js/modules/esnext.weak-map.delete-all.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
|
-
})
|
|
7
|
-
exports.testQuick = void 0
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function _interopRequireWildcard
|
|
6
|
+
});
|
|
7
|
+
exports.testQuick = void 0;
|
|
8
|
+
var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
|
|
9
|
+
var _jest = require("jest");
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
11
|
/**
|
|
12
12
|
* Run the Jest tests for files which have been modified (based on git status).
|
|
13
13
|
* Configure where tests are located by using 'testPath'.
|
|
@@ -15,13 +15,13 @@ function _interopRequireWildcard (e, t) { if (typeof WeakMap === 'function') var
|
|
|
15
15
|
* @returns {Promise<*>}
|
|
16
16
|
*/
|
|
17
17
|
const testQuick = () => {
|
|
18
|
-
let testPath = gulpConfig.get('test.path')
|
|
18
|
+
let testPath = gulpConfig.get('test.path');
|
|
19
19
|
if (!Array.isArray(testPath)) {
|
|
20
20
|
// The testPath must be an array of strings
|
|
21
|
-
testPath = [testPath]
|
|
21
|
+
testPath = [testPath];
|
|
22
22
|
}
|
|
23
23
|
return (0, _jest.runCLI)({
|
|
24
24
|
onlyChanged: true
|
|
25
|
-
}, testPath)
|
|
26
|
-
}
|
|
27
|
-
exports.testQuick = testQuick
|
|
25
|
+
}, testPath);
|
|
26
|
+
};
|
|
27
|
+
exports.testQuick = testQuick;
|
package/dist/typeDocs.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports,
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.typeDocs = void 0
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.typeDocs = void 0;
|
|
7
|
+
var _typeDocsFor = require("./partials/typeDocsFor.js");
|
|
8
8
|
/**
|
|
9
9
|
* Generate the HTML documentation of a TypeScript project from its source, with the modules mirroring the source
|
|
10
10
|
* folders. Turn it on with docs.enabled, see {@link module:partials.typeDocsFor}.
|
|
11
11
|
* @memberOf module:js-build-tools
|
|
12
12
|
* @returns {Function}
|
|
13
|
-
*/
|
|
14
|
-
const typeDocs = exports.typeDocs = (0, _typeDocsFor.typeDocsFor)()
|
|
13
|
+
*/
|
|
14
|
+
const typeDocs = exports.typeDocs = (0, _typeDocsFor.typeDocsFor)();
|
package/dist/typeScript.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.typeScript = void 0
|
|
7
|
-
|
|
5
|
+
});
|
|
6
|
+
exports.typeScript = void 0;
|
|
7
|
+
var _tsFor = require("./partials/tsFor.js");
|
|
8
8
|
/**
|
|
9
9
|
* Simplified typescript task using tsFor.
|
|
10
10
|
* @memberOf module:js-build-tools
|
|
11
11
|
* @returns {Function}
|
|
12
12
|
*/
|
|
13
|
-
const typeScript = exports.typeScript = (0, _tsFor.tsFor)()
|
|
13
|
+
const typeScript = exports.typeScript = (0, _tsFor.tsFor)();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.convertMjsFilesForDocs = void 0;
|
|
7
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
|
-
require("core-js/modules/esnext.iterator.map.js");
|
|
9
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
10
|
-
var _os = _interopRequireDefault(require("os"));
|
|
11
|
-
var _path = _interopRequireDefault(require("path"));
|
|
12
|
-
var _esmNamedExportsToCjs = require("./esmNamedExportsToCjs.js");
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.convertMjsFilesForDocs = void 0;
|
|
7
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
|
+
require("core-js/modules/esnext.iterator.map.js");
|
|
9
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
10
|
+
var _os = _interopRequireDefault(require("os"));
|
|
11
|
+
var _path = _interopRequireDefault(require("path"));
|
|
12
|
+
var _esmNamedExportsToCjs = require("./esmNamedExportsToCjs.js");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
/**
|
|
15
15
|
* Writes a rewritten (see {@link esmNamedExportsToCjs}) copy of each given `.mjs` file into a fresh, unique
|
|
16
16
|
* directory under the OS temp directory, with a `.js` extension - jsdoc-to-markdown only recognizes `.js` as a
|
|
@@ -22,27 +22,27 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
22
22
|
* @param {Array<string>} mjsFilePaths - Real `.mjs` files to convert. An empty array is a safe, cheap no-op.
|
|
23
23
|
* @returns {{filePaths: Array<string>, cleanUp: function(): void}} The temp `.js` file paths to pass to
|
|
24
24
|
* jsdoc-to-markdown instead of the real `.mjs` ones, and a function to remove the temp directory afterward.
|
|
25
|
-
*/
|
|
26
|
-
const convertMjsFilesForDocs = (mjsFilePaths = []) => {
|
|
27
|
-
if (mjsFilePaths.length === 0) {
|
|
28
|
-
return {
|
|
29
|
-
filePaths: [],
|
|
30
|
-
cleanUp: () => {}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
const tempDir = _fs.default.mkdtempSync(_path.default.join(_os.default.tmpdir(), 'js-build-tools-docs-'));
|
|
34
|
-
const filePaths = mjsFilePaths.map(mjsFilePath => {
|
|
35
|
-
const tempFilePath = _path.default.join(tempDir, _path.default.basename(mjsFilePath, '.js') + '.js');
|
|
36
|
-
const source = _fs.default.readFileSync(mjsFilePath, 'utf8');
|
|
37
|
-
_fs.default.writeFileSync(tempFilePath, (0, _esmNamedExportsToCjs.esmNamedExportsToCjs)(source));
|
|
38
|
-
return tempFilePath;
|
|
39
|
-
});
|
|
40
|
-
return {
|
|
41
|
-
filePaths,
|
|
42
|
-
cleanUp: () => _fs.default.rmSync(tempDir, {
|
|
43
|
-
recursive: true,
|
|
44
|
-
force: true
|
|
45
|
-
})
|
|
46
|
-
};
|
|
47
|
-
};
|
|
25
|
+
*/
|
|
26
|
+
const convertMjsFilesForDocs = (mjsFilePaths = []) => {
|
|
27
|
+
if (mjsFilePaths.length === 0) {
|
|
28
|
+
return {
|
|
29
|
+
filePaths: [],
|
|
30
|
+
cleanUp: () => {}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const tempDir = _fs.default.mkdtempSync(_path.default.join(_os.default.tmpdir(), 'js-build-tools-docs-'));
|
|
34
|
+
const filePaths = mjsFilePaths.map(mjsFilePath => {
|
|
35
|
+
const tempFilePath = _path.default.join(tempDir, _path.default.basename(mjsFilePath, '.js') + '.js');
|
|
36
|
+
const source = _fs.default.readFileSync(mjsFilePath, 'utf8');
|
|
37
|
+
_fs.default.writeFileSync(tempFilePath, (0, _esmNamedExportsToCjs.esmNamedExportsToCjs)(source));
|
|
38
|
+
return tempFilePath;
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
filePaths,
|
|
42
|
+
cleanUp: () => _fs.default.rmSync(tempDir, {
|
|
43
|
+
recursive: true,
|
|
44
|
+
force: true
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
48
|
exports.convertMjsFilesForDocs = convertMjsFilesForDocs;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.esmNamedExportsToCjs = void 0;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.esmNamedExportsToCjs = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* Rewrites named `export const`/`export function`/`export class` declarations to plain declarations plus a
|
|
9
9
|
* trailing `module.exports = { ... }` - the same shape jsdoc-to-markdown already documents cleanly (a plain
|
|
@@ -18,16 +18,16 @@ exports.esmNamedExportsToCjs = void 0;
|
|
|
18
18
|
* @memberOf module:utilities
|
|
19
19
|
* @param {string} source - The raw ESM source text (never executed, just rewritten as text).
|
|
20
20
|
* @returns {string} The rewritten text, safe to write out with a `.js` extension for jsdoc-to-markdown to read.
|
|
21
|
-
*/
|
|
22
|
-
const esmNamedExportsToCjs = source => {
|
|
23
|
-
const exportedNames = [];
|
|
24
|
-
const rewritten = source.replace(/^export (const|function|class) (\w+)/gm, (match, keyword, name) => {
|
|
25
|
-
exportedNames.push(name);
|
|
26
|
-
return `${keyword} ${name}`;
|
|
27
|
-
});
|
|
28
|
-
if (exportedNames.length === 0) {
|
|
29
|
-
return rewritten;
|
|
30
|
-
}
|
|
31
|
-
return `${rewritten}\n\nmodule.exports = { ${exportedNames.join(', ')} }\n`;
|
|
32
|
-
};
|
|
21
|
+
*/
|
|
22
|
+
const esmNamedExportsToCjs = source => {
|
|
23
|
+
const exportedNames = [];
|
|
24
|
+
const rewritten = source.replace(/^export (const|function|class) (\w+)/gm, (match, keyword, name) => {
|
|
25
|
+
exportedNames.push(name);
|
|
26
|
+
return `${keyword} ${name}`;
|
|
27
|
+
});
|
|
28
|
+
if (exportedNames.length === 0) {
|
|
29
|
+
return rewritten;
|
|
30
|
+
}
|
|
31
|
+
return `${rewritten}\n\nmodule.exports = { ${exportedNames.join(', ')} }\n`;
|
|
32
|
+
};
|
|
33
33
|
exports.esmNamedExportsToCjs = esmNamedExportsToCjs;
|
|
@@ -1,14 +1,14 @@
|
|
|
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
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
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
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
12
|
/**
|
|
13
13
|
* Build the full list of bundles to produce for this project: the primary bundle (browser.name /
|
|
14
14
|
* dist.main / browser.ignore / browser.exclude, exactly as before browser.bundles existed) plus
|
|
@@ -17,20 +17,20 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
17
17
|
* specify what's actually different about it.
|
|
18
18
|
* @memberOf module:utilities
|
|
19
19
|
* @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
|
-
};
|
|
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
|
+
};
|
|
36
36
|
exports.getBundleConfigs = getBundleConfigs;
|
package/dist/watchFull.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.watchFull = void 0
|
|
7
|
-
|
|
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
12
|
*/
|
|
13
|
-
const watchFull = () => (0, _partials.beginWatcher)().on('change', _partials.runOnChange)
|
|
14
|
-
exports.watchFull = watchFull
|
|
13
|
+
const watchFull = () => (0, _partials.beginWatcher)().on('change', _partials.runOnChange);
|
|
14
|
+
exports.watchFull = watchFull;
|
package/dist/watchTest.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
require(
|
|
4
|
-
Object.defineProperty(exports,
|
|
3
|
+
require("core-js/modules/esnext.weak-map.delete-all.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
|
-
})
|
|
7
|
-
exports.watchTest = void 0
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function _interopRequireWildcard
|
|
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 _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
12
|
/**
|
|
13
13
|
* Watch for changes and run the tests.
|
|
14
14
|
* @memberOf module:js-build-tools
|
|
@@ -16,5 +16,5 @@ function _interopRequireWildcard (e, t) { if (typeof WeakMap === 'function') var
|
|
|
16
16
|
*/
|
|
17
17
|
const watchTest = () => (0, _gulp.watch)(gulpConfig.get('test.watch'), {
|
|
18
18
|
ignoreInitial: false
|
|
19
|
-
}, _testQuick.testQuick)
|
|
20
|
-
exports.watchTest = watchTest
|
|
19
|
+
}, _testQuick.testQuick);
|
|
20
|
+
exports.watchTest = watchTest;
|
package/functions/build.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { bundle } from './bundle.mjs'
|
|
2
|
-
import { bundleLint } from './bundleLint.mjs'
|
|
3
2
|
import { bundleMinify } from './bundleMinify.mjs'
|
|
4
3
|
import { clean, distSeries } from './partials.mjs'
|
|
5
4
|
import { compileReadme } from './compileReadme.mjs'
|
|
6
5
|
import { typeDocs } from './typeDocs.mjs'
|
|
7
|
-
import { distLint } from './distLint.mjs'
|
|
8
6
|
import { distMinify } from './distMinify.mjs'
|
|
7
|
+
import { sourceLint } from './sourceLint.mjs'
|
|
9
8
|
import { parallel, series } from 'gulp'
|
|
10
9
|
import * as gulpConfig from '../gulp.config.mjs'
|
|
11
10
|
import { copyFonts } from './copyFonts.mjs'
|
|
@@ -15,14 +14,13 @@ import { testFull } from './testFull.mjs'
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* Runs several processes to build and validate the project.
|
|
18
|
-
* Cleans, distributes
|
|
17
|
+
* Cleans and lints the source, distributes and minifies, bundles and minifies, creates the readme, then runs the
|
|
18
|
+
* tests.
|
|
19
19
|
* @memberOf module:js-build-tools
|
|
20
20
|
* @returns {stream.Stream}
|
|
21
21
|
*/
|
|
22
22
|
export const build = (done = null) => {
|
|
23
|
-
const
|
|
24
|
-
const bundleLintMinify = parallel(bundleLint, bundleMinify)
|
|
25
|
-
const buildActions = [distSeries(), distLintMinify]
|
|
23
|
+
const buildActions = [distSeries(), distMinify]
|
|
26
24
|
const generateDocs = gulpConfig.get('docs.enabled')
|
|
27
25
|
if (generateDocs) {
|
|
28
26
|
// The documentation is generated from the TypeScript source itself, the readme is written by hand
|
|
@@ -34,7 +32,7 @@ export const build = (done = null) => {
|
|
|
34
32
|
if (gulpConfig.get('browser.enabled')) {
|
|
35
33
|
// If not 'nodeOnly' then we also want to bundle for browser after we complete the dist directory
|
|
36
34
|
buildActions.push(bundle)
|
|
37
|
-
buildActions.push(
|
|
35
|
+
buildActions.push(bundleMinify)
|
|
38
36
|
}
|
|
39
37
|
const runActions = [
|
|
40
38
|
series(...buildActions),
|
|
@@ -58,8 +56,11 @@ export const build = (done = null) => {
|
|
|
58
56
|
}
|
|
59
57
|
// clean has to finish before anything writes into the output folders - images, fonts and sass all write into
|
|
60
58
|
// browser/, so running clean in parallel with them races (ENOTEMPTY errors from clean, or output deleted mid-write).
|
|
59
|
+
// sourceLint fixes the real source in place before anything compiles from it (distSeries, tsFor inside it), so a
|
|
60
|
+
// build never reads a mix of pre- and post-fix content; clean only touches dist/browser output, so the two can
|
|
61
|
+
// run alongside each other.
|
|
61
62
|
return series(
|
|
62
|
-
clean,
|
|
63
|
+
parallel(clean, sourceLint),
|
|
63
64
|
parallel(...runActions)
|
|
64
65
|
)(done)
|
|
65
66
|
}
|
package/functions/build.test.mjs
CHANGED
|
@@ -6,8 +6,8 @@ import { testFull } from './testFull.mjs'
|
|
|
6
6
|
import { typeDocs } from './typeDocs.mjs'
|
|
7
7
|
import { countMatches } from 'test-filesystem'
|
|
8
8
|
|
|
9
|
-
// Run the real
|
|
10
|
-
jest.mock('./partials/
|
|
9
|
+
// Run the real neostandard (in a subprocess) - Jest's CommonJS transform can't load the ESM-only package itself.
|
|
10
|
+
jest.mock('./partials/neostandardLint.mjs', () => require('./test-helpers/neostandardLintWithRealNeostandard.mjs'))
|
|
11
11
|
|
|
12
12
|
setUp.setDefaults('test-build')
|
|
13
13
|
const gulpConfig = setUp.gulpConfig
|
|
@@ -266,7 +266,7 @@ beforeEach(
|
|
|
266
266
|
afterEach(setUp.afterEach)
|
|
267
267
|
|
|
268
268
|
describe('build', () => {
|
|
269
|
-
test('when browser.enabled false: calls clean,
|
|
269
|
+
test('when browser.enabled false: calls clean, sourceLint, distSeries, distMinify, compileReadme, testFull', done => {
|
|
270
270
|
const srcPath = gulpConfig.get('srcPath')
|
|
271
271
|
const sourcesPath = `${srcPath}/sources`
|
|
272
272
|
const distPath = gulpConfig.get('dist.to')
|
|
@@ -288,16 +288,15 @@ describe('build', () => {
|
|
|
288
288
|
// Minify the dist files (distMinify)
|
|
289
289
|
expect(fs.existsSync(`${distPath}/main.min.js`)).toBeTruthy()
|
|
290
290
|
const babelifiedMain = fs.readFileSync(`${distPath}/main.js`).toString()
|
|
291
|
-
|
|
292
|
-
expect(countMatches(babelifiedMain, '\'use strict\'')).toEqual(1)
|
|
291
|
+
expect(babelifiedMain.includes('use strict')).toBe(true)
|
|
293
292
|
|
|
294
293
|
expect(fs.existsSync(`${distSourcesPath}/file1.min.js`)).toBeTruthy()
|
|
295
294
|
const babelifiedFile1 = fs.readFileSync(`${distSourcesPath}/file1.js`).toString()
|
|
296
|
-
expect(
|
|
295
|
+
expect(babelifiedFile1.includes('use strict')).toBe(true)
|
|
297
296
|
|
|
298
297
|
expect(fs.existsSync(`${distSourcesPath}/file2.min.js`)).toBeTruthy()
|
|
299
298
|
const babelifiedFile2 = fs.readFileSync(`${distSourcesPath}/file2.js`).toString()
|
|
300
|
-
expect(
|
|
299
|
+
expect(babelifiedFile2.includes('use strict')).toBe(true)
|
|
301
300
|
|
|
302
301
|
// Generated README.md (compileReadme)
|
|
303
302
|
const readmeContents = fs.readFileSync(`${readmePath}/${readmeFile}`).toString()
|
|
@@ -312,7 +311,7 @@ describe('build', () => {
|
|
|
312
311
|
})
|
|
313
312
|
}, 30000)
|
|
314
313
|
|
|
315
|
-
test('when browser.enabled true: calls clean,
|
|
314
|
+
test('when browser.enabled true: calls clean, sourceLint, distSeries, distMinify, bundle, bundleMinify, compileReadme, testFull', done => {
|
|
316
315
|
const srcPath = gulpConfig.get('srcPath')
|
|
317
316
|
const sourcesPath = `${srcPath}/sources`
|
|
318
317
|
const distPath = gulpConfig.get('dist.to')
|
|
@@ -336,8 +335,7 @@ describe('build', () => {
|
|
|
336
335
|
// Minify the dist files (distMinify)
|
|
337
336
|
expect(fs.existsSync(`${distPath}/main.min.js`)).toBeTruthy()
|
|
338
337
|
const babelifiedMain = fs.readFileSync(`${distPath}/main.js`).toString()
|
|
339
|
-
|
|
340
|
-
expect(countMatches(babelifiedMain, '\'use strict\'')).toEqual(1)
|
|
338
|
+
expect(babelifiedMain.includes('use strict')).toBe(true)
|
|
341
339
|
|
|
342
340
|
// Created browser directory (bundle)
|
|
343
341
|
expect(fs.existsSync(browserPath)).toBeTruthy()
|
|
@@ -361,7 +359,7 @@ describe('build', () => {
|
|
|
361
359
|
})
|
|
362
360
|
}, 30000)
|
|
363
361
|
|
|
364
|
-
test('when browser.enabled true and fonts.enabled true: calls clean,
|
|
362
|
+
test('when browser.enabled true and fonts.enabled true: calls clean, sourceLint, distSeries, distMinify, bundle, bundleMinify, compileReadme, testFull, copyFonts', done => {
|
|
365
363
|
const srcPath = gulpConfig.get('srcPath')
|
|
366
364
|
const sourcesPath = `${srcPath}/sources`
|
|
367
365
|
const distPath = gulpConfig.get('dist.to')
|
|
@@ -388,8 +386,7 @@ describe('build', () => {
|
|
|
388
386
|
// Minify the dist files (distMinify)
|
|
389
387
|
expect(fs.existsSync(`${distPath}/main.min.js`)).toBeTruthy()
|
|
390
388
|
const babelifiedMain = fs.readFileSync(`${distPath}/main.js`).toString()
|
|
391
|
-
|
|
392
|
-
expect(countMatches(babelifiedMain, '\'use strict\'')).toEqual(1)
|
|
389
|
+
expect(babelifiedMain.includes('use strict')).toBe(true)
|
|
393
390
|
|
|
394
391
|
// Created browser directory (bundle)
|
|
395
392
|
expect(fs.existsSync(browserPath)).toBeTruthy()
|
|
@@ -419,7 +416,7 @@ describe('build', () => {
|
|
|
419
416
|
})
|
|
420
417
|
}, 30000)
|
|
421
418
|
|
|
422
|
-
test('when browser.enabled true and images.enabled true: calls clean,
|
|
419
|
+
test('when browser.enabled true and images.enabled true: calls clean, sourceLint, distSeries, distMinify, bundle, bundleMinify, compileReadme, testFull, images', done => {
|
|
423
420
|
const srcPath = gulpConfig.get('srcPath')
|
|
424
421
|
const sourcesPath = `${srcPath}/sources`
|
|
425
422
|
const distPath = gulpConfig.get('dist.to')
|
|
@@ -446,8 +443,7 @@ describe('build', () => {
|
|
|
446
443
|
// Minify the dist files (distMinify)
|
|
447
444
|
expect(fs.existsSync(`${distPath}/main.min.js`)).toBeTruthy()
|
|
448
445
|
const babelifiedMain = fs.readFileSync(`${distPath}/main.js`).toString()
|
|
449
|
-
|
|
450
|
-
expect(countMatches(babelifiedMain, '\'use strict\'')).toEqual(1)
|
|
446
|
+
expect(babelifiedMain.includes('use strict')).toBe(true)
|
|
451
447
|
|
|
452
448
|
// Created browser directory (bundle)
|
|
453
449
|
expect(fs.existsSync(browserPath)).toBeTruthy()
|
|
@@ -477,7 +473,7 @@ describe('build', () => {
|
|
|
477
473
|
})
|
|
478
474
|
}, 30000)
|
|
479
475
|
|
|
480
|
-
test('when browser.enabled true and sass.enabled true: calls clean,
|
|
476
|
+
test('when browser.enabled true and sass.enabled true: calls clean, sourceLint, distSeries, distMinify, bundle, bundleMinify, compileReadme, testFull, sass', done => {
|
|
481
477
|
const srcPath = gulpConfig.get('srcPath')
|
|
482
478
|
const sourcesPath = `${srcPath}/sources`
|
|
483
479
|
const distPath = gulpConfig.get('dist.to')
|
|
@@ -504,8 +500,7 @@ describe('build', () => {
|
|
|
504
500
|
// Minify the dist files (distMinify)
|
|
505
501
|
expect(fs.existsSync(`${distPath}/main.min.js`)).toBeTruthy()
|
|
506
502
|
const babelifiedMain = fs.readFileSync(`${distPath}/main.js`).toString()
|
|
507
|
-
|
|
508
|
-
expect(countMatches(babelifiedMain, '\'use strict\'')).toEqual(1)
|
|
503
|
+
expect(babelifiedMain.includes('use strict')).toBe(true)
|
|
509
504
|
|
|
510
505
|
// Created browser directory (bundle)
|
|
511
506
|
expect(fs.existsSync(browserPath)).toBeTruthy()
|
|
@@ -537,7 +532,7 @@ describe('build', () => {
|
|
|
537
532
|
})
|
|
538
533
|
}, 30000)
|
|
539
534
|
|
|
540
|
-
test('when browser.enabled false and typescript.enabled set: calls clean, tsFor, distFor,
|
|
535
|
+
test('when browser.enabled false and typescript.enabled set: calls clean, sourceLint, tsFor, distFor, distMinify, compileReadme, testFull', done => {
|
|
541
536
|
const srcPath = gulpConfig.get('srcPath')
|
|
542
537
|
const rootPath = gulpConfig.get('rootPath')
|
|
543
538
|
const tsConfig = `${rootPath}/tsconfig.json`
|
|
@@ -563,8 +558,7 @@ describe('build', () => {
|
|
|
563
558
|
// Minify the dist files (distMinify)
|
|
564
559
|
expect(fs.existsSync(`${distPath}/main.min.js`)).toBeTruthy()
|
|
565
560
|
const babelifiedMain = fs.readFileSync(`${distPath}/main.js`).toString()
|
|
566
|
-
|
|
567
|
-
expect(countMatches(babelifiedMain, '\'use strict\'')).toEqual(1)
|
|
561
|
+
expect(babelifiedMain.includes('use strict')).toBe(true)
|
|
568
562
|
|
|
569
563
|
// Generated README.md (compileReadme)
|
|
570
564
|
const readmeContents = fs.readFileSync(`${readmePath}/${readmeFile}`).toString()
|
|
@@ -577,7 +571,7 @@ describe('build', () => {
|
|
|
577
571
|
})
|
|
578
572
|
}, 30000)
|
|
579
573
|
|
|
580
|
-
test('when browser.enabled true and typescript.enabled set: calls clean, tsFor, distFor,
|
|
574
|
+
test('when browser.enabled true and typescript.enabled set: calls clean, sourceLint, tsFor, distFor, distMinify, bundle, bundleMinify, compileReadme, testFull', done => {
|
|
581
575
|
const srcPath = gulpConfig.get('srcPath')
|
|
582
576
|
const rootPath = gulpConfig.get('rootPath')
|
|
583
577
|
const tsConfig = `${rootPath}/tsconfig.json`
|
|
@@ -606,8 +600,7 @@ describe('build', () => {
|
|
|
606
600
|
// Minify the dist files (distMinify)
|
|
607
601
|
expect(fs.existsSync(`${distPath}/main.min.js`)).toBeTruthy()
|
|
608
602
|
const babelifiedMain = fs.readFileSync(`${distPath}/main.js`).toString()
|
|
609
|
-
|
|
610
|
-
expect(countMatches(babelifiedMain, '\'use strict\'')).toEqual(1)
|
|
603
|
+
expect(babelifiedMain.includes('use strict')).toBe(true)
|
|
611
604
|
|
|
612
605
|
// Created browser directory (bundle)
|
|
613
606
|
expect(fs.existsSync(browserPath)).toBeTruthy()
|