@mobilabs/es6lib 1.0.15 → 1.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/.eslintrc +9 -9
- package/README.md +1 -1
- package/_dist/README.md +1 -1
- 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 +1 -1
- package/package.json +7 -5
- package/rmdstore.sh +9 -0
- package/tasks/_build.template.js +247 -0
- package/tasks/{makejs.js → build.js.dev.js} +143 -28
- package/tasks/build.js.prod.js +294 -0
- package/tasks/build.skeleton.prod.js +198 -0
- package/tasks/dep.private.js +232 -0
- package/tasks/makedist.js +0 -154
- package/tasks/makeprivatepackage.js +0 -99
package/.eslintrc
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Set JavaScript language options
|
|
4
4
|
*/
|
|
5
5
|
"parserOptions": {
|
|
6
|
-
"sourceType": "script"
|
|
6
|
+
"sourceType": "script"
|
|
7
7
|
},
|
|
8
8
|
/**
|
|
9
9
|
* Set Environnement
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"extends": "airbnb-base",
|
|
23
23
|
// Overwritten airbnb's rules:
|
|
24
24
|
"rules": {
|
|
25
|
-
strict: ["error", "global"],
|
|
26
|
-
func-names: ["error", "never"],
|
|
27
|
-
space-before-function-paren: ["error", { "anonymous": "never", "named": "never", "asyncArrow": "always" }],
|
|
28
|
-
no-plusplus: ["error", { "allowForLoopAfterthoughts": true }],
|
|
29
|
-
"no-multi-spaces": [2, { exceptions: { "VariableDeclarator": true } }],
|
|
30
|
-
comma-style: ["error", "first", { "exceptions": { "ArrayExpression": true, "ObjectExpression": true } }],
|
|
31
|
-
indent: ["error", 2, { "VariableDeclarator": { "const": 2 }, "SwitchCase": 1 }],
|
|
32
|
-
no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 0 }]
|
|
25
|
+
"strict": ["error", "global"],
|
|
26
|
+
"func-names": ["error", "never"],
|
|
27
|
+
"space-before-function-paren": ["error", { "anonymous": "never", "named": "never", "asyncArrow": "always" }],
|
|
28
|
+
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
|
|
29
|
+
"no-multi-spaces": [2, { "exceptions": { "VariableDeclarator": true } }],
|
|
30
|
+
"comma-style": ["error", "first", { "exceptions": { "ArrayExpression": true, "ObjectExpression": true } }],
|
|
31
|
+
"indent": ["error", 2, { "VariableDeclarator": { "const": 2 }, "SwitchCase": 1 }],
|
|
32
|
+
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 0 }]
|
|
33
33
|
}
|
|
34
34
|
}
|
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ Then, you just need to create a `package.json` file that contains:
|
|
|
36
36
|
"name": "NameOfYourProject",
|
|
37
37
|
"scripts": {
|
|
38
38
|
"create": "npm install @mobilabs/es6lib && npm run populate",
|
|
39
|
-
"populate": "es6lib populate --name $npm_package_name --author $npm_package_config_name --acronym $npm_package_config_acronym --email $npm_package_config_email --url $npm_package_config_url && npm install && npm run build && npm run test && npm run report"
|
|
39
|
+
"populate": "es6lib populate --name $npm_package_name --author $npm_package_config_name --acronym $npm_package_config_acronym --email $npm_package_config_email --url $npm_package_config_url && npm install && npm run build:dev && npm run test && npm run report"
|
|
40
40
|
},
|
|
41
41
|
"config": {
|
|
42
42
|
"name": "John Doe",
|
package/_dist/README.md
CHANGED
|
@@ -36,7 +36,7 @@ Then, you just need to create a `package.json` file that contains:
|
|
|
36
36
|
"name": "NameOfYourProject",
|
|
37
37
|
"scripts": {
|
|
38
38
|
"create": "npm install @mobilabs/es6lib && npm run populate",
|
|
39
|
-
"populate": "es6lib populate --name $npm_package_name --author $npm_package_config_name --acronym $npm_package_config_acronym --email $npm_package_config_email --url $npm_package_config_url && npm install && npm run build && npm run test && npm run report"
|
|
39
|
+
"populate": "es6lib populate --name $npm_package_name --author $npm_package_config_name --acronym $npm_package_config_acronym --email $npm_package_config_email --url $npm_package_config_url && npm install && npm run build:dev && npm run test && npm run report"
|
|
40
40
|
},
|
|
41
41
|
"config": {
|
|
42
42
|
"name": "John Doe",
|
package/_dist/lib/es6lib.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! ****************************************************************************
|
|
2
|
-
* ES6lib v1.
|
|
2
|
+
* ES6lib v1.1.1
|
|
3
3
|
*
|
|
4
4
|
* A template for writing pure ES6 Javascript libraries.
|
|
5
5
|
* (you can download it from npm or github repositories)
|
|
@@ -312,14 +312,14 @@
|
|
|
312
312
|
const obj = Object.create(methods);
|
|
313
313
|
obj._library = {
|
|
314
314
|
name: 'ES6lib',
|
|
315
|
-
version: '1.
|
|
315
|
+
version: '1.1.1',
|
|
316
316
|
};
|
|
317
317
|
return obj;
|
|
318
318
|
};
|
|
319
319
|
|
|
320
320
|
// Attaches constants to ES6lib that provide name and version of the lib.
|
|
321
321
|
ES6lib.NAME = 'ES6lib';
|
|
322
|
-
ES6lib.VERSION = '1.
|
|
322
|
+
ES6lib.VERSION = '1.1.1';
|
|
323
323
|
|
|
324
324
|
|
|
325
325
|
// -- Private Static Methods -----------------------------------------------
|
package/_dist/lib/es6lib.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! ****************************************************************************
|
|
2
|
-
* ES6lib v1.
|
|
2
|
+
* ES6lib v1.1.1
|
|
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
|
-
!
|
|
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:"1.1.1"},t},e.NAME="ES6lib",e.VERSION="1.1.1",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 v1.
|
|
2
|
+
* ES6lib v1.1.1
|
|
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
|
-
|
|
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:"1.1.1"},t},e.NAME="ES6lib",e.VERSION="1.1.1",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 v1.
|
|
2
|
+
* ES6lib v1.1.1
|
|
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 @@ const $__ES6GLOB = {};
|
|
|
313
313
|
const obj = Object.create(methods);
|
|
314
314
|
obj._library = {
|
|
315
315
|
name: 'ES6lib',
|
|
316
|
-
version: '1.
|
|
316
|
+
version: '1.1.1',
|
|
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 = '1.
|
|
323
|
+
ES6lib.VERSION = '1.1.1';
|
|
324
324
|
|
|
325
325
|
|
|
326
326
|
// -- Private Static Methods -----------------------------------------------
|
package/bin/es6lib.js
CHANGED
|
@@ -269,7 +269,7 @@ function _addSkeleton(base, app, owner, cright) {
|
|
|
269
269
|
* @returns {} -,
|
|
270
270
|
*/
|
|
271
271
|
function _duplicate(source, dest) {
|
|
272
|
-
const dupFiles = ['.eslintrc', '.travis.yml'];
|
|
272
|
+
const dupFiles = ['.eslintrc', '.travis.yml', 'rmdstore.sh'];
|
|
273
273
|
|
|
274
274
|
for (let i = 0; i < dupFiles.length; i++) {
|
|
275
275
|
process.stdout.write(` copied ${dupFiles[i]}\n`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mobilabs/es6lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
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 tasks/
|
|
17
|
-
"build:js:prod": "node tasks/
|
|
16
|
+
"build:js:dev": "node tasks/build.js.dev.js $1",
|
|
17
|
+
"build:js:prod": "node tasks/build.js.prod.js $1",
|
|
18
18
|
|
|
19
19
|
"build:css": " --- CSS --- ",
|
|
20
20
|
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"build:dev": "npm run build:js:dev",
|
|
25
25
|
|
|
26
26
|
"build:production": " --- BUILD (PRODUCTION) --- ",
|
|
27
|
-
"
|
|
27
|
+
"build:skeleton:prod": "node tasks/build.skeleton.prod.js $1",
|
|
28
|
+
"prebuild:prod": "npm run build:dev && npm run build:skeleton:prod",
|
|
28
29
|
"build:prod": "npm run build:js:prod",
|
|
29
30
|
|
|
30
31
|
"testing": " --- TESTING --- ",
|
|
@@ -43,7 +44,8 @@
|
|
|
43
44
|
"watch": "npm run watch:js",
|
|
44
45
|
|
|
45
46
|
"deployment": " --- DEPLOYMENT --- ",
|
|
46
|
-
"dep:
|
|
47
|
+
"dep:prod": "rm -rf _dist-$npm_package_version && npm run build:prod && cp -r _dist _dist-$npm_package_version",
|
|
48
|
+
"dep:private": "npm run build:prod && node tasks/dep.private.js && sh tasks/compress.sh ${npm_package_name} ${npm_package_version} @mobilabs",
|
|
47
49
|
|
|
48
50
|
"others": " --- OTHERS ---",
|
|
49
51
|
"prepare": "husky install",
|
package/rmdstore.sh
ADDED
|
@@ -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
|
+
* @puublic
|
|
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:js:dev\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:js:dev\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 --
|
|
@@ -1,10 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* *****************************************************************************
|
|
3
|
+
*
|
|
4
|
+
* Creates the JS bundle.
|
|
5
|
+
*
|
|
6
|
+
* build:js.dev script creates the JS bundle from ./public/src/main.js by importing
|
|
7
|
+
* all the linked src files;
|
|
8
|
+
*
|
|
9
|
+
* Private Functions:
|
|
10
|
+
* . _help displays the help message,
|
|
11
|
+
* . _clean removes the previous build,
|
|
12
|
+
* . _docore creates the content of the library,
|
|
13
|
+
* . _doumdlib creates the UMD Module,
|
|
14
|
+
* . _domodule creates the ES6 module,
|
|
15
|
+
* . _delcore removes the temp file(s),
|
|
16
|
+
*
|
|
17
|
+
*
|
|
18
|
+
* Public Static Methods:
|
|
19
|
+
* . run executes the script,
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
* @namespace -
|
|
23
|
+
* @dependencies none
|
|
24
|
+
* @exports -
|
|
25
|
+
* @author -
|
|
26
|
+
* @since 0.0.0
|
|
27
|
+
* @version -
|
|
28
|
+
* ************************************************************************** */
|
|
29
|
+
/* eslint one-var: 0, semi-style: 0, no-underscore-dangle: 0 */
|
|
3
30
|
|
|
4
31
|
'use strict';
|
|
5
32
|
|
|
6
33
|
// -- Vendor Modules
|
|
7
|
-
const fs
|
|
34
|
+
const fs = require('fs')
|
|
35
|
+
, nopt = require('nopt')
|
|
8
36
|
;
|
|
9
37
|
|
|
10
38
|
|
|
@@ -15,7 +43,17 @@ const pack = require('../package.json')
|
|
|
15
43
|
|
|
16
44
|
|
|
17
45
|
// -- Local Constants
|
|
18
|
-
const
|
|
46
|
+
const VERSION = '0.0.0-alpha.0'
|
|
47
|
+
, opts = {
|
|
48
|
+
help: [Boolean, false],
|
|
49
|
+
version: [String, null],
|
|
50
|
+
}
|
|
51
|
+
, shortOpts = {
|
|
52
|
+
h: ['--help'],
|
|
53
|
+
v: ['--version', VERSION],
|
|
54
|
+
}
|
|
55
|
+
, parsed = nopt(opts, shortOpts, process.argv, 2)
|
|
56
|
+
, destination = config.libdir
|
|
19
57
|
, { ES6GLOB } = config
|
|
20
58
|
, source = config.src
|
|
21
59
|
, { libname } = config
|
|
@@ -30,16 +68,46 @@ const destination = config.libdir
|
|
|
30
68
|
// -- Local Variables
|
|
31
69
|
|
|
32
70
|
|
|
33
|
-
// -- Private
|
|
71
|
+
// -- Private Functions --------------------------------------------------------
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Dispays the help message.
|
|
75
|
+
*
|
|
76
|
+
* @function ()
|
|
77
|
+
* @private
|
|
78
|
+
* @param {} -,
|
|
79
|
+
* @returns {} -,
|
|
80
|
+
* @since 0.0.0
|
|
81
|
+
*/
|
|
82
|
+
function _help() {
|
|
83
|
+
const message = ['',
|
|
84
|
+
'Usage: command [options]',
|
|
85
|
+
'',
|
|
86
|
+
' creates the js bundle from ./public/src/main.js',
|
|
87
|
+
'',
|
|
88
|
+
'Options:',
|
|
89
|
+
'',
|
|
90
|
+
'-h, --help output usage information',
|
|
91
|
+
'-v, --version output the version number',
|
|
92
|
+
'',
|
|
93
|
+
].join('\n');
|
|
94
|
+
|
|
95
|
+
process.stdout.write(`${message}\n`);
|
|
96
|
+
}
|
|
34
97
|
|
|
35
98
|
/**
|
|
36
|
-
* Removes the previous
|
|
99
|
+
* Removes the previous build.
|
|
100
|
+
*
|
|
101
|
+
* @function ()
|
|
102
|
+
* @private
|
|
103
|
+
* @param {} -,
|
|
104
|
+
* @returns {} -,
|
|
105
|
+
* @since 0.0.0
|
|
37
106
|
*/
|
|
38
|
-
function
|
|
107
|
+
function _clean() {
|
|
39
108
|
const d1 = new Date();
|
|
40
109
|
process.stdout.write('Starting \'\x1b[36mclean\x1b[89m\x1b[0m\'...\n');
|
|
41
110
|
|
|
42
|
-
|
|
43
111
|
fs.rmSync(destination, { force: true, recursive: true });
|
|
44
112
|
fs.mkdirSync(destination, { recursive: true });
|
|
45
113
|
|
|
@@ -47,11 +115,16 @@ function clean() {
|
|
|
47
115
|
process.stdout.write(`Finished '\x1b[36mclean\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
|
|
48
116
|
}
|
|
49
117
|
|
|
50
|
-
|
|
51
118
|
/**
|
|
52
|
-
* Creates the content.
|
|
119
|
+
* Creates the content of the library.
|
|
120
|
+
*
|
|
121
|
+
* @function ()
|
|
122
|
+
* @private
|
|
123
|
+
* @param {} -,
|
|
124
|
+
* @returns {} -,
|
|
125
|
+
* @since 0.0.0
|
|
53
126
|
*/
|
|
54
|
-
function
|
|
127
|
+
function _docore() {
|
|
55
128
|
const d1 = new Date();
|
|
56
129
|
process.stdout.write('Starting \'\x1b[36mdocore\x1b[89m\x1b[0m\'...\n');
|
|
57
130
|
|
|
@@ -80,11 +153,16 @@ function docore() {
|
|
|
80
153
|
process.stdout.write(`Finished '\x1b[36mdocore\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
|
|
81
154
|
}
|
|
82
155
|
|
|
83
|
-
|
|
84
156
|
/**
|
|
85
|
-
*
|
|
157
|
+
* Creates the UMD Module.
|
|
158
|
+
*
|
|
159
|
+
* @function ()
|
|
160
|
+
* @private
|
|
161
|
+
* @param {} -,
|
|
162
|
+
* @returns {} -,
|
|
163
|
+
* @since 0.0.0
|
|
86
164
|
*/
|
|
87
|
-
function
|
|
165
|
+
function _doumdlib() {
|
|
88
166
|
const d1 = new Date();
|
|
89
167
|
process.stdout.write('Starting \'\x1b[36mdoumdlib\x1b[89m\x1b[0m\'...\n');
|
|
90
168
|
|
|
@@ -108,11 +186,16 @@ function doumdlib() {
|
|
|
108
186
|
process.stdout.write(`Finished '\x1b[36mdoumdlib\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
|
|
109
187
|
}
|
|
110
188
|
|
|
111
|
-
|
|
112
189
|
/**
|
|
113
190
|
* Creates the ES6 module.
|
|
191
|
+
*
|
|
192
|
+
* @function ()
|
|
193
|
+
* @private
|
|
194
|
+
* @param {} -,
|
|
195
|
+
* @returns {} -,
|
|
196
|
+
* @since 0.0.0
|
|
114
197
|
*/
|
|
115
|
-
function
|
|
198
|
+
function _domodule() {
|
|
116
199
|
const d1 = new Date();
|
|
117
200
|
process.stdout.write('Starting \'\x1b[36mdomodule\x1b[89m\x1b[0m\'...\n');
|
|
118
201
|
|
|
@@ -139,11 +222,16 @@ function domodule() {
|
|
|
139
222
|
process.stdout.write(`Finished '\x1b[36mdomodule\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
|
|
140
223
|
}
|
|
141
224
|
|
|
142
|
-
|
|
143
225
|
/**
|
|
144
226
|
* Removes the temp file(s).
|
|
227
|
+
*
|
|
228
|
+
* @function ()
|
|
229
|
+
* @private
|
|
230
|
+
* @param {} -,
|
|
231
|
+
* @returns {} -,
|
|
232
|
+
* @since 0.0.0
|
|
145
233
|
*/
|
|
146
|
-
function
|
|
234
|
+
function _delcore() {
|
|
147
235
|
const d1 = new Date();
|
|
148
236
|
process.stdout.write('Starting \'\x1b[36mdelcore\x1b[89m\x1b[0m\'...\n');
|
|
149
237
|
fs.unlinkSync(`${destination}/core.js`);
|
|
@@ -153,17 +241,44 @@ function delcore() {
|
|
|
153
241
|
}
|
|
154
242
|
|
|
155
243
|
|
|
156
|
-
// --
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
244
|
+
// -- Main ---------------------------------------------------------------------
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Executes the script.
|
|
248
|
+
*
|
|
249
|
+
* @function ()
|
|
250
|
+
* @puublic
|
|
251
|
+
* @param {} -,
|
|
252
|
+
* @returns {} -,
|
|
253
|
+
* @since 0.0.0
|
|
254
|
+
*/
|
|
255
|
+
function run() {
|
|
256
|
+
if (parsed.help) {
|
|
257
|
+
_help();
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (parsed.version) {
|
|
262
|
+
process.stdout.write(`version: ${parsed.version}\n`);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const d1 = new Date();
|
|
267
|
+
process.stdout.write('Starting \'\x1b[36mbuild:js:dev\x1b[89m\x1b[0m\'...\n');
|
|
268
|
+
|
|
269
|
+
_clean();
|
|
270
|
+
_docore();
|
|
271
|
+
_doumdlib();
|
|
272
|
+
_domodule();
|
|
273
|
+
_delcore();
|
|
274
|
+
|
|
275
|
+
const d2 = new Date() - d1;
|
|
276
|
+
process.stdout.write(`Finished '\x1b[36mbuild:js:dev\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
|
|
277
|
+
}
|
|
278
|
+
|
|
164
279
|
|
|
165
|
-
|
|
166
|
-
|
|
280
|
+
// Start script.
|
|
281
|
+
run();
|
|
167
282
|
|
|
168
283
|
|
|
169
284
|
// -- oOo --
|