@mobilabs/es6lib 2.1.0 → 2.1.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.
@@ -3,7 +3,7 @@ name: CI pipeline
3
3
 
4
4
  on:
5
5
  push:
6
- branches: [ master ]
6
+ branches: [ master, main ]
7
7
 
8
8
  jobs:
9
9
  build:
package/.husky/pre-commit CHANGED
@@ -6,3 +6,6 @@ npm run build:prod
6
6
  npm test
7
7
  npm run check:coverage
8
8
  npm run report
9
+
10
+
11
+ # -- oOo ---
package/README.md CHANGED
@@ -183,5 +183,5 @@ Enjoy!
183
183
  [commit-url]: https://github.com/jclo/es6lib/commits/master
184
184
  [ci-url]: https://github.com/jclo/es6lib/actions/workflows/ci.yml
185
185
  [coveralls-url]: https://coveralls.io/github/jclo/es6lib?branch=master
186
- [license-url]: http://opensource.org/licenses/MIT
187
186
  [npm-bundle-size-url]: https://img.shields.io/bundlephobia/minzip/@mobilabs/es6lib
187
+ [license-url]: http://opensource.org/licenses/MIT
package/_dist/README.md CHANGED
@@ -183,5 +183,5 @@ Enjoy!
183
183
  [commit-url]: https://github.com/jclo/es6lib/commits/master
184
184
  [ci-url]: https://github.com/jclo/es6lib/actions/workflows/ci.yml
185
185
  [coveralls-url]: https://coveralls.io/github/jclo/es6lib?branch=master
186
- [license-url]: http://opensource.org/licenses/MIT
187
186
  [npm-bundle-size-url]: https://img.shields.io/bundlephobia/minzip/@mobilabs/es6lib
187
+ [license-url]: http://opensource.org/licenses/MIT
@@ -1,5 +1,5 @@
1
1
  /*! ****************************************************************************
2
- * ES6lib v2.1.0
2
+ * ES6lib v2.1.2
3
3
  *
4
4
  * A template for writing pure ES6 Javascript libraries.
5
5
  * (you can download it from npm or github repositories)
@@ -313,14 +313,14 @@
313
313
  const obj = Object.create(methods);
314
314
  obj._library = {
315
315
  name: 'ES6lib',
316
- version: '2.1.0',
316
+ version: '2.1.2',
317
317
  };
318
318
  return obj;
319
319
  };
320
320
 
321
321
  // Attaches constants to ES6lib that provide name and version of the lib.
322
322
  ES6lib.NAME = 'ES6lib';
323
- ES6lib.VERSION = '2.1.0';
323
+ ES6lib.VERSION = '2.1.2';
324
324
 
325
325
 
326
326
  // -- Private Static Methods -----------------------------------------------
@@ -1,5 +1,5 @@
1
1
  /*! ****************************************************************************
2
- * ES6lib v2.1.0
2
+ * ES6lib v2.1.2
3
3
  *
4
4
  * A template for writing pure ES6 Javascript libraries.
5
5
  * (you can download it from npm or github repositories)
@@ -8,4 +8,4 @@
8
8
  * at: http://www.opensource.org/licenses/mit-license.php).
9
9
  * Built from {{boiler:name}} v{{boiler:name:version}}.
10
10
  * ************************************************************************** */
11
- !function(t,e){"use strict";"function"==typeof define&&define.amd?define([""],e):"object"==typeof exports?module.exports=e(t):t.ES6lib=e(t)}(this,(t=>{"use strict";let e,n;const i={Public:{}};return n=function(t,e){const n=Object.keys(e);for(let i=0;i<n.length;i++)t[n[i]]=e[n[i]]},function(){const t=i.Public;n(t,{getString:()=>"I am a string!",getArray:()=>[1,2,3]})}(),function(){const n=i.Public,r=t.ES6lib;let o;e=function(){const t=Object.create(o);return t._library={name:"ES6lib",version:"2.1.0"},t},e.NAME="ES6lib",e.VERSION="2.1.0",e._setTestMode=function(){return[]},e.noConflict=function(){return t.ES6lib=r,this},o={whoami(){return this._library},getString:()=>n.getString(),getArray:()=>n.getArray()}}(),e}));
11
+ !function(t,e){"use strict";"function"==typeof define&&define.amd?define([""],e):"object"==typeof exports?module.exports=e(t):t.ES6lib=e(t)}(this,(t=>{"use strict";let e,n;const i={Public:{}};return n=function(t,e){const n=Object.keys(e);for(let i=0;i<n.length;i++)t[n[i]]=e[n[i]]},function(){const t=i.Public;n(t,{getString:()=>"I am a string!",getArray:()=>[1,2,3]})}(),function(){const n=i.Public,r=t.ES6lib;let o;e=function(){const t=Object.create(o);return t._library={name:"ES6lib",version:"2.1.2"},t},e.NAME="ES6lib",e.VERSION="2.1.2",e._setTestMode=function(){return[]},e.noConflict=function(){return t.ES6lib=r,this},o={whoami(){return this._library},getString:()=>n.getString(),getArray:()=>n.getArray()}}(),e}));
@@ -1,5 +1,5 @@
1
1
  /*! ****************************************************************************
2
- * ES6lib v2.1.0
2
+ * ES6lib v2.1.2
3
3
  *
4
4
  * A template for writing pure ES6 Javascript libraries.
5
5
  * (you can download it from npm or github repositories)
@@ -8,4 +8,4 @@
8
8
  * at: http://www.opensource.org/licenses/mit-license.php).
9
9
  * Built from {{boiler:name}} v{{boiler:name:version}}.
10
10
  * ************************************************************************** */
