js-build-tools 3.0.4 → 4.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 (213) hide show
  1. package/README.md +166 -426
  2. package/babel.config.js +1 -1
  3. package/dist/build.js +33 -34
  4. package/dist/build.min.js +1 -1
  5. package/dist/bundle.js +14 -9
  6. package/dist/bundle.min.js +1 -1
  7. package/dist/bundleLint.js +15 -11
  8. package/dist/bundleLint.min.js +1 -1
  9. package/dist/bundleMinify.js +11 -5
  10. package/dist/bundleMinify.min.js +1 -1
  11. package/dist/compileReadme.js +7 -10
  12. package/dist/compileReadme.min.js +1 -1
  13. package/dist/copyFonts.js +11 -5
  14. package/dist/copyFonts.min.js +1 -1
  15. package/dist/default.js +13 -9
  16. package/dist/default.min.js +1 -1
  17. package/dist/dist.js +7 -4
  18. package/dist/dist.min.js +1 -1
  19. package/dist/distLint.js +15 -11
  20. package/dist/distLint.min.js +1 -1
  21. package/dist/distMinify.js +11 -5
  22. package/dist/distMinify.min.js +1 -1
  23. package/dist/images.js +7 -4
  24. package/dist/images.min.js +1 -1
  25. package/dist/partials/addToReadme.js +16 -11
  26. package/dist/partials/beginWatcher.js +11 -7
  27. package/dist/partials/clean.js +11 -5
  28. package/dist/partials/copyFor.js +7 -7
  29. package/dist/partials/distFor.js +21 -11
  30. package/dist/partials/distForSrc.js +9 -3
  31. package/dist/partials/distSeries.js +17 -13
  32. package/dist/partials/imagesFor.js +16 -17
  33. package/dist/partials/minifyFor.js +12 -11
  34. package/dist/partials/readmeTemplate.js +13 -9
  35. package/dist/partials/removeDirectory.js +7 -7
  36. package/dist/partials/runOnChange.js +18 -16
  37. package/dist/partials/sassFor.js +19 -12
  38. package/dist/partials/tsFor.js +17 -14
  39. package/dist/partials.js +101 -39
  40. package/dist/partials.min.js +1 -1
  41. package/dist/sass.js +7 -4
  42. package/dist/sass.min.js +1 -1
  43. package/dist/test-helpers/setUp.js +50 -47
  44. package/dist/testFull.js +12 -7
  45. package/dist/testFull.min.js +1 -1
  46. package/dist/testHelpers.js +9 -13
  47. package/dist/testHelpers.min.js +1 -1
  48. package/dist/testQuick.js +12 -7
  49. package/dist/testQuick.min.js +1 -1
  50. package/dist/typeScript.js +6 -4
  51. package/dist/typeScript.min.js +1 -1
  52. package/dist/utilities/dotGet.js +14 -12
  53. package/dist/utilities/dotNotate.js +10 -8
  54. package/dist/utilities/dotSet.js +13 -11
  55. package/dist/utilities/isObject.js +5 -1
  56. package/dist/utilities/strAfter.js +11 -7
  57. package/dist/utilities/strBefore.js +11 -7
  58. package/dist/watchFull.js +7 -7
  59. package/dist/watchFull.min.js +1 -1
  60. package/dist/watchTest.js +13 -9
  61. package/dist/watchTest.min.js +1 -1
  62. package/functions/{build.js → build.mjs} +14 -16
  63. package/functions/{build.test.js → build.test.mjs} +9 -8
  64. package/functions/{bundle.js → bundle.mjs} +5 -7
  65. package/functions/{bundle.test.js → bundle.test.mjs} +5 -4
  66. package/functions/{bundleLint.js → bundleLint.mjs} +4 -6
  67. package/functions/{bundleLint.test.js → bundleLint.test.mjs} +5 -4
  68. package/functions/bundleMinify.mjs +9 -0
  69. package/functions/bundleMinify.test.mjs +15 -0
  70. package/functions/compileReadme.mjs +9 -0
  71. package/functions/{compileReadme.test.js → compileReadme.test.mjs} +4 -4
  72. package/functions/copyFonts.mjs +9 -0
  73. package/functions/{copyFonts.test.js → copyFonts.test.mjs} +4 -3
  74. package/functions/default.mjs +12 -0
  75. package/functions/{default.test.js → default.test.mjs} +8 -7
  76. package/functions/{dist.js → dist.mjs} +2 -4
  77. package/functions/{dist.test.js → dist.test.mjs} +4 -3
  78. package/functions/{distLint.js → distLint.mjs} +4 -6
  79. package/functions/{distLint.test.js → distLint.test.mjs} +5 -4
  80. package/functions/distMinify.mjs +9 -0
  81. package/functions/distMinify.test.mjs +15 -0
  82. package/functions/{images.js → images.mjs} +2 -4
  83. package/functions/{images.test.js → images.test.mjs} +4 -3
  84. package/functions/partials/{addToReadme.js → addToReadme.mjs} +5 -7
  85. package/functions/partials/{addToReadme.test.js → addToReadme.test.mjs} +4 -3
  86. package/functions/partials/beginWatcher.mjs +9 -0
  87. package/functions/partials/{beginWatcher.test.js → beginWatcher.test.mjs} +4 -3
  88. package/functions/partials/clean.mjs +13 -0
  89. package/functions/partials/{clean.test.js → clean.test.mjs} +4 -3
  90. package/functions/partials/{copyFor.js → copyFor.mjs} +2 -4
  91. package/functions/partials/{copyFor.test.js → copyFor.test.mjs} +4 -3
  92. package/functions/partials/distFor.mjs +22 -0
  93. package/functions/partials/{distFor.test.js → distFor.test.mjs} +49 -8
  94. package/functions/partials/{distForSrc.js → distForSrc.mjs} +2 -4
  95. package/functions/partials/{distForSrc.test.js → distForSrc.test.mjs} +3 -2
  96. package/functions/partials/{distSeries.js → distSeries.mjs} +6 -8
  97. package/functions/partials/{distSeries.test.js → distSeries.test.mjs} +7 -6
  98. package/functions/partials/{imagesFor.js → imagesFor.mjs} +5 -13
  99. package/functions/partials/{imagesFor.test.js → imagesFor.test.mjs} +4 -3
  100. package/functions/partials/minifyFor.mjs +15 -0
  101. package/functions/partials/{minifyFor.test.js → minifyFor.test.mjs} +5 -4
  102. package/functions/partials/readmeTemplate.mjs +12 -0
  103. package/functions/partials/{readmeTemplate.test.js → readmeTemplate.test.mjs} +4 -3
  104. package/functions/partials/{removeDirectory.js → removeDirectory.mjs} +2 -4
  105. package/functions/partials/{removeDirectory.test.js → removeDirectory.test.mjs} +28 -28
  106. package/functions/partials/{runOnChange.js → runOnChange.mjs} +6 -8
  107. package/functions/partials/{runOnChange.test.js → runOnChange.test.mjs} +12 -11
  108. package/functions/partials/sassFor.mjs +22 -0
  109. package/functions/partials/{sassFor.test.js → sassFor.test.mjs} +5 -4
  110. package/functions/partials/{tsFor.js → tsFor.mjs} +4 -6
  111. package/functions/partials/{tsFor.test.js → tsFor.test.mjs} +5 -4
  112. package/functions/partials.mjs +23 -0
  113. package/functions/{partials.test.js → partials.test.mjs} +1 -1
  114. package/functions/sass.mjs +4 -0
  115. package/functions/{sass.test.js → sass.test.mjs} +4 -3
  116. package/functions/test-helpers/{setUp.js → setUp.mjs} +25 -27
  117. package/functions/test-helpers/setUp.test.mjs +19 -0
  118. package/functions/{testFull.js → testFull.mjs} +4 -6
  119. package/functions/testFull.test.mjs +17 -0
  120. package/functions/{testHelpers.js → testHelpers.mjs} +1 -6
  121. package/functions/testHelpers.test.mjs +7 -0
  122. package/functions/{testQuick.js → testQuick.mjs} +4 -6
  123. package/functions/testQuick.test.mjs +17 -0
  124. package/functions/{typeScript.js → typeScript.mjs} +2 -4
  125. package/functions/typeScript.test.mjs +11 -0
  126. package/functions/utilities/{dotGet.js → dotGet.mjs} +4 -6
  127. package/functions/utilities/{dotNotate.js → dotNotate.mjs} +2 -4
  128. package/functions/utilities/{dotSet.js → dotSet.mjs} +4 -6
  129. package/functions/utilities/{isObject.js → isObject.mjs} +1 -3
  130. package/functions/utilities/{strAfter.js → strAfter.mjs} +11 -13
  131. package/functions/utilities/{strBefore.js → strBefore.mjs} +11 -13
  132. package/functions/{watchFull.js → watchFull.mjs} +2 -4
  133. package/functions/{watchFull.test.js → watchFull.test.mjs} +8 -7
  134. package/functions/watchTest.mjs +10 -0
  135. package/functions/{watchTest.test.js → watchTest.test.mjs} +7 -6
  136. package/gulp.config.js +20 -19
  137. package/gulp.config.mjs +252 -0
  138. package/gulpfile.base.js +20 -20
  139. package/gulpfile.base.mjs +27 -0
  140. package/package.json +27 -13
  141. package/functions/bundleMinify.js +0 -11
  142. package/functions/bundleMinify.test.js +0 -14
  143. package/functions/compileReadme.js +0 -11
  144. package/functions/copyFonts.js +0 -11
  145. package/functions/default.js +0 -14
  146. package/functions/distMinify.js +0 -11
  147. package/functions/distMinify.test.js +0 -14
  148. package/functions/partials/beginWatcher.js +0 -11
  149. package/functions/partials/clean.js +0 -15
  150. package/functions/partials/distFor.js +0 -17
  151. package/functions/partials/minifyFor.js +0 -15
  152. package/functions/partials/readmeTemplate.js +0 -14
  153. package/functions/partials/sassFor.js +0 -21
  154. package/functions/partials.js +0 -40
  155. package/functions/sass.js +0 -6
  156. package/functions/test-helpers/setUp.test.js +0 -18
  157. package/functions/testFull.test.js +0 -16
  158. package/functions/testHelpers.test.js +0 -7
  159. package/functions/testQuick.test.js +0 -16
  160. package/functions/typeScript.test.js +0 -10
  161. package/functions/watchTest.js +0 -12
  162. package/vendor/array-union/index.js +0 -31
  163. package/vendor/easy-transform-stream/index.js +0 -54
  164. package/vendor/globby/gitignore.js +0 -96
  165. package/vendor/globby/index.js +0 -191
  166. package/vendor/globby/node_modules/slash/index.js +0 -16
  167. package/vendor/globby/stream-utils.js +0 -58
  168. package/vendor/globby/to-path.js +0 -20
  169. package/vendor/gulp-imagemin/index.js +0 -124
  170. package/vendor/gulp-imagemin/node_modules/chalk/source/index.js +0 -265
  171. package/vendor/gulp-imagemin/node_modules/chalk/source/utilities.js +0 -36
  172. package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -217
  173. package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/supports-color/index.js +0 -154
  174. package/vendor/gulp-plugin-extras/index.js +0 -42
  175. package/vendor/gulp-plugin-extras/node_modules/chalk/source/index.js +0 -265
  176. package/vendor/gulp-plugin-extras/node_modules/chalk/source/utilities.js +0 -36
  177. package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -217
  178. package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/supports-color/index.js +0 -154
  179. package/vendor/gulp-plugin-extras/plugin-error.js +0 -145
  180. package/vendor/ignore/index.js +0 -468
  181. package/vendor/imagemin/index.js +0 -90
  182. package/vendor/imagemin-gifsicle/index.js +0 -33
  183. package/vendor/imagemin-mozjpeg/index.js +0 -100
  184. package/vendor/imagemin-mozjpeg/node_modules/execa/index.js +0 -260
  185. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/command.js +0 -47
  186. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/error.js +0 -102
  187. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/kill.js +0 -123
  188. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/promise.js +0 -47
  189. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stdio.js +0 -50
  190. package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stream.js +0 -124
  191. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/core.js +0 -238
  192. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/main.js +0 -89
  193. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/realtime.js +0 -24
  194. package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/signals.js +0 -44
  195. package/vendor/imagemin-mozjpeg/node_modules/is-stream/index.js +0 -25
  196. package/vendor/imagemin-mozjpeg/node_modules/mimic-fn/index.js +0 -70
  197. package/vendor/imagemin-mozjpeg/node_modules/npm-run-path/index.js +0 -52
  198. package/vendor/imagemin-mozjpeg/node_modules/onetime/index.js +0 -43
  199. package/vendor/imagemin-mozjpeg/node_modules/path-key/index.js +0 -20
  200. package/vendor/imagemin-mozjpeg/node_modules/strip-final-newline/index.js +0 -17
  201. package/vendor/imagemin-optipng/index.js +0 -44
  202. package/vendor/imagemin-svgo/index.js +0 -27
  203. package/vendor/is-jpg/index.js +0 -12
  204. package/vendor/junk/index.js +0 -49
  205. package/vendor/mozjpeg/index.js +0 -9
  206. package/vendor/mozjpeg/lib/index.js +0 -18
  207. package/vendor/mozjpeg/package.json +0 -49
  208. package/vendor/mozjpeg/vendor/cjpeg +0 -0
  209. package/vendor/mozjpeg/vendor/source/mozjpeg.tar.gz +0 -0
  210. package/vendor/p-pipe/index.js +0 -22
  211. package/vendor/plur/index.js +0 -32
  212. package/vendor/pretty-bytes/index.js +0 -71
  213. package/vendor/slash/index.js +0 -12
