@judenns/create-starter 1.0.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/index.js +54 -0
  2. package/package.json +19 -0
package/index.js ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+ import { downloadTemplate } from 'giget';
3
+
4
+ const REPO = 'judenns/starter-templates';
5
+ const TEMPLATES = {
6
+ vanilla: 'vanilla-js',
7
+ react: 'react-js',
8
+ };
9
+
10
+ const [template, projectName] = process.argv.slice(2);
11
+
12
+ // Show help
13
+ if (!template || !projectName || template === '--help' || template === '-h') {
14
+ console.log(`
15
+ Usage: pnpm create @judenns/starter <template> <project-name>
16
+
17
+ Templates:
18
+ vanilla Vite + Vanilla JavaScript
19
+ react Vite + React 19
20
+
21
+ Example:
22
+ pnpm create @judenns/starter react my-app
23
+ pnpm create @judenns/starter vanilla my-app
24
+ `);
25
+ process.exit(template === '--help' || template === '-h' ? 0 : 1);
26
+ }
27
+
28
+ // Validate template
29
+ const branch = TEMPLATES[template];
30
+ if (!branch) {
31
+ console.error(`Error: Unknown template "${template}"`);
32
+ console.error(`Available templates: ${Object.keys(TEMPLATES).join(', ')}`);
33
+ process.exit(1);
34
+ }
35
+
36
+ // Download template
37
+ try {
38
+ console.log(`Creating ${projectName} with ${template} template...`);
39
+
40
+ await downloadTemplate(`github:${REPO}#${branch}`, {
41
+ dir: projectName,
42
+ });
43
+
44
+ console.log(`
45
+ Done! Now run:
46
+
47
+ cd ${projectName}
48
+ pnpm install
49
+ pnpm dev
50
+ `);
51
+ } catch (error) {
52
+ console.error('Error:', error.message);
53
+ process.exit(1);
54
+ }
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@judenns/create-starter",
3
+ "version": "1.0.0",
4
+ "description": "Create a new project from starter templates",
5
+ "type": "module",
6
+ "bin": {
7
+ "create-starter": "./index.js"
8
+ },
9
+ "files": ["index.js"],
10
+ "keywords": ["create", "starter", "template", "vite", "react", "vanilla"],
11
+ "author": "judenns",
12
+ "license": "MIT",
13
+ "engines": {
14
+ "node": ">=20"
15
+ },
16
+ "dependencies": {
17
+ "giget": "^2.0.0"
18
+ }
19
+ }