js-build-tools 2.4.0 → 3.0.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 (204) hide show
  1. package/README.md +334 -205
  2. package/dist/build.js +59 -48
  3. package/dist/build.min.js +1 -1
  4. package/dist/bundle.js +12 -13
  5. package/dist/bundle.min.js +1 -1
  6. package/dist/bundleLint.js +17 -18
  7. package/dist/bundleLint.min.js +1 -1
  8. package/dist/bundleMinify.js +8 -9
  9. package/dist/bundleMinify.min.js +1 -1
  10. package/dist/copyFonts.js +12 -0
  11. package/dist/copyFonts.min.js +1 -0
  12. package/dist/default.js +1 -1
  13. package/dist/default.min.js +1 -1
  14. package/dist/dist.js +7 -8
  15. package/dist/distLint.js +17 -18
  16. package/dist/distLint.min.js +1 -1
  17. package/dist/distMinify.js +8 -9
  18. package/dist/distMinify.min.js +1 -1
  19. package/dist/images.js +11 -0
  20. package/dist/images.min.js +1 -0
  21. package/dist/partials/addToReadme.js +13 -14
  22. package/dist/partials/beginWatcher.js +9 -10
  23. package/dist/partials/clean.js +10 -11
  24. package/dist/partials/copyFor.js +16 -0
  25. package/dist/partials/distFor.js +16 -17
  26. package/dist/partials/distForSrc.js +9 -10
  27. package/dist/partials/distSeries.js +19 -20
  28. package/dist/partials/imagesFor.js +34 -0
  29. package/dist/partials/minifyFor.js +15 -16
  30. package/dist/partials/readmeTemplate.js +11 -12
  31. package/dist/partials/removeDirectory.js +11 -12
  32. package/dist/partials/runOnChange.js +27 -27
  33. package/dist/partials/sassFor.js +20 -21
  34. package/dist/partials/tsFor.js +20 -21
  35. package/dist/partials.js +35 -31
  36. package/dist/partials.min.js +1 -1
  37. package/dist/test-helpers/setUp.js +52 -60
  38. package/dist/testFull.js +17 -18
  39. package/dist/testFull.min.js +1 -1
  40. package/dist/testHelpers.js +10 -28
  41. package/dist/testHelpers.min.js +1 -1
  42. package/dist/testQuick.js +19 -20
  43. package/dist/testQuick.min.js +1 -1
  44. package/dist/typeScript.js +7 -8
  45. package/dist/utilities/dotGet.js +50 -0
  46. package/dist/utilities/dotNotate.js +77 -0
  47. package/dist/utilities/dotSet.js +44 -0
  48. package/dist/utilities/isObject.js +10 -0
  49. package/dist/utilities/strAfter.js +14 -0
  50. package/dist/utilities/strBefore.js +14 -0
  51. package/dist/watchFull.js +10 -11
  52. package/dist/watchTest.js +13 -14
  53. package/dist/watchTest.min.js +1 -1
  54. package/functions/build.js +15 -5
  55. package/functions/build.test.js +278 -42
  56. package/functions/bundle.js +3 -4
  57. package/functions/bundle.test.js +6 -6
  58. package/functions/bundleLint.js +2 -3
  59. package/functions/bundleLint.test.js +5 -5
  60. package/functions/bundleMinify.js +1 -2
  61. package/functions/bundleMinify.test.js +1 -1
  62. package/functions/copyFonts.js +11 -0
  63. package/functions/copyFonts.test.js +31 -0
  64. package/functions/default.js +1 -1
  65. package/functions/default.test.js +2 -2
  66. package/functions/dist.js +0 -1
  67. package/functions/dist.test.js +1 -1
  68. package/functions/distLint.js +2 -3
  69. package/functions/distLint.test.js +3 -3
  70. package/functions/distMinify.js +1 -2
  71. package/functions/distMinify.test.js +1 -1
  72. package/functions/images.js +10 -0
  73. package/functions/images.test.js +138 -0
  74. package/functions/partials/addToReadme.js +2 -3
  75. package/functions/partials/addToReadme.test.js +2 -2
  76. package/functions/partials/beginWatcher.js +1 -2
  77. package/functions/partials/beginWatcher.test.js +1 -1
  78. package/functions/partials/clean.js +0 -1
  79. package/functions/partials/copyFor.js +13 -0
  80. package/functions/partials/copyFor.test.js +34 -0
  81. package/functions/partials/distFor.js +1 -2
  82. package/functions/partials/distFor.test.js +4 -4
  83. package/functions/partials/distForSrc.js +3 -4
  84. package/functions/partials/distForSrc.test.js +6 -6
  85. package/functions/partials/distSeries.js +2 -3
  86. package/functions/partials/distSeries.test.js +5 -5
  87. package/functions/partials/imagesFor.js +33 -0
  88. package/functions/partials/imagesFor.test.js +143 -0
  89. package/functions/partials/minifyFor.js +0 -1
  90. package/functions/partials/minifyFor.test.js +1 -1
  91. package/functions/partials/readmeTemplate.js +3 -4
  92. package/functions/partials/readmeTemplate.test.js +2 -2
  93. package/functions/partials/removeDirectory.js +0 -1
  94. package/functions/partials/runOnChange.js +5 -6
  95. package/functions/partials/runOnChange.test.js +9 -9
  96. package/functions/partials/sassFor.js +1 -2
  97. package/functions/partials/sassFor.test.js +3 -3
  98. package/functions/partials/tsFor.js +3 -4
  99. package/functions/partials/tsFor.test.js +2 -2
  100. package/functions/partials.js +5 -1
  101. package/functions/partials.test.js +1 -1
  102. package/functions/sass.test.js +2 -2
  103. package/functions/test-helpers/setUp.js +24 -32
  104. package/functions/testFull.js +2 -3
  105. package/functions/testFull.test.js +1 -1
  106. package/functions/testHelpers.js +3 -20
  107. package/functions/testHelpers.test.js +1 -1
  108. package/functions/testQuick.js +1 -2
  109. package/functions/testQuick.test.js +1 -1
  110. package/functions/typeScript.js +0 -1
  111. package/functions/typeScript.test.js +0 -2
  112. package/functions/utilities/dotGet.js +47 -0
  113. package/functions/utilities/dotNotate.js +68 -0
  114. package/functions/utilities/dotSet.js +41 -0
  115. package/functions/utilities/isObject.js +9 -0
  116. package/functions/utilities/strAfter.js +13 -0
  117. package/functions/utilities/strBefore.js +13 -0
  118. package/functions/watchFull.js +0 -1
  119. package/functions/watchFull.test.js +1 -1
  120. package/functions/watchTest.js +1 -2
  121. package/functions/watchTest.test.js +1 -1
  122. package/gulp.config.js +153 -79
  123. package/gulpfile.base.js +5 -1
  124. package/jsdoc.base.js +1 -1
  125. package/package.json +13 -9
  126. package/vendor/array-union/index.js +31 -0
  127. package/vendor/easy-transform-stream/index.js +54 -0
  128. package/vendor/globby/gitignore.js +96 -0
  129. package/vendor/globby/index.js +191 -0
  130. package/vendor/globby/node_modules/slash/index.js +16 -0
  131. package/vendor/globby/stream-utils.js +58 -0
  132. package/vendor/globby/to-path.js +20 -0
  133. package/vendor/gulp-imagemin/index.js +128 -0
  134. package/vendor/gulp-imagemin/node_modules/chalk/source/index.js +265 -0
  135. package/vendor/gulp-imagemin/node_modules/chalk/source/utilities.js +36 -0
  136. package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/ansi-styles/index.js +217 -0
  137. package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/supports-color/index.js +154 -0
  138. package/vendor/gulp-plugin-extras/index.js +42 -0
  139. package/vendor/gulp-plugin-extras/node_modules/chalk/source/index.js +265 -0
  140. package/vendor/gulp-plugin-extras/node_modules/chalk/source/utilities.js +36 -0
  141. package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/ansi-styles/index.js +217 -0
  142. package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/supports-color/index.js +154 -0
  143. package/vendor/gulp-plugin-extras/plugin-error.js +145 -0
  144. package/vendor/ignore/index.js +468 -0
  145. package/vendor/imagemin/index.js +90 -0
  146. package/vendor/imagemin-gifsicle/index.js +33 -0
  147. package/vendor/imagemin-mozjpeg/index.js +100 -0
  148. package/vendor/imagemin-mozjpeg/node_modules/execa/index.js +260 -0
  149. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/command.js +47 -0
  150. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/error.js +102 -0
  151. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/kill.js +123 -0
  152. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/promise.js +47 -0
  153. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stdio.js +50 -0
  154. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stream.js +124 -0
  155. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/core.js +238 -0
  156. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/main.js +89 -0
  157. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/realtime.js +24 -0
  158. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/signals.js +44 -0
  159. package/vendor/imagemin-mozjpeg/node_modules/is-stream/index.js +25 -0
  160. package/vendor/imagemin-mozjpeg/node_modules/mimic-fn/index.js +70 -0
  161. package/vendor/imagemin-mozjpeg/node_modules/npm-run-path/index.js +52 -0
  162. package/vendor/imagemin-mozjpeg/node_modules/onetime/index.js +43 -0
  163. package/vendor/imagemin-mozjpeg/node_modules/path-key/index.js +20 -0
  164. package/vendor/imagemin-mozjpeg/node_modules/strip-final-newline/index.js +17 -0
  165. package/vendor/imagemin-optipng/index.js +44 -0
  166. package/vendor/imagemin-svgo/index.js +27 -0
  167. package/vendor/is-jpg/index.js +12 -0
  168. package/vendor/junk/index.js +49 -0
  169. package/vendor/mozjpeg/index.js +9 -0
  170. package/vendor/mozjpeg/lib/index.js +18 -0
  171. package/vendor/mozjpeg/package.json +49 -0
  172. package/vendor/mozjpeg/vendor/cjpeg +0 -0
  173. package/vendor/mozjpeg/vendor/source/mozjpeg.tar.gz +0 -0
  174. package/vendor/p-pipe/index.js +22 -0
  175. package/vendor/plur/index.js +32 -0
  176. package/vendor/pretty-bytes/index.js +71 -0
  177. package/vendor/slash/index.js +12 -0
  178. package/dist/test-helpers/circularObject.js +0 -50
  179. package/dist/test-helpers/countMatches.js +0 -12
  180. package/dist/test-helpers/deepReferenceObject.js +0 -20
  181. package/dist/test-helpers/domItem.js +0 -33
  182. package/dist/test-helpers/jsonDom.js +0 -20
  183. package/dist/test-helpers/linkedList.js +0 -23
  184. package/dist/test-helpers/logObject.js +0 -21
  185. package/dist/test-helpers/multiReferenceObject.js +0 -20
  186. package/dist/test-helpers/nodeTree.js +0 -28
  187. package/functions/test-helpers/circularObject.js +0 -28
  188. package/functions/test-helpers/circularObject.test.js +0 -14
  189. package/functions/test-helpers/countMatches.js +0 -11
  190. package/functions/test-helpers/countMatches.test.js +0 -9
  191. package/functions/test-helpers/deepReferenceObject.js +0 -25
  192. package/functions/test-helpers/deepReferenceObject.test.js +0 -7
  193. package/functions/test-helpers/domItem.js +0 -31
  194. package/functions/test-helpers/domItem.test.js +0 -12
  195. package/functions/test-helpers/jsonDom.js +0 -16
  196. package/functions/test-helpers/jsonDom.test.js +0 -12
  197. package/functions/test-helpers/linkedList.js +0 -10
  198. package/functions/test-helpers/linkedList.test.js +0 -22
  199. package/functions/test-helpers/logObject.js +0 -18
  200. package/functions/test-helpers/logObject.test.js +0 -20
  201. package/functions/test-helpers/multiReferenceObject.js +0 -25
  202. package/functions/test-helpers/multiReferenceObject.test.js +0 -14
  203. package/functions/test-helpers/nodeTree.js +0 -11
  204. package/functions/test-helpers/nodeTree.test.js +0 -18
