js-build-tools 2.1.0 → 2.1.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.
Files changed (38) hide show
  1. package/dist/build.js +24 -24
  2. package/dist/bundle.js +13 -13
  3. package/dist/bundleLint.js +19 -19
  4. package/dist/bundleMinify.js +11 -11
  5. package/dist/compileReadme.js +11 -11
  6. package/dist/default.js +14 -14
  7. package/dist/dist.js +9 -9
  8. package/dist/distLint.js +18 -18
  9. package/dist/distMinify.js +10 -10
  10. package/dist/partials/addToReadme.js +18 -18
  11. package/dist/partials/beginWatcher.js +10 -10
  12. package/dist/partials/clean.js +13 -13
  13. package/dist/partials/distFor.js +15 -15
  14. package/dist/partials/distForSrc.js +9 -9
  15. package/dist/partials/distSeries.js +22 -22
  16. package/dist/partials/minifyFor.js +15 -15
  17. package/dist/partials/readmeTemplate.js +12 -12
  18. package/dist/partials/runOnChange.js +30 -30
  19. package/dist/partials/tsFor.js +15 -15
  20. package/dist/partials.js +26 -26
  21. package/dist/test-helpers/circularObject.js +45 -45
  22. package/dist/test-helpers/countMatches.js +8 -8
  23. package/dist/test-helpers/deepReferenceObject.js +15 -15
  24. package/dist/test-helpers/domItem.js +28 -28
  25. package/dist/test-helpers/jsonDom.js +15 -15
  26. package/dist/test-helpers/linkedList.js +18 -18
  27. package/dist/test-helpers/logObject.js +15 -15
  28. package/dist/test-helpers/multiReferenceObject.js +15 -15
  29. package/dist/test-helpers/nodeTree.js +23 -23
  30. package/dist/test-helpers/setUp.js +105 -105
  31. package/dist/testFull.js +17 -17
  32. package/dist/testHelpers.js +26 -26
  33. package/dist/testQuick.js +19 -19
  34. package/dist/typeScript.js +9 -9
  35. package/dist/watchFull.js +11 -11
  36. package/dist/watchTest.js +14 -14
  37. package/functions/partials/distFor.test.js +1 -1
  38. package/package.json +2 -1
@@ -1,18 +1,18 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.regexp.constructor.js");
4
- require("core-js/modules/es.regexp.exec.js");
5
- require("core-js/modules/es.regexp.sticky.js");
6
- require("core-js/modules/es.regexp.to-string.js");
7
- require("core-js/modules/es.string.replace.js");
8
- var gulpConfig = require('../../gulp.config.js');
9
- var bundle = require('../bundle');
10
- var distSeries = require('./distSeries');
11
- var _require = require('gulp'),
12
- parallel = _require.parallel,
13
- series = _require.series;
14
- var testQuick = require('../testQuick');
15
-
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.regexp.constructor.js");
4
+ require("core-js/modules/es.regexp.exec.js");
5
+ require("core-js/modules/es.regexp.sticky.js");
6
+ require("core-js/modules/es.regexp.to-string.js");
7
+ require("core-js/modules/es.string.replace.js");
8
+ var gulpConfig = require('../../gulp.config.js');
9
+ var bundle = require('../bundle');
10
+ var distSeries = require('./distSeries');
11
+ var _require = require('gulp'),
12
+ parallel = _require.parallel,
13
+ series = _require.series;
14
+ var testQuick = require('../testQuick');
15
+
16
16
  /**
17
17
  * Run this function when the watched files are modified.
18
18
  * 1. Find the sub-folders within src path
@@ -38,11 +38,11 @@ var testQuick = require('../testQuick');
38
38
  * @memberOf module:partials
39
39
  * @param {string} path
40
40
  * @returns {stream.Stream}
41
- */
42
- var runOnChange = function runOnChange(path) {
43
- var useTs = gulpConfig.get('useTsConfig');
44
- var distPath = gulpConfig.get('distPath');
45
- var srcPath = gulpConfig.get('srcPath');
41
+ */
42
+ var runOnChange = function runOnChange(path) {
43
+ var useTs = gulpConfig.get('useTsConfig');
44
+ var distPath = gulpConfig.get('distPath');
45
+ var srcPath = gulpConfig.get('srcPath');
46
46
  /**
47
47
  * 1. The original path comes in from src and is a .ts
48
48
  * 2. Discover the outgoing dist path where that file should go
@@ -50,14 +50,14 @@ var runOnChange = function runOnChange(path) {
50
50
  * 4. Take the original path, convert to full file path in dist
51
51
  * 5. Use the dist path found previously in #2
52
52
  * 6. Use the full dist path and the dist outgoing path in distFor
53
- */
54
- var pathRegex = new RegExp("^".concat(srcPath, "(.*\\/)(.+)\\.(js|ts)$"), 'i');
55
- var distPathResult = path.replace(pathRegex, "".concat(distPath, "$1"));
56
- var distSrcPath = path;
57
- if (useTs) {
58
- distSrcPath = path.replace(pathRegex, "".concat(distPath, "$1$2.js"));
59
- }
60
- var runSeries = distSeries(distSrcPath, distPathResult, path);
61
- return gulpConfig.get('nodeOnly') ? series(testQuick, runSeries)() : parallel(testQuick, series(runSeries, bundle))();
62
- };
53
+ */
54
+ var pathRegex = new RegExp("^".concat(srcPath, "(.*\\/)(.+)\\.(js|ts)$"), 'i');
55
+ var distPathResult = path.replace(pathRegex, "".concat(distPath, "$1"));
56
+ var distSrcPath = path;
57
+ if (useTs) {
58
+ distSrcPath = path.replace(pathRegex, "".concat(distPath, "$1$2.js"));
59
+ }
60
+ var runSeries = distSeries(distSrcPath, distPathResult, path);
61
+ return gulpConfig.get('nodeOnly') ? series(testQuick, runSeries)() : parallel(testQuick, series(runSeries, bundle))();
62
+ };
63
63
  module.exports = runOnChange;
