@mobilabs/es6lib 1.0.14 → 1.0.15

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/.husky/pre-commit CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/bin/sh
2
2
  . "$(dirname "$0")/_/husky.sh"
3
3
 
4
- npm run build
5
- npm run makedist
4
+ npm run build:dev
5
+ npm run build:prod
6
6
  npm test
7
- npm run check-coverage
7
+ npm run check:coverage
8
8
  npm run report
package/.travis.yml CHANGED
@@ -14,6 +14,6 @@ before_script:
14
14
  - npm prune
15
15
  script:
16
16
  - npm run test
17
- - npm run check-coverage
17
+ - npm run check:coverage
18
18
  after_success:
19
- - npm run report-coverage
19
+ - npm run report:coverage
package/README.md CHANGED
@@ -16,7 +16,7 @@ The ES6lib build produces two libraries:
16
16
  * a library packaged in an UMD module that could be used on both the browser and Node.js,
17
17
  * a library packaged as an ES6 module that can be imported with the keyword `import` (import ES6lib from '../../es6lib.mjs').
18
18
 
19
- This template does not include a transpiler like babel or a module bundler like browserify/webpack or rollup. It relies on Gulp to build your library from the source files. Thus, it keeps your library pure (without extra code due to the transpiler or the module bundler).
19
+ This template does not include a transpiler like babel or a module bundler like browserify/webpack or rollup. It relies on Npm scripts to build your library from the source files. Thus, it keeps your library pure (without extra code due to the transpiler or the module bundler).
20
20
 
21
21
  This template is useful if your library is intended to run on ECMAScript 2015 (ES6) compliant browser.
22
22
 
@@ -66,7 +66,7 @@ Your project Folder
66
66
  | |_ _header // The UMD header,
67
67
  | |_ ... // The core or your library,
68
68
  |_ tasks
69
- | |_ ... // The Gulp tasks to build your project,
69
+ | |_ ... // The tasks to build your project,
70
70
  |_ test
71
71
  | |_ main.js // Your Mocha, Chai test file,
72
72
  |_ .eslintignore // Files to be ignored by ESLint,
@@ -75,7 +75,6 @@ Your project Folder
75
75
  |_ .npmignore // Files that are ignored by npm publish,
76
76
  |_ .travis.yml // A configuration file for Travis CI (if you use it),
77
77
  |_ .CHANGELOG.md // The changes between your different versions,
78
- |_ .gulpfile.js // The main Gulp task,
79
78
  |_ index.js // The link to your ES5 library,
80
79
  |_ LICENSE.md // The license that applies to your library (here MIT),
81
80
  |_ package-lock.json // The NPM dependency tree,
@@ -88,10 +87,10 @@ This folder is now a NPM package.
88
87
 
89
88
  ## How to build it
90
89
 
91
- The file `gulpfile.js` contains the build instructions. These instructions populate the folder `lib` from the sources files included in the folder `src`.
90
+ The file `package.json` contains the build instructions. These instructions populate the folder `lib` from the sources files included in the folder `src`.
92
91
 
93
- `gulpfile.js` implements two operations for the build:
94
- * the command `npm run build` creates the library at the execution,
92
+ `package.json` implements two operations for the build:
93
+ * the command `npm run build:dev` creates the library at the execution,
95
94
  * and the command `npm run watch` updates the library when one of the source files is modified.
96
95
 
97
96
 
@@ -100,23 +99,23 @@ The file `gulpfile.js` contains the build instructions. These instructions popul
100
99
  Your `package.json` file contains three scripts to test your UMD library:
101
100
 
102
101
  * `npm run test`,
103
- * `npm run check-coverage`,
104
- * `npm run display-coverage`.
102
+ * `npm run check:coverage`,
103
+ * `npm run display:coverage`.
105
104
 
106
105
  `npm run test` executes the tests and computes the test coverage.
107
106
 
108
- `npm run check-coverage` checks if the test coverage matches the requirements. Here 100%.
107
+ `npm run check:coverage` checks if the test coverage matches the requirements. Here 100%.
109
108
 
110
- `npm run display-coverage` opens your browser and reports the test coverage.
109
+ `npm run display:coverage` opens your browser and reports the test coverage.
111
110
 
112
111
 
113
112
  ## How to create a distribution version
114
113
 
115
114
  Your `package.json` file contains a script to build a distribution library:
116
115
 
117
- * `npm run makedist`
116
+ * `npm run build:prod`
118
117
 
119
- The script `makedist` adds a license header to the library and creates a minified version.
118
+ The script `build:prod` adds a license header to the library and creates a minified version.
120
119
 
121
120
 
122
121
  ## How to use it
package/_dist/README.md CHANGED
@@ -16,7 +16,7 @@ The ES6lib build produces two libraries:
16
16
  * a library packaged in an UMD module that could be used on both the browser and Node.js,
17
17
  * a library packaged as an ES6 module that can be imported with the keyword `import` (import ES6lib from '../../es6lib.mjs').
18
18
 
19
- This template does not include a transpiler like babel or a module bundler like browserify/webpack or rollup. It relies on Gulp to build your library from the source files. Thus, it keeps your library pure (without extra code due to the transpiler or the module bundler).
19
+ This template does not include a transpiler like babel or a module bundler like browserify/webpack or rollup. It relies on Npm scripts to build your library from the source files. Thus, it keeps your library pure (without extra code due to the transpiler or the module bundler).
20
20
 