@@ -1,21 +1,20 @@
1
- "use strict";
2
-
3
- const {
4
- dest,
5
- src
6
- } = require('gulp');
7
- const {
8
- default: uglify
9
- } = require('gulp-uglify-es');
10
- const rename = require('gulp-rename');
11
-
1
+ "use strict";
2
+
3
+ const {
4
+ dest,
5
+ src
6
+ } = require('gulp');
7
+ const {
8
+ default: uglify
9
+ } = require('gulp-uglify-es');
10
+ const rename = require('gulp-rename');
11
+
12
12
  /**
13
13
  * Minify files and rename the output with '.min' extension.
14
- * @function
15
14
  * @memberOf module:partials
16
15
  * @returns {*}
17
- */
18
- const minifyFor = (srcSearch, destination) => src(srcSearch).pipe(uglify()).pipe(rename({
19
- extname: '.min.js'
20
- })).pipe(dest(destination));
16
+ */
17
+ const minifyFor = (srcSearch, destination) => src(srcSearch).pipe(uglify()).pipe(rename({
18
+ extname: '.min.js'
19
+ })).pipe(dest(destination));
21
20
  module.exports = minifyFor;
@@ -1,17 +1,16 @@
1
- "use strict";
2
-
3
- const {
4
- dest,
5
- src
6
- } = require('gulp');
7
- const gulpConfig = require('../../gulp.config.js');
8
- const rename = require('gulp-rename');
9
-
1
+ "use strict";
2
+
3
+ const {
4
+ dest,
5
+ src
6
+ } = require('gulp');
7
+ const gulpConfig = require('../../gulp.config.js');
8
+ const rename = require('gulp-rename');
9
+
10
10
  /**
11
11
  * Copy a readme template into the README.md file.
12
- * @function
13
12
  * @memberOf module:partials
14
13
  * @returns {*}
15
- */
16
- const readmeTemplate = () => src(gulpConfig.get('readmeTemplate')).pipe(rename(gulpConfig.get('readmeFile'))).pipe(dest(gulpConfig.get('readmePath')));
14
+ */
15
+ const readmeTemplate = () => src(gulpConfig.get('readme.template')).pipe(rename(gulpConfig.get('readme.file'))).pipe(dest(gulpConfig.get('readme.to')));
17
16
  module.exports = readmeTemplate;
