prebundle 1.4.2 → 1.6.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/bin.js CHANGED
@@ -1,4 +1,28 @@
1
1
  #!/usr/bin/env node
2
+ import cac from 'cac';
3
+ import { createRequire } from 'node:module';
2
4
  import { run } from './dist/index.js';
3
5
 
4
- run();
6
+ const require = createRequire(import.meta.url);
7
+ const pkg = require('./package.json');
8
+
9
+ const cli = cac('prebundle');
10
+
11
+ cli
12
+ .command('[...packages]', 'Prebundle configured dependencies')
13
+ .option('--config <path>', 'Path to a custom config file')
14
+ .action(async (packages = [], options) => {
15
+ try {
16
+ await run({
17
+ config: options.config,
18
+ packages,
19
+ });
20
+ } catch (error) {
21
+ console.error(error);
22
+ process.exitCode = 1;
23
+ }
24
+ });
25
+
26
+ cli.help();
27
+ cli.version(pkg.version);
28
+ cli.parse();