js-build-tools 3.0.4 → 4.0.0
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 +431 -691
- package/babel.config.js +1 -1
- package/dist/build.js +58 -59
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +17 -12
- package/dist/bundle.min.js +1 -1
- package/dist/bundleLint.js +21 -17
- package/dist/bundleLint.min.js +1 -1
- package/dist/bundleMinify.js +14 -8
- package/dist/bundleMinify.min.js +1 -1
- package/dist/compileReadme.js +10 -13
- package/dist/compileReadme.min.js +1 -1
- package/dist/copyFonts.js +14 -8
- package/dist/copyFonts.min.js +1 -1
- package/dist/default.js +19 -15
- package/dist/default.min.js +1 -1
- package/dist/dist.js +10 -7
- package/dist/dist.min.js +1 -1
- package/dist/distLint.js +21 -17
- package/dist/distLint.min.js +1 -1
- package/dist/distMinify.js +14 -8
- package/dist/distMinify.min.js +1 -1
- package/dist/images.js +10 -7
- package/dist/images.min.js +1 -1
- package/dist/partials/addToReadme.js +19 -14
- package/dist/partials/beginWatcher.js +14 -10
- package/dist/partials/clean.js +17 -11
- package/dist/partials/copyFor.js +10 -10
- package/dist/partials/distFor.js +27 -17
- package/dist/partials/distForSrc.js +16 -10
- package/dist/partials/distSeries.js +24 -20
- package/dist/partials/imagesFor.js +27 -28
- package/dist/partials/minifyFor.js +17 -16
- package/dist/partials/readmeTemplate.js +16 -12
- package/dist/partials/removeDirectory.js +12 -12
- package/dist/partials/runOnChange.js +30 -28
- package/dist/partials/sassFor.js +28 -21
- package/dist/partials/tsFor.js +24 -21
- package/dist/partials.js +103 -41
- package/dist/partials.min.js +1 -1
- package/dist/sass.js +10 -7
- package/dist/sass.min.js +1 -1
- package/dist/test-helpers/setUp.js +68 -65
- package/dist/testFull.js +22 -17
- package/dist/testFull.min.js +1 -1
- package/dist/testHelpers.js +11 -15
- package/dist/testHelpers.min.js +1 -1
- package/dist/testQuick.js +24 -19
- package/dist/testQuick.min.js +1 -1
- package/dist/typeScript.js +9 -7
- package/dist/typeScript.min.js +1 -1
- package/dist/utilities/dotGet.js +45 -43
- package/dist/utilities/dotNotate.js +53 -51
- package/dist/utilities/dotSet.js +39 -37
- package/dist/utilities/isObject.js +9 -5
- package/dist/utilities/strAfter.js +18 -14
- package/dist/utilities/strBefore.js +18 -14
- package/dist/watchFull.js +10 -10
- package/dist/watchFull.min.js +1 -1
- package/dist/watchTest.js +17 -13
- 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 +19 -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
|
@@ -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,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js-build-tools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Standardised build process with gulp.",
|
|
5
5
|
"main": "gulpfile.base.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
"import": "./gulpfile.base.mjs",
|
|
8
|
+
"require": "./gulpfile.base.js"
|
|
9
|
+
},
|
|
6
10
|
"scripts": {
|
|
7
11
|
"build": "gulp build",
|
|
8
12
|
"dev": "gulp",
|
|
@@ -32,17 +36,17 @@
|
|
|
32
36
|
]
|
|
33
37
|
},
|
|
34
38
|
"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.
|
|
39
|
+
"@babel/core": "^7.24.6",
|
|
40
|
+
"@babel/plugin-transform-modules-commonjs": "^7.24.6",
|
|
41
|
+
"@babel/preset-env": "^7.24.6",
|
|
42
|
+
"@babel/preset-typescript": "^7.24.6",
|
|
43
|
+
"@babel/runtime-corejs3": "^7.24.6",
|
|
40
44
|
"babel-jest": "^29.7.0",
|
|
41
45
|
"browserify": "^17.0.0",
|
|
42
|
-
"core-js": "^3.
|
|
46
|
+
"core-js": "^3.37.1",
|
|
43
47
|
"fs": "^0.0.1-security",
|
|
44
|
-
"glob": "^10.
|
|
45
|
-
"gulp": "^
|
|
48
|
+
"glob": "^10.4.1",
|
|
49
|
+
"gulp": "^5.0.0",
|
|
46
50
|
"gulp-babel": "^8.0.0",
|
|
47
51
|
"gulp-cache": "^1.1.3",
|
|
48
52
|
"gulp-cssnano": "^2.1.3",
|
|
@@ -56,8 +60,9 @@
|
|
|
56
60
|
"jest-environment-jsdom": "^29.7.0",
|
|
57
61
|
"jsdoc-to-markdown": "^8.0.1",
|
|
58
62
|
"regenerator-runtime": "^0.14.1",
|
|
59
|
-
"sass": "^1.
|
|
60
|
-
"test-filesystem": "^1.3.
|
|
63
|
+
"sass": "^1.77.4",
|
|
64
|
+
"test-filesystem": "^1.3.5",
|
|
65
|
+
"through2": "^4.0.2",
|
|
61
66
|
"vinyl-source-stream": "^2.0.0"
|
|
62
67
|
},
|
|
63
68
|
"files": [
|
|
@@ -65,9 +70,10 @@
|
|
|
65
70
|
"dist",
|
|
66
71
|
"functions",
|
|
67
72
|
"gulpfile.base.js",
|
|
73
|
+
"gulpfile.base.mjs",
|
|
68
74
|
"gulp.config.js",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
75
|
+
"gulp.config.mjs",
|
|
76
|
+
"jsdoc.base.js"
|
|
71
77
|
],
|
|
72
78
|
"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
79
|
}
|
|
@@ -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
|
package/functions/copyFonts.js
DELETED
|
@@ -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
|
package/functions/default.js
DELETED
|
@@ -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
|
package/functions/distMinify.js
DELETED
|
@@ -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
|