@mobilabs/es6lib 2.0.2 → 2.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.
- package/.github/workflows/ci.yml +1 -0
- package/README.md +3 -3
- package/_dist/README.md +3 -3
- package/_dist/lib/es6lib.js +3 -3
- package/_dist/lib/es6lib.min.js +2 -2
- package/_dist/lib/es6lib.min.mjs +2 -2
- package/_dist/lib/es6lib.mjs +3 -3
- package/bin/es6lib.js +15 -19
- package/package.json +14 -5
- package/rmdstore.sh +2 -0
- package/tasks/_build.template.js +0 -247
- package/tasks/build.js.dev.js +0 -284
- package/tasks/build.js.prod.js +0 -294
- package/tasks/build.skeleton.prod.js +0 -198
- package/tasks/compress.sh +0 -41
- package/tasks/config.js +0 -80
- package/tasks/dep.private.js +0 -232
package/.github/workflows/ci.yml
CHANGED
package/README.md
CHANGED
|
@@ -61,13 +61,13 @@ Your project Folder
|
|
|
61
61
|
| |_ ci.yml // Github Workflow file (if you use it),
|
|
62
62
|
|_ lib
|
|
63
63
|
| |_ lib.js // Your built ES6 UMD library,
|
|
64
|
-
| |_ lib.mjs // Your built ES6 Module,
|
|
64
|
+
| |_ lib.mjs // Your built ES6 Module,
|
|
65
|
+
|_ scripts
|
|
66
|
+
| |_ ... // The scripts to build your project,
|
|
65
67
|
|_ src
|
|
66
68
|
| |_ _footer // The UMD footer,
|
|
67
69
|
| |_ _header // The UMD header,
|
|
68
70
|
| |_ ... // The core or your library,
|
|
69
|
-
|_ tasks
|
|
70
|
-
| |_ ... // The tasks to build your project,
|
|
71
71
|
|_ test
|
|
72
72
|
| |_ main.js // Your Mocha, Chai test file,
|
|
73
73
|
|_ .eslintignore // Files to be ignored by ESLint,
|
package/_dist/README.md
CHANGED
|
@@ -61,13 +61,13 @@ Your project Folder
|
|
|
61
61
|
| |_ ci.yml // Github Workflow file (if you use it),
|
|
62
62
|
|_ lib
|
|
63
63
|
| |_ lib.js // Your built ES6 UMD library,
|
|
64
|
-
| |_ lib.mjs // Your built ES6 Module,
|
|
64
|
+
| |_ lib.mjs // Your built ES6 Module,
|
|
65
|
+
|_ scripts
|
|
66
|
+
| |_ ... // The scripts to build your project,
|
|
65
67
|
|_ src
|
|
66
68
|
| |_ _footer // The UMD footer,
|
|
67
69
|
| |_ _header // The UMD header,
|
|
68
70
|
| |_ ... // The core or your library,
|
|
69
|
-
|_ tasks
|
|
70
|
-
| |_ ... // The tasks to build your project,
|
|
71
71
|
|_ test
|
|
72
72
|
| |_ main.js // Your Mocha, Chai test file,
|
|
73
73
|
|_ .eslintignore // Files to be ignored by ESLint,
|
package/_dist/lib/es6lib.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! ****************************************************************************
|
|
2
|
-
* ES6lib v2.0
|
|
2
|
+
* ES6lib v2.1.0
|
|
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.0
|
|
316
|
+
version: '2.1.0',
|
|
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.0
|
|
323
|
+
ES6lib.VERSION = '2.1.0';
|
|
324
324
|
|
|
325
325
|
|
|
326
326
|
// -- Private Static Methods -----------------------------------------------
|
package/_dist/lib/es6lib.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! ****************************************************************************
|
|
2
|
-
* ES6lib v2.0
|
|
2
|
+
* ES6lib v2.1.0
|
|
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.0
|
|
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}));
|
package/_dist/lib/es6lib.min.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! ****************************************************************************
|
|
2
|
-
* ES6lib v2.0
|
|
2
|
+
* ES6lib v2.1.0
|
|
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.0
|
|
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;
|
package/_dist/lib/es6lib.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! ****************************************************************************
|
|
2
|
-
* ES6lib v2.0
|
|
2
|
+
* ES6lib v2.1.0
|
|
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.0
|
|
317
|
+
version: '2.1.0',
|
|
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.0
|
|
324
|
+
ES6lib.VERSION = '2.1.0';
|
|
325
325
|
|
|
326
326
|
|
|
327
327
|
// -- Private Static Methods -----------------------------------------------
|
package/bin/es6lib.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* The MIT License (MIT)
|
|
6
6
|
*
|
|
7
|
-
* Copyright (c)
|
|
7
|
+
* Copyright (c) 2024 Mobilabs <contact@mobilabs.fr> (http://www.mobilabs.fr)
|
|
8
8
|
*
|
|
9
9
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
10
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -89,6 +89,9 @@ const readme = [
|
|
|
89
89
|
' ',
|
|
90
90
|
'MIT.',
|
|
91
91
|
'',
|
|
92
|
+
'',
|
|
93
|
+
'-- oOo --',
|
|
94
|
+
'',
|
|
92
95
|
].join('\n');
|
|
93
96
|
|
|
94
97
|
const license = [
|
|
@@ -124,7 +127,11 @@ const changelog = [
|
|
|
124
127
|
'',
|
|
125
128
|
' * Initial commit,',
|
|
126
129
|
' * ...,',
|
|
127
|
-
''
|
|
130
|
+
'',
|
|
131
|
+
'',
|
|
132
|
+
'-- oOo --',
|
|
133
|
+
'',
|
|
134
|
+
].join('\n');
|
|
128
135
|
|
|
129
136
|
const index = [
|
|
130
137
|
"'use strict';",
|
|
@@ -135,7 +142,6 @@ const index = [
|
|
|
135
142
|
const gitignore = [
|
|
136
143
|
'.DS_Store',
|
|
137
144
|
'',
|
|
138
|
-
'.nyc_output',
|
|
139
145
|
'coverage',
|
|
140
146
|
'node_modules',
|
|
141
147
|
''].join('\n');
|
|
@@ -303,23 +309,12 @@ function _customize(source, dest, app, owner, boilerlib) {
|
|
|
303
309
|
pack.unpkg = `_dist/lib/${app.toLowerCase()}.mjs`;
|
|
304
310
|
pack.module = `_dist/lib/${app.toLowerCase()}.min.mjs`;
|
|
305
311
|
pack.bin = {};
|
|
306
|
-
|
|
307
|
-
// build: obj.scripts.build,
|
|
308
|
-
// watch: obj.scripts.watch,
|
|
309
|
-
// dev: obj.scripts.dev,
|
|
310
|
-
// test: obj.scripts.test,
|
|
311
|
-
// 'display-coverage': obj.scripts['display-coverage'],
|
|
312
|
-
// 'check-coverage': obj.scripts['check-coverage'],
|
|
313
|
-
// 'report-coverage': obj.scripts['report-coverage'],
|
|
314
|
-
// report: obj.scripts.report,
|
|
315
|
-
// makedist: obj.scripts.makedist,
|
|
316
|
-
// app: obj.scripts.app,
|
|
317
|
-
// makeprivate: obj.scripts.makeprivate,
|
|
318
|
-
// makelib: obj.scripts.makelib,
|
|
319
|
-
// prepare: obj.scripts.prepare,
|
|
320
|
-
// doc: obj.scripts.doc,
|
|
321
|
-
// };
|
|
312
|
+
|
|
322
313
|
pack.scripts = obj.scripts;
|
|
314
|
+
pack.scripts['check:coverage'] = 'c8 check-coverage --statements 100 --branches 100 --functions 100 --lines 100';
|
|
315
|
+
delete pack.scripts['dep:private:package'];
|
|
316
|
+
delete pack.scripts['dep:npm:private:package'];
|
|
317
|
+
|
|
323
318
|
pack.repository = obj.repository;
|
|
324
319
|
pack.repository.url = `https://github.com/${owner.acronym}/${app.toLowerCase()}.git`;
|
|
325
320
|
pack.keywords = ['ES6'];
|
|
@@ -333,6 +328,7 @@ function _customize(source, dest, app, owner, boilerlib) {
|
|
|
333
328
|
pack.homepage = `https://github.com/${owner.acronym}/${app.toLowerCase()}`;
|
|
334
329
|
pack.dependencies = obj.dependencies;
|
|
335
330
|
pack.devDependencies = obj.devDependencies;
|
|
331
|
+
pack.c8 = obj.c8;
|
|
336
332
|
pack.publishConfig = obj.publishConfig;
|
|
337
333
|
pack.private = obj.private;
|
|
338
334
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mobilabs/es6lib",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "A template for writing pure ES6 Javascript libraries",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"minified": "_dist/lib/es6lib.min.js",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"general": " --- GENERAL ---",
|
|
14
14
|
|
|
15
15
|
"build:js": " --- JAVASCRIPT --- ",
|
|
16
|
-
"build:js:dev": "node
|
|
17
|
-
"build:js:prod": "node
|
|
16
|
+
"build:js:dev": "node scripts/build.js.dev.js $1",
|
|
17
|
+
"build:js:prod": "node scripts/build.js.prod.js $1",
|
|
18
18
|
|
|
19
19
|
"build:css": " --- CSS --- ",
|
|
20
20
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"build:dev": "npm run build:js:dev",
|
|
25
25
|
|
|
26
26
|
"build:production": " --- BUILD (PRODUCTION) --- ",
|
|
27
|
-
"build:skeleton:prod": "node
|
|
27
|
+
"build:skeleton:prod": "node scripts/build.skeleton.prod.js $1",
|
|
28
28
|
"prebuild:prod": "npm run build:dev && npm run build:skeleton:prod",
|
|
29
29
|
"build:prod": "npm run build:js:prod",
|
|
30
30
|
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
|
|
45
45
|
"deployment": " --- DEPLOYMENT --- ",
|
|
46
46
|
"dep:prod": "rm -rf _dist-$npm_package_version && npm run build:prod && cp -r _dist _dist-$npm_package_version",
|
|
47
|
-
"dep:private": "npm run build:prod && node
|
|
47
|
+
"dep:private:package": "npm run build:prod && node scripts/dep.private.js && sh scripts/compress.sh ${npm_package_name} ${npm_package_version} @mobilabs",
|
|
48
|
+
"dep:npm:private:package": "npm pack && sh scripts/dep.npm.private.sh ${npm_package_name} ${npm_package_version} @mobilabs",
|
|
48
49
|
|
|
49
50
|
"others": " --- OTHERS ---",
|
|
50
51
|
"prepare": "husky install",
|
|
@@ -89,6 +90,14 @@
|
|
|
89
90
|
"nodemon": "^3.0.2",
|
|
90
91
|
"terser": "^5.26.0"
|
|
91
92
|
},
|
|
93
|
+
"c8": {
|
|
94
|
+
"include": [
|
|
95
|
+
"index.js",
|
|
96
|
+
"lib/**/*.js"
|
|
97
|
+
],
|
|
98
|
+
"exclude": [],
|
|
99
|
+
"all": false
|
|
100
|
+
},
|
|
92
101
|
"publishConfig": {
|
|
93
102
|
"access": "public"
|
|
94
103
|
},
|
package/rmdstore.sh
CHANGED
package/tasks/_build.template.js
DELETED
|
@@ -1,247 +0,0 @@
|
|
|
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 --
|