@galacean/cli 0.0.1-1 → 0.0.1-alpha.1-alpha.1-alpha.1

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.
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "<%= projectName %>",
3
+ "version": "1.0.0",
4
+ <% if(debug) { %>
5
+ "main": "./main.js",
6
+ <% } else { %>
7
+ "main": "./src/App.tsx",
8
+ <% } %>
9
+ "scripts": {
10
+ "dev": "vite --host",
11
+ "build": "vite build",
12
+ "serve": "vite preview",
13
+ "https": "vite --https --host"
14
+ },
15
+ "dependencies": {
16
+ <% if(framework === 0x2) { %>
17
+ "react": "^18.3.1",
18
+ "react-dom": "^18.3.1",
19
+ <% } %>
20
+ <% if(framework === 0x4) { %>
21
+ "vue": "^3.5.13",
22
+ <% } %>
23
+ <% if(features.lottie) { %>"@galacean/engine-lottie": "<%= `engine-${engineVersion.split('.')[0]}.${engineVersion.split('.')[1]}` %>", <% } %>
24
+ <% if(features.spine) { %>"@galacean/engine-spine": "<%= `engine-${engineVersion.split('.')[0]}.${engineVersion.split('.')[1]}` %>", <% } %>
25
+ <% if(features.shaderlab) { %>"@galacean/engine-shaderlab": "<%= engineVersion %>", <% } %>
26
+ <% if(features.shaderlab) { %>"@galacean/engine-shader": "<%= engineVersion %>", <% } %>
27
+ <% if(features.physicsLite) { %>"@galacean/engine-physics-lite": "<%= engineVersion %>", <% } %>
28
+ <% if(features.physx) { %>"@galacean/engine-physics-physx": "<%= engineVersion %>", <% } %>
29
+ <% if(features.xr) { %>
30
+ "@galacean/engine-xr": "<%= engineVersion %>",
31
+ "@galacean/engine-xr-webxr": "<%= engineVersion %>",
32
+ "@galacean/engine-toolkit-xr": "<%= `engine-${engineVersion.split('.')[0]}.${engineVersion.split('.')[1]}` %>",
33
+ <% } %>
34
+ <% if(features.gui) { %>"@galacean/engine-ui": "<%= engineVersion %>", <% } %>
35
+ <% if(features.editorDecorators) { %>"@galacean/editor-decorators": "latest", <% } %>
36
+ <% if(debug.stats || debug.orbitControl) { %>
37
+ "@galacean/engine-toolkit": "<%= `engine-${engineVersion.split('.')[0]}.${engineVersion.split('.')[1]}` %>",
38
+ <% } %>
39
+ <% Object.keys(dependencies).forEach((name, index, array) => { %>
40
+ "<%= name %>": "<%= dependencies[name] %>",
41
+ <% }) %>
42
+ "@galacean/engine": "<%= engineVersion %>"
43
+ },
44
+ "devDependencies": {
45
+ <% if(framework === 0x2) { %>
46
+ "@vitejs/plugin-react": "^3.1.0",
47
+ <% } %>
48
+ <% if(framework === 0x4) { %>
49
+ "@vitejs/plugin-vue": "^4.6.2",
50
+ "@vitejs/plugin-vue-jsx": "^4.1.1",
51
+ <% } %>
52
+ "vite": "^4",
53
+ "typescript": "^4.3.5"
54
+ }
55
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "url": "/project.json"
3
+ }
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import { WebGLEngine } from "@galacean/engine";
3
+
4
+ import { init } from "./index";
5
+
6
+ interface AppProps {
7
+ onLoad?: (engine: WebGLEngine) => void;
8
+ onError?: (e: any) => void;
9
+ }
10
+
11
+ function App(props: AppProps) {
12
+ React.useEffect(() => {
13
+ init(document.getElementById("canvas") as HTMLCanvasElement)
14
+ .then((engine) => {
15
+ props.onLoad && props.onLoad(engine);
16
+ })
17
+ .catch((e) => {
18
+ props.onError && props.onError(e);
19
+ });
20
+ }, []);
21
+
22
+ return (
23
+ <canvas id="canvas" style={{ display: "block", width: "100%", height: "100%" }} />
24
+ );
25
+ }
26
+
27
+ export default App;
@@ -0,0 +1,41 @@
1
+ <script setup lang="ts">
2
+ import { type PropType, onMounted } from 'vue';
3
+ import { init } from './index'
4
+
5
+ const props = defineProps({
6
+ onLoad: {
7
+ type: Function as PropType<(engine: any) => void>,
8
+ required: false,
9
+ },
10
+ onError: {
11
+ type: Function as PropType<(error: any) => void>,
12
+ required: false,
13
+ },
14
+ });
15
+
16
+ onMounted(() => {
17
+ init(document.getElementById("canvas") as HTMLCanvasElement)
18
+ .then((engine) => {
19
+ console.log('engine', engine)
20
+ props.onLoad && props.onLoad(engine);
21
+ })
22
+ .catch((e) => {
23
+ props.onError && props.onError(e);
24
+ });
25
+ });
26
+
27
+ </script>
28
+
29
+ <template>
30
+ <canvas id="canvas"></canvas>
31
+ </template>
32
+
33
+ <style scoped>
34
+ #canvas {
35
+ display: block;
36
+ width: 100%;
37
+ height: 100%;
38
+ background-color: #000;
39
+ }
40
+ </style>
41
+