Skip to content

Commit

Permalink
Updated the project with @mobilabs/es6lib v2.2.2 (removed typos in bu…
Browse files Browse the repository at this point in the history
…ild scripts).
  • Loading branch information
jclo committed Feb 10, 2024
1 parent 13ae3e2 commit ac28821
Show file tree
Hide file tree
Showing 13 changed files with 310 additions and 269 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,11 @@
### HEAD

### 2.1.2 (February 10, 2024)

* Updated the project with @mobilabs/es6lib v2.2.2 (removed typos in build scripts),
* ...,


### 2.1.1 (February 9, 2024)

* Updated the project with @mobilabs/es6lib v2.2.1 (improved build scripts),
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -85,7 +85,7 @@
"mocha": "^8.4.0",
"nodemon": "^3.0.2",
"terser": "^5.26.0",
"@mobilabs/es6lib": "2.2.1"
"@mobilabs/es6lib": "2.2.2"
},
"c8": {
"include": [
Expand Down
106 changes: 55 additions & 51 deletions scripts/_build.template.js
Expand Up @@ -3,7 +3,7 @@
*
* Does ...
*
* build:template script is a framework to build npm build scripts;
* build:template script is a framework to build npm build scripts.
*
* Private Functions:
* . _help displays the help message,
Expand Down Expand Up @@ -85,13 +85,13 @@ function _help() {
/**
* Removes the previous build.
*
* @function ()
* @function ([arg1])
* @private
* @param {} -,
* @param {Function} the function to call at the completion,
* @returns {Object} returns a promise,
* @since 0.0.0
*/
function _clean() {
function _clean(done) {
const d1 = new Date();
process.stdout.write('Starting \'\x1b[36mclean\x1b[89m\x1b[0m\'...\n');

Expand All @@ -105,6 +105,7 @@ function _clean() {
const d2 = new Date() - d1;
process.stdout.write(`Finished '\x1b[36mclean\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
resolve();
if (done) done();
});
});
});
Expand All @@ -121,13 +122,13 @@ function _clean() {
*/
function _doparallel1(done) {
const d1 = new Date();
process.stdout.write('Starting \'\x1b[36mdoparallel1\x1b[89m\x1b[0m\'...\n');
process.stdout.write('Starting \'\x1b[36mdo:parallel1\x1b[89m\x1b[0m\'...\n');

fs.writeFile(`${destination}/generic1.js`, 'bla bla', { encoding: 'utf8' }, (err) => {
if (err) throw new Error(err);

const d2 = new Date() - d1;
process.stdout.write(`Finished '\x1b[36mdodoparallel1\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
process.stdout.write(`Finished '\x1b[36mdo:doparallel1\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
done();
});
}
Expand All @@ -143,13 +144,13 @@ function _doparallel1(done) {
*/
function _doparallel2(done) {
const d1 = new Date();
process.stdout.write('Starting \'\x1b[36mdoparallel2\x1b[89m\x1b[0m\'...\n');
process.stdout.write('Starting \'\x1b[36mdo:parallel2\x1b[89m\x1b[0m\'...\n');

fs.writeFile(`${destination}/generic2.js`, 'bla bla', { encoding: 'utf8' }, (err) => {
if (err) throw new Error(err);

const d2 = new Date() - d1;
process.stdout.write(`Finished '\x1b[36mdodoparallel2\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
process.stdout.write(`Finished '\x1b[36mdo:parallel2\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
done();
});
}
Expand All @@ -165,7 +166,7 @@ function _doparallel2(done) {
*/
function _delgeneric(done) {
const d1 = new Date();
process.stdout.write('Starting \'\x1b[36mdelgeneric\x1b[89m\x1b[0m\'...\n');
process.stdout.write('Starting \'\x1b[36mdel:generic\x1b[89m\x1b[0m\'...\n');

/**
* Wait all the processes are completed.
Expand All @@ -175,7 +176,7 @@ function _delgeneric(done) {
pending -= 1;
if (!pending) {
const d2 = new Date() - d1;
process.stdout.write(`Finished '\x1b[36mdelgeneric\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
process.stdout.write(`Finished '\x1b[36mdel:generic\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
done();
}
}
Expand All @@ -192,55 +193,58 @@ function _delgeneric(done) {
}


// -- Main ---------------------------------------------------------------------
// -- Public Static Methods ----------------------------------------------------

/**
* Executes the script.
*
* @function ()
* @public
* @param {} -,
* @returns {} -,
* @since 0.0.0
*/
async function run() {
const PENDING = 2;
const Lib = {

if (parsed.help) {
_help();
return;
}

if (parsed.version) {
process.stdout.write(`version: ${parsed.version}\n`);
return;
}
/**
* Executes the script.
*
* @method ()
* @public
* @param {} -,
* @returns {} -,
* @since 0.0.0
*/
async run() {
const PENDING = 2;

if (parsed.help) {
_help();
return;
}

const d1 = new Date();
process.stdout.write('Starting \'\x1b[36mbuild:xxx:yyy\x1b[89m\x1b[0m\'...\n');
if (parsed.version) {
process.stdout.write(`version: ${parsed.version}\n`);
return;
}

let pending = PENDING;
/**
* Executes done until completion.
*/
function done() {
pending -= 1;
if (!pending) {
_delgeneric(() => {
const d2 = new Date() - d1;
process.stdout.write(`Finished '\x1b[36mbuild:xxx:yyy\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
});
const d1 = new Date();
process.stdout.write('Starting \'\x1b[36mbuild:xxx:yyy\x1b[89m\x1b[0m\'...\n');

let pending = PENDING;
/**
* Executes done until completion.
*/
function done() {
pending -= 1;
if (!pending) {
_delgeneric(() => {
const d2 = new Date() - d1;
process.stdout.write(`Finished '\x1b[36mbuild:xxx:yyy\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
});
}
}
}

await _clean();
_doparallel1(done);
_doparallel2(done);
}
await _clean();
_doparallel1(done);
_doparallel2(done);
},
};


// Start script.
run();
// -- Where the script starts --------------------------------------------------
Lib.run();


// -- oOo --
63 changes: 33 additions & 30 deletions scripts/build.js.dev.js
Expand Up @@ -96,7 +96,7 @@ function _help() {
/**
* Removes the previous build.
*
* @function (arg1)
* @function ([arg1])
* @private
* @param {Function} the function to call at the completion,
* @returns {object} returns a promise,
Expand Down Expand Up @@ -258,42 +258,45 @@ function _doLibs(done) {
}


// -- Main ---------------------------------------------------------------------
// -- Public Static Methods ----------------------------------------------------

/**
* Executes the script.
*
* @function ()
* @public
* @param {} -,
* @returns {} -,
* @since 0.0.0
*/
function run() {
if (parsed.help) {
_help();
return;
}
const Lib = {

if (parsed.version) {
process.stdout.write(`version: ${parsed.version}\n`);
return;
}
/**
* Executes the script.
*
* @method ()
* @public
* @param {} -,
* @returns {} -,
* @since 0.0.0
*/
async run() {
if (parsed.help) {
_help();
return;
}

const d1 = new Date();
process.stdout.write('Starting \'\x1b[36mbuild:js:dev\x1b[89m\x1b[0m\'...\n');
if (parsed.version) {
process.stdout.write(`version: ${parsed.version}\n`);
return;
}

const d1 = new Date();
process.stdout.write('Starting \'\x1b[36mbuild:js:dev\x1b[89m\x1b[0m\'...\n');

_clean(() => {
_doLibs(() => {
const d2 = new Date() - d1;
process.stdout.write(`Finished '\x1b[36mbuild:js:dev\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
_clean(() => {
_doLibs(() => {
const d2 = new Date() - d1;
process.stdout.write(`Finished '\x1b[36mbuild:js:dev\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
});
});
});
}
},
};


// Start script.
run();
// -- Where the script starts --------------------------------------------------
Lib.run();


// -- oOo --

0 comments on commit ac28821

Please sign in to comment.