create-babylonjs 9.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/package.json +38 -0
  2. package/readme.md +103 -0
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "create-babylonjs",
3
+ "version": "9.0.0",
4
+ "description": "Scaffold a new Babylon.js project with your choice of module format, language, and bundler.",
5
+ "bin": {
6
+ "create-babylonjs": "./dist/index.js"
7
+ },
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc -p tsconfig.json",
13
+ "typecheck": "tsc -p tsconfig.json --noEmit"
14
+ },
15
+ "dependencies": {
16
+ "prompts": "^2.4.2"
17
+ },
18
+ "devDependencies": {
19
+ "@types/prompts": "^2.4.9",
20
+ "typescript": "^5.4.0"
21
+ },
22
+ "keywords": [
23
+ "babylonjs",
24
+ "babylon.js",
25
+ "webgl",
26
+ "webgpu",
27
+ "3d",
28
+ "scaffold",
29
+ "create",
30
+ "template"
31
+ ],
32
+ "license": "Apache-2.0",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/BabylonJS/Babylon.js.git",
36
+ "directory": "packages/public/create-babylonjs"
37
+ }
38
+ }
package/readme.md ADDED
@@ -0,0 +1,103 @@
1
+ # create-babylonjs
2
+
3
+ Scaffold a new [Babylon.js](https://www.babylonjs.com/) project in seconds.
4
+
5
+ ```bash
6
+ npm create babylonjs
7
+ ```
8
+
9
+ ## What it does
10
+
11
+ The CLI walks you through a few choices and generates a ready-to-run project:
12
+
13
+ | Prompt | Options |
14
+ | ----------------- | -------------------------------------------------------------------------------------------------- |
15
+ | **Project name** | Any name (defaults to `my-babylonjs-app`) |
16
+ | **Module format** | **ES6** (`@babylonjs/core` — tree-shakeable) or **UMD** (`babylonjs` — global `BABYLON` namespace) |
17
+ | **Language** | **TypeScript** or **JavaScript** |
18
+ | **Bundler** | **Vite**, **Webpack**, **Rollup**, or **None** (CDN script tags only — UMD only) |
19
+
20
+ ## Generated project
21
+
22
+ Every project includes:
23
+
24
+ - A starter scene that loads a glTF model with environment lighting
25
+ - Demonstrates `SceneLoader.AppendAsync`, `createDefaultCamera`, and `createDefaultEnvironment`
26
+ - Proper side-effect imports for tree-shaken ES6 builds (glTF loader, env texture loader, PBR material, etc.)
27
+ - Resize handling and render loop
28
+
29
+ ### ES6 template
30
+
31
+ Uses tree-shakeable imports from `@babylonjs/core` and `@babylonjs/loaders`:
32
+
33
+ ```ts
34
+ import { Engine } from "@babylonjs/core/Engines/engine";
35
+ import { Scene } from "@babylonjs/core/scene";
36
+ import { SceneLoader } from "@babylonjs/core/Loading/sceneLoader";
37
+ import "@babylonjs/core/Helpers/sceneHelpers";
38
+ import "@babylonjs/loaders/glTF";
39
+ // ...
40
+ ```
41
+
42
+ ### UMD template
43
+
44
+ Uses the `babylonjs` and `babylonjs-loaders` packages with the global `BABYLON` namespace:
45
+
46
+ ```ts
47
+ import * as BABYLON from "babylonjs";
48
+ import "babylonjs-loaders";
49
+ // ...
50
+ ```
51
+
52
+ ### CDN-only template (no bundler)
53
+
54
+ A single `index.html` with `<script>` tags — no npm install required:
55
+
56
+ ```html
57
+ <script src="https://cdn.babylonjs.com/babylon.js"></script>
58
+ <script src="https://cdn.babylonjs.com/loaders/babylonjs.loaders.min.js"></script>
59
+ ```
60
+
61
+ ## Bundler configurations
62
+
63
+ | Bundler | Config file | Dev server |
64
+ | ------- | ----------------------------------- | -------------------------------------------- |
65
+ | Vite | `vite.config.ts` / `vite.config.js` | `npm run dev` |
66
+ | Webpack | `webpack.config.js` | `npm run dev` (webpack-dev-server) |
67
+ | Rollup | `rollup.config.mjs` | `npm run dev` (rollup -c -w with livereload) |
68
+ | None | — | Open `index.html` in browser |
69
+
70
+ ## Production build
71
+
72
+ All bundler-based templates include a `build:prod` script that creates an optimized production bundle:
73
+
74
+ ```bash
75
+ npm run build:prod
76
+ ```
77
+
78
+ | Bundler | Output | Preview |
79
+ | ------- | ---------------- | --------------------------------------------------- |
80
+ | Vite | `dist/` | `npm run preview` |
81
+ | Webpack | `dist/` | Serve `dist/` with any static server |
82
+ | Rollup | `dist/bundle.js` | Open `index.html` which references `dist/bundle.js` |
83
+
84
+ Deploy the contents of `dist/` (or the project root for Rollup) to any static hosting provider.
85
+
86
+ ## Quick start
87
+
88
+ ```bash
89
+ npm create babylonjs
90
+ cd my-babylonjs-app
91
+ npm install
92
+ npm run dev
93
+ ```
94
+
95
+ When you are ready to deploy:
96
+
97
+ ```bash
98
+ npm run build:prod
99
+ ```
100
+
101
+ ## License
102
+
103
+ Apache-2.0