@tmbr/bundler 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +35 -51
- package/package.json +5 -4
package/cli.js
CHANGED
|
@@ -3,10 +3,11 @@ const esbuild = require('esbuild');
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const exec = require('child_process').execSync;
|
|
5
5
|
const styles = require('esbuild-sass-plugin').sassPlugin;
|
|
6
|
+
const qrcode = require('qrcode-terminal');
|
|
6
7
|
const chalk = require('chalk');
|
|
7
|
-
const qr = require('qrcode-terminal');
|
|
8
8
|
const bs = require('browser-sync').create();
|
|
9
9
|
const renderError = require('./error');
|
|
10
|
+
// const webfontsGenerator = require('webfonts-generator'); // OPTIONAL ICON FONT BUILDER UNCOMMENT TO USE
|
|
10
11
|
|
|
11
12
|
const cwd = process.cwd();
|
|
12
13
|
const package = require(`${cwd}/package.json`);
|
|
@@ -20,50 +21,6 @@ if (!['build', 'watch'].includes(command)) {
|
|
|
20
21
|
|
|
21
22
|
exec(`rm -rf ${cwd}/build/*`);
|
|
22
23
|
|
|
23
|
-
/* const logger = (options = {}) => ({
|
|
24
|
-
name: 'logger',
|
|
25
|
-
setup(build) {
|
|
26
|
-
|
|
27
|
-
let info;
|
|
28
|
-
// const cache = new Map;
|
|
29
|
-
|
|
30
|
-
function reset() {
|
|
31
|
-
console.clear();
|
|
32
|
-
info.external && console.log(info.qrcode);
|
|
33
|
-
console.log(`Proxying: ${chalk.green(info.proxying)}`);
|
|
34
|
-
console.log(`External: ${chalk.cyan(info.external || 'offline')}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
build.onEnd(() => {
|
|
38
|
-
|
|
39
|
-
if (typeof info === 'undefined') {
|
|
40
|
-
|
|
41
|
-
const host = bs.getOption('proxy').get('target');
|
|
42
|
-
const port = bs.getOption('port');
|
|
43
|
-
|
|
44
|
-
info = {};
|
|
45
|
-
info.proxying = `${host}:${port}`;
|
|
46
|
-
info.external = bs.getOption('urls').get('external');
|
|
47
|
-
|
|
48
|
-
info.external && qr.generate(info.external, {small: true}, qrcode => {
|
|
49
|
-
info.qrcode = qrcode;
|
|
50
|
-
reset();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
error = result.errors[0];
|
|
57
|
-
|
|
58
|
-
if (error) {
|
|
59
|
-
bs.reload();
|
|
60
|
-
} else {
|
|
61
|
-
reset();
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}); */
|
|
66
|
-
|
|
67
24
|
const assets = (options = {}) => ({
|
|
68
25
|
name: 'assets',
|
|
69
26
|
setup(build) {
|
|
@@ -74,10 +31,41 @@ const assets = (options = {}) => ({
|
|
|
74
31
|
},
|
|
75
32
|
});
|
|
76
33
|
|
|
34
|
+
// OPTIONAL ICON FONT BUILDER. CREATE /ICONS FOLDER AND UNCOMMENT TO USE
|
|
35
|
+
// ADD SVG FILES INTO FOLDER AND ADD TO FILES LIST BELOW
|
|
36
|
+
// ADD TO INDEX.SCSS: @import "../fonts/tmbr-icons.css";
|
|
37
|
+
// webfontsGenerator({
|
|
38
|
+
// files: [
|
|
39
|
+
// './icons/angle-left.svg',
|
|
40
|
+
// ],
|
|
41
|
+
// dest: './fonts/',
|
|
42
|
+
// fontName: 'tmbr-icons',
|
|
43
|
+
// templateOptions: {
|
|
44
|
+
// baseClass: 'icon',
|
|
45
|
+
// classPrefix: 'icon-'
|
|
46
|
+
// },
|
|
47
|
+
// types: ['woff2', 'woff', 'svg']
|
|
48
|
+
// }, function(error) {
|
|
49
|
+
// if (error) {
|
|
50
|
+
// console.log('Fail!', error);
|
|
51
|
+
// } else {
|
|
52
|
+
// console.log('Icon Font Built');
|
|
53
|
+
// }
|
|
54
|
+
// });
|
|
55
|
+
|
|
77
56
|
const errors = (options = {}) => ({
|
|
78
57
|
name: 'errors',
|
|
79
58
|
setup(build) {
|
|
59
|
+
build.onEnd(result => {
|
|
60
|
+
error = result.errors[0];
|
|
61
|
+
error && bs.reload();
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
});
|
|
80
65
|
|
|
66
|
+
const errors = (options = {}) => ({
|
|
67
|
+
name: 'errors',
|
|
68
|
+
setup(build) {
|
|
81
69
|
build.onEnd(result => {
|
|
82
70
|
error = result.errors[0];
|
|
83
71
|
error && bs.reload();
|
|
@@ -87,7 +75,7 @@ const errors = (options = {}) => ({
|
|
|
87
75
|
|
|
88
76
|
function entryPoints(suffix = '') {
|
|
89
77
|
|
|
90
|
-
if (
|
|
78
|
+
if (!suffix.startsWith('.')) {
|
|
91
79
|
suffix = `.${suffix}`;
|
|
92
80
|
}
|
|
93
81
|
|
|
@@ -171,13 +159,9 @@ if (command === 'watch') {
|
|
|
171
159
|
const port = bs.getOption('port');
|
|
172
160
|
const proxying = `${host}:${port}`;
|
|
173
161
|
const external = bs.getOption('urls').get('external');
|
|
174
|
-
external && qr.generate(external, {small: true}, console.log);
|
|
175
162
|
|
|
163
|
+
external && qrcode.generate(external, {small: true}, console.log);
|
|
176
164
|
console.log(`Proxying: ${chalk.green(proxying)}`);
|
|
177
165
|
console.log(`External: ${chalk.cyan(external || 'offline')}`);
|
|
178
166
|
});
|
|
179
167
|
}
|
|
180
|
-
|
|
181
|
-
process.on('SIGINT', () => {
|
|
182
|
-
process.exit();
|
|
183
|
-
})
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmbr/bundler",
|
|
3
3
|
"author": "TMBR (https://wearetmbr.com/)",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/TMBR/tmbr-bundler",
|
|
7
7
|
"description": "WordPress development toolkit built on esbuild and browser-sync",
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"browser-sync": "^2.27.5",
|
|
13
13
|
"chalk": "^4.1.2",
|
|
14
|
-
"esbuild": "^0.14.
|
|
15
|
-
"esbuild-sass-plugin": "^2.2.
|
|
14
|
+
"esbuild": "^0.14.47",
|
|
15
|
+
"esbuild-sass-plugin": "^2.2.6",
|
|
16
16
|
"html-entities": "^2.3.2",
|
|
17
|
-
"qrcode-terminal": "^0.12.0"
|
|
17
|
+
"qrcode-terminal": "^0.12.0",
|
|
18
|
+
"webfonts-generator": "^0.4.0"
|
|
18
19
|
}
|
|
19
20
|
}
|