editor-sdk 1.1.9 → 1.1.10
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/dist/cli.js +60 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -31,7 +31,7 @@ function loadConfig() {
|
|
|
31
31
|
program
|
|
32
32
|
.name('3d-editor')
|
|
33
33
|
.description('CLI to install 3D components from the registry')
|
|
34
|
-
.version('1.
|
|
34
|
+
.version('1.1.10');
|
|
35
35
|
// Login Command
|
|
36
36
|
program
|
|
37
37
|
.command('login')
|
|
@@ -222,15 +222,71 @@ program
|
|
|
222
222
|
process.exit(0);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
//
|
|
226
|
-
//
|
|
225
|
+
// Determine the Registry Origin to bake into the component
|
|
226
|
+
// If user provided a full URL (e.g. from Vercel), use that origin.
|
|
227
|
+
// If user used default (localhost), use localhost.
|
|
228
|
+
let registryOrigin = defaultHost; // Default fallback from line 126
|
|
229
|
+
try {
|
|
230
|
+
const urlObj = new URL(registryUrl);
|
|
231
|
+
registryOrigin = urlObj.origin;
|
|
232
|
+
}
|
|
233
|
+
catch (e) {
|
|
234
|
+
// If invalid URL, fallback
|
|
235
|
+
}
|
|
236
|
+
// Determine default registry URL logic
|
|
237
|
+
// Always bake in the origin we fetched from. This ensures:
|
|
238
|
+
// 1. Localhost installs (port 3000) work even if consumer app is on port 3001.
|
|
239
|
+
// 2. Remote installs (vercel) lock in the production URL.
|
|
240
|
+
// 3. Prop 'registryUrl' still allows manual override.
|
|
241
|
+
const registryValue = `{registryUrl || '${registryOrigin}'}`;
|
|
242
|
+
// The Shell Code with exposed props
|
|
227
243
|
const shellCode = `import React from 'react';
|
|
228
244
|
import { SecureScene } from 'editor-sdk';
|
|
229
245
|
|
|
230
|
-
|
|
246
|
+
interface ${componentName}Props {
|
|
247
|
+
/** Position in 3D space [x, y, z] */
|
|
248
|
+
position?: [number, number, number];
|
|
249
|
+
/** Rotation in radians [x, y, z] */
|
|
250
|
+
rotation?: [number, number, number];
|
|
251
|
+
/** Scale [x, y, z] */
|
|
252
|
+
scale?: [number, number, number];
|
|
253
|
+
/** Animation configuration */
|
|
254
|
+
animation?: {
|
|
255
|
+
type: 'none' | 'rotate' | 'float' | 'pulse' | 'bounce' | 'shake';
|
|
256
|
+
speed?: number;
|
|
257
|
+
intensity?: number;
|
|
258
|
+
axis?: 'x' | 'y' | 'z';
|
|
259
|
+
};
|
|
260
|
+
/** Override registry URL */
|
|
261
|
+
registryUrl?: string;
|
|
262
|
+
/** Additional props passed to SecureScene */
|
|
263
|
+
[key: string]: any;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* ${componentName} - 3D Component
|
|
268
|
+
*
|
|
269
|
+
* This component fetches its default configuration from the registry.
|
|
270
|
+
* Origin: ${registryOrigin}
|
|
271
|
+
*
|
|
272
|
+
* You can override position, rotation, scale, and animation via props.
|
|
273
|
+
*/
|
|
274
|
+
export default function ${componentName}({
|
|
275
|
+
position,
|
|
276
|
+
rotation,
|
|
277
|
+
scale,
|
|
278
|
+
animation,
|
|
279
|
+
registryUrl,
|
|
280
|
+
...props
|
|
281
|
+
}: ${componentName}Props) {
|
|
231
282
|
return (
|
|
232
283
|
<SecureScene
|
|
233
284
|
id="${id}"
|
|
285
|
+
registryUrl=${registryValue}
|
|
286
|
+
position={position}
|
|
287
|
+
rotation={rotation}
|
|
288
|
+
scale={scale}
|
|
289
|
+
animation={animation}
|
|
234
290
|
{...props}
|
|
235
291
|
/>
|
|
236
292
|
);
|