regpick 0.4.0 → 0.6.0
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/index.mjs +1 -1
- package/package.json +18 -5
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e from"node:path";import t from"picocolors";import n from"node:fs/promises";import{cosmiconfig as r}from"cosmiconfig";import{fileURLToPath as i}from"node:url";import a from"node:crypto";import*as o from"diff";import s from"node:fs";import{autocompleteMultiselect as c,cancel as l,confirm as u,intro as d,isCancel as f,log as p,multiselect as m,outro as h,select as g,text as _}from"@clack/prompts";import{spawnSync as v}from"node:child_process";function y(e,t,n){return{kind:e,message:t,cause:n}}function b(e,t=`RuntimeError`){return typeof e==`object`&&e&&`kind`in e&&`message`in e&&typeof e.kind==`string`&&typeof e.message==`string`?e:e instanceof Error?y(t,e.message,e):y(t,String(e))}function x(e){return{ok:!0,value:e}}function S(e){return{ok:!1,error:e}}function C(e){return e.replace(/\\/g,`/`)}function w(t,n,r){let i=`${e.resolve(t)}${e.sep}`,a=e.resolve(n);return r?x(void 0):a!==e.resolve(t)&&!a.startsWith(i)?S(y(`ValidationError`,`Refusing to write outside project: ${a}`)):x(void 0)}function T(t,n,r,i){let a=n.type||t.type||`registry:file`,o=i.targetsByType?.[a],s=i.preferManifestTarget!==!1,c=e.basename(n.path||`${t.name}.txt`),l;l=s&&n.target?n.target:o?e.join(o,c):n.target?n.target:e.join(`src`,c);let u=e.resolve(r,l),d=w(r,u,!!i.allowOutsideProject);return d.ok?x({absoluteTarget:u,relativeTarget:C(e.relative(r,u))}):d}function E(e){return[...new Set(e.filter(Boolean))]}function D(e){return{dependencies:E(e.flatMap(e=>e.dependencies||[])),devDependencies:E(e.flatMap(e=>e.devDependencies||[]))}}function O(e,t,n,r=new Set){let i=[],a=[];for(let o of e)for(let e of o.files){let s=T(o,e,t,n);if(!s.ok)return s;let{absoluteTarget:c,relativeTarget:l}=s.value,u={itemName:o.name,sourceFile:e,absoluteTarget:c,relativeTarget:l};i.push(u),r.has(c)&&a.push(u)}return x({selectedItems:e,plannedWrites:i,dependencyPlan:D(e),conflicts:a})}function ee(e){return e?String(e).split(`,`).map(e=>e.trim()).filter(Boolean):[]}function te(e,t){let{flags:n}=t.args,r=ee(n.select);if(n.all)return x(e);if(r.length){let t=e.filter(e=>r.includes(e.name));return t.length?x(t):S(y(`ValidationError`,`No items matched --select=${String(n.select)}`))}return x(null)}const k={registries:{tebra:`./tebra-icon-registry/registry`},targetsByType:{"registry:icon":`src/components/ui/icons`,"registry:component":`src/components/ui`,"registry:file":`src/components/ui`},aliases:{},overwritePolicy:`prompt`,packageManager:`auto`,preferManifestTarget:!0,allowOutsideProject:!1};function A(t){return e.join(t,`regpick.json`)}async function j(e){let t=await r(`regpick`,{searchPlaces:[`regpick.json`,`.regpickrc`,`.regpickrc.json`]}).search(e);if(!t||!t.config)return{config:{...k},configPath:null};let n=t.config;return{config:{...k,...n,registries:{...k.registries,...n.registries||{}},targetsByType:{...k.targetsByType,...n.targetsByType||{}},aliases:{...k.aliases,...n.aliases||{}}},configPath:t.filepath}}async function ne(e,t,{overwrite:r=!1}={}){let i=A(e),a=!1;try{await n.access(i),a=!0}catch{}return a&&!r?{filePath:i,written:!1}:(await n.writeFile(i,JSON.stringify(t,null,2),`utf8`),{filePath:i,written:!0})}function M(e,t){return e?t.registries[e]?String(t.registries[e]):e:null}function N(e){return e?Array.isArray(e)?e.filter(e=>typeof e==`string`):typeof e==`string`?[e]:[]:[]}function P(e){return Array.isArray(e)?e.filter(e=>!!(e&&typeof e==`object`)):[]}function F(e,t){let n=P(e.files).map(t=>({path:typeof t.path==`string`?t.path:void 0,target:typeof t.target==`string`?t.target:void 0,type:typeof t.type==`string`?t.type:typeof e.type==`string`?e.type:`registry:file`,content:typeof t.content==`string`?t.content:void 0,url:typeof t.url==`string`?t.url:void 0})),r=typeof e.name==`string`?e.name:typeof e.title==`string`?e.title:`unnamed-item`;return{name:r,title:typeof e.title==`string`?e.title:r,description:typeof e.description==`string`?e.description:``,type:typeof e.type==`string`?e.type:`registry:file`,dependencies:N(e.dependencies),devDependencies:N(e.devDependencies),registryDependencies:N(e.registryDependencies),files:n,sourceMeta:t}}function re(e){return P(e.items).map(e=>Array.isArray(e.files)?null:typeof e.url==`string`?e.url:typeof e.href==`string`?e.href:typeof e.path==`string`?e.path:null).filter(e=>!!e)}function ie(e,t){return Array.isArray(e)?x(e.filter(e=>!!(e&&typeof e==`object`)).map(e=>F(e,t))):e&&typeof e==`object`&&Array.isArray(e.items)?x(P(e.items).filter(e=>Array.isArray(e.files)).map(e=>F(e,t))):e&&typeof e==`object`&&Array.isArray(e.files)?x([F(e,t)]):S(y(`RegistryError`,`Unsupported manifest structure.`))}function I(e){return/^https?:\/\//i.test(e)}function L(e){return/^file:\/\//i.test(e)}function R(e,t){return new URL(t,e).toString()}async function z(t,n,r){let i=ie(t,n);if(!t||typeof t!=`object`||Array.isArray(t))return i;let a=re(t);if(!a.length)return i;let o=i.ok?i.value:[],s=[];for(let t of a){let i;if(I(t)){let e=await r.http.getJson(t);if(!e.ok)return S(e.error);i=e.value}else if(n.type===`http`&&n.baseUrl){let e=await r.http.getJson(R(n.baseUrl,t));if(!e.ok)return S(e.error);i=e.value}else if((n.type===`file`||n.type===`directory`)&&n.baseDir){let a=await r.fs.readFile(e.resolve(n.baseDir,t),`utf8`);if(!a.ok)return S(a.error);try{i=JSON.parse(a.value)}catch{return S(y(`RegistryError`,`Invalid JSON: ${t}`))}}else{let n=await r.fs.readFile(e.resolve(t),`utf8`);if(!n.ok)return S(n.error);try{i=JSON.parse(n.value)}catch{return S(y(`RegistryError`,`Invalid JSON: ${t}`))}}i&&typeof i==`object`&&s.push(F(i,n))}return x([...o,...s])}async function ae(t,n){let r=e.resolve(t),i=await n.fs.readdir(r);if(!i.ok)return S(i.error);let a=i.value.filter(e=>e.endsWith(`.json`)),o=[];for(let t of a){let i=e.join(r,t),a=await n.fs.readFile(i,`utf8`);if(!a.ok)return S(a.error);let s;try{s=JSON.parse(a.value)}catch{continue}!s||typeof s!=`object`||!Array.isArray(s.files)||o.push(F(s,{type:`directory`,baseDir:r}))}return x(o)}async function B(t,n,r){if(!t)return S(y(`ValidationError`,`Registry source is required.`));let a=I(t)||L(t)?t:e.resolve(n,t);if(I(a)){let e=await r.http.getJson(a);if(!e.ok)return S(e.error);let t=a.endsWith(`/`)?a:a.replace(/[^/]*$/,``),n=await z(e.value,{type:`http`,baseUrl:t},r);return n.ok?x({items:n.value,source:a}):S(n.error)}let o=L(a)?i(new URL(a)):e.resolve(a),s=await r.fs.stat(o);if(!s.ok)return S(y(`RegistryError`,`Registry source not found: ${t}`));if(s.value.isDirectory()){let e=await ae(o,r);return e.ok?x({items:e.value,source:o}):S(e.error)}let c=await r.fs.readFile(o,`utf8`);if(!c.ok)return S(c.error);let l;try{l=JSON.parse(c.value)}catch(e){return S(y(`RegistryError`,`Failed to parse registry JSON.`,e))}let u=await z(l,{type:`file`,baseDir:e.dirname(o)},r);return u.ok?x({items:u.value,source:o}):S(u.error)}async function V(t,n,r,i){if(typeof t.content==`string`)return x(t.content);let a=t.url||t.path;if(!a)return S(y(`ValidationError`,`File entry in "${n.name}" is missing both content and path/url.`));if(I(a))return await i.http.getText(a);if(n.sourceMeta.type===`http`&&n.sourceMeta.baseUrl){let e=R(n.sourceMeta.baseUrl,a);return await i.http.getText(e)}let o=n.sourceMeta.baseDir&&!e.isAbsolute(a)?e.resolve(n.sourceMeta.baseDir,a):e.resolve(r,a);return await i.fs.readFile(o,`utf8`)}function oe(e,t){let n=[];return e.length&&n.push({command:`npm`,args:[`install`,...e]}),t.length&&n.push({command:`npm`,args:[`install`,`-D`,...t]}),n}function se(e,t){let n=[];return e.length&&n.push({command:`yarn`,args:[`add`,...e]}),t.length&&n.push({command:`yarn`,args:[`add`,`-D`,...t]}),n}function ce(e,t){let n=[];return e.length&&n.push({command:`pnpm`,args:[`add`,...e]}),t.length&&n.push({command:`pnpm`,args:[`add`,`-D`,...t]}),n}const le={npm:{manager:`npm`,buildInstallCommands:oe},yarn:{manager:`yarn`,buildInstallCommands:se},pnpm:{manager:`pnpm`,buildInstallCommands:ce}};function H(e){return le[e]}function U(e){return[...new Set(e.filter(Boolean))]}function ue(t,n,r){let i=e.join(n,`package.json`);if(!r.fs.existsSync(i))return{missingDependencies:[],missingDevDependencies:[]};let a=r.fs.readJsonSync(i),o=a.ok?a.value:{},s={...o.dependencies||{},...o.devDependencies||{},...o.peerDependencies||{}},c=U(t.flatMap(e=>e.dependencies||[])),l=U(t.flatMap(e=>e.devDependencies||[]));return{missingDependencies:c.filter(e=>!s[e]),missingDevDependencies:l.filter(e=>!s[e])}}function de(e,t,n,r,i){if(!n.length&&!r.length)return x(void 0);let a=H(t).buildInstallCommands(n,r);for(let t of a)if(i.process.run(t.command,t.args,e).status!==0)return S(y(`InstallError`,`Dependency install failed: ${t.command} ${t.args.join(` `)}`));return x(void 0)}function W(t,n,r){return n&&n!==`auto`?n:r.fs.existsSync(e.join(t,`pnpm-lock.yaml`))?`pnpm`:r.fs.existsSync(e.join(t,`yarn.lock`))?`yarn`:(r.fs.existsSync(e.join(t,`package-lock.json`)),`npm`)}function G(t){return e.join(t,`regpick-lock.json`)}async function K(e,t){let n=G(e);if(!await t.fs.pathExists(n))return{components:{}};let r=t.fs.readJsonSync(n);return r.ok?r.value:{components:{}}}async function q(e,t,n){let r=G(e);await n.fs.writeJson(r,t,{spaces:2})}function J(e){return a.createHash(`sha256`).update(e).digest(`hex`)}function Y(e,t){let n=e;for(let[e,r]of Object.entries(t.aliases||{})){let t=RegExp(`from ["']${e}(.*?)["']`,`g`);n=n.replace(t,`from "${r}$1"`);let i=RegExp(`import\\(["']${e}(.*?)["']\\)`,`g`);n=n.replace(i,`import("${r}$1")`)}return n}async function fe(e,t,n){let r=n[1];if(r)return x(M(r,t));let i=Object.entries(t.registries||{}).map(([e,t])=>({label:`${e} -> ${t}`,value:e}));if(i.length){let n=await e.runtime.prompt.multiselect({message:`Pick registry alias (or cancel and provide URL/path manually)`,options:i,maxItems:1,required:!1});if(e.runtime.prompt.isCancel(n))return S(y(`UserCancelled`,`Operation cancelled.`));if(Array.isArray(n)&&n.length>0)return x(M(String(n[0]),t))}let a=await e.runtime.prompt.text({message:`Registry URL/path:`,placeholder:`https://example.com/registry.json`});return e.runtime.prompt.isCancel(a)?S(y(`UserCancelled`,`Operation cancelled.`)):x(String(a))}function pe(e){return e.map(e=>({value:e.name,label:`${e.name} (${e.type||`registry:file`})`,hint:e.description||`${e.files.length} file(s)`}))}async function me(e,t){if(!t.length)return x([]);let n=await e.runtime.prompt.autocompleteMultiselect({message:`Select items to install`,options:pe(t),maxItems:10,required:!0});if(e.runtime.prompt.isCancel(n))return S(y(`UserCancelled`,`Operation cancelled.`));let r=Array.isArray(n)?n:[],i=new Set(r.map(e=>String(e)));return x(t.filter(e=>i.has(e.name)))}async function he(t){let n=!!t.args.flags.yes,{config:r}=await j(t.cwd),i=await fe(t,r,t.args.positionals);if(!i.ok)return i;let a=i.value;if(!a)return x({kind:`noop`,message:`No registry source provided.`});let o=await B(a,t.cwd,t.runtime);if(!o.ok)return o;let{items:s}=o.value;if(!s.length)return t.runtime.prompt.warn(`No installable items in registry.`),x({kind:`noop`,message:`No installable items in registry.`});let c=te(s,t),l=c.ok&&c.value?c:await me(t,s);if(!l.ok)return l;let u=l.value;if(!u||!u.length)return t.runtime.prompt.warn(`No items selected.`),x({kind:`noop`,message:`No items selected.`});if(!n){let e=await t.runtime.prompt.confirm({message:`Install ${u.length} item(s)?`,initialValue:!0});if(t.runtime.prompt.isCancel(e)||!e)return S(y(`UserCancelled`,`Operation cancelled.`))}let d=new Set,f=O(u,t.cwd,r);if(!f.ok)return f;let p=f.value;for(let e of p.plannedWrites)await t.runtime.fs.pathExists(e.absoluteTarget)&&d.add(e.absoluteTarget);let m=O(u,t.cwd,r,d);if(!m.ok)return m;let h=m.value,g=[];for(let e of h.plannedWrites)if(d.has(e.absoluteTarget))if(n||r.overwritePolicy===`overwrite`)g.push(e);else if(r.overwritePolicy===`skip`)t.runtime.prompt.warn(`Skipped existing file: ${e.absoluteTarget}`);else{let n=await t.runtime.prompt.select({message:`File exists: ${e.absoluteTarget}`,options:[{value:`overwrite`,label:`Overwrite this file`},{value:`skip`,label:`Skip this file`},{value:`abort`,label:`Abort installation`}]});if(t.runtime.prompt.isCancel(n)||n===`abort`)return S(y(`UserCancelled`,`Installation aborted by user.`));n===`overwrite`&&g.push(e)}else g.push(e);let{missingDependencies:_,missingDevDependencies:v}=ue(u,t.cwd,t.runtime),b=!1;if(_.length||v.length)if(n)b=!0;else{let e=W(t.cwd,r.packageManager,t.runtime),n=[];_.length&&n.push(`dependencies: ${_.join(`, `)}`),v.length&&n.push(`devDependencies: ${v.join(`, `)}`);let i=await t.runtime.prompt.confirm({message:`Install missing packages with ${e}? (${n.join(` | `)})`,initialValue:!0});if(t.runtime.prompt.isCancel(i))return S(y(`UserCancelled`,`Dependency installation cancelled by user.`));b=!!i,b||t.runtime.prompt.warn(`Skipped dependency installation.`)}let C=0,w=await K(t.cwd,t.runtime),T={};for(let n of g){let i=u.find(e=>e.name===n.itemName);if(!i)continue;let a=await V(n.sourceFile,i,t.cwd,t.runtime);if(!a.ok)return a;let o=Y(a.value,r),s=await t.runtime.fs.ensureDir(e.dirname(n.absoluteTarget));if(!s.ok)return s;let c=await t.runtime.fs.writeFile(n.absoluteTarget,o,`utf8`);if(!c.ok)return c;let l=J(o);T[i.name]||(T[i.name]=[]),T[i.name].push(l),C+=1,t.runtime.prompt.success(`Wrote ${n.relativeTarget}`)}if(C>0){for(let[e,t]of Object.entries(T)){let n=J(t.sort().join(``));w.components[e]={source:a,hash:n}}await q(t.cwd,w,t.runtime)}if(b){let e=W(t.cwd,r.packageManager,t.runtime),n=de(t.cwd,e,_,v,t.runtime);if(!n.ok)return n}return t.runtime.prompt.info(`Installed ${u.length} item(s), wrote ${C} file(s).`),x({kind:`success`,message:`Installed ${u.length} item(s), wrote ${C} file(s).`})}function ge(e,t){return e?`cancelled`:t?`overwrite`:`keep`}async function _e(e){let t=A(e.cwd),n=await e.runtime.fs.stat(t);if(n.ok){let n=await e.runtime.prompt.confirm({message:`${t} already exists. Overwrite?`,initialValue:!1}),r=ge(e.runtime.prompt.isCancel(n),!!n);if(r===`cancelled`)return S(y(`UserCancelled`,`Operation cancelled.`));if(r===`keep`)return e.runtime.prompt.info(`Keeping existing configuration.`),x({kind:`noop`,message:`Keeping existing configuration.`})}let{config:r}=await j(e.cwd),i=await e.runtime.prompt.select({message:`Jakiego menedżera pakietów używasz?`,options:[{value:`auto`,label:`Auto (wykrywanie)`},{value:`npm`,label:`npm`},{value:`yarn`,label:`yarn`},{value:`pnpm`,label:`pnpm`}]});if(e.runtime.prompt.isCancel(i))return S(y(`UserCancelled`,`Operation cancelled.`));let a=await e.runtime.prompt.text({message:`W jakim folderze trzymasz komponenty UI?`,placeholder:`src/components/ui`});if(e.runtime.prompt.isCancel(a))return S(y(`UserCancelled`,`Operation cancelled.`));let o=await e.runtime.prompt.select({message:`Czy chcesz nadpisywać pliki automatycznie, czy wolisz być pytany?`,options:[{value:`prompt`,label:`Pytaj (prompt)`},{value:`overwrite`,label:`Zawsze nadpisuj (overwrite)`},{value:`skip`,label:`Pomijaj nadpisywanie (skip)`}]});if(e.runtime.prompt.isCancel(o))return S(y(`UserCancelled`,`Operation cancelled.`));let s={...r,packageManager:String(i),overwritePolicy:String(o),targetsByType:{...r.targetsByType,"registry:component":String(a||`src/components/ui`),"registry:file":String(a||`src/components/ui`),"registry:icon":`${String(a||`src/components/ui`)}/icons`}};return await ne(e.cwd,s,{overwrite:!0}),e.runtime.prompt.success(`${n.ok?`Overwrote`:`Created`} ${t}`),x({kind:`success`,message:`${n.ok?`Overwrote`:`Created`} ${t}`})}function X(e,t){return e?t[e]?String(t[e]):e:null}function ve(e,t){let n=X(e,t);if(n)return{source:n,requiresPrompt:!1};let r=Object.keys(t)[0];return r?{source:X(r,t),requiresPrompt:!1}:{source:null,requiresPrompt:!0}}function ye(e){let t=e.type||`registry:file`,n=Array.isArray(e.files)?e.files.length:0;return`${e.name} (${t}, files: ${n})`}async function be(e){let{config:t}=await j(e.cwd),n=ve(e.args.positionals[1],t.registries),r=n.source;if(n.requiresPrompt){let t=await e.runtime.prompt.text({message:`Registry URL/path:`,placeholder:`https://example.com/registry.json`});if(e.runtime.prompt.isCancel(t))return S(y(`UserCancelled`,`Operation cancelled.`));r=String(t)}if(!r)return x({kind:`noop`,message:`No registry source provided.`});let i=await B(r,e.cwd,e.runtime);if(!i.ok)return i;let{items:a}=i.value;if(!a.length)return e.runtime.prompt.warn(`No items found in registry.`),x({kind:`noop`,message:`No items found in registry.`});e.runtime.prompt.info(`Found ${a.length} items.`);for(let e of a)console.log(`- ${ye(e)}`);return x({kind:`success`,message:`Listed ${a.length} item(s).`})}function xe(e,n){let r=o.diffLines(e,n);for(let e of r){let n=e.added?t.green:e.removed?t.red:t.gray,r=e.added?`+ `:e.removed?`- `:` `,i=e.value.replace(/\n$/,``).split(`
|
|
1
|
+
import e from"node:path";import t from"picocolors";import n from"node:fs/promises";import{loadConfig as r}from"unconfig";import{fileURLToPath as i}from"node:url";import a from"node:crypto";import*as o from"diff";import s from"node:fs";import{autocompleteMultiselect as c,cancel as l,confirm as u,intro as d,isCancel as f,log as p,multiselect as m,outro as h,select as g,text as _}from"@clack/prompts";import{spawnSync as v}from"node:child_process";function y(e,t,n){return{kind:e,message:t,cause:n}}function b(e,t=`RuntimeError`){return typeof e==`object`&&e&&`kind`in e&&`message`in e&&typeof e.kind==`string`&&typeof e.message==`string`?e:e instanceof Error?y(t,e.message,e):y(t,String(e))}function x(e){return{ok:!0,value:e}}function S(e){return{ok:!1,error:e}}function C(e){return e.replace(/\\/g,`/`)}function w(t,n,r){let i=`${e.resolve(t)}${e.sep}`,a=e.resolve(n);return r?x(void 0):a!==e.resolve(t)&&!a.startsWith(i)?S(y(`ValidationError`,`Refusing to write outside project: ${a}`)):x(void 0)}function T(t,n,r,i){let a=n.type||t.type||`registry:file`,o=i.targetsByType?.[a],s=i.preferManifestTarget!==!1,c=e.basename(n.path||`${t.name}.txt`),l;l=s&&n.target?n.target:o?e.join(o,c):n.target?n.target:e.join(`src`,c);let u=e.resolve(r,l),d=w(r,u,!!i.allowOutsideProject);return d.ok?x({absoluteTarget:u,relativeTarget:C(e.relative(r,u))}):d}function E(e){return[...new Set(e.filter(Boolean))]}function D(e){return{dependencies:E(e.flatMap(e=>e.dependencies||[])),devDependencies:E(e.flatMap(e=>e.devDependencies||[]))}}function O(e,t,n,r=new Set){let i=[],a=[];for(let o of e)for(let e of o.files){let s=T(o,e,t,n);if(!s.ok)return s;let{absoluteTarget:c,relativeTarget:l}=s.value,u={itemName:o.name,sourceFile:e,absoluteTarget:c,relativeTarget:l};i.push(u),r.has(c)&&a.push(u)}return x({selectedItems:e,plannedWrites:i,dependencyPlan:D(e),conflicts:a})}function ee(e){return e?String(e).split(`,`).map(e=>e.trim()).filter(Boolean):[]}function te(e,t){let{flags:n}=t.args,r=ee(n.select);if(n.all)return x(e);if(r.length){let t=e.filter(e=>r.includes(e.name));return t.length?x(t):S(y(`ValidationError`,`No items matched --select=${String(n.select)}`))}return x(null)}const k={registries:{tebra:`./tebra-icon-registry/registry`},targetsByType:{"registry:icon":`src/components/ui/icons`,"registry:component":`src/components/ui`,"registry:file":`src/components/ui`},aliases:{},overwritePolicy:`prompt`,packageManager:`auto`,preferManifestTarget:!0,allowOutsideProject:!1};function A(t){return e.join(t,`regpick.json`)}async function j(e){let{config:t,sources:n}=await r({sources:[{files:[`regpick`,`.regpickrc`,`regpickrc`],extensions:[`json`,``]}],defaults:k,cwd:e});return n.length?{config:{...k,...t,registries:{...k.registries,...t.registries||{}},targetsByType:{...k.targetsByType,...t.targetsByType||{}},aliases:{...k.aliases,...t.aliases||{}}},configPath:n[0]}:{config:{...k},configPath:null}}async function ne(e,t,{overwrite:r=!1}={}){let i=A(e),a=!1;try{await n.access(i),a=!0}catch{}return a&&!r?{filePath:i,written:!1}:(await n.writeFile(i,JSON.stringify(t,null,2),`utf8`),{filePath:i,written:!0})}function M(e,t){return e?t.registries[e]?String(t.registries[e]):e:null}function N(e){return e?Array.isArray(e)?e.filter(e=>typeof e==`string`):typeof e==`string`?[e]:[]:[]}function P(e){return Array.isArray(e)?e.filter(e=>!!(e&&typeof e==`object`)):[]}function F(e,t){let n=P(e.files).map(t=>({path:typeof t.path==`string`?t.path:void 0,target:typeof t.target==`string`?t.target:void 0,type:typeof t.type==`string`?t.type:typeof e.type==`string`?e.type:`registry:file`,content:typeof t.content==`string`?t.content:void 0,url:typeof t.url==`string`?t.url:void 0})),r=typeof e.name==`string`?e.name:typeof e.title==`string`?e.title:`unnamed-item`;return{name:r,title:typeof e.title==`string`?e.title:r,description:typeof e.description==`string`?e.description:``,type:typeof e.type==`string`?e.type:`registry:file`,dependencies:N(e.dependencies),devDependencies:N(e.devDependencies),registryDependencies:N(e.registryDependencies),files:n,sourceMeta:t}}function re(e){return P(e.items).map(e=>Array.isArray(e.files)?null:typeof e.url==`string`?e.url:typeof e.href==`string`?e.href:typeof e.path==`string`?e.path:null).filter(e=>!!e)}function ie(e,t){return Array.isArray(e)?x(e.filter(e=>!!(e&&typeof e==`object`)).map(e=>F(e,t))):e&&typeof e==`object`&&Array.isArray(e.items)?x(P(e.items).filter(e=>Array.isArray(e.files)).map(e=>F(e,t))):e&&typeof e==`object`&&Array.isArray(e.files)?x([F(e,t)]):S(y(`RegistryError`,`Unsupported manifest structure.`))}function I(e){return/^https?:\/\//i.test(e)}function L(e){return/^file:\/\//i.test(e)}function R(e,t){return new URL(t,e).toString()}async function z(t,n,r){let i=ie(t,n);if(!t||typeof t!=`object`||Array.isArray(t))return i;let a=re(t);if(!a.length)return i;let o=i.ok?i.value:[],s=[];for(let t of a){let i;if(I(t)){let e=await r.http.getJson(t);if(!e.ok)return S(e.error);i=e.value}else if(n.type===`http`&&n.baseUrl){let e=await r.http.getJson(R(n.baseUrl,t));if(!e.ok)return S(e.error);i=e.value}else if((n.type===`file`||n.type===`directory`)&&n.baseDir){let a=await r.fs.readFile(e.resolve(n.baseDir,t),`utf8`);if(!a.ok)return S(a.error);try{i=JSON.parse(a.value)}catch{return S(y(`RegistryError`,`Invalid JSON: ${t}`))}}else{let n=await r.fs.readFile(e.resolve(t),`utf8`);if(!n.ok)return S(n.error);try{i=JSON.parse(n.value)}catch{return S(y(`RegistryError`,`Invalid JSON: ${t}`))}}i&&typeof i==`object`&&s.push(F(i,n))}return x([...o,...s])}async function ae(t,n){let r=e.resolve(t),i=await n.fs.readdir(r);if(!i.ok)return S(i.error);let a=i.value.filter(e=>e.endsWith(`.json`)),o=[];for(let t of a){let i=e.join(r,t),a=await n.fs.readFile(i,`utf8`);if(!a.ok)return S(a.error);let s;try{s=JSON.parse(a.value)}catch{continue}!s||typeof s!=`object`||!Array.isArray(s.files)||o.push(F(s,{type:`directory`,baseDir:r}))}return x(o)}async function B(t,n,r){if(!t)return S(y(`ValidationError`,`Registry source is required.`));let a=I(t)||L(t)?t:e.resolve(n,t);if(I(a)){let e=await r.http.getJson(a);if(!e.ok)return S(e.error);let t=a.endsWith(`/`)?a:a.replace(/[^/]*$/,``),n=await z(e.value,{type:`http`,baseUrl:t},r);return n.ok?x({items:n.value,source:a}):S(n.error)}let o=L(a)?i(new URL(a)):e.resolve(a),s=await r.fs.stat(o);if(!s.ok)return S(y(`RegistryError`,`Registry source not found: ${t}`));if(s.value.isDirectory()){let e=await ae(o,r);return e.ok?x({items:e.value,source:o}):S(e.error)}let c=await r.fs.readFile(o,`utf8`);if(!c.ok)return S(c.error);let l;try{l=JSON.parse(c.value)}catch(e){return S(y(`RegistryError`,`Failed to parse registry JSON.`,e))}let u=await z(l,{type:`file`,baseDir:e.dirname(o)},r);return u.ok?x({items:u.value,source:o}):S(u.error)}async function V(t,n,r,i){if(typeof t.content==`string`)return x(t.content);let a=t.url||t.path;if(!a)return S(y(`ValidationError`,`File entry in "${n.name}" is missing both content and path/url.`));if(I(a))return await i.http.getText(a);if(n.sourceMeta.type===`http`&&n.sourceMeta.baseUrl){let e=R(n.sourceMeta.baseUrl,a);return await i.http.getText(e)}let o=n.sourceMeta.baseDir&&!e.isAbsolute(a)?e.resolve(n.sourceMeta.baseDir,a):e.resolve(r,a);return await i.fs.readFile(o,`utf8`)}function oe(e,t){let n=[];return e.length&&n.push({command:`npm`,args:[`install`,...e]}),t.length&&n.push({command:`npm`,args:[`install`,`-D`,...t]}),n}function se(e,t){let n=[];return e.length&&n.push({command:`yarn`,args:[`add`,...e]}),t.length&&n.push({command:`yarn`,args:[`add`,`-D`,...t]}),n}function ce(e,t){let n=[];return e.length&&n.push({command:`pnpm`,args:[`add`,...e]}),t.length&&n.push({command:`pnpm`,args:[`add`,`-D`,...t]}),n}const le={npm:{manager:`npm`,buildInstallCommands:oe},yarn:{manager:`yarn`,buildInstallCommands:se},pnpm:{manager:`pnpm`,buildInstallCommands:ce}};function H(e){return le[e]}function U(e){return[...new Set(e.filter(Boolean))]}function ue(t,n,r){let i=e.join(n,`package.json`);if(!r.fs.existsSync(i))return{missingDependencies:[],missingDevDependencies:[]};let a=r.fs.readJsonSync(i),o=a.ok?a.value:{},s={...o.dependencies||{},...o.devDependencies||{},...o.peerDependencies||{}},c=U(t.flatMap(e=>e.dependencies||[])),l=U(t.flatMap(e=>e.devDependencies||[]));return{missingDependencies:c.filter(e=>!s[e]),missingDevDependencies:l.filter(e=>!s[e])}}function de(e,t,n,r,i){if(!n.length&&!r.length)return x(void 0);let a=H(t).buildInstallCommands(n,r);for(let t of a)if(i.process.run(t.command,t.args,e).status!==0)return S(y(`InstallError`,`Dependency install failed: ${t.command} ${t.args.join(` `)}`));return x(void 0)}function W(t,n,r){return n&&n!==`auto`?n:r.fs.existsSync(e.join(t,`pnpm-lock.yaml`))?`pnpm`:r.fs.existsSync(e.join(t,`yarn.lock`))?`yarn`:(r.fs.existsSync(e.join(t,`package-lock.json`)),`npm`)}function G(t){return e.join(t,`regpick-lock.json`)}async function K(e,t){let n=G(e);if(!await t.fs.pathExists(n))return{components:{}};let r=t.fs.readJsonSync(n);return r.ok?r.value:{components:{}}}async function q(e,t,n){let r=G(e);await n.fs.writeJson(r,t,{spaces:2})}function J(e){return a.createHash(`sha256`).update(e).digest(`hex`)}function Y(e,t){let n=e;for(let[e,r]of Object.entries(t.aliases||{})){let t=RegExp(`from ["']${e}(.*?)["']`,`g`);n=n.replace(t,`from "${r}$1"`);let i=RegExp(`import\\(["']${e}(.*?)["']\\)`,`g`);n=n.replace(i,`import("${r}$1")`)}return n}async function fe(e,t,n){let r=n[1];if(r)return x(M(r,t));let i=Object.entries(t.registries||{}).map(([e,t])=>({label:`${e} -> ${t}`,value:e}));if(i.length){let n=await e.runtime.prompt.multiselect({message:`Pick registry alias (or cancel and provide URL/path manually)`,options:i,maxItems:1,required:!1});if(e.runtime.prompt.isCancel(n))return S(y(`UserCancelled`,`Operation cancelled.`));if(Array.isArray(n)&&n.length>0)return x(M(String(n[0]),t))}let a=await e.runtime.prompt.text({message:`Registry URL/path:`,placeholder:`https://example.com/registry.json`});return e.runtime.prompt.isCancel(a)?S(y(`UserCancelled`,`Operation cancelled.`)):x(String(a))}function pe(e){return e.map(e=>({value:e.name,label:`${e.name} (${e.type||`registry:file`})`,hint:e.description||`${e.files.length} file(s)`}))}async function me(e,t){if(!t.length)return x([]);let n=await e.runtime.prompt.autocompleteMultiselect({message:`Select items to install`,options:pe(t),maxItems:10,required:!0});if(e.runtime.prompt.isCancel(n))return S(y(`UserCancelled`,`Operation cancelled.`));let r=Array.isArray(n)?n:[],i=new Set(r.map(e=>String(e)));return x(t.filter(e=>i.has(e.name)))}async function he(t){let n=!!t.args.flags.yes,{config:r}=await j(t.cwd),i=await fe(t,r,t.args.positionals);if(!i.ok)return i;let a=i.value;if(!a)return x({kind:`noop`,message:`No registry source provided.`});let o=await B(a,t.cwd,t.runtime);if(!o.ok)return o;let{items:s}=o.value;if(!s.length)return t.runtime.prompt.warn(`No installable items in registry.`),x({kind:`noop`,message:`No installable items in registry.`});let c=te(s,t),l=c.ok&&c.value?c:await me(t,s);if(!l.ok)return l;let u=l.value;if(!u||!u.length)return t.runtime.prompt.warn(`No items selected.`),x({kind:`noop`,message:`No items selected.`});if(!n){let e=await t.runtime.prompt.confirm({message:`Install ${u.length} item(s)?`,initialValue:!0});if(t.runtime.prompt.isCancel(e)||!e)return S(y(`UserCancelled`,`Operation cancelled.`))}let d=new Set,f=O(u,t.cwd,r);if(!f.ok)return f;let p=f.value;for(let e of p.plannedWrites)await t.runtime.fs.pathExists(e.absoluteTarget)&&d.add(e.absoluteTarget);let m=O(u,t.cwd,r,d);if(!m.ok)return m;let h=m.value,g=[];for(let e of h.plannedWrites)if(d.has(e.absoluteTarget))if(n||r.overwritePolicy===`overwrite`)g.push(e);else if(r.overwritePolicy===`skip`)t.runtime.prompt.warn(`Skipped existing file: ${e.absoluteTarget}`);else{let n=await t.runtime.prompt.select({message:`File exists: ${e.absoluteTarget}`,options:[{value:`overwrite`,label:`Overwrite this file`},{value:`skip`,label:`Skip this file`},{value:`abort`,label:`Abort installation`}]});if(t.runtime.prompt.isCancel(n)||n===`abort`)return S(y(`UserCancelled`,`Installation aborted by user.`));n===`overwrite`&&g.push(e)}else g.push(e);let{missingDependencies:_,missingDevDependencies:v}=ue(u,t.cwd,t.runtime),b=!1;if(_.length||v.length)if(n)b=!0;else{let e=W(t.cwd,r.packageManager,t.runtime),n=[];_.length&&n.push(`dependencies: ${_.join(`, `)}`),v.length&&n.push(`devDependencies: ${v.join(`, `)}`);let i=await t.runtime.prompt.confirm({message:`Install missing packages with ${e}? (${n.join(` | `)})`,initialValue:!0});if(t.runtime.prompt.isCancel(i))return S(y(`UserCancelled`,`Dependency installation cancelled by user.`));b=!!i,b||t.runtime.prompt.warn(`Skipped dependency installation.`)}let C=0,w=await K(t.cwd,t.runtime),T={};for(let n of g){let i=u.find(e=>e.name===n.itemName);if(!i)continue;let a=await V(n.sourceFile,i,t.cwd,t.runtime);if(!a.ok)return a;let o=Y(a.value,r),s=await t.runtime.fs.ensureDir(e.dirname(n.absoluteTarget));if(!s.ok)return s;let c=await t.runtime.fs.writeFile(n.absoluteTarget,o,`utf8`);if(!c.ok)return c;let l=J(o);T[i.name]||(T[i.name]=[]),T[i.name].push(l),C+=1,t.runtime.prompt.success(`Wrote ${n.relativeTarget}`)}if(C>0){for(let[e,t]of Object.entries(T)){let n=J(t.sort().join(``));w.components[e]={source:a,hash:n}}await q(t.cwd,w,t.runtime)}if(b){let e=W(t.cwd,r.packageManager,t.runtime),n=de(t.cwd,e,_,v,t.runtime);if(!n.ok)return n}return t.runtime.prompt.info(`Installed ${u.length} item(s), wrote ${C} file(s).`),x({kind:`success`,message:`Installed ${u.length} item(s), wrote ${C} file(s).`})}function ge(e,t){return e?`cancelled`:t?`overwrite`:`keep`}async function _e(e){let t=A(e.cwd),n=await e.runtime.fs.stat(t);if(n.ok){let n=await e.runtime.prompt.confirm({message:`${t} already exists. Overwrite?`,initialValue:!1}),r=ge(e.runtime.prompt.isCancel(n),!!n);if(r===`cancelled`)return S(y(`UserCancelled`,`Operation cancelled.`));if(r===`keep`)return e.runtime.prompt.info(`Keeping existing configuration.`),x({kind:`noop`,message:`Keeping existing configuration.`})}let{config:r}=await j(e.cwd),i=await e.runtime.prompt.select({message:`Jakiego menedżera pakietów używasz?`,options:[{value:`auto`,label:`Auto (wykrywanie)`},{value:`npm`,label:`npm`},{value:`yarn`,label:`yarn`},{value:`pnpm`,label:`pnpm`}]});if(e.runtime.prompt.isCancel(i))return S(y(`UserCancelled`,`Operation cancelled.`));let a=await e.runtime.prompt.text({message:`W jakim folderze trzymasz komponenty UI?`,placeholder:`src/components/ui`});if(e.runtime.prompt.isCancel(a))return S(y(`UserCancelled`,`Operation cancelled.`));let o=await e.runtime.prompt.select({message:`Czy chcesz nadpisywać pliki automatycznie, czy wolisz być pytany?`,options:[{value:`prompt`,label:`Pytaj (prompt)`},{value:`overwrite`,label:`Zawsze nadpisuj (overwrite)`},{value:`skip`,label:`Pomijaj nadpisywanie (skip)`}]});if(e.runtime.prompt.isCancel(o))return S(y(`UserCancelled`,`Operation cancelled.`));let s={...r,packageManager:String(i),overwritePolicy:String(o),targetsByType:{...r.targetsByType,"registry:component":String(a||`src/components/ui`),"registry:file":String(a||`src/components/ui`),"registry:icon":`${String(a||`src/components/ui`)}/icons`}};return await ne(e.cwd,s,{overwrite:!0}),e.runtime.prompt.success(`${n.ok?`Overwrote`:`Created`} ${t}`),x({kind:`success`,message:`${n.ok?`Overwrote`:`Created`} ${t}`})}function X(e,t){return e?t[e]?String(t[e]):e:null}function ve(e,t){let n=X(e,t);if(n)return{source:n,requiresPrompt:!1};let r=Object.keys(t)[0];return r?{source:X(r,t),requiresPrompt:!1}:{source:null,requiresPrompt:!0}}function ye(e){let t=e.type||`registry:file`,n=Array.isArray(e.files)?e.files.length:0;return`${e.name} (${t}, files: ${n})`}async function be(e){let{config:t}=await j(e.cwd),n=ve(e.args.positionals[1],t.registries),r=n.source;if(n.requiresPrompt){let t=await e.runtime.prompt.text({message:`Registry URL/path:`,placeholder:`https://example.com/registry.json`});if(e.runtime.prompt.isCancel(t))return S(y(`UserCancelled`,`Operation cancelled.`));r=String(t)}if(!r)return x({kind:`noop`,message:`No registry source provided.`});let i=await B(r,e.cwd,e.runtime);if(!i.ok)return i;let{items:a}=i.value;if(!a.length)return e.runtime.prompt.warn(`No items found in registry.`),x({kind:`noop`,message:`No items found in registry.`});e.runtime.prompt.info(`Found ${a.length} items.`);for(let e of a)console.log(`- ${ye(e)}`);return x({kind:`success`,message:`Listed ${a.length} item(s).`})}function xe(e,n){let r=o.diffLines(e,n);for(let e of r){let n=e.added?t.green:e.removed?t.red:t.gray,r=e.added?`+ `:e.removed?`- `:` `,i=e.value.replace(/\n$/,``).split(`
|
|
2
2
|
`);for(let e of i)console.log(n(`${r}${e}`))}}async function Se(n){let r=await K(n.cwd,n.runtime),i=Object.keys(r.components);if(i.length===0)return n.runtime.prompt.info(`No components installed. Nothing to update.`),x({kind:`noop`,message:`No components to update.`});let{config:a}=await j(n.cwd),o={};for(let e of i){let t=r.components[e].source;t&&(o[t]||(o[t]=[]),o[t].push(e))}let s=0;for(let[i,c]of Object.entries(o)){let o=await B(i,n.cwd,n.runtime);if(!o.ok){n.runtime.prompt.warn(`Failed to load registry ${i}`);continue}let l=o.value.items;for(let i of c){let o=l.find(e=>e.name===i);if(!o)continue;let c=[],u=[];for(let e of o.files){let t=await V(e,o,n.cwd,n.runtime);if(!t.ok)continue;let r=Y(t.value,a);c.push(r);let i=T(o,e,n.cwd,a);i.ok&&u.push({target:i.value.absoluteTarget,content:r})}let d=J(c.sort().join(``));if(d!==r.components[i].hash){n.runtime.prompt.info(`Update available for ${i}`);let a=await n.runtime.prompt.select({message:`What do you want to do with ${i}?`,options:[{value:`diff`,label:`Show diff`},{value:`update`,label:`Update`},{value:`skip`,label:`Skip`}]});if(n.runtime.prompt.isCancel(a)||a===`skip`)continue;if(a===`diff`){for(let e of u){let r=await n.runtime.fs.readFile(e.target,`utf8`),i=r.ok?r.value:``;console.log(t.bold(`\nDiff for ${e.target}:`)),xe(i,e.content)}let e=await n.runtime.prompt.confirm({message:`Update ${i} now?`,initialValue:!0});if(n.runtime.prompt.isCancel(e)||!e)continue}for(let t of u){let r=await n.runtime.fs.ensureDir(e.dirname(t.target));if(!r.ok)return r;let i=await n.runtime.fs.writeFile(t.target,t.content,`utf8`);if(!i.ok)return i}r.components[i].hash=d,s++,n.runtime.prompt.success(`Updated ${i}`)}}}return s>0?(await q(n.cwd,r,n.runtime),x({kind:`success`,message:`Updated ${s} components.`})):x({kind:`noop`,message:`All components are up to date.`})}function Ce(e){let t=/import\s+[\s\S]*?from\s+["']([^"']+)["']/g,n=/import\(["']([^"']+)["']\)/g,r=new Set,i;for(;(i=t.exec(e))!==null;){let e=i[1];if(!e.startsWith(`.`)&&!e.startsWith(`/`)&&!e.startsWith(`~`)&&!e.startsWith(`@/`)&&!e.startsWith(`@\\`)){let t=e.split(`/`);e.startsWith(`@`)&&t.length>1?r.add(`${t[0]}/${t[1]}`):r.add(t[0])}}for(;(i=n.exec(e))!==null;){let e=i[1];if(!e.startsWith(`.`)&&!e.startsWith(`/`)&&!e.startsWith(`~`)&&!e.startsWith(`@/`)&&!e.startsWith(`@\\`)){let t=e.split(`/`);e.startsWith(`@`)&&t.length>1?r.add(`${t[0]}/${t[1]}`):r.add(t[0])}}return Array.from(r)}async function we(t,n){let r=[];async function i(t){let a=await n.runtime.fs.readdir(t);if(!a.ok)return a;for(let o of a.value){let a=e.join(t,o),s=await n.runtime.fs.stat(a);if(!s.ok)return s;if(s.value.isDirectory()){let e=await i(a);if(!e.ok)return e}else (a.endsWith(`.ts`)||a.endsWith(`.tsx`))&&r.push(a)}return x(void 0)}let a=await i(t);return a.ok?x(r):S(a.error)}async function Z(t){let n=t.args.positionals[1]||`.`,r=e.resolve(t.cwd,n),i=await t.runtime.fs.stat(r);if(!i.ok||!i.value.isDirectory())return S(y(`ValidationError`,`Target is not a directory: ${r}`));t.runtime.prompt.info(`Scanning ${r} for components...`);let a=await we(r,t);if(!a.ok)return a;let o=a.value;if(o.length===0)return t.runtime.prompt.warn(`No .ts or .tsx files found.`),x({kind:`noop`,message:`No files found.`});let s=[];for(let n of o){let i=await t.runtime.fs.readFile(n,`utf8`);if(!i.ok)return S(i.error);let a=Ce(i.value),o=e.relative(r,n).replace(/\\/g,`/`),c=e.basename(n,e.extname(n));s.push({name:c,title:c,description:`Packed component`,type:`registry:component`,dependencies:a,devDependencies:[],registryDependencies:[],files:[{path:o,type:`registry:component`}]})}let c={items:s},l=e.join(t.cwd,`registry.json`),u=await t.runtime.fs.writeJson(l,c,{spaces:2});return u.ok?(t.runtime.prompt.success(`Packed ${s.length} components into registry.json`),x({kind:`success`,message:`Generated registry.json`})):S(u.error)}function Te(e){return e===`true`?!0:e===`false`?!1:e}function Ee(e){let t={},n=[];for(let r of e){if(!r.startsWith(`--`)){n.push(r);continue}let e=r.slice(2),i=e.indexOf(`=`);if(i===-1){t[e]=!0;continue}let a=e.slice(0,i);t[a]=Te(e.slice(i+1))}return{flags:t,positionals:n}}const De=e=>({fs:{existsSync:e=>s.existsSync(e),pathExists:async e=>{try{return await n.access(e),!0}catch{return!1}},ensureDir:async e=>{try{return await n.mkdir(e,{recursive:!0}),x(void 0)}catch(t){return S(y(`RuntimeError`,`Failed to ensure directory: ${e}`,t))}},writeFile:async(e,t,r)=>{try{return await n.writeFile(e,t,r),x(void 0)}catch(t){return S(y(`RuntimeError`,`Failed to write file: ${e}`,t))}},readFile:async(e,t)=>{try{return x(await n.readFile(e,t))}catch(t){return S(y(`RuntimeError`,`Failed to read file: ${e}`,t))}},readJsonSync:e=>{try{let t=s.readFileSync(e,`utf8`);return x(JSON.parse(t))}catch(t){return S(y(`RuntimeError`,`Failed to read JSON: ${e}`,t))}},writeJson:async(e,t,r)=>{try{let i=JSON.stringify(t,null,r?.spaces??2);return await n.writeFile(e,i,`utf8`),x(void 0)}catch(t){return S(y(`RuntimeError`,`Failed to write JSON: ${e}`,t))}},stat:async e=>{try{return x(await n.stat(e))}catch(t){return S(y(`RuntimeError`,`Failed to stat path: ${e}`,t))}},readdir:async e=>{try{return x(await n.readdir(e))}catch(t){return S(y(`RuntimeError`,`Failed to read directory: ${e}`,t))}}},http:{getJson:async(e,t=15e3)=>{try{let n=await fetch(e,{signal:AbortSignal.timeout(t)});return n.ok?x(await n.json()):S(y(`RuntimeError`,`HTTP error! status: ${n.status} when fetching JSON from: ${e}`))}catch(t){return S(y(`RuntimeError`,`Failed to fetch JSON from: ${e}`,t))}},getText:async(e,t=15e3)=>{try{let n=await fetch(e,{signal:AbortSignal.timeout(t)});return n.ok?x(await n.text()):S(y(`RuntimeError`,`HTTP error! status: ${n.status} when fetching text from: ${e}`))}catch(t){return S(y(`RuntimeError`,`Failed to fetch text from: ${e}`,t))}}},prompt:{intro:e=>d(e),outro:e=>h(e),cancel:e=>l(e),isCancel:e=>f(e),info:e=>p.info(e),warn:e=>p.warn(e),error:e=>p.error(e),success:e=>p.success(e),text:t=>_({signal:e?.signal,...t}),confirm:t=>u({signal:e?.signal,...t}),select:t=>g({signal:e?.signal,...t}),multiselect:t=>m({signal:e?.signal,...t}),autocompleteMultiselect:t=>c({signal:e?.signal,...t})},process:{run:(e,t,n)=>v(e,t,{cwd:n,stdio:`inherit`,shell:process.platform===`win32`})}});function Q(){console.log(`
|
|
3
3
|
Usage:
|
|
4
4
|
regpick init
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "regpick",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Lightweight CLI for selecting and installing registry entries.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -14,9 +14,22 @@
|
|
|
14
14
|
],
|
|
15
15
|
"keywords": [
|
|
16
16
|
"cli",
|
|
17
|
-
"registry",
|
|
17
|
+
"component-registry",
|
|
18
|
+
"component-library",
|
|
19
|
+
"developer-tool",
|
|
20
|
+
"design-system",
|
|
21
|
+
"frontend-tooling",
|
|
22
|
+
"icon-registry",
|
|
23
|
+
"react-components",
|
|
18
24
|
"shadcn",
|
|
19
|
-
"
|
|
25
|
+
"shadcn-ui",
|
|
26
|
+
"svg-icons",
|
|
27
|
+
"tailwind",
|
|
28
|
+
"ui-components",
|
|
29
|
+
"package-installer",
|
|
30
|
+
"registry",
|
|
31
|
+
"components",
|
|
32
|
+
"copy"
|
|
20
33
|
],
|
|
21
34
|
"author": "",
|
|
22
35
|
"license": "MIT",
|
|
@@ -43,9 +56,9 @@
|
|
|
43
56
|
},
|
|
44
57
|
"dependencies": {
|
|
45
58
|
"@clack/prompts": "^1.0.1",
|
|
46
|
-
"cosmiconfig": "^9.0.0",
|
|
47
59
|
"diff": "^8.0.3",
|
|
48
|
-
"picocolors": "^1.1.1"
|
|
60
|
+
"picocolors": "^1.1.1",
|
|
61
|
+
"unconfig": "^7.5.0"
|
|
49
62
|
},
|
|
50
63
|
"devDependencies": {
|
|
51
64
|
"@commitlint/cli": "^20.4.2",
|