js-build-tools 2.4.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +334 -205
- package/dist/build.js +59 -48
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +12 -13
- package/dist/bundle.min.js +1 -1
- package/dist/bundleLint.js +17 -18
- package/dist/bundleLint.min.js +1 -1
- package/dist/bundleMinify.js +8 -9
- package/dist/bundleMinify.min.js +1 -1
- package/dist/copyFonts.js +12 -0
- package/dist/copyFonts.min.js +1 -0
- package/dist/default.js +1 -1
- package/dist/default.min.js +1 -1
- package/dist/dist.js +7 -8
- package/dist/distLint.js +17 -18
- package/dist/distLint.min.js +1 -1
- package/dist/distMinify.js +8 -9
- package/dist/distMinify.min.js +1 -1
- package/dist/images.js +11 -0
- package/dist/images.min.js +1 -0
- package/dist/partials/addToReadme.js +13 -14
- package/dist/partials/beginWatcher.js +9 -10
- package/dist/partials/clean.js +10 -11
- package/dist/partials/copyFor.js +16 -0
- package/dist/partials/distFor.js +16 -17
- package/dist/partials/distForSrc.js +9 -10
- package/dist/partials/distSeries.js +19 -20
- package/dist/partials/imagesFor.js +34 -0
- package/dist/partials/minifyFor.js +15 -16
- package/dist/partials/readmeTemplate.js +11 -12
- package/dist/partials/removeDirectory.js +11 -12
- package/dist/partials/runOnChange.js +27 -27
- package/dist/partials/sassFor.js +20 -21
- package/dist/partials/tsFor.js +20 -21
- package/dist/partials.js +35 -31
- package/dist/partials.min.js +1 -1
- package/dist/test-helpers/setUp.js +52 -60
- package/dist/testFull.js +17 -18
- package/dist/testFull.min.js +1 -1
- package/dist/testHelpers.js +10 -28
- package/dist/testHelpers.min.js +1 -1
- package/dist/testQuick.js +19 -20
- package/dist/testQuick.min.js +1 -1
- package/dist/typeScript.js +7 -8
- package/dist/utilities/dotGet.js +50 -0
- package/dist/utilities/dotNotate.js +77 -0
- package/dist/utilities/dotSet.js +44 -0
- package/dist/utilities/isObject.js +10 -0
- package/dist/utilities/strAfter.js +14 -0
- package/dist/utilities/strBefore.js +14 -0
- package/dist/watchFull.js +10 -11
- package/dist/watchTest.js +13 -14
- package/dist/watchTest.min.js +1 -1
- package/functions/build.js +15 -5
- package/functions/build.test.js +278 -42
- package/functions/bundle.js +3 -4
- package/functions/bundle.test.js +6 -6
- package/functions/bundleLint.js +2 -3
- package/functions/bundleLint.test.js +5 -5
- package/functions/bundleMinify.js +1 -2
- package/functions/bundleMinify.test.js +1 -1
- package/functions/copyFonts.js +11 -0
- package/functions/copyFonts.test.js +31 -0
- package/functions/default.js +1 -1
- package/functions/default.test.js +2 -2
- package/functions/dist.js +0 -1
- package/functions/dist.test.js +1 -1
- package/functions/distLint.js +2 -3
- package/functions/distLint.test.js +3 -3
- package/functions/distMinify.js +1 -2
- package/functions/distMinify.test.js +1 -1
- package/functions/images.js +10 -0
- package/functions/images.test.js +138 -0
- package/functions/partials/addToReadme.js +2 -3
- package/functions/partials/addToReadme.test.js +2 -2
- package/functions/partials/beginWatcher.js +1 -2
- package/functions/partials/beginWatcher.test.js +1 -1
- package/functions/partials/clean.js +0 -1
- package/functions/partials/copyFor.js +13 -0
- package/functions/partials/copyFor.test.js +34 -0
- package/functions/partials/distFor.js +1 -2
- package/functions/partials/distFor.test.js +4 -4
- package/functions/partials/distForSrc.js +3 -4
- package/functions/partials/distForSrc.test.js +6 -6
- package/functions/partials/distSeries.js +2 -3
- package/functions/partials/distSeries.test.js +5 -5
- package/functions/partials/imagesFor.js +33 -0
- package/functions/partials/imagesFor.test.js +143 -0
- package/functions/partials/minifyFor.js +0 -1
- package/functions/partials/minifyFor.test.js +1 -1
- package/functions/partials/readmeTemplate.js +3 -4
- package/functions/partials/readmeTemplate.test.js +2 -2
- package/functions/partials/removeDirectory.js +0 -1
- package/functions/partials/runOnChange.js +5 -6
- package/functions/partials/runOnChange.test.js +9 -9
- package/functions/partials/sassFor.js +1 -2
- package/functions/partials/sassFor.test.js +3 -3
- package/functions/partials/tsFor.js +3 -4
- package/functions/partials/tsFor.test.js +2 -2
- package/functions/partials.js +5 -1
- package/functions/partials.test.js +1 -1
- package/functions/sass.test.js +2 -2
- package/functions/test-helpers/setUp.js +24 -32
- package/functions/testFull.js +2 -3
- package/functions/testFull.test.js +1 -1
- package/functions/testHelpers.js +3 -20
- package/functions/testHelpers.test.js +1 -1
- package/functions/testQuick.js +1 -2
- package/functions/testQuick.test.js +1 -1
- package/functions/typeScript.js +0 -1
- package/functions/typeScript.test.js +0 -2
- package/functions/utilities/dotGet.js +47 -0
- package/functions/utilities/dotNotate.js +68 -0
- package/functions/utilities/dotSet.js +41 -0
- package/functions/utilities/isObject.js +9 -0
- package/functions/utilities/strAfter.js +13 -0
- package/functions/utilities/strBefore.js +13 -0
- package/functions/watchFull.js +0 -1
- package/functions/watchFull.test.js +1 -1
- package/functions/watchTest.js +1 -2
- package/functions/watchTest.test.js +1 -1
- package/gulp.config.js +153 -79
- package/gulpfile.base.js +5 -1
- package/jsdoc.base.js +1 -1
- package/package.json +13 -9
- package/vendor/array-union/index.js +31 -0
- package/vendor/easy-transform-stream/index.js +54 -0
- package/vendor/globby/gitignore.js +96 -0
- package/vendor/globby/index.js +191 -0
- package/vendor/globby/node_modules/slash/index.js +16 -0
- package/vendor/globby/stream-utils.js +58 -0
- package/vendor/globby/to-path.js +20 -0
- package/vendor/gulp-imagemin/index.js +128 -0
- package/vendor/gulp-imagemin/node_modules/chalk/source/index.js +265 -0
- package/vendor/gulp-imagemin/node_modules/chalk/source/utilities.js +36 -0
- package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/ansi-styles/index.js +217 -0
- package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/supports-color/index.js +154 -0
- package/vendor/gulp-plugin-extras/index.js +42 -0
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/index.js +265 -0
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/utilities.js +36 -0
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/ansi-styles/index.js +217 -0
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/supports-color/index.js +154 -0
- package/vendor/gulp-plugin-extras/plugin-error.js +145 -0
- package/vendor/ignore/index.js +468 -0
- package/vendor/imagemin/index.js +90 -0
- package/vendor/imagemin-gifsicle/index.js +33 -0
- package/vendor/imagemin-mozjpeg/index.js +100 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/index.js +260 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/command.js +47 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/error.js +102 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/kill.js +123 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/promise.js +47 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stdio.js +50 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stream.js +124 -0
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/core.js +238 -0
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/main.js +89 -0
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/realtime.js +24 -0
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/signals.js +44 -0
- package/vendor/imagemin-mozjpeg/node_modules/is-stream/index.js +25 -0
- package/vendor/imagemin-mozjpeg/node_modules/mimic-fn/index.js +70 -0
- package/vendor/imagemin-mozjpeg/node_modules/npm-run-path/index.js +52 -0
- package/vendor/imagemin-mozjpeg/node_modules/onetime/index.js +43 -0
- package/vendor/imagemin-mozjpeg/node_modules/path-key/index.js +20 -0
- package/vendor/imagemin-mozjpeg/node_modules/strip-final-newline/index.js +17 -0
- package/vendor/imagemin-optipng/index.js +44 -0
- package/vendor/imagemin-svgo/index.js +27 -0
- package/vendor/is-jpg/index.js +12 -0
- package/vendor/junk/index.js +49 -0
- package/vendor/mozjpeg/index.js +9 -0
- package/vendor/mozjpeg/lib/index.js +18 -0
- package/vendor/mozjpeg/package.json +49 -0
- package/vendor/mozjpeg/vendor/cjpeg +0 -0
- package/vendor/mozjpeg/vendor/source/mozjpeg.tar.gz +0 -0
- package/vendor/p-pipe/index.js +22 -0
- package/vendor/plur/index.js +32 -0
- package/vendor/pretty-bytes/index.js +71 -0
- package/vendor/slash/index.js +12 -0
- package/dist/test-helpers/circularObject.js +0 -50
- package/dist/test-helpers/countMatches.js +0 -12
- package/dist/test-helpers/deepReferenceObject.js +0 -20
- package/dist/test-helpers/domItem.js +0 -33
- package/dist/test-helpers/jsonDom.js +0 -20
- package/dist/test-helpers/linkedList.js +0 -23
- package/dist/test-helpers/logObject.js +0 -21
- package/dist/test-helpers/multiReferenceObject.js +0 -20
- package/dist/test-helpers/nodeTree.js +0 -28
- package/functions/test-helpers/circularObject.js +0 -28
- package/functions/test-helpers/circularObject.test.js +0 -14
- package/functions/test-helpers/countMatches.js +0 -11
- package/functions/test-helpers/countMatches.test.js +0 -9
- package/functions/test-helpers/deepReferenceObject.js +0 -25
- package/functions/test-helpers/deepReferenceObject.test.js +0 -7
- package/functions/test-helpers/domItem.js +0 -31
- package/functions/test-helpers/domItem.test.js +0 -12
- package/functions/test-helpers/jsonDom.js +0 -16
- package/functions/test-helpers/jsonDom.test.js +0 -12
- package/functions/test-helpers/linkedList.js +0 -10
- package/functions/test-helpers/linkedList.test.js +0 -22
- package/functions/test-helpers/logObject.js +0 -18
- package/functions/test-helpers/logObject.test.js +0 -20
- package/functions/test-helpers/multiReferenceObject.js +0 -25
- package/functions/test-helpers/multiReferenceObject.test.js +0 -14
- package/functions/test-helpers/nodeTree.js +0 -11
- package/functions/test-helpers/nodeTree.test.js +0 -18
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
dest,
|
|
5
|
-
src
|
|
6
|
-
} = require('gulp');
|
|
7
|
-
const {
|
|
8
|
-
default: uglify
|
|
9
|
-
} = require('gulp-uglify-es');
|
|
10
|
-
const rename = require('gulp-rename');
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
dest,
|
|
5
|
+
src
|
|
6
|
+
} = require('gulp');
|
|
7
|
+
const {
|
|
8
|
+
default: uglify
|
|
9
|
+
} = require('gulp-uglify-es');
|
|
10
|
+
const rename = require('gulp-rename');
|
|
11
|
+
|
|
12
12
|
/**
|
|
13
13
|
* Minify files and rename the output with '.min' extension.
|
|
14
|
-
* @function
|
|
15
14
|
* @memberOf module:partials
|
|
16
15
|
* @returns {*}
|
|
17
|
-
*/
|
|
18
|
-
const minifyFor = (srcSearch, destination) => src(srcSearch).pipe(uglify()).pipe(rename({
|
|
19
|
-
extname: '.min.js'
|
|
20
|
-
})).pipe(dest(destination));
|
|
16
|
+
*/
|
|
17
|
+
const minifyFor = (srcSearch, destination) => src(srcSearch).pipe(uglify()).pipe(rename({
|
|
18
|
+
extname: '.min.js'
|
|
19
|
+
})).pipe(dest(destination));
|
|
21
20
|
module.exports = minifyFor;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
dest,
|
|
5
|
-
src
|
|
6
|
-
} = require('gulp');
|
|
7
|
-
const gulpConfig = require('../../gulp.config.js');
|
|
8
|
-
const rename = require('gulp-rename');
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
dest,
|
|
5
|
+
src
|
|
6
|
+
} = require('gulp');
|
|
7
|
+
const gulpConfig = require('../../gulp.config.js');
|
|
8
|
+
const rename = require('gulp-rename');
|
|
9
|
+
|
|
10
10
|
/**
|
|
11
11
|
* Copy a readme template into the README.md file.
|
|
12
|
-
* @function
|
|
13
12
|
* @memberOf module:partials
|
|
14
13
|
* @returns {*}
|
|
15
|
-
*/
|
|
16
|
-
const readmeTemplate = () => src(gulpConfig.get('
|
|
14
|
+
*/
|
|
15
|
+
const readmeTemplate = () => src(gulpConfig.get('readme.template')).pipe(rename(gulpConfig.get('readme.file'))).pipe(dest(gulpConfig.get('readme.to')));
|
|
17
16
|
module.exports = readmeTemplate;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
rm,
|
|
5
|
-
exists
|
|
6
|
-
} = require('fs');
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
rm,
|
|
5
|
+
exists
|
|
6
|
+
} = require('fs');
|
|
7
|
+
|
|
8
8
|
/**
|
|
9
9
|
* Return a promise to be completed once the specified directory is deleted.
|
|
10
|
-
* @function
|
|
11
10
|
* @memberOf module:partials
|
|
12
11
|
* @param {string} dirPath
|
|
13
12
|
* @returns {Promise<*>}
|
|
14
|
-
*/
|
|
15
|
-
const removeDirectory = dirPath => new Promise((resolve, reject) => exists(dirPath, doesExist => doesExist ? rm(dirPath, {
|
|
16
|
-
recursive: true
|
|
17
|
-
}, error => error ? reject(error) : resolve(dirPath)) : resolve(dirPath)));
|
|
13
|
+
*/
|
|
14
|
+
const removeDirectory = dirPath => new Promise((resolve, reject) => exists(dirPath, doesExist => doesExist ? rm(dirPath, {
|
|
15
|
+
recursive: true
|
|
16
|
+
}, error => error ? reject(error) : resolve(dirPath)) : resolve(dirPath)));
|
|
18
17
|
module.exports = removeDirectory;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.string.replace.js");
|
|
4
|
+
const gulpConfig = require('../../gulp.config.js');
|
|
5
|
+
const bundle = require('../bundle');
|
|
6
|
+
const distSeries = require('./distSeries');
|
|
7
|
+
const {
|
|
8
|
+
parallel,
|
|
9
|
+
series
|
|
10
|
+
} = require('gulp');
|
|
11
|
+
const testQuick = require('../testQuick');
|
|
12
|
+
|
|
12
13
|
/**
|
|
13
14
|
* Run this function when the watched files are modified.
|
|
14
15
|
* 1. Find the sub-folders within src path
|
|
@@ -30,15 +31,14 @@ const testQuick = require('../testQuick');
|
|
|
30
31
|
*
|
|
31
32
|
* // The resulting replaced path for the destination folder
|
|
32
33
|
* distPathResult = 'dist/some/path/'
|
|
33
|
-
* @function
|
|
34
34
|
* @memberOf module:partials
|
|
35
35
|
* @param {string} path
|
|
36
36
|
* @returns {stream.Stream}
|
|
37
|
-
*/
|
|
38
|
-
const runOnChange = path => {
|
|
39
|
-
const useTs = gulpConfig.get('
|
|
40
|
-
const distPath = gulpConfig.get('
|
|
41
|
-
const srcPath = gulpConfig.get('srcPath');
|
|
37
|
+
*/
|
|
38
|
+
const runOnChange = path => {
|
|
39
|
+
const useTs = gulpConfig.get('typescript.enabled');
|
|
40
|
+
const distPath = gulpConfig.get('dist.to');
|
|
41
|
+
const srcPath = gulpConfig.get('srcPath');
|
|
42
42
|
/**
|
|
43
43
|
* 1. The original path comes in from src and is a .ts
|
|
44
44
|
* 2. Discover the outgoing dist path where that file should go
|
|
@@ -46,14 +46,14 @@ const runOnChange = path => {
|
|
|
46
46
|
* 4. Take the original path, convert to full file path in dist
|
|
47
47
|
* 5. Use the dist path found previously in #2
|
|
48
48
|
* 6. Use the full dist path and the dist outgoing path in distFor
|
|
49
|
-
*/
|
|
50
|
-
const pathRegex = new RegExp(
|
|
51
|
-
const distPathResult = path.replace(pathRegex,
|
|
52
|
-
let distSrcPath = path;
|
|
53
|
-
if (useTs) {
|
|
54
|
-
distSrcPath = path.replace(pathRegex,
|
|
55
|
-
}
|
|
56
|
-
const runSeries = distSeries(distSrcPath, distPathResult, path);
|
|
57
|
-
return gulpConfig.get('
|
|
58
|
-
};
|
|
49
|
+
*/
|
|
50
|
+
const pathRegex = new RegExp("^".concat(srcPath, "(.*\\/)(.+)\\.(js|ts)$"), 'i');
|
|
51
|
+
const distPathResult = path.replace(pathRegex, "".concat(distPath, "$1"));
|
|
52
|
+
let distSrcPath = path;
|
|
53
|
+
if (useTs) {
|
|
54
|
+
distSrcPath = path.replace(pathRegex, "".concat(distPath, "$1$2.js"));
|
|
55
|
+
}
|
|
56
|
+
const runSeries = distSeries(distSrcPath, distPathResult, path);
|
|
57
|
+
return gulpConfig.get('browser.enabled') ? parallel(testQuick, series(runSeries, bundle))() : series(testQuick, runSeries)();
|
|
58
|
+
};
|
|
59
59
|
module.exports = runOnChange;
|
package/dist/partials/sassFor.js
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
dest,
|
|
5
|
-
src
|
|
6
|
-
} = require('gulp');
|
|
7
|
-
const gulpConfig = require('../../gulp.config.js');
|
|
8
|
-
const cssnano = require('gulp-cssnano');
|
|
9
|
-
const rename = require('gulp-rename');
|
|
10
|
-
const sass = require('gulp-sass')(require('sass'));
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
dest,
|
|
5
|
+
src
|
|
6
|
+
} = require('gulp');
|
|
7
|
+
const gulpConfig = require('../../gulp.config.js');
|
|
8
|
+
const cssnano = require('gulp-cssnano');
|
|
9
|
+
const rename = require('gulp-rename');
|
|
10
|
+
const sass = require('gulp-sass')(require('sass'));
|
|
11
|
+
|
|
12
12
|
/**
|
|
13
13
|
* Build the CSS for a given source pattern.
|
|
14
|
-
* @function
|
|
15
14
|
* @memberOf module:partials
|
|
16
15
|
* @param {string|array} [srcSearch='src/config/path/sass/for']
|
|
17
16
|
* @param {string} [cssPath='css/config/path']
|
|
18
17
|
* @returns {stream.Stream}
|
|
19
|
-
*/
|
|
20
|
-
const sassFor = function () {
|
|
21
|
-
let srcSearch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gulpConfig.get('
|
|
22
|
-
let cssPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gulpConfig.get('
|
|
23
|
-
return src(srcSearch).pipe(sass().on('error', sass.logError)) // Passes it through a gulp-sass, log errors to console
|
|
24
|
-
.pipe(dest(cssPath)).pipe(cssnano()).pipe(rename({
|
|
25
|
-
extname: '.min.css'
|
|
26
|
-
})).pipe(dest(cssPath));
|
|
27
|
-
};
|
|
18
|
+
*/
|
|
19
|
+
const sassFor = function () {
|
|
20
|
+
let srcSearch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gulpConfig.get('sass.from');
|
|
21
|
+
let cssPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gulpConfig.get('sass.to');
|
|
22
|
+
return src(srcSearch).pipe(sass().on('error', sass.logError)) // Passes it through a gulp-sass, log errors to console
|
|
23
|
+
.pipe(dest(cssPath)).pipe(cssnano()).pipe(rename({
|
|
24
|
+
extname: '.min.css'
|
|
25
|
+
})).pipe(dest(cssPath));
|
|
26
|
+
};
|
|
28
27
|
module.exports = sassFor;
|
package/dist/partials/tsFor.js
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
dest,
|
|
5
|
-
parallel,
|
|
6
|
-
src
|
|
7
|
-
} = require('gulp');
|
|
8
|
-
const gulpConfig = require('../../gulp.config.js');
|
|
9
|
-
const ts = require('gulp-typescript');
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
dest,
|
|
5
|
+
parallel,
|
|
6
|
+
src
|
|
7
|
+
} = require('gulp');
|
|
8
|
+
const gulpConfig = require('../../gulp.config.js');
|
|
9
|
+
const ts = require('gulp-typescript');
|
|
10
|
+
|
|
11
11
|
/**
|
|
12
12
|
* Starting at the source directory, find all the ts files and convert them into the distribution directory.
|
|
13
|
-
* @function
|
|
14
13
|
* @memberOf module:partials
|
|
15
14
|
* @param {string|array} [srcPath='']
|
|
16
15
|
* @param {string} [distPath='']
|
|
17
16
|
* @returns {Function}
|
|
18
17
|
* @see `https://www.typescriptlang.org/docs/handbook/gulp.html` for more info
|
|
19
|
-
*/
|
|
20
|
-
const tsFor = function () {
|
|
21
|
-
let srcPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gulpConfig.get('
|
|
22
|
-
let distPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gulpConfig.get('
|
|
23
|
-
const declarationProject = ts.createProject(gulpConfig.get('
|
|
24
|
-
const tsProject = ts.createProject(gulpConfig.get('
|
|
25
|
-
const makeDeclarations = () => src(srcPath).pipe(declarationProject()).dts.pipe(dest(distPath));
|
|
26
|
-
const compileJS = () => src(srcPath).pipe(tsProject()).js.pipe(dest(distPath));
|
|
27
|
-
return parallel(makeDeclarations, compileJS);
|
|
28
|
-
};
|
|
18
|
+
*/
|
|
19
|
+
const tsFor = function () {
|
|
20
|
+
let srcPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gulpConfig.get('typescript.from');
|
|
21
|
+
let distPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gulpConfig.get('typescript.to');
|
|
22
|
+
const declarationProject = ts.createProject(gulpConfig.get('typescript.config'));
|
|
23
|
+
const tsProject = ts.createProject(gulpConfig.get('typescript.config'));
|
|
24
|
+
const makeDeclarations = () => src(srcPath).pipe(declarationProject()).dts.pipe(dest(distPath));
|
|
25
|
+
const compileJS = () => src(srcPath).pipe(tsProject()).js.pipe(dest(distPath));
|
|
26
|
+
return parallel(makeDeclarations, compileJS);
|
|
27
|
+
};
|
|
29
28
|
module.exports = tsFor;
|
package/dist/partials.js
CHANGED
|
@@ -1,37 +1,41 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
3
|
/**
|
|
4
4
|
* Micro-functions used as components for the main gulp functions.
|
|
5
5
|
* @file
|
|
6
6
|
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
7
|
-
* @version
|
|
7
|
+
* @version 3.0.0
|
|
8
8
|
* @module partials
|
|
9
9
|
* @memberOf module:js-build-tools
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const addToReadme = require('./partials/addToReadme')
|
|
13
|
-
const beginWatcher = require('./partials/beginWatcher')
|
|
14
|
-
const clean = require('./partials/clean')
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const addToReadme = require('./partials/addToReadme')
|
|
13
|
+
const beginWatcher = require('./partials/beginWatcher')
|
|
14
|
+
const clean = require('./partials/clean')
|
|
15
|
+
const copyFor = require('./partials/copyFor')
|
|
16
|
+
const distFor = require('./partials/distFor')
|
|
17
|
+
const distForSrc = require('./partials/distForSrc')
|
|
18
|
+
const distSeries = require('./partials/distSeries')
|
|
19
|
+
const imagesFor = require('./partials/imagesFor.js')
|
|
20
|
+
const minifyFor = require('./partials/minifyFor')
|
|
21
|
+
const readmeTemplate = require('./partials/readmeTemplate')
|
|
22
|
+
const removeDirectory = require('./partials/removeDirectory')
|
|
23
|
+
const runOnChange = require('./partials/runOnChange')
|
|
24
|
+
const sassFor = require('./partials/sassFor')
|
|
25
|
+
const tsFor = require('./partials/tsFor')
|
|
26
|
+
module.exports = {
|
|
27
|
+
addToReadme,
|
|
28
|
+
beginWatcher,
|
|
29
|
+
clean,
|
|
30
|
+
copyFor,
|
|
31
|
+
distFor,
|
|
32
|
+
distForSrc,
|
|
33
|
+
distSeries,
|
|
34
|
+
imagesFor,
|
|
35
|
+
minifyFor,
|
|
36
|
+
readmeTemplate,
|
|
37
|
+
removeDirectory,
|
|
38
|
+
runOnChange,
|
|
39
|
+
sassFor,
|
|
40
|
+
tsFor
|
|
41
|
+
}
|
package/dist/partials.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const addToReadme=require("./partials/addToReadme"),beginWatcher=require("./partials/beginWatcher"),clean=require("./partials/clean"),distFor=require("./partials/distFor"),distForSrc=require("./partials/distForSrc"),distSeries=require("./partials/distSeries"),minifyFor=require("./partials/minifyFor"),readmeTemplate=require("./partials/readmeTemplate"),removeDirectory=require("./partials/removeDirectory"),runOnChange=require("./partials/runOnChange"),sassFor=require("./partials/sassFor"),tsFor=require("./partials/tsFor");module.exports={addToReadme:addToReadme,beginWatcher:beginWatcher,clean:clean,distFor:distFor,distForSrc:distForSrc,distSeries:distSeries,minifyFor:minifyFor,readmeTemplate:readmeTemplate,removeDirectory:removeDirectory,runOnChange:runOnChange,sassFor:sassFor,tsFor:tsFor};
|
|
1
|
+
"use strict";const addToReadme=require("./partials/addToReadme"),beginWatcher=require("./partials/beginWatcher"),clean=require("./partials/clean"),copyFor=require("./partials/copyFor"),distFor=require("./partials/distFor"),distForSrc=require("./partials/distForSrc"),distSeries=require("./partials/distSeries"),imagesFor=require("./partials/imagesFor.js"),minifyFor=require("./partials/minifyFor"),readmeTemplate=require("./partials/readmeTemplate"),removeDirectory=require("./partials/removeDirectory"),runOnChange=require("./partials/runOnChange"),sassFor=require("./partials/sassFor"),tsFor=require("./partials/tsFor");module.exports={addToReadme:addToReadme,beginWatcher:beginWatcher,clean:clean,copyFor:copyFor,distFor:distFor,distForSrc:distForSrc,distSeries:distSeries,imagesFor:imagesFor,minifyFor:minifyFor,readmeTemplate:readmeTemplate,removeDirectory:removeDirectory,runOnChange:runOnChange,sassFor:sassFor,tsFor:tsFor};
|
|
@@ -1,77 +1,69 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Import the configurations and override some of them to direct to the temp directory.
|
|
4
|
+
const gulpConfig = require('../../gulp.config.js');
|
|
5
|
+
const {
|
|
6
|
+
setUp
|
|
7
|
+
} = require('test-filesystem');
|
|
8
|
+
let tempDir = 'test-temp/';
|
|
9
|
+
let srcPath = "".concat(tempDir, "src");
|
|
10
|
+
|
|
12
11
|
/**
|
|
13
12
|
* Update the gulp configurations with the test data. Set the test directory where temp files will be created for testing.
|
|
14
|
-
* @function
|
|
15
13
|
* @memberOf module:testHelpers
|
|
16
14
|
* @param {string} testDir
|
|
17
|
-
*/
|
|
18
|
-
const setDefaults = function () {
|
|
19
|
-
let testDir = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'test-temp';
|
|
20
|
-
tempDir =
|
|
21
|
-
srcPath =
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
gulpConfig.set('
|
|
27
|
-
gulpConfig.set('
|
|
28
|
-
gulpConfig.set('
|
|
29
|
-
gulpConfig.set('
|
|
30
|
-
gulpConfig.set('
|
|
31
|
-
gulpConfig.set('
|
|
32
|
-
gulpConfig.set('
|
|
33
|
-
gulpConfig.set('
|
|
34
|
-
gulpConfig.set('
|
|
35
|
-
gulpConfig.set('
|
|
36
|
-
gulpConfig.set('
|
|
37
|
-
gulpConfig.set('
|
|
38
|
-
gulpConfig.set('
|
|
39
|
-
gulpConfig.set('
|
|
40
|
-
gulpConfig.set('
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
15
|
+
*/
|
|
16
|
+
const setDefaults = function () {
|
|
17
|
+
let testDir = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'test-temp';
|
|
18
|
+
tempDir = "".concat(testDir, "/");
|
|
19
|
+
srcPath = "".concat(tempDir, "src");
|
|
20
|
+
setUp.setDefaults(tempDir);
|
|
21
|
+
const distPath = "".concat(tempDir, "dist");
|
|
22
|
+
const browserPath = "".concat(tempDir, "browser");
|
|
23
|
+
const sassPath = "".concat(tempDir, "sass");
|
|
24
|
+
gulpConfig.set('browser.from', "".concat(distPath, "/**/*.js"));
|
|
25
|
+
gulpConfig.set('browser.to', browserPath);
|
|
26
|
+
gulpConfig.set('cleanPaths', [distPath, browserPath]);
|
|
27
|
+
gulpConfig.set('dist.from', "".concat(srcPath, "/**/!(*.test).js"));
|
|
28
|
+
gulpConfig.set('dist.main', "".concat(distPath, "/main"));
|
|
29
|
+
gulpConfig.set('dist.to', distPath);
|
|
30
|
+
gulpConfig.set('fonts.from', "".concat(srcPath, "/fonts/**/*"));
|
|
31
|
+
gulpConfig.set('fonts.to', "".concat(browserPath, "/fonts"));
|
|
32
|
+
gulpConfig.set('images.from', "".concat(srcPath, "/img/**/*.+(png|jpg|jpeg|gif|svg)"));
|
|
33
|
+
gulpConfig.set('images.to', "".concat(browserPath, "/img"));
|
|
34
|
+
gulpConfig.set('readme.template', "".concat(tempDir, "MAIN.md"));
|
|
35
|
+
gulpConfig.set('readme.to', tempDir);
|
|
36
|
+
gulpConfig.set('readme.from', "".concat(srcPath, "/**/!(*.test).js"));
|
|
37
|
+
gulpConfig.set('rootPath', tempDir);
|
|
38
|
+
gulpConfig.set('sass.from', "".concat(sassPath, "/**/*.+(scss|sass)"));
|
|
39
|
+
gulpConfig.set('sass.path', sassPath);
|
|
40
|
+
gulpConfig.set('sass.to', "".concat(browserPath, "/css"));
|
|
41
|
+
gulpConfig.set('srcPath', srcPath);
|
|
42
|
+
gulpConfig.set('typescript.from', "".concat(srcPath, "/**/*.ts"));
|
|
43
|
+
gulpConfig.set('typescript.to', distPath);
|
|
44
|
+
gulpConfig.set('test.watch', "".concat(srcPath, "/**/*.js"));
|
|
45
|
+
};
|
|
46
|
+
exports.setDefaults = setDefaults;
|
|
47
|
+
exports.gulpConfig = gulpConfig;
|
|
48
|
+
|
|
45
49
|
/**
|
|
46
50
|
* Ensure that the del has completed, recursively attempt to delete and recreate
|
|
47
|
-
* @function
|
|
48
51
|
* @memberOf module:testHelpers
|
|
49
52
|
* @param {boolean} [exists=true]
|
|
50
53
|
* @returns {Promise<*|void>}
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (exists) {
|
|
55
|
-
return removeDirectory(tempDir).then(removedDir => createTempDir(fs.existsSync(removedDir))).catch(error => console.error('Error: ', error));
|
|
56
|
-
}
|
|
57
|
-
return fs.mkdirSync(srcPath, {
|
|
58
|
-
recursive: true
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
exports.createTempDir = createTempDir;
|
|
62
|
-
|
|
54
|
+
*/
|
|
55
|
+
exports.createTempDir = setUp.createTempDir;
|
|
56
|
+
|
|
63
57
|
/**
|
|
64
58
|
* In the Jest.beforeEach function call this one to set up the temp directory.
|
|
65
|
-
* @function
|
|
66
59
|
* @memberOf module:testHelpers
|
|
67
60
|
* @returns {Promise<*|void>}
|
|
68
|
-
*/
|
|
69
|
-
exports.beforeEach =
|
|
70
|
-
|
|
61
|
+
*/
|
|
62
|
+
exports.beforeEach = setUp.beforeEach;
|
|
63
|
+
|
|
71
64
|
/**
|
|
72
65
|
* In the Jest.afterEach function call this one to clean up and remove the temp directory.
|
|
73
|
-
* @function
|
|
74
66
|
* @memberOf module:testHelpers
|
|
75
67
|
* @returns {Promise<*>}
|
|
76
|
-
*/
|
|
77
|
-
exports.afterEach =
|
|
68
|
+
*/
|
|
69
|
+
exports.afterEach = setUp.afterEach;
|
package/dist/testFull.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const gulpConfig = require('../gulp.config.js')
|
|
4
|
-
const {
|
|
5
|
-
runCLI
|
|
6
|
-
} = require('jest')
|
|
7
|
-
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const gulpConfig = require('../gulp.config.js')
|
|
4
|
+
const {
|
|
5
|
+
runCLI
|
|
6
|
+
} = require('jest')
|
|
7
|
+
|
|
8
8
|
/**
|
|
9
9
|
* Run all tests with jest.
|
|
10
10
|
* Configure where tests are located by using 'testPath'.
|
|
11
|
-
* @function
|
|
12
11
|
* @memberOf module:js-build-tools
|
|
13
12
|
* @returns {Promise<*>}
|
|
14
|
-
*/
|
|
15
|
-
const testFull = () => {
|
|
16
|
-
let testPath = gulpConfig.get('
|
|
17
|
-
if (!Array.isArray(testPath)) {
|
|
18
|
-
// The testPath must be an array of strings
|
|
19
|
-
testPath = [testPath]
|
|
20
|
-
}
|
|
21
|
-
return runCLI(gulpConfig.get('
|
|
22
|
-
}
|
|
23
|
-
module.exports = testFull
|
|
13
|
+
*/
|
|
14
|
+
const testFull = () => {
|
|
15
|
+
let testPath = gulpConfig.get('test.path')
|
|
16
|
+
if (!Array.isArray(testPath)) {
|
|
17
|
+
// The testPath must be an array of strings
|
|
18
|
+
testPath = [testPath]
|
|
19
|
+
}
|
|
20
|
+
return runCLI(gulpConfig.get('test.options'), testPath)
|
|
21
|
+
}
|
|
22
|
+
module.exports = testFull
|
package/dist/testFull.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const gulpConfig=require("../gulp.config.js"),{runCLI:runCLI}=require("jest"),testFull=()=>{let t=gulpConfig.get("
|
|
1
|
+
"use strict";const gulpConfig=require("../gulp.config.js"),{runCLI:runCLI}=require("jest"),testFull=()=>{let t=gulpConfig.get("test.path");return Array.isArray(t)||(t=[t]),runCLI(gulpConfig.get("test.options"),t)};module.exports=testFull;
|
package/dist/testHelpers.js
CHANGED
|
@@ -1,33 +1,15 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Export the setUp helper.
|
|
5
5
|
* @file
|
|
6
6
|
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
7
|
-
* @version
|
|
7
|
+
* @version 3.0.0
|
|
8
8
|
* @module testHelpers
|
|
9
9
|
* @memberOf module:js-build-tools
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const jsonDom = require('./test-helpers/jsonDom')
|
|
17
|
-
const linkedList = require('./test-helpers/linkedList')
|
|
18
|
-
const logObject = require('./test-helpers/logObject')
|
|
19
|
-
const multiReferenceObject = require('./test-helpers/multiReferenceObject')
|
|
20
|
-
const nodeTree = require('./test-helpers/nodeTree')
|
|
21
|
-
const setUp = require('./test-helpers/setUp')
|
|
22
|
-
module.exports = {
|
|
23
|
-
circularObject,
|
|
24
|
-
countMatches,
|
|
25
|
-
deepReferenceObject,
|
|
26
|
-
domItem,
|
|
27
|
-
jsonDom,
|
|
28
|
-
linkedList,
|
|
29
|
-
logObject,
|
|
30
|
-
multiReferenceObject,
|
|
31
|
-
nodeTree,
|
|
32
|
-
setUp
|
|
33
|
-
}
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const setUp = require('./test-helpers/setUp')
|
|
13
|
+
module.exports = {
|
|
14
|
+
setUp
|
|
15
|
+
}
|
package/dist/testHelpers.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const setUp=require("./test-helpers/setUp");module.exports={setUp:setUp};
|
package/dist/testQuick.js
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const gulpConfig = require('../gulp.config.js')
|
|
4
|
-
const {
|
|
5
|
-
runCLI
|
|
6
|
-
} = require('jest')
|
|
7
|
-
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const gulpConfig = require('../gulp.config.js')
|
|
4
|
+
const {
|
|
5
|
+
runCLI
|
|
6
|
+
} = require('jest')
|
|
7
|
+
|
|
8
8
|
/**
|
|
9
9
|
* Run the Jest tests for files which have been modified (based on git status).
|
|
10
10
|
* Configure where tests are located by using 'testPath'.
|
|
11
|
-
* @function
|
|
12
11
|
* @memberOf module:js-build-tools
|
|
13
12
|
* @returns {Promise<*>}
|
|
14
|
-
*/
|
|
15
|
-
const testQuick = () => {
|
|
16
|
-
let testPath = gulpConfig.get('
|
|
17
|
-
if (!Array.isArray(testPath)) {
|
|
18
|
-
// The testPath must be an array of strings
|
|
19
|
-
testPath = [testPath]
|
|
20
|
-
}
|
|
21
|
-
return runCLI({
|
|
22
|
-
onlyChanged: true
|
|
23
|
-
}, testPath)
|
|
24
|
-
}
|
|
25
|
-
module.exports = testQuick
|
|
13
|
+
*/
|
|
14
|
+
const testQuick = () => {
|
|
15
|
+
let testPath = gulpConfig.get('test.path')
|
|
16
|
+
if (!Array.isArray(testPath)) {
|
|
17
|
+
// The testPath must be an array of strings
|
|
18
|
+
testPath = [testPath]
|
|
19
|
+
}
|
|
20
|
+
return runCLI({
|
|
21
|
+
onlyChanged: true
|
|
22
|
+
}, testPath)
|
|
23
|
+
}
|
|
24
|
+
module.exports = testQuick
|
package/dist/testQuick.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const gulpConfig=require("../gulp.config.js"),{runCLI:runCLI}=require("jest"),testQuick=()=>{let e=gulpConfig.get("
|
|
1
|
+
"use strict";const gulpConfig=require("../gulp.config.js"),{runCLI:runCLI}=require("jest"),testQuick=()=>{let e=gulpConfig.get("test.path");return Array.isArray(e)||(e=[e]),runCLI({onlyChanged:!0},e)};module.exports=testQuick;
|
package/dist/typeScript.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const tsFor = require('./partials/tsFor')
|
|
4
|
-
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const tsFor = require('./partials/tsFor')
|
|
4
|
+
|
|
5
5
|
/**
|
|
6
6
|
* Simplified typescript task using tsFor.
|
|
7
|
-
* @function
|
|
8
7
|
* @memberOf module:js-build-tools
|
|
9
8
|
* @returns {Function}
|
|
10
|
-
*/
|
|
11
|
-
const typeScript = tsFor()
|
|
12
|
-
module.exports = typeScript
|
|
9
|
+
*/
|
|
10
|
+
const typeScript = tsFor()
|
|
11
|
+
module.exports = typeScript
|