21
21
  This template is useful if your library is intended to run on ECMAScript 2015 (ES6) compliant browser.
22
22
 
@@ -66,7 +66,7 @@ Your project Folder
66
66
  | |_ _header // The UMD header,
67
67
  | |_ ... // The core or your library,
68
68
  |_ tasks
69
- | |_ ... // The Gulp tasks to build your project,
69
+ | |_ ... // The tasks to build your project,
70
70
  |_ test
71
71
  | |_ main.js // Your Mocha, Chai test file,
72
72
  |_ .eslintignore // Files to be ignored by ESLint,
@@ -75,7 +75,6 @@ Your project Folder
75
75
  |_ .npmignore // Files that are ignored by npm publish,
76
76
  |_ .travis.yml // A configuration file for Travis CI (if you use it),
77
77
  |_ .CHANGELOG.md // The changes between your different versions,
78
- |_ .gulpfile.js // The main Gulp task,
79
78
  |_ index.js // The link to your ES5 library,
80
79
  |_ LICENSE.md // The license that applies to your library (here MIT),
81
80
  |_ package-lock.json // The NPM dependency tree,
@@ -88,10 +87,10 @@ This folder is now a NPM package.
88
87
 
89
88
  ## How to build it
90
89
 
91
- The file `gulpfile.js` contains the build instructions. These instructions populate the folder `lib` from the sources files included in the folder `src`.
90
+ The file `package.json` contains the build instructions. These instructions populate the folder `lib` from the sources files included in the folder `src`.
92
91
 
93
- `gulpfile.js` implements two operations for the build:
94
- * the command `npm run build` creates the library at the execution,
92
+ `package.json` implements two operations for the build:
93
+ * the command `npm run build:dev` creates the library at the execution,
95
94
  * and the command `npm run watch` updates the library when one of the source files is modified.
96
95
 
97
96
 
@@ -100,23 +99,23 @@ The file `gulpfile.js` contains the build instructions. These instructions popul
100
99
  Your `package.json` file contains three scripts to test your UMD library:
101
100
 
102
101
  * `npm run test`,
103
- * `npm run check-coverage`,
104
- * `npm run display-coverage`.
102
+ * `npm run check:coverage`,
103
+ * `npm run display:coverage`.
105
104
 
106
105
  `npm run test` executes the tests and computes the test coverage.
107
106
 
108
- `npm run check-coverage` checks if the test coverage matches the requirements. Here 100%.
107
+ `npm run check:coverage` checks if the test coverage matches the requirements. Here 100%.
109
108
 
110
- `npm run display-coverage` opens your browser and reports the test coverage.
109
+ `npm run display:coverage` opens your browser and reports the test coverage.
111
110
 
112
111
 
113
112
  ## How to create a distribution version
114
113
 
115
114
  Your `package.json` file contains a script to build a distribution library:
116
115
 
117
- * `npm run makedist`
116
+ * `npm run build:prod`
118
117
 
119
- The script `makedist` adds a license header to the library and creates a minified version.
118
+ The script `build:prod` adds a license header to the library and creates a minified version.
120
119
 
121
120
 
122
121
  ## How to use it
