js-build-tools 1.0.5 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +353 -100
  2. package/babel.config.js +3 -0
  3. package/dist/addToReadme.js +38 -0
  4. package/dist/addToReadme.min.js +1 -0
  5. package/dist/build.js +32 -0
  6. package/dist/build.min.js +1 -0
  7. package/dist/bundle.js +20 -0
  8. package/dist/bundle.min.js +1 -0
  9. package/dist/bundleLint.js +26 -0
  10. package/dist/bundleLint.min.js +1 -0
  11. package/dist/bundleMinify.js +26 -0
  12. package/dist/bundleMinify.min.js +1 -0
  13. package/dist/clean.js +15 -0
  14. package/dist/clean.min.js +1 -0
  15. package/dist/compileReadme.js +14 -0
  16. package/dist/compileReadme.min.js +1 -0
  17. package/dist/default.js +16 -0
  18. package/dist/default.min.js +1 -0
  19. package/dist/dist.js +13 -0
  20. package/dist/dist.min.js +1 -0
  21. package/dist/distFor.js +23 -0
  22. package/dist/distFor.min.js +1 -0
  23. package/dist/distLint.js +24 -0
  24. package/dist/distLint.min.js +1 -0
  25. package/dist/distMinify.js +24 -0
  26. package/dist/distMinify.min.js +1 -0
  27. package/dist/readmeTemplate.js +19 -0
  28. package/dist/readmeTemplate.min.js +1 -0
  29. package/dist/testFull.js +85 -0
  30. package/dist/testFull.min.js +1 -0
  31. package/dist/testHelpers.js +203 -0
  32. package/dist/testHelpers.min.js +1 -0
  33. package/dist/testQuick.js +87 -0
  34. package/dist/testQuick.min.js +1 -0
  35. package/dist/watchFull.js +42 -0
  36. package/dist/watchFull.min.js +1 -0
  37. package/dist/watchTest.js +21 -0
  38. package/dist/watchTest.min.js +1 -0
  39. package/functions/addToReadme.js +1 -1
  40. package/functions/build.js +4 -1
  41. package/functions/default.js +2 -1
  42. package/functions/testHelpers.js +142 -0
  43. package/functions/testHelpers.test.js +100 -0
  44. package/gulp.config.js +12 -1
  45. package/package.json +18 -14