11
- const $__ES6GLOB={};!function(t,e){"use strict";"function"==typeof define&&define.amd?define([""],e):"object"==typeof exports?module.exports=e(t):t.ES6lib=e(t)}($__ES6GLOB,(t=>{"use strict";let e,n;const i={Public:{}};return n=function(t,e){const n=Object.keys(e);for(let i=0;i<n.length;i++)t[n[i]]=e[n[i]]},function(){const t=i.Public;n(t,{getString:()=>"I am a string!",getArray:()=>[1,2,3]})}(),function(){const n=i.Public,r=t.ES6lib;let o;e=function(){const t=Object.create(o);return t._library={name:"ES6lib",version:"2.1.0"},t},e.NAME="ES6lib",e.VERSION="2.1.0",e._setTestMode=function(){return[]},e.noConflict=function(){return t.ES6lib=r,this},o={whoami(){return this._library},getString:()=>n.getString(),getArray:()=>n.getArray()}}(),e}));export default $__ES6GLOB.ES6lib;
11
+ const $__ES6GLOB={};!function(t,e){"use strict";"function"==typeof define&&define.amd?define([""],e):"object"==typeof exports?module.exports=e(t):t.ES6lib=e(t)}($__ES6GLOB,(t=>{"use strict";let e,n;const i={Public:{}};return n=function(t,e){const n=Object.keys(e);for(let i=0;i<n.length;i++)t[n[i]]=e[n[i]]},function(){const t=i.Public;n(t,{getString:()=>"I am a string!",getArray:()=>[1,2,3]})}(),function(){const n=i.Public,r=t.ES6lib;let o;e=function(){const t=Object.create(o);return t._library={name:"ES6lib",version:"2.1.2"},t},e.NAME="ES6lib",e.VERSION="2.1.2",e._setTestMode=function(){return[]},e.noConflict=function(){return t.ES6lib=r,this},o={whoami(){return this._library},getString:()=>n.getString(),getArray:()=>n.getArray()}}(),e}));export default $__ES6GLOB.ES6lib;
@@ -1,5 +1,5 @@
1
1
  /*! ****************************************************************************
2
- * ES6lib v2.1.0
2
+ * ES6lib v2.1.2
3
3
  *
4
4
  * A template for writing pure ES6 Javascript libraries.
5
5
  * (you can download it from npm or github repositories)
@@ -314,14 +314,14 @@ const $__ES6GLOB = {};
314
314
  const obj = Object.create(methods);
315
315
  obj._library = {
316
316
  name: 'ES6lib',
317
- version: '2.1.0',
317
+ version: '2.1.2',
318
318
  };
319
319
  return obj;
320
320
  };
321
321
 
322
322
  // Attaches constants to ES6lib that provide name and version of the lib.
323
323
  ES6lib.NAME = 'ES6lib';
324
- ES6lib.VERSION = '2.1.0';
324
+ ES6lib.VERSION = '2.1.2';
325
325
 
326
326
 
327
327
  // -- Private Static Methods -----------------------------------------------
package/bin/es6lib.js CHANGED
@@ -36,10 +36,10 @@ const fs = require('fs')
36
36
  ;
37
37
 
38
38
 
39
- // -- Local modules
39
+ // -- Local Modules
40
40
 
41
41
 
42
- // -- Local Variables
42
+ // -- Local Constants
43
43
  const defBoilerLib = 'ES6lib'
44
44
  /* eslint-disable-next-line object-curly-newline */
45
45
  , defAuthor = { name: 'John Doe', acronym: 'jdo', email: 'jdo@johndoe.com', url: 'http://www.johndoe.com' }