@@ -1,5 +1,5 @@
1
1
  /*! ****************************************************************************
2
- * ES6lib v1.0.14
2
+ * ES6lib v1.0.15
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.0.14',
315
+ version: '1.0.15',
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.0.14';
322
+ ES6lib.VERSION = '1.0.15';
323
323
 
324
324
 
325
325
  // -- Private Static Methods -----------------------------------------------
@@ -1,5 +1,5 @@
1
1
  /*! ****************************************************************************
2
- * ES6lib v1.0.14
2
+ * ES6lib v1.0.15
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:"1.0.14"},t},e.NAME="ES6lib",e.VERSION="1.0.14",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,n){"use strict";if(typeof define==="function"&&define.amd){define([""],n)}else if(typeof exports==="object"){module.exports=n(t)}else{t.ES6lib=n(t)}})(this,(t=>{"use strict";let n,e;const r={Util:{Public:{}}};(function(){e=function(t,n){const e=Object.keys(n);for(let r=0;r<e.length;r++){t[e[r]]=n[e[r]]}}})();(function(){const t=r.Util.Public;function n(){return"I am a string!"}function i(){return[1,2,3]}e(t,{getString(){return n()},getArray(){return i()}})})();(function(){const e=r.Util.Public;const i=t.ES6lib;let o;n=function(){const t=Object.create(o);t._library={name:"ES6lib",version:"1.0.15"};return t};n.NAME="ES6lib";n.VERSION="1.0.15";n._setTestMode=function(){return[]};n.noConflict=function(){t.ES6lib=i;return this};o={whoami(){return this._library},getString(){return e.getString()},getArray(){return e.getArray()}}})();return n}));
@@ -1,5 +1,5 @@
1
1
  /*! ****************************************************************************
2
- * ES6lib v1.0.14
2
+ * ES6lib v1.0.15
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:"1.0.14"},t},e.NAME="ES6lib",e.VERSION="1.0.14",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,n){"use strict";if(typeof define==="function"&&define.amd){define([""],n)}else if(typeof exports==="object"){module.exports=n(t)}else{t.ES6lib=n(t)}})($__ES6GLOB,(t=>{"use strict";let n,e;const r={Util:{Public:{}}};(function(){e=function(t,n){const e=Object.keys(n);for(let r=0;r<e.length;r++){t[e[r]]=n[e[r]]}}})();(function(){const t=r.Util.Public;function n(){return"I am a string!"}function i(){return[1,2,3]}e(t,{getString(){return n()},getArray(){return i()}})})();(function(){const e=r.Util.Public;const i=t.ES6lib;let o;n=function(){const t=Object.create(o);t._library={name:"ES6lib",version:"1.0.15"};return t};n.NAME="ES6lib";n.VERSION="1.0.15";n._setTestMode=function(){return[]};n.noConflict=function(){t.ES6lib=i;return this};o={whoami(){return this._library},getString(){return e.getString()},getArray(){return e.getArray()}}})();return n}));export default $__ES6GLOB.ES6lib;
@@ -1,5 +1,5 @@
1
1
  /*! ****************************************************************************
2
- * ES6lib v1.0.14
2
+ * ES6lib v1.0.15
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.0.14',
316
+ version: '1.0.15',
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.0.14';
323
+ ES6lib.VERSION = '1.0.15';
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', 'gulpfile.js'];
272
+ const dupFiles = ['.eslintrc', '.travis.yml'];
273
273
 
274
274
  for (let i = 0; i < dupFiles.length; i++) {
275
275
  process.stdout.write(` copied ${dupFiles[i]}\n`);
@@ -303,22 +303,23 @@ function _customize(source, dest, app, owner, boilerlib) {
303
303
  pack.unpkg = `_dist/lib/${app.toLowerCase()}.mjs`;
304
304
  pack.module = `_dist/lib/${app.toLowerCase()}.min.mjs`;
305
305
  pack.bin = {};
306
- pack.scripts = {
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
- };
306
+ // pack.scripts = {
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
+ // };
322
+ pack.scripts = obj.scripts;
322
323
  pack.repository = obj.repository;
323
324
  pack.repository.url = `https://github.com/${owner.acronym}/${app.toLowerCase()}.git`;
324
325
  pack.keywords = ['ES6'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobilabs/es6lib",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "A template for writing pure ES6 Javascript libraries",
5
5
  "main": "index.js",
6
6
  "minified": "_dist/lib/es6lib.min.js",
@@ -10,18 +10,42 @@
10
10
  "es6lib": "./bin/es6lib.js"
11
11
  },
12
12
  "scripts": {
13
- "build": "gulp build",
14
- "watch": "gulp watch",
15
- "dev": "gulp rundev",
13
+ "general": " --- GENERAL ---",
14
+
15
+ "build:js": " --- JAVASCRIPT --- ",
16
+ "build:js:dev": "node tasks/makejs.js",
17
+ "build:js:prod": "node tasks/makedist.js",
18
+
19
+ "build:css": " --- CSS --- ",
20
+
21
+ "build:generic": " --- BUILD (GENERIC) --- ",
22
+
23
+ "build:development": " --- BUILD (DEVELOPMENT) --- ",
24
+ "build:dev": "npm run build:js:dev",
25
+
26
+ "build:production": " --- BUILD (PRODUCTION) --- ",
27
+ "prebuild:prod": "npm run build:dev",
28
+ "build:prod": "npm run build:js:prod",
29
+
30
+ "testing": " --- TESTING --- ",
16
31
  "test": "cross-env NODE_ENV=test nyc --reporter=lcov mocha ./test/main.js",
17
- "display-coverage": "opener ./coverage/lcov-report/index.html",
18
- "check-coverage": "nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100",
19
- "report-coverage": "nyc report --reporter=text-lcov | coveralls",
32
+ "display:coverage": "open -a safari ./coverage/lcov-report/index.html",
33
+ "check:coverage": "nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100",
34
+ "report:coverage": "nyc report --reporter=text-lcov | coveralls",
20
35
  "report": "nyc report",
21
- "makedist": "gulp makedist",
22
- "app": "gulp runapp",
23
- "makeprivate": "gulp makeprivate && sh tasks/compress.sh ${npm_package_name} ${npm_package_version} @mobilabs",
24
- "makelib": "gulp build && gulp makedist && gulp makeprivate && sh tasks/compress.sh ${npm_package_name} ${npm_package_version}",
36
+
37
+ "serving": " --- SERVING --- ",
38
+ "server:dev": "http-server --port 8080",
39
+ "server:prod": "http-server --port 8090",
40
+
41
+ "watch:js:css": " --- WATCHING --- ",
42
+ "watch:js": "nodemon --watch './src/**/*.js' --exec npm run build:dev",
43
+ "watch": "npm run watch:js",
44
+
45
+ "deployment": " --- DEPLOYMENT --- ",
46
+ "dep:private": "npm run build:prod && node tasks/makeprivatepackage.js && sh tasks/compress.sh ${npm_package_name} ${npm_package_version} @mobilabs",
47
+
48
+ "others": " --- OTHERS ---",
25
49
  "prepare": "husky install",
