@s0rt/3dvf 0.1.0 → 0.1.2

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +16 -7
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -3578,10 +3578,12 @@ __export(exports_config, {
3578
3578
  writeConfig: () => writeConfig,
3579
3579
  readConfig: () => readConfig,
3580
3580
  configExists: () => configExists,
3581
- DEFAULT_CONFIG: () => DEFAULT_CONFIG
3581
+ DEFAULT_CONFIG: () => DEFAULT_CONFIG,
3582
+ CLI_VERSION: () => CLI_VERSION
3582
3583
  });
3583
3584
  import {existsSync, readFileSync, writeFileSync} from "fs";
3584
3585
  import {join} from "path";
3586
+ import {createRequire as createRequire2} from "module";
3585
3587
  function readConfig(cwd = process.cwd()) {
3586
3588
  const configPath = join(cwd, CONFIG_FILE);
3587
3589
  if (!existsSync(configPath)) {
@@ -3597,11 +3599,14 @@ function writeConfig(config, cwd = process.cwd()) {
3597
3599
  function configExists(cwd = process.cwd()) {
3598
3600
  return existsSync(join(cwd, CONFIG_FILE));
3599
3601
  }
3600
- var CONFIG_FILE = "3dvf.json", DEFAULT_CONFIG;
3602
+ var require2, pkg, CLI_VERSION, CONFIG_FILE = "3dvf.json", BASE_REGISTRY_URL = "https://app.pierrelespingal.xyz/3dvf/registry", DEFAULT_CONFIG;
3601
3603
  var init_config = __esm(() => {
3604
+ require2 = createRequire2(import.meta.url);
3605
+ pkg = require2("../../../package.json");
3606
+ CLI_VERSION = pkg.version;
3602
3607
  DEFAULT_CONFIG = {
3603
3608
  outputDir: "src/lib/3dvf",
3604
- registry: "https://pierreleblond.github.io/3d-viewer-functions/registry",
3609
+ registry: `${BASE_REGISTRY_URL}/v${CLI_VERSION}`,
3605
3610
  typescript: true
3606
3611
  };
3607
3612
  });
@@ -9875,16 +9880,20 @@ function collectDeps(items) {
9875
9880
  // src/cli/utils/write.ts
9876
9881
  import {mkdirSync, writeFileSync as writeFileSync2} from "fs";
9877
9882
  import {dirname, join as join2} from "path";
9878
- function writeRegistryItem(item, outputDir, cwd = process.cwd()) {
9883
+ function writeRegistryItem(item, outputDir, version, cwd = process.cwd()) {
9879
9884
  const written = [];
9885
+ const itemDir = join2(cwd, outputDir, item.name);
9880
9886
  for (const file of item.files) {
9881
- const dest = join2(cwd, outputDir, item.name, file.path);
9887
+ const dest = join2(itemDir, file.path);
9882
9888
  mkdirSync(dirname(dest), { recursive: true });
9883
9889
  writeFileSync2(dest, file.content, "utf-8");
9884
9890
  written.push(dest);
9885
9891
  }
9892
+ const stampPath = join2(itemDir, VERSION_STAMP_FILE);
9893
+ writeFileSync2(stampPath, version, "utf-8");
9886
9894
  return written;
9887
9895
  }
9896
+ var VERSION_STAMP_FILE = ".3dvf-version";
9888
9897
 
9889
9898
  // src/cli/utils/packageManager.ts
9890
9899
  import {existsSync as existsSync2} from "fs";
@@ -9934,9 +9943,9 @@ async function addCommand(names) {
9934
9943
  const items = [...tree.values()];
9935
9944
  const written = [];
9936
9945
  for (const item of items) {
9937
- const paths = writeRegistryItem(item, config2.outputDir);
9946
+ const paths = writeRegistryItem(item, config2.outputDir, CLI_VERSION);
9938
9947
  written.push(...paths);
9939
- console.log(import_picocolors.default.green("\u2713") + ` Installed ${import_picocolors.default.bold(item.name)}`);
9948
+ console.log(import_picocolors.default.green("\u2713") + ` Installed ${import_picocolors.default.bold(item.name)} ${import_picocolors.default.dim(`(v${CLI_VERSION})`)}`);
9940
9949
  for (const p of paths) {
9941
9950
  console.log(import_picocolors.default.dim(` ${p.replace(process.cwd() + "/", "")}`));
9942
9951
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s0rt/3dvf",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "shadcn-style Three.js function library CLI",
5
5
  "type": "module",
6
6
  "bin": {