js-build-tools 2.2.11 → 2.2.12
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/dist/build.js +23 -21
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +7 -8
- package/dist/bundle.min.js +1 -1
- package/dist/bundleLint.js +12 -14
- package/dist/bundleLint.min.js +1 -1
- package/dist/bundleMinify.js +3 -6
- package/dist/bundleMinify.min.js +1 -1
- package/dist/compileReadme.js +8 -6
- package/dist/compileReadme.min.js +1 -1
- package/dist/default.js +8 -7
- package/dist/default.min.js +1 -1
- package/dist/dist.js +2 -4
- package/dist/dist.min.js +1 -1
- package/dist/distLint.js +12 -13
- package/dist/distLint.min.js +1 -1
- package/dist/distMinify.js +3 -5
- package/dist/distMinify.min.js +1 -1
- package/dist/partials/addToReadme.js +9 -12
- package/dist/partials/beginWatcher.js +5 -6
- package/dist/partials/clean.js +3 -12
- package/dist/partials/distFor.js +10 -9
- package/dist/partials/distForSrc.js +3 -3
- package/dist/partials/distSeries.js +13 -14
- package/dist/partials/minifyFor.js +11 -11
- package/dist/partials/readmeTemplate.js +7 -8
- package/dist/partials/removeDirectory.js +7 -16
- package/dist/partials/runOnChange.js +17 -21
- package/dist/partials/tsFor.js +14 -17
- package/dist/partials.js +11 -11
- package/dist/partials.min.js +1 -1
- package/dist/test-helpers/circularObject.js +1 -1
- package/dist/test-helpers/countMatches.js +1 -5
- package/dist/test-helpers/deepReferenceObject.js +1 -1
- package/dist/test-helpers/domItem.js +1 -1
- package/dist/test-helpers/jsonDom.js +1 -1
- package/dist/test-helpers/linkedList.js +1 -1
- package/dist/test-helpers/logObject.js +4 -7
- package/dist/test-helpers/multiReferenceObject.js +1 -1
- package/dist/test-helpers/nodeTree.js +1 -1
- package/dist/test-helpers/setUp.js +31 -75
- package/dist/testFull.js +6 -5
- package/dist/testFull.min.js +1 -1
- package/dist/testHelpers.js +10 -10
- package/dist/testHelpers.min.js +1 -1
- package/dist/testQuick.js +6 -5
- package/dist/testQuick.min.js +1 -1
- package/dist/typeScript.js +2 -2
- package/dist/typeScript.min.js +1 -1
- package/dist/watchFull.js +5 -6
- package/dist/watchFull.min.js +1 -1
- package/dist/watchTest.js +8 -9
- package/dist/watchTest.min.js +1 -1
- package/functions/build.test.js +4 -11
- package/functions/partials/distFor.test.js +7 -7
- package/package.json +6 -6
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require(
|
|
4
|
-
require(
|
|
5
|
-
require(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _require = require('gulp'),
|
|
12
|
-
parallel = _require.parallel,
|
|
13
|
-
series = _require.series;
|
|
14
|
-
var testQuick = require('../testQuick');
|
|
3
|
+
const gulpConfig = require('../../gulp.config.js');
|
|
4
|
+
const bundle = require('../bundle');
|
|
5
|
+
const distSeries = require('./distSeries');
|
|
6
|
+
const {
|
|
7
|
+
parallel,
|
|
8
|
+
series
|
|
9
|
+
} = require('gulp');
|
|
10
|
+
const testQuick = require('../testQuick');
|
|
15
11
|
|
|
16
12
|
/**
|
|
17
13
|
* Run this function when the watched files are modified.
|
|
@@ -39,10 +35,10 @@ var testQuick = require('../testQuick');
|
|
|
39
35
|
* @param {string} path
|
|
40
36
|
* @returns {stream.Stream}
|
|
41
37
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
const runOnChange = path => {
|
|
39
|
+
const useTs = gulpConfig.get('useTsConfig');
|
|
40
|
+
const distPath = gulpConfig.get('distPath');
|
|
41
|
+
const srcPath = gulpConfig.get('srcPath');
|
|
46
42
|
/**
|
|
47
43
|
* 1. The original path comes in from src and is a .ts
|
|
48
44
|
* 2. Discover the outgoing dist path where that file should go
|
|
@@ -51,13 +47,13 @@ var runOnChange = function runOnChange(path) {
|
|
|
51
47
|
* 5. Use the dist path found previously in #2
|
|
52
48
|
* 6. Use the full dist path and the dist outgoing path in distFor
|
|
53
49
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
const pathRegex = new RegExp(`^${srcPath}(.*\\/)(.+)\\.(js|ts)$`, 'i');
|
|
51
|
+
const distPathResult = path.replace(pathRegex, `${distPath}$1`);
|
|
52
|
+
let distSrcPath = path;
|
|
57
53
|
if (useTs) {
|
|
58
|
-
distSrcPath = path.replace(pathRegex,
|
|
54
|
+
distSrcPath = path.replace(pathRegex, `${distPath}$1$2.js`);
|
|
59
55
|
}
|
|
60
|
-
|
|
56
|
+
const runSeries = distSeries(distSrcPath, distPathResult, path);
|
|
61
57
|
return gulpConfig.get('nodeOnly') ? series(testQuick, runSeries)() : parallel(testQuick, series(runSeries, bundle))();
|
|
62
58
|
};
|
|
63
59
|
module.exports = runOnChange;
|
package/dist/partials/tsFor.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
dest
|
|
5
|
-
parallel
|
|
6
|
-
src
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const {
|
|
4
|
+
dest,
|
|
5
|
+
parallel,
|
|
6
|
+
src
|
|
7
|
+
} = require('gulp');
|
|
8
|
+
const gulpConfig = require('../../gulp.config.js');
|
|
9
|
+
const ts = require('gulp-typescript');
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Starting at the source directory, find all the ts files and convert them into the distribution directory.
|
|
@@ -16,17 +17,13 @@ var ts = require('gulp-typescript');
|
|
|
16
17
|
* @returns {Function}
|
|
17
18
|
* @see `https://www.typescriptlang.org/docs/handbook/gulp.html` for more info
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
var compileJS = function compileJS() {
|
|
28
|
-
return src(srcPath).pipe(tsProject()).js.pipe(dest(distPath));
|
|
29
|
-
};
|
|
20
|
+
const tsFor = function () {
|
|
21
|
+
let srcPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gulpConfig.get('tsSearch');
|
|
22
|
+
let distPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gulpConfig.get('distPath');
|
|
23
|
+
const declarationProject = ts.createProject(gulpConfig.get('useTsConfig'));
|
|
24
|
+
const tsProject = ts.createProject(gulpConfig.get('useTsConfig'));
|
|
25
|
+
const makeDeclarations = () => src(srcPath).pipe(declarationProject()).dts.pipe(dest(distPath));
|
|
26
|
+
const compileJS = () => src(srcPath).pipe(tsProject()).js.pipe(dest(distPath));
|
|
30
27
|
return parallel(makeDeclarations, compileJS);
|
|
31
28
|
};
|
|
32
29
|
module.exports = tsFor;
|
package/dist/partials.js
CHANGED
|
@@ -9,17 +9,17 @@
|
|
|
9
9
|
* @memberOf module:js-build-tools
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
const addToReadme = require('./partials/addToReadme')
|
|
13
|
+
const beginWatcher = require('./partials/beginWatcher')
|
|
14
|
+
const clean = require('./partials/clean')
|
|
15
|
+
const distFor = require('./partials/distFor')
|
|
16
|
+
const distForSrc = require('./partials/distForSrc')
|
|
17
|
+
const distSeries = require('./partials/distSeries')
|
|
18
|
+
const minifyFor = require('./partials/minifyFor')
|
|
19
|
+
const readmeTemplate = require('./partials/readmeTemplate')
|
|
20
|
+
const removeDirectory = require('./partials/removeDirectory')
|
|
21
|
+
const runOnChange = require('./partials/runOnChange')
|
|
22
|
+
const tsFor = require('./partials/tsFor')
|
|
23
23
|
module.exports = {
|
|
24
24
|
addToReadme,
|
|
25
25
|
beginWatcher,
|
package/dist/partials.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const addToReadme=require("./partials/addToReadme"),beginWatcher=require("./partials/beginWatcher"),clean=require("./partials/clean"),distFor=require("./partials/distFor"),distForSrc=require("./partials/distForSrc"),distSeries=require("./partials/distSeries"),minifyFor=require("./partials/minifyFor"),readmeTemplate=require("./partials/readmeTemplate"),removeDirectory=require("./partials/removeDirectory"),runOnChange=require("./partials/runOnChange"),tsFor=require("./partials/tsFor");module.exports={addToReadme:addToReadme,beginWatcher:beginWatcher,clean:clean,distFor:distFor,distForSrc:distForSrc,distSeries:distSeries,minifyFor:minifyFor,readmeTemplate:readmeTemplate,removeDirectory:removeDirectory,runOnChange:runOnChange,tsFor:tsFor};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
4
|
-
require("core-js/modules/es.string.split.js");
|
|
5
3
|
/**
|
|
6
4
|
* Simple way to count string occurrences for testing.
|
|
7
5
|
* @function
|
|
@@ -10,7 +8,5 @@ require("core-js/modules/es.string.split.js");
|
|
|
10
8
|
* @param {string} search
|
|
11
9
|
* @returns {number}
|
|
12
10
|
*/
|
|
13
|
-
|
|
14
|
-
return content.split(search).length - 1;
|
|
15
|
-
};
|
|
11
|
+
const countMatches = (content, search) => content.split(search).length - 1;
|
|
16
12
|
module.exports = countMatches;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.json.stringify.js");
|
|
4
3
|
/**
|
|
5
4
|
* Log out an object in a nicely formatted way.
|
|
6
5
|
* @function
|
|
@@ -10,12 +9,10 @@ require("core-js/modules/es.json.stringify.js");
|
|
|
10
9
|
* @param {string} [outputType=log]
|
|
11
10
|
* @returns {string|undefined}
|
|
12
11
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return "'".concat(label, "' | ") + JSON.stringify(object);
|
|
18
|
-
} : console[outputType];
|
|
12
|
+
const logObject = function (object) {
|
|
13
|
+
let label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'logging';
|
|
14
|
+
let outputType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'log';
|
|
15
|
+
const logger = outputType === 'string' ? (label, object) => `'${label}' | ` + JSON.stringify(object) : console[outputType];
|
|
19
16
|
if (typeof require === 'undefined' || outputType === 'string') {
|
|
20
17
|
return logger(label, object);
|
|
21
18
|
}
|
|
@@ -1,31 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require(
|
|
4
|
-
require("core-js/modules/es.symbol.description.js");
|
|
5
|
-
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
7
|
-
require("core-js/modules/es.symbol.async-iterator.js");
|
|
8
|
-
require("core-js/modules/es.symbol.to-string-tag.js");
|
|
9
|
-
require("core-js/modules/es.json.to-string-tag.js");
|
|
10
|
-
require("core-js/modules/es.math.to-string-tag.js");
|
|
11
|
-
require("core-js/modules/esnext.async-iterator.for-each.js");
|
|
12
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
13
|
-
require("core-js/modules/esnext.iterator.for-each.js");
|
|
14
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
15
|
-
require("core-js/modules/es.array.reverse.js");
|
|
16
|
-
require("core-js/modules/es.array.slice.js");
|
|
17
|
-
require("core-js/modules/es.object.to-string.js");
|
|
18
|
-
require("core-js/modules/es.promise.js");
|
|
19
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(typeof e + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
20
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
21
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
22
|
-
var fs = require('fs');
|
|
3
|
+
const fs = require('fs');
|
|
23
4
|
// Import the configurations and override some of them in order to direct to the temp directory.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
removeDirectory
|
|
27
|
-
|
|
28
|
-
|
|
5
|
+
const gulpConfig = require('../../gulp.config.js');
|
|
6
|
+
const {
|
|
7
|
+
removeDirectory
|
|
8
|
+
} = require('../partials');
|
|
9
|
+
let tempDir = 'test-temp/';
|
|
10
|
+
let srcPath = `${tempDir}src`;
|
|
29
11
|
|
|
30
12
|
/**
|
|
31
13
|
* Update the gulp configurations with the test data. Set the test directory where temp files will be created for testing.
|
|
@@ -33,25 +15,25 @@ var srcPath = "".concat(tempDir, "src");
|
|
|
33
15
|
* @memberOf module:testHelpers
|
|
34
16
|
* @param {string} testDir
|
|
35
17
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
tempDir =
|
|
39
|
-
srcPath =
|
|
40
|
-
|
|
41
|
-
|
|
18
|
+
const setDefaults = function () {
|
|
19
|
+
let testDir = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'test-temp';
|
|
20
|
+
tempDir = `${testDir}/`;
|
|
21
|
+
srcPath = `${tempDir}src`;
|
|
22
|
+
const distPath = `${tempDir}dist`;
|
|
23
|
+
const browserPath = `${tempDir}browser`;
|
|
42
24
|
gulpConfig.set('browserPath', browserPath);
|
|
43
25
|
gulpConfig.set('cleanPaths', [distPath, browserPath]);
|
|
44
|
-
gulpConfig.set('distMain',
|
|
26
|
+
gulpConfig.set('distMain', `${distPath}/main`);
|
|
45
27
|
gulpConfig.set('distPath', distPath);
|
|
46
|
-
gulpConfig.set('distSearch',
|
|
47
|
-
gulpConfig.set('readmeTemplate',
|
|
28
|
+
gulpConfig.set('distSearch', `${distPath}/**/*.js`);
|
|
29
|
+
gulpConfig.set('readmeTemplate', `${tempDir}MAIN.md`);
|
|
48
30
|
gulpConfig.set('readmePath', tempDir);
|
|
49
|
-
gulpConfig.set('readmeSearch',
|
|
31
|
+
gulpConfig.set('readmeSearch', `${srcPath}/**/!(*.test).js`);
|
|
50
32
|
gulpConfig.set('rootPath', tempDir);
|
|
51
33
|
gulpConfig.set('srcPath', srcPath);
|
|
52
|
-
gulpConfig.set('srcSearch',
|
|
53
|
-
gulpConfig.set('tsSearch',
|
|
54
|
-
gulpConfig.set('watchSearch',
|
|
34
|
+
gulpConfig.set('srcSearch', `${srcPath}/**/!(*.test).js`);
|
|
35
|
+
gulpConfig.set('tsSearch', `${srcPath}/**/*.ts`);
|
|
36
|
+
gulpConfig.set('watchSearch', `${srcPath}/**/*.js`);
|
|
55
37
|
};
|
|
56
38
|
exports.setDefaults = setDefaults;
|
|
57
39
|
exports.gulpConfig = gulpConfig;
|
|
@@ -63,37 +45,15 @@ exports.gulpConfig = gulpConfig;
|
|
|
63
45
|
* @param {boolean} [exists=true]
|
|
64
46
|
* @returns {Promise<*|void>}
|
|
65
47
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
_context.next = 3;
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
return _context.abrupt("return", removeDirectory(tempDir).then(function (removedDir) {
|
|
79
|
-
return createTempDir(fs.existsSync(removedDir));
|
|
80
|
-
}).catch(function (error) {
|
|
81
|
-
return console.error('Error: ', error);
|
|
82
|
-
}));
|
|
83
|
-
case 3:
|
|
84
|
-
return _context.abrupt("return", fs.mkdirSync(srcPath, {
|
|
85
|
-
recursive: true
|
|
86
|
-
}));
|
|
87
|
-
case 4:
|
|
88
|
-
case "end":
|
|
89
|
-
return _context.stop();
|
|
90
|
-
}
|
|
91
|
-
}, _callee);
|
|
92
|
-
}));
|
|
93
|
-
return function createTempDir() {
|
|
94
|
-
return _ref.apply(this, arguments);
|
|
95
|
-
};
|
|
96
|
-
}();
|
|
48
|
+
const createTempDir = async function () {
|
|
49
|
+
let exists = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
50
|
+
if (exists) {
|
|
51
|
+
return removeDirectory(tempDir).then(removedDir => createTempDir(fs.existsSync(removedDir))).catch(error => console.error('Error: ', error));
|
|
52
|
+
}
|
|
53
|
+
return fs.mkdirSync(srcPath, {
|
|
54
|
+
recursive: true
|
|
55
|
+
});
|
|
56
|
+
};
|
|
97
57
|
exports.createTempDir = createTempDir;
|
|
98
58
|
|
|
99
59
|
/**
|
|
@@ -102,9 +62,7 @@ exports.createTempDir = createTempDir;
|
|
|
102
62
|
* @memberOf module:testHelpers
|
|
103
63
|
* @returns {Promise<*|void>}
|
|
104
64
|
*/
|
|
105
|
-
exports.beforeEach =
|
|
106
|
-
return createTempDir();
|
|
107
|
-
};
|
|
65
|
+
exports.beforeEach = () => createTempDir();
|
|
108
66
|
|
|
109
67
|
/**
|
|
110
68
|
* In the Jest.afterEach function call this one to clean up and remove the temp directory.
|
|
@@ -112,6 +70,4 @@ exports.beforeEach = function () {
|
|
|
112
70
|
* @memberOf module:testHelpers
|
|
113
71
|
* @returns {Promise<*>}
|
|
114
72
|
*/
|
|
115
|
-
exports.afterEach =
|
|
116
|
-
return removeDirectory(tempDir);
|
|
117
|
-
};
|
|
73
|
+
exports.afterEach = () => removeDirectory(tempDir);
|
package/dist/testFull.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const gulpConfig = require('../gulp.config.js')
|
|
4
|
+
const {
|
|
5
|
+
runCLI
|
|
6
|
+
} = require('jest')
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Run all tests with jest.
|
|
@@ -11,8 +12,8 @@ var runCLI = _require.runCLI
|
|
|
11
12
|
* @memberOf module:js-build-tools
|
|
12
13
|
* @returns {Promise<*>}
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
const testFull = () => {
|
|
16
|
+
let testPath = gulpConfig.get('testPath')
|
|
16
17
|
if (!Array.isArray(testPath)) {
|
|
17
18
|
// The testPath must be an array of strings
|
|
18
19
|
testPath = [testPath]
|
package/dist/testFull.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const gulpConfig=require("../gulp.config.js"),{runCLI:runCLI}=require("jest"),testFull=()=>{let t=gulpConfig.get("testPath");return Array.isArray(t)||(t=[t]),runCLI(gulpConfig.get("testOptions"),t)};module.exports=testFull;
|
package/dist/testHelpers.js
CHANGED
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
* @memberOf module:js-build-tools
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
const circularObject = require('./test-helpers/circularObject')
|
|
13
|
+
const countMatches = require('./test-helpers/countMatches')
|
|
14
|
+
const deepReferenceObject = require('./test-helpers/deepReferenceObject')
|
|
15
|
+
const domItem = require('./test-helpers/domItem')
|
|
16
|
+
const jsonDom = require('./test-helpers/jsonDom')
|
|
17
|
+
const linkedList = require('./test-helpers/linkedList')
|
|
18
|
+
const logObject = require('./test-helpers/logObject')
|
|
19
|
+
const multiReferenceObject = require('./test-helpers/multiReferenceObject')
|
|
20
|
+
const nodeTree = require('./test-helpers/nodeTree')
|
|
21
|
+
const setUp = require('./test-helpers/setUp')
|
|
22
22
|
module.exports = {
|
|
23
23
|
circularObject,
|
|
24
24
|
countMatches,
|
package/dist/testHelpers.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const circularObject=require("./test-helpers/circularObject"),countMatches=require("./test-helpers/countMatches"),deepReferenceObject=require("./test-helpers/deepReferenceObject"),domItem=require("./test-helpers/domItem"),jsonDom=require("./test-helpers/jsonDom"),linkedList=require("./test-helpers/linkedList"),logObject=require("./test-helpers/logObject"),multiReferenceObject=require("./test-helpers/multiReferenceObject"),nodeTree=require("./test-helpers/nodeTree"),setUp=require("./test-helpers/setUp");module.exports={circularObject:circularObject,countMatches:countMatches,deepReferenceObject:deepReferenceObject,domItem:domItem,jsonDom:jsonDom,linkedList:linkedList,logObject:logObject,multiReferenceObject:multiReferenceObject,nodeTree:nodeTree,setUp:setUp};
|
package/dist/testQuick.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const gulpConfig = require('../gulp.config.js')
|
|
4
|
+
const {
|
|
5
|
+
runCLI
|
|
6
|
+
} = require('jest')
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Run the Jest tests for files which have been modified (based on git status).
|
|
@@ -11,8 +12,8 @@ var runCLI = _require.runCLI
|
|
|
11
12
|
* @memberOf module:js-build-tools
|
|
12
13
|
* @returns {Promise<*>}
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
const testQuick = () => {
|
|
16
|
+
let testPath = gulpConfig.get('testPath')
|
|
16
17
|
if (!Array.isArray(testPath)) {
|
|
17
18
|
// The testPath must be an array of strings
|
|
18
19
|
testPath = [testPath]
|
package/dist/testQuick.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const gulpConfig=require("../gulp.config.js"),{runCLI:runCLI}=require("jest"),testQuick=()=>{let e=gulpConfig.get("testPath");return Array.isArray(e)||(e=[e]),runCLI({onlyChanged:!0},e)};module.exports=testQuick;
|
package/dist/typeScript.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const tsFor = require('./partials/tsFor')
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Simplified typescript task using tsFor.
|
|
@@ -8,5 +8,5 @@ var tsFor = require('./partials/tsFor')
|
|
|
8
8
|
* @memberOf module:js-build-tools
|
|
9
9
|
* @returns {Function}
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
const typeScript = tsFor()
|
|
12
12
|
module.exports = typeScript
|
package/dist/typeScript.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const tsFor=require("./partials/tsFor"),typeScript=tsFor();module.exports=typeScript;
|
package/dist/watchFull.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const {
|
|
4
|
+
beginWatcher,
|
|
5
|
+
runOnChange
|
|
6
|
+
} = require('./partials')
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Watch for changes and run the distribution for the changed files, then bundle and test the changed files.
|
|
@@ -10,7 +11,5 @@ var runOnChange = _require.runOnChange
|
|
|
10
11
|
* @memberOf module:js-build-tools
|
|
11
12
|
* @returns {FSWatcher}
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
-
return beginWatcher().on('change', runOnChange)
|
|
15
|
-
}
|
|
14
|
+
const watchFull = () => beginWatcher().on('change', runOnChange)
|
|
16
15
|
module.exports = watchFull
|
package/dist/watchFull.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const{beginWatcher:beginWatcher,runOnChange:runOnChange}=require("./partials"),watchFull=()=>beginWatcher().on("change",runOnChange);module.exports=watchFull;
|
package/dist/watchTest.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const gulpConfig = require('../gulp.config.js')
|
|
4
|
+
const {
|
|
5
|
+
watch
|
|
6
|
+
} = require('gulp')
|
|
7
|
+
const testQuick = require('./testQuick')
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Watch for changes and run the tests.
|
|
@@ -11,9 +12,7 @@ var testQuick = require('./testQuick')
|
|
|
11
12
|
* @memberOf module:js-build-tools
|
|
12
13
|
* @returns {*}
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, testQuick)
|
|
18
|
-
}
|
|
15
|
+
const watchTest = () => watch(gulpConfig.get('watchSearch'), {
|
|
16
|
+
ignoreInitial: false
|
|
17
|
+
}, testQuick)
|
|
19
18
|
module.exports = watchTest
|
package/dist/watchTest.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const gulpConfig=require("../gulp.config.js"),{watch:watch}=require("gulp"),testQuick=require("./testQuick"),watchTest=()=>watch(gulpConfig.get("watchSearch"),{ignoreInitial:!1},testQuick);module.exports=watchTest;
|