@@ -1,12 +1,12 @@
1
- "use strict";
2
-
3
- var _require = require('gulp'),
4
- dest = _require.dest,
5
- src = _require.src;
6
- var gulpConfig = require('../../gulp.config.js');
7
- var ts = require('gulp-typescript');
8
- var tsProject = ts.createProject(gulpConfig.get('useTsConfig'));
9
-
1
+ "use strict";
2
+
3
+ var _require = require('gulp'),
4
+ dest = _require.dest,
5
+ src = _require.src;
6
+ var gulpConfig = require('../../gulp.config.js');
7
+ var ts = require('gulp-typescript');
8
+ var tsProject = ts.createProject(gulpConfig.get('useTsConfig'));
9
+
10
10
  /**
11
11
  * Starting at the source directory, find all the ts files and convert them into the distribution directory.
12
12
  * @function
@@ -15,10 +15,10 @@ var tsProject = ts.createProject(gulpConfig.get('useTsConfig'));
15
15
  * @param {string} [distPath='']
16
16
  * @returns {stream.Stream}
17
17
  * @see `https://www.typescriptlang.org/docs/handbook/gulp.html` for more info
18
- */
19
- var tsFor = function tsFor() {
20
- var srcPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gulpConfig.get('tsSearch');
21
- var distPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gulpConfig.get('distPath');
22
- return src(srcPath).pipe(tsProject()).js.pipe(dest(distPath));
23
- };
18
+ */
19
+ var tsFor = function tsFor() {
20
+ var srcPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gulpConfig.get('tsSearch');
21
+ var distPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gulpConfig.get('distPath');
22
+ return src(srcPath).pipe(tsProject()).js.pipe(dest(distPath));
23
+ };
24
24
  module.exports = tsFor;
