@benjos/create-boilerplate 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.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @benjos/boilerplate
2
+
3
+ CLI pour scaffolder des projets Three.js avec support Vanilla/React/Vue.
4
+
5
+ ## Utilisation
6
+
7
+ ```bash
8
+ npm create @benjos/boilerplate
9
+ # ou
10
+ npx @benjos/boilerplate
11
+ ```
12
+
13
+ Le CLI vous demandera :
14
+ 1. **Nom du projet** (exemple: `my-threejs-app` ou `.` pour le dossier actuel)
15
+ 2. **Framework** : Vanilla (React et Vue à venir)
16
+
17
+ ## Développement local
18
+
19
+ ```bash
20
+ cd packages/cli
21
+ npm install
22
+ npm run build
23
+ npm link
24
+
25
+ # Tester
26
+ cd /tmp
27
+ create-boilerplate
28
+ ```
29
+
30
+ ## Publication
31
+
32
+ Voir [docs/PUBLISHING.md](../../docs/PUBLISHING.md)
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+ import { program } from 'commander';
3
+ import inquirer from 'inquirer';
4
+ import chalk from 'chalk';
5
+ import fs from 'fs-extra';
6
+ import path from 'path';
7
+ import { fileURLToPath } from 'url';
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
10
+ async function createProject() {
11
+ console.log(chalk.cyan.bold('\n🚀 Welcome to @benjos/boilerplate!\n'));
12
+ const answers = await inquirer.prompt([
13
+ {
14
+ type: 'input',
15
+ name: 'projectName',
16
+ message: 'Project name:',
17
+ default: 'my-threejs-app',
18
+ validate: (input) => {
19
+ if (input === '.')
20
+ return true;
21
+ if (!/^[a-z0-9-]+$/.test(input)) {
22
+ return 'Project name must contain only lowercase letters, numbers, and hyphens (or "." for current directory)';
23
+ }
24
+ return true;
25
+ },
26
+ },
27
+ {
28
+ type: 'list',
29
+ name: 'framework',
30
+ message: 'Choose a framework:',
31
+ choices: [
32
+ { name: 'Vanilla (Three.js + TypeScript)', value: 'vanilla' },
33
+ { name: 'React (Coming soon)', value: 'react', disabled: true },
34
+ { name: 'Vue (Coming soon)', value: 'vue', disabled: true },
35
+ ],
36
+ },
37
+ ]);
38
+ // Handle current directory case
39
+ const isCurrentDir = answers.projectName === '.';
40
+ const targetDir = isCurrentDir
41
+ ? process.cwd()
42
+ : path.join(process.cwd(), answers.projectName);
43
+ // Check if directory already exists (only for new directories)
44
+ if (!isCurrentDir && (await fs.pathExists(targetDir))) {
45
+ console.log(chalk.red(`\n❌ Directory "${answers.projectName}" already exists!`));
46
+ process.exit(1);
47
+ }
48
+ // Check if current directory is empty (only for current directory)
49
+ if (isCurrentDir) {
50
+ const files = await fs.readdir(targetDir);
51
+ if (files.length > 0) {
52
+ console.log(chalk.red('\n❌ Current directory is not empty!'));
53
+ process.exit(1);
54
+ }
55
+ }
56
+ const projectName = isCurrentDir
57
+ ? path.basename(targetDir)
58
+ : answers.projectName;
59
+ console.log(chalk.blue(`\n📦 Creating project in ${targetDir}...\n`));
60
+ // Copy template
61
+ const templateDir = path.join(__dirname, '..', '..', `template-${answers.framework}`);
62
+ await fs.copy(templateDir, targetDir);
63
+ // Update package.json with project name
64
+ const packageJsonPath = path.join(targetDir, 'package.json');
65
+ const packageJson = await fs.readJson(packageJsonPath);
66
+ packageJson.name = projectName;
67
+ await fs.writeJson(packageJsonPath, packageJson, { spaces: 4 });
68
+ console.log(chalk.green('✅ Project created successfully!\n'));
69
+ console.log(chalk.cyan('Next steps:\n'));
70
+ if (!isCurrentDir) {
71
+ console.log(chalk.white(` cd ${answers.projectName}`));
72
+ }
73
+ console.log(chalk.white(' npm install'));
74
+ console.log(chalk.white(' npm run dev\n'));
75
+ }
76
+ program
77
+ .name('create-boilerplate')
78
+ .description('Create a new Three.js project with Vanilla/React/Vue')
79
+ .version('1.0.0')
80
+ .action(createProject);
81
+ program.parse();
82
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;AAO1C,KAAK,UAAU,aAAa;IACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC,CAAA;IAEtE,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAiB;QAClD;YACI,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,eAAe;YACxB,OAAO,EAAE,gBAAgB;YACzB,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE;gBACxB,IAAI,KAAK,KAAK,GAAG;oBAAE,OAAO,IAAI,CAAA;gBAC9B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC9B,OAAO,uGAAuG,CAAA;gBAClH,CAAC;gBACD,OAAO,IAAI,CAAA;YACf,CAAC;SACJ;QACD;YACI,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,qBAAqB;YAC9B,OAAO,EAAE;gBACL,EAA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C,aAAa,CAAC,CAAA;AAE1B,OAAO,CAAC,KAAK,EAAE,CAAA"}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@benjos/create-boilerplate",
3
+ "version": "1.0.0",
4
+ "description": "CLI to scaffold Three.js projects with Vanilla/React/Vue support",
5
+ "type": "module",
6
+ "bin": {
7
+ "create-boilerplate": "./dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "../template-vanilla"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsc",
15
+ "dev": "tsc --watch",
16
+ "prepublishOnly": "npm run build"
17
+ },
18
+ "keywords": [
19
+ "three.js",
20
+ "boilerplate",
21
+ "cli",
22
+ "scaffold",
23
+ "vanilla",
24
+ "react",
25
+ "vue"
26
+ ],
27
+ "author": "Benjamin Schinkel",
28
+ "license": "MIT",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/LeBenjos/boilerplate.git"
32
+ },
33
+ "homepage": "https://github.com/LeBenjos/boilerplate#readme",
34
+ "dependencies": {
35
+ "chalk": "^5.3.0",
36
+ "commander": "^12.1.0",
37
+ "fs-extra": "^11.2.0",
38
+ "inquirer": "^9.2.12"
39
+ },
40
+ "devDependencies": {
41
+ "@types/fs-extra": "^11.0.4",
42
+ "@types/inquirer": "^9.0.7",
43
+ "@types/node": "^20.10.5",
44
+ "typescript": "~5.9.3"
45
+ }
46
+ }