js-build-tools 1.2.3 → 2.1.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 +573 -250
- package/dist/build.js +27 -20
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +16 -13
- package/dist/bundle.min.js +1 -1
- package/dist/bundleLint.js +22 -18
- package/dist/bundleLint.min.js +1 -1
- package/dist/bundleMinify.js +13 -17
- package/dist/bundleMinify.min.js +1 -1
- package/dist/compileReadme.js +13 -11
- package/dist/compileReadme.min.js +1 -1
- package/dist/default.js +17 -12
- package/dist/default.min.js +1 -1
- package/dist/dist.js +11 -7
- package/dist/dist.min.js +1 -1
- package/dist/distLint.js +20 -17
- package/dist/distLint.min.js +1 -1
- package/dist/distMinify.js +12 -17
- package/dist/distMinify.min.js +1 -1
- package/dist/partials/addToReadme.js +25 -0
- package/dist/partials/beginWatcher.js +16 -0
- package/dist/partials/clean.js +21 -0
- package/dist/partials/distFor.js +23 -0
- package/dist/partials/distForSrc.js +16 -0
- package/dist/partials/distSeries.js +31 -0
- package/dist/partials/minifyFor.js +21 -0
- package/dist/partials/readmeTemplate.js +18 -0
- package/dist/partials/runOnChange.js +63 -0
- package/dist/partials/tsFor.js +24 -0
- package/dist/partials.js +33 -0
- package/dist/partials.min.js +1 -0
- package/dist/test-helpers/circularObject.js +50 -0
- package/dist/test-helpers/countMatches.js +16 -0
- package/dist/test-helpers/deepReferenceObject.js +20 -0
- package/dist/test-helpers/domItem.js +33 -0
- package/dist/test-helpers/jsonDom.js +20 -0
- package/dist/test-helpers/linkedList.js +23 -0
- package/dist/test-helpers/logObject.js +24 -0
- package/dist/test-helpers/multiReferenceObject.js +20 -0
- package/dist/test-helpers/nodeTree.js +28 -0
- package/dist/test-helpers/setUp.js +127 -0
- package/dist/testFull.js +21 -10
- package/dist/testFull.min.js +1 -1
- package/dist/testHelpers.js +33 -198
- package/dist/testHelpers.min.js +1 -1
- package/dist/testQuick.js +23 -12
- package/dist/testQuick.min.js +1 -1
- package/dist/typeScript.js +14 -0
- package/dist/typeScript.min.js +1 -0
- package/dist/watchFull.js +14 -21
- package/dist/watchFull.min.js +1 -1
- package/dist/watchTest.js +16 -14
- package/dist/watchTest.min.js +1 -1
- package/functions/build.js +8 -5
- package/functions/build.test.js +59 -0
- package/functions/bundle.js +6 -4
- package/functions/bundle.test.js +68 -0
- package/functions/bundleLint.js +5 -3
- package/functions/bundleLint.test.js +61 -0
- package/functions/bundleMinify.js +4 -7
- package/functions/bundleMinify.test.js +14 -0
- package/functions/compileReadme.js +3 -2
- package/functions/compileReadme.test.js +18 -0
- package/functions/default.js +5 -2
- package/functions/default.test.js +32 -0
- package/functions/dist.js +3 -1
- package/functions/dist.test.js +43 -0
- package/functions/distLint.js +4 -2
- package/functions/distLint.test.js +58 -0
- package/functions/distMinify.js +4 -7
- package/functions/distMinify.test.js +14 -0
- package/functions/partials/addToReadme.js +20 -0
- package/functions/partials/addToReadme.test.js +28 -0
- package/functions/partials/beginWatcher.js +12 -0
- package/functions/partials/beginWatcher.test.js +18 -0
- package/functions/partials/clean.js +14 -0
- package/functions/partials/clean.test.js +20 -0
- package/functions/partials/distFor.js +18 -0
- package/functions/partials/distFor.test.js +125 -0
- package/functions/partials/distForSrc.js +14 -0
- package/functions/partials/distForSrc.test.js +17 -0
- package/functions/partials/distSeries.js +21 -0
- package/functions/partials/distSeries.test.js +33 -0
- package/functions/partials/minifyFor.js +16 -0
- package/functions/partials/minifyFor.test.js +48 -0
- package/functions/partials/readmeTemplate.js +15 -0
- package/functions/partials/readmeTemplate.test.js +33 -0
- package/functions/partials/runOnChange.js +57 -0
- package/functions/partials/runOnChange.test.js +93 -0
- package/functions/partials/tsFor.js +21 -0
- package/functions/partials/tsFor.test.js +44 -0
- package/functions/partials.js +32 -0
- package/functions/partials.test.js +7 -0
- package/functions/test-helpers/circularObject.js +28 -0
- package/functions/test-helpers/circularObject.test.js +14 -0
- package/functions/test-helpers/countMatches.js +11 -0
- package/functions/test-helpers/countMatches.test.js +9 -0
- package/functions/test-helpers/deepReferenceObject.js +25 -0
- package/functions/test-helpers/deepReferenceObject.test.js +7 -0
- package/functions/test-helpers/domItem.js +31 -0
- package/functions/test-helpers/domItem.test.js +12 -0
- package/functions/test-helpers/jsonDom.js +16 -0
- package/functions/test-helpers/jsonDom.test.js +12 -0
- package/functions/test-helpers/linkedList.js +10 -0
- package/functions/test-helpers/linkedList.test.js +22 -0
- package/functions/test-helpers/logObject.js +18 -0
- package/functions/test-helpers/logObject.test.js +20 -0
- package/functions/test-helpers/multiReferenceObject.js +25 -0
- package/functions/test-helpers/multiReferenceObject.test.js +14 -0
- package/functions/test-helpers/nodeTree.js +11 -0
- package/functions/test-helpers/nodeTree.test.js +18 -0
- package/functions/test-helpers/setUp.js +67 -0
- package/functions/test-helpers/setUp.test.js +18 -0
- package/functions/testFull.js +13 -3
- package/functions/testFull.test.js +16 -0
- package/functions/testHelpers.js +27 -137
- package/functions/testHelpers.test.js +3 -96
- package/functions/testQuick.js +12 -2
- package/functions/testQuick.test.js +16 -0
- package/functions/typeScript.js +11 -0
- package/functions/typeScript.test.js +10 -0
- package/functions/watchFull.js +6 -12
- package/functions/watchFull.test.js +40 -0
- package/functions/watchTest.js +4 -2
- package/functions/watchTest.test.js +48 -0
- package/gulp.config.js +161 -16
- package/gulpfile.base.js +9 -0
- package/package.json +2 -1
- package/dist/addToReadme.js +0 -22
- package/dist/addToReadme.min.js +0 -1
- package/dist/clean.js +0 -11
- package/dist/clean.min.js +0 -1
- package/dist/distFor.js +0 -21
- package/dist/distFor.min.js +0 -1
- package/dist/readmeTemplate.js +0 -15
- package/dist/readmeTemplate.min.js +0 -1
- package/functions/addToReadme.js +0 -17
- package/functions/clean.js +0 -10
- package/functions/distFor.js +0 -15
- package/functions/readmeTemplate.js +0 -13
package/gulp.config.js
CHANGED
|
@@ -1,30 +1,175 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Modify these configurations to match your project specifications.
|
|
3
|
+
* @file
|
|
4
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
5
|
+
* @version 2.0.0
|
|
6
|
+
* @module gulpConfig
|
|
7
|
+
* @memberOf module:js-build-tools
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Retrieve a value from an object with the path (key), return a given default if the key is not found.
|
|
12
|
+
* @memberOf module:gulpConfig
|
|
13
|
+
* @param {Object<string, *>} [config=[]]
|
|
14
|
+
* @param {string|null} [path=null]
|
|
15
|
+
* @param {*} [defaultValue=null]
|
|
16
|
+
* @returns {*|null}
|
|
17
|
+
*/
|
|
18
|
+
const defaultConfig = (config = {}, path = null, defaultValue = null) => {
|
|
19
|
+
if (!path) {
|
|
20
|
+
return config
|
|
21
|
+
}
|
|
2
22
|
if (typeof config[path] === 'undefined') {
|
|
3
23
|
return defaultValue
|
|
4
24
|
}
|
|
5
25
|
return config[path]
|
|
6
26
|
}
|
|
7
|
-
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A setting that may be an array of strings or a string only.
|
|
30
|
+
* @typedef {Array<string>|string} module:gulpConfig~ArrayableSetting
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A setting that may be true or false.
|
|
35
|
+
* @typedef {boolean} module:gulpConfig~BooleanSetting
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A setting that may be flag 'false' or provide a StringSetting
|
|
40
|
+
* @typedef {false|StringSetting} module:gulpConfig~FlagStringSetting
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* An object of boolean settings used as flags.
|
|
45
|
+
* @typedef {Object<string, BooleanSetting>} module:gulpConfig~FlagsSetting
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Configure cli options for running Jest.
|
|
50
|
+
* @typedef {FlagsSetting} module:gulpConfig~JestTestFlags
|
|
51
|
+
* @property {BooleanSetting} clearCache
|
|
52
|
+
* @property {BooleanSetting} debug
|
|
53
|
+
* @property {BooleanSetting} ignoreProjects:
|
|
54
|
+
* @property {BooleanSetting} json
|
|
55
|
+
* @property {BooleanSetting} selectProjects
|
|
56
|
+
* @property {BooleanSetting} showConfig
|
|
57
|
+
* @property {BooleanSetting} useStderr
|
|
58
|
+
* @property {BooleanSetting} watch
|
|
59
|
+
* @property {BooleanSetting} watchAll
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* A setting that may only be a string.
|
|
64
|
+
* @typedef {string} module:gulpConfig~StringSetting
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Any single configuration option is a Setting.
|
|
69
|
+
* @typedef {ArrayableSetting|BooleanSetting|FlagsSetting|StringSetting} Setting
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A set of Configurations options defined by Settings.
|
|
74
|
+
* @typedef {Object<string, Setting>} module:gulpConfig~Configurations
|
|
75
|
+
* @property {StringSetting} browserName
|
|
76
|
+
* @property {StringSetting} browserPath
|
|
77
|
+
* @property {StringSetting} distMain
|
|
78
|
+
* @property {StringSetting} distPath
|
|
79
|
+
* @property {ArrayableSetting} distSearch
|
|
80
|
+
* @property {BooleanSetting} nodeOnly
|
|
81
|
+
* @property {StringSetting} readmeTemplate
|
|
82
|
+
* @property {ArrayableSetting} readmeOptions
|
|
83
|
+
* @property {StringSetting} readmeFile
|
|
84
|
+
* @property {StringSetting} readmePath
|
|
85
|
+
* @property {ArrayableSetting} readmeSearch
|
|
86
|
+
* @property {StringSetting} rootPath
|
|
87
|
+
* @property {StringSetting} srcPath
|
|
88
|
+
* @property {ArrayableSetting} srcSearch
|
|
89
|
+
* @property {JestTestFlags} testOptions
|
|
90
|
+
* @property {ArrayableSetting} testPath
|
|
91
|
+
* @property {FlagStringSetting} useTsConfig
|
|
92
|
+
* @property {ArrayableSetting} watchSearch
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* All the available configuration setting options for running the build.
|
|
97
|
+
* @memberOf module:gulpConfig` `
|
|
98
|
+
* @type {Configurations}
|
|
99
|
+
*/
|
|
100
|
+
let gulpConfigurations = {}
|
|
8
101
|
try {
|
|
9
|
-
|
|
102
|
+
gulpConfigurations = require('../../build-tools.config.js')
|
|
10
103
|
} catch (isUndefined) {
|
|
11
104
|
try {
|
|
12
|
-
|
|
13
|
-
|
|
105
|
+
// Missing main project config, using default path
|
|
106
|
+
gulpConfigurations = require('./build-tools.config.js')
|
|
14
107
|
} catch (stillUndefined) {
|
|
15
108
|
console.warn('Missing config path, ensure you have a build-tools.config.js file in you project root')
|
|
16
109
|
}
|
|
17
110
|
}
|
|
111
|
+
|
|
112
|
+
const setDefaults = {
|
|
113
|
+
browserName: 'default',
|
|
114
|
+
browserPath: 'browser',
|
|
115
|
+
distMain: 'dist/main',
|
|
116
|
+
distPath: 'dist',
|
|
117
|
+
distSearch: 'dist/**/*.js',
|
|
118
|
+
nodeOnly: false,
|
|
119
|
+
readmeTemplate: 'MAIN.md',
|
|
120
|
+
readmeOptions: 'utf8',
|
|
121
|
+
readmeFile: 'README.md',
|
|
122
|
+
readmePath: './',
|
|
123
|
+
readmeSearch: 'src/**/!(*.test).js',
|
|
124
|
+
rootPath: './',
|
|
125
|
+
srcPath: 'src',
|
|
126
|
+
srcSearch: 'src/**/!(*.test).js',
|
|
127
|
+
testOptions: {
|
|
128
|
+
clearCache: false,
|
|
129
|
+
debug: false,
|
|
130
|
+
ignoreProjects: false,
|
|
131
|
+
json: false,
|
|
132
|
+
selectProjects: false,
|
|
133
|
+
showConfig: false,
|
|
134
|
+
useStderr: false,
|
|
135
|
+
watch: false,
|
|
136
|
+
watchAll: false,
|
|
137
|
+
},
|
|
138
|
+
testPath: ['src'],
|
|
139
|
+
tsSearch: 'src/**/*.ts',
|
|
140
|
+
useTsConfig: false,
|
|
141
|
+
watchSearch: 'src/**/*.js'
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
Object.keys(setDefaults).forEach(parentKey => {
|
|
145
|
+
gulpConfigurations[parentKey] = defaultConfig(gulpConfigurations, parentKey, setDefaults[parentKey])
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Retrieve a value from teh configurations, default may be returned.
|
|
150
|
+
* @function
|
|
151
|
+
* @memberOf module:gulpConfig
|
|
152
|
+
* @param {string|null} path
|
|
153
|
+
* @param {*} defaultValue
|
|
154
|
+
* @returns {*|null}
|
|
155
|
+
*/
|
|
156
|
+
const get = (path = null, defaultValue = null) => defaultConfig(gulpConfigurations, path, defaultValue)
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Specify a value for the configurations to use.
|
|
160
|
+
* @function
|
|
161
|
+
* @memberOf module:gulpConfig
|
|
162
|
+
* @param path
|
|
163
|
+
* @param value
|
|
164
|
+
* @returns {*}
|
|
165
|
+
*/
|
|
166
|
+
const set = (path, value) => {
|
|
167
|
+
gulpConfigurations[path] = value
|
|
168
|
+
return value
|
|
169
|
+
}
|
|
170
|
+
|
|
18
171
|
module.exports = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
distPath: defaultConfig(parentConfig, 'distPath', 'dist'),
|
|
23
|
-
distSearch: defaultConfig(parentConfig, 'distSearch', 'dist/**/*.js'),
|
|
24
|
-
nodeOnly: defaultConfig(parentConfig, 'nodeOnly', false),
|
|
25
|
-
readmeTemplate: defaultConfig(parentConfig, 'readmeTemplate', 'MAIN.md'),
|
|
26
|
-
srcPath: defaultConfig(parentConfig, 'srcPath', 'src'),
|
|
27
|
-
srcSearch: defaultConfig(parentConfig, 'srcSearch', 'src/**/!(*.test).js'),
|
|
28
|
-
testPath: defaultConfig(parentConfig, 'testPath', ['src']),
|
|
29
|
-
watchSearch: defaultConfig(parentConfig, 'watchSearch', 'src/**/*.js'),
|
|
172
|
+
defaultConfig,
|
|
173
|
+
get,
|
|
174
|
+
set
|
|
30
175
|
}
|
package/gulpfile.base.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export these functions to your own project in order to customize your build pipeline.
|
|
3
|
+
* @file
|
|
4
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
5
|
+
* @version 2.0.0
|
|
6
|
+
* @module js-build-tools
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const gulpConfig = require('./gulp.config.js')
|
|
1
10
|
const build = require('./functions/build.js')
|
|
2
11
|
const compileReadme = require('./functions/compileReadme.js')
|
|
3
12
|
const defaultCmd = require('./functions/default.js')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js-build-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Standardised build process with gulp.",
|
|
5
5
|
"main": "gulpfile.base.js",
|
|
6
6
|
"scripts": {
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"gulp-babel": "^8.0.0",
|
|
48
48
|
"gulp-rename": "^2.0.0",
|
|
49
49
|
"gulp-standard": "^14.0.0",
|
|
50
|
+
"gulp-typescript": "^6.0.0-alpha.1",
|
|
50
51
|
"gulp-uglify-es": "^3.0.0",
|
|
51
52
|
"jest": "^29.6.4",
|
|
52
53
|
"jest-environment-jsdom": "^29.6.4",
|
package/dist/addToReadme.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const fs = require('fs')
|
|
4
|
-
const gulpConfig = require('../gulp.config.js')
|
|
5
|
-
const jsdoc2md = require('jsdoc-to-markdown')
|
|
6
|
-
const {
|
|
7
|
-
globSync
|
|
8
|
-
} = require('glob')
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Appends all the jsdoc comments to the readme file. Assumes empty or templated file.
|
|
12
|
-
* @returns {string|Uint8Array}
|
|
13
|
-
*/
|
|
14
|
-
const addToReadme = done => {
|
|
15
|
-
const files = globSync(gulpConfig.srcSearch)
|
|
16
|
-
const readme = jsdoc2md.renderSync({
|
|
17
|
-
files: files
|
|
18
|
-
})
|
|
19
|
-
fs.appendFileSync('README.md', readme, 'utf8')
|
|
20
|
-
done()
|
|
21
|
-
}
|
|
22
|
-
module.exports = addToReadme
|
package/dist/addToReadme.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const fs=require("fs"),gulpConfig=require("../gulp.config.js"),jsdoc2md=require("jsdoc-to-markdown"),{globSync:globSync}=require("glob"),addToReadme=e=>{const o=globSync(gulpConfig.srcSearch),d=jsdoc2md.renderSync({files:o});fs.appendFileSync("README.md",d,"utf8"),e()};module.exports=addToReadme;
|
package/dist/clean.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const del = require('del')
|
|
4
|
-
const gulpConfig = require('../gulp.config.js')
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Deletes all the distribution and browser files (used before create a new build).
|
|
8
|
-
* @returns {Promise<string[]> | *}
|
|
9
|
-
*/
|
|
10
|
-
const clean = () => del([gulpConfig.distPath, gulpConfig.browserPath])
|
|
11
|
-
module.exports = clean
|
package/dist/clean.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const del=require("del"),gulpConfig=require("../gulp.config.js"),clean=()=>del([gulpConfig.distPath,gulpConfig.browserPath]);module.exports=clean;
|
package/dist/distFor.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const babel = require('gulp-babel')
|
|
4
|
-
const {
|
|
5
|
-
dest,
|
|
6
|
-
src
|
|
7
|
-
} = require('gulp')
|
|
8
|
-
const gulpConfig = require('../gulp.config.js')
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Build the distribution for a given source pattern.
|
|
12
|
-
* @param {string|array} srcPath
|
|
13
|
-
* @param {string} destPath
|
|
14
|
-
* @returns {*}
|
|
15
|
-
*/
|
|
16
|
-
const distFor = function () {
|
|
17
|
-
const srcPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gulpConfig.srcSearch
|
|
18
|
-
const destPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gulpConfig.distPath
|
|
19
|
-
return src(srcPath).pipe(babel()).pipe(dest(destPath))
|
|
20
|
-
}
|
|
21
|
-
module.exports = distFor
|
package/dist/distFor.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const babel=require("gulp-babel"),{dest:dest,src:src}=require("gulp"),gulpConfig=require("../gulp.config.js"),distFor=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:gulpConfig.srcSearch,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gulpConfig.distPath;return src(e).pipe(babel()).pipe(dest(r))};module.exports=distFor;
|
package/dist/readmeTemplate.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
/**
|
|
11
|
-
* Copy a readme template into the README.md file.
|
|
12
|
-
* @returns {*}
|
|
13
|
-
*/
|
|
14
|
-
const readmeTemplate = () => src(gulpConfig.readmeTemplate).pipe(rename('README.md')).pipe(dest('.'))
|
|
15
|
-
module.exports = readmeTemplate
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const{dest:dest,src:src}=require("gulp"),gulpConfig=require("../gulp.config.js"),rename=require("gulp-rename"),readmeTemplate=()=>src(gulpConfig.readmeTemplate).pipe(rename("README.md")).pipe(dest("."));module.exports=readmeTemplate;
|
package/functions/addToReadme.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const gulpConfig = require('../gulp.config.js')
|
|
3
|
-
const jsdoc2md = require('jsdoc-to-markdown')
|
|
4
|
-
const { globSync } = require('glob')
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Appends all the jsdoc comments to the readme file. Assumes empty or templated file.
|
|
8
|
-
* @returns {string|Uint8Array}
|
|
9
|
-
*/
|
|
10
|
-
const addToReadme = done => {
|
|
11
|
-
const files = globSync(gulpConfig.srcSearch)
|
|
12
|
-
const readme = jsdoc2md.renderSync({ files: files })
|
|
13
|
-
fs.appendFileSync('README.md', readme, 'utf8')
|
|
14
|
-
done()
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
module.exports = addToReadme
|
package/functions/clean.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const del = require('del')
|
|
2
|
-
const gulpConfig = require('../gulp.config.js')
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Deletes all the distribution and browser files (used before create a new build).
|
|
6
|
-
* @returns {Promise<string[]> | *}
|
|
7
|
-
*/
|
|
8
|
-
const clean = () => del([gulpConfig.distPath, gulpConfig.browserPath])
|
|
9
|
-
|
|
10
|
-
module.exports = clean
|
package/functions/distFor.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const babel = require('gulp-babel')
|
|
2
|
-
const { dest, src } = require('gulp')
|
|
3
|
-
const gulpConfig = require('../gulp.config.js')
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Build the distribution for a given source pattern.
|
|
7
|
-
* @param {string|array} srcPath
|
|
8
|
-
* @param {string} destPath
|
|
9
|
-
* @returns {*}
|
|
10
|
-
*/
|
|
11
|
-
const distFor = (srcPath = gulpConfig.srcSearch, destPath = gulpConfig.distPath) => src(srcPath)
|
|
12
|
-
.pipe(babel())
|
|
13
|
-
.pipe(dest(destPath))
|
|
14
|
-
|
|
15
|
-
module.exports = distFor
|
|
@@ -1,13 +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
|
-
* @returns {*}
|
|
8
|
-
*/
|
|
9
|
-
const readmeTemplate = () => src(gulpConfig.readmeTemplate)
|
|
10
|
-
.pipe(rename('README.md'))
|
|
11
|
-
.pipe(dest('.'))
|
|
12
|
-
|
|
13
|
-
module.exports = readmeTemplate
|