package/dist/partials.js CHANGED
@@ -1,5 +1,5 @@
1
- 'use strict'
2
-
1
+ 'use strict'
2
+
3
3
  /**
4
4
  * Micro-functions used as components for the main gulp functions.
5
5
  * @file
@@ -7,27 +7,27 @@
7
7
  * @version 2.0.0
8
8
  * @module partials
9
9
  * @memberOf module:js-build-tools
10
- */
11
-
12
- var addToReadme = require('./partials/addToReadme')
13
- var beginWatcher = require('./partials/beginWatcher')
14
- var clean = require('./partials/clean')
15
- var distFor = require('./partials/distFor')
16
- var distForSrc = require('./partials/distForSrc')
17
- var distSeries = require('./partials/distSeries')
18
- var minifyFor = require('./partials/minifyFor')
19
- var readmeTemplate = require('./partials/readmeTemplate')
20
- var runOnChange = require('./partials/runOnChange')
21
- var tsFor = require('./partials/tsFor')
22
- module.exports = {
23
- addToReadme: addToReadme,
24
- beginWatcher: beginWatcher,
25
- clean: clean,
26
- distFor: distFor,
27
- distForSrc: distForSrc,
28
- distSeries: distSeries,
29
- minifyFor: minifyFor,
30
- readmeTemplate: readmeTemplate,
31
- runOnChange: runOnChange,
32
- tsFor: tsFor
33
- }
10
+ */
11
+
12
+ var addToReadme = require('./partials/addToReadme')
13
+ var beginWatcher = require('./partials/beginWatcher')
14
+ var clean = require('./partials/clean')
15
+ var distFor = require('./partials/distFor')
16
+ var distForSrc = require('./partials/distForSrc')
17
+ var distSeries = require('./partials/distSeries')
18
+ var minifyFor = require('./partials/minifyFor')
19
+ var readmeTemplate = require('./partials/readmeTemplate')
20
+ var runOnChange = require('./partials/runOnChange')
21
+ var tsFor = require('./partials/tsFor')
22
+ module.exports = {
23
+ addToReadme: addToReadme,
24
+ beginWatcher: beginWatcher,
25
+ clean: clean,
26
+ distFor: distFor,
27
+ distForSrc: distForSrc,
28
+ distSeries: distSeries,
29
+ minifyFor: minifyFor,
30
+ readmeTemplate: readmeTemplate,
31
+ runOnChange: runOnChange,
32
+ tsFor: tsFor
33
+ }
@@ -1,50 +1,50 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Multilayered node tree-like structure with parent references
5
5
  * @memberOf module:testHelpers
6
6
  * @type {Object.<string, string|Object|Array>}
7
- */
8
- var circularObject = {
9
- name: 'root',
10
- parent: {},
11
- body: {},
12
- head: {},
13
- children: []
14
- };
15
- circularObject.children = [{
16
- name: 'body',
17
- parent: {},
18
- children: []
19
- }, {
20
- name: 'head',
21
- parent: {},
22
- children: []
23
- }];
24
- circularObject.body = circularObject.children[0];
25
- circularObject.head = circularObject.children[1];
26
- circularObject.body.parent = circularObject;
27
- circularObject.head.parent = circularObject;
28
- circularObject.body.children = [{
29
- name: 'body child one',
30
- parent: {},
31
- children: []
32
- }, {
33
- name: 'body child two',
34
- parent: {},
35
- children: []
36
- }];
37
- circularObject.body.children[0].parent = circularObject.body;
38
- circularObject.body.children[1].parent = circularObject.body;
39
- circularObject.head.children = [{
40
- name: 'head child one',
41
- parent: {},
42
- children: []
43
- }, {
44
- name: 'head child two',
45
- parent: {},
46
- children: []
47
- }];
48
- circularObject.head.children[0].parent = circularObject.head;
49
- circularObject.head.children[1].parent = circularObject.head;
7
+ */
8
+ var circularObject = {
9
+ name: 'root',
10
+ parent: {},
11
+ body: {},
12
+ head: {},
13
+ children: []
14
+ };
15
+ circularObject.children = [{
16
+ name: 'body',
17
+ parent: {},
18
+ children: []
19
+ }, {
20
+ name: 'head',
21
+ parent: {},
22
+ children: []
23
+ }];
24
+ circularObject.body = circularObject.children[0];
25
+ circularObject.head = circularObject.children[1];
26
+ circularObject.body.parent = circularObject;
27
+ circularObject.head.parent = circularObject;
28
+ circularObject.body.children = [{
29
+ name: 'body child one',
30
+ parent: {},
31
+ children: []
32
+ }, {
33
+ name: 'body child two',
34
+ parent: {},
35
+ children: []
36
+ }];
37
+ circularObject.body.children[0].parent = circularObject.body;
38
+ circularObject.body.children[1].parent = circularObject.body;
39
+ circularObject.head.children = [{
40
+ name: 'head child one',
41
+ parent: {},
42
+ children: []
43
+ }, {
44
+ name: 'head child two',
45
+ parent: {},
46
+ children: []
47
+ }];
48
+ circularObject.head.children[0].parent = circularObject.head;
49
+ circularObject.head.children[1].parent = circularObject.head;
50
50
  module.exports = circularObject;