26
50
  "doc": ""
27
51
  },
@@ -35,7 +59,6 @@
35
59
  "library",
36
60
  "template",
37
61
  "boilerplate",
38
- "gulp",
39
62
  "mocha",
40
63
  "istanbul"
41
64
  ],
@@ -57,21 +80,15 @@
57
80
  "chai": "^4.3.7",
58
81
  "coveralls": "^3.1.1",
59
82
  "cross-env": "^7.0.3",
60
- "del": "^6.1.1",
61
- "eslint": "^8.40.0",
83
+ "eslint": "^8.41.0",
62
84
  "eslint-config-airbnb-base": "^15.0.0",
63
85
  "eslint-plugin-import": "^2.27.5",
64
- "gulp": "^4.0.2",
65
- "gulp-concat": "^2.6.1",
66
- "gulp-connect": "^5.7.0",
67
- "gulp-header": "^2.0.9",
68
- "gulp-replace": "^1.1.4",
69
- "gulp-uglify-es": "^3.0.0",
86
+ "http-server": "^14.1.1",
70
87
  "husky": "^8.0.3",
71
88
  "mocha": "^10.2.0",
89
+ "nodemon": "^2.0.22",
72
90
  "nyc": "^15.1.0",
73
- "open": "^8.4.2",
74
- "opener": "^1.5.2"
91
+ "terser": "^5.17.4"
75
92
  },
