@benjos/create-boilerplate 1.0.1 β 1.3.2
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 +29 -22
- package/dist/index.js +20 -17
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/template-react/.prettierignore +6 -0
- package/template-react/.prettierrc +10 -0
- package/template-react/assets_source/.gitkeep +0 -0
- package/template-react/eslint.config.js +23 -0
- package/template-react/index.html +17 -0
- package/template-react/package-lock.json +4492 -0
- package/template-react/package.json +47 -0
- package/template-react/public/assets/fonts/LICENSE +13 -0
- package/template-react/public/assets/fonts/template.typeface.json +1 -0
- package/template-react/public/assets/hdrs/template.hdr +0 -0
- package/template-react/public/assets/icons/benjosLogoBlack.svg +5 -0
- package/template-react/public/assets/loaders/draco/README.md +32 -0
- package/template-react/public/assets/loaders/draco/draco_decoder.js +34 -0
- package/template-react/public/assets/loaders/draco/draco_decoder.wasm +0 -0
- package/template-react/public/assets/loaders/draco/draco_encoder.js +33 -0
- package/template-react/public/assets/loaders/draco/draco_wasm_wrapper.js +117 -0
- package/template-react/public/assets/loaders/draco/gltf/draco_decoder.js +33 -0
- package/template-react/public/assets/loaders/draco/gltf/draco_decoder.wasm +0 -0
- package/template-react/public/assets/loaders/draco/gltf/draco_encoder.js +33 -0
- package/template-react/public/assets/loaders/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/template-react/public/assets/models/template.glb +0 -0
- package/template-react/public/assets/textures/template.jpg +0 -0
- package/template-react/readme.md +31 -0
- package/template-react/src/App.css +42 -0
- package/template-react/src/App.tsx +14 -0
- package/template-react/src/index.css +68 -0
- package/template-react/src/main.tsx +10 -0
- package/template-react/tsconfig.app.json +28 -0
- package/template-react/tsconfig.json +7 -0
- package/template-react/tsconfig.node.json +26 -0
- package/template-react/vite.config.ts +29 -0
- package/template-vanilla/eslint.config.js +11 -0
- package/template-vanilla/package-lock.json +3739 -3739
- package/template-vanilla/package.json +2 -2
- package/template-vanilla/readme.md +28 -10
- package/template-vanilla/src/experiences/Experience.ts +7 -0
- package/template-vanilla/src/experiences/constants/experiences/ViewType.ts +6 -0
- package/template-vanilla/src/experiences/proxies/ViewProxy.ts +15 -0
- package/template-vanilla/src/experiences/views/bases/ViewBase.ts +14 -3
- package/template-vanilla/src/experiences/views/htmls/bases/HTMLViewBase.ts +2 -1
- package/template-vanilla/src/experiences/views/threes/bases/ThreeViewBase.ts +2 -1
- package/template-vanilla/src/experiences/views/threes/loaders/LoaderThreeView.ts +1 -0
- package/template-vanilla/tsconfig.json +0 -24
package/README.md
CHANGED
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
# @benjos/boilerplate
|
|
1
|
+
# π¦ @benjos/create-boilerplate
|
|
2
2
|
|
|
3
|
-
CLI
|
|
3
|
+
CLI to scaffold Three.js projects with framework support.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## π Quick Start
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
# Interactive mode
|
|
9
|
+
npm create @benjos/boilerplate@latest
|
|
10
|
+
|
|
11
|
+
# With project name
|
|
12
|
+
npm create @benjos/boilerplate@latest my-threejs-app
|
|
13
|
+
|
|
14
|
+
# In current directory
|
|
15
|
+
npm create @benjos/boilerplate@latest .
|
|
11
16
|
```
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
1. **Nom du projet** (exemple: `my-threejs-app` ou `.` pour le dossier actuel)
|
|
15
|
-
2. **Framework** : Vanilla (React et Vue Γ venir)
|
|
18
|
+
## β¨ Features
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
Choose your framework:
|
|
21
|
+
- **Vanilla** β Three.js + TypeScript + HTML views
|
|
22
|
+
- **React** β Three.js + TypeScript + React components
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
Both templates include:
|
|
25
|
+
- β‘ Vite for fast development
|
|
26
|
+
- π¨ GLSL shader support (vite-plugin-glsl)
|
|
27
|
+
- π Debug mode with lil-gui
|
|
28
|
+
- π¦ Manager-based architecture (Loader, Ticker, Keyboard, Mouse, etc.)
|
|
29
|
+
- π― ViewProxy system for managing views
|
|
30
|
+
- π Three.js scene management
|
|
31
|
+
- π TypeScript + ESLint + Prettier
|
|
32
|
+
|
|
33
|
+
## π§ Development
|
|
34
|
+
|
|
35
|
+
See [MAINTENANCE.md](./MAINTENANCE.md) for contributing.
|
|
29
36
|
|
|
30
|
-
##
|
|
37
|
+
## π License
|
|
31
38
|
|
|
32
|
-
|
|
39
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { program } from 'commander';
|
|
3
|
-
import inquirer from 'inquirer';
|
|
4
2
|
import chalk from 'chalk';
|
|
3
|
+
import { program } from 'commander';
|
|
5
4
|
import fs from 'fs-extra';
|
|
5
|
+
import inquirer from 'inquirer';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9
11
|
const __dirname = path.dirname(__filename);
|
|
10
|
-
async function createProject() {
|
|
12
|
+
async function createProject(projectNameArg) {
|
|
11
13
|
console.log(chalk.cyan.bold('\nπ Welcome to @benjos/boilerplate!\n'));
|
|
12
14
|
const answers = await inquirer.prompt([
|
|
13
15
|
{
|
|
14
16
|
type: 'input',
|
|
15
17
|
name: 'projectName',
|
|
16
18
|
message: 'Project name:',
|
|
17
|
-
default: 'my-threejs-app',
|
|
19
|
+
default: projectNameArg ?? 'my-threejs-app',
|
|
20
|
+
when: !projectNameArg,
|
|
18
21
|
validate: (input) => {
|
|
19
22
|
if (input === '.')
|
|
20
23
|
return true;
|
|
@@ -30,19 +33,18 @@ async function createProject() {
|
|
|
30
33
|
message: 'Choose a framework:',
|
|
31
34
|
choices: [
|
|
32
35
|
{ name: 'Vanilla (Three.js + TypeScript)', value: 'vanilla' },
|
|
33
|
-
{ name: 'React (
|
|
36
|
+
{ name: 'React (Three.js + TypeScript + React)', value: 'react' },
|
|
34
37
|
{ name: 'Vue (Coming soon)', value: 'vue', disabled: true },
|
|
35
38
|
],
|
|
36
39
|
},
|
|
37
40
|
]);
|
|
38
41
|
// Handle current directory case
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
: path.join(process.cwd(), answers.projectName);
|
|
42
|
+
const projectName = projectNameArg ?? answers.projectName ?? '.';
|
|
43
|
+
const isCurrentDir = projectName === '.';
|
|
44
|
+
const targetDir = isCurrentDir ? process.cwd() : path.join(process.cwd(), projectName);
|
|
43
45
|
// Check if directory already exists (only for new directories)
|
|
44
46
|
if (!isCurrentDir && (await fs.pathExists(targetDir))) {
|
|
45
|
-
console.log(chalk.red(`\nβ Directory "${
|
|
47
|
+
console.log(chalk.red(`\nβ Directory "${projectName}" already exists!`));
|
|
46
48
|
process.exit(1);
|
|
47
49
|
}
|
|
48
50
|
// Check if current directory is empty (only for current directory)
|
|
@@ -53,22 +55,22 @@ async function createProject() {
|
|
|
53
55
|
process.exit(1);
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
|
-
const
|
|
57
|
-
? path.basename(targetDir)
|
|
58
|
-
: answers.projectName;
|
|
58
|
+
const finalProjectName = isCurrentDir ? path.basename(targetDir) : projectName;
|
|
59
59
|
console.log(chalk.blue(`\nπ¦ Creating project in ${targetDir}...\n`));
|
|
60
60
|
// Copy template
|
|
61
61
|
const templateDir = path.join(__dirname, '..', `template-${answers.framework}`);
|
|
62
62
|
await fs.copy(templateDir, targetDir);
|
|
63
63
|
// Update package.json with project name
|
|
64
64
|
const packageJsonPath = path.join(targetDir, 'package.json');
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
65
66
|
const packageJson = await fs.readJson(packageJsonPath);
|
|
66
|
-
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
68
|
+
packageJson.name = finalProjectName;
|
|
67
69
|
await fs.writeJson(packageJsonPath, packageJson, { spaces: 4 });
|
|
68
70
|
console.log(chalk.green('β
Project created successfully!\n'));
|
|
69
71
|
console.log(chalk.cyan('Next steps:\n'));
|
|
70
72
|
if (!isCurrentDir) {
|
|
71
|
-
console.log(chalk.white(` cd ${
|
|
73
|
+
console.log(chalk.white(` cd ${projectName}`));
|
|
72
74
|
}
|
|
73
75
|
console.log(chalk.white(' npm install'));
|
|
74
76
|
console.log(chalk.white(' npm run dev\n'));
|
|
@@ -76,7 +78,8 @@ async function createProject() {
|
|
|
76
78
|
program
|
|
77
79
|
.name('create-boilerplate')
|
|
78
80
|
.description('Create a new Three.js project with Vanilla/React/Vue')
|
|
79
|
-
.version('1.0.
|
|
80
|
-
.
|
|
81
|
+
.version('1.0.1')
|
|
82
|
+
.argument('[project-name]', 'Project name (use "." for current directory)')
|
|
83
|
+
.action((projectName) => createProject(projectName));
|
|
81
84
|
program.parse();
|
|
82
85
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM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description": "CLI to scaffold Three.js projects with framework support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"create-boilerplate": "./dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
|
-
"template-vanilla"
|
|
11
|
+
"template-vanilla",
|
|
12
|
+
"template-react"
|
|
12
13
|
],
|
|
13
14
|
"scripts": {
|
|
14
15
|
"build": "tsc",
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import globals from 'globals'
|
|
3
|
+
import reactHooks from 'eslint-plugin-react-hooks'
|
|
4
|
+
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
5
|
+
import tseslint from 'typescript-eslint'
|
|
6
|
+
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
7
|
+
|
|
8
|
+
export default defineConfig([
|
|
9
|
+
globalIgnores(['dist']),
|
|
10
|
+
{
|
|
11
|
+
files: ['**/*.{ts,tsx}'],
|
|
12
|
+
extends: [
|
|
13
|
+
js.configs.recommended,
|
|
14
|
+
tseslint.configs.recommended,
|
|
15
|
+
reactHooks.configs.flat.recommended,
|
|
16
|
+
reactRefresh.configs.vite,
|
|
17
|
+
],
|
|
18
|
+
languageOptions: {
|
|
19
|
+
ecmaVersion: 2020,
|
|
20
|
+
globals: globals.browser,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
])
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="./assets/icons/benjosLogoBlack.svg" />
|
|
6
|
+
<meta
|
|
7
|
+
name="viewport"
|
|
8
|
+
content="width=device-width, initial-scale=1.0, maximum-scale=1, minimum-scale=1, height=device-height, user-scalable=no, viewport-fit=cover, shrink-to-fit=no, minimal-ui"
|
|
9
|
+
/>
|
|
10
|
+
<title>Boilerplate</title>
|
|
11
|
+
</head>
|
|
12
|
+
|
|
13
|
+
<body>
|
|
14
|
+
<div id="root"></div>
|
|
15
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|