@jsrepo/shadcn 0.0.1-beta.8 → 0.0.1

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
@@ -5,15 +5,12 @@
5
5
 
6
6
  A package to help you distribute your jsrepo registry as a shadcn registry.
7
7
 
8
- > [!WARNING]
9
- > Users can only use the **shadcn** CLI to add items from a registry output by this plugin.
10
-
11
8
  ## Usage
12
9
 
13
10
  Install the package:
14
11
 
15
12
  ```sh
16
- pnpm install @jsrepo/shadcn
13
+ pnpm install @jsrepo/shadcn -D
17
14
  ```
18
15
 
19
16
  Use the output to output a shadcn registry:
@@ -25,14 +22,11 @@ import { output } from "@jsrepo/shadcn/output";
25
22
  export default defineConfig({
26
23
  registry: {
27
24
  // ...
28
- outputs: [output({ dir: "./public/r/shadcn" })],
25
+ outputs: [output({ dir: "./public/r" })],
29
26
  },
30
27
  });
31
28
  ```
32
29
 
33
- > [!IMPORTANT]
34
- > If you have multiple outputs you need to ensure that the directory is unique for each output. jsrepo outputs will conflict with shadcn outputs.
35
-
36
30
  If you want to ensure compatibility with the shadcn registry while losing access to some of the features of the jsrepo registry you can use the `defineShadcnRegistry` function. This can also be useful for incremental adoption as it closely matches the shadcn registry schema.
37
31
 
38
32
  ```ts
@@ -42,7 +36,7 @@ export default defineConfig({
42
36
  registry: defineShadcnRegistry({
43
37
  // ...
44
38
  // make sure you still include the output
45
- outputs: [output({ dir: "./public/r/shadcn" })],
39
+ outputs: [output({ dir: "./public/r" })],
46
40
  }),
47
41
  });
