@s0rt/3dvf 0.1.2 → 0.1.3
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/index.js +46 -9
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -3572,6 +3572,43 @@ var require_picocolors = __commonJS((exports, module) => {
|
|
|
3572
3572
|
module.exports.createColors = createColors;
|
|
3573
3573
|
});
|
|
3574
3574
|
|
|
3575
|
+
// package.json
|
|
3576
|
+
var package_default;
|
|
3577
|
+
var init_package = __esm(() => {
|
|
3578
|
+
package_default = {
|
|
3579
|
+
name: "@s0rt/3dvf",
|
|
3580
|
+
version: "0.1.2",
|
|
3581
|
+
description: "shadcn-style Three.js function library CLI",
|
|
3582
|
+
type: "module",
|
|
3583
|
+
bin: {
|
|
3584
|
+
"3dvf": "./dist/cli/index.js"
|
|
3585
|
+
},
|
|
3586
|
+
files: [
|
|
3587
|
+
"dist/"
|
|
3588
|
+
],
|
|
3589
|
+
publishConfig: {
|
|
3590
|
+
access: "public"
|
|
3591
|
+
},
|
|
3592
|
+
scripts: {
|
|
3593
|
+
build: "bun build src/cli/index.ts --outdir dist/cli --target node --format esm",
|
|
3594
|
+
"build:registry": "bun run scripts/build-registry.ts",
|
|
3595
|
+
"serve:registry": "bunx serve public -p 3001",
|
|
3596
|
+
dev: "bun run src/cli/index.ts",
|
|
3597
|
+
test: "bun test"
|
|
3598
|
+
},
|
|
3599
|
+
dependencies: {
|
|
3600
|
+
commander: "^12.1.0",
|
|
3601
|
+
ora: "^8.1.1",
|
|
3602
|
+
picocolors: "^1.1.1",
|
|
3603
|
+
prompts: "^2.4.2"
|
|
3604
|
+
},
|
|
3605
|
+
devDependencies: {
|
|
3606
|
+
"@types/prompts": "^2.4.9",
|
|
3607
|
+
typescript: "^5.7.0"
|
|
3608
|
+
}
|
|
3609
|
+
};
|
|
3610
|
+
});
|
|
3611
|
+
|
|
3575
3612
|
// src/cli/utils/config.ts
|
|
3576
3613
|
var exports_config = {};
|
|
3577
3614
|
__export(exports_config, {
|
|
@@ -3583,7 +3620,6 @@ __export(exports_config, {
|
|
|
3583
3620
|
});
|
|
3584
3621
|
import {existsSync, readFileSync, writeFileSync} from "fs";
|
|
3585
3622
|
import {join} from "path";
|
|
3586
|
-
import {createRequire as createRequire2} from "module";
|
|
3587
3623
|
function readConfig(cwd = process.cwd()) {
|
|
3588
3624
|
const configPath = join(cwd, CONFIG_FILE);
|
|
3589
3625
|
if (!existsSync(configPath)) {
|
|
@@ -3599,11 +3635,10 @@ function writeConfig(config, cwd = process.cwd()) {
|
|
|
3599
3635
|
function configExists(cwd = process.cwd()) {
|
|
3600
3636
|
return existsSync(join(cwd, CONFIG_FILE));
|
|
3601
3637
|
}
|
|
3602
|
-
var
|
|
3638
|
+
var CLI_VERSION, CONFIG_FILE = "3dvf.json", BASE_REGISTRY_URL = "https://app.pierrelespingal.xyz/3dvf/registry", DEFAULT_CONFIG;
|
|
3603
3639
|
var init_config = __esm(() => {
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
CLI_VERSION = pkg.version;
|
|
3640
|
+
init_package();
|
|
3641
|
+
CLI_VERSION = package_default.version;
|
|
3607
3642
|
DEFAULT_CONFIG = {
|
|
3608
3643
|
outputDir: "src/lib/3dvf",
|
|
3609
3644
|
registry: `${BASE_REGISTRY_URL}/v${CLI_VERSION}`,
|
|
@@ -9842,16 +9877,18 @@ init_config();
|
|
|
9842
9877
|
|
|
9843
9878
|
// src/cli/utils/registry.ts
|
|
9844
9879
|
async function fetchRegistryIndex(registryUrl) {
|
|
9845
|
-
const
|
|
9880
|
+
const url = `${registryUrl}/registry.json`;
|
|
9881
|
+
const res = await fetch(url);
|
|
9846
9882
|
if (!res.ok) {
|
|
9847
|
-
throw new Error(`Failed to fetch registry index: ${res.status} ${res.statusText}`);
|
|
9883
|
+
throw new Error(`Failed to fetch registry index from ${url}: ${res.status} ${res.statusText}`);
|
|
9848
9884
|
}
|
|
9849
9885
|
return res.json();
|
|
9850
9886
|
}
|
|
9851
9887
|
async function fetchRegistryItem(registryUrl, name) {
|
|
9852
|
-
const
|
|
9888
|
+
const url = `${registryUrl}/${name}.json`;
|
|
9889
|
+
const res = await fetch(url);
|
|
9853
9890
|
if (!res.ok) {
|
|
9854
|
-
throw new Error(`Function "${name}" not found in registry (${res.status})`);
|
|
9891
|
+
throw new Error(`Function "${name}" not found in registry at ${url} (${res.status})`);
|
|
9855
9892
|
}
|
|
9856
9893
|
return res.json();
|
|
9857
9894
|
}
|