@@ -1,18 +1,17 @@
1
- "use strict";
2
-
3
- const {
4
- rm,
5
- exists
6
- } = require('fs');
7
-
1
+ "use strict";
2
+
3
+ const {
4
+ rm,
5
+ exists
6
+ } = require('fs');
7
+
8
8
  /**
9
9
  * Return a promise to be completed once the specified directory is deleted.
10
- * @function
11
10
  * @memberOf module:partials
12
11
  * @param {string} dirPath
13
12
  * @returns {Promise<*>}
14
- */
15
- const removeDirectory = dirPath => new Promise((resolve, reject) => exists(dirPath, doesExist => doesExist ? rm(dirPath, {
16
- recursive: true
17
- }, error => error ? reject(error) : resolve(dirPath)) : resolve(dirPath)));
13
+ */
14
+ const removeDirectory = dirPath => new Promise((resolve, reject) => exists(dirPath, doesExist => doesExist ? rm(dirPath, {
15
+ recursive: true
16
+ }, error => error ? reject(error) : resolve(dirPath)) : resolve(dirPath)));
18
17
  module.exports = removeDirectory;
@@ -1,14 +1,15 @@
1
- "use strict";
2
-
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');
11
-
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.string.replace.js");
4
+ const gulpConfig = require('../../gulp.config.js');
5
+ const bundle = require('../bundle');
6
+ const distSeries = require('./distSeries');
7
+ const {
8
+ parallel,
9
+ series
10
+ } = require('gulp');
11
+ const testQuick = require('../testQuick');
12
+
12
13
  /**
13
14
  * Run this function when the watched files are modified.
14
15
  * 1. Find the sub-folders within src path
@@ -30,15 +31,14 @@ const testQuick = require('../testQuick');
30
31
  *
31
32
  * // The resulting replaced path for the destination folder
32
33
  * distPathResult = 'dist/some/path/'
33
- * @function
34
34
  * @memberOf module:partials
35
35
  * @param {string} path
36
36
  * @returns {stream.Stream}
37
- */
38
- const runOnChange = path => {
39
- const useTs = gulpConfig.get('useTsConfig');
40
- const distPath = gulpConfig.get('distPath');
41
- const srcPath = gulpConfig.get('srcPath');
37
+ */
38
+ const runOnChange = path => {
39
+ const useTs = gulpConfig.get('typescript.enabled');
40
+ const distPath = gulpConfig.get('dist.to');
41
+ const srcPath = gulpConfig.get('srcPath');
42
42
  /**
43
43
  * 1. The original path comes in from src and is a .ts
44
44
  * 2. Discover the outgoing dist path where that file should go
@@ -46,14 +46,14 @@ const runOnChange = path => {
46
46
  * 4. Take the original path, convert to full file path in dist
47
47
  * 5. Use the dist path found previously in #2
48
48
  * 6. Use the full dist path and the dist outgoing path in distFor
49
- */
50
- const pathRegex = new RegExp(`^${srcPath}(.*\\/)(.+)\\.(js|ts)$`, 'i');
51
- const distPathResult = path.replace(pathRegex, `${distPath}$1`);
52
- let distSrcPath = path;
53
- if (useTs) {
54
- distSrcPath = path.replace(pathRegex, `${distPath}$1$2.js`);
55
- }
56
- const runSeries = distSeries(distSrcPath, distPathResult, path);
57
- return gulpConfig.get('nodeOnly') ? series(testQuick, runSeries)() : parallel(testQuick, series(runSeries, bundle))();
58
- };
49
+ */
50
+ const pathRegex = new RegExp("^".concat(srcPath, "(.*\\/)(.+)\\.(js|ts)$"), 'i');
51
+ const distPathResult = path.replace(pathRegex, "".concat(distPath, "$1"));
52
+ let distSrcPath = path;
53
+ if (useTs) {
54
+ distSrcPath = path.replace(pathRegex, "".concat(distPath, "$1$2.js"));
55
+ }
56
+ const runSeries = distSeries(distSrcPath, distPathResult, path);
57
+ return gulpConfig.get('browser.enabled') ? parallel(testQuick, series(runSeries, bundle))() : series(testQuick, runSeries)();
58
+ };
59
59
  module.exports = runOnChange;