@@ -1,7 +1,7 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.regexp.exec.js");
4
- require("core-js/modules/es.string.split.js");
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.regexp.exec.js");
4
+ require("core-js/modules/es.string.split.js");
5
5
  /**
6
6
  * Simple way to count string occurrences for testing.
7
7
  * @function
@@ -9,8 +9,8 @@ require("core-js/modules/es.string.split.js");
9
9
  * @param {string} content
10
10
  * @param {string} search
11
11
  * @returns {number}
12
- */
13
- var countMatches = function countMatches(content, search) {
14
- return content.split(search).length - 1;
15
- };
12
+ */
13
+ var countMatches = function countMatches(content, search) {
14
+ return content.split(search).length - 1;
15
+ };
16
16
  module.exports = countMatches;
@@ -1,20 +1,20 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Sample object with deep references.
5
5
  * @memberOf module:testHelpers
6
6
  * @type {Object.<string, string|number|Object>}
7
- */
8
- var deepReferenceObject = {
9
- object1: {
10
- name: 'someName',
11
- object2: {
12
- age: 12,
13
- array1: ['someString', 'anotherString']
14
- },
15
- array2: [89, 32]
16
- },
17
- title: 'Some Title',
18
- item: 45
19
- };
7
+ */
8
+ var deepReferenceObject = {
9
+ object1: {
10
+ name: 'someName',
11
+ object2: {
12
+ age: 12,
13
+ array1: ['someString', 'anotherString']
14
+ },
15
+ array2: [89, 32]
16
+ },
17
+ title: 'Some Title',
18
+ item: 45
19
+ };
20
20
  module.exports = deepReferenceObject;
@@ -1,33 +1,33 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Sample of domItem child with nested child and optional details
5
5
  * @memberOf module:testHelpers
6
6
  * @type {Object.<string, string|number|Array|Object>}
7
- */
8
- var domItem = [{
9
- attributes: {
10
- className: 'row',
11
- style: {}
12
- },
13
- axis: 'y',
14
- children: [{
15
- attributes: {
16
- style: {}
17
- },
18
- axis: 'x',
19
- children: [],
20
- element: {},
21
- eventListeners: {},
22
- hasShip: false,
23
- isHit: false,
24
- parentItem: {},
25
- point: {},
26
- tagName: 'div'
27
- }],
28
- element: null,
29
- eventListeners: {},
30
- parentItem: {},
31
- tagName: 'div'
32
- }];
7
+ */
8
+ var domItem = [{
9
+ attributes: {
10
+ className: 'row',
11
+ style: {}
12
+ },
13
+ axis: 'y',
14
+ children: [{
15
+ attributes: {
16
+ style: {}
17
+ },
18
+ axis: 'x',
19
+ children: [],
20
+ element: {},
21
+ eventListeners: {},
22
+ hasShip: false,
23
+ isHit: false,
24
+ parentItem: {},
25
+ point: {},
26
+ tagName: 'div'
27
+ }],
28
+ element: null,
29
+ eventListeners: {},
30
+ parentItem: {},
31
+ tagName: 'div'
32
+ }];
33
33
  module.exports = domItem;
@@ -1,20 +1,20 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Sample of jsonDom object containing empty nested array and objects
5
5
  * @memberOf module:testHelpers
6
6
  * @type {Object.<string, string|number|Array|Object>}
7
- */
8
- var jsonDom = {
9
- tagName: 'div',
10
- attributes: {
11
- style: {},
12
- className: 'column'
13
- },
14
- element: null,
15
- eventListeners: {},
16
- parentItem: {},
17
- children: [],
18
- axis: 'x'
19
- };
7
+ */
8
+ var jsonDom = {
9
+ tagName: 'div',
10
+ attributes: {
11
+ style: {},
12
+ className: 'column'
13
+ },
14
+ element: null,
15
+ eventListeners: {},
16
+ parentItem: {},
17
+ children: [],
18
+ axis: 'x'
19
+ };
20
20
  module.exports = jsonDom;
@@ -1,23 +1,23 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Sample LinkedList for testing circular references.
5
5
  * @memberOf module:testHelpers
6
6
  * @type {Object.<string, string|Object>}
