js-build-tools 6.2.0 → 6.2.2
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/dist/build.js +66 -68
- package/dist/build.min.js +1 -1
- package/dist/docs.js +19 -0
- package/dist/docs.min.js +1 -0
- package/dist/partials/resolveDocsMethod.js +19 -0
- package/dist/partials.js +149 -135
- package/dist/partials.min.js +1 -1
- package/functions/build.mjs +2 -4
- package/functions/docs.mjs +13 -0
- package/functions/docs.test.mjs +45 -0
- package/functions/partials/resolveDocsMethod.mjs +10 -0
- package/functions/partials/resolveDocsMethod.test.mjs +33 -0
- package/functions/partials.mjs +2 -0
- package/functions/partials.test.mjs +1 -1
- package/gulpfile.base.mjs +2 -1
- package/package.json +4 -1
package/dist/build.js
CHANGED
|
@@ -1,75 +1,73 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/esnext.weak-map.delete-all.js");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.build = void 0;
|
|
8
|
-
var _bundle = require("./bundle.js");
|
|
9
|
-
var _bundleMinify = require("./bundleMinify.js");
|
|
10
|
-
var _partials = require("./partials.js");
|
|
11
|
-
var _compileReadme = require("./compileReadme.js");
|
|
12
|
-
var _typeDocs = require("./typeDocs.js");
|
|
13
|
-
var _jsdocDocs = require("./jsdocDocs.js");
|
|
14
|
-
var _distMinify = require("./distMinify.js");
|
|
15
|
-
var _sourceLint = require("./sourceLint.js");
|
|
16
|
-
var _gulp = require("gulp");
|
|
17
|
-
var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
|
|
18
|
-
var _copyFonts = require("./copyFonts.js");
|
|
19
|
-
var _images = require("./images.js");
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/esnext.weak-map.delete-all.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.build = void 0;
|
|
8
|
+
var _bundle = require("./bundle.js");
|
|
9
|
+
var _bundleMinify = require("./bundleMinify.js");
|
|
10
|
+
var _partials = require("./partials.js");
|
|
11
|
+
var _compileReadme = require("./compileReadme.js");
|
|
12
|
+
var _typeDocs = require("./typeDocs.js");
|
|
13
|
+
var _jsdocDocs = require("./jsdocDocs.js");
|
|
14
|
+
var _distMinify = require("./distMinify.js");
|
|
15
|
+
var _sourceLint = require("./sourceLint.js");
|
|
16
|
+
var _gulp = require("gulp");
|
|
17
|
+
var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
|
|
18
|
+
var _copyFonts = require("./copyFonts.js");
|
|
19
|
+
var _images = require("./images.js");
|
|
20
|
+
var _resolveDocsMethod = require("./partials/resolveDocsMethod.js");
|
|
21
|
+
var _sass = require("./sass.js");
|
|
22
|
+
var _testFull = require("./testFull.js");
|
|
23
|
+
var cache;
|
|
24
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
24
25
|
/**
|
|
25
26
|
* Runs several processes to build and validate the project.
|
|
26
27
|
* Cleans and lints the source, distributes and minifies, bundles and minifies, creates the readme, then runs the
|
|
27
28
|
* tests.
|
|
28
29
|
* @memberOf module:js-build-tools
|
|
29
30
|
* @returns {stream.Stream}
|
|
30
|
-
*/
|
|
31
|
-
const build = (done = null) => {
|
|
32
|
-
const buildActions = [(0, _partials.distSeries)(), _distMinify.distMinify];
|
|
33
|
-
const generateDocs = gulpConfig.get('docs.enabled');
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
//
|
|
40
|
-
buildActions.push(
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// run alongside each other.
|
|
73
|
-
return (0, _gulp.series)((0, _gulp.parallel)(_partials.clean, _sourceLint.sourceLint), (0, _gulp.parallel)(...runActions))(done);
|
|
74
|
-
};
|
|
31
|
+
*/
|
|
32
|
+
const build = (done = null) => {
|
|
33
|
+
const buildActions = [(0, _partials.distSeries)(), _distMinify.distMinify];
|
|
34
|
+
const generateDocs = gulpConfig.get('docs.enabled');
|
|
35
|
+
const docsMethod = (0, _resolveDocsMethod.resolveDocsMethod)();
|
|
36
|
+
if (generateDocs) {
|
|
37
|
+
// The documentation is generated from the source itself, the readme is written by hand
|
|
38
|
+
buildActions.push(docsMethod === 'jsdoc' ? _jsdocDocs.jsdocDocs : _typeDocs.typeDocs);
|
|
39
|
+
} else if (gulpConfig.get('typescript.enabled')) {
|
|
40
|
+
// For ts usage, we need to run the readme on the dist directly since that is where the .js files are located
|
|
41
|
+
buildActions.push(_compileReadme.compileReadme);
|
|
42
|
+
}
|
|
43
|
+
if (gulpConfig.get('browser.enabled')) {
|
|
44
|
+
// If not 'nodeOnly' then we also want to bundle for browser after we complete the dist directory
|
|
45
|
+
buildActions.push(_bundle.bundle);
|
|
46
|
+
buildActions.push(_bundleMinify.bundleMinify);
|
|
47
|
+
}
|
|
48
|
+
const runActions = [(0, _gulp.series)(...buildActions)];
|
|
49
|
+
if (!generateDocs && !gulpConfig.get('typescript.enabled')) {
|
|
50
|
+
// Since we didn't run this in series after dist because of typescript, we need to run it now. Potentially faster here.
|
|
51
|
+
runActions.push(_compileReadme.compileReadme);
|
|
52
|
+
}
|
|
53
|
+
runActions.push(_testFull.testFull);
|
|
54
|
+
if (gulpConfig.get('fonts.enabled')) {
|
|
55
|
+
// Conditionally add Fonts process
|
|
56
|
+
runActions.push(_copyFonts.copyFonts);
|
|
57
|
+
}
|
|
58
|
+
if (gulpConfig.get('images.enabled')) {
|
|
59
|
+
// Conditionally add Images process
|
|
60
|
+
runActions.push(_images.images);
|
|
61
|
+
}
|
|
62
|
+
if (gulpConfig.get('sass.enabled')) {
|
|
63
|
+
// Conditionally add SASS process
|
|
64
|
+
runActions.push(_sass.sass);
|
|
65
|
+
}
|
|
66
|
+
// clean has to finish before anything writes into the output folders - images, fonts and sass all write into
|
|
67
|
+
// browser/, so running clean in parallel with them races (ENOTEMPTY errors from clean, or output deleted mid-write).
|
|
68
|
+
// sourceLint fixes the real source in place before anything compiles from it (distSeries, tsFor inside it), so a
|
|
69
|
+
// build never reads a mix of pre- and post-fix content; clean only touches dist/browser output, so the two can
|
|
70
|
+
// run alongside each other.
|
|
71
|
+
return (0, _gulp.series)((0, _gulp.parallel)(_partials.clean, _sourceLint.sourceLint), (0, _gulp.parallel)(...runActions))(done);
|
|
72
|
+
};
|
|
75
73
|
exports.build = build;
|
package/dist/build.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.build=void 0;var cache,_bundle=require("./bundle.js"),_bundleMinify=require("./bundleMinify.js"),_partials=require("./partials.js"),_compileReadme=require("./compileReadme.js"),_typeDocs=require("./typeDocs.js"),_jsdocDocs=require("./jsdocDocs.js"),_distMinify=require("./distMinify.js"),_sourceLint=require("./sourceLint.js"),_gulp=require("gulp"),gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_copyFonts=require("./copyFonts.js"),_images=require("./images.js"),_sass=require("./sass.js"),_testFull=require("./testFull.js");function _interopRequireWildcard(e,s){if(!s&&e&&e.__esModule)return e;var i,t
|
|
1
|
+
"use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.build=void 0;var cache,_bundle=require("./bundle.js"),_bundleMinify=require("./bundleMinify.js"),_partials=require("./partials.js"),_compileReadme=require("./compileReadme.js"),_typeDocs=require("./typeDocs.js"),_jsdocDocs=require("./jsdocDocs.js"),_distMinify=require("./distMinify.js"),_sourceLint=require("./sourceLint.js"),_gulp=require("gulp"),gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_copyFonts=require("./copyFonts.js"),_images=require("./images.js"),_resolveDocsMethod=require("./partials/resolveDocsMethod.js"),_sass=require("./sass.js"),_testFull=require("./testFull.js");function _interopRequireWildcard(e,s){if(!s&&e&&e.__esModule)return e;var i,r,t=Object.defineProperty,l={__proto__:null,default:e};if(Object(e)!==e)return l;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,l)}for(r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((i=t&&Object.getOwnPropertyDescriptor(e,r))&&(i.get||i.set)?t(l,r,i):l[r]=e[r]);return l}const build=(e=null)=>{const s=[(0,_partials.distSeries)(),_distMinify.distMinify],i=gulpConfig.get("docs.enabled"),r=(0,_resolveDocsMethod.resolveDocsMethod)();i?s.push("jsdoc"===r?_jsdocDocs.jsdocDocs:_typeDocs.typeDocs):gulpConfig.get("typescript.enabled")&&s.push(_compileReadme.compileReadme),gulpConfig.get("browser.enabled")&&(s.push(_bundle.bundle),s.push(_bundleMinify.bundleMinify));const t=[(0,_gulp.series)(...s)];return i||gulpConfig.get("typescript.enabled")||t.push(_compileReadme.compileReadme),t.push(_testFull.testFull),gulpConfig.get("fonts.enabled")&&t.push(_copyFonts.copyFonts),gulpConfig.get("images.enabled")&&t.push(_images.images),gulpConfig.get("sass.enabled")&&t.push(_sass.sass),(0,_gulp.series)((0,_gulp.parallel)(_partials.clean,_sourceLint.sourceLint),(0,_gulp.parallel)(...t))(e)};exports.build=build;
|
package/dist/docs.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.docs = void 0;
|
|
7
|
+
var _jsdocDocs = require("./jsdocDocs.js");
|
|
8
|
+
var _resolveDocsMethod = require("./partials/resolveDocsMethod.js");
|
|
9
|
+
var _typeDocs = require("./typeDocs.js");
|
|
10
|
+
/**
|
|
11
|
+
* Generate the HTML documentation with whichever engine docs.method (or its typescript.enabled-based default)
|
|
12
|
+
* resolves to - see {@link module:partials.resolveDocsMethod}. The standalone counterpart to build's own
|
|
13
|
+
* internal branching, for running `gulp docs` directly instead of as part of a full build.
|
|
14
|
+
* @memberOf module:js-build-tools
|
|
15
|
+
* @param {Function} [done]
|
|
16
|
+
* @returns {*}
|
|
17
|
+
*/
|
|
18
|
+
const docs = (done = null) => ((0, _resolveDocsMethod.resolveDocsMethod)() === 'jsdoc' ? _jsdocDocs.jsdocDocs : _typeDocs.typeDocs)(done);
|
|
19
|
+
exports.docs = docs;
|
package/dist/docs.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.docs=void 0;var _jsdocDocs=require("./jsdocDocs.js"),_resolveDocsMethod=require("./partials/resolveDocsMethod.js"),_typeDocs=require("./typeDocs.js");const docs=(o=null)=>("jsdoc"===(0,_resolveDocsMethod.resolveDocsMethod)()?_jsdocDocs.jsdocDocs:_typeDocs.typeDocs)(o);exports.docs=docs;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/esnext.weak-map.delete-all.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.resolveDocsMethod = void 0;
|
|
8
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
9
|
+
var cache;
|
|
10
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
11
|
+
/**
|
|
12
|
+
* Pick which engine generates the HTML documentation: docs.method picks it explicitly; left unset (false, the
|
|
13
|
+
* default), it's inferred from typescript.enabled - every existing TypeScript project's config, which never
|
|
14
|
+
* sets method, keeps producing TypeDoc output exactly as it always has.
|
|
15
|
+
* @memberOf module:partials
|
|
16
|
+
* @returns {'typedoc'|'jsdoc'}
|
|
17
|
+
*/
|
|
18
|
+
const resolveDocsMethod = () => gulpConfig.get('docs.method') || (gulpConfig.get('typescript.enabled') ? 'typedoc' : 'jsdoc');
|
|
19
|
+
exports.resolveDocsMethod = resolveDocsMethod;
|
package/dist/partials.js
CHANGED
|
@@ -1,136 +1,150 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "addToReadme", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _addToReadme.addToReadme;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "beginWatcher", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _beginWatcher.beginWatcher;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "clean", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _clean.clean;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "copyFor", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _copyFor.copyFor;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "distFor", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _distFor.distFor;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "distForSrc", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _distForSrc.distForSrc;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "distSeries", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _distSeries.distSeries;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "imagesFor", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return _imagesFor.imagesFor;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "importModule", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _loadPeer.importModule;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(exports, "importPeer", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function () {
|
|
63
|
-
return _loadPeer.importPeer;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
Object.defineProperty(exports, "
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get: function () {
|
|
69
|
-
return
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
Object.defineProperty(exports, "
|
|
73
|
-
enumerable: true,
|
|
74
|
-
get: function () {
|
|
75
|
-
return
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
Object.defineProperty(exports, "
|
|
79
|
-
enumerable: true,
|
|
80
|
-
get: function () {
|
|
81
|
-
return
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
Object.defineProperty(exports, "
|
|
85
|
-
enumerable: true,
|
|
86
|
-
get: function () {
|
|
87
|
-
return
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
Object.defineProperty(exports, "
|
|
91
|
-
enumerable: true,
|
|
92
|
-
get: function () {
|
|
93
|
-
return
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
Object.defineProperty(exports, "
|
|
97
|
-
enumerable: true,
|
|
98
|
-
get: function () {
|
|
99
|
-
return
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
Object.defineProperty(exports, "
|
|
103
|
-
enumerable: true,
|
|
104
|
-
get: function () {
|
|
105
|
-
return
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
Object.defineProperty(exports, "
|
|
109
|
-
enumerable: true,
|
|
110
|
-
get: function () {
|
|
111
|
-
return
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
Object.defineProperty(exports, "
|
|
115
|
-
enumerable: true,
|
|
116
|
-
get: function () {
|
|
117
|
-
return
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
var
|
|
133
|
-
var
|
|
134
|
-
var
|
|
135
|
-
var
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "addToReadme", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _addToReadme.addToReadme;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "beginWatcher", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _beginWatcher.beginWatcher;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "clean", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _clean.clean;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "copyFor", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _copyFor.copyFor;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "distFor", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _distFor.distFor;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "distForSrc", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _distForSrc.distForSrc;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "distSeries", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _distSeries.distSeries;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "imagesFor", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _imagesFor.imagesFor;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "importModule", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _loadPeer.importModule;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "importPeer", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _loadPeer.importPeer;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "jsdocDocsFor", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _jsdocDocsFor.jsdocDocsFor;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "minifyFor", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _minifyFor.minifyFor;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "neostandardLint", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return _neostandardLint.neostandardLint;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "readmeTemplate", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _readmeTemplate.readmeTemplate;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "removeDirectory", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _removeDirectory.removeDirectory;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "requirePeer", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () {
|
|
99
|
+
return _loadPeer.requirePeer;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(exports, "resolveDocsMethod", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function () {
|
|
105
|
+
return _resolveDocsMethod.resolveDocsMethod;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, "runOnChange", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () {
|
|
111
|
+
return _runOnChange.runOnChange;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(exports, "sassFor", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function () {
|
|
117
|
+
return _sassFor.sassFor;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "tsFor", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () {
|
|
123
|
+
return _tsFor.tsFor;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(exports, "typeDocsFor", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function () {
|
|
129
|
+
return _typeDocsFor.typeDocsFor;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
var _addToReadme = require("./partials/addToReadme.js");
|
|
133
|
+
var _beginWatcher = require("./partials/beginWatcher.js");
|
|
134
|
+
var _clean = require("./partials/clean.js");
|
|
135
|
+
var _copyFor = require("./partials/copyFor.js");
|
|
136
|
+
var _distFor = require("./partials/distFor.js");
|
|
137
|
+
var _distForSrc = require("./partials/distForSrc.js");
|
|
138
|
+
var _distSeries = require("./partials/distSeries.js");
|
|
139
|
+
var _imagesFor = require("./partials/imagesFor.js");
|
|
140
|
+
var _loadPeer = require("./partials/loadPeer.js");
|
|
141
|
+
var _jsdocDocsFor = require("./partials/jsdocDocsFor.js");
|
|
142
|
+
var _minifyFor = require("./partials/minifyFor.js");
|
|
143
|
+
var _neostandardLint = require("./partials/neostandardLint.js");
|
|
144
|
+
var _readmeTemplate = require("./partials/readmeTemplate.js");
|
|
145
|
+
var _removeDirectory = require("./partials/removeDirectory.js");
|
|
146
|
+
var _resolveDocsMethod = require("./partials/resolveDocsMethod.js");
|
|
147
|
+
var _runOnChange = require("./partials/runOnChange.js");
|
|
148
|
+
var _sassFor = require("./partials/sassFor.js");
|
|
149
|
+
var _tsFor = require("./partials/tsFor.js");
|
|
136
150
|
var _typeDocsFor = require("./partials/typeDocsFor.js");
|
package/dist/partials.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"addToReadme",{enumerable:!0,get:function(){return _addToReadme.addToReadme}}),Object.defineProperty(exports,"beginWatcher",{enumerable:!0,get:function(){return _beginWatcher.beginWatcher}}),Object.defineProperty(exports,"clean",{enumerable:!0,get:function(){return _clean.clean}}),Object.defineProperty(exports,"copyFor",{enumerable:!0,get:function(){return _copyFor.copyFor}}),Object.defineProperty(exports,"distFor",{enumerable:!0,get:function(){return _distFor.distFor}}),Object.defineProperty(exports,"distForSrc",{enumerable:!0,get:function(){return _distForSrc.distForSrc}}),Object.defineProperty(exports,"distSeries",{enumerable:!0,get:function(){return _distSeries.distSeries}}),Object.defineProperty(exports,"imagesFor",{enumerable:!0,get:function(){return _imagesFor.imagesFor}}),Object.defineProperty(exports,"importModule",{enumerable:!0,get:function(){return _loadPeer.importModule}}),Object.defineProperty(exports,"importPeer",{enumerable:!0,get:function(){return _loadPeer.importPeer}}),Object.defineProperty(exports,"minifyFor",{enumerable:!0,get:function(){return _minifyFor.minifyFor}}),Object.defineProperty(exports,"neostandardLint",{enumerable:!0,get:function(){return _neostandardLint.neostandardLint}}),Object.defineProperty(exports,"readmeTemplate",{enumerable:!0,get:function(){return _readmeTemplate.readmeTemplate}}),Object.defineProperty(exports,"removeDirectory",{enumerable:!0,get:function(){return _removeDirectory.removeDirectory}}),Object.defineProperty(exports,"requirePeer",{enumerable:!0,get:function(){return _loadPeer.requirePeer}}),Object.defineProperty(exports,"runOnChange",{enumerable:!0,get:function(){return _runOnChange.runOnChange}}),Object.defineProperty(exports,"sassFor",{enumerable:!0,get:function(){return _sassFor.sassFor}}),Object.defineProperty(exports,"tsFor",{enumerable:!0,get:function(){return _tsFor.tsFor}}),Object.defineProperty(exports,"typeDocsFor",{enumerable:!0,get:function(){return _typeDocsFor.typeDocsFor}});var _addToReadme=require("./partials/addToReadme.js"),_beginWatcher=require("./partials/beginWatcher.js"),_clean=require("./partials/clean.js"),_copyFor=require("./partials/copyFor.js"),_distFor=require("./partials/distFor.js"),_distForSrc=require("./partials/distForSrc.js"),_distSeries=require("./partials/distSeries.js"),_imagesFor=require("./partials/imagesFor.js"),_loadPeer=require("./partials/loadPeer.js"),_minifyFor=require("./partials/minifyFor.js"),_neostandardLint=require("./partials/neostandardLint.js"),_readmeTemplate=require("./partials/readmeTemplate.js"),_removeDirectory=require("./partials/removeDirectory.js"),_runOnChange=require("./partials/runOnChange.js"),_sassFor=require("./partials/sassFor.js"),_tsFor=require("./partials/tsFor.js"),_typeDocsFor=require("./partials/typeDocsFor.js");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"addToReadme",{enumerable:!0,get:function(){return _addToReadme.addToReadme}}),Object.defineProperty(exports,"beginWatcher",{enumerable:!0,get:function(){return _beginWatcher.beginWatcher}}),Object.defineProperty(exports,"clean",{enumerable:!0,get:function(){return _clean.clean}}),Object.defineProperty(exports,"copyFor",{enumerable:!0,get:function(){return _copyFor.copyFor}}),Object.defineProperty(exports,"distFor",{enumerable:!0,get:function(){return _distFor.distFor}}),Object.defineProperty(exports,"distForSrc",{enumerable:!0,get:function(){return _distForSrc.distForSrc}}),Object.defineProperty(exports,"distSeries",{enumerable:!0,get:function(){return _distSeries.distSeries}}),Object.defineProperty(exports,"imagesFor",{enumerable:!0,get:function(){return _imagesFor.imagesFor}}),Object.defineProperty(exports,"importModule",{enumerable:!0,get:function(){return _loadPeer.importModule}}),Object.defineProperty(exports,"importPeer",{enumerable:!0,get:function(){return _loadPeer.importPeer}}),Object.defineProperty(exports,"jsdocDocsFor",{enumerable:!0,get:function(){return _jsdocDocsFor.jsdocDocsFor}}),Object.defineProperty(exports,"minifyFor",{enumerable:!0,get:function(){return _minifyFor.minifyFor}}),Object.defineProperty(exports,"neostandardLint",{enumerable:!0,get:function(){return _neostandardLint.neostandardLint}}),Object.defineProperty(exports,"readmeTemplate",{enumerable:!0,get:function(){return _readmeTemplate.readmeTemplate}}),Object.defineProperty(exports,"removeDirectory",{enumerable:!0,get:function(){return _removeDirectory.removeDirectory}}),Object.defineProperty(exports,"requirePeer",{enumerable:!0,get:function(){return _loadPeer.requirePeer}}),Object.defineProperty(exports,"resolveDocsMethod",{enumerable:!0,get:function(){return _resolveDocsMethod.resolveDocsMethod}}),Object.defineProperty(exports,"runOnChange",{enumerable:!0,get:function(){return _runOnChange.runOnChange}}),Object.defineProperty(exports,"sassFor",{enumerable:!0,get:function(){return _sassFor.sassFor}}),Object.defineProperty(exports,"tsFor",{enumerable:!0,get:function(){return _tsFor.tsFor}}),Object.defineProperty(exports,"typeDocsFor",{enumerable:!0,get:function(){return _typeDocsFor.typeDocsFor}});var _addToReadme=require("./partials/addToReadme.js"),_beginWatcher=require("./partials/beginWatcher.js"),_clean=require("./partials/clean.js"),_copyFor=require("./partials/copyFor.js"),_distFor=require("./partials/distFor.js"),_distForSrc=require("./partials/distForSrc.js"),_distSeries=require("./partials/distSeries.js"),_imagesFor=require("./partials/imagesFor.js"),_loadPeer=require("./partials/loadPeer.js"),_jsdocDocsFor=require("./partials/jsdocDocsFor.js"),_minifyFor=require("./partials/minifyFor.js"),_neostandardLint=require("./partials/neostandardLint.js"),_readmeTemplate=require("./partials/readmeTemplate.js"),_removeDirectory=require("./partials/removeDirectory.js"),_resolveDocsMethod=require("./partials/resolveDocsMethod.js"),_runOnChange=require("./partials/runOnChange.js"),_sassFor=require("./partials/sassFor.js"),_tsFor=require("./partials/tsFor.js"),_typeDocsFor=require("./partials/typeDocsFor.js");
|
package/functions/build.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { parallel, series } from 'gulp'
|
|
|
10
10
|
import * as gulpConfig from '../gulp.config.mjs'
|
|
11
11
|
import { copyFonts } from './copyFonts.mjs'
|
|
12
12
|
import { images } from './images.mjs'
|
|
13
|
+
import { resolveDocsMethod } from './partials/resolveDocsMethod.mjs'
|
|
13
14
|
import { sass } from './sass.mjs'
|
|
14
15
|
import { testFull } from './testFull.mjs'
|
|
15
16
|
|
|
@@ -23,10 +24,7 @@ import { testFull } from './testFull.mjs'
|
|
|
23
24
|
export const build = (done = null) => {
|
|
24
25
|
const buildActions = [distSeries(), distMinify]
|
|
25
26
|
const generateDocs = gulpConfig.get('docs.enabled')
|
|
26
|
-
|
|
27
|
-
// typescript.enabled - every existing TypeScript project's config, which never sets method, keeps producing
|
|
28
|
-
// TypeDoc output exactly as it always has.
|
|
29
|
-
const docsMethod = gulpConfig.get('docs.method') || (gulpConfig.get('typescript.enabled') ? 'typedoc' : 'jsdoc')
|
|
27
|
+
const docsMethod = resolveDocsMethod()
|
|
30
28
|
if (generateDocs) {
|
|
31
29
|
// The documentation is generated from the source itself, the readme is written by hand
|
|
32
30
|
buildActions.push(docsMethod === 'jsdoc' ? jsdocDocs : typeDocs)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsdocDocs } from './jsdocDocs.mjs'
|
|
2
|
+
import { resolveDocsMethod } from './partials/resolveDocsMethod.mjs'
|
|
3
|
+
import { typeDocs } from './typeDocs.mjs'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Generate the HTML documentation with whichever engine docs.method (or its typescript.enabled-based default)
|
|
7
|
+
* resolves to - see {@link module:partials.resolveDocsMethod}. The standalone counterpart to build's own
|
|
8
|
+
* internal branching, for running `gulp docs` directly instead of as part of a full build.
|
|
9
|
+
* @memberOf module:js-build-tools
|
|
10
|
+
* @param {Function} [done]
|
|
11
|
+
* @returns {*}
|
|
12
|
+
*/
|
|
13
|
+
export const docs = (done = null) => (resolveDocsMethod() === 'jsdoc' ? jsdocDocs : typeDocs)(done)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as setUp from './test-helpers/setUp.mjs'
|
|
2
|
+
import { docs } from './docs.mjs'
|
|
3
|
+
import { typeDocs } from './typeDocs.mjs'
|
|
4
|
+
import { jsdocDocs } from './jsdocDocs.mjs'
|
|
5
|
+
|
|
6
|
+
const genericFunction = () => Promise.resolve(true)
|
|
7
|
+
|
|
8
|
+
jest.mock('./typeDocs.mjs', () => ({ typeDocs: jest.fn(genericFunction) }))
|
|
9
|
+
jest.mock('./jsdocDocs.mjs', () => ({ jsdocDocs: jest.fn(genericFunction) }))
|
|
10
|
+
|
|
11
|
+
setUp.setDefaults('test-docs')
|
|
12
|
+
const gulpConfig = setUp.gulpConfig
|
|
13
|
+
|
|
14
|
+
beforeEach(() => setUp.beforeEach().then(() => {
|
|
15
|
+
typeDocs.mockClear()
|
|
16
|
+
jsdocDocs.mockClear()
|
|
17
|
+
}))
|
|
18
|
+
|
|
19
|
+
afterEach(setUp.afterEach)
|
|
20
|
+
|
|
21
|
+
describe('docs', () => {
|
|
22
|
+
test('runs jsdocDocs when resolveDocsMethod infers jsdoc', async () => {
|
|
23
|
+
gulpConfig.set('typescript.enabled', false)
|
|
24
|
+
gulpConfig.set('docs.method', false)
|
|
25
|
+
await docs()
|
|
26
|
+
expect(jsdocDocs).toHaveBeenCalledTimes(1)
|
|
27
|
+
expect(typeDocs).not.toHaveBeenCalled()
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
test('runs typeDocs when resolveDocsMethod infers typedoc', async () => {
|
|
31
|
+
gulpConfig.set('typescript.enabled', true)
|
|
32
|
+
gulpConfig.set('docs.method', false)
|
|
33
|
+
await docs()
|
|
34
|
+
expect(typeDocs).toHaveBeenCalledTimes(1)
|
|
35
|
+
expect(jsdocDocs).not.toHaveBeenCalled()
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('docs.method overrides the typescript.enabled inference either way', async () => {
|
|
39
|
+
gulpConfig.set('typescript.enabled', true)
|
|
40
|
+
gulpConfig.set('docs.method', 'jsdoc')
|
|
41
|
+
await docs()
|
|
42
|
+
expect(jsdocDocs).toHaveBeenCalledTimes(1)
|
|
43
|
+
expect(typeDocs).not.toHaveBeenCalled()
|
|
44
|
+
})
|
|
45
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as gulpConfig from '../../gulp.config.mjs'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pick which engine generates the HTML documentation: docs.method picks it explicitly; left unset (false, the
|
|
5
|
+
* default), it's inferred from typescript.enabled - every existing TypeScript project's config, which never
|
|
6
|
+
* sets method, keeps producing TypeDoc output exactly as it always has.
|
|
7
|
+
* @memberOf module:partials
|
|
8
|
+
* @returns {'typedoc'|'jsdoc'}
|
|
9
|
+
*/
|
|
10
|
+
export const resolveDocsMethod = () => gulpConfig.get('docs.method') || (gulpConfig.get('typescript.enabled') ? 'typedoc' : 'jsdoc')
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as setUp from '../test-helpers/setUp.mjs'
|
|
2
|
+
import { resolveDocsMethod } from './resolveDocsMethod.mjs'
|
|
3
|
+
|
|
4
|
+
setUp.setDefaults('test-resolve-docs-method')
|
|
5
|
+
const gulpConfig = setUp.gulpConfig
|
|
6
|
+
|
|
7
|
+
beforeEach(setUp.beforeEach)
|
|
8
|
+
|
|
9
|
+
afterEach(setUp.afterEach)
|
|
10
|
+
|
|
11
|
+
describe('resolveDocsMethod', () => {
|
|
12
|
+
test('infers jsdoc when typescript.enabled is false and docs.method is unset', () => {
|
|
13
|
+
gulpConfig.set('typescript.enabled', false)
|
|
14
|
+
gulpConfig.set('docs.method', false)
|
|
15
|
+
expect(resolveDocsMethod()).toBe('jsdoc')
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('infers typedoc when typescript.enabled is true and docs.method is unset', () => {
|
|
19
|
+
gulpConfig.set('typescript.enabled', true)
|
|
20
|
+
gulpConfig.set('docs.method', false)
|
|
21
|
+
expect(resolveDocsMethod()).toBe('typedoc')
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
test('docs.method overrides the typescript.enabled inference either way', () => {
|
|
25
|
+
gulpConfig.set('typescript.enabled', true)
|
|
26
|
+
gulpConfig.set('docs.method', 'jsdoc')
|
|
27
|
+
expect(resolveDocsMethod()).toBe('jsdoc')
|
|
28
|
+
|
|
29
|
+
gulpConfig.set('typescript.enabled', false)
|
|
30
|
+
gulpConfig.set('docs.method', 'typedoc')
|
|
31
|
+
expect(resolveDocsMethod()).toBe('typedoc')
|
|
32
|
+
})
|
|
33
|
+
})
|
package/functions/partials.mjs
CHANGED
|
@@ -16,10 +16,12 @@ export { distForSrc } from './partials/distForSrc.mjs'
|
|
|
16
16
|
export { distSeries } from './partials/distSeries.mjs'
|
|
17
17
|
export { imagesFor } from './partials/imagesFor.mjs'
|
|
18
18
|
export { importModule, importPeer, requirePeer } from './partials/loadPeer.mjs'
|
|
19
|
+
export { jsdocDocsFor } from './partials/jsdocDocsFor.mjs'
|
|
19
20
|
export { minifyFor } from './partials/minifyFor.mjs'
|
|
20
21
|
export { neostandardLint } from './partials/neostandardLint.mjs'
|
|
21
22
|
export { readmeTemplate } from './partials/readmeTemplate.mjs'
|
|
22
23
|
export { removeDirectory } from './partials/removeDirectory.mjs'
|
|
24
|
+
export { resolveDocsMethod } from './partials/resolveDocsMethod.mjs'
|
|
23
25
|
export { runOnChange } from './partials/runOnChange.mjs'
|
|
24
26
|
export { sassFor } from './partials/sassFor.mjs'
|
|
25
27
|
export { tsFor } from './partials/tsFor.mjs'
|
package/gulpfile.base.mjs
CHANGED
|
@@ -13,6 +13,7 @@ export { copyFiles } from './functions/copyFiles.mjs'
|
|
|
13
13
|
export { copyFonts } from './functions/copyFonts.mjs'
|
|
14
14
|
export { defaultCmd } from './functions/default.mjs'
|
|
15
15
|
export { dist } from './functions/dist.mjs'
|
|
16
|
+
export { docs } from './functions/docs.mjs'
|
|
16
17
|
export { distMinify } from './functions/distMinify.mjs'
|
|
17
18
|
export * as gulpConfig from './gulp.config.mjs'
|
|
18
19
|
export { images } from './functions/images.mjs'
|
|
@@ -23,7 +24,7 @@ export { sourceLint } from './functions/sourceLint.mjs'
|
|
|
23
24
|
export { testFull } from './functions/testFull.mjs'
|
|
24
25
|
export * as testHelpers from './functions/testHelpers.mjs'
|
|
25
26
|
export { testQuick } from './functions/testQuick.mjs'
|
|
26
|
-
export { typeDocs
|
|
27
|
+
export { typeDocs } from './functions/typeDocs.mjs'
|
|
27
28
|
export { typeScript as typescript } from './functions/typeScript.mjs'
|
|
28
29
|
export { watchFull } from './functions/watchFull.mjs'
|
|
29
30
|
export { watchTest } from './functions/watchTest.mjs'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js-build-tools",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.2",
|
|
4
4
|
"description": "Standardised build process with gulp.",
|
|
5
5
|
"main": "gulpfile.base.js",
|
|
6
6
|
"exports": {
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
"dev": "gulp",
|
|
23
23
|
"htmldocs": "jsdoc -R MAIN.md -c ./.jsdoc.conf.js -d docs",
|
|
24
24
|
"readme": "gulp readme",
|
|
25
|
+
"release": "release-it",
|
|
26
|
+
"release:dry-run": "release-it --dry-run",
|
|
25
27
|
"test": "gulp testFull",
|
|
26
28
|
"test:quick": "gulp testQuick",
|
|
27
29
|
"watch": "gulp watchFull",
|
|
@@ -117,6 +119,7 @@
|
|
|
117
119
|
"clean-jsdoc-theme": "^5.2.0",
|
|
118
120
|
"gulp-imagemin": "github:jheagle/gulp-imagemin#common-js-compatibility",
|
|
119
121
|
"jsdoc": "^4.0.5",
|
|
122
|
+
"release-it": "^21.1.1",
|
|
120
123
|
"typedoc": "^0.28.20",
|
|
121
124
|
"typescript": "^6.0.3"
|
|
122
125
|
},
|