@mobilabs/es6lib 2.1.0 → 2.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/.github/workflows/ci.yml +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 +5 -5
- package/package.json +1 -1
- package/scripts/_build.template.js +247 -0
- package/scripts/build.js.dev.js +284 -0
- package/scripts/build.js.prod.js +294 -0
- package/scripts/build.skeleton.prod.js +198 -0
- package/scripts/compress.sh +41 -0
- package/scripts/config.js +80 -0
- package/scripts/dep.npm.private.sh +42 -0
- package/scripts/dep.private.js +232 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* *****************************************************************************
|
|
3
|
+
*
|
|
4
|
+
* Creates the production JS files.
|
|
5
|
+
*
|
|
6
|
+
* build:js:prod.js script minifies JS files and copies them in the
|
|
7
|
+
* production folder.
|
|
8
|
+
*
|
|
9
|
+
* Private Functions:
|
|
10
|
+
* . _help displays the help message,
|
|
11
|
+
* . _clean removes the previous js production files,
|
|
12
|
+
* . _copydev builds the js production file,
|
|
13
|
+
* . _copydevm builds the ES6 module production file,
|
|
14
|
+
* . _makeminified builds and minifies the js production file,
|
|
15
|
+
* . _makeminifiedm builds and minifies the ES6 module production file,
|
|
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,
|
|
30
|
+
import/no-extraneous-dependencies: 0 */
|
|
31
|
+
|
|
32
|
+
'use strict';
|
|
33
|
+
|
|
34
|
+
// -- Vendor Modules
|
|
35
|
+
const fs = require('fs')
|
|
36
|
+
, nopt = require('nopt')
|
|
37
|
+
, { minify } = require('terser')
|
|
38
|
+
;
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
// -- Local Modules
|
|
42
|
+
const config = require('./config')
|
|
43
|
+
;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
// -- Local Constants
|
|
47
|
+
const VERSION = '0.0.0-alpha.0'
|
|
48
|
+
, opts = {
|
|
49
|
+
help: [Boolean, false],
|
|
50
|
+
version: [String, null],
|
|
51
|
+
}
|
|
52
|
+
, shortOpts = {
|
|
53
|
+
h: ['--help'],
|
|
54
|
+
v: ['--version', VERSION],
|
|
55
|
+
}
|
|
56
|
+
, parsed = nopt(opts, shortOpts, process.argv, 2)
|
|
57
|
+
, { dist } = config
|
|
58
|
+
, { libdir } = config
|
|
59
|
+
, { name } = config
|
|
60
|
+
, { license } = config
|
|
61
|
+
;
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
// -- Local Variables
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
// -- Private Functions --------------------------------------------------------
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Dispays the help message.
|
|
71
|
+
*
|
|
72
|
+
* @function ()
|
|
73
|
+
* @private
|
|
74
|
+
* @param {} -,
|
|
75
|
+
* @returns {} -,
|
|
76
|
+
* @since 0.0.0
|
|
77
|
+
*/
|
|
78
|
+
function _help() {
|
|
79
|
+
const message = ['',
|
|
80
|
+
'Usage: command [options]',
|
|
81
|
+
'',
|
|
82
|
+
' creates the js production files',
|
|
83
|
+
'',
|
|
84
|
+
'Options:',
|
|
85
|
+
'',
|
|
86
|
+
'-h, --help output usage information',
|
|
87
|
+
'-v, --version output the version number',
|
|
88
|
+
'',
|
|
89
|
+
].join('\n');
|
|
90
|
+
|
|
91
|
+
process.stdout.write(`${message}\n`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Removes the previous js production build.
|
|
96
|
+
*
|
|
97
|
+
* @function ()
|
|
98
|
+
* @private
|
|
99
|
+
* @param {} -,
|
|
100
|
+
* @returns {} -,
|
|
101
|
+
* @since 0.0.0
|
|
102
|
+
*/
|
|
103
|
+
function _clean() {
|
|
104
|
+
const d1 = new Date();
|
|
105
|
+
process.stdout.write('Starting \'\x1b[36mclean\x1b[89m\x1b[0m\'...\n');
|
|
106
|
+
|
|
107
|
+
return new Promise((resolve) => {
|
|
108
|
+
fs.rm(`${dist}/lib`, { force: true, recursive: true }, (err1) => {
|
|
109
|
+
if (err1) throw new Error(err1);
|
|
110
|
+
|
|
111
|
+
fs.mkdir(`${dist}/lib`, { recursive: true }, (err2) => {
|
|
112
|
+
if (err2) throw new Error(err2);
|
|
113
|
+
|
|
114
|
+
const d2 = new Date() - d1;
|
|
115
|
+
process.stdout.write(`Finished '\x1b[36mclean\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
|
|
116
|
+
resolve();
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Builds the js production file.
|
|
124
|
+
*
|
|
125
|
+
* @function (arg1)
|
|
126
|
+
* @private
|
|
127
|
+
* @param {Function} the function to call at the completion,
|
|
128
|
+
* @returns {} -,
|
|
129
|
+
* @since 0.0.0
|
|
130
|
+
*/
|
|
131
|
+
function _copydev(done) {
|
|
132
|
+
const d1 = new Date();
|
|
133
|
+
process.stdout.write('Starting \'\x1b[36mcopydev\x1b[89m\x1b[0m\'...\n');
|
|
134
|
+
|
|
135
|
+
fs.readFile(`${libdir}/${name}.js`, 'utf8', (err1, data) => {
|
|
136
|
+
if (err1) throw new Error(err1);
|
|
137
|
+
|
|
138
|
+
let content = license;
|
|
139
|
+
content += data;
|
|
140
|
+
fs.writeFile(`${dist}/lib/${name}.js`, content, { encoding: 'utf8' }, (err2) => {
|
|
141
|
+
if (err2) throw new Error(err2);
|
|
142
|
+
|
|
143
|
+
const d2 = new Date() - d1;
|
|
144
|
+
process.stdout.write(`Finished '\x1b[36mcopydev\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
|
|
145
|
+
done();
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Builds the ES6 module production file.
|
|
152
|
+
*
|
|
153
|
+
* @function (arg1)
|
|
154
|
+
* @private
|
|
155
|
+
* @param {Function} the function to call at the completion,
|
|
156
|
+
* @returns {} -,
|
|
157
|
+
* @since 0.0.0
|
|
158
|
+
*/
|
|
159
|
+
function _copydevm(done) {
|
|
160
|
+
const d1 = new Date();
|
|
161
|
+
process.stdout.write('Starting \'\x1b[36mcopydevm\x1b[89m\x1b[0m\'...\n');
|
|
162
|
+
|
|
163
|
+
fs.readFile(`${libdir}/${name}.mjs`, 'utf8', (err1, data) => {
|
|
164
|
+
if (err1) throw new Error(err1);
|
|
165
|
+
|
|
166
|
+
let content = license;
|
|
167
|
+
content += data;
|
|
168
|
+
fs.writeFile(`${dist}/lib/${name}.mjs`, content, { encoding: 'utf8' }, (err2) => {
|
|
169
|
+
if (err2) throw new Error(err2);
|
|
170
|
+
|
|
171
|
+
const d2 = new Date() - d1;
|
|
172
|
+
process.stdout.write(`Finished '\x1b[36mcopydevm\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
|
|
173
|
+
done();
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Builds and minifies the js production file.
|
|
180
|
+
*
|
|
181
|
+
* @function (arg1)
|
|
182
|
+
* @private
|
|
183
|
+
* @param {Function} the function to call at the completion,
|
|
184
|
+
* @returns {} -,
|
|
185
|
+
* @since 0.0.0
|
|
186
|
+
*/
|
|
187
|
+
function _makeminified(done) {
|
|
188
|
+
const d1 = new Date();
|
|
189
|
+
process.stdout.write('Starting \'\x1b[36mmakeminified\x1b[89m\x1b[0m\'...\n');
|
|
190
|
+
|
|
191
|
+
fs.readFile(`${libdir}/${name}.js`, 'utf8', (err1, data) => {
|
|
192
|
+
if (err1) throw new Error(err1);
|
|
193
|
+
|
|
194
|
+
let content = license;
|
|
195
|
+
content += data.replace(/\/\*! \*\*\*/g, '/** ***');
|
|
196
|
+
|
|
197
|
+
minify(content, {})
|
|
198
|
+
.then((result) => {
|
|
199
|
+
fs.writeFile(`${dist}/lib/${name}.min.js`, result.code, { encoding: 'utf8' }, (err2) => {
|
|
200
|
+
if (err2) throw new Error(err2);
|
|
201
|
+
|
|
202
|
+
const d2 = new Date() - d1;
|
|
203
|
+
process.stdout.write(`Finished '\x1b[36mmakeminified\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
|
|
204
|
+
done();
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Builds and minifies the ES6 module production file.
|
|
212
|
+
*
|
|
213
|
+
* @function (arg1)
|
|
214
|
+
* @private
|
|
215
|
+
* @param {Function} the function to call at the completion,
|
|
216
|
+
* @returns {} -,
|
|
217
|
+
* @since 0.0.0
|
|
218
|
+
*/
|
|
219
|
+
function _makeminifiedm(done) {
|
|
220
|
+
const d1 = new Date();
|
|
221
|
+
process.stdout.write('Starting \'\x1b[36mmakeminified\x1b[89m\x1b[0m\'...\n');
|
|
222
|
+
|
|
223
|
+
fs.readFile(`${libdir}/${name}.mjs`, 'utf8', (err1, data) => {
|
|
224
|
+
if (err1) throw new Error(err1);
|
|
225
|
+
|
|
226
|
+
let content = license;
|
|
227
|
+
content += data.replace(/\/\*! \*\*\*/g, '/** ***');
|
|
228
|
+
|
|
229
|
+
minify(content, {})
|
|
230
|
+
.then((result) => {
|
|
231
|
+
fs.writeFile(`${dist}/lib/${name}.min.mjs`, result.code, { encoding: 'utf8' }, (err2) => {
|
|
232
|
+
if (err2) throw new Error(err2);
|
|
233
|
+
|
|
234
|
+
const d2 = new Date() - d1;
|
|
235
|
+
process.stdout.write(`Finished '\x1b[36mmakeminified\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
|
|
236
|
+
done();
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
// -- Main ---------------------------------------------------------------------
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Executes the script.
|
|
247
|
+
*
|
|
248
|
+
* @function ()
|
|
249
|
+
* @public
|
|
250
|
+
* @param {} -,
|
|
251
|
+
* @returns {} -,
|
|
252
|
+
* @since 0.0.0
|
|
253
|
+
*/
|
|
254
|
+
async function run() {
|
|
255
|
+
const PENDING = 4;
|
|
256
|
+
|
|
257
|
+
if (parsed.help) {
|
|
258
|
+
_help();
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (parsed.version) {
|
|
263
|
+
process.stdout.write(`version: ${parsed.version}\n`);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const d1 = new Date();
|
|
268
|
+
process.stdout.write('Starting \'\x1b[36mbuild:js:prod\x1b[89m\x1b[0m\'...\n');
|
|
269
|
+
|
|
270
|
+
let pending = PENDING;
|
|
271
|
+
/**
|
|
272
|
+
* Executes done until completion.
|
|
273
|
+
*/
|
|
274
|
+
function done() {
|
|
275
|
+
pending -= 1;
|
|
276
|
+
if (!pending) {
|
|
277
|
+
const d2 = new Date() - d1;
|
|
278
|
+
process.stdout.write(`Finished '\x1b[36mbuild:js:prod\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
await _clean();
|
|
283
|
+
_copydev(done);
|
|
284
|
+
_copydevm(done);
|
|
285
|
+
_makeminified(done);
|
|
286
|
+
_makeminifiedm(done);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
// Start script.
|
|
291
|
+
run();
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
// -- oOo --
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* *****************************************************************************
|
|
3
|
+
*
|
|
4
|
+
* Creates the production folder.
|
|
5
|
+
*
|
|
6
|
+
* build:skeleton:prod.js script creates the productiion folder and copies the
|
|
7
|
+
* files defined in config.js.
|
|
8
|
+
*
|
|
9
|
+
* Private Functions:
|
|
10
|
+
* . _help displays the help message,
|
|
11
|
+
* . _clean removes the previous production folder,
|
|
12
|
+
* . _doskeleton creates the production folder and copies files,
|
|
13
|
+
*
|
|
14
|
+
*
|
|
15
|
+
* Public Static Methods:
|
|
16
|
+
* . run executes the script,
|
|
17
|
+
*
|
|
18
|
+
*
|
|
19
|
+
* @namespace -
|
|
20
|
+
* @dependencies none
|
|
21
|
+
* @exports -
|
|
22
|
+
* @author -
|
|
23
|
+
* @since 0.0.0
|
|
24
|
+
* @version -
|
|
25
|
+
* ************************************************************************** */
|
|
26
|
+
/* eslint one-var: 0, semi-style: 0, no-underscore-dangle: 0,
|
|
27
|
+
import/no-extraneous-dependencies: 0 */
|
|
28
|
+
|
|
29
|
+
'use strict';
|
|
30
|
+
|
|
31
|
+
// -- Vendor Modules
|
|
32
|
+
const fs = require('fs')
|
|
33
|
+
, path = require('path')
|
|
34
|
+
, nopt = require('nopt')
|
|
35
|
+
;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
// -- Local Modules
|
|
39
|
+
const config = require('./config')
|
|
40
|
+
;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// -- Local Constants
|
|
44
|
+
const VERSION = '0.0.0-alpha.0'
|
|
45
|
+
, opts = {
|
|
46
|
+
help: [Boolean, false],
|
|
47
|
+
version: [String, null],
|
|
48
|
+
}
|
|
49
|
+
, shortOpts = {
|
|
50
|
+
h: ['--help'],
|
|
51
|
+
v: ['--version', VERSION],
|
|
52
|
+
}
|
|
53
|
+
, parsed = nopt(opts, shortOpts, process.argv, 2)
|
|
54
|
+
, { dist } = config
|
|
55
|
+
, { webfiles } = config
|
|
56
|
+
;
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// -- Local Variables
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
// -- Private Functions --------------------------------------------------------
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Dispays the help message.
|
|
66
|
+
*
|
|
67
|
+
* @function ()
|
|
68
|
+
* @private
|
|
69
|
+
* @param {} -,
|
|
70
|
+
* @returns {} -,
|
|
71
|
+
* @since 0.0.0
|
|
72
|
+
*/
|
|
73
|
+
function _help() {
|
|
74
|
+
const message = ['',
|
|
75
|
+
'Usage: command [options]',
|
|
76
|
+
'',
|
|
77
|
+
' creates the production folder and copies the files defined in config.js',
|
|
78
|
+
'',
|
|
79
|
+
'Options:',
|
|
80
|
+
'',
|
|
81
|
+
'-h, --help output usage information',
|
|
82
|
+
'-v, --version output the version number',
|
|
83
|
+
'',
|
|
84
|
+
].join('\n');
|
|
85
|
+
|
|
86
|
+
process.stdout.write(`${message}\n`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Removes the previous production folder,
|
|
91
|
+
*
|
|
92
|
+
* @function ()
|
|
93
|
+
* @private
|
|
94
|
+
* @param {} -,
|
|
95
|
+
* @returns {Object} returns a promise,
|
|
96
|
+
* @since 0.0.0
|
|
97
|
+
*/
|
|
98
|
+
function _clean() {
|
|
99
|
+
const d1 = new Date();
|
|
100
|
+
process.stdout.write('Starting \'\x1b[36mclean\x1b[89m\x1b[0m\'...\n');
|
|
101
|
+
|
|
102
|
+
return new Promise((resolve) => {
|
|
103
|
+
fs.rm(dist, { force: true, recursive: true }, (err) => {
|
|
104
|
+
if (err) throw new Error(err);
|
|
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
|
+
* Creates the production folder and copies files.
|
|
115
|
+
*
|
|
116
|
+
* @function (arg1)
|
|
117
|
+
* @private
|
|
118
|
+
* @param {Function} the function to call at the completion,
|
|
119
|
+
* @returns {} -,
|
|
120
|
+
* @since 0.0.0
|
|
121
|
+
*/
|
|
122
|
+
function _doskeleton(done) {
|
|
123
|
+
const d1 = new Date();
|
|
124
|
+
process.stdout.write('Starting \'\x1b[36mdoskeleton\x1b[89m\x1b[0m\'...\n');
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Wait all processes completed;
|
|
128
|
+
*/
|
|
129
|
+
let pending = webfiles.length;
|
|
130
|
+
function _next() {
|
|
131
|
+
pending -= 1;
|
|
132
|
+
if (!pending) {
|
|
133
|
+
const d2 = new Date() - d1;
|
|
134
|
+
process.stdout.write(`Finished '\x1b[36mdoskeleton\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
|
|
135
|
+
done();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
let filename;
|
|
140
|
+
for (let i = 0; i < webfiles.length; i++) {
|
|
141
|
+
filename = path.basename(webfiles[i]);
|
|
142
|
+
fs.cp(webfiles[i], `${dist}/${filename}`, (err) => {
|
|
143
|
+
if (err) throw new Error(err);
|
|
144
|
+
_next();
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
// -- Main ---------------------------------------------------------------------
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Executes the script.
|
|
154
|
+
*
|
|
155
|
+
* @function ()
|
|
156
|
+
* @public
|
|
157
|
+
* @param {} -,
|
|
158
|
+
* @returns {} -,
|
|
159
|
+
* @since 0.0.0
|
|
160
|
+
*/
|
|
161
|
+
async function run() {
|
|
162
|
+
const PENDING = 1;
|
|
163
|
+
|
|
164
|
+
if (parsed.help) {
|
|
165
|
+
_help();
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (parsed.version) {
|
|
170
|
+
process.stdout.write(`version: ${parsed.version}\n`);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const d1 = new Date();
|
|
175
|
+
process.stdout.write('Starting \'\x1b[36mbuild:skeleton:prod\x1b[89m\x1b[0m\'...\n');
|
|
176
|
+
|
|
177
|
+
let pending = PENDING;
|
|
178
|
+
/**
|
|
179
|
+
* Executes done until completion.
|
|
180
|
+
*/
|
|
181
|
+
function done() {
|
|
182
|
+
pending -= 1;
|
|
183
|
+
if (!pending) {
|
|
184
|
+
const d2 = new Date() - d1;
|
|
185
|
+
process.stdout.write(`Finished '\x1b[36mbuild:skeleton:prod\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
await _clean();
|
|
190
|
+
_doskeleton(done);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
// Start script.
|
|
195
|
+
run();
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
// -- oOo --
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
NAME=$1
|
|
4
|
+
name=$(echo $1 | tr '[:upper:]' '[:lower:]')
|
|
5
|
+
VERSION=$2
|
|
6
|
+
NAMESPACE=$3
|
|
7
|
+
NPM='private_repo'
|
|
8
|
+
TMP='tmp'
|
|
9
|
+
DIST='_dist'
|
|
10
|
+
|
|
11
|
+
# Check if it is a package with a namespace. For instance @mobilabs/libname
|
|
12
|
+
if [[ ! -z ${NAMESPACE} ]]
|
|
13
|
+
then
|
|
14
|
+
# Remove the namespace:
|
|
15
|
+
NAMESPACE=${NAMESPACE}/
|
|
16
|
+
name=${name/${NAMESPACE}}
|
|
17
|
+
echo ${name}
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
if [[ -z ${name} ]]
|
|
21
|
+
then
|
|
22
|
+
echo 'You have to provide a name for the NPM package! Aborting ...'
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
if [[ -z ${VERSION} ]]
|
|
27
|
+
then
|
|
28
|
+
echo 'You have to provide a version for the NPM package! Aborting ...'
|
|
29
|
+
exit 1
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
mkdir -p ${NPM}/${name}/${VERSION}/${name}
|
|
33
|
+
cp ${NPM}/${TMP}/index.js ${NPM}/${name}/${VERSION}/${name}/.
|
|
34
|
+
cp ${NPM}/${TMP}/package.json ${NPM}/${name}/${VERSION}/${name}/.
|
|
35
|
+
rm -rf ${NPM}/${TMP}
|
|
36
|
+
|
|
37
|
+
cp -r ${DIST} ${NPM}/${name}/${VERSION}/${name}/_dist
|
|
38
|
+
cd ${NPM}/${name}/${VERSION}
|
|
39
|
+
tar zcvf ${name}.tgz ${name}/
|
|
40
|
+
rm -rf ${name}
|
|
41
|
+
echo 'Done!'
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* eslint one-var: 0, semi-style: 0 */
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
// -- Vendor Modules
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// -- Local Modules
|
|
9
|
+
const pack = require('../package.json');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
// -- Local Constants
|
|
13
|
+
const libname = 'ES6lib'
|
|
14
|
+
, name = libname.replace(/\s+/g, '').toLowerCase()
|
|
15
|
+
;
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
// -- Local Variables
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
// -- Main
|
|
22
|
+
|
|
23
|
+
module.exports = {
|
|
24
|
+
ES6GLOB: '$__ES6GLOB',
|
|
25
|
+
dist: './_dist',
|
|
26
|
+
libdir: './lib',
|
|
27
|
+
libname,
|
|
28
|
+
name,
|
|
29
|
+
index: './index.js',
|
|
30
|
+
distlink: `./_dist/lib/${name}.js`,
|
|
31
|
+
|
|
32
|
+
// These are the Javascript files required to build the library. Choose one
|
|
33
|
+
// pattern among these ones. The library can include only the header file,
|
|
34
|
+
// a core file and the footer file. The files 'basic.js', 'functional.js',
|
|
35
|
+
// 'functional-shared.js', 'prototypal.js', 'pseudoclassical.js' and
|
|
36
|
+
// 'pseudoclassical-auto.js' are mutually exclusives.
|
|
37
|
+
/* eslint-disable no-multi-spaces */
|
|
38
|
+
src: [
|
|
39
|
+
// These three files (_header, _head.js and extend.js) must be declared
|
|
40
|
+
// in this order as they create the umd module, define the global
|
|
41
|
+
// constants/variables, the object tree and the function to fill
|
|
42
|
+
// the tree!
|
|
43
|
+
'./src/_header',
|
|
44
|
+
'./src/_head.js',
|
|
45
|
+
'./src/lib/extend.js',
|
|
46
|
+
|
|
47
|
+
'./src/util/util.js',
|
|
48
|
+
// './src/basic.js',
|
|
49
|
+
// './src/basicplus.js',
|
|
50
|
+
// './src/functional.js',
|
|
51
|
+
// './src/functional-shared.js',
|
|
52
|
+
'./src/prototypal.js',
|
|
53
|
+
// './src/pseudoclassical.js',
|
|
54
|
+
// './src/pseudoclassical-auto.js',
|
|
55
|
+
|
|
56
|
+
// This file must always be the last one as it closes the umd module.
|
|
57
|
+
'./src/_footer',
|
|
58
|
+
],
|
|
59
|
+
/* eslint-enable no-multi-spaces */
|
|
60
|
+
|
|
61
|
+
webfiles: [
|
|
62
|
+
// These are the files to copy to the root path of the web app,
|
|
63
|
+
'./README.md',
|
|
64
|
+
'./LICENSE.md',
|
|
65
|
+
],
|
|
66
|
+
|
|
67
|
+
get license() {
|
|
68
|
+
return ['/*! ****************************************************************************',
|
|
69
|
+
` * ${libname} v${pack.version}`,
|
|
70
|
+
' *',
|
|
71
|
+
` * ${pack.description}.`,
|
|
72
|
+
' * (you can download it from npm or github repositories)',
|
|
73
|
+
` * Copyright (c) ${(new Date()).getFullYear()} ${pack.author.name} <${pack.author.email}> (${pack.author.url}).`,
|
|
74
|
+
' * Released under the MIT license. You may obtain a copy of the License',
|
|
75
|
+
' * at: http://www.opensource.org/licenses/mit-license.php).',
|
|
76
|
+
' * Built from {{boiler:name}} v{{boiler:name:version}}.',
|
|
77
|
+
' * ************************************************************************** */',
|
|
78
|
+
''].join('\n');
|
|
79
|
+
},
|
|
80
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
NAME=$1
|
|
4
|
+
name=$(echo $1 | tr '[:upper:]' '[:lower:]')
|
|
5
|
+
VERSION=$2
|
|
6
|
+
NAMESPACE=$3
|
|
7
|
+
NPM='npm_private_repo'
|
|
8
|
+
|
|
9
|
+
# Check if it is a package with a namespace. For instance @mobilabs/libname
|
|
10
|
+
if [[ ! -z ${NAMESPACE} ]]
|
|
11
|
+
then
|
|
12
|
+
PREFIX=${NAMESPACE/@}
|
|
13
|
+
# remove the namespace:
|
|
14
|
+
NAMESPACE=${NAMESPACE}/
|
|
15
|
+
name=${name/${NAMESPACE}}
|
|
16
|
+
echo ${name}
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
if [[ -z ${name} ]]
|
|
20
|
+
then
|
|
21
|
+
echo 'You have to provide a name for the NPM package! Aborting ...'
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
if [[ -z ${VERSION} ]]
|
|
26
|
+
then
|
|
27
|
+
echo 'You have to provide a version for the NPM package! Aborting ...'
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
mkdir -p ${NPM}/${name}
|
|
32
|
+
if [[ ! -z ${NAMESPACE} ]]
|
|
33
|
+
then
|
|
34
|
+
mv ${PREFIX}-${name}-${VERSION}.tgz ./${NPM}/${name}/.
|
|
35
|
+
else
|
|
36
|
+
mv ${name}-${VERSION}.tgz ./${NPM}/${name}/.
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
echo 'done!'
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# -- oOo --
|