7
- */
8
- var linkedList = {
9
- name: 'one',
10
- prev: null,
11
- next: null
12
- };
13
- linkedList.next = {
14
- name: 'two',
15
- prev: linkedList,
16
- next: null
17
- };
18
- linkedList.next.next = {
19
- name: 'three',
20
- prev: linkedList.next,
21
- next: null
22
- };
7
+ */
8
+ var linkedList = {
9
+ name: 'one',
10
+ prev: null,
11
+ next: null
12
+ };
13
+ linkedList.next = {
14
+ name: 'two',
15
+ prev: linkedList,
16
+ next: null
17
+ };
18
+ linkedList.next.next = {
19
+ name: 'three',
20
+ prev: linkedList.next,
21
+ next: null
22
+ };
23
23
  module.exports = linkedList;
@@ -1,6 +1,6 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.json.stringify.js");
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.json.stringify.js");
4
4
  /**
5
5
  * Log out an object in a nicely formatted way.
6
6
  * @function
@@ -9,16 +9,16 @@ require("core-js/modules/es.json.stringify.js");
9
9
  * @param {string} [label=logging]
10
10
  * @param {string} [outputType=log]
11
11
  * @returns {string|undefined}
12
- */
13
- var logObject = function logObject(object) {
14
- var label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'logging';
15
- var outputType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'log';
16
- var logger = outputType === 'string' ? function (label, object) {
17
- return "'".concat(label, "' | ") + JSON.stringify(object);
18
- } : console[outputType];
19
- if (typeof require === 'undefined' || outputType === 'string') {
20
- return logger(label, object);
21
- }
22
- return logger(label, require('util').inspect(object, false, null, true));
23
- };
12
+ */
13
+ var logObject = function logObject(object) {
14
+ var label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'logging';
15
+ var outputType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'log';
16
+ var logger = outputType === 'string' ? function (label, object) {
17
+ return "'".concat(label, "' | ") + JSON.stringify(object);
18
+ } : console[outputType];
19
+ if (typeof require === 'undefined' || outputType === 'string') {
20
+ return logger(label, object);
21
+ }
22
+ return logger(label, require('util').inspect(object, false, null, true));
23
+ };
24
24
  module.exports = logObject;
@@ -1,20 +1,20 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Sample of object containing multiple references.
5
5
  * @memberOf module:testHelpers
6
6
  * @type {Object.<string, string|number|Object>}
7
- */
8
- var multiReferenceObject = {
9
- object1: {
10
- name: 'someName'
11
- },
12
- object2: {
13
- age: 12
14
- },
15
- array1: ['someString', 'anotherString'],
16
- array2: [89, 32],
17
- title: 'Some Title',
18
- item: 45
19
- };
7
+ */
8
+ var multiReferenceObject = {
9
+ object1: {
10
+ name: 'someName'
11
+ },
12
+ object2: {
13
+ age: 12
14
+ },
15
+ array1: ['someString', 'anotherString'],
16
+ array2: [89, 32],
17
+ title: 'Some Title',
18
+ item: 45
19
+ };
20
20
  module.exports = multiReferenceObject;
@@ -1,28 +1,28 @@
1
- "use strict";
2
-
1
+ "use strict";
2
+
3
3
  /**
4
4
  * Sample NodeTree for testing circular references and arrays.
5
5
  * @memberOf module:testHelpers
6
6
  * @type {Object.<string, string|Object|Array>}
7
- */
8
- var nodeTree = {
9
- name: 'one',
10
- parent: null,
11
- children: []
12
- };
13
- nodeTree.children[0] = {
14
- name: 'child one',
15
- parent: nodeTree,
16
- children: []
17
- };
18
- nodeTree.children[1] = {
19
- name: 'child two',
20
- parent: nodeTree,
21
- children: []
22
- };
23
- nodeTree.children[0].children[0] = {
24
- name: 'grandchild one',
25
- parent: nodeTree.children[0],
26
- children: []
27
- };
7
+ */
8
+ var nodeTree = {
9
+ name: 'one',
10
+ parent: null,
11
+ children: []
12
+ };
13
+ nodeTree.children[0] = {
14
+ name: 'child one',
15
+ parent: nodeTree,
16
+ children: []
17
+ };
18
+ nodeTree.children[1] = {
19
+ name: 'child two',
20
+ parent: nodeTree,
21
+ children: []
22
+ };
23
+ nodeTree.children[0].children[0] = {
24
+ name: 'grandchild one',
25
+ parent: nodeTree.children[0],
26
+ children: []
27
+ };
28
28
  module.exports = nodeTree;