@viji-dev/sdk 1.0.5 → 1.0.6

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 CHANGED
@@ -42,7 +42,7 @@ Create a new scene in the `scenes/` folder.
42
42
  - `viji create my-scene --renderer shader` — GLSL fragment shader
43
43
  - `viji create my-scene --ts` — TypeScript scene file (works with any renderer)
44
44
 
45
- On the first run, the SDK installs type definitions locally for IDE autocompletion. This creates `node_modules/`, `package.json`, and `global.d.ts` in your workspace — all auto-generated, no manual setup needed.
45
+ On the first run, the SDK installs type definitions locally for IDE autocompletion. This creates `node_modules/`, `package.json`, `global.d.ts`, and `tsconfig.json` files in your workspace — all auto-generated, no manual setup needed. Each scene gets its own `tsconfig.json` so scenes don't interfere with each other in your editor.
46
46
 
47
47
  ### `viji dev [--port <port>] [--host <host>] [--open]`
48
48
 
@@ -83,14 +83,17 @@ After creating a few scenes, your workspace looks like this:
83
83
  my-viji-scenes/
84
84
  ├── scenes/
85
85
  │ ├── my-scene/
86
- │ │ └── main.js
86
+ │ │ ├── main.js
87
+ │ │ └── tsconfig.json # per-scene IDE config (auto-generated)
87
88
  │ ├── shader-demo/
88
89
  │ │ └── main.glsl
89
90
  │ └── p5-sketch/
90
- └── main.js
91
- ├── global.d.ts # IDE type support (auto-generated)
92
- ├── node_modules/ # type definitions (auto-generated)
93
- └── package.json # auto-generated
91
+ ├── main.js
92
+ │ └── tsconfig.json
93
+ ├── global.d.ts # IDE type support (auto-generated)
94
+ ├── tsconfig.json # shared compiler options (auto-generated)
95
+ ├── node_modules/ # type definitions (auto-generated)
96
+ └── package.json # auto-generated
94
97
  ```
95
98
 
96
99
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viji-dev/sdk",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "type": "module",
5
5
  "description": "Professional toolkit for creating interactive Viji scenes",
6
6
  "keywords": [
@@ -5,6 +5,22 @@ import { execSync } from 'child_process';
5
5
  import { getSceneTemplate, getGlobalDtsContent, getSceneFileExtension, VALID_RENDERERS } from '../../templates/scene-templates.js';
6
6
  import { validateProjectName } from '../utils/cli-utils.js';
7
7
 
8
+ const ROOT_TSCONFIG = JSON.stringify({
9
+ compilerOptions: {
10
+ target: 'ESNext',
11
+ module: 'ESNext',
12
+ moduleResolution: 'bundler',
13
+ checkJs: true,
14
+ noEmit: true,
15
+ strict: false,
16
+ },
17
+ }, null, 2) + '\n';
18
+
19
+ const SCENE_TSCONFIG = JSON.stringify({
20
+ extends: '../../tsconfig.json',
21
+ include: ['.', '../../global.d.ts'],
22
+ }, null, 2) + '\n';
23
+
8
24
  function ensureCoreTypes(cwd) {
9
25
  const coreDtsPath = join(cwd, 'node_modules', '@viji-dev', 'core', 'dist', 'artist-global.d.ts');
10
26
  if (existsSync(coreDtsPath)) return true;
@@ -47,16 +63,26 @@ export async function createCommand(sceneName, options) {
47
63
 
48
64
  const ext = getSceneFileExtension(renderer, typescript);
49
65
  const mainFile = `main${ext}`;
50
- const mainPath = join(scenePath, mainFile);
51
- await writeFile(mainPath, getSceneTemplate(renderer, typescript));
66
+ await writeFile(join(scenePath, mainFile), getSceneTemplate(renderer, typescript));
52
67
  console.log(`Created scene: scenes/${sceneName}/${mainFile} [${renderer} renderer]`);
53
68
 
54
- const globalDtsPath = join(cwd, 'global.d.ts');
55
- if (!existsSync(globalDtsPath)) {
56
- const dtsContent = getGlobalDtsContent(renderer);
57
- if (dtsContent && ensureCoreTypes(cwd)) {
58
- await writeFile(globalDtsPath, dtsContent);
59
- console.log('Created global.d.ts for IDE type support');
69
+ if (renderer !== 'shader' && ensureCoreTypes(cwd)) {
70
+ const globalDtsPath = join(cwd, 'global.d.ts');
71
+ if (!existsSync(globalDtsPath)) {
72
+ const dtsContent = getGlobalDtsContent(renderer);
73
+ if (dtsContent) {
74
+ await writeFile(globalDtsPath, dtsContent);
75
+ }
76
+ }
77
+
78
+ const rootTsconfigPath = join(cwd, 'tsconfig.json');
79
+ if (!existsSync(rootTsconfigPath)) {
80
+ await writeFile(rootTsconfigPath, ROOT_TSCONFIG);
81
+ }
82
+
83
+ const sceneTsconfigPath = join(scenePath, 'tsconfig.json');
84
+ if (!existsSync(sceneTsconfigPath)) {
85
+ await writeFile(sceneTsconfigPath, SCENE_TSCONFIG);
60
86
  }
61
87
  }
62
88