@@ -49,7 +49,7 @@ const defBoilerLib = 'ES6lib'
49
49
  , { version } = require('../package.json')
50
50
  , src = 'src'
51
51
  , test = 'test'
52
- , tasks = 'tasks'
52
+ , scripts = 'scripts'
53
53
  , husky = '.husky'
54
54
  , docs = 'docs'
55
55
  // Command line Options
@@ -68,17 +68,20 @@ const defBoilerLib = 'ES6lib'
68
68
  h: ['--help'],
69
69
  v: ['--version', version],
70
70
  p: ['--path'],
71
- b: ['--boilerlib'],
72
- n: ['--name'],
73
- a: ['--author'],
74
- c: ['--acronym'],
75
- e: ['--email'],
76
- u: ['--url'],
71
+ b: ['--boilerlib', defBoilerLib],
72
+ n: ['--name', defAuthor.name],
73
+ a: ['--author', defAuthor.name],
74
+ c: ['--acronym', defAuthor.acronym],
75
+ e: ['--email', defAuthor.email],
76
+ u: ['--url', defAuthor.url],
77
77
  }
78
78
  , parsed = nopt(opts, shortOpts, process.argv, 2)
79
79
  ;
80
80
 
81
81
 
82
+ // -- Local Variables
83
+
84
+
82
85
  // -- Templates
83
86
  const readme = [
84
87
  '# {{lib:name}}',
@@ -137,23 +140,27 @@ const index = [
137
140
  "'use strict';",
138
141
  '',
139
142
  "module.exports = require('./lib/{{lib:lowname}}');",
140
- ''].join('\n');
143
+ '',
144
+ ].join('\n');
141
145
 
142
146
  const gitignore = [
143
147
  '.DS_Store',
144
148
  '',
145
149
  'coverage',
146
150
  'node_modules',
147
- ''].join('\n');
151
+ '',
152
+ ].join('\n');
148
153
 
149
154
  const eslintignore = [
150
155
  '_dist/lib/{{lib:lowname}}.min.*',
151
- ''].join('\n');
156
+ '',
157
+ ].join('\n');
152
158
 
153
159
  const npmignore = [
154
160
  '*',
155
161
  '!_dist/**/*',
156
- ''].join('\n');
162
+ '',
163
+ ].join('\n');
157
164
 
158
165
 
159
166
  // -- Private Functions --------------------------------------------------------
@@ -376,7 +383,7 @@ function _addSrc(source, dest, folder, app, boilerlib) {
376
383
  }
377
384
 
378
385
  /**
379
- * Adds the task files.
386
+ * Adds the script files.
380
387
  *
381
388
  * @function (arg1, arg2, arg3, arg4, arg5)
382
389
  * @private
@@ -387,7 +394,7 @@ function _addSrc(source, dest, folder, app, boilerlib) {
387
394
  * @param {String} the name of the boilerplate,
388
395
  * @returns {} -,
389
396
  */
