js-build-tools 5.2.0 → 5.3.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.
- package/README.md +101 -10
- package/dist/build.js +63 -58
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +27 -27
- package/dist/bundleLint.js +16 -16
- package/dist/bundleMinify.js +13 -13
- package/dist/compileReadme.js +10 -10
- package/dist/copyFonts.js +13 -13
- package/dist/default.js +15 -15
- package/dist/dist.js +10 -10
- package/dist/distLint.js +16 -16
- package/dist/distMinify.js +13 -13
- package/dist/images.js +10 -10
- package/dist/partials/addToReadme.js +17 -17
- package/dist/partials/beginWatcher.js +12 -12
- package/dist/partials/clean.js +14 -14
- package/dist/partials/copyFor.js +12 -12
- package/dist/partials/distFor.js +21 -21
- package/dist/partials/distForSrc.js +11 -11
- package/dist/partials/distSeries.js +19 -19
- package/dist/partials/imagesFor.js +7 -13
- package/dist/partials/loadPeer.js +99 -0
- package/dist/partials/minifyFor.js +16 -16
- package/dist/partials/readmeTemplate.js +14 -14
- package/dist/partials/removeDirectory.js +29 -29
- package/dist/partials/runOnChange.js +28 -28
- package/dist/partials/sassFor.js +28 -28
- package/dist/partials/standardLint.js +3 -5
- package/dist/partials/tsFor.js +8 -20
- package/dist/partials/typeDocsFor.js +228 -0
- package/dist/partials.js +26 -0
- package/dist/partials.min.js +1 -1
- package/dist/sass.js +10 -10
- package/dist/test-helpers/setUp.js +89 -89
- package/dist/test-helpers/standardLintWithRealStandard.js +27 -27
- package/dist/testFull.js +20 -20
- package/dist/testHelpers.js +10 -10
- package/dist/testQuick.js +22 -22
- package/dist/typeDocs.js +14 -0
- package/dist/typeDocs.min.js +1 -0
- package/dist/typeScript.js +9 -9
- package/dist/utilities/dotGet.js +46 -46
- package/dist/utilities/dotNotate.js +46 -46
- package/dist/utilities/dotSet.js +37 -37
- 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 +16 -16
- package/functions/build.mjs +7 -2
- package/functions/build.test.mjs +29 -0
- package/functions/partials/imagesFor.mjs +7 -13
- package/functions/partials/loadPeer.mjs +75 -0
- package/functions/partials/loadPeer.test.mjs +58 -0
- package/functions/partials/standardLint.mjs +3 -5
- package/functions/partials/tsFor.mjs +4 -20
- package/functions/partials/typeDocsFor.mjs +199 -0
- package/functions/partials/typeDocsFor.test.mjs +204 -0
- package/functions/partials.mjs +2 -0
- package/functions/partials.test.mjs +1 -1
- package/functions/typeDocs.mjs +9 -0
- package/functions/typeDocs.test.mjs +11 -0
- package/gulp.config.mjs +24 -2
- package/gulpfile.base.js +2 -0
- package/gulpfile.base.mjs +1 -0
- package/package.json +12 -7
package/dist/distMinify.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
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.distMinify = void 0
|
|
8
|
-
const gulpConfig = _interopRequireWildcard(require('../gulp.config.js'))
|
|
9
|
-
const _minifyFor = require('./partials/minifyFor.js')
|
|
10
|
-
function _interopRequireWildcard (e, t) { if (typeof WeakMap === 'function') var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; let o; let i; const f = { __proto__: null, default: e }; if (e === null || typeof e !== 'object' && typeof e !== 'function') return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f) } for (const t in e) t !== 'default' && {}.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.distMinify = void 0
|
|
8
|
+
const gulpConfig = _interopRequireWildcard(require('../gulp.config.js'))
|
|
9
|
+
const _minifyFor = require('./partials/minifyFor.js')
|
|
10
|
+
function _interopRequireWildcard (e, t) { if (typeof WeakMap === 'function') var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; let o; let i; const f = { __proto__: null, default: e }; if (e === null || typeof e !== 'object' && typeof e !== 'function') return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f) } for (const t in e) t !== 'default' && {}.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
|
* Creates minified versions of the dist files.
|
|
13
13
|
* @memberOf module:js-build-tools
|
|
14
14
|
* @returns {*}
|
|
15
|
-
*/
|
|
16
|
-
const distMinify = () => (0, _minifyFor.minifyFor)(gulpConfig.get('browser.from'), gulpConfig.get('dist.to'))
|
|
17
|
-
exports.distMinify = distMinify
|
|
15
|
+
*/
|
|
16
|
+
const distMinify = () => (0, _minifyFor.minifyFor)(gulpConfig.get('browser.from'), gulpConfig.get('dist.to'))
|
|
17
|
+
exports.distMinify = distMinify
|
package/dist/images.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.images = void 0
|
|
7
|
-
const _imagesFor = require('./partials/imagesFor.js')
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.images = void 0
|
|
7
|
+
const _imagesFor = require('./partials/imagesFor.js')
|
|
8
8
|
/**
|
|
9
9
|
* Move and optimize the images into the browser folder using configured settings.
|
|
10
10
|
* @memberOf module:js-build-tools
|
|
11
11
|
* @return {stream.Stream}
|
|
12
|
-
*/
|
|
13
|
-
const images = () => (0, _imagesFor.imagesFor)()
|
|
14
|
-
exports.images = images
|
|
12
|
+
*/
|
|
13
|
+
const images = () => (0, _imagesFor.imagesFor)()
|
|
14
|
+
exports.images = images
|
|
@@ -1,23 +1,23 @@
|
|
|
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.addToReadme = void 0;
|
|
8
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
10
|
-
var _jsdocToMarkdown = _interopRequireDefault(require("jsdoc-to-markdown"));
|
|
11
|
-
var _glob = require("glob");
|
|
12
|
-
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); }
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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.addToReadme = void 0;
|
|
8
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
10
|
+
var _jsdocToMarkdown = _interopRequireDefault(require("jsdoc-to-markdown"));
|
|
11
|
+
var _glob = require("glob");
|
|
12
|
+
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); }
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
/**
|
|
15
15
|
* Appends all the jsdoc comments to the readme file. Assumes empty or templated file.
|
|
16
16
|
* Configure this with 'readmeSearch', 'readmePath', 'readmeFile', and 'readmeOptions'.
|
|
17
17
|
* @memberOf module:partials
|
|
18
18
|
* @returns {string|Uint8Array}
|
|
19
|
-
*/
|
|
20
|
-
const addToReadme = () => _jsdocToMarkdown.default.render({
|
|
21
|
-
files: (0, _glob.globSync)(gulpConfig.get('readme.from'))
|
|
22
|
-
}).then(readme => _fs.default.appendFileSync(gulpConfig.get('readme.to') + gulpConfig.get('readme.file'), readme, gulpConfig.get('readmeOptions')));
|
|
19
|
+
*/
|
|
20
|
+
const addToReadme = () => _jsdocToMarkdown.default.render({
|
|
21
|
+
files: (0, _glob.globSync)(gulpConfig.get('readme.from'))
|
|
22
|
+
}).then(readme => _fs.default.appendFileSync(gulpConfig.get('readme.to') + gulpConfig.get('readme.file'), readme, gulpConfig.get('readmeOptions')));
|
|
23
23
|
exports.addToReadme = addToReadme;
|
|
@@ -1,17 +1,17 @@
|
|
|
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.beginWatcher = void 0;
|
|
8
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
9
|
-
var _gulp = require("gulp");
|
|
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); }
|
|
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.beginWatcher = void 0;
|
|
8
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
9
|
+
var _gulp = require("gulp");
|
|
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
|
* Create a chokidar instance which watches and triggers change when the globed files are modified.
|
|
13
13
|
* @memberOf module:partials
|
|
14
14
|
* @returns {FSWatcher}
|
|
15
|
-
*/
|
|
16
|
-
const beginWatcher = () => (0, _gulp.watch)(gulpConfig.get('test.watch'));
|
|
15
|
+
*/
|
|
16
|
+
const beginWatcher = () => (0, _gulp.watch)(gulpConfig.get('test.watch'));
|
|
17
17
|
exports.beginWatcher = beginWatcher;
|
package/dist/partials/clean.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
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.clean = void 0;
|
|
8
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
9
|
-
require("core-js/modules/esnext.iterator.reduce.js");
|
|
10
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
11
|
-
var _removeDirectory = require("./removeDirectory.js");
|
|
12
|
-
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.clean = void 0;
|
|
8
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
9
|
+
require("core-js/modules/esnext.iterator.reduce.js");
|
|
10
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
11
|
+
var _removeDirectory = require("./removeDirectory.js");
|
|
12
|
+
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); }
|
|
13
13
|
/**
|
|
14
14
|
* Deletes all the distribution and browser files (used before create a new build).
|
|
15
15
|
* Configure array of directories to remove with 'cleanPaths'.
|
|
16
16
|
* @memberOf module:partials
|
|
17
17
|
* @returns {Promise<string[]> | *}
|
|
18
|
-
*/
|
|
19
|
-
const clean = () => gulpConfig.get('cleanPaths').reduce((promise, path) => promise.then(() => (0, _removeDirectory.removeDirectory)(path)), Promise.resolve());
|
|
18
|
+
*/
|
|
19
|
+
const clean = () => gulpConfig.get('cleanPaths').reduce((promise, path) => promise.then(() => (0, _removeDirectory.removeDirectory)(path)), Promise.resolve());
|
|
20
20
|
exports.clean = clean;
|
package/dist/partials/copyFor.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.copyFor = void 0;
|
|
7
|
-
var _gulp = require("gulp");
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.copyFor = void 0;
|
|
7
|
+
var _gulp = require("gulp");
|
|
8
8
|
/**
|
|
9
9
|
* Copy some files to a different location.
|
|
10
10
|
* @memberOf module:partials
|
|
11
11
|
* @param {string|array} srcPath
|
|
12
12
|
* @param {string} destPath
|
|
13
13
|
* @returns {stream.Stream}
|
|
14
|
-
*/
|
|
15
|
-
// encoding: false copies the bytes untouched - Gulp 5's default utf8 handling corrupts binary files such as fonts.
|
|
16
|
-
const copyFor = (srcPath, destPath) => (0, _gulp.src)(srcPath, {
|
|
17
|
-
encoding: false
|
|
18
|
-
}).pipe((0, _gulp.dest)(destPath));
|
|
14
|
+
*/
|
|
15
|
+
// encoding: false copies the bytes untouched - Gulp 5's default utf8 handling corrupts binary files such as fonts.
|
|
16
|
+
const copyFor = (srcPath, destPath) => (0, _gulp.src)(srcPath, {
|
|
17
|
+
encoding: false
|
|
18
|
+
}).pipe((0, _gulp.dest)(destPath));
|
|
19
19
|
exports.copyFor = copyFor;
|
package/dist/partials/distFor.js
CHANGED
|
@@ -1,28 +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.distFor = void 0;
|
|
8
|
-
var _gulpBabel = _interopRequireDefault(require("gulp-babel"));
|
|
9
|
-
var _gulp = require("gulp");
|
|
10
|
-
var _distForSrc = require("./distForSrc.js");
|
|
11
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
12
|
-
var _through = _interopRequireDefault(require("through2"));
|
|
13
|
-
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); }
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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.distFor = void 0;
|
|
8
|
+
var _gulpBabel = _interopRequireDefault(require("gulp-babel"));
|
|
9
|
+
var _gulp = require("gulp");
|
|
10
|
+
var _distForSrc = require("./distForSrc.js");
|
|
11
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
12
|
+
var _through = _interopRequireDefault(require("through2"));
|
|
13
|
+
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); }
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
/**
|
|
16
16
|
* Build the distribution for a given source pattern.
|
|
17
17
|
* @memberOf module:partials
|
|
18
18
|
* @param {string|array} [srcPath='src/config/path/dist/for']
|
|
19
19
|
* @param {string} [destPath='dist/config/path']
|
|
20
20
|
* @returns {stream.Stream}
|
|
21
|
-
*/
|
|
22
|
-
const distFor = (srcPath = (0, _distForSrc.distForSrc)(), destPath = gulpConfig.get('dist.to')) => (0, _gulp.src)(srcPath).pipe((0, _gulpBabel.default)()).pipe(_through.default.obj(function (file, enc, callback) {
|
|
23
|
-
const regex = /\.mjs(['"]\s*\))/gi;
|
|
24
|
-
file.contents = Buffer.from(file.contents.toString().replaceAll(regex, '.js$1'));
|
|
25
|
-
this.push(file);
|
|
26
|
-
callback();
|
|
27
|
-
})).pipe((0, _gulp.dest)(destPath));
|
|
21
|
+
*/
|
|
22
|
+
const distFor = (srcPath = (0, _distForSrc.distForSrc)(), destPath = gulpConfig.get('dist.to')) => (0, _gulp.src)(srcPath).pipe((0, _gulpBabel.default)()).pipe(_through.default.obj(function (file, enc, callback) {
|
|
23
|
+
const regex = /\.mjs(['"]\s*\))/gi;
|
|
24
|
+
file.contents = Buffer.from(file.contents.toString().replaceAll(regex, '.js$1'));
|
|
25
|
+
this.push(file);
|
|
26
|
+
callback();
|
|
27
|
+
})).pipe((0, _gulp.dest)(destPath));
|
|
28
28
|
exports.distFor = distFor;
|
|
@@ -1,17 +1,17 @@
|
|
|
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.distForSrc = void 0;
|
|
8
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
9
|
-
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.distForSrc = void 0;
|
|
8
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
9
|
+
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); }
|
|
10
10
|
/**
|
|
11
11
|
* Retrieve the correct distFor search path based on TS Config.
|
|
12
12
|
* @memberOf module:partials
|
|
13
13
|
* @param {module:gulpConfig~FlagStringSetting} [useTs='config/for/ts']
|
|
14
14
|
* @returns {string}
|
|
15
|
-
*/
|
|
16
|
-
const distForSrc = (useTs = gulpConfig.get('typescript.enabled')) => useTs ? gulpConfig.get('browser.from') : gulpConfig.get('dist.from');
|
|
15
|
+
*/
|
|
16
|
+
const distForSrc = (useTs = gulpConfig.get('typescript.enabled')) => useTs ? gulpConfig.get('browser.from') : gulpConfig.get('dist.from');
|
|
17
17
|
exports.distForSrc = distForSrc;
|
|
@@ -1,16 +1,16 @@
|
|
|
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.distSeries = void 0;
|
|
8
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
9
|
-
var _distFor = require("./distFor.js");
|
|
10
|
-
var _distForSrc = require("./distForSrc.js");
|
|
11
|
-
var _gulp = require("gulp");
|
|
12
|
-
var _tsFor = require("./tsFor.js");
|
|
13
|
-
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.distSeries = void 0;
|
|
8
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
9
|
+
var _distFor = require("./distFor.js");
|
|
10
|
+
var _distForSrc = require("./distForSrc.js");
|
|
11
|
+
var _gulp = require("gulp");
|
|
12
|
+
var _tsFor = require("./tsFor.js");
|
|
13
|
+
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); }
|
|
14
14
|
/**
|
|
15
15
|
* When using TypeScript, ensure that we process the ts first then run babel (dist)
|
|
16
16
|
* @memberOf module:partials
|
|
@@ -18,10 +18,10 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
18
18
|
* @param {string} [distFinalPath='dist/config/path']
|
|
19
19
|
* @param {string} [tsSearch='ts/search/config/path']
|
|
20
20
|
* @returns {function(null=): stream.Stream}
|
|
21
|
-
*/
|
|
22
|
-
const distSeries = (srcPath = (0, _distForSrc.distForSrc)(), distFinalPath = gulpConfig.get('dist.to'), tsSearch = gulpConfig.get('typescript.from')) => {
|
|
23
|
-
const typescript = (0, _tsFor.tsFor)(tsSearch, distFinalPath);
|
|
24
|
-
const dist = () => (0, _distFor.distFor)(srcPath, distFinalPath);
|
|
25
|
-
return gulpConfig.get('typescript.enabled') ? (0, _gulp.series)(typescript, dist) : dist;
|
|
26
|
-
};
|
|
21
|
+
*/
|
|
22
|
+
const distSeries = (srcPath = (0, _distForSrc.distForSrc)(), distFinalPath = gulpConfig.get('dist.to'), tsSearch = gulpConfig.get('typescript.from')) => {
|
|
23
|
+
const typescript = (0, _tsFor.tsFor)(tsSearch, distFinalPath);
|
|
24
|
+
const dist = () => (0, _distFor.distFor)(srcPath, distFinalPath);
|
|
25
|
+
return gulpConfig.get('typescript.enabled') ? (0, _gulp.series)(typescript, dist) : dist;
|
|
26
|
+
};
|
|
27
27
|
exports.distSeries = distSeries;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.loadImagemin = exports.imagesFor = void 0;
|
|
8
8
|
var _gulpCache = _interopRequireDefault(require("gulp-cache"));
|
|
9
|
-
var
|
|
9
|
+
var _loadPeer = require("./loadPeer.js");
|
|
10
10
|
var _gulp = require("gulp");
|
|
11
11
|
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
12
12
|
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
@@ -24,18 +24,12 @@ const installHint = 'Add it to your project with: npm install --save-dev github:
|
|
|
24
24
|
* @throws {Error} With install instructions when gulp-imagemin is missing or is the ESM-only upstream release.
|
|
25
25
|
*/
|
|
26
26
|
const loadImagemin = (projectPath = process.cwd()) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
if (error.code === 'ERR_REQUIRE_ESM') {
|
|
35
|
-
throw new Error(`gulp-imagemin could not be loaded because it is ESM-only. ${installHint}`);
|
|
36
|
-
}
|
|
37
|
-
throw error;
|
|
38
|
-
}
|
|
27
|
+
const loaded = (0, _loadPeer.requirePeer)('gulp-imagemin', {
|
|
28
|
+
task: 'images',
|
|
29
|
+
installHint,
|
|
30
|
+
esmOnlyMessage: `gulp-imagemin could not be loaded because it is ESM-only. ${installHint}`,
|
|
31
|
+
projectPath
|
|
32
|
+
});
|
|
39
33
|
return loaded && (loaded.__esModule || loaded.default) ? loaded.default : loaded;
|
|
40
34
|
};
|
|
41
35
|
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.requirePeer = exports.importPeer = exports.importModule = void 0;
|
|
7
|
+
require("core-js/modules/es.array.includes.js");
|
|
8
|
+
var _nodeModule = require("node:module");
|
|
9
|
+
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
10
|
+
var _nodeUrl = require("node:url");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
// Several dependencies ship ESM-only (standard, gulp-ts-compile, typedoc), but this package also publishes a CommonJS
|
|
13
|
+
// build (dist/*.js) whose babel transform would turn even a dynamic import() into a require() that cannot load an ES
|
|
14
|
+
// module. Hiding the import() inside a Function constructor keeps it a genuine dynamic import that works from either
|
|
15
|
+
// build, because babel cannot see (and so cannot rewrite) an import expression which only exists as a runtime string.
|
|
16
|
+
const dynamicImport = new Function('specifier', 'return import(specifier)');
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Import an ES module (or any module) with a real dynamic import(), whichever build (ESM or CommonJS) this runs from.
|
|
20
|
+
* @memberOf module:partials
|
|
21
|
+
* @param {string} specifier - The package name, or the URL of a file.
|
|
22
|
+
* @returns {Promise<Object>} The module namespace.
|
|
23
|
+
*/
|
|
24
|
+
const importModule = specifier => dynamicImport(specifier);
|
|
25
|
+
exports.importModule = importModule;
|
|
26
|
+
const isMissing = (error, name) => error.code === 'MODULE_NOT_FOUND' && error.message.includes(`'${name}'`);
|
|
27
|
+
const notInstalled = (name, {
|
|
28
|
+
task,
|
|
29
|
+
installHint
|
|
30
|
+
}) => new Error(`The ${task} task needs the optional peer dependency ${name}, which is not installed. ${installHint}`);
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Load an optional peer dependency (one which is only needed once a task runs, so projects which never use that task
|
|
34
|
+
* do not have to install it) with require(), from the project being built rather than from this package. When it is
|
|
35
|
+
* missing the error explains how to install it.
|
|
36
|
+
* @memberOf module:partials
|
|
37
|
+
* @param {string} name - The package name.
|
|
38
|
+
* @param {Object} options
|
|
39
|
+
* @param {string} options.task - The task which needs the package, for the error message.
|
|
40
|
+
* @param {string} options.installHint - How to install it, for the error message.
|
|
41
|
+
* @param {string} [options.esmOnlyMessage] - The error message when the package turns out to be ESM-only (it cannot be require()d).
|
|
42
|
+
* @param {string} [options.projectPath=process.cwd()] - The folder of the project (which has the package.json) being built.
|
|
43
|
+
* @returns {*} Whatever the package exports.
|
|
44
|
+
* @throws {Error} With install instructions when the package is not installed.
|
|
45
|
+
*/
|
|
46
|
+
const requirePeer = (name, {
|
|
47
|
+
task,
|
|
48
|
+
installHint,
|
|
49
|
+
esmOnlyMessage,
|
|
50
|
+
projectPath = process.cwd()
|
|
51
|
+
}) => {
|
|
52
|
+
try {
|
|
53
|
+
return (0, _nodeModule.createRequire)(_nodePath.default.join(projectPath, 'package.json'))(name);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
if (isMissing(error, name)) {
|
|
56
|
+
throw notInstalled(name, {
|
|
57
|
+
task,
|
|
58
|
+
installHint
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (error.code === 'ERR_REQUIRE_ESM' && esmOnlyMessage) {
|
|
62
|
+
throw new Error(esmOnlyMessage);
|
|
63
|
+
}
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Import an optional peer dependency which ships ESM-only, from the project being built. See {@link requirePeer}.
|
|
70
|
+
* @memberOf module:partials
|
|
71
|
+
* @param {string} name - The package name.
|
|
72
|
+
* @param {Object} options
|
|
73
|
+
* @param {string} options.task - The task which needs the package, for the error message.
|
|
74
|
+
* @param {string} options.installHint - How to install it, for the error message.
|
|
75
|
+
* @param {string} [options.projectPath=process.cwd()] - The folder of the project (which has the package.json) being built.
|
|
76
|
+
* @returns {Promise<Object>} The module namespace.
|
|
77
|
+
* @throws {Error} With install instructions when the package is not installed.
|
|
78
|
+
*/
|
|
79
|
+
exports.requirePeer = requirePeer;
|
|
80
|
+
const importPeer = async (name, {
|
|
81
|
+
task,
|
|
82
|
+
installHint,
|
|
83
|
+
projectPath = process.cwd()
|
|
84
|
+
}) => {
|
|
85
|
+
let resolved;
|
|
86
|
+
try {
|
|
87
|
+
resolved = (0, _nodeModule.createRequire)(_nodePath.default.join(projectPath, 'package.json')).resolve(name);
|
|
88
|
+
} catch (error) {
|
|
89
|
+
if (isMissing(error, name)) {
|
|
90
|
+
throw notInstalled(name, {
|
|
91
|
+
task,
|
|
92
|
+
installHint
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
throw error;
|
|
96
|
+
}
|
|
97
|
+
return importModule((0, _nodeUrl.pathToFileURL)(resolved).href);
|
|
98
|
+
};
|
|
99
|
+
exports.importPeer = importPeer;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.minifyFor = void 0;
|
|
7
|
-
var _gulp = require("gulp");
|
|
8
|
-
var _gulpUglifyEs = _interopRequireDefault(require("gulp-uglify-es"));
|
|
9
|
-
var _gulpRename = _interopRequireDefault(require("gulp-rename"));
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
const uglify = _gulpUglifyEs.default.hasOwnProperty('default') ? _gulpUglifyEs.default.default : _gulpUglifyEs.default;
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.minifyFor = void 0;
|
|
7
|
+
var _gulp = require("gulp");
|
|
8
|
+
var _gulpUglifyEs = _interopRequireDefault(require("gulp-uglify-es"));
|
|
9
|
+
var _gulpRename = _interopRequireDefault(require("gulp-rename"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const uglify = _gulpUglifyEs.default.hasOwnProperty('default') ? _gulpUglifyEs.default.default : _gulpUglifyEs.default;
|
|
12
|
+
|
|
13
13
|
/**
|
|
14
14
|
* Minify files and rename the output with '.min' extension.
|
|
15
15
|
* @memberOf module:partials
|
|
16
16
|
* @returns {*}
|
|
17
|
-
*/
|
|
18
|
-
const minifyFor = (srcSearch, destination) => (0, _gulp.src)(srcSearch).pipe(uglify()).pipe((0, _gulpRename.default)({
|
|
19
|
-
extname: '.min.js'
|
|
20
|
-
})).pipe((0, _gulp.dest)(destination));
|
|
17
|
+
*/
|
|
18
|
+
const minifyFor = (srcSearch, destination) => (0, _gulp.src)(srcSearch).pipe(uglify()).pipe((0, _gulpRename.default)({
|
|
19
|
+
extname: '.min.js'
|
|
20
|
+
})).pipe((0, _gulp.dest)(destination));
|
|
21
21
|
exports.minifyFor = minifyFor;
|
|
@@ -1,19 +1,19 @@
|
|
|
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.readmeTemplate = void 0;
|
|
8
|
-
var _gulp = require("gulp");
|
|
9
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
10
|
-
var _gulpRename = _interopRequireDefault(require("gulp-rename"));
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
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.readmeTemplate = void 0;
|
|
8
|
+
var _gulp = require("gulp");
|
|
9
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
10
|
+
var _gulpRename = _interopRequireDefault(require("gulp-rename"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
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); }
|
|
13
13
|
/**
|
|
14
14
|
* Copy a readme template into the README.md file.
|
|
15
15
|
* @memberOf module:partials
|
|
16
16
|
* @returns {*}
|
|
17
|
-
*/
|
|
18
|
-
const readmeTemplate = () => (0, _gulp.src)(gulpConfig.get('readme.template')).pipe((0, _gulpRename.default)(gulpConfig.get('readme.file'))).pipe((0, _gulp.dest)(gulpConfig.get('readme.to')));
|
|
17
|
+
*/
|
|
18
|
+
const readmeTemplate = () => (0, _gulp.src)(gulpConfig.get('readme.template')).pipe((0, _gulpRename.default)(gulpConfig.get('readme.file'))).pipe((0, _gulp.dest)(gulpConfig.get('readme.to')));
|
|
19
19
|
exports.readmeTemplate = readmeTemplate;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.removeDirectory = void 0;
|
|
7
|
-
var _promises = require("node:fs/promises");
|
|
8
|
-
var _promises2 = require("node:timers/promises");
|
|
9
|
-
const attempts = 4;
|
|
10
|
-
const exists = dirPath => (0, _promises.access)(dirPath).then(() => true, () => false);
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.removeDirectory = void 0;
|
|
7
|
+
var _promises = require("node:fs/promises");
|
|
8
|
+
var _promises2 = require("node:timers/promises");
|
|
9
|
+
const attempts = 4;
|
|
10
|
+
const exists = dirPath => (0, _promises.access)(dirPath).then(() => true, () => false);
|
|
11
|
+
|
|
12
12
|
/**
|
|
13
13
|
* Delete a directory and everything in it, resolving only once it is really gone.
|
|
14
14
|
*
|
|
@@ -20,22 +20,22 @@ const exists = dirPath => (0, _promises.access)(dirPath).then(() => true, () =>
|
|
|
20
20
|
* @param {string} dirPath
|
|
21
21
|
* @returns {Promise<string>} Resolves with dirPath once the directory no longer exists (or already didn't).
|
|
22
22
|
* @throws {Error} If the directory still exists after several attempts.
|
|
23
|
-
*/
|
|
24
|
-
const removeDirectory = async dirPath => {
|
|
25
|
-
for (let attempt = 1; attempt <= attempts; attempt++) {
|
|
26
|
-
await (0, _promises.rm)(dirPath, {
|
|
27
|
-
recursive: true,
|
|
28
|
-
force: true,
|
|
29
|
-
maxRetries: 5,
|
|
30
|
-
retryDelay: 100
|
|
31
|
-
});
|
|
32
|
-
if (!(await exists(dirPath))) {
|
|
33
|
-
return dirPath;
|
|
34
|
-
}
|
|
35
|
-
if (attempt < attempts) {
|
|
36
|
-
await (0, _promises2.setTimeout)(200 * attempt);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
throw new Error(`Unable to remove "${dirPath}" - it was recreated or is locked. Stop anything that has it open or is writing ` + 'into it (watchers, dev servers, editors, other build tasks) and try again.');
|
|
40
|
-
};
|
|
23
|
+
*/
|
|
24
|
+
const removeDirectory = async dirPath => {
|
|
25
|
+
for (let attempt = 1; attempt <= attempts; attempt++) {
|
|
26
|
+
await (0, _promises.rm)(dirPath, {
|
|
27
|
+
recursive: true,
|
|
28
|
+
force: true,
|
|
29
|
+
maxRetries: 5,
|
|
30
|
+
retryDelay: 100
|
|
31
|
+
});
|
|
32
|
+
if (!(await exists(dirPath))) {
|
|
33
|
+
return dirPath;
|
|
34
|
+
}
|
|
35
|
+
if (attempt < attempts) {
|
|
36
|
+
await (0, _promises2.setTimeout)(200 * attempt);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
throw new Error(`Unable to remove "${dirPath}" - it was recreated or is locked. Stop anything that has it open or is writing ` + 'into it (watchers, dev servers, editors, other build tasks) and try again.');
|
|
40
|
+
};
|
|
41
41
|
exports.removeDirectory = removeDirectory;
|