package/README.md CHANGED
@@ -1,100 +1,353 @@
1
- # js-build-tools
2
- Centralize the build process for node.js and JS projects into a single tool suite.
3
-
4
- ### Goals
5
- Using this tool suite, you can:
6
- * Create formatted distribution files to be used in a node / commonjs environment.
7
- * Bundle your distribution files to be used in a browser environment.
8
- * Run tests and watch for changes.
9
- * Generate jsdoc readme files.
10
-
11
- ## Installation
12
- In your project's root directory, run: `npm install --save-dev gulp js-build-tools`
13
- (or `yarn add --dev gulp js-build-tools` if you use Yarn).
14
-
15
- It is recommended to install gulp with the `-g` flag, so that you can run it with `gulp` instead of `node_modules/.bin/gulp`.
16
-
17
- ## Configuration
18
- In your project's root directory, create a `build-tools.config.js` file. This can contain any of the following (values provided are the defaults):
19
- ```
20
- module.exports = {
21
- // The name to use for the browser-bundled output file (.js will be appended).
22
- browserName: 'my-package',
23
-
24
- // The output directory for browser-bundled files.
25
- browserPath: 'browser',
26
-
27
- // The name of entry the distribution file.
28
- distMain: 'dist/main',
29
-
30
- // The output directory for the distribution files.
31
- distPath: 'dist',
32
-
33
- // The search pattern used for retrieving compiled distribution files.
34
- distSearch: 'dist/**/*.js',
35
-
36
- // The file which will be pre-fixed to your README.md output.
37
- readmeTemplate: 'MAIN.md',
38
-
39
- // The directory where your source files are stored (the files you manually created).
40
- srcPath: 'src',
41
-
42
- // The search pattern used for gathering source files for distribution.
43
- srcSearch: 'src/**/!(*.test).js',
44
-
45
- // The directory where Jest test files are stored.
46
- // By default stored as *.test.js adjacent with the files they are testing).
47
- testPath: 'src',
48
-
49
- // The search pattern for watching files for changes.
50
- watchSearch: 'src/**/*.js',
51
- }
52
- ```
53
-
54
- ### Create your local gulpfile.js
55
- In your project's root directory, create a `gulpfile.js` file, in here you can require any of the functions you need. For example:
56
- ```
57
- // Your local gulpfile.js
58
- const { build, defaultCmd, readme, testFull, testQuick, watchFull, watchTest } = require('js-build-tools')
59
-
60
- // Everything you export will be created as a gulp task.
61
- // You can build your own tasks here as well by using some of the functions `js-build-tools/functions`.
62
- // You can list your available tasks by running `gulp --tasks`.
63
- exports.build = build
64
- exports.default = defaultCmd
65
- exports.readme = readme
66
- exports.testFull = testFull
67
- exports.testQuick = testQuick
68
- exports.watchFull = watchFull
69
- exports.watchTest = watchTest
70
- ```
71
-
72
- Verify your tasks are available by running `gulp --tasks`.
73
-
74
- ### Configure Babel
75
- Depending on how you wrote your test files, Jest may require some Babel configuration.
76
- Create a `babel.config.js` file in the root directory of your project.
77
- You can then use the recommended configuration by requiring the babel.config.js file into your own configuration file.
78
- Example:
79
- ```
80
- const babelConfig = require('js-build-tools/babel.config')
81
- // You may add additional configuration here. Example: babelConfig.presets.push('@babel/preset-env')
82
- module.exports = babelConfig
83
- ```
84
-
85
- ### Configure Scripts
86
- In your package.json file, add the following scripts:
87
- ```
88
- "scripts": {
89
- "build": "gulp build",
90
- "dev": "gulp",
91
- "readme": "gulp readme",
92
- "test": "gulp testFull",
93
- "test:quick": "gulp testQuick",
94
- "watch": "gulp watchFull",
95
- "watch:test": "gulp watchTest"
96
- },
97
- ```
98
-
99
- ## Usage
100
- Run any of the above commands with `gulp` or `npm run`.
1
+ # js-build-tools
2
+ Centralize the build process for node.js and JS projects into a single tool suite.
3
+
4
+ ### Goals
5
+ Using this tool suite, you can:
6
+ * Create formatted distribution files to be used in a node / commonjs environment.
7
+ * Bundle your distribution files to be used in a browser environment.
8
+ * Run tests and watch for changes.
9
+ * Generate jsdoc readme files.
10
+
11
+ ## Installation
12
+ In your project's root directory, run: `npm install --save-dev gulp js-build-tools`
13
+ (or `yarn add --dev gulp js-build-tools` if you use Yarn).
14
+
15
+ It is recommended to install gulp with the `-g` flag, so that you can run it with `gulp` instead of `node_modules/.bin/gulp`.
16
+
17
+ ## Configuration
18
+ In your project's root directory, create a `build-tools.config.js` file. This can contain any of the following (values provided are the defaults):
19
+ ```
20
+ module.exports = {
21
+ // The name to use for the browser-bundled output file (.js will be appended).
22
+ browserName: 'my-package',
23
+
24
+ // The output directory for browser-bundled files.
25
+ browserPath: 'browser',
26
+
27
+ // The name of entry the distribution file.
28
+ distMain: 'dist/main',
29
+
30
+ // The output directory for the distribution files.
31
+ distPath: 'dist',
32
+
33
+ // The search pattern used for retrieving compiled distribution files.
34
+ distSearch: 'dist/**/*.js',
35
+
36
+ // The file which will be pre-fixed to your README.md output.
37
+ readmeTemplate: 'MAIN.md',
38
+
39
+ // The directory where your source files are stored (the files you manually created).
40
+ srcPath: 'src',
41
+
42
+ // The search pattern used for gathering source files for distribution.
43
+ srcSearch: 'src/**/!(*.test).js',
44
+
45
+ // The directory where Jest test files are stored.
46
+ // By default stored as *.test.js adjacent with the files they are testing).
47
+ testPath: 'src',
48
+
49
+ // The search pattern for watching files for changes.
50
+ watchSearch: 'src/**/*.js',
51
+ }
52
+ ```
53
+
54
+ ### Create your local gulpfile.js
55
+ In your project's root directory, create a `gulpfile.js` file, in here you can require any of the functions you need. For example:
56
+ ```
57
+ // Your local gulpfile.js
58
+ const { build, defaultCmd, readme, testFull, testQuick, watchFull, watchTest } = require('js-build-tools')
59
+
60
+ // Everything you export will be created as a gulp task.
61
+ // You can build your own tasks here as well by using some of the functions `js-build-tools/functions`.
62
+ // You can list your available tasks by running `gulp --tasks`.
63
+ exports.build = build
64
+ exports.default = defaultCmd
65
+ exports.readme = readme
66
+ exports.testFull = testFull
67
+ exports.testQuick = testQuick
68
+ exports.watchFull = watchFull
69
+ exports.watchTest = watchTest
70
+ ```
71
+
72
+ Verify your tasks are available by running `gulp --tasks`.
73
+
74
+ ### Configure Babel
75
+ Depending on how you wrote your test files, Jest may require some Babel configuration.
76
+ Create a `babel.config.js` file in the root directory of your project.
77
+ You can then use the recommended configuration by requiring the babel.config.js file into your own configuration file.
78
+ Example:
79
+ ```
80
+ const babelConfig = require('js-build-tools/babel.config')
81
+ // You may add additional configuration here. Example: babelConfig.presets.push('@babel/preset-env')
82
+ module.exports = babelConfig
83
+ ```
84
+
85
+ ### Configure Scripts
86
+ In your package.json file, add the following scripts:
87
+ ```
88
+ "scripts": {
89
+ "build": "gulp build",
90
+ "dev": "gulp",
91
+ "readme": "gulp readme",
92
+ "test": "gulp testFull",
93
+ "test:quick": "gulp testQuick",
94
+ "watch": "gulp watchFull",
95
+ "watch:test": "gulp watchTest"
96
+ },
97
+ ```
98
+
99
+ ## Usage
100
+ Run any of the above commands with `gulp` or `npm run`.
101
+
102
+
103
+ # Available functions documentation
104
+
105
+ ## Constants
106
+
107
+ <dl>
108
+ <dt><a href="#build">build</a></dt>
109
+ <dd><p>Runs several processes to build and validate the project.
110
+ Cleans, distributes (lint and minify), bundles (lint and minify), creates the readme, then runs the tests.</p>
111
+ </dd>
112
+ <dt><a href="#compileReadme">compileReadme</a></dt>
113
+ <dd><p>Generate the README.md file based off of the template, then append the generated documentation.</p>
114
+ </dd>
115
+ <dt><a href="#defaultCmd">defaultCmd</a></dt>
116
+ <dd><p>Recommended as the default task, runs the simple dist and bundle tasks.</p>
117
+ </dd>
118
+ <dt><a href="#logObject">logObject</a></dt>
119
+ <dd><p>Log out an object in a nicely formatted way.</p>
120
+ </dd>
121
+ <dt><a href="#circularObject">circularObject</a> : <code>Object.&lt;string, (string|Object|Array)&gt;</code></dt>
122
+ <dd><p>Multilayered node tree-like structure with parent references</p>
123
+ </dd>
124
+ <dt><a href="#deepReferenceObject">deepReferenceObject</a> : <code>Object.&lt;string, (string|number|Object)&gt;</code></dt>
125
+ <dd><p>Sample object with deep references.</p>
126
+ </dd>
127
+ <dt><a href="#linkedList">linkedList</a> : <code>Object.&lt;string, (string|Object)&gt;</code></dt>
128
+ <dd><p>Sample LinkedList for testing circular references.</p>
129
+ </dd>
130
+ <dt><a href="#jsonDom">jsonDom</a></dt>
131
+ <dd><p>Sample of jsonDom object containing empty nested array and objects</p>
132
+ </dd>
133
+ <dt><a href="#domItem">domItem</a></dt>
134
+ <dd><p>Sample of domItem child with nested child and optional details</p>
135
+ </dd>
136
+ <dt><a href="#multiReferenceObject">multiReferenceObject</a> : <code>Object.&lt;string, (string|number|Object)&gt;</code></dt>
137
+ <dd><p>Sample of object containing multiple references.</p>
138
+ </dd>
139
+ <dt><a href="#nodeTree">nodeTree</a> : <code>Object.&lt;string, (string|Object|Array)&gt;</code></dt>
140
+ <dd><p>Sample NodeTree for testing circular references and arrays.</p>
141
+ </dd>
142
+ </dl>
143
+
144
+ ## Functions
145
+
146
+ <dl>
147
+ <dt><a href="#addToReadme">addToReadme()</a> ⇒ <code>string</code> | <code>Uint8Array</code></dt>
148
+ <dd><p>Appends all the jsdoc comments to the readme file. Assumes empty or templated file.</p>
149
+ </dd>
150
+ <dt><a href="#bundle">bundle()</a> ⇒ <code>*</code></dt>
151
+ <dd><p>Starting at the distribution entry point, bundle all the files into a single file and store them in the specified output directory.</p>
152
+ </dd>
153
+ <dt><a href="#bundleLint">bundleLint()</a> ⇒ <code>*</code></dt>
154
+ <dd><p>Applies Standard code style linting to bundled file.</p>
155
+ </dd>
156
+ <dt><a href="#bundleMinify">bundleMinify()</a> ⇒ <code>*</code></dt>
157
+ <dd><p>Creates the minified bundle file.</p>
158
+ </dd>
159
+ <dt><a href="#clean">clean()</a> ⇒ <code>Promise.&lt;Array.&lt;string&gt;&gt;</code> | <code>*</code></dt>
160
+ <dd><p>Deletes all the distribution and browser files (used before create a new build).</p>
161
+ </dd>
162
+ <dt><a href="#dist">dist()</a> ⇒ <code>*</code></dt>
163
+ <dd><p>Simplified distribution tasks which will use arguments from distFor.</p>
164
+ </dd>
165
+ <dt><a href="#distFor">distFor(srcPath, destPath)</a> ⇒ <code>*</code></dt>
166
+ <dd><p>Build the distribution for a given source pattern.</p>
167
+ </dd>
168
+ <dt><a href="#distLint">distLint()</a> ⇒ <code>*</code></dt>
169
+ <dd><p>Applies Standard code style linting to distribution files.</p>
170
+ </dd>
171
+ <dt><a href="#distMinify">distMinify()</a> ⇒ <code>*</code></dt>
172
+ <dd><p>Creates minified versions of the dist files.</p>
173
+ </dd>
174
+ <dt><a href="#readmeTemplate">readmeTemplate()</a> ⇒ <code>*</code></dt>
175
+ <dd><p>Copy a readme template into the README.md file.</p>
176
+ </dd>
177
+ <dt><a href="#testFull">testFull()</a> ⇒ <code>Promise.&lt;*&gt;</code></dt>
178
+ <dd><p>Run all tests with jest.</p>
179
+ </dd>
180
+ <dt><a href="#testQuick">testQuick()</a> ⇒ <code>Promise.&lt;*&gt;</code></dt>
181
+ <dd><p>Run the Jest tests for files which have been modified (based on git status).</p>
182
+ </dd>
183
+ <dt><a href="#watchFull">watchFull()</a> ⇒ <code>*</code></dt>
184
+ <dd><p>Watch for changes and run the distribution for the changed files, then bundle and test the changed files.</p>
185
+ </dd>
186
+ <dt><a href="#watchTest">watchTest()</a> ⇒ <code>*</code></dt>
187
+ <dd><p>Watch for changes and run the tests.</p>
188
+ </dd>
189
+ </dl>
190
+
191
+ <a name="build"></a>
192
+
193
+ ## build
194
+ Runs several processes to build and validate the project.
195
+ Cleans, distributes (lint and minify), bundles (lint and minify), creates the readme, then runs the tests.
196
+
197
+ **Kind**: global constant
198
+ <a name="compileReadme"></a>
199
+
200
+ ## compileReadme
201
+ Generate the README.md file based off of the template, then append the generated documentation.
202
+
203
+ **Kind**: global constant
204
+ <a name="defaultCmd"></a>
205
+
206
+ ## defaultCmd
207
+ Recommended as the default task, runs the simple dist and bundle tasks.
208
+
209
+ **Kind**: global constant
210
+ <a name="logObject"></a>
211
+
212
+ ## logObject
213
+ Log out an object in a nicely formatted way.
214
+
215
+ **Kind**: global constant
216
+
217
+ | Param | Type | Default |
218
+ | --- | --- | --- |
219
+ | object | <code>Object</code> | |
220
+ | [label] | <code>string</code> | <code>&quot;&#x27;logging&#x27;&quot;</code> |
221
+
222
+ <a name="circularObject"></a>
223
+
224
+ ## circularObject : <code>Object.&lt;string, (string\|Object\|Array)&gt;</code>
225
+ Multilayered node tree-like structure with parent references
226
+
227
+ **Kind**: global constant
228
+ <a name="deepReferenceObject"></a>
229
+
230
+ ## deepReferenceObject : <code>Object.&lt;string, (string\|number\|Object)&gt;</code>
231
+ Sample object with deep references.
232
+
233
+ **Kind**: global constant
234
+ <a name="linkedList"></a>
235
+
236
+ ## linkedList : <code>Object.&lt;string, (string\|Object)&gt;</code>
237
+ Sample LinkedList for testing circular references.
238
+
239
+ **Kind**: global constant
240
+ <a name="jsonDom"></a>
241
+
242
+ ## jsonDom
243
+ Sample of jsonDom object containing empty nested array and objects
244
+
245
+ **Kind**: global constant
246
+ <a name="domItem"></a>
247
+
248
+ ## domItem
249
+ Sample of domItem child with nested child and optional details
250
+
251
+ **Kind**: global constant
252
+ <a name="multiReferenceObject"></a>
253
+
254
+ ## multiReferenceObject : <code>Object.&lt;string, (string\|number\|Object)&gt;</code>
255
+ Sample of object containing multiple references.
256
+
257
+ **Kind**: global constant
258
+ <a name="nodeTree"></a>
259
+
260
+ ## nodeTree : <code>Object.&lt;string, (string\|Object\|Array)&gt;</code>
261
+ Sample NodeTree for testing circular references and arrays.
262
+
263
+ **Kind**: global constant
264
+ <a name="addToReadme"></a>
265
+
266
+ ## addToReadme() ⇒ <code>string</code> \| <code>Uint8Array</code>
267
+ Appends all the jsdoc comments to the readme file. Assumes empty or templated file.
268
+
269
+ **Kind**: global function
270
+ <a name="bundle"></a>
271
+
272
+ ## bundle() ⇒ <code>\*</code>
273
+ Starting at the distribution entry point, bundle all the files into a single file and store them in the specified output directory.
274
+
275
+ **Kind**: global function
276
+ <a name="bundleLint"></a>
277
+
278
+ ## bundleLint() ⇒ <code>\*</code>
279
+ Applies Standard code style linting to bundled file.
280
+
281
+ **Kind**: global function
282
+ <a name="bundleMinify"></a>
283
+
284
+ ## bundleMinify() ⇒ <code>\*</code>
285
+ Creates the minified bundle file.
286
+
287
+ **Kind**: global function
288
+ <a name="clean"></a>
289
+
290
+ ## clean() ⇒ <code>Promise.&lt;Array.&lt;string&gt;&gt;</code> \| <code>\*</code>
291
+ Deletes all the distribution and browser files (used before create a new build).
292
+
293
+ **Kind**: global function
294
+ <a name="dist"></a>
295
+
296
+ ## dist() ⇒ <code>\*</code>
297
+ Simplified distribution tasks which will use arguments from distFor.
298
+
299
+ **Kind**: global function
300
+ <a name="distFor"></a>
301
+
302
+ ## distFor(srcPath, destPath) ⇒ <code>\*</code>
303
+ Build the distribution for a given source pattern.
304
+
305
+ **Kind**: global function
306
+
307
+ | Param | Type |
308
+ | --- | --- |
309
+ | srcPath | <code>string</code> \| <code>array</code> |
310
+ | destPath | <code>string</code> |
311
+
312
+ <a name="distLint"></a>
313
+
314
+ ## distLint() ⇒ <code>\*</code>
315
+ Applies Standard code style linting to distribution files.
316
+
317
+ **Kind**: global function
318
+ <a name="distMinify"></a>
319
+
320
+ ## distMinify() ⇒ <code>\*</code>
321
+ Creates minified versions of the dist files.
322
+
323
+ **Kind**: global function
324
+ <a name="readmeTemplate"></a>
325
+
326
+ ## readmeTemplate() ⇒ <code>\*</code>
327
+ Copy a readme template into the README.md file.
328
+
329
+ **Kind**: global function
330
+ <a name="testFull"></a>
331
+
332
+ ## testFull() ⇒ <code>Promise.&lt;\*&gt;</code>
333
+ Run all tests with jest.
334
+
335
+ **Kind**: global function
336
+ <a name="testQuick"></a>
337
+
338
+ ## testQuick() ⇒ <code>Promise.&lt;\*&gt;</code>
339
+ Run the Jest tests for files which have been modified (based on git status).
340
+
341
+ **Kind**: global function
342
+ <a name="watchFull"></a>
343
+
344
+ ## watchFull() ⇒ <code>\*</code>
345
+ Watch for changes and run the distribution for the changed files, then bundle and test the changed files.
346
+
347
+ **Kind**: global function
348
+ <a name="watchTest"></a>
349
+
350
+ ## watchTest() ⇒ <code>\*</code>
351
+ Watch for changes and run the tests.
352
+
353
+ **Kind**: global function
package/babel.config.js CHANGED
@@ -1,4 +1,7 @@
1
1
  module.exports = {
2
+ plugins: [
3
+ '@babel/plugin-proposal-throw-expressions'
4
+ ],
2
5
  presets: [
3
6
  ['@babel/preset-env', {
4
7
  useBuiltIns: 'usage',
@@ -0,0 +1,38 @@
1
+ 'use strict'
2
+
3
+ require('core-js/modules/es.array.map.js')
4
+
5
+ require('core-js/modules/esnext.async-iterator.map.js')
6
+
7
+ require('core-js/modules/esnext.iterator.map.js')
8
+
9
+ require('core-js/modules/es.array.concat.js')
10
+
11
+ var filenames = require('gulp-filenames')
12
+
13
+ var fs = require('fs')
14
+
15
+ var gulpConfig = require('../gulp.config.js')
16
+
17
+ var jsdoc2md = require('jsdoc-to-markdown')
18
+
19
+ var _require = require('gulp')
20
+ var src = _require.src
21
+ /**
22
+ * Appends all the jsdoc comments to the readme file. Assumes empty or templated file.
23
+ * @returns {string|Uint8Array}
24
+ */
25
+
26
+ var addToReadme = function addToReadme () {
27
+ return src(gulpConfig.srcSearch).pipe(filenames('readme')).on('end', function () {
28
+ var readme = jsdoc2md.renderSync({
29
+ files: filenames.get('readme').map(function (file) {
30
+ return ''.concat(gulpConfig.srcPath, '/').concat(file)
31
+ })
32
+ })
33
+ fs.appendFileSync('README.md', readme, 'utf8')
34
+ return readme
35
+ })
36
+ }
37
+
38
+ module.exports = addToReadme
@@ -0,0 +1 @@
1
+ "use strict";require("core-js/modules/es.array.map.js"),require("core-js/modules/esnext.async-iterator.map.js"),require("core-js/modules/esnext.iterator.map.js"),require("core-js/modules/es.array.concat.js");var filenames=require("gulp-filenames"),fs=require("fs"),gulpConfig=require("../gulp.config.js"),jsdoc2md=require("jsdoc-to-markdown"),_require=require("gulp"),src=_require.src,addToReadme=function(){return src(gulpConfig.srcSearch).pipe(filenames("readme")).on("end",(function(){var e=jsdoc2md.renderSync({files:filenames.get("readme").map((function(e){return"".concat(gulpConfig.srcPath,"/").concat(e)}))});return fs.appendFileSync("README.md",e,"utf8"),e}))};module.exports=addToReadme;
package/dist/build.js ADDED
@@ -0,0 +1,32 @@
1
+ 'use strict'
2
+
3
+ var bundle = require('./bundle')
4
+
5
+ var bundleLint = require('./bundleLint')
6
+
7
+ var bundleMinify = require('./bundleMinify')
8
+
9
+ var clean = require('./clean')
10
+
11
+ var compileReadme = require('./compileReadme')
12
+
13
+ var dist = require('./dist')
14
+
15
+ var distLint = require('./distLint')
16
+
17
+ var distMinify = require('./distMinify')
18
+
19
+ var _require = require('gulp')
20
+ var parallel = _require.parallel
21
+ var series = _require.series
22
+
23
+ var gulpConfig = require('../gulp.config.js')
24
+
25
+ var testFull = require('./testFull')
26
+ /**
27
+ * Runs several processes to build and validate the project.
28
+ * Cleans, distributes (lint and minify), bundles (lint and minify), creates the readme, then runs the tests.
29
+ */
30
+
31
+ var build = parallel(gulpConfig.nodeOnly ? series(clean, dist, parallel(distLint, distMinify)) : series(clean, dist, parallel(distLint, distMinify), bundle, parallel(bundleLint, bundleMinify)), compileReadme, testFull)
32
+ module.exports = build
@@ -0,0 +1 @@
1
+ "use strict";var bundle=require("./bundle"),bundleLint=require("./bundleLint"),bundleMinify=require("./bundleMinify"),clean=require("./clean"),compileReadme=require("./compileReadme"),dist=require("./dist"),distLint=require("./distLint"),distMinify=require("./distMinify"),_require=require("gulp"),parallel=_require.parallel,series=_require.series,gulpConfig=require("../gulp.config.js"),testFull=require("./testFull"),build=parallel(gulpConfig.nodeOnly?series(clean,dist,parallel(distLint,distMinify)):series(clean,dist,parallel(distLint,distMinify),bundle,parallel(bundleLint,bundleMinify)),compileReadme,testFull);module.exports=build;
package/dist/bundle.js ADDED
@@ -0,0 +1,20 @@
1
+ 'use strict'
2
+
3
+ var browserify = require('browserify')
4
+
5
+ var _require = require('gulp')
6
+ var dest = _require.dest
7
+
8
+ var gulpConfig = require('../gulp.config.js')
9
+
10
+ var source = require('vinyl-source-stream')
11
+ /**
12
+ * Starting at the distribution entry point, bundle all the files into a single file and store them in the specified output directory.
13
+ * @returns {*}
14
+ */
15
+
16
+ var bundle = function bundle () {
17
+ return browserify(gulpConfig.distMain).bundle().pipe(source(''.concat(gulpConfig.browserName, '.js'))).pipe(dest(gulpConfig.browserPath))
18
+ }
19
+
20
+ module.exports = bundle
@@ -0,0 +1 @@
1
+ "use strict";var browserify=require("browserify"),_require=require("gulp"),dest=_require.dest,gulpConfig=require("../gulp.config.js"),source=require("vinyl-source-stream"),bundle=function(){return browserify(gulpConfig.distMain).bundle().pipe(source("".concat(gulpConfig.browserName,".js"))).pipe(dest(gulpConfig.browserPath))};module.exports=bundle;
@@ -0,0 +1,26 @@
1
+ 'use strict'
2
+
3
+ require('core-js/modules/es.array.concat.js')
4
+
5
+ var _require = require('gulp')
6
+ var dest = _require.dest
7
+ var src = _require.src
8
+
9
+ var gulpConfig = require('../gulp.config.js')
10
+
11
+ var standard = require('gulp-standard')
12
+ /**
13
+ * Applies Standard code style linting to bundled file.
14
+ * @returns {*}
15
+ */
16
+
17
+ var bundleLint = function bundleLint () {
18
+ return src(''.concat(gulpConfig.browserPath, '/').concat(gulpConfig.browserName, '.js')).pipe(standard({
19
+ fix: true
20
+ })).pipe(standard.reporter('default', {
21
+ fix: true,
22
+ quiet: true
23
+ })).pipe(dest(gulpConfig.browserPath))
24
+ }
25
+
26
+ module.exports = bundleLint
@@ -0,0 +1 @@
1
+ "use strict";require("core-js/modules/es.array.concat.js");var _require=require("gulp"),dest=_require.dest,src=_require.src,gulpConfig=require("../gulp.config.js"),standard=require("gulp-standard"),bundleLint=function(){return src("".concat(gulpConfig.browserPath,"/").concat(gulpConfig.browserName,".js")).pipe(standard({fix:!0})).pipe(standard.reporter("default",{fix:!0,quiet:!0})).pipe(dest(gulpConfig.browserPath))};module.exports=bundleLint;
@@ -0,0 +1,26 @@
1
+ 'use strict'
2
+
3
+ require('core-js/modules/es.array.concat.js')
4
+
5
+ var _require = require('gulp')
6
+ var dest = _require.dest
7
+ var src = _require.src
8
+
9
+ var gulpConfig = require('../gulp.config.js')
10
+
11
+ var _require2 = require('gulp-uglify-es')
12
+ var uglify = _require2.default
13
+
14
+ var rename = require('gulp-rename')
15
+ /**
16
+ * Creates the minified bundle file.
17
+ * @returns {*}
18
+ */
19
+
20
+ var bundleMinify = function bundleMinify () {
21
+ return src(''.concat(gulpConfig.browserPath, '/').concat(gulpConfig.browserName, '.js')).pipe(uglify()).pipe(rename({
22
+ extname: '.min.js'
23
+ })).pipe(dest(gulpConfig.browserPath))
24
+ }
25
+
26
+ module.exports = bundleMinify
@@ -0,0 +1 @@
1
+ "use strict";require("core-js/modules/es.array.concat.js");var _require=require("gulp"),dest=_require.dest,src=_require.src,gulpConfig=require("../gulp.config.js"),_require2=require("gulp-uglify-es"),uglify=_require2.default,rename=require("gulp-rename"),bundleMinify=function(){return src("".concat(gulpConfig.browserPath,"/").concat(gulpConfig.browserName,".js")).pipe(uglify()).pipe(rename({extname:".min.js"})).pipe(dest(gulpConfig.browserPath))};module.exports=bundleMinify;
package/dist/clean.js ADDED
@@ -0,0 +1,15 @@
1
+ 'use strict'
2
+
3
+ var del = require('del')
4
+
5
+ var gulpConfig = require('../gulp.config.js')
6
+ /**
7
+ * Deletes all the distribution and browser files (used before create a new build).
8
+ * @returns {Promise<string[]> | *}
9
+ */
10
+
11
+ var clean = function clean () {
12
+ return del([gulpConfig.distPath, gulpConfig.browserPath])
13
+ }
14
+
15
+ module.exports = clean
@@ -0,0 +1 @@
1
+ "use strict";var del=require("del"),gulpConfig=require("../gulp.config.js"),clean=function(){return del([gulpConfig.distPath,gulpConfig.browserPath])};module.exports=clean;
@@ -0,0 +1,14 @@
1
+ 'use strict'
2
+
3
+ var addToReadme = require('./addToReadme')
4
+
5
+ var readmeTemplate = require('./readmeTemplate')
6
+
7
+ var _require = require('gulp')
8
+ var series = _require.series
9
+ /**
10
+ * Generate the README.md file based off of the template, then append the generated documentation.
11
+ */
12
+
13
+ var compileReadme = series(readmeTemplate, addToReadme)
14
+ module.exports = compileReadme
@@ -0,0 +1 @@
1
+ "use strict";var addToReadme=require("./addToReadme"),readmeTemplate=require("./readmeTemplate"),_require=require("gulp"),series=_require.series,compileReadme=series(readmeTemplate,addToReadme);module.exports=compileReadme;