package/README.md CHANGED
@@ -22,92 +22,99 @@ of `node_modules/.bin/gulp`.
22
22
 
23
23
  ## Configuration
24
24
 
25
- In your project's root directory, create a `build-tools.config.js` file. This can contain any of the following (values
25
+ In your project's root directory, create a `build-tools.config.json` file. This can contain any of the following (values
26
26
  provided are the defaults):
27
27
 
28
- ```js
29
- module.exports = {
30
- browser: {
28
+ ```json
29
+ {
30
+ "browser": {
31
31
  // 'true' to generate browser bundled files; 'false' for node environment only
32
- enabled: true,
32
+ "enabled": true,
33
33
  // The name to use for the browser-bundled output file (.js will be appended).
34
- name: 'my-package',
34
+ "name": "my-package",
35
35
  // The search pattern used for retrieving compiled distribution files.
36
- from: 'dist/**/*.js',
36
+ "from": "dist/**/*.js",
37
37
  // The output directory for browser-bundled files.
38
- to: 'browser',
38
+ "to": "browser"
39
39
  },
40
40
  // The paths for directories to delete before build.
41
- cleanPaths: ['dist', 'browser'],
42
- dist: {
41
+ "cleanPaths": [
42
+ "dist",
43
+ "browser"
44
+ ],
45
+ "dist": {
43
46
  // Name of the entry the distribution file.
44
- main: 'dist/main',
47
+ "main": "dist/main",
45
48
  // The search pattern used for gathering source files for distribution.
46
- from: 'src/**/!(*.test).js',
49
+ "from": "src/**/!(*.test).js",
47
50
  // The output directory for the distribution files.
48
- to: 'dist',
51
+ "to": "dist"
49
52
  },
50
- fonts: {
53
+ "fonts": {
51
54
  // Toggle copy directory of fonts on
52
- enabled: false,
55
+ "enabled": false,
53
56
  // Path to search for fonts
54
- from: 'src/fonts/**/*',
57
+ "from": "src/fonts/**/*",
55
58
  // Path to output fonts
56
- to: 'browser/fonts',
59
+ "to": "browser/fonts"
57
60
  },
58
- images: {
61
+ "images": {
59
62
  // Toggle image minify and copy process
60
- enabled: false,
63
+ "enabled": false,
61
64
  // Path to search for images
62
- from: 'src/img/**/*.+(png|jpg|jpeg|gif|svg)',
65
+ "from": "src/img/**/*.+(png|jpg|jpeg|gif|svg)",
63
66
  // Path to output images
64
- to: 'browser/img',
67
+ "to": "browser/img"
65
68
  },
66
- readme: {
69
+ "readme": {
67
70
  // The file which will be pre-fixed to your README.md output.
68
- template: 'MAIN.md',
71
+ "template": "MAIN.md",
69
72
  // Options for formatting the output readme.
70
- options: 'utf8',
73
+ "options": "utf8",
71
74
  // The name of the output documentation markdown file.
72
- file: 'README.md',
75
+ "file": "README.md",
73
76
  // Location of files to use for compiling documentation into the readme.
74
- from: ['gulpfile.base.js', 'gulp.config.js', 'functions/**/!(*.test).js'],
77
+ "from": [
78
+ "src/**/!(*.test).js"
79
+ ],
75
80
  // The directory to output the readme file in.
76
- to: './'
81
+ "to": "./"
77
82
  },
78
83
  // Base directory of the project.
79
- rootPath: './',
80
- sass: {
84
+ "rootPath": "./",
85
+ "sass": {
81
86
  // Toggle SASS to CSS process on.
82
- enabled: false,
87
+ "enabled": false,
83
88
  // The pattern for finding all sass files.
84
- from: 'sass/**/*.+(scss|sass)',
89
+ "from": "sass/**/*.+(scss|sass)",
85
90
  // The directory were sass files will be stored.
86
- path: 'sass',
91
+ "path": "sass",
87
92
  // The destination path for where generated CSS (from SASS files) should go.
88
- to: 'browser/css',
93
+ "to": "browser/css"
89
94
  },
90
95
  // The directory where your source files are stored (the files you manually created).
91
- srcPath: 'src',
92
- test: {
96
+ "srcPath": "src",
97
+ "test": {
93
98
  // Additional flags for programmatically running Jest Cli.
94
- options: null,
99
+ "options": null,
95
100
  // The directory where Jest test files are stored.
96
101
  // By default, stored as *.test.js adjacent to the files they are testing.
97
- path: ['src'],
102
+ "path": [
103
+ "src"
104
+ ],
98
105
  // The search pattern for watching files for changes.
99
- watch: 'src/**/*.js'
106
+ "watch": "src/**/*.js"
100
107
  },
101
- typescript: {
108
+ "typescript": {
102
109
  // The path the tsconfig file for running typescript or false if no ts file given.
103
- config: false,
110
+ "config": false,
104
111
  // Toggle usage of typescript parsing.
105
- enabled: false,
112
+ "enabled": false,
106
113
  // Pattern for finding the TypeScript files.
107
- from: 'src/**/*.ts',
114
+ "from": "src/**/*.ts",
108
115
  // Directory where parsed typescript files go.
109
- to: 'dist',
110
- },
116
+ "to": "dist"
117
+ }
111
118
  }
112
119
  ```
113
120
 
@@ -116,6 +123,8 @@ module.exports = {
116
123
  In your project's root directory, create a `gulpfile.js` file, in here you can require any of the functions you need.
117
124
  For example:
118
125
 
126
+ #### Common JS
127
+
119
128
  ```js
120
129
  // Your local gulpfile.js
121
130
  const {
@@ -144,6 +153,29 @@ exports.watchFull = watchFull
144
153
  exports.watchTest = watchTest
145
154
  ```
146
155
 
156
+ #### ES Module
157
+
158
+ ```js
159
+ // Your local gulpfile.mjs
160
+ // Everything you export will be created as a gulp task.
161
+ export {
162
+ build,
163
+ defaultCmd,
164
+ partials,
165
+ readme,
166
+ sass,
167
+ testFull,
168
+ testQuick,
169
+ typescript,
170
+ watchFull,
171
+ watchTest
172
+ } from 'js-build-tools'
173
+
174
+ // You can build your own tasks here as well by using some of the functions `js-build-tools/functions`.
175
+ // You can list your available tasks by running `gulp --tasks`.
176
+
177
+ ```
178
+
147
179
  Verify your tasks are available by running `gulp --tasks`.
148
180
 
149
181
  ### Configure Babel
@@ -159,6 +191,60 @@ const babelConfig = require('js-build-tools/babel.config')
159
191
  module.exports = babelConfig
160
192
  ```
161
193
 
194
+ ### Configure ES Modules (.mjs)
195
+
196
+ It is not recommended to use `"type": "module"` in the `package.json` to enable ES Modules.
197
+ This is because some dependencies still rely on common JS syntax (ex: babel, jest, jsdoc).
198
+ So, to use ES Modules, you can use the `.mjs` extension on your files instead.
199
+ There are different downsides to using the `.mjs` extension to consider.
200
+ The `jsdoc` generation can only read `.js` files, and the provided test runner `Jest` will need to be configured.
201
+ Update the test config as follows:
202
+
203
+ ```json
204
+ {
205
+ "dist": {
206
+ // Use .mjs files for from and main
207
+ "main": "src/main.mjs",
208
+ "from": "src/**/!(*.test).mjs",
209
+ "to": "dist"
210
+ },
211
+ "readme": {
212
+ "template": "MAIN.md",
213
+ "options": "utf8",
214
+ "toFile": "README.md",
215
+ "from": [
216
+ // Use the dist directory files to generate the jsdocs
217
+ "dist/!(*.test).js"
218
+ ],
219
+ "to": "./"
220
+ },
221
+ "test": {
222
+ "options": {
223
+ // The below helps to find the .mjs files (rather than default .js files)
224
+ "testMatch": [
225
+ "**/?(*.)+(spec|test).mjs?(x)"
226
+ ]
227
+ },
228
+ "path": "functions",
229
+ // Include watching for .mjs files
230
+ "watch": "functions/**/*.[cm]?[jt]s"
231
+ }
232
+ }
233
+ ```
234
+
235
+ There is an additional file you need to get Jest working, add a `jest.config.js` file.
236
+ While we have already added these configurations above in the "options",
237
+ there seems to be a bug where the "transform" does not work in that context. Add the following to your `jest.config.js`:
238
+
239
+ ```js
240
+ module.exports = {
241
+ // The transform will instruct jest to run the files through babel so it can interpret them
242
+ transform: {
243
+ '^.+\\.[cm]?[jt]sx?$': 'babel-jest'
244
+ }
245
+ }
246
+ ```
247
+
162
248
  ### Configure HTML JS Documentation (optional)
163
249
 
164
250
  It may be desirable to generate HTML documentation for your JS files.
@@ -186,17 +272,17 @@ module.exports = jsDocBase
186
272
 
187
273
  Be able to copy a source directory of fonts into the distribution path.
188
274
 
189
- Add the following to the exports in your `build-tools.config.js`:
275
+ Add the following to the exports in your `build-tools.config.json`:
190
276
 
191
- ```js
192
- module.exports = {
193
- fonts: {
277
+ ```json
278
+ {
279
+ "fonts": {
194
280
  // Enable fonts process
195
- enabled: false,
281
+ "enabled": false,
196
282
  // Search pattern to find your font files
197
- from: 'src/fonts/**/*',
283
+ "from": "src/fonts/**/*",
198
284
  // Output directory for your font files
199
- to: 'browser/fonts',
285
+ "to": "browser/fonts"
200
286
  }
201
287
  }
202
288
  ```
@@ -205,17 +291,17 @@ module.exports = {
205
291
 
206
292
  Be able to copy and reduce the file size of images into an output path.
207
293
 
208
- Add the following to the exports in your `build-tools.config.js`:
294
+ Add the following to the exports in your `build-tools.config.json`:
209
295
 
210
- ```js
211
- module.exports = {
212
- images: {
296
+ ```json
297
+ {
298
+ "images": {
213
299
  // Enable image process
214
- enabled: false,
300
+ "enabled": false,
215
301
  // Search pattern to find your images
216
- from: 'src/img/**/*.+(png|jpg|jpeg|gif|svg)',
302
+ "from": "src/img/**/*.+(png|jpg|jpeg|gif|svg)",
217
303
  // Output directory for your images files
218
- to: 'browser/img',
304
+ "to": "browser/img"
219
305
  }
220
306
  }
221
307
  ```
@@ -224,19 +310,19 @@ module.exports = {
224
310
 
225
311
  SASS support is built-in, this enables conversion of SASS files to CSS for web projects.
226
312
 
227
- Add the following to the exports in your `build-tools.config.js`:
313
+ Add the following to the exports in your `build-tools.config.json`:
228
314
 
229
- ```js
230
- module.exports = {
231
- sass: {
315
+ ```json
316
+ {
317
+ "sass": {
232
318
  // Enable SASS process
233
- enabled: false,
319
+ "enabled": false,
234
320
  // Search pattern to find your SASS files (the below would be files ending in .scss or .sass in a directory called 'sass')
235
- from: 'sass/**/*.+(scss|sass)',
321
+ "from": "sass/**/*.+(scss|sass)",
236
322
  // Optional but nice to add (future support), add the directory where your sass files exist
237
- path: 'sass',
323
+ "path": "sass",
238
324
  // Output directory for your compiled css files, recommend css directory within your browser output directory
239
- to: 'browser/css',
325
+ "to": "browser/css"
240
326
  }
241
327
  }
242
328
  ```
@@ -260,27 +346,27 @@ Create a `tsconfig.json` file in your project root with the following:
260
346
  ```
261
347
 
262
348
  The pattern for `"files"` should match your .ts files, but the essential thing is that it is wrapped in an array.
263
- The actual pattern used comes from `build-tools.config.js` as `'typescript.from'` setting.
349
+ The actual pattern used comes from `build-tools.config.json` as `'typescript.from'` setting.
264
350
  To create the ts declaration files, you must add the `"declaration": true`.
265
351
 
266
- Add the following to the exports in your `build-tools.config.js`:
352
+ Add the following to the exports in your `build-tools.config.json`:
267
353
 
268
- ```js
269
- module.exports = {
270
- readme: {
354
+ ```json
355
+ {
356
+ "readme": {
271
357
  // Location of files to use for compiling documentation into the readme.
272
- from: 'dist/**/!(*.min).js',
358
+ "from": "dist/**/!(*.min).js"
273
359
  },
274
- typescript: {
360
+ "typescript": {
275
361
  // The path the tsconfig file for running typescript or false if no ts file given.
276
- config: 'tsconfig.json',
362
+ "config": "tsconfig.json",
277
363
  // Toggle usage of typescript parsing
278
- enabled: true,
364
+ "enabled": true,
279
365
  // Pattern for finding the TypeScript files
280
- from: 'src/**/*.ts',
366
+ "from": "src/**/*.ts",
281
367
  // Directory where parsed typescript files go
282
- to: 'dist',
283
- },
368
+ "to": "dist"
369
+ }
284
370
  }
285
371
  ```
286
372
 
@@ -326,146 +412,20 @@ Run any of the above commands with `gulp` or `npm run`.
326
412
 
327
413
  <dl>
328
414
  <dt><a href="#module_js-build-tools">js-build-tools</a></dt>
329
- <dd><p>Export these functions to your own project in order to customize your build pipeline.</p>
415
+ <dd><p>Export these functions to your own project to customize your build pipeline.</p>
330
416
  </dd>
331
417
  <dt><a href="#module_gulpConfig">gulpConfig</a></dt>
332
418
  <dd><p>Modify these configurations to match your project specifications.</p>
333
419
  </dd>
334
- <dt><a href="#module_testHelpers">testHelpers</a></dt>
335
- <dd><p>Export the setUp helper.</p>
336
- </dd>
337
- <dt><a href="#module_partials">partials</a></dt>
338
- <dd><p>Micro-functions used as components for the main gulp functions.</p>
339
- </dd>
340
420
  </dl>
341
421
 
342
422
  <a name="module_js-build-tools"></a>
343
423
 
344
424
  ## js-build-tools
345
- Export these functions to your own project in order to customize your build pipeline.
425
+ Export these functions to your own project to customize your build pipeline.
346
426
 
347
427
  **Version**: 3.0.0
348
428
  **Author**: Joshua Heagle <joshuaheagle@gmail.com>
349
-
350
- * [js-build-tools](#module_js-build-tools)
351
- * [.typeScript](#module_js-build-tools.typeScript) ⇒ <code>function</code>
352
- * [.compileReadme](#module_js-build-tools.compileReadme) ⇒ <code>stream.Stream</code>
353
- * [.watchTest()](#module_js-build-tools.watchTest) ⇒ <code>\*</code>
354
- * [.watchFull()](#module_js-build-tools.watchFull) ⇒ <code>FSWatcher</code>
355
- * [.testQuick()](#module_js-build-tools.testQuick) ⇒ <code>Promise.&lt;\*&gt;</code>
356
- * [.testFull()](#module_js-build-tools.testFull) ⇒ <code>Promise.&lt;\*&gt;</code>
357
- * [.images()](#module_js-build-tools.images) ⇒ <code>stream.Stream</code>
358
- * [.distMinify()](#module_js-build-tools.distMinify) ⇒ <code>\*</code>
359
- * [.distLint()](#module_js-build-tools.distLint) ⇒ <code>\*</code>
360
- * [.dist()](#module_js-build-tools.dist) ⇒ <code>\*</code>
361
- * [.defaultCmd([done])](#module_js-build-tools.defaultCmd) ⇒ <code>stream.Stream</code>
362
- * [.copyFonts()](#module_js-build-tools.copyFonts) ⇒ <code>stream.Stream</code>
363
- * [.bundleMinify()](#module_js-build-tools.bundleMinify) ⇒ <code>\*</code>
364
- * [.bundleLint()](#module_js-build-tools.bundleLint) ⇒ <code>stream.Stream</code>
365
- * [.bundle()](#module_js-build-tools.bundle) ⇒ <code>stream.Stream</code>
366
- * [.build()](#module_js-build-tools.build) ⇒ <code>stream.Stream</code>
367
-
368
- <a name="module_js-build-tools.typeScript"></a>
369
-
370
- ### js-build-tools.typeScript ⇒ <code>function</code>
371
- Simplified typescript task using tsFor.
372
-
373
- **Kind**: static constant of [<code>js-build-tools</code>](#module_js-build-tools)
374
- <a name="module_js-build-tools.compileReadme"></a>
375
-
376
- ### js-build-tools.compileReadme ⇒ <code>stream.Stream</code>
377
- Generate the README.md file based off of the template, then append the generated documentation.
378
-
379
- **Kind**: static constant of [<code>js-build-tools</code>](#module_js-build-tools)
380
- <a name="module_js-build-tools.watchTest"></a>
381
-
382
- ### js-build-tools.watchTest() ⇒ <code>\*</code>
383
- Watch for changes and run the tests.
384
-
385
- **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
386
- <a name="module_js-build-tools.watchFull"></a>
387
-
388
- ### js-build-tools.watchFull() ⇒ <code>FSWatcher</code>
389
- Watch for changes and run the distribution for the changed files, then bundle and test the changed files.
390
-
391
- **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
392
- <a name="module_js-build-tools.testQuick"></a>
393
-
394
- ### js-build-tools.testQuick() ⇒ <code>Promise.&lt;\*&gt;</code>
395
- Run the Jest tests for files which have been modified (based on git status).
396
-
397
- **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
398
- <a name="module_js-build-tools.testFull"></a>
399
-
400
- ### js-build-tools.testFull() ⇒ <code>Promise.&lt;\*&gt;</code>
401
- Run all tests with jest.
402
-
403
- **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
404
- <a name="module_js-build-tools.images"></a>
405
-
406
- ### js-build-tools.images() ⇒ <code>stream.Stream</code>
407
- Move and optimize the images into the browser folder using configured settings.
408
-
409
- **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
410
- <a name="module_js-build-tools.distMinify"></a>
411
-
412
- ### js-build-tools.distMinify() ⇒ <code>\*</code>
413
- Creates minified versions of the dist files.
414
-
415
- **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
416
- <a name="module_js-build-tools.distLint"></a>
417
-
418
- ### js-build-tools.distLint() ⇒ <code>\*</code>
419
- Applies Standard code style linting to distribution files.
420
-
421
- **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
422
- <a name="module_js-build-tools.dist"></a>
423
-
424
- ### js-build-tools.dist() ⇒ <code>\*</code>
425
- Simplified distribution tasks which will use arguments from distFor.
426
-
427
- **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
428
- <a name="module_js-build-tools.defaultCmd"></a>
429
-
430
- ### js-build-tools.defaultCmd([done]) ⇒ <code>stream.Stream</code>
431
- Recommended as the default task, runs the simple dist and bundle tasks.
432
-
433
- **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
434
-
435
- | Param | Type | Default |
436
- | --- | --- | --- |
437
- | [done] | <code>function</code> | <code></code> |
438
-
439
- <a name="module_js-build-tools.copyFonts"></a>
440
-
441
- ### js-build-tools.copyFonts() ⇒ <code>stream.Stream</code>
442
- Move the font files into the browser directory.
443
-
444
- **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
445
- <a name="module_js-build-tools.bundleMinify"></a>
446
-
447
- ### js-build-tools.bundleMinify() ⇒ <code>\*</code>
448
- Creates the minified bundle file.
449
-
450
- **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
451
- <a name="module_js-build-tools.bundleLint"></a>
452
-
453
- ### js-build-tools.bundleLint() ⇒ <code>stream.Stream</code>
454
- Applies Standard code style linting to bundled file.
455
-
456
- **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
457
- <a name="module_js-build-tools.bundle"></a>
458
-
459
- ### js-build-tools.bundle() ⇒ <code>stream.Stream</code>
460
- Starting at the distribution entry point, bundle all the files into a single file and store them in the specified output directory.
461
-
462
- **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
463
- <a name="module_js-build-tools.build"></a>
464
-
465
- ### js-build-tools.build() ⇒ <code>stream.Stream</code>
466
- Runs several processes to build and validate the project.
467
-
468
- **Kind**: static method of [<code>js-build-tools</code>](#module_js-build-tools)
469
429
  <a name="module_gulpConfig"></a>
470
430
 
471
431
  ## gulpConfig
@@ -715,223 +675,3 @@ A set of Configurations options defined by Settings.
715
675
  | test | <code>TestConfig</code> | Run test suite configuration. |
716
676
  | typescript | <code>TsConfig</code> | Compile from typescript configuration. |
717
677
 
718
- <a name="module_testHelpers"></a>
719
-
720
- ## testHelpers
721
- Export the setUp helper.
722
-
723
- **Version**: 3.0.0
724
- **Author**: Joshua Heagle <joshuaheagle@gmail.com>
725
-
726
- * [testHelpers](#module_testHelpers)
727
- * [.exports.createTempDir](#module_testHelpers.exports.createTempDir) ⇒ <code>Promise.&lt;(\*\|void)&gt;</code>
728
- * [.exports.beforeEach](#module_testHelpers.exports.beforeEach) ⇒ <code>Promise.&lt;(\*\|void)&gt;</code>
729
- * [.exports.afterEach](#module_testHelpers.exports.afterEach) ⇒ <code>Promise.&lt;\*&gt;</code>
730
- * [.setDefaults(testDir)](#module_testHelpers.setDefaults)
731
-
732
- <a name="module_testHelpers.exports.createTempDir"></a>
733
-
734
- ### testHelpers.exports.createTempDir ⇒ <code>Promise.&lt;(\*\|void)&gt;</code>
735
- Ensure that the del has completed, recursively attempt to delete and recreate
736
-
737
- **Kind**: static property of [<code>testHelpers</code>](#module_testHelpers)
738
-
739
- | Param | Type | Default |
740
- | --- | --- | --- |
741
- | [exists] | <code>boolean</code> | <code>true</code> |
742
-
743
- <a name="module_testHelpers.exports.beforeEach"></a>
744
-
745
- ### testHelpers.exports.beforeEach ⇒ <code>Promise.&lt;(\*\|void)&gt;</code>
746
- In the Jest.beforeEach function call this one to set up the temp directory.
747
-
748
- **Kind**: static property of [<code>testHelpers</code>](#module_testHelpers)
749
- <a name="module_testHelpers.exports.afterEach"></a>
750
-
751
- ### testHelpers.exports.afterEach ⇒ <code>Promise.&lt;\*&gt;</code>
752
- In the Jest.afterEach function call this one to clean up and remove the temp directory.
753
-
754
- **Kind**: static property of [<code>testHelpers</code>](#module_testHelpers)
755
- <a name="module_testHelpers.setDefaults"></a>
756
-
757
- ### testHelpers.setDefaults(testDir)
758
- Update the gulp configurations with the test data. Set the test directory where temp files will be created for testing.
759
-
760
- **Kind**: static method of [<code>testHelpers</code>](#module_testHelpers)
761
-
762
- | Param | Type | Default |
763
- | --- | --- | --- |
764
- | testDir | <code>string</code> | <code>&quot;test-temp&quot;</code> |
765
-
766
- <a name="module_partials"></a>
767
-
768
- ## partials
769
- Micro-functions used as components for the main gulp functions.
770
-
771
- **Version**: 3.0.0
772
- **Author**: Joshua Heagle <joshuaheagle@gmail.com>
773
-
774
- * [partials](#module_partials)
775
- * [.tsFor([srcPath], [distPath])](#module_partials.tsFor) ⇒ <code>function</code>
776
- * [.sassFor([srcSearch], [cssPath])](#module_partials.sassFor) ⇒ <code>stream.Stream</code>
777
- * [.runOnChange(path)](#module_partials.runOnChange) ⇒ <code>stream.Stream</code>
778
- * [~pathRegex](#module_partials.runOnChange..pathRegex)
779
- * [.removeDirectory(dirPath)](#module_partials.removeDirectory) ⇒ <code>Promise.&lt;\*&gt;</code>
780
- * [.readmeTemplate()](#module_partials.readmeTemplate) ⇒ <code>\*</code>
781
- * [.minifyFor()](#module_partials.minifyFor) ⇒ <code>\*</code>
782
- * [.imagesFor([imageSrc], [imageDest])](#module_partials.imagesFor) ⇒ <code>stream.Stream</code>
783
- * [.distSeries([srcPath], [distFinalPath], [tsSearch])](#module_partials.distSeries) ⇒ <code>function</code>
784
- * [.distForSrc([useTs])](#module_partials.distForSrc) ⇒ <code>string</code>
785
- * [.distFor([srcPath], [destPath])](#module_partials.distFor) ⇒ <code>stream.Stream</code>
786
- * [.copyFor(srcPath, destPath)](#module_partials.copyFor) ⇒ <code>stream.Stream</code>
787
- * [.clean()](#module_partials.clean) ⇒ <code>Promise.&lt;Array.&lt;string&gt;&gt;</code> \| <code>\*</code>
788
- * [.beginWatcher()](#module_partials.beginWatcher) ⇒ <code>FSWatcher</code>
789
- * [.addToReadme()](#module_partials.addToReadme) ⇒ <code>string</code> \| <code>Uint8Array</code>
790
-
791
- <a name="module_partials.tsFor"></a>
792
-
793
- ### partials.tsFor([srcPath], [distPath]) ⇒ <code>function</code>
794
- Starting at the source directory, find all the ts files and convert them into the distribution directory.
795
-
796
- **Kind**: static method of [<code>partials</code>](#module_partials)
797
- **See**: `https://www.typescriptlang.org/docs/handbook/gulp.html` for more info
798
-
799
- | Param | Type | Default |
800
- | --- | --- | --- |
801
- | [srcPath] | <code>string</code> \| <code>array</code> | <code>&quot;&#x27;&#x27;&quot;</code> |
802
- | [distPath] | <code>string</code> | <code>&quot;&#x27;&#x27;&quot;</code> |
803
-
804
- <a name="module_partials.sassFor"></a>
805
-
806
- ### partials.sassFor([srcSearch], [cssPath]) ⇒ <code>stream.Stream</code>
807
- Build the CSS for a given source pattern.
808
-
809
- **Kind**: static method of [<code>partials</code>](#module_partials)
810
-
811
- | Param | Type | Default |
812
- | --- | --- | --- |
813
- | [srcSearch] | <code>string</code> \| <code>array</code> | <code>&quot;&#x27;src/config/path/sass/for&#x27;&quot;</code> |
814
- | [cssPath] | <code>string</code> | <code>&quot;&#x27;css/config/path&#x27;&quot;</code> |
815
-
816
- <a name="module_partials.runOnChange"></a>
817
-
818
- ### partials.runOnChange(path) ⇒ <code>stream.Stream</code>
819
- Run this function when the watched files are modified.
820
-
821
- **Kind**: static method of [<code>partials</code>](#module_partials)
822
-
823
- | Param | Type |
824
- | --- | --- |
825
- | path | <code>string</code> |
826
-
827
- **Example**
828
- ```js
829
- // Configured paths
830
- ```
831
- <a name="module_partials.runOnChange..pathRegex"></a>
832
-
833
- #### runOnChange~pathRegex
834
- 1. The original path comes in from src and is a .ts
835
-
836
- **Kind**: inner constant of [<code>runOnChange</code>](#module_partials.runOnChange)
837
- <a name="module_partials.removeDirectory"></a>
838
-
839
- ### partials.removeDirectory(dirPath) ⇒ <code>Promise.&lt;\*&gt;</code>
840
- Return a promise to be completed once the specified directory is deleted.
841
-
842
- **Kind**: static method of [<code>partials</code>](#module_partials)
843
-
844
- | Param | Type |
845
- | --- | --- |
846
- | dirPath | <code>string</code> |
847
-
848
- <a name="module_partials.readmeTemplate"></a>
849
-
850
- ### partials.readmeTemplate() ⇒ <code>\*</code>
851
- Copy a readme template into the README.md file.
852
-
853
- **Kind**: static method of [<code>partials</code>](#module_partials)
854
- <a name="module_partials.minifyFor"></a>
855
-
856
- ### partials.minifyFor() ⇒ <code>\*</code>
857
- Minify files and rename the output with '.min' extension.
858
-
859
- **Kind**: static method of [<code>partials</code>](#module_partials)
860
- <a name="module_partials.imagesFor"></a>
861
-
862
- ### partials.imagesFor([imageSrc], [imageDest]) ⇒ <code>stream.Stream</code>
863
- Move and optimize images into the browser directory.
864
-
865
- **Kind**: static method of [<code>partials</code>](#module_partials)
866
-
867
- | Param | Type | Default |
868
- | --- | --- | --- |
869
- | [imageSrc] | <code>string</code> \| <code>array</code> | <code>&quot;src/images/pattern&quot;</code> |
870
- | [imageDest] | <code>string</code> | <code>&quot;dest/image/folder&quot;</code> |
871
-
872
- <a name="module_partials.distSeries"></a>
873
-
874
- ### partials.distSeries([srcPath], [distFinalPath], [tsSearch]) ⇒ <code>function</code>
875
- When using TypeScript, ensure that we process the ts first then run babel (dist)
876
-
877
- **Kind**: static method of [<code>partials</code>](#module_partials)
878
-
879
- | Param | Type | Default |
880
- | --- | --- | --- |
881
- | [srcPath] | <code>string</code> | <code>&quot;&#x27;src/config/path/dist/for&#x27;&quot;</code> |
882
- | [distFinalPath] | <code>string</code> | <code>&quot;&#x27;dist/config/path&#x27;&quot;</code> |
883
- | [tsSearch] | <code>string</code> | <code>&quot;&#x27;ts/search/config/path&#x27;&quot;</code> |
884
-
885
- <a name="module_partials.distForSrc"></a>
886
-
887
- ### partials.distForSrc([useTs]) ⇒ <code>string</code>
888
- Retrieve the correct distFor search path based on TS Config.
889
-
890
- **Kind**: static method of [<code>partials</code>](#module_partials)
891
-
892
- | Param | Type | Default |
893
- | --- | --- | --- |
894
- | [useTs] | [<code>FlagStringSetting</code>](#module_gulpConfig..FlagStringSetting) | <code>&#x27;config/for/ts&#x27;</code> |
895
-
896
- <a name="module_partials.distFor"></a>
897
-
898
- ### partials.distFor([srcPath], [destPath]) ⇒ <code>stream.Stream</code>
899
- Build the distribution for a given source pattern.
900
-
901
- **Kind**: static method of [<code>partials</code>](#module_partials)
902
-
903
- | Param | Type | Default |
904
- | --- | --- | --- |
905
- | [srcPath] | <code>string</code> \| <code>array</code> | <code>&quot;&#x27;src/config/path/dist/for&#x27;&quot;</code> |
906
- | [destPath] | <code>string</code> | <code>&quot;&#x27;dist/config/path&#x27;&quot;</code> |
907
-
908
- <a name="module_partials.copyFor"></a>
909
-
910
- ### partials.copyFor(srcPath, destPath) ⇒ <code>stream.Stream</code>
911
- Copy some files to a different location.
912
-
913
- **Kind**: static method of [<code>partials</code>](#module_partials)
914
-
915
- | Param | Type |
916
- | --- | --- |
917
- | srcPath | <code>string</code> \| <code>array</code> |
918
- | destPath | <code>string</code> |
919
-
920
- <a name="module_partials.clean"></a>
921
-
922
- ### partials.clean() ⇒ <code>Promise.&lt;Array.&lt;string&gt;&gt;</code> \| <code>\*</code>
923
- Deletes all the distribution and browser files (used before create a new build).
924
-
925
- **Kind**: static method of [<code>partials</code>](#module_partials)
926
- <a name="module_partials.beginWatcher"></a>
927
-
928
- ### partials.beginWatcher() ⇒ <code>FSWatcher</code>
929
- Create a chokidar instance which watches and triggers change when the globed files are modified.
930
-
931
- **Kind**: static method of [<code>partials</code>](#module_partials)
932
- <a name="module_partials.addToReadme"></a>
933
-
934
- ### partials.addToReadme() ⇒ <code>string</code> \| <code>Uint8Array</code>
935
- Appends all the jsdoc comments to the readme file. Assumes empty or templated file.
936
-
937
- **Kind**: static method of [<code>partials</code>](#module_partials)