@voltkit/create-volt 0.1.3 → 0.1.5

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/dist/index.js +16 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5,8 +5,21 @@ import { fileURLToPath } from 'node:url';
5
5
  import { updateVoltConfigContent } from './config-updater.js';
6
6
  import { createProject } from './create-project.js';
7
7
  import { escapeHtml, normalizeProjectName, toDisplayName } from './options.js';
8
+ const VALID_FRAMEWORKS = ['vanilla', 'react', 'svelte', 'vue', 'enterprise'];
9
+ function parseFrameworkArg(args) {
10
+ const idx = args.indexOf('--framework');
11
+ if (idx === -1 || idx + 1 >= args.length)
12
+ return undefined;
13
+ const value = args[idx + 1];
14
+ if (VALID_FRAMEWORKS.includes(value)) {
15
+ return value;
16
+ }
17
+ console.error(` Error: Invalid framework "${value}". Valid options: ${VALID_FRAMEWORKS.join(', ')}`);
18
+ process.exit(1);
19
+ }
8
20
  async function main() {
9
- const argName = process.argv[2];
21
+ const argName = process.argv[2]?.startsWith('--') ? undefined : process.argv[2];
22
+ const frameworkArg = parseFrameworkArg(process.argv);
10
23
  console.log();
11
24
  console.log(' Volt - Lightweight Desktop App Framework');
12
25
  console.log();
@@ -18,7 +31,7 @@ async function main() {
18
31
  initial: 'my-volt-app',
19
32
  },
20
33
  {
21
- type: 'select',
34
+ type: frameworkArg ? null : 'select',
22
35
  name: 'framework',
23
36
  message: 'Select a framework:',
24
37
  choices: [
@@ -39,7 +52,7 @@ async function main() {
39
52
  const options = {
40
53
  name: projectName,
41
54
  displayName: toDisplayName(projectName),
42
- framework: response.framework ?? 'vanilla',
55
+ framework: frameworkArg ?? response.framework ?? 'vanilla',
43
56
  };
44
57
  await createProject(options);
45
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltkit/create-volt",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "license": "BSL-1.1",
5
5
  "repository": {
6
6
  "type": "git",