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
@@ -1,11 +0,0 @@
1
- const copyFor = require('./partials/copyFor.js')
2
- const gulpConfig = require('../gulp.config.js')
3
-
4
- /**
5
- * Move the font files into the browser directory.
6
- * @memberOf module:js-build-tools
7
- * @return {stream.Stream}
8
- */
9
- const copyFonts = () => copyFor(gulpConfig.get('fonts.from'), gulpConfig.get('fonts.to'))
10
-
11
- module.exports = copyFonts
@@ -1,14 +0,0 @@
1
- const dist = require('./dist')
2
- const bundle = require('./bundle')
3
- const gulpConfig = require('../gulp.config')
4
- const { series } = require('gulp')
5
-
6
- /**
7
- * Recommended as the default task, runs the simple dist and bundle tasks.
8
- * @memberOf module:js-build-tools
9
- * @param {function} [done=null]
10
- * @returns {stream.Stream}
11
- */
12
- const defaultCmd = (done = null) => gulpConfig.get('browser.enabled') ? series(dist, bundle)(done) : series(dist)(done)
13
-
14
- module.exports = defaultCmd
@@ -1,11 +0,0 @@
1
- const gulpConfig = require('../gulp.config.js')
2
- const minifyFor = require('./partials/minifyFor')
3
-
4
- /**
5
- * Creates minified versions of the dist files.
6
- * @memberOf module:js-build-tools
7
- * @returns {*}
8
- */
9
- const distMinify = () => minifyFor(gulpConfig.get('browser.from'), gulpConfig.get('dist.to'))
10
-
11
- module.exports = distMinify
@@ -1,14 +0,0 @@
1
- const { setUp } = require('./testHelpers')
2
- const gulpConfig = setUp.gulpConfig
3
- const distMinify = require('./distMinify')
4
- const minifyFor = require('./partials/minifyFor')
5
-
6
- jest.mock('./partials/minifyFor', () => jest.fn(() => Promise.resolve(true)))
7
-
8
- describe('distMinify', () => {
9
- test('calls minifyFor with configurations', () => {
10
- expect.assertions(1)
11
- distMinify()
12
- expect(minifyFor).toHaveBeenCalledWith(gulpConfig.get('browser.from'), gulpConfig.get('dist.to'))
13
- })
14
- })
@@ -1,11 +0,0 @@
1
- const gulpConfig = require('../../gulp.config.js')
2
- const { watch } = require('gulp')
3
-
4
- /**
5
- * Create a chokidar instance which watches and triggers change when the globed files are modified.
6
- * @memberOf module:partials
7
- * @returns {FSWatcher}
8
- */
9
- const beginWatcher = () => watch(gulpConfig.get('test.watch'))
10
-
11
- module.exports = beginWatcher
@@ -1,15 +0,0 @@
1
- const gulpConfig = require('../../gulp.config.js')
2
- const removeDirectory = require('./removeDirectory')
3
-
4
- /**
5
- * Deletes all the distribution and browser files (used before create a new build).
6
- * Configure array of directories to remove with 'cleanPaths'.
7
- * @memberOf module:partials
8
- * @returns {Promise<string[]> | *}
9
- */
10
- const clean = () => gulpConfig.get('cleanPaths').reduce(
11
- (promise, path) => promise.then(() => removeDirectory(path)),
12
- Promise.resolve()
13
- )
14
-
15
- module.exports = clean
@@ -1,17 +0,0 @@
1
- const babel = require('gulp-babel')
2
- const { dest, src } = require('gulp')
3
- const distForSrc = require('./distForSrc')
4
- const gulpConfig = require('../../gulp.config.js')
5
-
6
- /**
7
- * Build the distribution for a given source pattern.
8
- * @memberOf module:partials
9
- * @param {string|array} [srcPath='src/config/path/dist/for']
10
- * @param {string} [destPath='dist/config/path']
11
- * @returns {stream.Stream}
12
- */
13
- const distFor = (srcPath = distForSrc(), destPath = gulpConfig.get('dist.to')) => src(srcPath)
14
- .pipe(babel())
15
- .pipe(dest(destPath))
16
-
17
- module.exports = distFor
@@ -1,15 +0,0 @@
1
- const { dest, src } = require('gulp')
2
- const { default: uglify } = require('gulp-uglify-es')
3
- const rename = require('gulp-rename')
4
-
5
- /**
6
- * Minify files and rename the output with '.min' extension.
7
- * @memberOf module:partials
8
- * @returns {*}
9
- */
10
- const minifyFor = (srcSearch, destination) => src(srcSearch)
11
- .pipe(uglify())
12
- .pipe(rename({ extname: '.min.js' }))
13
- .pipe(dest(destination))
14
-
15
- module.exports = minifyFor
@@ -1,14 +0,0 @@
1
- const { dest, src } = require('gulp')
2
- const gulpConfig = require('../../gulp.config.js')
3
- const rename = require('gulp-rename')
4
-
5
- /**
6
- * Copy a readme template into the README.md file.
7
- * @memberOf module:partials
8
- * @returns {*}
9
- */
10
- const readmeTemplate = () => src(gulpConfig.get('readme.template'))
11
- .pipe(rename(gulpConfig.get('readme.file')))
12
- .pipe(dest(gulpConfig.get('readme.to')))
13
-
14
- module.exports = readmeTemplate
@@ -1,21 +0,0 @@
1
- const { dest, src } = require('gulp')
2
- const gulpConfig = require('../../gulp.config.js')
3
- const cssnano = require('gulp-cssnano')
4
- const rename = require('gulp-rename')
5
- const sass = require('gulp-sass')(require('sass'))
6
-
7
- /**
8
- * Build the CSS for a given source pattern.
9
- * @memberOf module:partials
10
- * @param {string|array} [srcSearch='src/config/path/sass/for']
11
- * @param {string} [cssPath='css/config/path']
12
- * @returns {stream.Stream}
13
- */
14
- const sassFor = (srcSearch = gulpConfig.get('sass.from'), cssPath = gulpConfig.get('sass.to')) => src(srcSearch)
15
- .pipe(sass().on('error', sass.logError)) // Passes it through a gulp-sass, log errors to console
16
- .pipe(dest(cssPath))
17
- .pipe(cssnano())
18
- .pipe(rename({ extname: '.min.css' }))
19
- .pipe(dest(cssPath))
20
-
21
- module.exports = sassFor
@@ -1,40 +0,0 @@
1
- /**
2
- * Micro-functions used as components for the main gulp functions.
3
- * @file
4
- * @author Joshua Heagle <joshuaheagle@gmail.com>
5
- * @version 3.0.0
6
- * @module partials
7
- * @memberOf module:js-build-tools
8
- */
9
-
10
- const addToReadme = require('./partials/addToReadme')
11
- const beginWatcher = require('./partials/beginWatcher')
12
- const clean = require('./partials/clean')
13
- const copyFor = require('./partials/copyFor')
14
- const distFor = require('./partials/distFor')
15
- const distForSrc = require('./partials/distForSrc')
16
- const distSeries = require('./partials/distSeries')
17
- const imagesFor = require('./partials/imagesFor.js')
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
-
25
- module.exports = {
26
- addToReadme,
27
- beginWatcher,
28
- clean,
29
- copyFor,
30
- distFor,
31
- distForSrc,
32
- distSeries,
33
- imagesFor,
34
- minifyFor,
35
- readmeTemplate,
36
- removeDirectory,
37
- runOnChange,
38
- sassFor,
39
- tsFor,
40
- }
package/functions/sass.js DELETED
@@ -1,6 +0,0 @@
1
- const sassFor = require('./partials/sassFor')
2
-
3
- // Compile sass into CSS & auto-inject into browsers
4
- const sass = () => sassFor()
5
-
6
- module.exports = sass
@@ -1,18 +0,0 @@
1
- const { afterEach, createTempDir, gulpConfig, setDefaults } = require('./setUp')
2
- const fs = require('fs')
3
-
4
- setDefaults()
5
-
6
- describe('setUp', () => {
7
- test('able to create the test-temp/src directory', async () => {
8
- expect(fs.existsSync(gulpConfig.get('srcPath'))).toBeFalsy()
9
- await createTempDir()
10
- expect(fs.existsSync(gulpConfig.get('srcPath'))).toBeTruthy()
11
- })
12
-
13
- test('able to delete the test-temp/src directory', async () => {
14
- expect(fs.existsSync(gulpConfig.get('srcPath'))).toBeTruthy()
15
- await afterEach()
16
- expect(fs.existsSync(gulpConfig.get('srcPath'))).toBeFalsy()
17
- })
18
- })
@@ -1,16 +0,0 @@
1
- const { setUp } = require('./testHelpers')
2
- const gulpConfig = setUp.gulpConfig
3
- const { runCLI } = require('jest')
4
- const testFull = require('./testFull')
5
-
6
- jest.mock('jest', () => ({
7
- 'runCLI': jest.fn(() => Promise.resolve(true))
8
- }))
9
-
10
- describe('testFull', () => {
11
- test('runs the Jest CLI with the configured options', () => {
12
- expect.assertions(1)
13
- testFull()
14
- expect(runCLI).toHaveBeenCalledWith(gulpConfig.get('test.options'), [gulpConfig.get('test.path')])
15
- })
16
- })
@@ -1,7 +0,0 @@
1
- const testHelpers = require('./testHelpers')
2
-
3
- describe('testHelpers', () => {
4
- test('is object with all helper exports', () => {
5
- expect(Object.keys(testHelpers).length).toBe(1)
6
- })
7
- })
@@ -1,16 +0,0 @@
1
- const { setUp } = require('./testHelpers')
2
- const gulpConfig = setUp.gulpConfig
3
- const { runCLI } = require('jest')
4
- const testQuick = require('./testQuick')
5
-
6
- jest.mock('jest', () => ({
7
- 'runCLI': jest.fn(() => Promise.resolve(true))
8
- }))
9
-
10
- describe('testQuick', () => {
11
- test('runs the jest CLI with onlyChanged option', () => {
12
- expect.assertions(1)
13
- testQuick()
14
- expect(runCLI).toHaveBeenCalledWith({ onlyChanged: true }, [gulpConfig.get('test.path')])
15
- })
16
- })
@@ -1,10 +0,0 @@
1
- const typeScript = require('./typeScript')
2
- const tsFor = require('./partials/tsFor')
3
- jest.mock('./partials/tsFor', () => jest.fn(() => () => null))
4
-
5
- describe('typeScript', () => {
6
- test('calls tsFor with no parameters', () => {
7
- typeScript()
8
- expect(tsFor).toHaveBeenCalled()
9
- })
10
- })
@@ -1,12 +0,0 @@
1
- const gulpConfig = require('../gulp.config.js')
2
- const { watch } = require('gulp')
3
- const testQuick = require('./testQuick')
4
-
5
- /**
6
- * Watch for changes and run the tests.
7
- * @memberOf module:js-build-tools
8
- * @returns {*}
9
- */
10
- const watchTest = () => watch(gulpConfig.get('test.watch'), { ignoreInitial: false }, testQuick)
11
-
12
- module.exports = watchTest
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- require("core-js/modules/es.array.unscopables.flat.js");
8
- require("core-js/modules/esnext.set.add-all.js");
9
- require("core-js/modules/esnext.set.delete-all.js");
10
- require("core-js/modules/esnext.set.difference.js");
11
- require("core-js/modules/esnext.set.every.js");
12
- require("core-js/modules/esnext.set.filter.js");
13
- require("core-js/modules/esnext.set.find.js");
14
- require("core-js/modules/esnext.set.intersection.js");
15
- require("core-js/modules/esnext.set.is-disjoint-from.js");
16
- require("core-js/modules/esnext.set.is-subset-of.js");
17
- require("core-js/modules/esnext.set.is-superset-of.js");
18
- require("core-js/modules/esnext.set.join.js");
19
- require("core-js/modules/esnext.set.map.js");
20
- require("core-js/modules/esnext.set.reduce.js");
21
- require("core-js/modules/esnext.set.some.js");
22
- require("core-js/modules/esnext.set.symmetric-difference.js");
23
- require("core-js/modules/esnext.set.union.js");
24
- require("core-js/modules/web.dom-collections.iterator.js");
25
- const arrayUnion = function () {
26
- for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
27
- arguments_[_key] = arguments[_key];
28
- }
29
- return [...new Set(arguments_.flat())];
30
- };
31
- var _default = exports.default = arrayUnion;
@@ -1,54 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = transformStream;
7
- require("core-js/modules/web.dom-collections.iterator.js");
8
- var _nodeStream = require("node:stream");
9
- function transformStream() {
10
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11
- let transformer = arguments.length > 1 ? arguments[1] : undefined;
12
- let flusher = arguments.length > 2 ? arguments[2] : undefined;
13
- if (typeof options === 'function') {
14
- flusher = transformer;
15
- transformer = options;
16
- }
17
- return new _nodeStream.Transform({
18
- ...options,
19
- transform(chunk, encoding, callback) {
20
- (async () => {
21
- try {
22
- const value = await transformer(chunk, encoding, this);
23
-
24
- // If the callback throws, we don't want to cause an infinite recursion.
25
- try {
26
- callback(undefined, value);
27
- } catch {}
28
- } catch (error) {
29
- callback(error);
30
- }
31
- })();
32
- },
33
- flush(callback) {
34
- if (typeof flusher !== 'function') {
35
- callback();
36
- return;
37
- }
38
- (async () => {
39
- try {
40
- for await (const chunk of flusher(this)) {
41
- this.push(chunk);
42
- }
43
-
44
- // If the callback throws, we don't want to cause an infinite recursion.
45
- try {
46
- callback();
47
- } catch {}
48
- } catch (error) {
49
- callback(error);
50
- }
51
- })();
52
- }
53
- });
54
- }
@@ -1,96 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isGitIgnoredSync = exports.isGitIgnored = void 0;
7
- require("core-js/modules/esnext.async-iterator.filter.js");
8
- require("core-js/modules/esnext.async-iterator.map.js");
9
- require("core-js/modules/esnext.iterator.constructor.js");
10
- require("core-js/modules/esnext.iterator.filter.js");
11
- require("core-js/modules/esnext.iterator.map.js");
12
- require("core-js/modules/web.dom-collections.iterator.js");
13
- var _nodeProcess = _interopRequireDefault(require("node:process"));
14
- var _nodeFs = _interopRequireDefault(require("node:fs"));
15
- var _nodePath = _interopRequireDefault(require("node:path"));
16
- var _fastGlob = _interopRequireDefault(require("fast-glob"));
17
- var _index = _interopRequireDefault(require("../ignore/index.js"));
18
- var _index2 = _interopRequireDefault(require("./node_modules/slash/index.js"));
19
- var _toPath = _interopRequireDefault(require("./to-path.js"));
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
- const DEFAULT_IGNORE = ['**/node_modules/**', '**/flow-typed/**', '**/coverage/**', '**/.git'];
22
- const mapGitIgnorePatternTo = base => ignore => {
23
- if (ignore.startsWith('!')) {
24
- return '!' + _nodePath.default.posix.join(base, ignore.slice(1));
25
- }
26
- return _nodePath.default.posix.join(base, ignore);
27
- };
28
- const parseGitIgnore = (content, options) => {
29
- const base = (0, _index2.default)(_nodePath.default.relative(options.cwd, _nodePath.default.dirname(options.fileName)));
30
- return content.split(/\r?\n/).filter(Boolean).filter(line => !line.startsWith('#')).map(mapGitIgnorePatternTo(base));
31
- };
32
- const reduceIgnore = files => {
33
- const ignores = (0, _index.default)();
34
- for (const file of files) {
35
- ignores.add(parseGitIgnore(file.content, {
36
- cwd: file.cwd,
37
- fileName: file.filePath
38
- }));
39
- }
40
- return ignores;
41
- };
42
- const ensureAbsolutePathForCwd = (cwd, p) => {
43
- cwd = (0, _index2.default)(cwd);
44
- if (_nodePath.default.isAbsolute(p)) {
45
- if ((0, _index2.default)(p).startsWith(cwd)) {
46
- return p;
47
- }
48
- throw new Error("Path ".concat(p, " is not in cwd ").concat(cwd));
49
- }
50
- return _nodePath.default.join(cwd, p);
51
- };
52
- const getIsIgnoredPredicate = (ignores, cwd) => p => ignores.ignores((0, _index2.default)(_nodePath.default.relative(cwd, ensureAbsolutePathForCwd(cwd, (0, _toPath.default)(p.path || p)))));
53
- const getFile = async (file, cwd) => {
54
- const filePath = _nodePath.default.join(cwd, file);
55
- const content = await _nodeFs.default.promises.readFile(filePath, 'utf8');
56
- return {
57
- cwd,
58
- filePath,
59
- content
60
- };
61
- };
62
- const getFileSync = (file, cwd) => {
63
- const filePath = _nodePath.default.join(cwd, file);
64
- const content = _nodeFs.default.readFileSync(filePath, 'utf8');
65
- return {
66
- cwd,
67
- filePath,
68
- content
69
- };
70
- };
71
- const normalizeOptions = function () {
72
- let {
73
- ignore = [],
74
- cwd = (0, _index2.default)(_nodeProcess.default.cwd())
75
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
76
- return {
77
- ignore: [...DEFAULT_IGNORE, ...ignore],
78
- cwd: (0, _toPath.default)(cwd)
79
- };
80
- };
81
- const isGitIgnored = async options => {
82
- options = normalizeOptions(options);
83
- const paths = await (0, _fastGlob.default)('**/.gitignore', options);
84
- const files = await Promise.all(paths.map(file => getFile(file, options.cwd)));
85
- const ignores = reduceIgnore(files);
86
- return getIsIgnoredPredicate(ignores, options.cwd);
87
- };
88
- exports.isGitIgnored = isGitIgnored;
89
- const isGitIgnoredSync = options => {
90
- options = normalizeOptions(options);
91
- const paths = _fastGlob.default.sync('**/.gitignore', options);
92
- const files = paths.map(file => getFileSync(file, options.cwd));
93
- const ignores = reduceIgnore(files);
94
- return getIsIgnoredPredicate(ignores, options.cwd);
95
- };
96
- exports.isGitIgnoredSync = isGitIgnoredSync;
@@ -1,191 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isDynamicPattern = exports.globbySync = exports.globbyStream = exports.globby = exports.generateGlobTasks = void 0;
7
- Object.defineProperty(exports, "isGitIgnored", {
8
- enumerable: true,
9
- get: function () {
10
- return _gitignore.isGitIgnored;
11
- }
12
- });
13
- Object.defineProperty(exports, "isGitIgnoredSync", {
14
- enumerable: true,
15
- get: function () {
16
- return _gitignore.isGitIgnoredSync;
17
- }
18
- });
19
- require("core-js/modules/es.array.unscopables.flat.js");
20
- require("core-js/modules/esnext.async-iterator.every.js");
21
- require("core-js/modules/esnext.async-iterator.filter.js");
22
- require("core-js/modules/esnext.async-iterator.map.js");
23
- require("core-js/modules/esnext.async-iterator.some.js");
24
- require("core-js/modules/esnext.iterator.constructor.js");
25
- require("core-js/modules/esnext.iterator.every.js");
26
- require("core-js/modules/esnext.iterator.filter.js");
27
- require("core-js/modules/esnext.iterator.map.js");
28
- require("core-js/modules/esnext.iterator.some.js");
29
- require("core-js/modules/web.dom-collections.iterator.js");
30
- var _nodeFs = _interopRequireDefault(require("node:fs"));
31
- var _index = _interopRequireDefault(require("../array-union/index.js"));
32
- var _merge = _interopRequireDefault(require("merge2"));
33
- var _fastGlob = _interopRequireDefault(require("fast-glob"));
34
- var _dirGlob = _interopRequireDefault(require("dir-glob"));
35
- var _toPath = _interopRequireDefault(require("./to-path.js"));
36
- var _gitignore = require("./gitignore.js");
37
- var _streamUtils = require("./stream-utils.js");
38
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
- const DEFAULT_FILTER = () => false;
40
- const isNegative = pattern => pattern[0] === '!';
41
- const assertPatternsInput = patterns => {
42
- if (!patterns.every(pattern => typeof pattern === 'string')) {
43
- throw new TypeError('Patterns must be a string or an array of strings');
44
- }
45
- };
46
- const checkCwdOption = options => {
47
- if (!options.cwd) {
48
- return;
49
- }
50
- let stat;
51
- try {
52
- stat = _nodeFs.default.statSync(options.cwd);
53
- } catch {
54
- return;
55
- }
56
- if (!stat.isDirectory()) {
57
- throw new Error('The `cwd` option must be a path to a directory');
58
- }
59
- };
60
- const getPathString = p => p.stats instanceof _nodeFs.default.Stats ? p.path : p;
61
- const generateGlobTasks = function (patterns) {
62
- let taskOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
63
- patterns = (0, _index.default)([patterns].flat());
64
- assertPatternsInput(patterns);
65
- const globTasks = [];
66
- taskOptions = {
67
- ignore: [],
68
- expandDirectories: true,
69
- ...taskOptions,
70
- cwd: (0, _toPath.default)(taskOptions.cwd)
71
- };
72
- checkCwdOption(taskOptions);
73
- for (const [index, pattern] of patterns.entries()) {
74
- if (isNegative(pattern)) {
75
- continue;
76
- }
77
- const ignore = patterns.slice(index).filter(pattern => isNegative(pattern)).map(pattern => pattern.slice(1));
78
- const options = {
79
- ...taskOptions,
80
- ignore: [...taskOptions.ignore, ...ignore]
81
- };
82
- globTasks.push({
83
- pattern,
84
- options
85
- });
86
- }
87
- return globTasks;
88
- };
89
- exports.generateGlobTasks = generateGlobTasks;
90
- const globDirectories = (task, fn) => {
91
- let options = {};
92
- if (task.options.cwd) {
93
- options.cwd = task.options.cwd;
94
- }
95
- if (Array.isArray(task.options.expandDirectories)) {
96
- options = {
97
- ...options,
98
- files: task.options.expandDirectories
99
- };
100
- } else if (typeof task.options.expandDirectories === 'object') {
101
- options = {
102
- ...options,
103
- ...task.options.expandDirectories
104
- };
105
- }
106
- return fn(task.pattern, options);
107
- };
108
- const getPattern = (task, fn) => task.options.expandDirectories ? globDirectories(task, fn) : [task.pattern];
109
- const getFilterSync = options => options && options.gitignore ? (0, _gitignore.isGitIgnoredSync)({
110
- cwd: options.cwd,
111
- ignore: options.ignore
112
- }) : DEFAULT_FILTER;
113
- const globToTask = task => async glob => {
114
- const {
115
- options
116
- } = task;
117
- if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) {
118
- options.ignore = await (0, _dirGlob.default)(options.ignore);
119
- }
120
- return {
121
- pattern: glob,
122
- options
123
- };
124
- };
125
- const globToTaskSync = task => glob => {
126
- const {
127
- options
128
- } = task;
129
- if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) {
130
- options.ignore = _dirGlob.default.sync(options.ignore);
131
- }
132
- return {
133
- pattern: glob,
134
- options
135
- };
136
- };
137
- const globby = async (patterns, options) => {
138
- const globTasks = generateGlobTasks(patterns, options);
139
- const getFilter = async () => options && options.gitignore ? (0, _gitignore.isGitIgnored)({
140
- cwd: options.cwd,
141
- ignore: options.ignore
142
- }) : DEFAULT_FILTER;
143
- const getTasks = async () => {
144
- const tasks = await Promise.all(globTasks.map(async task => {
145
- const globs = await getPattern(task, _dirGlob.default);
146
- return Promise.all(globs.map(globToTask(task)));
147
- }));
148
- return (0, _index.default)(...tasks);
149
- };
150
- const [filter, tasks] = await Promise.all([getFilter(), getTasks()]);
151
- const paths = await Promise.all(tasks.map(task => (0, _fastGlob.default)(task.pattern, task.options)));
152
- return (0, _index.default)(...paths).filter(path_ => !filter(getPathString(path_)));
153
- };
154
- exports.globby = globby;
155
- const globbySync = (patterns, options) => {
156
- const globTasks = generateGlobTasks(patterns, options);
157
- const tasks = [];
158
- for (const task of globTasks) {
159
- const newTask = getPattern(task, _dirGlob.default.sync).map(globToTaskSync(task));
160
- tasks.push(...newTask);
161
- }
162
- const filter = getFilterSync(options);
163
- let matches = [];
164
- for (const task of tasks) {
165
- matches = (0, _index.default)(matches, _fastGlob.default.sync(task.pattern, task.options));
166
- }
167
- return matches.filter(path_ => !filter(path_));
168
- };
169
- exports.globbySync = globbySync;
170
- const globbyStream = (patterns, options) => {
171
- const globTasks = generateGlobTasks(patterns, options);
172
- const tasks = [];
173
- for (const task of globTasks) {
174
- const newTask = getPattern(task, _dirGlob.default.sync).map(globToTaskSync(task));
175
- tasks.push(...newTask);
176
- }
177
- const filter = getFilterSync(options);
178
- const filterStream = new _streamUtils.FilterStream(p => !filter(p));
179
- const uniqueStream = new _streamUtils.UniqueStream();
180
- return (0, _merge.default)(tasks.map(task => _fastGlob.default.stream(task.pattern, task.options))).pipe(filterStream).pipe(uniqueStream);
181
- };
182
- exports.globbyStream = globbyStream;
183
- const isDynamicPattern = function (patterns) {
184
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
185
- options = {
186
- ...options,
187
- cwd: (0, _toPath.default)(options.cwd)
188
- };
189
- return [patterns].flat().some(pattern => _fastGlob.default.isDynamicPattern(pattern, options));
190
- };
191
- exports.isDynamicPattern = isDynamicPattern;