js-build-tools 1.2.2 → 1.2.3

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.
@@ -1,198 +1,198 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
6
- exports.nodeTree = exports.multiReferenceObject = exports.logObject = exports.linkedList = exports.jsonDom = exports.domItem = exports.deepReferenceObject = exports.circularObject = void 0
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
6
+ exports.nodeTree = exports.multiReferenceObject = exports.logObject = exports.linkedList = exports.jsonDom = exports.domItem = exports.deepReferenceObject = exports.circularObject = void 0
7
7
  /**
8
8
  * Log out an object in a nicely formatted way.
9
9
  * @param {Object} object
10
10
  * @param {string} [label='logging']
11
- */
12
- const logObject = function (object) {
13
- const label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'logging'
14
- if (typeof require === 'undefined') {
15
- console.log(label, object)
16
- return
17
- }
18
- console.log(label, require('util').inspect(object, false, null, true))
19
- }
20
-
11
+ */
12
+ const logObject = function (object) {
13
+ const label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'logging'
14
+ if (typeof require === 'undefined') {
15
+ console.log(label, object)
16
+ return
17
+ }
18
+ console.log(label, require('util').inspect(object, false, null, true))
19
+ }
20
+
21
21
  /**
22
22
  * Multilayered node tree-like structure with parent references
23
23
  * @type {Object.<string, string|Object|Array>}
24
- */
25
- exports.logObject = logObject
26
- const circularObject = {
27
- name: 'root',
28
- parent: {},
29
- body: {},
30
- head: {},
31
- children: []
32
- }
33
- exports.circularObject = circularObject
34
- circularObject.children = [{
35
- name: 'body',
36
- parent: {},
37
- children: []
38
- }, {
39
- name: 'head',
40
- parent: {},
41
- children: []
42
- }]
43
- circularObject.body = circularObject.children[0]
44
- circularObject.head = circularObject.children[1]
45
- circularObject.body.parent = circularObject
46
- circularObject.head.parent = circularObject
47
- circularObject.body.children = [{
48
- name: 'body child one',
49
- parent: {},
50
- children: []
51
- }, {
52
- name: 'body child two',
53
- parent: {},
54
- children: []
55
- }]
56
- circularObject.body.children[0].parent = circularObject.body
57
- circularObject.body.children[1].parent = circularObject.body
58
- circularObject.head.children = [{
59
- name: 'head child one',
60
- parent: {},
61
- children: []
62
- }, {
63
- name: 'head child two',
64
- parent: {},
65
- children: []
66
- }]
67
- circularObject.head.children[0].parent = circularObject.head
68
- circularObject.head.children[1].parent = circularObject.head
69
-
24
+ */
25
+ exports.logObject = logObject
26
+ const circularObject = {
27
+ name: 'root',
28
+ parent: {},
29
+ body: {},
30
+ head: {},
31
+ children: []
32
+ }
33
+ exports.circularObject = circularObject
34
+ circularObject.children = [{
35
+ name: 'body',
36
+ parent: {},
37
+ children: []
38
+ }, {
39
+ name: 'head',
40
+ parent: {},
41
+ children: []
42
+ }]
43
+ circularObject.body = circularObject.children[0]
44
+ circularObject.head = circularObject.children[1]
45
+ circularObject.body.parent = circularObject
46
+ circularObject.head.parent = circularObject
47
+ circularObject.body.children = [{
48
+ name: 'body child one',
49
+ parent: {},
50
+ children: []
51
+ }, {
52
+ name: 'body child two',
53
+ parent: {},
54
+ children: []
55
+ }]
56
+ circularObject.body.children[0].parent = circularObject.body
57
+ circularObject.body.children[1].parent = circularObject.body
58
+ circularObject.head.children = [{
59
+ name: 'head child one',
60
+ parent: {},
61
+ children: []
62
+ }, {
63
+ name: 'head child two',
64
+ parent: {},
65
+ children: []
66
+ }]
67
+ circularObject.head.children[0].parent = circularObject.head
68
+ circularObject.head.children[1].parent = circularObject.head
69
+
70
70
  /**
71
71
  * Sample object with deep references.
72
72
  * @type {Object.<string, string|number|Object>}
73
- */
74
- const deepReferenceObject = {
75
- object1: {
76
- name: 'someName',
77
- object2: {
78
- age: 12,
79
- array1: ['someString', 'anotherString']
80
- },
81
- array2: [89, 32]
82
- },
83
- title: 'Some Title',
84
- item: 45
85
- }
86
-
73
+ */
74
+ const deepReferenceObject = {
75
+ object1: {
76
+ name: 'someName',
77
+ object2: {
78
+ age: 12,
79
+ array1: ['someString', 'anotherString']
80
+ },
81
+ array2: [89, 32]
82
+ },
83
+ title: 'Some Title',
84
+ item: 45
85
+ }
86
+
87
87
  /**
88
88
  * Sample LinkedList for testing circular references.
89
89
  * @type {Object.<string, string|Object>}
90
- */
91
- exports.deepReferenceObject = deepReferenceObject
92
- const linkedList = {
93
- name: 'one',
94
- prev: null,
95
- next: null
96
- }
97
- exports.linkedList = linkedList
98
- linkedList.next = {
99
- name: 'two',
100
- prev: linkedList,
101
- next: null
102
- }
103
- linkedList.next.next = {
104
- name: 'three',
105
- prev: linkedList.next,
106
- next: null
107
- }
108
-
90
+ */
91
+ exports.deepReferenceObject = deepReferenceObject
92
+ const linkedList = {
93
+ name: 'one',
94
+ prev: null,
95
+ next: null
96
+ }
97
+ exports.linkedList = linkedList
98
+ linkedList.next = {
99
+ name: 'two',
100
+ prev: linkedList,
101
+ next: null
102
+ }
103
+ linkedList.next.next = {
104
+ name: 'three',
105
+ prev: linkedList.next,
106
+ next: null
107
+ }
108
+
109
109
  /**
110
110
  * Sample of jsonDom object containing empty nested array and objects
111
- */
112
- const jsonDom = {
113
- tagName: 'div',
114
- attributes: {
115
- style: {},
116
- className: 'column'
117
- },
118
- element: null,
119
- eventListeners: {},
120
- parentItem: {},
121
- children: [],
122
- axis: 'x'
123
- }
124
-
111
+ */
112
+ const jsonDom = {
113
+ tagName: 'div',
114
+ attributes: {
115
+ style: {},
116
+ className: 'column'
117
+ },
118
+ element: null,
119
+ eventListeners: {},
120
+ parentItem: {},
121
+ children: [],
122
+ axis: 'x'
123
+ }
124
+
125
125
  /**
126
126
  * Sample of domItem child with nested child and optional details
127
- */
128
- exports.jsonDom = jsonDom
129
- const domItem = [{
130
- attributes: {
131
- className: 'row',
132
- style: {}
133
- },
134
- axis: 'y',
135
- children: [{
136
- attributes: {
137
- style: {}
138
- },
139
- axis: 'x',
140
- children: [],
141
- element: {},
142
- eventListeners: {},
143
- hasShip: false,
144
- isHit: false,
145
- parentItem: {},
146
- point: {},
147
- tagName: 'div'
148
- }],
149
- element: null,
150
- eventListeners: {},
151
- parentItem: {},
152
- tagName: 'div'
153
- }]
154
-
127
+ */
128
+ exports.jsonDom = jsonDom
129
+ const domItem = [{
130
+ attributes: {
131
+ className: 'row',
132
+ style: {}
133
+ },
134
+ axis: 'y',
135
+ children: [{
136
+ attributes: {
137
+ style: {}
138
+ },
139
+ axis: 'x',
140
+ children: [],
141
+ element: {},
142
+ eventListeners: {},
143
+ hasShip: false,
144
+ isHit: false,
145
+ parentItem: {},
146
+ point: {},
147
+ tagName: 'div'
148
+ }],
149
+ element: null,
150
+ eventListeners: {},
151
+ parentItem: {},
152
+ tagName: 'div'
153
+ }]
154
+
155
155
  /**
156
156
  * Sample of object containing multiple references.
157
157
  * @type {Object.<string, string|number|Object>}
158
- */
159
- exports.domItem = domItem
160
- const multiReferenceObject = {
161
- object1: {
162
- name: 'someName'
163
- },
164
- object2: {
165
- age: 12
166
- },
167
- array1: ['someString', 'anotherString'],
168
- array2: [89, 32],
169
- title: 'Some Title',
170
- item: 45
171
- }
172
-
158
+ */
159
+ exports.domItem = domItem
160
+ const multiReferenceObject = {
161
+ object1: {
162
+ name: 'someName'
163
+ },
164
+ object2: {
165
+ age: 12
166
+ },
167
+ array1: ['someString', 'anotherString'],
168
+ array2: [89, 32],
169
+ title: 'Some Title',
170
+ item: 45
171
+ }
172
+
173
173
  /**
174
174
  * Sample NodeTree for testing circular references and arrays.
175
175
  * @type {Object.<string, string|Object|Array>}
176
- */
177
- exports.multiReferenceObject = multiReferenceObject
178
- const nodeTree = {
179
- name: 'one',
180
- parent: null,
181
- children: []
182
- }
183
- exports.nodeTree = nodeTree
184
- nodeTree.children[0] = {
185
- name: 'child one',
186
- parent: nodeTree,
187
- children: []
188
- }
189
- nodeTree.children[1] = {
190
- name: 'child two',
191
- parent: nodeTree,
192
- children: []
193
- }
194
- nodeTree.children[0].children[0] = {
195
- name: 'grandchild one',
196
- parent: nodeTree.children[0],
197
- children: []
198
- }
176
+ */
177
+ exports.multiReferenceObject = multiReferenceObject
178
+ const nodeTree = {
179
+ name: 'one',
180
+ parent: null,
181
+ children: []
182
+ }
183
+ exports.nodeTree = nodeTree
184
+ nodeTree.children[0] = {
185
+ name: 'child one',
186
+ parent: nodeTree,
187
+ children: []
188
+ }
189
+ nodeTree.children[1] = {
190
+ name: 'child two',
191
+ parent: nodeTree,
192
+ children: []
193
+ }
194
+ nodeTree.children[0].children[0] = {
195
+ name: 'grandchild one',
196
+ parent: nodeTree.children[0],
197
+ children: []
198
+ }
package/dist/testQuick.js CHANGED
@@ -1,15 +1,15 @@
1
- 'use strict'
2
-
3
- const gulpConfig = require('../gulp.config.js')
4
- const {
5
- runCLI: jest
6
- } = require('jest')
7
-
8
- /**
9
- * Run the Jest tests for files which have been modified (based on git status).
10
- * @returns {Promise<*>}
11
- */
12
- const testQuick = async () => await jest({
13
- onlyChanged: true
14
- }, gulpConfig.testPath)
15
- module.exports = testQuick
1
+ 'use strict'
2
+
3
+ const gulpConfig = require('../gulp.config.js')
4
+ const {
5
+ runCLI: jest
6
+ } = require('jest')
7
+
8
+ /**
9
+ * Run the Jest tests for files which have been modified (based on git status).
10
+ * @returns {Promise<*>}
11
+ */
12
+ const testQuick = async () => await jest({
13
+ onlyChanged: true
14
+ }, gulpConfig.testPath)
15
+ module.exports = testQuick
package/dist/watchFull.js CHANGED
@@ -1,23 +1,23 @@
1
- 'use strict'
2
-
3
- require('core-js/modules/es.string.replace.js')
4
- const bundle = require('./bundle')
5
- const distFor = require('./distFor')
6
- const gulpConfig = require('../gulp.config.js')
7
- const {
8
- parallel,
9
- series,
10
- watch
11
- } = require('gulp')
12
- const testQuick = require('./testQuick')
13
-
1
+ 'use strict'
2
+
3
+ require('core-js/modules/es.string.replace.js')
4
+ const bundle = require('./bundle')
5
+ const distFor = require('./distFor')
6
+ const gulpConfig = require('../gulp.config.js')
7
+ const {
8
+ parallel,
9
+ series,
10
+ watch
11
+ } = require('gulp')
12
+ const testQuick = require('./testQuick')
13
+
14
14
  /**
15
15
  * Watch for changes and run the distribution for the changed files, then bundle and test the changed files.
16
16
  * @returns {*}
17
- */
18
- const watchFull = () => watch(gulpConfig.watchSearch).on('change', path => {
19
- const pathRegex = new RegExp('^'.concat(gulpConfig.srcPath, '(.*\\/).+\\.js$'), 'i')
20
- const distForPath = () => distFor(path, path.replace(pathRegex, ''.concat(gulpConfig.distPath, '$1')))
21
- return parallel(testQuick, series(distForPath, bundle))()
22
- })
23
- module.exports = watchFull
17
+ */
18
+ const watchFull = () => watch(gulpConfig.watchSearch).on('change', path => {
19
+ const pathRegex = new RegExp('^'.concat(gulpConfig.srcPath, '(.*\\/).+\\.js$'), 'i')
20
+ const distForPath = () => distFor(path, path.replace(pathRegex, ''.concat(gulpConfig.distPath, '$1')))
21
+ return parallel(testQuick, series(distForPath, bundle))()
22
+ })
23
+ module.exports = watchFull
package/dist/watchTest.js CHANGED
@@ -1,17 +1,17 @@
1
- 'use strict'
2
-
3
- const gulpConfig = require('../gulp.config.js')
4
- const {
5
- series,
6
- watch
7
- } = require('gulp')
8
- const testQuick = require('./testQuick')
9
-
1
+ 'use strict'
2
+
3
+ const gulpConfig = require('../gulp.config.js')
4
+ const {
5
+ series,
6
+ watch
7
+ } = require('gulp')
8
+ const testQuick = require('./testQuick')
9
+
10
10
  /**
11
11
  * Watch for changes and run the tests.
12
12
  * @returns {*}
13
- */
14
- const watchTest = () => watch(gulpConfig.watchSearch, {
15
- ignoreInitial: false
16
- }, series(testQuick))
17
- module.exports = watchTest
13
+ */
14
+ const watchTest = () => watch(gulpConfig.watchSearch, {
15
+ ignoreInitial: false
16
+ }, series(testQuick))
17
+ module.exports = watchTest
@@ -1,17 +1,17 @@
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
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
@@ -1,25 +1,25 @@
1
- const bundle = require('./bundle')
2
- const bundleLint = require('./bundleLint')
3
- const bundleMinify = require('./bundleMinify')
4
- const clean = require('./clean')
5
- const compileReadme = require('./compileReadme')
6
- const dist = require('./dist')
7
- const distLint = require('./distLint')
8
- const distMinify = require('./distMinify')
9
- const { parallel, series } = require('gulp')
10
- const gulpConfig = require('../gulp.config.js')
11
- const testFull = require('./testFull')
12
-
13
- /**
14
- * Runs several processes to build and validate the project.
15
- * Cleans, distributes (lint and minify), bundles (lint and minify), creates the readme, then runs the tests.
16
- */
17
- const build = parallel(
18
- gulpConfig.nodeOnly
19
- ? series(clean, dist, parallel(distLint, distMinify))
20
- : series(clean, dist, parallel(distLint, distMinify), bundle, parallel(bundleLint, bundleMinify)),
21
- compileReadme,
22
- testFull
23
- )
24
-
25
- module.exports = build
1
+ const bundle = require('./bundle')
2
+ const bundleLint = require('./bundleLint')
3
+ const bundleMinify = require('./bundleMinify')
4
+ const clean = require('./clean')
5
+ const compileReadme = require('./compileReadme')
6
+ const dist = require('./dist')
7
+ const distLint = require('./distLint')
8
+ const distMinify = require('./distMinify')
9
+ const { parallel, series } = require('gulp')
10
+ const gulpConfig = require('../gulp.config.js')
11
+ const testFull = require('./testFull')
12
+
13
+ /**
14
+ * Runs several processes to build and validate the project.
15
+ * Cleans, distributes (lint and minify), bundles (lint and minify), creates the readme, then runs the tests.
16
+ */
17
+ const build = parallel(
18
+ gulpConfig.nodeOnly
19
+ ? series(clean, dist, parallel(distLint, distMinify))
20
+ : series(clean, dist, parallel(distLint, distMinify), bundle, parallel(bundleLint, bundleMinify)),
21
+ compileReadme,
22
+ testFull
23
+ )
24
+
25
+ module.exports = build
@@ -1,15 +1,15 @@
1
- const browserify = require('browserify')
2
- const { dest } = require('gulp')
3
- const gulpConfig = require('../gulp.config.js')
4
- const source = require('vinyl-source-stream')
5
-
6
- /**
7
- * Starting at the distribution entry point, bundle all the files into a single file and store them in the specified output directory.
8
- * @returns {*}
9
- */
10
- const bundle = () => browserify(gulpConfig.distMain)
11
- .bundle()
12
- .pipe(source(`${gulpConfig.browserName}.js`))
13
- .pipe(dest(gulpConfig.browserPath))
14
-
15
- module.exports = bundle
1
+ const browserify = require('browserify')
2
+ const { dest } = require('gulp')
3
+ const gulpConfig = require('../gulp.config.js')
4
+ const source = require('vinyl-source-stream')
5
+
6
+ /**
7
+ * Starting at the distribution entry point, bundle all the files into a single file and store them in the specified output directory.
8
+ * @returns {*}
9
+ */
10
+ const bundle = () => browserify(gulpConfig.distMain)
11
+ .bundle()
12
+ .pipe(source(`${gulpConfig.browserName}.js`))
13
+ .pipe(dest(gulpConfig.browserPath))
14
+
15
+ module.exports = bundle
@@ -1,17 +1,17 @@
1
- const { dest, src } = require('gulp')
2
- const gulpConfig = require('../gulp.config.js')
3
- const standard = require('gulp-standard')
4
-
5
- /**
6
- * Applies Standard code style linting to bundled file.
7
- * @returns {*}
8
- */
9
- const bundleLint = () => src(`${gulpConfig.browserPath}/${gulpConfig.browserName}.js`)
10
- .pipe(standard({ fix: true }))
11
- .pipe(standard.reporter('default', {
12
- fix: true,
13
- quiet: true
14
- }))
15
- .pipe(dest(gulpConfig.browserPath))
16
-
17
- module.exports = bundleLint
1
+ const { dest, src } = require('gulp')
2
+ const gulpConfig = require('../gulp.config.js')
3
+ const standard = require('gulp-standard')
4
+
5
+ /**
6
+ * Applies Standard code style linting to bundled file.
7
+ * @returns {*}
8
+ */
9
+ const bundleLint = () => src(`${gulpConfig.browserPath}/${gulpConfig.browserName}.js`)
10
+ .pipe(standard({ fix: true }))
11
+ .pipe(standard.reporter('default', {
12
+ fix: true,
13
+ quiet: true
14
+ }))
15
+ .pipe(dest(gulpConfig.browserPath))
16
+
17
+ module.exports = bundleLint
@@ -1,15 +1,15 @@
1
- const { dest, src } = require('gulp')
2
- const gulpConfig = require('../gulp.config.js')
3
- const { default: uglify } = require('gulp-uglify-es')
4
- const rename = require('gulp-rename')
5
-
6
- /**
7
- * Creates the minified bundle file.
8
- * @returns {*}
9
- */
10
- const bundleMinify = () => src(`${gulpConfig.browserPath}/${gulpConfig.browserName}.js`)
11
- .pipe(uglify())
12
- .pipe(rename({ extname: '.min.js' }))
13
- .pipe(dest(gulpConfig.browserPath))
14
-
15
- module.exports = bundleMinify
1
+ const { dest, src } = require('gulp')
2
+ const gulpConfig = require('../gulp.config.js')
3
+ const { default: uglify } = require('gulp-uglify-es')
4
+ const rename = require('gulp-rename')
5
+
6
+ /**
7
+ * Creates the minified bundle file.
8
+ * @returns {*}
9
+ */
10
+ const bundleMinify = () => src(`${gulpConfig.browserPath}/${gulpConfig.browserName}.js`)
11
+ .pipe(uglify())
12
+ .pipe(rename({ extname: '.min.js' }))
13
+ .pipe(dest(gulpConfig.browserPath))
14
+
15
+ module.exports = bundleMinify