@tmbr/bundler 1.10.1 → 1.11.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.
Files changed (2) hide show
  1. package/cli.js +20 -16
  2. package/package.json +5 -5
package/cli.js CHANGED
@@ -9,10 +9,9 @@ import { execSync as exec } from 'child_process';
9
9
  import { sassPlugin as styles } from 'esbuild-sass-plugin';
10
10
  import * as sass from 'sass';
11
11
 
12
- const server = create();
13
-
14
12
  const cwd = process.cwd();
15
13
  const src = path.resolve(cwd, 'src');
14
+ const server = create();
16
15
  const command = process.argv[2];
17
16
 
18
17
  if (!['build', 'watch'].includes(command)) {
@@ -32,14 +31,18 @@ const logger = (options = {}) => ({
32
31
  });
33
32
 
34
33
  context.onEnd(result => {
35
- if (result.warnings.length || result.errors.length) return console.log('\\007');
34
+
35
+ if (result.warnings.length || result.errors.length) {
36
+ console.log('\x07');
37
+ return
38
+ }
36
39
 
37
40
  const css = `${path}/${slug}.css`;
38
41
  const js = `${path}/${slug}.js`;
39
42
 
40
43
  console.log(` ${chalk.green('✓')} ${css} ${Math.round(fs.statSync(css).size / 1000)} KB`);
41
44
  console.log(` ${chalk.green('✓')} ${js} ${Math.round(fs.statSync(js).size / 1000)} KB`);
42
- console.log()
45
+ console.log();
43
46
  });
44
47
  }
45
48
  });
@@ -137,17 +140,18 @@ async function main() {
137
140
  });
138
141
  }
139
142
 
140
- function extend(options, config) {
141
- if (!config) return options;
142
- return typeof config === 'function' ? config(options) : Object.assign(options, config);
143
- }
144
-
145
143
  if (fs.existsSync(process.argv[3])) {
146
- // const test = require(`${cwd}/${process.argv[3]}`);
147
- // console.log(extend(watchOptions, test.watch));
148
- // console.log(extend(buildOptions, test.build));
149
- // console.log(extend(serveOptions, test.serve));
150
- // process.exit();
151
- }
152
144
 
153
- main();
145
+ function extend(options, config) {
146
+ if (typeof config === 'undefined') return;
147
+ Object.assign(options, typeof config === 'function' ? config(options) : config);
148
+ }
149
+
150
+ import(`${cwd}/${process.argv[3]}`).then(settings => {
151
+ extend(watchOptions, settings.watch);
152
+ extend(buildOptions, settings.build);
153
+ extend(serveOptions, settings.serve);
154
+ main();
155
+ });
156
+
157
+ } else { main(); }
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@tmbr/bundler",
3
3
  "type": "module",
4
- "version": "1.10.1",
4
+ "version": "1.11.0",
5
5
  "repository": "github:TMBR/tmbr-bundler",
6
6
  "bin": {
7
7
  "bundler": "cli.js",
8
8
  "tmbr-bundler": "cli.js"
9
9
  },
10
10
  "dependencies": {
11
- "browser-sync": "^2.29.3",
12
- "chalk": "^4.1.2",
13
- "esbuild": "^0.19.3",
14
- "esbuild-sass-plugin": "^2.15.0"
11
+ "browser-sync": "^3.0.2",
12
+ "chalk": "^5.3.0",
13
+ "esbuild": "^0.19.11",
14
+ "esbuild-sass-plugin": "^2.16.1"
15
15
  }
16
16
  }