@@ -1,28 +1,27 @@
1
- "use strict";
2
-
3
- const {
4
- dest,
5
- src
6
- } = require('gulp');
7
- const gulpConfig = require('../../gulp.config.js');
8
- const cssnano = require('gulp-cssnano');
9
- const rename = require('gulp-rename');
10
- const sass = require('gulp-sass')(require('sass'));
11
-
1
+ "use strict";
2
+
3
+ const {
4
+ dest,
5
+ src
6
+ } = require('gulp');
7
+ const gulpConfig = require('../../gulp.config.js');
8
+ const cssnano = require('gulp-cssnano');
9
+ const rename = require('gulp-rename');
10
+ const sass = require('gulp-sass')(require('sass'));
11
+
12
12
  /**
13
13
  * Build the CSS for a given source pattern.
14
- * @function
15
14
  * @memberOf module:partials
16
15
  * @param {string|array} [srcSearch='src/config/path/sass/for']
17
16
  * @param {string} [cssPath='css/config/path']
18
17
  * @returns {stream.Stream}
19
- */
20
- const sassFor = function () {
21
- let srcSearch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gulpConfig.get('sassSearch');
22
- let cssPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gulpConfig.get('cssPath');
23
- return src(srcSearch).pipe(sass().on('error', sass.logError)) // Passes it through a gulp-sass, log errors to console
24
- .pipe(dest(cssPath)).pipe(cssnano()).pipe(rename({
25
- extname: '.min.css'
26
- })).pipe(dest(cssPath));
27
- };
18
+ */
19
+ const sassFor = function () {
20
+ let srcSearch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gulpConfig.get('sass.from');
21
+ let cssPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gulpConfig.get('sass.to');
22
+ return src(srcSearch).pipe(sass().on('error', sass.logError)) // Passes it through a gulp-sass, log errors to console
23
+ .pipe(dest(cssPath)).pipe(cssnano()).pipe(rename({
24
+ extname: '.min.css'
25
+ })).pipe(dest(cssPath));
26
+ };
28
27
  module.exports = sassFor;