48
42
  ```
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { n as output, t as OutputOptions } from "./output-CKieuEU1.js";
1
+ import { n as output, t as OutputOptions } from "./output-DR1ZWDBj.js";
2
+ import { n as provider } from "./provider-v0pBRKCX.js";
2
3
  import { Output, RegistryConfig } from "jsrepo";
3
4
  import { registryItemTypeSchema } from "shadcn/schema";
4
5
 
@@ -13,6 +14,8 @@ type ShadcnRegistry = {
13
14
  };
14
15
  type ShadcnRegistryItem = {
15
16
  name: string;
17
+ /** Human readable title of the item */
18
+ title?: string;
16
19
  type: ShadcnRegistryItemType;
17
20
  description?: string;
18
21
  files: Array<{
@@ -38,8 +41,16 @@ type ShadcnRegistryItem = {
38
41
  * Environment variables that are required for the item to work. These will be added to the users `.env` or `.env.local` file. NEVER ADD SECRETS HERE.
39
42
  */
40
43
  envVars?: Record<string, string>;
44
+ /**
45
+ * Organize your registry item.
46
+ */
47
+ categories?: string[];
48
+ /**
49
+ * Add additional metadata to your registry item.
50
+ */
51
+ meta?: Record<string, string>;
41
52
  };
42
53
  declare function defineShadcnRegistry(registry: ShadcnRegistry): RegistryConfig;
43
54
  //#endregion
44
- export { OutputOptions, ShadcnRegistry, ShadcnRegistryItem, ShadcnRegistryItemType, defineShadcnRegistry, output };
55
+ export { OutputOptions, ShadcnRegistry, ShadcnRegistryItem, ShadcnRegistryItemType, provider as default, defineShadcnRegistry, output };
45
56
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{t as e}from"./output-oZQMHaJS.js";import{JsrepoError as t}from"jsrepo";const n=/^(@[^/]+\/[^@/]+)(?:@([^/]+))?(\/.*)?$/,r=/^([^@/]+)(?:@([^/]+))?(\/.*)?$/;function i(e){let t=n.exec(e)||r.exec(e);if(t)return{name:t[1]||``,version:t[2]||void 0,path:t[3]||``}}function a(e){return{...e,items:e.items.map(e=>({...e,dependencies:e.dependencies?.map(e=>{let n=i(e);if(n===void 0)throw new t(`Invalid package name: ${e}`,{suggestion:`Please provide a valid package name.`});return{ecosystem:`js`,name:n.name,version:n.version}})}))}}export{a as defineShadcnRegistry,e as output};
1
+ import{t as e}from"./output-oZQMHaJS.js";import{t}from"./provider-w0GjKOJb.js";import{JsrepoError as n}from"jsrepo";const r=/^(@[^/]+\/[^@/]+)(?:@([^/]+))?(\/.*)?$/,i=/^([^@/]+)(?:@([^/]+))?(\/.*)?$/;function a(e){let t=r.exec(e)||i.exec(e);if(t)return{name:t[1]||``,version:t[2]||void 0,path:t[3]||``}}function o(e){return{...e,items:e.items.map(e=>({...e,dependencies:e.dependencies?.map(e=>{let t=a(e);if(t===void 0)throw new n(`Invalid package name: ${e}`,{suggestion:`Please provide a valid package name.`});return{ecosystem:`js`,name:t.name,version:t.version}})}))}}export{t as default,o as defineShadcnRegistry,e as output};
2
2
  //# sourceMappingURL=index.js.map
@@ -8,4 +8,4 @@ type OutputOptions = {
8
8
  declare function output(options: OutputOptions): Output;
9
9
  //#endregion
10
10
  export { output as n, OutputOptions as t };
11
- //# sourceMappingURL=output-CKieuEU1.d.ts.map
11
+ //# sourceMappingURL=output-DR1ZWDBj.d.ts.map
package/dist/output.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as output, t as OutputOptions } from "./output-CKieuEU1.js";
1
+ import { n as output, t as OutputOptions } from "./output-DR1ZWDBj.js";
2
2
  export { OutputOptions, output };
@@ -0,0 +1,35 @@
1
+ import { ProviderFactory } from "jsrepo/providers";
2
+
3
+ //#region src/provider.d.ts
4
+ type ShadcnOptions = {
5
+ /**
6
+ * The base url of the registry index.
7
+ *
8
+ * @default https://ui.shadcn.com/r/registries.json
9
+ */
10
+ registryIndexUrl?: string;
11
+ };
12
+ /**
13
+ * A provider for the shadcn registry index.
14
+ * @param options
15
+ * @returns
16
+ *
17
+ * @urlFormat
18
+ * ```
19
+ * shadcn:@react-bits
20
+ * ```
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * import { defineConfig } from "jsrepo/config";
25
+ * import shadcn from "@jsrepo/shadcn";
26
+ *
27
+ * export default defineConfig({
28
+ * providers: [shadcn()],
29
+ * });
30
+ * ```
31
+ */
32
+ declare function provider(options?: ShadcnOptions): ProviderFactory;
33
+ //#endregion
34
+ export { provider as n, ShadcnOptions as t };
35
+ //# sourceMappingURL=provider-v0pBRKCX.d.ts.map
@@ -0,0 +1,2 @@
1
+ import{JsrepoError as e,ProviderFetchError as t}from"jsrepo/errors";function n(e={}){return{name:`shadcn`,matches:e=>e.startsWith(`shadcn:`),create:(t,n)=>r.create(t,e,n)}}var r=class n{constructor(e,t){this.state=e,this.opts=t}async fetch(e,{fetch:n=fetch}){let r=this.state.registryUrl.replace(`{name}`,e.replace(`.json`,``));try{let e=await n(r.toString());if(!e.ok)throw e.headers.get(`content-type`)?.includes(`application/json`)?new t(`${e.status} ${(await e.json()).message??e.statusText}`,r.toString()):new t(`${e.status} ${e.statusText}`,r.toString());return await e.text()}catch(e){throw e instanceof t?new t(e.originalMessage,r.toString()):new t(`${e instanceof Error?e.message:String(e)}`,r.toString())}}static async create(t,r,{fetch:i=fetch}){let a=t.slice(7),o=r.registryIndexUrl??`https://ui.shadcn.com/r/registries.json`;try{let t=await i(o);if(!t.ok)throw new e(`Failed to fetch registry index ${t.status} ${t.statusText}`,{suggestion:`Please try again`});let s=(await t.json())[a];if(!s)throw new e(`Registry ${a} not found in registry index`,{suggestion:`Please check the registry name`});return new n({registryUrl:s},r)}catch{throw new e(`Failed to fetch registry index at ${o}`,{suggestion:`Please try again`})}}};export{n as t};
2
+ //# sourceMappingURL=provider-w0GjKOJb.js.map
@@ -0,0 +1,2 @@
1
+ import { n as provider, t as ShadcnOptions } from "./provider-v0pBRKCX.js";
2
+ export { ShadcnOptions, provider };
@@ -0,0 +1 @@
1
+ import{t as e}from"./provider-w0GjKOJb.js";export{e as provider};
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@jsrepo/shadcn",
3
3
  "description": "A package to help you distribute your jsrepo registry as a shadcn registry.",
4
- "version": "0.0.1-beta.8",
4
+ "version": "0.0.1",
5
5
  "license": "MIT",
6
- "homepage": "https://v3.jsrepo.dev/docs/outputs/shadcn",
6
+ "homepage": "https://jsrepo.dev/docs/outputs/shadcn",
7
7
  "author": {
8
8
  "name": "Aidan Bleser",
9
9
  "url": "https://github.com/ieedan"
@@ -31,6 +31,10 @@
31
31
  "./output": {
32
32
  "types": "./dist/output.d.ts",
33
33
  "default": "./dist/output.js"
34
+ },
35
+ "./provider": {
36
+ "types": "./dist/provider.d.ts",
37
+ "default": "./dist/provider.js"
34
38
  }
35
39
  },
36
40
  "main": "./dist/index.js",
@@ -39,7 +43,7 @@
39
43
  "!dist/**/*.map"
40
44
  ],
41
45
  "peerDependencies": {
42
- "jsrepo": "3.0.0-beta.8"
46
+ "jsrepo": "3.0.0"
43
47
  },
44
48
  "devDependencies": {
45
49
  "@types/node": "^24.10.0",