centoui-cli 0.2.1 → 0.2.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/index.mjs +8 -8
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -8,7 +8,7 @@ import { pathToFileURL } from "node:url";
8
8
  //#endregion
9
9
  //#region src/constants.ts
10
10
  /** CentoUI current package version */
11
- const VERSION = "0.2.1";
11
+ const VERSION = "0.2.2";
12
12
  /** CentoUI config file name */
13
13
  const CONFIG_FILE_NAME = "centoui.config.ts";
14
14
  /** CentoUI registry file name */
@@ -77,7 +77,7 @@ function validatePath(path) {
77
77
  * @returns The destination path for the component file.
78
78
  */
79
79
  function resolveComponentsDestinationPath(path, config, cwd) {
80
- const normalizedPath = path.replace(/^src\/components\//, "");
80
+ const normalizedPath = path.replace(/^components\//, "");
81
81
  return join(cwd, config.componentsDir, normalizedPath);
82
82
  }
83
83
  /**
@@ -188,11 +188,11 @@ function resolveComponentTree(name, registry, seen = /* @__PURE__ */ new Set())
188
188
  /**
189
189
  * Fetches the raw source code of a component or utility file from the registry.
190
190
  *
191
- * @param registryPath - Path as listed in the component registry (e.g. 'src/components/button/button.vue')
191
+ * @param path - Path as listed in the component registry (e.g. 'components/button/button.vue')
192
192
  * @returns The raw source code of the file
193
193
  */
194
- async function fetchComponentFile(registryPath) {
195
- const requestUrl = `${BASE_URL}/${registryPath}`;
194
+ async function fetchComponentFile(path) {
195
+ const requestUrl = `${BASE_URL}/${path}`;
196
196
  const response = await fetch(requestUrl, { headers: FETCH_HEADERS });
197
197
  if (!response.ok) throw new Error(`${response.status}: ${response.statusText}`);
198
198
  return response.text();
@@ -354,9 +354,9 @@ function add() {
354
354
  await tasks([...componentsToInstall.map(([name, entry]) => ({
355
355
  title: `Installing ${name}`,
356
356
  task: async () => {
357
- for (const registryPath of entry.files) {
358
- const content = await fetchComponentFile(registryPath);
359
- await writeFile(resolveComponentsDestinationPath(registryPath, config, cwd), content);
357
+ for (const path of entry.files) {
358
+ const content = await fetchComponentFile(path);
359
+ await writeFile(resolveComponentsDestinationPath(path, config, cwd), content);
360
360
  }
361
361
  return `${name} installed (${entry.files.length} file${entry.files.length !== 1 ? "s" : ""})`;
362
362
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "centoui-cli",
3
3
  "type": "module",
4
- "version": "0.2.1",
4
+ "version": "0.2.2",
5
5
  "private": false,
6
6
  "description": "Official CLI for CentoUI.",
7
7
  "author": "Favour Emeka <favorodera@gmail.com>",