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.
- package/README.md +166 -426
- package/babel.config.js +1 -1
- package/dist/build.js +33 -34
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +14 -9
- package/dist/bundle.min.js +1 -1
- package/dist/bundleLint.js +15 -11
- package/dist/bundleLint.min.js +1 -1
- package/dist/bundleMinify.js +11 -5
- package/dist/bundleMinify.min.js +1 -1
- package/dist/compileReadme.js +7 -10
- package/dist/compileReadme.min.js +1 -1
- package/dist/copyFonts.js +11 -5
- package/dist/copyFonts.min.js +1 -1
- package/dist/default.js +13 -9
- package/dist/default.min.js +1 -1
- package/dist/dist.js +7 -4
- package/dist/dist.min.js +1 -1
- package/dist/distLint.js +15 -11
- package/dist/distLint.min.js +1 -1
- package/dist/distMinify.js +11 -5
- package/dist/distMinify.min.js +1 -1
- package/dist/images.js +7 -4
- package/dist/images.min.js +1 -1
- package/dist/partials/addToReadme.js +16 -11
- package/dist/partials/beginWatcher.js +11 -7
- package/dist/partials/clean.js +11 -5
- package/dist/partials/copyFor.js +7 -7
- package/dist/partials/distFor.js +21 -11
- package/dist/partials/distForSrc.js +9 -3
- package/dist/partials/distSeries.js +17 -13
- package/dist/partials/imagesFor.js +16 -17
- package/dist/partials/minifyFor.js +12 -11
- package/dist/partials/readmeTemplate.js +13 -9
- package/dist/partials/removeDirectory.js +7 -7
- package/dist/partials/runOnChange.js +18 -16
- package/dist/partials/sassFor.js +19 -12
- package/dist/partials/tsFor.js +17 -14
- package/dist/partials.js +101 -39
- package/dist/partials.min.js +1 -1
- package/dist/sass.js +7 -4
- package/dist/sass.min.js +1 -1
- package/dist/test-helpers/setUp.js +50 -47
- package/dist/testFull.js +12 -7
- package/dist/testFull.min.js +1 -1
- package/dist/testHelpers.js +9 -13
- package/dist/testHelpers.min.js +1 -1
- package/dist/testQuick.js +12 -7
- package/dist/testQuick.min.js +1 -1
- package/dist/typeScript.js +6 -4
- package/dist/typeScript.min.js +1 -1
- package/dist/utilities/dotGet.js +14 -12
- package/dist/utilities/dotNotate.js +10 -8
- package/dist/utilities/dotSet.js +13 -11
- package/dist/utilities/isObject.js +5 -1
- package/dist/utilities/strAfter.js +11 -7
- package/dist/utilities/strBefore.js +11 -7
- package/dist/watchFull.js +7 -7
- package/dist/watchFull.min.js +1 -1
- package/dist/watchTest.js +13 -9
- package/dist/watchTest.min.js +1 -1
- package/functions/{build.js → build.mjs} +14 -16
- package/functions/{build.test.js → build.test.mjs} +9 -8
- package/functions/{bundle.js → bundle.mjs} +5 -7
- package/functions/{bundle.test.js → bundle.test.mjs} +5 -4
- package/functions/{bundleLint.js → bundleLint.mjs} +4 -6
- package/functions/{bundleLint.test.js → bundleLint.test.mjs} +5 -4
- package/functions/bundleMinify.mjs +9 -0
- package/functions/bundleMinify.test.mjs +15 -0
- package/functions/compileReadme.mjs +9 -0
- package/functions/{compileReadme.test.js → compileReadme.test.mjs} +4 -4
- package/functions/copyFonts.mjs +9 -0
- package/functions/{copyFonts.test.js → copyFonts.test.mjs} +4 -3
- package/functions/default.mjs +12 -0
- package/functions/{default.test.js → default.test.mjs} +8 -7
- package/functions/{dist.js → dist.mjs} +2 -4
- package/functions/{dist.test.js → dist.test.mjs} +4 -3
- package/functions/{distLint.js → distLint.mjs} +4 -6
- package/functions/{distLint.test.js → distLint.test.mjs} +5 -4
- package/functions/distMinify.mjs +9 -0
- package/functions/distMinify.test.mjs +15 -0
- package/functions/{images.js → images.mjs} +2 -4
- package/functions/{images.test.js → images.test.mjs} +4 -3
- package/functions/partials/{addToReadme.js → addToReadme.mjs} +5 -7
- package/functions/partials/{addToReadme.test.js → addToReadme.test.mjs} +4 -3
- package/functions/partials/beginWatcher.mjs +9 -0
- package/functions/partials/{beginWatcher.test.js → beginWatcher.test.mjs} +4 -3
- package/functions/partials/clean.mjs +13 -0
- package/functions/partials/{clean.test.js → clean.test.mjs} +4 -3
- package/functions/partials/{copyFor.js → copyFor.mjs} +2 -4
- package/functions/partials/{copyFor.test.js → copyFor.test.mjs} +4 -3
- package/functions/partials/distFor.mjs +22 -0
- package/functions/partials/{distFor.test.js → distFor.test.mjs} +49 -8
- package/functions/partials/{distForSrc.js → distForSrc.mjs} +2 -4
- package/functions/partials/{distForSrc.test.js → distForSrc.test.mjs} +3 -2
- package/functions/partials/{distSeries.js → distSeries.mjs} +6 -8
- package/functions/partials/{distSeries.test.js → distSeries.test.mjs} +7 -6
- package/functions/partials/{imagesFor.js → imagesFor.mjs} +5 -13
- package/functions/partials/{imagesFor.test.js → imagesFor.test.mjs} +4 -3
- package/functions/partials/minifyFor.mjs +15 -0
- package/functions/partials/{minifyFor.test.js → minifyFor.test.mjs} +5 -4
- package/functions/partials/readmeTemplate.mjs +12 -0
- package/functions/partials/{readmeTemplate.test.js → readmeTemplate.test.mjs} +4 -3
- package/functions/partials/{removeDirectory.js → removeDirectory.mjs} +2 -4
- package/functions/partials/{removeDirectory.test.js → removeDirectory.test.mjs} +28 -28
- package/functions/partials/{runOnChange.js → runOnChange.mjs} +6 -8
- package/functions/partials/{runOnChange.test.js → runOnChange.test.mjs} +12 -11
- package/functions/partials/sassFor.mjs +22 -0
- package/functions/partials/{sassFor.test.js → sassFor.test.mjs} +5 -4
- package/functions/partials/{tsFor.js → tsFor.mjs} +4 -6
- package/functions/partials/{tsFor.test.js → tsFor.test.mjs} +5 -4
- package/functions/partials.mjs +23 -0
- package/functions/{partials.test.js → partials.test.mjs} +1 -1
- package/functions/sass.mjs +4 -0
- package/functions/{sass.test.js → sass.test.mjs} +4 -3
- package/functions/test-helpers/{setUp.js → setUp.mjs} +25 -27
- package/functions/test-helpers/setUp.test.mjs +19 -0
- package/functions/{testFull.js → testFull.mjs} +4 -6
- package/functions/testFull.test.mjs +17 -0
- package/functions/{testHelpers.js → testHelpers.mjs} +1 -6
- package/functions/testHelpers.test.mjs +7 -0
- package/functions/{testQuick.js → testQuick.mjs} +4 -6
- package/functions/testQuick.test.mjs +17 -0
- package/functions/{typeScript.js → typeScript.mjs} +2 -4
- package/functions/typeScript.test.mjs +11 -0
- package/functions/utilities/{dotGet.js → dotGet.mjs} +4 -6
- package/functions/utilities/{dotNotate.js → dotNotate.mjs} +2 -4
- package/functions/utilities/{dotSet.js → dotSet.mjs} +4 -6
- package/functions/utilities/{isObject.js → isObject.mjs} +1 -3
- package/functions/utilities/{strAfter.js → strAfter.mjs} +11 -13
- package/functions/utilities/{strBefore.js → strBefore.mjs} +11 -13
- package/functions/{watchFull.js → watchFull.mjs} +2 -4
- package/functions/{watchFull.test.js → watchFull.test.mjs} +8 -7
- package/functions/watchTest.mjs +10 -0
- package/functions/{watchTest.test.js → watchTest.test.mjs} +7 -6
- package/gulp.config.js +20 -19
- package/gulp.config.mjs +252 -0
- package/gulpfile.base.js +20 -20
- package/gulpfile.base.mjs +27 -0
- package/package.json +27 -13
- package/functions/bundleMinify.js +0 -11
- package/functions/bundleMinify.test.js +0 -14
- package/functions/compileReadme.js +0 -11
- package/functions/copyFonts.js +0 -11
- package/functions/default.js +0 -14
- package/functions/distMinify.js +0 -11
- package/functions/distMinify.test.js +0 -14
- package/functions/partials/beginWatcher.js +0 -11
- package/functions/partials/clean.js +0 -15
- package/functions/partials/distFor.js +0 -17
- package/functions/partials/minifyFor.js +0 -15
- package/functions/partials/readmeTemplate.js +0 -14
- package/functions/partials/sassFor.js +0 -21
- package/functions/partials.js +0 -40
- package/functions/sass.js +0 -6
- package/functions/test-helpers/setUp.test.js +0 -18
- package/functions/testFull.test.js +0 -16
- package/functions/testHelpers.test.js +0 -7
- package/functions/testQuick.test.js +0 -16
- package/functions/typeScript.test.js +0 -10
- package/functions/watchTest.js +0 -12
- package/vendor/array-union/index.js +0 -31
- package/vendor/easy-transform-stream/index.js +0 -54
- package/vendor/globby/gitignore.js +0 -96
- package/vendor/globby/index.js +0 -191
- package/vendor/globby/node_modules/slash/index.js +0 -16
- package/vendor/globby/stream-utils.js +0 -58
- package/vendor/globby/to-path.js +0 -20
- package/vendor/gulp-imagemin/index.js +0 -124
- package/vendor/gulp-imagemin/node_modules/chalk/source/index.js +0 -265
- package/vendor/gulp-imagemin/node_modules/chalk/source/utilities.js +0 -36
- package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -217
- package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/supports-color/index.js +0 -154
- package/vendor/gulp-plugin-extras/index.js +0 -42
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/index.js +0 -265
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/utilities.js +0 -36
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -217
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/supports-color/index.js +0 -154
- package/vendor/gulp-plugin-extras/plugin-error.js +0 -145
- package/vendor/ignore/index.js +0 -468
- package/vendor/imagemin/index.js +0 -90
- package/vendor/imagemin-gifsicle/index.js +0 -33
- package/vendor/imagemin-mozjpeg/index.js +0 -100
- package/vendor/imagemin-mozjpeg/node_modules/execa/index.js +0 -260
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/command.js +0 -47
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/error.js +0 -102
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/kill.js +0 -123
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/promise.js +0 -47
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stdio.js +0 -50
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stream.js +0 -124
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/core.js +0 -238
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/main.js +0 -89
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/realtime.js +0 -24
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/signals.js +0 -44
- package/vendor/imagemin-mozjpeg/node_modules/is-stream/index.js +0 -25
- package/vendor/imagemin-mozjpeg/node_modules/mimic-fn/index.js +0 -70
- package/vendor/imagemin-mozjpeg/node_modules/npm-run-path/index.js +0 -52
- package/vendor/imagemin-mozjpeg/node_modules/onetime/index.js +0 -43
- package/vendor/imagemin-mozjpeg/node_modules/path-key/index.js +0 -20
- package/vendor/imagemin-mozjpeg/node_modules/strip-final-newline/index.js +0 -17
- package/vendor/imagemin-optipng/index.js +0 -44
- package/vendor/imagemin-svgo/index.js +0 -27
- package/vendor/is-jpg/index.js +0 -12
- package/vendor/junk/index.js +0 -49
- package/vendor/mozjpeg/index.js +0 -9
- package/vendor/mozjpeg/lib/index.js +0 -18
- package/vendor/mozjpeg/package.json +0 -49
- package/vendor/mozjpeg/vendor/cjpeg +0 -0
- package/vendor/mozjpeg/vendor/source/mozjpeg.tar.gz +0 -0
- package/vendor/p-pipe/index.js +0 -22
- package/vendor/plur/index.js +0 -32
- package/vendor/pretty-bytes/index.js +0 -71
- package/vendor/slash/index.js +0 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { isObject } from './isObject.mjs'
|
|
2
|
+
import { strAfter } from './strAfter.mjs'
|
|
3
|
+
import { strBefore } from './strBefore.mjs'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Set a nested property value an object.
|
|
@@ -10,7 +10,7 @@ const strBefore = require('./strBefore')
|
|
|
10
10
|
* @param {*} value - The default value to return if the property is not found
|
|
11
11
|
* @returns {Object} The modified object
|
|
12
12
|
*/
|
|
13
|
-
const dotSet = (arrayObject, dotNotation, value = null) => {
|
|
13
|
+
export const dotSet = (arrayObject, dotNotation, value = null) => {
|
|
14
14
|
let key = strBefore(dotNotation, '.')
|
|
15
15
|
const lastKey = !key
|
|
16
16
|
if (lastKey) {
|
|
@@ -37,5 +37,3 @@ const dotSet = (arrayObject, dotNotation, value = null) => {
|
|
|
37
37
|
arrayObject[key] = dotSet(next, strAfter(dotNotation, '.'), value)
|
|
38
38
|
return arrayObject
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
module.exports = dotSet
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Retrieve the string part after the search match.
|
|
3
|
-
* Original source from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/strings/strAfter.ts Sí, funciona}
|
|
4
|
-
* @param {string} str
|
|
5
|
-
* @param {string} search
|
|
6
|
-
* @returns {string}
|
|
7
|
-
*/
|
|
8
|
-
const strAfter = (str, search) => {
|
|
9
|
-
const index = str.indexOf(search)
|
|
10
|
-
return index === -1 ? '' : str.substring(index + search.length)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
module.exports = strAfter
|
|
1
|
+
/**
|
|
2
|
+
* Retrieve the string part after the search match.
|
|
3
|
+
* Original source from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/strings/strAfter.ts Sí, funciona}
|
|
4
|
+
* @param {string} str
|
|
5
|
+
* @param {string} search
|
|
6
|
+
* @returns {string}
|
|
7
|
+
*/
|
|
8
|
+
export const strAfter = (str, search) => {
|
|
9
|
+
const index = str.indexOf(search)
|
|
10
|
+
return index === -1 ? '' : str.substring(index + search.length)
|
|
11
|
+
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Retrieve the string part before the search match.
|
|
3
|
-
* Original source from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/strings/strBefore.ts Sí, funciona}
|
|
4
|
-
* @param {string} str
|
|
5
|
-
* @param {string} search
|
|
6
|
-
* @returns {string}
|
|
7
|
-
*/
|
|
8
|
-
const strBefore = (str, search) => {
|
|
9
|
-
const index = str.indexOf(search)
|
|
10
|
-
return index === -1 ? '' : str.slice(0, index)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
module.exports = strBefore
|
|
1
|
+
/**
|
|
2
|
+
* Retrieve the string part before the search match.
|
|
3
|
+
* Original source from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/strings/strBefore.ts Sí, funciona}
|
|
4
|
+
* @param {string} str
|
|
5
|
+
* @param {string} search
|
|
6
|
+
* @returns {string}
|
|
7
|
+
*/
|
|
8
|
+
export const strBefore = (str, search) => {
|
|
9
|
+
const index = str.indexOf(search)
|
|
10
|
+
return index === -1 ? '' : str.slice(0, index)
|
|
11
|
+
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { beginWatcher, runOnChange } from './partials.mjs'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Watch for changes and run the distribution for the changed files, then bundle and test the changed files.
|
|
5
5
|
* @memberOf module:js-build-tools
|
|
6
6
|
* @returns {FSWatcher}
|
|
7
7
|
*/
|
|
8
|
-
const watchFull = () => beginWatcher()
|
|
8
|
+
export const watchFull = () => beginWatcher()
|
|
9
9
|
.on('change', runOnChange)
|
|
10
|
-
|
|
11
|
-
module.exports = watchFull
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import * as setUp from './test-helpers/setUp.mjs'
|
|
3
|
+
import { watchFull } from './watchFull.mjs'
|
|
4
|
+
import { beginWatcher } from './partials/beginWatcher.mjs'
|
|
5
|
+
import { runOnChange } from './partials/runOnChange.mjs'
|
|
6
|
+
|
|
3
7
|
setUp.setDefaults('test-watch-full')
|
|
4
8
|
const gulpConfig = setUp.gulpConfig
|
|
5
|
-
const watchFull = require('./watchFull')
|
|
6
|
-
const beginWatcher = require('./partials/beginWatcher')
|
|
7
|
-
const runOnChange = require('./partials/runOnChange')
|
|
8
9
|
|
|
9
|
-
jest.mock('./partials/beginWatcher', () => jest.fn(() => ({ on: (event, fn) => fn() })))
|
|
10
|
-
jest.mock('./partials/runOnChange', () => jest.fn())
|
|
10
|
+
jest.mock('./partials/beginWatcher.mjs', () => ({ beginWatcher: jest.fn(() => ({ on: (event, fn) => fn() })) }))
|
|
11
|
+
jest.mock('./partials/runOnChange.mjs', () => ({ runOnChange: jest.fn() }))
|
|
11
12
|
|
|
12
13
|
const rawContents = 'const { beginWatcher, runOnChange } = require(\'./partials\')\n' +
|
|
13
14
|
'\n' +
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as gulpConfig from '../gulp.config.mjs'
|
|
2
|
+
import { watch } from 'gulp'
|
|
3
|
+
import { testQuick } from './testQuick.mjs'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Watch for changes and run the tests.
|
|
7
|
+
* @memberOf module:js-build-tools
|
|
8
|
+
* @returns {*}
|
|
9
|
+
*/
|
|
10
|
+
export const watchTest = () => watch(gulpConfig.get('test.watch'), { ignoreInitial: false }, testQuick)
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import * as setUp from './test-helpers/setUp.mjs'
|
|
2
|
+
import { watchTest } from './watchTest.mjs'
|
|
3
|
+
import { EventEmitter } from 'node:events'
|
|
4
|
+
import fs from 'fs'
|
|
5
|
+
import { testQuick } from './testQuick.mjs'
|
|
6
|
+
|
|
2
7
|
setUp.setDefaults('test-watch-test')
|
|
3
8
|
const gulpConfig = setUp.gulpConfig
|
|
4
9
|
gulpConfig.set('test.watch', 'test-begin-watcher/*.js')
|
|
5
|
-
const watchTest = require('./watchTest')
|
|
6
|
-
const { EventEmitter } = require('node:events')
|
|
7
|
-
const fs = require('fs')
|
|
8
|
-
const testQuick = require('./testQuick')
|
|
9
10
|
|
|
10
|
-
jest.mock('./testQuick', () => jest.fn(() => Promise.resolve(true)))
|
|
11
|
+
jest.mock('./testQuick.mjs', () => ({ testQuick: jest.fn(() => Promise.resolve(true)) }))
|
|
11
12
|
|
|
12
13
|
const rawContents = 'const gulpConfig = require(\'../gulp.config.js\')\n' +
|
|
13
14
|
'const { watch } = require(\'gulp\')\n' +
|
package/gulp.config.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @module gulpConfig
|
|
7
7
|
* @memberOf module:js-build-tools
|
|
8
8
|
*/
|
|
9
|
+
const { fileExists } = require('test-filesystem')
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* A setting that may be an array of strings or a string only.
|
|
@@ -137,25 +138,10 @@
|
|
|
137
138
|
* @property {TsConfig} typescript - Compile from typescript configuration.
|
|
138
139
|
*/
|
|
139
140
|
|
|
140
|
-
const dotGet = require('./
|
|
141
|
-
const dotSet = require('./
|
|
142
|
-
const dotNotate = require('./
|
|
143
|
-
|
|
144
|
-
* All the available configuration setting options for running the build.
|
|
145
|
-
* @memberOf module:gulpConfig` `
|
|
146
|
-
* @type {Configurations}
|
|
147
|
-
*/
|
|
148
|
-
let gulpConfigurations = {}
|
|
149
|
-
try {
|
|
150
|
-
gulpConfigurations = require('../../build-tools.config.js')
|
|
151
|
-
} catch (isUndefined) {
|
|
152
|
-
try {
|
|
153
|
-
// Missing main project config, using default path
|
|
154
|
-
gulpConfigurations = require('./build-tools.config.js')
|
|
155
|
-
} catch (stillUndefined) {
|
|
156
|
-
console.warn('Missing config path, ensure you have a build-tools.config.js file in you project root')
|
|
157
|
-
}
|
|
158
|
-
}
|
|
141
|
+
const { dotGet } = require('./dist/utilities/dotGet')
|
|
142
|
+
const { dotSet } = require('./dist/utilities/dotSet')
|
|
143
|
+
const { dotNotate } = require('./dist/utilities/dotNotate')
|
|
144
|
+
const { readFileSync } = require('fs')
|
|
159
145
|
|
|
160
146
|
const setDefaults = {
|
|
161
147
|
browser: {
|
|
@@ -217,6 +203,21 @@ const setDefaults = {
|
|
|
217
203
|
to: 'dist',
|
|
218
204
|
},
|
|
219
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* All the available configuration setting options for running the build.
|
|
208
|
+
* @memberOf module:gulpConfig` `
|
|
209
|
+
* @type {Configurations}
|
|
210
|
+
*/
|
|
211
|
+
let gulpConfigurations = {}
|
|
212
|
+
if (fileExists('../../build-tools.config.json')) {
|
|
213
|
+
gulpConfigurations = JSON.parse(readFileSync('../../build-tools.config.json').toString())
|
|
214
|
+
} else {
|
|
215
|
+
if (fileExists('./build-tools.config.json')) {
|
|
216
|
+
gulpConfigurations = JSON.parse(readFileSync('./build-tools.config.json').toString())
|
|
217
|
+
} else {
|
|
218
|
+
console.warn('Missing config path, ensure you have a build-tools.config.js file in you project root')
|
|
219
|
+
}
|
|
220
|
+
}
|
|
220
221
|
|
|
221
222
|
const notation = dotNotate(setDefaults)
|
|
222
223
|
for (let notationKey in notation) {
|
package/gulp.config.mjs
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modify these configurations to match your project specifications.
|
|
3
|
+
* @file
|
|
4
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
5
|
+
* @version 3.0.0
|
|
6
|
+
* @module gulpConfig
|
|
7
|
+
* @memberOf module:js-build-tools
|
|
8
|
+
*/
|
|
9
|
+
import { fileExists } from 'test-filesystem'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A setting that may be an array of strings or a string only.
|
|
13
|
+
* @typedef {Array<string>|string} module:gulpConfig~ArrayableSetting
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A setting that may be true or false.
|
|
18
|
+
* @typedef {boolean} module:gulpConfig~BooleanSetting
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A setting that may be flag 'false' or provide a StringSetting
|
|
23
|
+
* @typedef {false|StringSetting} module:gulpConfig~FlagStringSetting
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* An object of boolean settings used as flags.
|
|
28
|
+
* @typedef {Object<string, BooleanSetting>} module:gulpConfig~FlagsSetting
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Configure cli options for running Jest.
|
|
33
|
+
* @typedef {FlagsSetting} module:gulpConfig~JestTestFlags
|
|
34
|
+
* @property {BooleanSetting} clearCache
|
|
35
|
+
* @property {BooleanSetting} debug
|
|
36
|
+
* @property {BooleanSetting} ignoreProjects:
|
|
37
|
+
* @property {BooleanSetting} json
|
|
38
|
+
* @property {BooleanSetting} selectProjects
|
|
39
|
+
* @property {BooleanSetting} showConfig
|
|
40
|
+
* @property {BooleanSetting} useStderr
|
|
41
|
+
* @property {BooleanSetting} watch
|
|
42
|
+
* @property {BooleanSetting} watchAll
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A setting that may only be a string.
|
|
47
|
+
* @typedef {string} module:gulpConfig~StringSetting
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Any single configuration option is a Setting.
|
|
52
|
+
* @typedef {ArrayableSetting|BooleanSetting|FlagsSetting|StringSetting} Setting
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Configurations for building the browser files.
|
|
57
|
+
* @typedef {Object<string, Setting>} module:gulpConfig~BrowserConfig
|
|
58
|
+
* @property {BooleanSetting} enabled - 'true' to generate browser bundled files; 'false' for node environment only
|
|
59
|
+
* @property {StringSetting} from - The name to use for the browser-bundled output file (.js will be appended).
|
|
60
|
+
* @property {StringSetting} name - The search pattern used for retrieving compiled distribution files.
|
|
61
|
+
* @property {StringSetting} to - The output directory for browser-bundled files.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Configurations for building the node distribution files.
|
|
66
|
+
* @typedef {Object<string, Setting>} module:gulpConfig~DistConfig
|
|
67
|
+
* @property {StringSetting} from - The search pattern used for gathering source files for distribution.
|
|
68
|
+
* @property {StringSetting} main - Name of the entry the distribution file.
|
|
69
|
+
* @property {StringSetting} to - The output directory for the distribution files.
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Configurations for copying the font files.
|
|
74
|
+
* @typedef {Object<string, Setting>} module:gulpConfig~FontConfig
|
|
75
|
+
* @property {BooleanSetting} enabled - Toggle copy directory of fonts on.
|
|
76
|
+
* @property {StringSetting} from - Path to search for fonts.
|
|
77
|
+
* @property {StringSetting} to - Path to output fonts.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Configurations to minify and copy the images.
|
|
82
|
+
* @typedef {Object<string, Setting>} module:gulpConfig~ImageConfig
|
|
83
|
+
* @property {BooleanSetting} enabled - Toggle image minify and copy process.
|
|
84
|
+
* @property {StringSetting} from - Path to search for images.
|
|
85
|
+
* @property {StringSetting} to - Path to output images.
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Configurations to compile and generate the Readme file.
|
|
90
|
+
* @typedef {Object<string, Setting>} module:gulpConfig~ReadmeConfig
|
|
91
|
+
* @property {StringSetting} file - The name of the output documentation markdown file.
|
|
92
|
+
* @property {StringSetting} from - Location of files to use for compiling documentation into the readme.
|
|
93
|
+
* @property {ArrayableSetting} options - Options for formatting the output readme.
|
|
94
|
+
* @property {StringSetting} template - The file which will be pre-fixed to your README.md output.
|
|
95
|
+
* @property {StringSetting} to - The directory to output the readme file in.
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Configurations to compile and copy the sass files into css.
|
|
100
|
+
* @typedef {Object<string, Setting>} module:gulpConfig~SassConfig
|
|
101
|
+
* @property {BooleanSetting} enabled - Toggle SASS to CSS process on.
|
|
102
|
+
* @property {StringSetting} from - The pattern for finding all sass files.
|
|
103
|
+
* @property {StringSetting} path - The directory were sass files will be stored.
|
|
104
|
+
* @property {StringSetting} to - The destination path for where generated CSS (from SASS files) should go.
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Configurations for running the test suite.
|
|
109
|
+
* @typedef {Object<string, Setting>} module:gulpConfig~TestConfig
|
|
110
|
+
* @property {JestTestFlags} options - Additional flags for programmatically running Jest Cli.
|
|
111
|
+
* @property {ArrayableSetting} path - The directory where Jest test files are stored.
|
|
112
|
+
* By default, stored as *.test.js adjacent to the files they are testing.
|
|
113
|
+
* @property {ArrayableSetting} watch - The search pattern for watching files for changes.
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Configurations for compiling typescript into JS files.
|
|
118
|
+
* @typedef {Object<string, Setting>} module:gulpConfig~TsConfig
|
|
119
|
+
* @property {FlagStringSetting} config - The path the tsconfig file for running typescript or false if no ts file given.
|
|
120
|
+
* @property {BooleanSetting} enabled - Toggle usage of typescript parsing.
|
|
121
|
+
* @property {StringSetting} from - Pattern for finding the TypeScript files.
|
|
122
|
+
* @property {StringSetting} to - Directory where parsed typescript files go.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* A set of Configurations options defined by Settings.
|
|
127
|
+
* @typedef {Object<string, Setting>} module:gulpConfig~Configurations
|
|
128
|
+
* @property {BrowserConfig} browser - Browser bundling configuration group.
|
|
129
|
+
* @property {ArrayableSetting} cleanPaths - The paths for directories to delete before build.
|
|
130
|
+
* @property {DistConfig} dist - Distribution file generation configuration group.
|
|
131
|
+
* @property {FontConfig} fonts - Fonts copy configuration group.
|
|
132
|
+
* @property {ImageConfig} images - Minify and copy the images configuration.
|
|
133
|
+
* @property {ReadmeConfig} readme - Build readme files configuration.
|
|
134
|
+
* @property {StringSetting} rootPath - Base directory of the project.
|
|
135
|
+
* @property {SassConfig} sass - Compile CSS from SASS configuration.
|
|
136
|
+
* @property {StringSetting} srcPath - The directory where your source files are stored (the files you manually created).
|
|
137
|
+
* @property {TestConfig} test - Run test suite configuration.
|
|
138
|
+
* @property {TsConfig} typescript - Compile from typescript configuration.
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
import { dotGet } from './functions/utilities/dotGet.mjs'
|
|
142
|
+
import { dotSet } from './functions/utilities/dotSet.mjs'
|
|
143
|
+
import { dotNotate } from './functions/utilities/dotNotate.mjs'
|
|
144
|
+
import { readFileSync } from 'fs'
|
|
145
|
+
|
|
146
|
+
const setDefaults = {
|
|
147
|
+
browser: {
|
|
148
|
+
enabled: true,
|
|
149
|
+
from: 'dist/**/*.js',
|
|
150
|
+
name: 'default',
|
|
151
|
+
to: 'browser',
|
|
152
|
+
},
|
|
153
|
+
cleanPaths: ['dist', 'browser'],
|
|
154
|
+
dist: {
|
|
155
|
+
from: 'src/**/!(*.test).js',
|
|
156
|
+
main: 'dist/main',
|
|
157
|
+
to: 'dist',
|
|
158
|
+
},
|
|
159
|
+
fonts: {
|
|
160
|
+
enabled: false,
|
|
161
|
+
from: 'src/fonts/**/*',
|
|
162
|
+
to: 'browser/fonts',
|
|
163
|
+
},
|
|
164
|
+
images: {
|
|
165
|
+
enabled: false,
|
|
166
|
+
from: 'src/img/**/*.+(png|jpg|jpeg|gif|svg)',
|
|
167
|
+
to: 'browser/img',
|
|
168
|
+
},
|
|
169
|
+
readme: {
|
|
170
|
+
file: 'README.md',
|
|
171
|
+
from: 'src/**/!(*.test).js',
|
|
172
|
+
options: 'utf8',
|
|
173
|
+
template: 'MAIN.md',
|
|
174
|
+
to: './'
|
|
175
|
+
},
|
|
176
|
+
rootPath: './',
|
|
177
|
+
sass: {
|
|
178
|
+
enabled: false,
|
|
179
|
+
from: 'sass/**/*.+(scss|sass)',
|
|
180
|
+
path: 'sass',
|
|
181
|
+
to: 'browser/css',
|
|
182
|
+
},
|
|
183
|
+
srcPath: 'src',
|
|
184
|
+
test: {
|
|
185
|
+
options: {
|
|
186
|
+
clearCache: false,
|
|
187
|
+
debug: false,
|
|
188
|
+
ignoreProjects: false,
|
|
189
|
+
json: false,
|
|
190
|
+
selectProjects: false,
|
|
191
|
+
showConfig: false,
|
|
192
|
+
useStderr: false,
|
|
193
|
+
watch: false,
|
|
194
|
+
watchAll: false,
|
|
195
|
+
},
|
|
196
|
+
path: ['src'],
|
|
197
|
+
watch: 'src/**/*.js'
|
|
198
|
+
},
|
|
199
|
+
typescript: {
|
|
200
|
+
config: false,
|
|
201
|
+
enabled: false,
|
|
202
|
+
from: 'src/**/*.ts',
|
|
203
|
+
to: 'dist',
|
|
204
|
+
},
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* All the available configuration setting options for running the build.
|
|
209
|
+
* @memberOf module:gulpConfig` `
|
|
210
|
+
* @type {Configurations}
|
|
211
|
+
*/
|
|
212
|
+
let gulpConfigurations = null
|
|
213
|
+
|
|
214
|
+
if (fileExists('../../build-tools.config.json')) {
|
|
215
|
+
gulpConfigurations = JSON.parse(readFileSync('../../build-tools.config.json').toString())
|
|
216
|
+
} else {
|
|
217
|
+
if (fileExists('./build-tools.config.json')) {
|
|
218
|
+
gulpConfigurations = JSON.parse(readFileSync('./build-tools.config.json').toString())
|
|
219
|
+
} else {
|
|
220
|
+
console.warn('Missing config path, ensure you have a build-tools.config.js file in you project root')
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const notation = dotNotate(setDefaults)
|
|
225
|
+
for (let notationKey in notation) {
|
|
226
|
+
const arrayEnding = /(\.\d+)$/
|
|
227
|
+
if (arrayEnding.test(notationKey)) {
|
|
228
|
+
// ends in number a key then it must be an array; use the entire array
|
|
229
|
+
notationKey = notationKey.replace(arrayEnding, '')
|
|
230
|
+
}
|
|
231
|
+
const defaultValue = dotGet(setDefaults, notationKey)
|
|
232
|
+
const existingConfig = dotGet(gulpConfigurations, notationKey, defaultValue)
|
|
233
|
+
dotSet(gulpConfigurations, notationKey, existingConfig)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Retrieve a value from the configurations, default may be returned.
|
|
238
|
+
* @memberOf module:gulpConfig
|
|
239
|
+
* @param {string|null} path
|
|
240
|
+
* @param {*} defaultValue
|
|
241
|
+
* @returns {*|null}
|
|
242
|
+
*/
|
|
243
|
+
export const get = (path = null, defaultValue = null) => dotGet(gulpConfigurations, path, defaultValue)
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Specify a value for the configurations to use.
|
|
247
|
+
* @memberOf module:gulpConfig
|
|
248
|
+
* @param path
|
|
249
|
+
* @param value
|
|
250
|
+
* @returns {*}
|
|
251
|
+
*/
|
|
252
|
+
export const set = (path, value) => dotSet(gulpConfigurations, path, value)
|
package/gulpfile.base.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Export these functions to your own project
|
|
2
|
+
* Export these functions to your own project to customize your build pipeline.
|
|
3
3
|
* @file
|
|
4
4
|
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
5
5
|
* @version 3.0.0
|
|
6
6
|
* @module js-build-tools
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
const build = require('./
|
|
10
|
-
const bundle = require('./
|
|
11
|
-
const bundleLint = require('./
|
|
12
|
-
const bundleMinify = require('./
|
|
13
|
-
const compileReadme = require('./
|
|
14
|
-
const copyFonts = require('./
|
|
15
|
-
const defaultCmd = require('./
|
|
16
|
-
const dist = require('./
|
|
17
|
-
const distLint = require('./
|
|
18
|
-
const distMinify = require('./
|
|
9
|
+
const build = require('./dist/build.js')
|
|
10
|
+
const bundle = require('./dist/bundle.js')
|
|
11
|
+
const bundleLint = require('./dist/bundleLint.js')
|
|
12
|
+
const bundleMinify = require('./dist/bundleMinify.js')
|
|
13
|
+
const compileReadme = require('./dist/compileReadme.js')
|
|
14
|
+
const copyFonts = require('./dist/copyFonts.js')
|
|
15
|
+
const defaultCmd = require('./dist/default.js')
|
|
16
|
+
const dist = require('./dist/dist.js')
|
|
17
|
+
const distLint = require('./dist/distLint.js')
|
|
18
|
+
const distMinify = require('./dist/distMinify.js')
|
|
19
19
|
const gulpConfig = require('./gulp.config.js')
|
|
20
|
-
const images = require('./
|
|
21
|
-
const partials = require('./
|
|
22
|
-
const sass = require('./
|
|
23
|
-
const testFull = require('./
|
|
24
|
-
const testHelpers = require('./
|
|
25
|
-
const testQuick = require('./
|
|
26
|
-
const typescript = require('./
|
|
27
|
-
const watchFull = require('./
|
|
28
|
-
const watchTest = require('./
|
|
20
|
+
const images = require('./dist/images.js')
|
|
21
|
+
const partials = require('./dist/partials.js')
|
|
22
|
+
const sass = require('./dist/sass.js')
|
|
23
|
+
const testFull = require('./dist/testFull.js')
|
|
24
|
+
const testHelpers = require('./dist/testHelpers.js')
|
|
25
|
+
const testQuick = require('./dist/testQuick.js')
|
|
26
|
+
const typescript = require('./dist/typeScript')
|
|
27
|
+
const watchFull = require('./dist/watchFull.js')
|
|
28
|
+
const watchTest = require('./dist/watchTest.js')
|
|
29
29
|
|
|
30
30
|
module.exports = {
|
|
31
31
|
build,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* import these functions to your own project to customize your build pipeline.
|
|
3
|
+
* @file
|
|
4
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
5
|
+
* @version 3.0.0
|
|
6
|
+
* @module js-build-tools
|
|
7
|
+
*/
|
|
8
|
+
export { build } from './functions/build.mjs'
|
|
9
|
+
export { bundle } from './functions/bundle.mjs'
|
|
10
|
+
export { bundleLint } from './functions/bundleLint.mjs'
|
|
11
|
+
export { bundleMinify } from './functions/bundleMinify.mjs'
|
|
12
|
+
export { compileReadme as readme } from './functions/compileReadme.mjs'
|
|
13
|
+
export { copyFonts } from './functions/copyFonts.mjs'
|
|
14
|
+
export { defaultCmd } from './functions/default.mjs'
|
|
15
|
+
export { dist } from './functions/dist.mjs'
|
|
16
|
+
export { distLint } from './functions/distLint.mjs'
|
|
17
|
+
export { distMinify } from './functions/distMinify.mjs'
|
|
18
|
+
export * as gulpConfig from './gulp.config.mjs'
|
|
19
|
+
export { images } from './functions/images.mjs'
|
|
20
|
+
export * as partials from './functions/partials.mjs'
|
|
21
|
+
export { sass } from './functions/sass.mjs'
|
|
22
|
+
export { testFull } from './functions/testFull.mjs'
|
|
23
|
+
export * as testHelpers from './functions/testHelpers.mjs'
|
|
24
|
+
export { testQuick } from './functions/testQuick.mjs'
|
|
25
|
+
export { typeScript as typescript } from './functions/typeScript.mjs'
|
|
26
|
+
export { watchFull } from './functions/watchFull.mjs'
|
|
27
|
+
export { watchTest } from './functions/watchTest.mjs'
|
package/package.json
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js-build-tools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Standardised build process with gulp.",
|
|
5
5
|
"main": "gulpfile.base.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"node": "./gulpfile.base.js",
|
|
9
|
+
"default": "./gulpfile.base.mjs"
|
|
10
|
+
},
|
|
11
|
+
"./babel.config": "./babel.config.js",
|
|
12
|
+
"./gulp.config": "./gulp.config.js",
|
|
13
|
+
"./gulp.config.mjs": "./gulp.config.mjs",
|
|
14
|
+
"./gulpfile.base": "./gulpfile.base.js",
|
|
15
|
+
"./gulpfile.base.mjs": "./gulpfile.base.mjs",
|
|
16
|
+
"./jsdoc.base": "./jsdoc.base.js"
|
|
17
|
+
},
|
|
6
18
|
"scripts": {
|
|
7
19
|
"build": "gulp build",
|
|
8
20
|
"dev": "gulp",
|
|
@@ -32,17 +44,17 @@
|
|
|
32
44
|
]
|
|
33
45
|
},
|
|
34
46
|
"dependencies": {
|
|
35
|
-
"@babel/core": "^7.24.
|
|
36
|
-
"@babel/plugin-
|
|
37
|
-
"@babel/preset-env": "^7.24.
|
|
38
|
-
"@babel/preset-typescript": "^7.
|
|
39
|
-
"@babel/runtime-corejs3": "^7.24.
|
|
47
|
+
"@babel/core": "^7.24.6",
|
|
48
|
+
"@babel/plugin-transform-modules-commonjs": "^7.24.6",
|
|
49
|
+
"@babel/preset-env": "^7.24.6",
|
|
50
|
+
"@babel/preset-typescript": "^7.24.6",
|
|
51
|
+
"@babel/runtime-corejs3": "^7.24.6",
|
|
40
52
|
"babel-jest": "^29.7.0",
|
|
41
53
|
"browserify": "^17.0.0",
|
|
42
|
-
"core-js": "^3.
|
|
54
|
+
"core-js": "^3.37.1",
|
|
43
55
|
"fs": "^0.0.1-security",
|
|
44
|
-
"glob": "^10.
|
|
45
|
-
"gulp": "^
|
|
56
|
+
"glob": "^10.4.1",
|
|
57
|
+
"gulp": "^5.0.0",
|
|
46
58
|
"gulp-babel": "^8.0.0",
|
|
47
59
|
"gulp-cache": "^1.1.3",
|
|
48
60
|
"gulp-cssnano": "^2.1.3",
|
|
@@ -56,8 +68,9 @@
|
|
|
56
68
|
"jest-environment-jsdom": "^29.7.0",
|
|
57
69
|
"jsdoc-to-markdown": "^8.0.1",
|
|
58
70
|
"regenerator-runtime": "^0.14.1",
|
|
59
|
-
"sass": "^1.
|
|
60
|
-
"test-filesystem": "^1.3.
|
|
71
|
+
"sass": "^1.77.4",
|
|
72
|
+
"test-filesystem": "^1.3.5",
|
|
73
|
+
"through2": "^4.0.2",
|
|
61
74
|
"vinyl-source-stream": "^2.0.0"
|
|
62
75
|
},
|
|
63
76
|
"files": [
|
|
@@ -65,9 +78,10 @@
|
|
|
65
78
|
"dist",
|
|
66
79
|
"functions",
|
|
67
80
|
"gulpfile.base.js",
|
|
81
|
+
"gulpfile.base.mjs",
|
|
68
82
|
"gulp.config.js",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
83
|
+
"gulp.config.mjs",
|
|
84
|
+
"jsdoc.base.js"
|
|
71
85
|
],
|
|
72
86
|
"funding": "https://www.paypal.com/donate/?business=LRYR6SZRWKXVY&no_recurring=0&item_name=Let%27s+build+together+today+to+simplify+our+jobs+tomorrow.¤cy_code=CAD"
|
|
73
87
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const gulpConfig = require('../gulp.config.js')
|
|
2
|
-
const minifyFor = require('./partials/minifyFor')
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Creates the minified bundle file.
|
|
6
|
-
* @memberOf module:js-build-tools
|
|
7
|
-
* @returns {*}
|
|
8
|
-
*/
|
|
9
|
-
const bundleMinify = () => minifyFor(`${gulpConfig.get('browser.to')}/${gulpConfig.get('browser.name')}.js`, gulpConfig.get('browser.to'))
|
|
10
|
-
|
|
11
|
-
module.exports = bundleMinify
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const { setUp } = require('./testHelpers')
|
|
2
|
-
const gulpConfig = setUp.gulpConfig
|
|
3
|
-
const bundleMinify = require('./bundleMinify')
|
|
4
|
-
const minifyFor = require('./partials/minifyFor')
|
|
5
|
-
|
|
6
|
-
jest.mock('./partials/minifyFor', () => jest.fn(() => Promise.resolve(true)))
|
|
7
|
-
|
|
8
|
-
describe('bundleMinify', () => {
|
|
9
|
-
test('calls minifyFor with configurations', () => {
|
|
10
|
-
expect.assertions(1)
|
|
11
|
-
bundleMinify()
|
|
12
|
-
expect(minifyFor).toHaveBeenCalledWith(`${gulpConfig.get('browser.to')}/${gulpConfig.get('browser.name')}.js`, gulpConfig.get('browser.to'))
|
|
13
|
-
})
|
|
14
|
-
})
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const { addToReadme, readmeTemplate } = require('./partials')
|
|
2
|
-
const { series } = require('gulp')
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Generate the README.md file based off of the template, then append the generated documentation.
|
|
6
|
-
* @memberOf module:js-build-tools
|
|
7
|
-
* @returns {stream.Stream}
|
|
8
|
-
*/
|
|
9
|
-
const compileReadme = series(readmeTemplate, addToReadme)
|
|
10
|
-
|
|
11
|
-
module.exports = compileReadme
|