@galacean/cli 0.0.1-alpha.5 → 0.0.1-alpha.7
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/bin/galacean.js +1 -0
- package/dist/cli.bundle.cjs +61161 -43062
- package/package.json +5 -2
- package/dist/assets/templates/web/index.html.ejs +0 -143
- package/dist/assets/templates/web/main.js.ejs +0 -41
- package/dist/assets/templates/web/package.json.ejs +0 -55
- package/dist/assets/templates/web/project.json.ejs +0 -3
- package/dist/assets/templates/web/src/App.tsx.ejs +0 -27
- package/dist/assets/templates/web/src/App.vue.ejs +0 -41
- package/dist/assets/templates/web/src/index.ts.ejs +0 -1065
- package/dist/assets/templates/web/src/scripts/index.ts.ejs +0 -9
- package/dist/assets/templates/web/tsconfig.json.ejs +0 -9
- package/dist/assets/templates/web/vite.config.ts.ejs +0 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/cli",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.7",
|
|
4
4
|
"main": "dist/cli.bundle.cjs",
|
|
5
5
|
"bin": {
|
|
6
6
|
"galacean": "bin/galacean.js"
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
"README.md"
|
|
16
16
|
],
|
|
17
17
|
"publishConfig": {
|
|
18
|
-
"
|
|
18
|
+
"main": "dist/cli.bundle.cjs",
|
|
19
|
+
"bin": {
|
|
20
|
+
"galacean": "bin/galacean.js"
|
|
21
|
+
}
|
|
19
22
|
},
|
|
20
23
|
"scripts": {
|
|
21
24
|
"build": "node build.mjs",
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>Galacean App</title>
|
|
7
|
-
<% if(debug && debug.loadingUI) { %>
|
|
8
|
-
<style>
|
|
9
|
-
#progress-container {
|
|
10
|
-
position: fixed;
|
|
11
|
-
top: 50%;
|
|
12
|
-
left: 50%;
|
|
13
|
-
transform: translate(-50%, -50%);
|
|
14
|
-
width: 300px;
|
|
15
|
-
height: 6px;
|
|
16
|
-
z-index: 9999;
|
|
17
|
-
transition: opacity 0.3s ease;
|
|
18
|
-
padding: 2px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
#progress-container::after {
|
|
22
|
-
content: '';
|
|
23
|
-
position: absolute;
|
|
24
|
-
top: 0;
|
|
25
|
-
left: 0;
|
|
26
|
-
width: 100%;
|
|
27
|
-
height: 100%;
|
|
28
|
-
background-color: #191919;
|
|
29
|
-
box-shadow: inset 0 1px 1px 0px #222;
|
|
30
|
-
border-radius: 1px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
#mask {
|
|
34
|
-
position: fixed;
|
|
35
|
-
top: 0;
|
|
36
|
-
left: 0;
|
|
37
|
-
width: 100vw;
|
|
38
|
-
height: 100vh;
|
|
39
|
-
display: block;
|
|
40
|
-
background-color: #111;
|
|
41
|
-
z-index: 9998;
|
|
42
|
-
opacity: 1;
|
|
43
|
-
transition: opacity 0.3s ease;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
#mask.hidden {
|
|
47
|
-
opacity: 0;
|
|
48
|
-
pointer-events: none;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
#progress-bar {
|
|
52
|
-
position: relative;
|
|
53
|
-
height: 100%;
|
|
54
|
-
width: 80%;
|
|
55
|
-
background-color: #70B8FF;
|
|
56
|
-
transition: width 0.2s ease;
|
|
57
|
-
border-radius: 1px;
|
|
58
|
-
z-index: 1;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
#progress-text {
|
|
62
|
-
position: absolute;
|
|
63
|
-
bottom: 16px;
|
|
64
|
-
left: 50%;
|
|
65
|
-
transform: translateX(-50%);
|
|
66
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
67
|
-
font-size: 12px;
|
|
68
|
-
color: #606060;
|
|
69
|
-
white-space: nowrap;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.progress-hidden {
|
|
73
|
-
opacity: 0;
|
|
74
|
-
pointer-events: none;
|
|
75
|
-
}
|
|
76
|
-
</style>
|
|
77
|
-
<% } %>
|
|
78
|
-
</head>
|
|
79
|
-
<body style="margin: 0; padding: 0">
|
|
80
|
-
<% if(debug && debug.loadingUI) { %>
|
|
81
|
-
<!-- Progress bar -->
|
|
82
|
-
<div id="progress-container">
|
|
83
|
-
<div id="progress-text">Loading... 0%</div>
|
|
84
|
-
<div id="progress-bar"></div>
|
|
85
|
-
</div>
|
|
86
|
-
<div id="mask"></div>
|
|
87
|
-
<% } %>
|
|
88
|
-
|
|
89
|
-
<div id="container" style="width: 100vw; height: 100vh; display: block;">
|
|
90
|
-
<% if(framework === 0x1) { %>
|
|
91
|
-
<canvas id="canvas" style="width: 100vw; height: 100vh; display: block;"></canvas>
|
|
92
|
-
<% } %>
|
|
93
|
-
</div>
|
|
94
|
-
|
|
95
|
-
<% if(debug && debug.loadingUI) { %>
|
|
96
|
-
<script>
|
|
97
|
-
// Progress bar logic
|
|
98
|
-
(function() {
|
|
99
|
-
const progressContainer = document.getElementById('progress-container');
|
|
100
|
-
const mask = document.getElementById('mask');;
|
|
101
|
-
const progressBar = document.getElementById('progress-bar');
|
|
102
|
-
const progressText = document.getElementById('progress-text');
|
|
103
|
-
|
|
104
|
-
// Listen for progress messages
|
|
105
|
-
window.addEventListener('message', function(event) {
|
|
106
|
-
const data = event.data;
|
|
107
|
-
|
|
108
|
-
// Check if the message contains progress data
|
|
109
|
-
if (data && typeof data.loaded === 'number' && typeof data.total === 'number') {
|
|
110
|
-
const loaded = Math.max(0, data.loaded);
|
|
111
|
-
const total = Math.max(1, data.total);
|
|
112
|
-
const percentage = Math.min(100, Math.round((loaded / total) * 100));
|
|
113
|
-
|
|
114
|
-
// Update progress bar
|
|
115
|
-
progressBar.style.width = percentage + '%';
|
|
116
|
-
progressText.textContent = `Loading... ${percentage}%`;
|
|
117
|
-
|
|
118
|
-
// Hide progress bar when complete
|
|
119
|
-
if (percentage >= 100) {
|
|
120
|
-
setTimeout(function() {
|
|
121
|
-
progressContainer.classList.add('progress-hidden');
|
|
122
|
-
mask.classList.add('hidden');
|
|
123
|
-
}, 10);
|
|
124
|
-
} else {
|
|
125
|
-
// Show progress bar if it was hidden
|
|
126
|
-
progressContainer.classList.remove('progress-hidden');
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
// Also listen for postMessage from parent window (for iframe usage)
|
|
132
|
-
if (window.parent !== window) {
|
|
133
|
-
window.parent.addEventListener('message', function(event) {
|
|
134
|
-
window.dispatchEvent(new MessageEvent('message', { data: event.data }));
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
})();
|
|
138
|
-
</script>
|
|
139
|
-
<% } %>
|
|
140
|
-
|
|
141
|
-
<script type="module" src="/main.js"></script>
|
|
142
|
-
</body>
|
|
143
|
-
</html>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<% if(framework === 0x1) { %>
|
|
2
|
-
import { init } from "./src";
|
|
3
|
-
|
|
4
|
-
let c = document.getElementById('canvas');
|
|
5
|
-
|
|
6
|
-
if(!c) {
|
|
7
|
-
c = document.createElement('canvas');
|
|
8
|
-
c.id = 'canvas';
|
|
9
|
-
document.body.appendChild(c);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
init(c)
|
|
13
|
-
.then(() => {
|
|
14
|
-
console.log('Project started');
|
|
15
|
-
})
|
|
16
|
-
.catch(error => {
|
|
17
|
-
console.error('Failed to start project', error);
|
|
18
|
-
<% if(debug) { %>
|
|
19
|
-
const projectChannel = new BroadcastChannel('Galacean_Editor_Channel');
|
|
20
|
-
projectChannel.postMessage({ type: "preview-error", payload: error.message });
|
|
21
|
-
<% } %>
|
|
22
|
-
})
|
|
23
|
-
<% } %>
|
|
24
|
-
|
|
25
|
-
<% if(framework === 0x2) { %>
|
|
26
|
-
import React from "react";
|
|
27
|
-
import { createRoot } from "react-dom/client";
|
|
28
|
-
import App from "./src/App";
|
|
29
|
-
|
|
30
|
-
const root = createRoot(document.getElementById('container'));
|
|
31
|
-
|
|
32
|
-
root.render(React.createElement(App));
|
|
33
|
-
|
|
34
|
-
<% } %>
|
|
35
|
-
|
|
36
|
-
<% if(framework === 0x4) { %>
|
|
37
|
-
import { createApp } from 'vue'
|
|
38
|
-
import App from './src/App.vue'
|
|
39
|
-
|
|
40
|
-
createApp(App).mount('#container')
|
|
41
|
-
<% } %>
|
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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;
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
|