@benjos/create-boilerplate 1.0.3 → 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 +24 -12
- package/dist/index.js +8 -6
- 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 +2 -20
- 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/docs/PUBLISHING.md +0 -30
- package/template-vanilla/tsconfig.json +0 -24
|
@@ -5,7 +5,8 @@ Custom boilerplate for Three.js projects with CLI scaffolding.
|
|
|
5
5
|
## 🚀 Quick Start
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm
|
|
8
|
+
npm i
|
|
9
|
+
npm run dev
|
|
9
10
|
```
|
|
10
11
|
|
|
11
12
|
## ✨ Features
|
|
@@ -16,19 +17,6 @@ npm create @benjos/boilerplate@latest
|
|
|
16
17
|
- Manager-based architecture
|
|
17
18
|
- ESLint + Prettier
|
|
18
19
|
|
|
19
|
-
## 📦 Usage
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
# Interactive
|
|
23
|
-
npm create @benjos/boilerplate@latest
|
|
24
|
-
|
|
25
|
-
# With name
|
|
26
|
-
npm create @benjos/boilerplate@latest my-project
|
|
27
|
-
|
|
28
|
-
# Current directory
|
|
29
|
-
npm create @benjos/boilerplate@latest .
|
|
30
|
-
```
|
|
31
|
-
|
|
32
20
|
## 🐛 Debug Mode
|
|
33
21
|
|
|
34
22
|
Add `#debug` to URL: `http://localhost:5173/#debug`
|
|
@@ -38,12 +26,6 @@ Add `#debug` to URL: `http://localhost:5173/#debug`
|
|
|
38
26
|
- `Shift + W` → Wireframe
|
|
39
27
|
- `Ctrl + Click` → Center on object
|
|
40
28
|
|
|
41
|
-
## 🛠️ Development
|
|
42
|
-
|
|
43
|
-
CLI development: [packages/cli/README.md](packages/cli/README.md)
|
|
44
|
-
|
|
45
|
-
Publishing: [docs/PUBLISHING.md](docs/PUBLISHING.md)
|
|
46
|
-
|
|
47
29
|
## 📄 License
|
|
48
30
|
|
|
49
31
|
MIT
|
|
@@ -6,7 +6,14 @@ import MainThree from './engines/threes/MainThree';
|
|
|
6
6
|
import LoaderManager from './managers/LoaderManager';
|
|
7
7
|
|
|
8
8
|
export default class Experience {
|
|
9
|
+
private static _isInitialized = false;
|
|
10
|
+
|
|
9
11
|
public static Init(): void {
|
|
12
|
+
if (Experience._isInitialized) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
Experience._isInitialized = true;
|
|
16
|
+
|
|
10
17
|
InitCommand.Init();
|
|
11
18
|
MainHTML.Init();
|
|
12
19
|
MainThree.Init();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ViewId } from '../constants/experiences/ViewId';
|
|
2
|
+
import { ViewType } from '../constants/experiences/ViewType';
|
|
2
3
|
import type ViewBase from '../views/bases/ViewBase';
|
|
3
4
|
|
|
4
5
|
type ViewConstructor<T extends ViewBase> = new (id: ViewId) => T;
|
|
@@ -27,4 +28,18 @@ export default class ViewProxy {
|
|
|
27
28
|
public static Has(viewId: ViewId): boolean {
|
|
28
29
|
return ViewProxy._Views.has(viewId);
|
|
29
30
|
}
|
|
31
|
+
|
|
32
|
+
public static GetAll<T extends ViewBase>(type?: ViewType): T[] {
|
|
33
|
+
const views: T[] = [];
|
|
34
|
+
|
|
35
|
+
ViewProxy._Views.forEach((view) => {
|
|
36
|
+
if (type && type === view.type) {
|
|
37
|
+
views.push(view as T);
|
|
38
|
+
} else {
|
|
39
|
+
views.push(view as T);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return views;
|
|
44
|
+
}
|
|
30
45
|
}
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import type { ViewId } from '../../constants/experiences/ViewId';
|
|
2
|
+
import type { ViewType } from '../../constants/experiences/ViewType';
|
|
2
3
|
|
|
3
4
|
export default class ViewBase {
|
|
4
5
|
private readonly _id: ViewId;
|
|
6
|
+
private readonly _type: ViewType;
|
|
7
|
+
protected _isVisible: boolean;
|
|
5
8
|
|
|
6
|
-
constructor(id: ViewId) {
|
|
9
|
+
constructor(id: ViewId, type: ViewType) {
|
|
7
10
|
this._id = id;
|
|
11
|
+
this._type = type;
|
|
12
|
+
this._isVisible = false;
|
|
8
13
|
}
|
|
9
14
|
|
|
10
15
|
protected _show(): void {
|
|
11
|
-
|
|
16
|
+
this._isVisible = true;
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
protected _hide(): void {
|
|
15
|
-
|
|
20
|
+
this._isVisible = false;
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
//#region Getters
|
|
@@ -20,6 +25,12 @@ export default class ViewBase {
|
|
|
20
25
|
public get id(): ViewId {
|
|
21
26
|
return this._id;
|
|
22
27
|
}
|
|
28
|
+
public get type(): ViewType {
|
|
29
|
+
return this._type;
|
|
30
|
+
}
|
|
31
|
+
public get isVisible(): boolean {
|
|
32
|
+
return this._isVisible;
|
|
33
|
+
}
|
|
23
34
|
//
|
|
24
35
|
//#endregion
|
|
25
36
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DomEvent } from '../../../constants/doms/DomEvent';
|
|
2
2
|
import type { ViewId } from '../../../constants/experiences/ViewId';
|
|
3
|
+
import { ViewType } from '../../../constants/experiences/ViewType';
|
|
3
4
|
import DomUtils from '../../../utils/DomUtils';
|
|
4
5
|
import ViewBase from '../../bases/ViewBase';
|
|
5
6
|
|
|
@@ -8,7 +9,7 @@ export default abstract class HTMLViewBase extends ViewBase {
|
|
|
8
9
|
protected readonly _htmlContainer: HTMLDivElement;
|
|
9
10
|
|
|
10
11
|
constructor(id: ViewId, parentElement: HTMLElement = DomUtils.GetApp()) {
|
|
11
|
-
super(id);
|
|
12
|
+
super(id, ViewType.HTML);
|
|
12
13
|
this._parentElement = parentElement;
|
|
13
14
|
this._htmlContainer = document.createElement('div');
|
|
14
15
|
this._htmlContainer.classList.add('view-html-container');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Object3D, Scene } from 'three';
|
|
2
2
|
import type { ViewId } from '../../../constants/experiences/ViewId';
|
|
3
|
+
import { ViewType } from '../../../constants/experiences/ViewType';
|
|
3
4
|
import MainThree from '../../../engines/threes/MainThree';
|
|
4
5
|
import ViewBase from '../../bases/ViewBase';
|
|
5
6
|
|
|
@@ -8,7 +9,7 @@ export default abstract class ThreeViewBase extends ViewBase {
|
|
|
8
9
|
protected _container: Object3D;
|
|
9
10
|
|
|
10
11
|
constructor(id: ViewId, scene: Scene = MainThree.Scene) {
|
|
11
|
-
super(id);
|
|
12
|
+
super(id, ViewType.THREE);
|
|
12
13
|
|
|
13
14
|
this._scene = scene;
|
|
14
15
|
this._container = new Object3D();
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# 📦 Publishing Guide
|
|
2
|
-
|
|
3
|
-
## First Publish
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
npm login
|
|
7
|
-
cd packages/cli
|
|
8
|
-
npm run build
|
|
9
|
-
npm publish --access public
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Updates
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
cd packages/cli
|
|
16
|
-
npm version patch # or minor/major
|
|
17
|
-
npm publish --access public
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Version Types
|
|
21
|
-
|
|
22
|
-
- `patch` → 1.0.0 → 1.0.1 (bug fixes)
|
|
23
|
-
- `minor` → 1.0.0 → 1.1.0 (new features)
|
|
24
|
-
- `major` → 1.0.0 → 2.0.0 (breaking changes)
|
|
25
|
-
|
|
26
|
-
## Test Before Publishing
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm pack --dry-run
|
|
30
|
-
```
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
-
"types": ["vite/client", "vite-plugin-glsl/ext"],
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
/* Bundler mode */
|
|
10
|
-
"moduleResolution": "bundler",
|
|
11
|
-
"allowImportingTsExtensions": true,
|
|
12
|
-
"verbatimModuleSyntax": true,
|
|
13
|
-
"moduleDetection": "force",
|
|
14
|
-
"noEmit": true,
|
|
15
|
-
/* Linting */
|
|
16
|
-
"strict": true,
|
|
17
|
-
// "noUnusedLocals": true,
|
|
18
|
-
// "noUnusedParameters": true,
|
|
19
|
-
"erasableSyntaxOnly": true,
|
|
20
|
-
"noFallthroughCasesInSwitch": true,
|
|
21
|
-
"noUncheckedSideEffectImports": true
|
|
22
|
-
},
|
|
23
|
-
"include": ["src", "src/**/*.ts", "src/**/*.d.ts"]
|
|
24
|
-
}
|