390
- function _addTasks(source, dest, folder, app, boilerlib) {
397
+ function _addScripts(source, dest, folder, app, boilerlib) {
391
398
  const exclude = []
392
399
  , boiler = '{{boiler:name}}'
393
400
  , ver = '{{boiler:name:version}}'
@@ -529,8 +536,8 @@ function _populate(options) {
529
536
  // Copy the src files:
530
537
  _addSrc(baseboiler, baseapp, src, app, boilerlib);
531
538
 
532
- // Add tasks:
533
- _addTasks(baseboiler, baseapp, tasks, app, boilerlib);
539
+ // Add scripts:
540
+ _addScripts(baseboiler, baseapp, scripts, app, boilerlib);
534
541
 
535
542
  // Copy Test Files:
536
543
  _addTest(baseboiler, baseapp, test, app, boilerlib);
@@ -544,19 +551,66 @@ function _populate(options) {
544
551
  process.stdout.write('Done. Enjoy!\n');
545
552
  }
546
553
 
554
+ /**
555
+ * Runs the script.
556
+ *
557
+ * @function ()
558
+ * @private
559
+ * @param {} -,
560
+ * @returns {} -,
561
+ * @since 0.0.0
562
+ */
563
+ function _run() {
564
+ if (parsed.help) {
565
+ _help();
566
+ }
547
567
 
548
- // -- Main
549
- if (parsed.help) {
550
- _help();
551
- }
568
+ if (parsed.version) {
569
+ process.stdout.write(`version: ${parsed.version}\n`);
570
+ return;
571
+ }
552
572
 
553
- if (parsed.version) {
554
- process.stdout.write(`version: ${parsed.version}\n`);
555
- process.exit(0);
556
- }
573
+ if (parsed.boilerlib) {
574
+ process.stdout.write(`boilerlib: ${parsed.boilerlib}\n`);
575
+ return;
576
+ }
577
+
578
+ if (parsed.name) {
579
+ process.stdout.write(`name: ${parsed.name}\n`);
580
+ return;
581
+ }
582
+
583
+ if (parsed.author) {
584
+ process.stdout.write(`author: ${parsed.author}\n`);
585
+ return;
586
+ }
587
+
588
+ if (parsed.acronym) {
589
+ process.stdout.write(`acronym: ${parsed.acronym}\n`);
590
+ return;
591
+ }
592
+
593
+ if (parsed.email) {
594
+ process.stdout.write(`email: ${parsed.email}\n`);
595
+ return;
596
+ }
597
+
598
+ if (parsed.url) {
599
+ process.stdout.write(`url: ${parsed.url}\n`);
600
+ return;
601
+ }
602
+
603
+ if (parsed.argv.remain[0] === 'populate') {
604
+ _populate(parsed);
605
+ return;
606
+ }
557
607
 
558
- if (parsed.argv.remain[0] === 'populate') {
559
- _populate(parsed);
560
- } else {
561
608
  _help();
562
609
  }
610
+
611
+
612
+ // -- Where the script starts --------------------------------------------------
613
+ _run();
614
+
615
+
616
+ // -- oOo ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobilabs/es6lib",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "A template for writing pure ES6 Javascript libraries",
5
5
  "main": "index.js",
6
6
  "minified": "_dist/lib/es6lib.min.js",
@@ -0,0 +1,247 @@
1
+ #!/usr/bin/env node
2
+ /* *****************************************************************************
3
+ *
4
+ * Does ...
5
+ *
6
+ * build:template script is a framework to build npm build scripts;
7
+ *
8
+ * Private Functions:
9
+ * . _help displays the help message,
10
+ * . _clean removes the previous build,
11
+ * . _dosomething creates something,
12
+ *
13
+ *
14
+ * Public Static Methods:
15
+ * . run executes the script,
16
+ *
17
+ *
18
+ * @namespace -
19
+ * @dependencies none
20
+ * @exports -
21
+ * @author -
22
+ * @since 0.0.0
23
+ * @version -
24
+ * ************************************************************************** */
25
+ /* eslint one-var: 0, semi-style: 0, no-underscore-dangle: 0,
26
+ import/no-extraneous-dependencies: 0 */
27
+
28
+ 'use strict';
29
+
30
+ // -- Vendor Modules
31
+ const fs = require('fs')
32
+ , nopt = require('nopt')
33
+ ;
34
+
35
+
36
+ // -- Local Modules
37
+ const config = require('./config')
38
+ ;
39
+
40
+
41
+ // -- Local Constants
42
+ const VERSION = '0.0.0-alpha.0'
43
+ , opts = {
44
+ help: [Boolean, false],
45
+ version: [String, null],
46
+ }
47
+ , shortOpts = {
48
+ h: ['--help'],
49
+ v: ['--version', VERSION],
50
+ }
51
+ , parsed = nopt(opts, shortOpts, process.argv, 2)
52
+ , destination = config.libdir
53
+ ;
54
+
55
+
56
+ // -- Local Variables
57
+
58
+
59
+ // -- Private Functions --------------------------------------------------------
60
+
61
+ /**
62
+ * Dispays the help message.
63
+ *
64
+ * @function ()
65
+ * @private
66
+ * @param {} -,
67
+ * @returns {} -,
68
+ * @since 0.0.0
69
+ */
70
+ function _help() {
71
+ const message = ['',
72
+ 'Usage: command [options]',
73
+ '',
74
+ ' creates something from something',
75
+ '',
76
+ 'Options:',
77
+ '',
78
+ '-h, --help output usage information',
79
+ '-v, --version output the version number',
80
+ '',
81
+ ].join('\n');
82
+
83
+ process.stdout.write(`${message}\n`);
84
+ }
85
+
86
+ /**
87
+ * Removes the previous build.
88
+ *
89
+ * @function ()
90
+ * @private
91
+ * @param {} -,
92
+ * @returns {Object} returns a promise,
93
+ * @since 0.0.0
94
+ */
95
+ function _clean() {
96
+ const d1 = new Date();
97
+ process.stdout.write('Starting \'\x1b[36mclean\x1b[89m\x1b[0m\'...\n');
98
+
99
+ return new Promise((resolve) => {
100
+ fs.rm(destination, { force: true, recursive: true }, (err1) => {
101
+ if (err1) throw new Error(err1);
102
+
103
+ fs.mkdir(destination, { recursive: true }, (err2) => {
104
+ if (err2) throw new Error(err2);
105
+
106
+ const d2 = new Date() - d1;
107
+ process.stdout.write(`Finished '\x1b[36mclean\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
108
+ resolve();
109
+ });
110
+ });
111
+ });
112
+ }
113
+
114
+ /**
115
+ * Creates something else.
116
+ *
117
+ * @function (arg1)
118
+ * @private
119
+ * @param {Function} the function to call at the completion,
120
+ * @returns {} -,
121
+ * @since 0.0.0
122
+ */
123
+ function _doparallel1(done) {
124
+ const d1 = new Date();
125
+ process.stdout.write('Starting \'\x1b[36mdoparallel1\x1b[89m\x1b[0m\'...\n');
126
+
127
+ fs.writeFile(`${destination}/generic1.js`, 'bla bla', { encoding: 'utf8' }, (err) => {
128
+ if (err) throw new Error(err);
129
+
130
+ const d2 = new Date() - d1;
131
+ process.stdout.write(`Finished '\x1b[36mdodoparallel1\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
132
+ done();
133
+ });
134
+ }
135
+
136
+ /**
137
+ * Creates something else.
138
+ *
139
+ * @function (arg1)
140
+ * @private
141
+ * @param {Function} the function to call at the completion,
142
+ * @returns {} -,
143
+ * @since 0.0.0
144
+ */
145
+ function _doparallel2(done) {
146
+ const d1 = new Date();
147
+ process.stdout.write('Starting \'\x1b[36mdoparallel2\x1b[89m\x1b[0m\'...\n');
148
+
149
+ fs.writeFile(`${destination}/generic2.js`, 'bla bla', { encoding: 'utf8' }, (err) => {
150
+ if (err) throw new Error(err);
151
+
152
+ const d2 = new Date() - d1;
153
+ process.stdout.write(`Finished '\x1b[36mdodoparallel2\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
154
+ done();
155
+ });
156
+ }
157
+
158
+ /**
159
+ * Removes the temp file(s).
160
+ *
161
+ * @function (arg1)
162
+ * @private
163
+ * @param {Function} the function to call at the completion,
164
+ * @returns {} -,
165
+ * @since 0.0.0
166
+ */
167
+ function _delgeneric(done) {
168
+ const d1 = new Date();
169
+ process.stdout.write('Starting \'\x1b[36mdelgeneric\x1b[89m\x1b[0m\'...\n');
170
+
171
+ /**
172
+ * Wait all the processes are completed.
173
+ */
174
+ let pending = 2;
175
+ function _next() {
176
+ pending -= 1;
177
+ if (!pending) {
178
+ const d2 = new Date() - d1;
179
+ process.stdout.write(`Finished '\x1b[36mdelgeneric\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
180
+ done();
181
+ }
182
+ }
183
+
184
+ fs.unlink(`${destination}/generic1.js`, (err) => {
185
+ if (err) throw new Error(err);
186
+ _next();
187
+ });
188
+
189
+ fs.unlink(`${destination}/generic2.js`, (err) => {
190
+ if (err) throw new Error(err);
191
+ _next();
192
+ });
193
+ }
194
+
195
+
196
+ // -- Main ---------------------------------------------------------------------
197
+
198
+ /**
199
+ * Executes the script.
200
+ *
201
+ * @function ()
202
+ * @public
203
+ * @param {} -,
204
+ * @returns {} -,
205
+ * @since 0.0.0
206
+ */
207
+ async function run() {
208
+ const PENDING = 2;
209
+
210
+ if (parsed.help) {
211
+ _help();
212
+ return;
213
+ }
214
+
215
+ if (parsed.version) {
216
+ process.stdout.write(`version: ${parsed.version}\n`);
217
+ return;
218
+ }
219
+
220
+ const d1 = new Date();
221
+ process.stdout.write('Starting \'\x1b[36mbuild:xxx:yyy\x1b[89m\x1b[0m\'...\n');
222
+
223
+ let pending = PENDING;
224
+ /**
225
+ * Executes done until completion.
226
+ */
227
+ function done() {
228
+ pending -= 1;
229
+ if (!pending) {
230
+ _delgeneric(() => {
231
+ const d2 = new Date() - d1;
232
+ process.stdout.write(`Finished '\x1b[36mbuild:xxx:yyy\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
233
+ });
234
+ }
235
+ }
236
+
237
+ await _clean();
238
+ _doparallel1(done);
239
+ _doparallel2(done);
240
+ }
241
+
242
+
243
+ // Start script.
244
+ run();
245
+
246
+
247
+ // -- oOo --