@@ -1,29 +1,28 @@
1
- "use strict";
2
-
3
- const {
4
- dest,
5
- parallel,
6
- src
7
- } = require('gulp');
8
- const gulpConfig = require('../../gulp.config.js');
9
- const ts = require('gulp-typescript');
10
-
1
+ "use strict";
2
+
3
+ const {
4
+ dest,
5
+ parallel,
6
+ src
7
+ } = require('gulp');
8
+ const gulpConfig = require('../../gulp.config.js');
9
+ const ts = require('gulp-typescript');
10
+
11
11
  /**
12
12
  * Starting at the source directory, find all the ts files and convert them into the distribution directory.
13
- * @function
14
13
  * @memberOf module:partials
15
14
  * @param {string|array} [srcPath='']
16
15
  * @param {string} [distPath='']
17
16
  * @returns {Function}
18
17
  * @see `https://www.typescriptlang.org/docs/handbook/gulp.html` for more info
19
- */
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));
27
- return parallel(makeDeclarations, compileJS);
28
- };
18
+ */
19
+ const tsFor = function () {
20
+ let srcPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gulpConfig.get('typescript.from');
21
+ let distPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gulpConfig.get('typescript.to');
22
+ const declarationProject = ts.createProject(gulpConfig.get('typescript.config'));
23
+ const tsProject = ts.createProject(gulpConfig.get('typescript.config'));
24
+ const makeDeclarations = () => src(srcPath).pipe(declarationProject()).dts.pipe(dest(distPath));
25
+ const compileJS = () => src(srcPath).pipe(tsProject()).js.pipe(dest(distPath));
26
+ return parallel(makeDeclarations, compileJS);
27
+ };
29
28
  module.exports = tsFor;
package/dist/partials.js CHANGED
@@ -1,37 +1,41 @@
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
6
6
  * @author Joshua Heagle <joshuaheagle@gmail.com>
7
- * @version 2.0.0
7
+ * @version 3.0.0
8
8
  * @module partials
9
9
  * @memberOf module:js-build-tools