76
93
  "publishConfig": {
77
94
  "access": "public"
package/tasks/compress.sh CHANGED
File without changes
package/tasks/config.js CHANGED
@@ -58,6 +58,12 @@ module.exports = {
58
58
  ],
59
59
  /* eslint-enable no-multi-spaces */
60
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
+
61
67
  get license() {
62
68
  return ['/*! ****************************************************************************',
63
69
  ` * ${libname} v${pack.version}`,
package/tasks/makedist.js CHANGED
@@ -4,12 +4,9 @@
4
4
  'use strict';
5
5
 
6
6
  // -- Vendor Modules
7
- const { src, dest, series, parallel } = require('gulp')
8
- , del = require('del')
9
- , concat = require('gulp-concat')
10
- , header = require('gulp-header')
11
- , replace = require('gulp-replace')
12
- , uglify = require('gulp-uglify-es').default
7
+ const fs = require('fs')
8
+ , path = require('path')
9
+ , { minify } = require('terser')
13
10
  ;
14
11
 
15
12
 
@@ -19,73 +16,139 @@ const config = require('./config')
19
16
 
20
17
 
21
18
  // -- Local Constants
22
- const { dist } = config
23
- , { libdir } = config
24
- , { name } = config
25
- , { license } = config
19
+ const { dist } = config
20
+ , { webfiles } = config
21
+ , { libdir } = config
22
+ , { name } = config
23
+ , { license } = config
26
24
  ;
27
25
 
28
26
 
29
27
  // -- Local Variables
30
28
 
31
29
 
32
- // -- Gulp Private Tasks
30
+ // -- Private Tasks
33
31
 
34
- // Removes the previous dist.
35
- function deldist(done) {
36
- del.sync(dist);
37
- done();
32
+ /**
33
+ * Removes the previous version.
34
+ */
35
+ function deldist() {
36
+ const d1 = new Date();
37
+ process.stdout.write('Starting \'\x1b[36mdeldist\x1b[89m\x1b[0m\'...\n');
38
+
39
+
40
+ fs.rmSync(dist, { force: true, recursive: true });
41
+ fs.mkdirSync(`${dist}/lib`, { recursive: true });
42
+
43
+ const d2 = new Date() - d1;
44
+ process.stdout.write(`Finished '\x1b[36mdeldist\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
38
45
  }
39
46
 
40
- // Copies README and LICENSE.
47
+
48
+ /**
49
+ * Copies README and LICENSE.
50
+ */
41
51
  function doskeleton() {
42
- return src(['README.md', 'LICENSE.md'])
43
- .pipe(dest(dist))
44
- ;
52
+ const d1 = new Date();
53
+ process.stdout.write('Starting \'\x1b[36mdoskeleton\x1b[89m\x1b[0m\'...\n');
54
+
55
+ let filename;
56
+ for (let i = 0; i < webfiles.length; i++) {
57
+ filename = path.basename(webfiles[i]);
58
+ fs.copyFileSync(webfiles[i], `${dist}/${filename}`);
59
+ }
60
+
61
+
62
+ const d2 = new Date() - d1;
63
+ process.stdout.write(`Finished '\x1b[36mdoskeleton\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
45
64
  }
46
65
 
47
- // Copies the development version.
66
+
67
+ /**
68
+ * Copies the development version.
69
+ */
48
70
  function copydev() {
49
- return src(`${libdir}/${name}.js`)
50
- .pipe(header(license))
51
- .pipe(dest(`${dist}/lib`))
52
- ;
71
+ const d1 = new Date();
72
+ process.stdout.write('Starting \'\x1b[36mcopydev\x1b[89m\x1b[0m\'...\n');
73
+
74
+ let f = license;
75
+ f += fs.readFileSync(`${libdir}/${name}.js`, 'utf-8');
76
+ fs.writeFileSync(`${dist}/lib/${name}.js`, f);
77
+
78
+ const d2 = new Date() - d1;
79
+ process.stdout.write(`Finished '\x1b[36mcopydev\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
53
80
  }
54
81
 
55
- // Copies the module development version.
82
+
83
+ /**
84
+ * Copies the module development version.
85
+ */
56
86
  function copydevm() {
57
- return src(`${libdir}/${name}.mjs`)
58
- .pipe(header(license))
59
- .pipe(dest(`${dist}/lib`))
60
- ;
87
+ const d1 = new Date();
88
+ process.stdout.write('Starting \'\x1b[36mcopydevm\x1b[89m\x1b[0m\'...\n');
89
+
90
+ let f = license;
91
+ f += fs.readFileSync(`${libdir}/${name}.mjs`, 'utf-8');
92
+ fs.writeFileSync(`${dist}/lib/${name}.mjs`, f);
93
+
94
+ const d2 = new Date() - d1;
95
+ process.stdout.write(`Finished '\x1b[36mcopydevm\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
61
96
  }
62
97
 
63
- // Creates the minified version.
98
+
99
+ /**
100
+ * Creates the minified version.
101
+ */
64
102
  function makeminified() {
65
- return src(`${libdir}/${name}.js`)
66
- .pipe(replace('/*! ***', '/** ***'))
67
- .pipe(uglify())
68
- .pipe(header(license))
69
- .pipe(concat(`${name}.min.js`))
70
- .pipe(dest(`${dist}/lib`))
71
- ;
103
+ const d1 = new Date();
104
+ process.stdout.write('Starting \'\x1b[36mmakeminified\x1b[89m\x1b[0m\'...\n');
105
+
106
+ let f;
107
+ f = fs.readFileSync(`${libdir}/${name}.js`, 'utf-8');
108
+ f = f.replace(/\/\*! \*\*\*/g, '/** ***');
109
+ minify(f, { compress: false, mangle: true })
110
+ .then((result) => {
111
+ fs.writeFileSync(`${dist}/lib/${name}.min.js`, `${license}!${result.code}`);
112
+
113
+ const d2 = new Date() - d1;
114
+ process.stdout.write(`Finished '\x1b[36mmakeminified\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
115
+ });
72
116
  }
73
117
 
74
- // Creates the module minified version.
118
+
119
+ /**
120
+ * Creates the module minified version.
121
+ */
75
122
  function makeminifiedm() {
76
- return src(`${libdir}/${name}.mjs`)
77
- .pipe(replace('/*! ***', '/** ***'))
78
- .pipe(uglify())
79
- .pipe(header(license))
80
- .pipe(concat(`${name}.min.mjs`))
81
- .pipe(dest(`${dist}/lib`))
82
- ;
123
+ const d1 = new Date();
124
+ process.stdout.write('Starting \'\x1b[36mmakeminifiedm\x1b[89m\x1b[0m\'...\n');
125
+
126
+ let f;
127
+ f = fs.readFileSync(`${libdir}/${name}.mjs`, 'utf-8');
128
+ f = f.replace(/\/\*! \*\*\*/g, '/** ***');
129
+ minify(f, { compress: false, mangle: true })
130
+ .then((result) => {
131
+ fs.writeFileSync(`${dist}/lib/${name}.min.mjs`, `${license}!${result.code}`);
132
+
133
+ const d2 = new Date() - d1;
134
+ process.stdout.write(`Finished '\x1b[36mmakeminifiedm\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
135
+ });
83
136
  }
84
137
 
85
138
 
86
- // -- Gulp Public Task(s):
139
+ // -- Public Task(s):
140
+
141
+ const d1 = new Date();
142
+ process.stdout.write('Starting \'\x1b[36mbuild:js:prod\x1b[89m\x1b[0m\'...\n');
143
+ deldist();
144
+ doskeleton();
145
+ copydev();
146
+ copydevm();
147
+ makeminified();
148
+ makeminifiedm();
149
+
150
+ const d2 = new Date() - d1;
151
+ process.stdout.write(`Finished '\x1b[36mbuild:js:prod\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
152
+
87
153
 
88
- module.exports = series(
89
- deldist,
90
- parallel(doskeleton, copydev, copydevm, makeminified, makeminifiedm),
91
- );
154
+ // -- oOo --
package/tasks/makejs.js CHANGED
@@ -4,10 +4,7 @@
4
4
  'use strict';
5
5
 
6
6
  // -- Vendor Modules
7
- const { src, dest, series, parallel } = require('gulp')
8
- , del = require('del')
9
- , concat = require('gulp-concat')
10
- , replace = require('gulp-replace')
7
+ const fs = require('fs')
11
8
  ;
12
9
 
13
10
 
@@ -33,71 +30,140 @@ const destination = config.libdir
33
30
  // -- Local Variables
34
31
 
35
32
 
36
- // -- Gulp Private Tasks
33
+ // -- Private Tasks
37
34
 
38
- // Removes the previous version.
39
- function clean(done) {
40
- del.sync(destination);
41
- done();
35
+ /**
36
+ * Removes the previous version.
37
+ */
38
+ function clean() {
39
+ const d1 = new Date();
40
+ process.stdout.write('Starting \'\x1b[36mclean\x1b[89m\x1b[0m\'...\n');
41
+
42
+
43
+ fs.rmSync(destination, { force: true, recursive: true });
44
+ fs.mkdirSync(destination, { recursive: true });
45
+
46
+ const d2 = new Date() - d1;
47
+ process.stdout.write(`Finished '\x1b[36mclean\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
42
48
  }
43
49
 
44
- // Creates the content.
50
+
51
+ /**
52
+ * Creates the content.
53
+ */
45
54
  function docore() {
46
- return src(core)
47
- .pipe(replace('{{lib:name}}', libname))
48
- .pipe(replace('{{lib:version}}', version))
55
+ const d1 = new Date();
56
+ process.stdout.write('Starting \'\x1b[36mdocore\x1b[89m\x1b[0m\'...\n');
57
+
58
+ let src = '';
59
+ for (let i = 0; i < core.length; i++) {
60
+ src += fs.readFileSync(core[i]);
61
+ if (i < core.length - 1) {
62
+ src += '\n';
63
+ }
64
+ }
65
+
66
+ src = src
67
+ .replace(/{{lib:name}}/g, libname)
68
+ .replace(/{{lib:version}}/g, version)
49
69
  // remove the extra global and 'use strict':
50
- .pipe(replace(/\/\* global[\w$_\s,]+\*\//g, '/* - */'))
51
- .pipe(replace(/\n'use strict';\n/, ''))
70
+ .replace(/\/\* global[\w$_\s,]+\*\//g, '/* - */')
71
+ .replace(/\n'use strict';\n/g, '')
52
72
  // indent the first line with 2 spaces:
53
- .pipe(replace(/^/g, ' '))
73
+ .replace(/^/g, ' ')
54
74
  // indent each other lines with 2 spaces:
55
- .pipe(replace(/\n/g, '\n '))
56
- .pipe(concat('core.js'))
57
- .pipe(dest(destination))
75
+ .replace(/\n/g, '\n ')
58
76
  ;
77
+
78
+ fs.writeFileSync(`${destination}/core.js`, src);
79
+ const d2 = new Date() - d1;
80
+ process.stdout.write(`Finished '\x1b[36mdocore\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
59
81
  }
60
82
 
61
- // Create the UMD Module.
83
+
84
+ /**
85
+ * Create the UMD Module.
86
+ */
62
87
  function doumdlib() {
63
- return src([head, `${destination}/core.js`, foot])
64
- .pipe(replace('{{lib:es6:define}}\n', ''))
65
- .pipe(replace('{{lib:es6:link}}', 'this'))
66
- .pipe(replace('{{lib:es6:export}}\n', ''))
67
- .pipe(concat(`${name}.js`))
88
+ const d1 = new Date();
89
+ process.stdout.write('Starting \'\x1b[36mdoumdlib\x1b[89m\x1b[0m\'...\n');
90
+
91
+ let src = '';
92
+ src = fs.readFileSync(head);
93
+ src += '\n';
94
+ src += fs.readFileSync(`${destination}/core.js`);
95
+ src += '\n';
96
+ src += fs.readFileSync(foot);
97
+
98
+ src = src
99
+ .replace('{{lib:es6:define}}\n', '')
100
+ .replace('{{lib:es6:link}}', 'this')
101
+ .replace('{{lib:es6:export}}\n', '')
68
102
  // fix the blanck lines we indented too:
69
- .pipe(replace(/\s{2}\n/g, '\n'))
70
- .pipe(dest(destination))
103
+ .replace(/\s{2}\n/g, '\n')
71
104
  ;
105
+
106
+ fs.writeFileSync(`${destination}/${name}.js`, src);
107
+ const d2 = new Date() - d1;
108
+ process.stdout.write(`Finished '\x1b[36mdoumdlib\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
72
109
  }
73
110
 
74
- // Creates the ES6 module.
111
+
112
+ /**
113
+ * Creates the ES6 module.
114
+ */
75
115
  function domodule() {
116
+ const d1 = new Date();
117
+ process.stdout.write('Starting \'\x1b[36mdomodule\x1b[89m\x1b[0m\'...\n');
118
+
76
119
  let exportM = '\n// -- Export\n';
77
120
  exportM += `export default ${ES6GLOB}.${libname};`;
78
121
 
79
- return src([head, `${destination}/core.js`, foot])
80
- .pipe(replace('{{lib:es6:define}}', `const ${ES6GLOB} = {};`))
81
- .pipe(replace('{{lib:es6:link}}', ES6GLOB))
82
- .pipe(replace('{{lib:es6:export}}', exportM))
83
- .pipe(concat(`${name}.mjs`))
122
+ let src = '';
123
+ src = fs.readFileSync(head);
124
+ src += '\n';
125
+ src += fs.readFileSync(`${destination}/core.js`);
126
+ src += '\n';
127
+ src += fs.readFileSync(foot);
128
+
129
+ src = src
130
+ .replace('{{lib:es6:define}}', `const ${ES6GLOB} = {};`)
131
+ .replace('{{lib:es6:link}}', ES6GLOB)
132
+ .replace('{{lib:es6:export}}', exportM)
84
133
  // fix the blanck lines we indented too:
85
- .pipe(replace(/\s{2}\n/g, '\n'))
86
- .pipe(dest(destination))
134
+ .replace(/\s{2}\n/g, '\n')
87
135
  ;
136
+
137
+ fs.writeFileSync(`${destination}/${name}.mjs`, src);
138
+ const d2 = new Date() - d1;
139
+ process.stdout.write(`Finished '\x1b[36mdomodule\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
88
140
  }
89
141
 
90
- // Removes the temp file(s).
91
- function delcore(done) {
92
- del.sync(`${destination}/core.js`);
93
- done();
142
+
143
+ /**
144
+ * Removes the temp file(s).
145
+ */
146
+ function delcore() {
147
+ const d1 = new Date();
148
+ process.stdout.write('Starting \'\x1b[36mdelcore\x1b[89m\x1b[0m\'...\n');
149
+ fs.unlinkSync(`${destination}/core.js`);
150
+
151
+ const d2 = new Date() - d1;
152
+ process.stdout.write(`Finished '\x1b[36mdelcore\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
94
153
  }
95
154
 
96
155
 
97
- // -- Gulp Public Task(s)
98
- module.exports = series(
99
- clean,
100
- docore,
101
- parallel(doumdlib, domodule),
102
- delcore,
103
- );
156
+ // -- Public Task(s)
157
+ const d1 = new Date();
158
+ process.stdout.write('Starting \'\x1b[36mbuild:js:dev\x1b[89m\x1b[0m\'...\n');
159
+ clean();
160
+ docore();
161
+ doumdlib();
162
+ domodule();
163
+ delcore();
164
+
165
+ const d2 = new Date() - d1;
166
+ process.stdout.write(`Finished '\x1b[36mbuild:js:dev\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
167
+
168
+
169
+ // -- oOo --
@@ -3,10 +3,8 @@
3
3
  'use strict';
4
4
 
5
5
  // -- Vendor Modules
6
- const { src, dest, series } = require('gulp')
7
- , fs = require('fs')
8
- , del = require('del')
9
- , replace = require('gulp-replace')
6
+ const fs = require('fs')
7
+ , path = require('path')
10
8
  ;
11
9
 
12
10
 
@@ -26,46 +24,76 @@ const tmppriv = './private_repo/tmp'
26
24
  // -- Local Variables
27
25
 
28
26
 
29
- // -- Gulp Private Tasks
27
+ // -- Private Tasks
30
28
 
31
- // Removes the previous version.
32
- function clear(done) {
33
- del.sync(tmppriv);
34
- done();
29
+ /**
30
+ * Removes the previous version.
31
+ */
32
+ function clear() {
33
+ const d1 = new Date();
34
+ process.stdout.write('Starting \'\x1b[36mclear\x1b[89m\x1b[0m\'...\n');
35
+
36
+
37
+ fs.rmSync(tmppriv, { force: true, recursive: true });
38
+ fs.mkdirSync(tmppriv, { recursive: true });
39
+
40
+ const d2 = new Date() - d1;
41
+ process.stdout.write(`Finished '\x1b[36mclear\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
35
42
  }
36
43
 
37
- // Copies the modified index.
44
+
45
+ /**
46
+ * Copies the modified index.
47
+ */
38
48
  function copyindex() {
39
- return src(index)
40
- .pipe(replace(`./lib/${name}`, distlink))
41
- .pipe(dest(tmppriv))
42
- ;
49
+ const d1 = new Date();
50
+ process.stdout.write('Starting \'\x1b[36mcopyindex\x1b[89m\x1b[0m\'...\n');
51
+
52
+ let f = fs.readFileSync(index, 'utf-8');
53
+ f = f.replace(`./lib/${name}`, distlink);
54
+
55
+ const filename = path.basename(index);
56
+ fs.writeFileSync(`${tmppriv}/${filename}`, f);
57
+ const d2 = new Date() - d1;
58
+ process.stdout.write(`Finished '\x1b[36mcopyindex\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
43
59
  }
44
60
 
45
- // Copies the modified package.json
46
- function copypackagejson(done) {
47
- fs.readFile('./package.json', 'utf8', (error, data) => {
48
- if (error) { throw error; }
49
- const obj = JSON.parse(data);
50
- obj.main = distlink;
51
- obj.bin = {};
52
- obj.scripts = {};
53
- obj.dependencies = {};
54
- obj.devDependencies = {};
55
- obj.private = true;
56
- obj.husky = {};
57
-
58
- // Write the updated package.json:
59
- fs.writeFile(`${tmppriv}/package.json`, JSON.stringify(obj, null, 2), 'utf8', (err) => {
60
- if (err) {
61
- throw err;
62
- }
63
- done();
64
- });
65
- });
61
+
62
+ /**
63
+ * Copies the modified package.json
64
+ */
65
+ function copypackagejson() {
66
+ const d1 = new Date();
67
+ process.stdout.write('Starting \'\x1b[36mcopypackagejson\x1b[89m\x1b[0m\'...\n');
68
+
69
+ const json = fs.readFileSync('./package.json', 'utf8');
70
+ const obj = JSON.parse(json);
71
+
72
+ obj.main = distlink;
73
+ obj.bin = {};
74
+ obj.scripts = {};
75
+ obj.dependencies = {};
76
+ obj.devDependencies = {};
77
+ obj.private = true;
78
+ obj.husky = {};
79
+
80
+ fs.writeFileSync(`${tmppriv}/package.json`, JSON.stringify(obj, null, 2), 'utf8');
81
+
82
+ const d2 = new Date() - d1;
83
+ process.stdout.write(`Finished '\x1b[36mcopypackagejson\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
66
84
  }
67
85
 
68
86
 
69
- // -- Gulp Public Task(s)
87
+ // -- Public Task(s)
88
+ const d1 = new Date();
89
+ process.stdout.write('Starting \'\x1b[36mdep:private\x1b[89m\x1b[0m\'...\n');
90
+
91
+ clear();
92
+ copyindex();
93
+ copypackagejson();
94
+
95
+ const d2 = new Date() - d1;
96
+ process.stdout.write(`Finished '\x1b[36mdep:private\x1b[89m\x1b[0m' after \x1b[35m${d2} ms\x1b[89m\x1b[0m\n`);
97
+
70
98
 
71
- module.exports = series(clear, copyindex, copypackagejson);
99
+ // -- oOo --
@@ -0,0 +1,59 @@
1
+ <!-- x -->
2
+ <!doctype html>
3
+ <html class="no-js" lang="">
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <title>View ES6lib</title>
7
+ <meta name="description" content="{{app:description}}">
8
+ <meta name="viewport" content="width=device-width, initial-scale=1">
9
+
10
+ <link rel="stylesheet" href="">
11
+ <meta name="theme-color" content="#2196f3">
12
+ <style>
13
+ /* - */
14
+ </style>
15
+
16
+ <!-- <script src='./lib/view.js'></script> -->
17
+ <script>
18
+ document.addEventListener('DOMContentLoaded', () => {
19
+ /* global Pixi */
20
+ 'use strict';
21
+ //
22
+ });
23
+ </script>
24
+ </head>
25
+
26
+ <body>
27
+ <!--[if IE]>
28
+ <p class="browserupgrade">You are using an <strong>outdated and unsupported</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to benefit of all the features of this web App.</p>
29
+ <![endif]-->
30
+
31
+ <!-- Warning message if Javascript isn't enabled -->
32
+ <noscript>
33
+ <p style="text-align:center;padding-top:3em;">
34
+ We are sorry, but this website doesn't work properly without JavaScript enabled!
35
+ </p>
36
+ </noscript>
37
+
38
+ <!-- Add your site or application content here -->
39
+ <div id="app"></div>
40
+
41
+ <!-- Add your scripts here -->
42
+ <script type="module">
43
+ import ES6lib from '../lib/es6lib.mjs';
44
+
45
+ console.log(ES6lib.VERSION);
46
+ console.log(Object.keys(ES6lib));
47
+
48
+ const lib = ES6lib();
49
+ console.log(lib.getString());
50
+ console.log(lib.getArray());
51
+
52
+ const el = document.getElementById('app');
53
+ el.append(`Es6lib $v${ES6lib.VERSION}`);
54
+ el.append(` ... ${lib.getString()}`);
55
+ el.append(` ... ${lib.getArray()}`);
56
+
57
+ </script>
58
+ </body>
59
+ </html>
package/gulpfile.js DELETED
@@ -1,67 +0,0 @@
1
- /* eslint one-var: 0, semi-style: 0 */
2
-
3
- 'use strict';
4
-
5
- // -- Vendor Modules
6
- const { watch, series } = require('gulp')
7
- , connect = require('gulp-connect')
8
- , open = require('open')
9
- ;
10
-
11
-
12
- // -- Local Modules
13
-
14
-
15
- // -- Local Constants
16
- const filesToWatch = ['src/**/*.js', 'src/_header', 'src/_footer']
17
- ;
18
-
19
-
20
- // -- Local Variables
21
-
22
-
23
- // -- Gulp Private Tasks
24
- const build = require('./tasks/makejs')
25
- , makedist = require('./tasks/makedist')
26
- , makeprivate = require('./tasks/makeprivatepackage')
27
- ;
28
-
29
-
30
- // -- Gulp watch
31
- function fwatch() {
32
- watch(filesToWatch, series(build));
33
- }
34
-
35
- // -- Gulp connect dev
36
- function devserver(done) {
37
- connect.server({
38
- host: '0.0.0.0', // (allows remote access)
39
- root: './',
40
- port: 8888,
41
- livereload: true,
42
- });
43
- open('http://localhost:8888/');
44
- done();
45
- }
46
-
47
- // -- Gulp connect prod
48
- function appserver(done) {
49
- connect.server({
50
- host: '0.0.0.0', // (allows remote access)
51
- root: './_dist',
52
- port: 8889,
53
- livereload: true,
54
- });
55
- open('http://localhost:8889/');
56
- done();
57
- }
58
-
59
-
60
- // Gulp Public Tasks:
61
- exports.build = build;
62
- exports.watch = fwatch;
63
- exports.rundev = devserver;
64
- exports.makedist = makedist;
65
- exports.runapp = appserver;
66
- exports.makeprivate = makeprivate;
67
- exports.default = series(build, makedist, makeprivate);