@certe/atmos-editor 0.4.0 → 0.6.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.
- package/README.md +29 -34
- package/bin/atmos-init.mjs +94 -0
- package/package.json +10 -6
package/README.md
CHANGED
|
@@ -6,52 +6,47 @@ Unity-style editor for the Atmos Engine, built with React. Provides scene hierar
|
|
|
6
6
|
|
|
7
7
|
## Getting Started
|
|
8
8
|
|
|
9
|
-
### 1. Create a new project
|
|
10
|
-
|
|
11
9
|
```bash
|
|
12
10
|
mkdir my-game && cd my-game
|
|
13
|
-
npm
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
### 2. Install dependencies
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
npm install @certe/atmos-editor @certe/atmos-core @certe/atmos-math @certe/atmos-renderer @certe/atmos-physics
|
|
20
|
-
npm install -D vite @vitejs/plugin-react
|
|
11
|
+
npm install @certe/atmos-editor
|
|
12
|
+
npx atmos-init
|
|
13
|
+
npm run dev
|
|
21
14
|
```
|
|
22
15
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Create `vite.config.ts`:
|
|
16
|
+
That's it. `atmos-init` creates `vite.config.ts`, `src/main.ts`, `tsconfig.json`, installs dev dependencies, and adds npm scripts. The editor opens at `http://localhost:5173`.
|
|
26
17
|
|
|
27
|
-
|
|
28
|
-
import { defineConfig } from 'vite';
|
|
29
|
-
import react from '@vitejs/plugin-react';
|
|
30
|
-
import { atmosPlugin } from '@certe/atmos-editor/vite';
|
|
18
|
+
### Manual setup
|
|
31
19
|
|
|
32
|
-
|
|
33
|
-
plugins: [react(), atmosPlugin()],
|
|
34
|
-
});
|
|
35
|
-
```
|
|
20
|
+
If you prefer to set things up yourself:
|
|
36
21
|
|
|
37
|
-
|
|
22
|
+
1. Install dependencies:
|
|
23
|
+
```bash
|
|
24
|
+
npm install @certe/atmos-editor
|
|
25
|
+
npm install -D vite @vitejs/plugin-react typescript
|
|
26
|
+
```
|
|
38
27
|
|
|
39
|
-
Create `
|
|
28
|
+
2. Create `vite.config.ts`:
|
|
29
|
+
```ts
|
|
30
|
+
import { defineConfig } from 'vite';
|
|
31
|
+
import react from '@vitejs/plugin-react';
|
|
32
|
+
import { atmosPlugin } from '@certe/atmos-editor/vite';
|
|
40
33
|
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
export default defineConfig({
|
|
35
|
+
plugins: [react(), atmosPlugin()],
|
|
36
|
+
});
|
|
37
|
+
```
|
|
43
38
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
```
|
|
39
|
+
3. Create `src/main.ts`:
|
|
40
|
+
```ts
|
|
41
|
+
import { startEditor, createEditorPhysics } from '@certe/atmos-editor';
|
|
49
42
|
|
|
50
|
-
|
|
43
|
+
await startEditor({
|
|
44
|
+
physics: await createEditorPhysics(),
|
|
45
|
+
scriptModules: import.meta.glob('./scripts/*.ts', { eager: true }),
|
|
46
|
+
});
|
|
47
|
+
```
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
npx vite
|
|
54
|
-
```
|
|
49
|
+
4. Run: `npx vite`
|
|
55
50
|
|
|
56
51
|
The editor opens with a WebGPU viewport, scene hierarchy, inspector, and gizmo tools. Place game scripts in `src/scripts/` and they'll be automatically discovered.
|
|
57
52
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { execSync } from 'node:child_process';
|
|
5
|
+
|
|
6
|
+
const root = process.cwd();
|
|
7
|
+
|
|
8
|
+
console.log('Initializing Atmos project...\n');
|
|
9
|
+
|
|
10
|
+
// 1. Ensure package.json exists
|
|
11
|
+
if (!fs.existsSync(path.join(root, 'package.json'))) {
|
|
12
|
+
console.log('Creating package.json...');
|
|
13
|
+
execSync('npm init -y', { stdio: 'inherit', cwd: root });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Ensure "type": "module" in package.json
|
|
17
|
+
const pkgPath = path.join(root, 'package.json');
|
|
18
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
19
|
+
if (pkg.type !== 'module') {
|
|
20
|
+
pkg.type = 'module';
|
|
21
|
+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
22
|
+
console.log('Set "type": "module" in package.json');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// 2. vite.config.ts
|
|
26
|
+
const viteConfig = `import { defineConfig } from 'vite';
|
|
27
|
+
import react from '@vitejs/plugin-react';
|
|
28
|
+
import { atmosPlugin } from '@certe/atmos-editor/vite';
|
|
29
|
+
|
|
30
|
+
export default defineConfig({
|
|
31
|
+
plugins: [react(), atmosPlugin()],
|
|
32
|
+
});
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
if (!fs.existsSync(path.join(root, 'vite.config.ts'))) {
|
|
36
|
+
fs.writeFileSync(path.join(root, 'vite.config.ts'), viteConfig);
|
|
37
|
+
console.log('Created vite.config.ts');
|
|
38
|
+
} else {
|
|
39
|
+
console.log('vite.config.ts already exists, skipping');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// 3. src/main.ts
|
|
43
|
+
const mainTs = `import { startEditor, createEditorPhysics } from '@certe/atmos-editor';
|
|
44
|
+
|
|
45
|
+
await startEditor({
|
|
46
|
+
physics: await createEditorPhysics(),
|
|
47
|
+
scriptModules: import.meta.glob('./scripts/*.ts', { eager: true }),
|
|
48
|
+
});
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
fs.mkdirSync(path.join(root, 'src', 'scripts'), { recursive: true });
|
|
52
|
+
|
|
53
|
+
if (!fs.existsSync(path.join(root, 'src', 'main.ts'))) {
|
|
54
|
+
fs.writeFileSync(path.join(root, 'src', 'main.ts'), mainTs);
|
|
55
|
+
console.log('Created src/main.ts');
|
|
56
|
+
} else {
|
|
57
|
+
console.log('src/main.ts already exists, skipping');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// 4. tsconfig.json
|
|
61
|
+
const tsconfig = {
|
|
62
|
+
compilerOptions: {
|
|
63
|
+
target: 'ESNext',
|
|
64
|
+
module: 'ESNext',
|
|
65
|
+
moduleResolution: 'bundler',
|
|
66
|
+
strict: true,
|
|
67
|
+
esModuleInterop: true,
|
|
68
|
+
skipLibCheck: true,
|
|
69
|
+
types: ['vite/client'],
|
|
70
|
+
},
|
|
71
|
+
include: ['src'],
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
if (!fs.existsSync(path.join(root, 'tsconfig.json'))) {
|
|
75
|
+
fs.writeFileSync(path.join(root, 'tsconfig.json'), JSON.stringify(tsconfig, null, 2) + '\n');
|
|
76
|
+
console.log('Created tsconfig.json');
|
|
77
|
+
} else {
|
|
78
|
+
console.log('tsconfig.json already exists, skipping');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// 5. Install dependencies
|
|
82
|
+
console.log('\nInstalling dependencies...');
|
|
83
|
+
execSync('npm install @certe/atmos-physics', { stdio: 'inherit', cwd: root });
|
|
84
|
+
execSync('npm install -D vite @vitejs/plugin-react typescript', { stdio: 'inherit', cwd: root });
|
|
85
|
+
|
|
86
|
+
// 6. Add scripts to package.json if missing
|
|
87
|
+
const updatedPkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
88
|
+
updatedPkg.scripts = updatedPkg.scripts || {};
|
|
89
|
+
if (!updatedPkg.scripts.dev) updatedPkg.scripts.dev = 'vite';
|
|
90
|
+
if (!updatedPkg.scripts.build) updatedPkg.scripts.build = 'vite build';
|
|
91
|
+
if (!updatedPkg.scripts.preview) updatedPkg.scripts.preview = 'vite preview';
|
|
92
|
+
fs.writeFileSync(pkgPath, JSON.stringify(updatedPkg, null, 2) + '\n');
|
|
93
|
+
|
|
94
|
+
console.log('\nDone! Run "npm run dev" to start the editor.');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@certe/atmos-editor",
|
|
3
3
|
"description": "Browser-based Unity-style editor for the Atmos Engine — hierarchy, inspector, gizmos",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/certesolutions-cyber/atmos.git",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"vite-plugin.mjs",
|
|
43
43
|
"vite-plugin.cjs",
|
|
44
44
|
"vite-plugin.d.ts",
|
|
45
|
+
"bin",
|
|
45
46
|
"package.json",
|
|
46
47
|
"README.md",
|
|
47
48
|
"LICENCE"
|
|
@@ -55,11 +56,11 @@
|
|
|
55
56
|
}
|
|
56
57
|
},
|
|
57
58
|
"dependencies": {
|
|
58
|
-
"@certe/atmos-animation": "^0.
|
|
59
|
-
"@certe/atmos-assets": "^0.
|
|
60
|
-
"@certe/atmos-core": "^0.
|
|
61
|
-
"@certe/atmos-math": "^0.
|
|
62
|
-
"@certe/atmos-renderer": "^0.
|
|
59
|
+
"@certe/atmos-animation": "^0.6.0",
|
|
60
|
+
"@certe/atmos-assets": "^0.6.0",
|
|
61
|
+
"@certe/atmos-core": "^0.6.0",
|
|
62
|
+
"@certe/atmos-math": "^0.6.0",
|
|
63
|
+
"@certe/atmos-renderer": "^0.6.0",
|
|
63
64
|
"react": "^19.0.0",
|
|
64
65
|
"react-dom": "^19.0.0"
|
|
65
66
|
},
|
|
@@ -67,6 +68,9 @@
|
|
|
67
68
|
"@types/react": "^19.0.0",
|
|
68
69
|
"@types/react-dom": "^19.0.0"
|
|
69
70
|
},
|
|
71
|
+
"bin": {
|
|
72
|
+
"atmos-init": "./bin/atmos-init.mjs"
|
|
73
|
+
},
|
|
70
74
|
"scripts": {
|
|
71
75
|
"test": "vitest run"
|
|
72
76
|
}
|