10
- */
11
-
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 sassFor = require('./partials/sassFor')
23
- const tsFor = require('./partials/tsFor')
24
- module.exports = {
25
- addToReadme,
26
- beginWatcher,
27
- clean,
28
- distFor,
29
- distForSrc,
30
- distSeries,
31
- minifyFor,
32
- readmeTemplate,
33
- removeDirectory,
34
- runOnChange,
35
- sassFor,
36
- tsFor
37
- }
10
+ */
11
+
12
+ const addToReadme = require('./partials/addToReadme')
13
+ const beginWatcher = require('./partials/beginWatcher')
14
+ const clean = require('./partials/clean')
15
+ const copyFor = require('./partials/copyFor')
16
+ const distFor = require('./partials/distFor')
17
+ const distForSrc = require('./partials/distForSrc')
18
+ const distSeries = require('./partials/distSeries')
19
+ const imagesFor = require('./partials/imagesFor.js')
20
+ const minifyFor = require('./partials/minifyFor')
21
+ const readmeTemplate = require('./partials/readmeTemplate')
22
+ const removeDirectory = require('./partials/removeDirectory')
23
+ const runOnChange = require('./partials/runOnChange')
24
+ const sassFor = require('./partials/sassFor')
25
+ const tsFor = require('./partials/tsFor')
26
+ module.exports = {
27
+ addToReadme,
28
+ beginWatcher,
29
+ clean,
30
+ copyFor,
31
+ distFor,
32
+ distForSrc,
33
+ distSeries,
34
+ imagesFor,
35
+ minifyFor,
36
+ readmeTemplate,
37
+ removeDirectory,
38
+ runOnChange,
39
+ sassFor,
40
+ tsFor
41
+ }
@@ -1 +1 @@
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"),sassFor=require("./partials/sassFor"),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,sassFor:sassFor,tsFor:tsFor};
1
+ "use strict";const addToReadme=require("./partials/addToReadme"),beginWatcher=require("./partials/beginWatcher"),clean=require("./partials/clean"),copyFor=require("./partials/copyFor"),distFor=require("./partials/distFor"),distForSrc=require("./partials/distForSrc"),distSeries=require("./partials/distSeries"),imagesFor=require("./partials/imagesFor.js"),minifyFor=require("./partials/minifyFor"),readmeTemplate=require("./partials/readmeTemplate"),removeDirectory=require("./partials/removeDirectory"),runOnChange=require("./partials/runOnChange"),sassFor=require("./partials/sassFor"),tsFor=require("./partials/tsFor");module.exports={addToReadme:addToReadme,beginWatcher:beginWatcher,clean:clean,copyFor:copyFor,distFor:distFor,distForSrc:distForSrc,distSeries:distSeries,imagesFor:imagesFor,minifyFor:minifyFor,readmeTemplate:readmeTemplate,removeDirectory:removeDirectory,runOnChange:runOnChange,sassFor:sassFor,tsFor:tsFor};
@@ -1,77 +1,69 @@
1
- "use strict";
2
-
3
- const fs = require('fs');
4
- // Import the configurations and override some of them in order to direct to the temp directory.
5
- const gulpConfig = require('../../gulp.config.js');
6
- const {
7
- removeDirectory
8
- } = require('../partials');
9
- let tempDir = 'test-temp/';
10
- let srcPath = `${tempDir}src`;
11
-
1
+ "use strict";
2
+
3
+ // Import the configurations and override some of them to direct to the temp directory.
4
+ const gulpConfig = require('../../gulp.config.js');
5
+ const {
6
+ setUp
7
+ } = require('test-filesystem');
8
+ let tempDir = 'test-temp/';
9
+ let srcPath = "".concat(tempDir, "src");
10
+
12
11
  /**
13
12
  * Update the gulp configurations with the test data. Set the test directory where temp files will be created for testing.
14
- * @function
15
13
  * @memberOf module:testHelpers
16
14
  * @param {string} testDir
17
- */
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`;
24
- const sassPath = `${tempDir}sass`;
25
- gulpConfig.set('browserPath', browserPath);
26
- gulpConfig.set('cleanPaths', [distPath, browserPath]);
27
- gulpConfig.set('cssPath', `${browserPath}/css`);
28
- gulpConfig.set('distMain', `${distPath}/main`);
29
- gulpConfig.set('distPath', distPath);
30
- gulpConfig.set('distSearch', `${distPath}/**/*.js`);
31
- gulpConfig.set('readmeTemplate', `${tempDir}MAIN.md`);
32
- gulpConfig.set('readmePath', tempDir);
33
- gulpConfig.set('readmeSearch', `${srcPath}/**/!(*.test).js`);
34
- gulpConfig.set('rootPath', tempDir);
35
- gulpConfig.set('sassPath', sassPath);
36
- gulpConfig.set('sassSearch', `${sassPath}/**/*.+(scss|sass)`);
37
- gulpConfig.set('srcPath', srcPath);
38
- gulpConfig.set('srcSearch', `${srcPath}/**/!(*.test).js`);
39
- gulpConfig.set('tsSearch', `${srcPath}/**/*.ts`);
40
- gulpConfig.set('watchSearch', `${srcPath}/**/*.js`);
41
- };
42
- exports.setDefaults = setDefaults;
43
- exports.gulpConfig = gulpConfig;
44
-
15
+ */
16
+ const setDefaults = function () {
17
+ let testDir = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'test-temp';
18
+ tempDir = "".concat(testDir, "/");
19
+ srcPath = "".concat(tempDir, "src");
20
+ setUp.setDefaults(tempDir);
21
+ const distPath = "".concat(tempDir, "dist");
22
+ const browserPath = "".concat(tempDir, "browser");
23
+ const sassPath = "".concat(tempDir, "sass");
24
+ gulpConfig.set('browser.from', "".concat(distPath, "/**/*.js"));
25
+ gulpConfig.set('browser.to', browserPath);
26
+ gulpConfig.set('cleanPaths', [distPath, browserPath]);
27
+ gulpConfig.set('dist.from', "".concat(srcPath, "/**/!(*.test).js"));
28
+ gulpConfig.set('dist.main', "".concat(distPath, "/main"));
29
+ gulpConfig.set('dist.to', distPath);
30
+ gulpConfig.set('fonts.from', "".concat(srcPath, "/fonts/**/*"));
31
+ gulpConfig.set('fonts.to', "".concat(browserPath, "/fonts"));
32
+ gulpConfig.set('images.from', "".concat(srcPath, "/img/**/*.+(png|jpg|jpeg|gif|svg)"));
33
+ gulpConfig.set('images.to', "".concat(browserPath, "/img"));
34
+ gulpConfig.set('readme.template', "".concat(tempDir, "MAIN.md"));
35
+ gulpConfig.set('readme.to', tempDir);
36
+ gulpConfig.set('readme.from', "".concat(srcPath, "/**/!(*.test).js"));
37
+ gulpConfig.set('rootPath', tempDir);
38
+ gulpConfig.set('sass.from', "".concat(sassPath, "/**/*.+(scss|sass)"));
39
+ gulpConfig.set('sass.path', sassPath);
40
+ gulpConfig.set('sass.to', "".concat(browserPath, "/css"));
41
+ gulpConfig.set('srcPath', srcPath);
42
+ gulpConfig.set('typescript.from', "".concat(srcPath, "/**/*.ts"));
43
+ gulpConfig.set('typescript.to', distPath);
44
+ gulpConfig.set('test.watch', "".concat(srcPath, "/**/*.js"));
45
+ };
46
+ exports.setDefaults = setDefaults;
47
+ exports.gulpConfig = gulpConfig;
48
+
45
49
  /**
46
50
  * Ensure that the del has completed, recursively attempt to delete and recreate
47
- * @function
48
51
  * @memberOf module:testHelpers
49
52
  * @param {boolean} [exists=true]
50
53
  * @returns {Promise<*|void>}
51
- */
52
- const createTempDir = async function () {
53
- let exists = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
54
- if (exists) {
55
- return removeDirectory(tempDir).then(removedDir => createTempDir(fs.existsSync(removedDir))).catch(error => console.error('Error: ', error));
56
- }
57
- return fs.mkdirSync(srcPath, {
58
- recursive: true
59
- });
60
- };
61
- exports.createTempDir = createTempDir;
62
-
54
+ */
55
+ exports.createTempDir = setUp.createTempDir;
56
+
63
57
  /**
64
58
  * In the Jest.beforeEach function call this one to set up the temp directory.
65
- * @function
66
59
  * @memberOf module:testHelpers
67
60
  * @returns {Promise<*|void>}
68
- */
69
- exports.beforeEach = () => createTempDir();
70
-
61
+ */
62
+ exports.beforeEach = setUp.beforeEach;
63
+
71
64
  /**
72
65
  * In the Jest.afterEach function call this one to clean up and remove the temp directory.
73
- * @function
74
66
  * @memberOf module:testHelpers
75
67
  * @returns {Promise<*>}
76
- */
77
- exports.afterEach = () => removeDirectory(tempDir);
68
+ */
69
+ exports.afterEach = setUp.afterEach;
package/dist/testFull.js CHANGED
@@ -1,23 +1,22 @@
1
- 'use strict'
2
-
3
- const gulpConfig = require('../gulp.config.js')
4
- const {
5
- runCLI
6
- } = require('jest')
7
-
1
+ 'use strict'
2
+
3
+ const gulpConfig = require('../gulp.config.js')
4
+ const {
5
+ runCLI
6
+ } = require('jest')
7
+
8
8
  /**
9
9
  * Run all tests with jest.
10
10
  * Configure where tests are located by using 'testPath'.
11
- * @function
12
11
  * @memberOf module:js-build-tools
13
12
  * @returns {Promise<*>}
14
- */
15
- const testFull = () => {
16
- let testPath = gulpConfig.get('testPath')
17
- if (!Array.isArray(testPath)) {
18
- // The testPath must be an array of strings
19
- testPath = [testPath]
20
- }
21
- return runCLI(gulpConfig.get('testOptions'), testPath)
22
- }
23
- module.exports = testFull
13
+ */
14
+ const testFull = () => {
15
+ let testPath = gulpConfig.get('test.path')
16
+ if (!Array.isArray(testPath)) {
17
+ // The testPath must be an array of strings
18
+ testPath = [testPath]
19
+ }
20
+ return runCLI(gulpConfig.get('test.options'), testPath)
21
+ }
22
+ module.exports = testFull
@@ -1 +1 @@
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;
1
+ "use strict";const gulpConfig=require("../gulp.config.js"),{runCLI:runCLI}=require("jest"),testFull=()=>{let t=gulpConfig.get("test.path");return Array.isArray(t)||(t=[t]),runCLI(gulpConfig.get("test.options"),t)};module.exports=testFull;
@@ -1,33 +1,15 @@
1
- 'use strict'
2
-
1
+ 'use strict'
2
+
3
3
  /**
4
- * An assortment of objects that can be used in tests and some functions to help debug and write tests.
4
+ * Export the setUp helper.
5
5
  * @file
6
6
  * @author Joshua Heagle <joshuaheagle@gmail.com>
7
- * @version 2.0.0
7
+ * @version 3.0.0
8
8
  * @module testHelpers
9
9
  * @memberOf module:js-build-tools
10
- */
11
-
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
- module.exports = {
23
- circularObject,
24
- countMatches,
25
- deepReferenceObject,
26
- domItem,
27
- jsonDom,
28
- linkedList,
29
- logObject,
30
- multiReferenceObject,
31
- nodeTree,
32
- setUp
33
- }
10
+ */
11
+
12
+ const setUp = require('./test-helpers/setUp')
13
+ module.exports = {
14
+ setUp
15
+ }
@@ -1 +1 @@
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};
1
+ "use strict";const setUp=require("./test-helpers/setUp");module.exports={setUp:setUp};
package/dist/testQuick.js CHANGED
@@ -1,25 +1,24 @@
1
- 'use strict'
2
-
3
- const gulpConfig = require('../gulp.config.js')
4
- const {
5
- runCLI
6
- } = require('jest')
7
-
1
+ 'use strict'
2
+
3
+ const gulpConfig = require('../gulp.config.js')
4
+ const {
5
+ runCLI
6
+ } = require('jest')
7
+
8
8
  /**
9
9
  * Run the Jest tests for files which have been modified (based on git status).
10
10
  * Configure where tests are located by using 'testPath'.
11
- * @function
12
11
  * @memberOf module:js-build-tools
13
12
  * @returns {Promise<*>}
14
- */
15
- const testQuick = () => {
16
- let testPath = gulpConfig.get('testPath')
17
- if (!Array.isArray(testPath)) {
18
- // The testPath must be an array of strings
19
- testPath = [testPath]
20
- }
21
- return runCLI({
22
- onlyChanged: true
23
- }, testPath)
24
- }
25
- module.exports = testQuick
13
+ */
14
+ const testQuick = () => {
15
+ let testPath = gulpConfig.get('test.path')
16
+ if (!Array.isArray(testPath)) {
17
+ // The testPath must be an array of strings
18
+ testPath = [testPath]
19
+ }
20
+ return runCLI({
21
+ onlyChanged: true
22
+ }, testPath)
23
+ }
24
+ module.exports = testQuick
@@ -1 +1 @@
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;
1
+ "use strict";const gulpConfig=require("../gulp.config.js"),{runCLI:runCLI}=require("jest"),testQuick=()=>{let e=gulpConfig.get("test.path");return Array.isArray(e)||(e=[e]),runCLI({onlyChanged:!0},e)};module.exports=testQuick;
@@ -1,12 +1,11 @@
1
- 'use strict'
2
-
3
- const tsFor = require('./partials/tsFor')
4
-
1
+ 'use strict'
2
+
3
+ const tsFor = require('./partials/tsFor')
4
+
5
5
  /**
6
6
  * Simplified typescript task using tsFor.
7
- * @function
8
7
  * @memberOf module:js-build-tools
9
8
  * @returns {Function}
10
- */
11
- const typeScript = tsFor()
12
- module.exports = typeScript
9
+ */
10
+ const typeScript = tsFor()
11
+ module.exports = typeScript