create-oc 1.1.7 → 1.1.9

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/index.js CHANGED
@@ -4,29 +4,70 @@ import prompts from 'prompts';
4
4
  import path from 'node:path';
5
5
  import fs from 'node:fs';
6
6
  import { fileURLToPath } from 'node:url';
7
+ import { parseArgs } from 'node:util';
7
8
 
8
- const { componentName, template } = await prompts([
9
+ const MIN_NODE_VERSION = 20;
10
+ function checkNodeVersion() {
11
+ const nodeVersion = process.version;
12
+ const major = parseInt(nodeVersion.split('.')[0].slice(1));
13
+ if (major < MIN_NODE_VERSION) {
14
+ console.error(`Node.js version ${MIN_NODE_VERSION} or higher is required`);
15
+ process.exit(1);
16
+ }
17
+ }
18
+
19
+ checkNodeVersion();
20
+
21
+ const templateChoices = [
22
+ { title: 'Vanilla', value: 'es6' },
23
+ { title: 'React', value: 'react' },
24
+ { title: 'Solid', value: 'solid' },
25
+ { title: 'Preact', value: 'preact' },
26
+ { title: 'Vue', value: 'vue' },
27
+ { title: 'Svelte', value: 'svelte' },
28
+ { title: 'Elm', value: 'elm' },
29
+ ];
30
+ const templates = templateChoices.map((t) => t.value);
31
+
32
+ let {
33
+ values: { name: componentName, template },
34
+ } = parseArgs({
35
+ args: process.argv.slice(2),
36
+ options: {
37
+ name: {
38
+ type: 'string',
39
+ },
40
+ template: {
41
+ type: 'string',
42
+ },
43
+ },
44
+ });
45
+ if (template && !templates.includes(template)) {
46
+ template = null;
47
+ }
48
+
49
+ let answers = await prompts([
9
50
  {
10
- type: 'text',
51
+ type: componentName ? null : 'text',
11
52
  name: 'componentName',
12
53
  message: 'Component name',
13
54
  initial: 'oc-component',
14
55
  },
15
56
  {
16
- type: 'select',
57
+ type: template ? null : 'select',
17
58
  name: 'template',
18
59
  message: 'Select a template',
19
- choices: [
20
- { title: 'Vanilla', value: 'es6' },
21
- { title: 'React', value: 'react' },
22
- { title: 'Solid', value: 'solid' },
23
- { title: 'Preact', value: 'preact' },
24
- { title: 'Vue', value: 'vue' },
25
- { title: 'Svelte', value: 'svelte' },
26
- { title: 'Elm', value: 'elm' },
27
- ],
60
+ choices: templateChoices,
28
61
  },
29
62
  ]);
63
+
64
+ if (!componentName) {
65
+ componentName = answers.componentName;
66
+ }
67
+ if (!template) {
68
+ template = answers.template;
69
+ }
70
+
30
71
  if (!componentName || !template) {
31
72
  process.exit(1);
32
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-oc",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "index.js",
@@ -17,8 +17,8 @@
17
17
  },
18
18
  "dependencies": {},
19
19
  "devDependencies": {
20
- "oc-server": "^2.0.5",
21
- "oc-template-elm-compiler": "^1.1.3",
20
+ "oc-server": "^2.0.6",
21
+ "oc-template-elm-compiler": "^1.1.5",
22
22
  "elm": "^0.19.1-6",
23
23
  "typescript": "^5.3.3"
24
24
  }
@@ -18,7 +18,7 @@
18
18
  }
19
19
  },
20
20
  "devDependencies": {
21
- "oc-server": "^2.0.5",
22
- "oc-template-es6-compiler": "^5.1.3"
21
+ "oc-server": "^2.0.6",
22
+ "oc-template-es6-compiler": "^5.1.5"
23
23
  }
24
24
  }
@@ -26,8 +26,8 @@
26
26
  "@testing-library/react": "^14.0.0",
27
27
  "@testing-library/user-event": "^14.4.3",
28
28
  "jsdom": "^21.1.1",
29
- "oc-server": "^2.0.5",
30
- "oc-template-preact-compiler": "^1.1.3",
29
+ "oc-server": "^2.0.6",
30
+ "oc-template-preact-compiler": "^1.1.5",
31
31
  "preact": "^10.13.2",
32
32
  "typescript": "5.0.2",
33
33
  "vitest": "^0.29.7"
@@ -26,8 +26,8 @@
26
26
  "@testing-library/user-event": "^14.4.3",
27
27
  "@types/react": "^18.0.28",
28
28
  "jsdom": "^21.1.1",
29
- "oc-server": "^2.0.5",
30
- "oc-template-react-compiler": "^7.1.3",
29
+ "oc-server": "^2.0.6",
30
+ "oc-template-react-compiler": "^7.1.5",
31
31
  "react": "18.3.1",
32
32
  "react-dom": "18.3.1",
33
33
  "typescript": "5.1.3",
@@ -25,9 +25,9 @@
25
25
  "@testing-library/jest-dom": "^6.5.0",
26
26
  "@types/testing-library__jest-dom": "^5.14.5",
27
27
  "jsdom": "^21.1.1",
28
- "oc-server": "^2.0.5",
29
- "oc-template-solid-compiler": "^1.1.3",
30
- "solid-js": "^1.8.21",
28
+ "oc-server": "^2.0.6",
29
+ "oc-template-solid-compiler": "^1.1.5",
30
+ "solid-js": "^1.9.5",
31
31
  "typescript": "5.5.4",
32
32
  "vitest": "^2.0.5"
33
33
  }
@@ -27,8 +27,8 @@
27
27
  "@tsconfig/svelte": "^5.0.4",
28
28
  "@types/testing-library__jest-dom": "^5.14.5",
29
29
  "jsdom": "^21.1.1",
30
- "oc-server": "^2.0.5",
31
- "oc-template-svelte-compiler": "^0.0.5",
30
+ "oc-server": "^2.0.6",
31
+ "oc-template-svelte-compiler": "^0.0.7",
32
32
  "svelte": "^5.23.0",
33
33
  "typescript": "5.0.2",
34
34
  "vitest": "^0.29.7"
@@ -23,13 +23,14 @@
23
23
  "devDependencies": {
24
24
  "@testing-library/jest-dom": "^5.16.5",
25
25
  "@types/testing-library__jest-dom": "^5.14.5",
26
- "@vitejs/plugin-vue": "^5.0.0",
26
+ "@vitejs/plugin-vue": "^5.2.1",
27
+ "@vue/tsconfig": "^0.7.0",
27
28
  "jsdom": "^21.1.1",
28
- "oc-server": "^2.0.5",
29
- "oc-template-vue-compiler": "^1.1.3",
30
- "typescript": "5.0.2",
29
+ "oc-server": "^2.0.6",
30
+ "oc-template-vue-compiler": "^1.1.5",
31
+ "typescript": "5.8.2",
31
32
  "vitest": "^0.29.7",
32
- "vue": "^3.3.11",
33
- "vue-tsc": "^1.8.25"
33
+ "vue": "^3.5.13",
34
+ "vue-tsc": "^2.2.4"
34
35
  }
35
36
  }