regpick 0.6.7 → 0.7.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 CHANGED
@@ -12,4 +12,4 @@ Options:
12
12
  --select=a,b,c Select explicit item names in add flow
13
13
  --yes Skip confirmation prompts where safe
14
14
  --help Show this help
15
- `)}async function s(){let n=new AbortController,i=e=>{n.signal.aborted||n.abort(e),e instanceof Error&&console.error(t(`red`,`\n[Fatal Error] ${e.message}`)),process.exit(1)};process.on(`SIGINT`,()=>i()),process.on(`SIGTERM`,()=>i()),process.on(`uncaughtException`,i),process.on(`unhandledRejection`,e=>i(e instanceof Error?e:Error(String(e))));let s=a(process.argv.slice(2)),l=s.positionals[0];if(!l||s.flags.help){o();return}let{createRuntimePorts:u}=await import(`./ports-Cr6fDIR9.mjs`),d=u({signal:n.signal});if(!l||s.flags.help){o();return}let f={cwd:s.flags.cwd?e.resolve(process.cwd(),String(s.flags.cwd)):process.cwd(),args:s,runtime:d};d.prompt.intro(t(`cyan`,`regpick`));try{let e;if(l===`init`)e=await import(`./init-BIH764-i.mjs`).then(e=>e.runInitCommand(f));else if(l===`list`)e=await import(`./list-BIXGjwlJ.mjs`).then(e=>e.runListCommand(f));else if(l===`add`)e=await import(`./add-BUU8nkkh.mjs`).then(e=>e.runAddCommand(f));else if(l===`update`)e=await import(`./update-BQeqp8Xs.mjs`).then(e=>e.runUpdateCommand(f));else if(l===`pack`)e=await import(`./pack-wVOoOChv.mjs`).then(e=>e.runPackCommand(f));else{d.prompt.error(`Unknown command: ${l}`),o(),process.exitCode=1;return}if(!e.ok){c(e.error,d.prompt.error),d.prompt.outro(t(`red`,`Failed.`)),process.exitCode=1;return}if(e.value.kind===`noop`){d.prompt.outro(t(`yellow`,e.value.message));return}d.prompt.outro(t(`green`,`Done.`))}catch(e){c(r(e),d.prompt.error),d.prompt.outro(t(`red`,`Failed.`)),process.exitCode=1}}function c(e,t){if(e.kind===`UserCancelled`){t(e.message);return}t(`[${e.kind}] ${e.message}`)}s();export{n as t};
15
+ `)}async function s(){let n=new AbortController,i=e=>{n.signal.aborted||n.abort(e),e instanceof Error&&console.error(t(`red`,`\n[Fatal Error] ${e.message}`)),process.exit(1)};process.on(`SIGINT`,()=>i()),process.on(`SIGTERM`,()=>i()),process.on(`uncaughtException`,i),process.on(`unhandledRejection`,e=>i(e instanceof Error?e:Error(String(e))));let s=a(process.argv.slice(2)),l=s.positionals[0];if(!l||s.flags.help){o();return}let{createRuntimePorts:u}=await import(`./ports-Cr6fDIR9.mjs`),d=u({signal:n.signal});if(!l||s.flags.help){o();return}let f={cwd:s.flags.cwd?e.resolve(process.cwd(),String(s.flags.cwd)):process.cwd(),args:s,runtime:d};d.prompt.intro(t(`cyan`,`regpick`));try{let e;if(l===`init`)e=await import(`./init-B3XFWkqZ.mjs`).then(e=>e.runInitCommand(f));else if(l===`list`)e=await import(`./list-Bss9NK-X.mjs`).then(e=>e.runListCommand(f));else if(l===`add`)e=await import(`./add-BUU8nkkh.mjs`).then(e=>e.runAddCommand(f));else if(l===`update`)e=await import(`./update-BQeqp8Xs.mjs`).then(e=>e.runUpdateCommand(f));else if(l===`pack`)e=await import(`./pack-wVOoOChv.mjs`).then(e=>e.runPackCommand(f));else{d.prompt.error(`Unknown command: ${l}`),o(),process.exitCode=1;return}if(!e.ok){c(e.error,d.prompt.error),d.prompt.outro(t(`red`,`Failed.`)),process.exitCode=1;return}if(e.value.kind===`noop`){d.prompt.outro(t(`yellow`,e.value.message));return}d.prompt.outro(t(`green`,`Done.`))}catch(e){c(r(e),d.prompt.error),d.prompt.outro(t(`red`,`Failed.`)),process.exitCode=1}}function c(e,t){if(e.kind===`UserCancelled`){t(e.message);return}t(`[${e.kind}] ${e.message}`)}s();export{n as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./index.mjs";import{n as t,t as n}from"./result-Dmv-uoQK.mjs";import{i as r,n as i,t as a}from"./config-DF-S5_la.mjs";function o(e,t){return e?`cancelled`:t?`overwrite`:`keep`}async function s(s){let c=a(s.cwd),l=await s.runtime.fs.stat(c);if(l.ok){let r=await s.runtime.prompt.confirm({message:`${c} already exists. Overwrite?`,initialValue:!1}),i=o(await s.runtime.prompt.isCancel(r),!!r);if(i===`cancelled`)return n(e(`UserCancelled`,`Operation cancelled.`));if(i===`keep`)return s.runtime.prompt.info(`Keeping existing configuration.`),t({kind:`noop`,message:`Keeping existing configuration.`})}let{config:u}=await i(s.cwd),d=await s.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(await s.runtime.prompt.isCancel(d))return n(e(`UserCancelled`,`Operation cancelled.`));let f=await s.runtime.prompt.text({message:`W jakim folderze trzymasz komponenty UI?`,placeholder:`src/components/ui`});if(await s.runtime.prompt.isCancel(f))return n(e(`UserCancelled`,`Operation cancelled.`));let p=await s.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(await s.runtime.prompt.isCancel(p))return n(e(`UserCancelled`,`Operation cancelled.`));let m={...u,packageManager:String(d),overwritePolicy:String(p),targetsByType:{...u.targetsByType,"registry:component":String(f||`src/components/ui`),"registry:file":String(f||`src/components/ui`),"registry:icon":`${String(f||`src/components/ui`)}/icons`}};return await r(s.cwd,m,{overwrite:!0}),s.runtime.prompt.success(`${l.ok?`Overwrote`:`Created`} ${c}`),t({kind:`success`,message:`${l.ok?`Overwrote`:`Created`} ${c}`})}export{s as runInitCommand};
@@ -1 +1 @@
1
- import{t as e}from"./index.mjs";import{n as t,t as n}from"./result-Dmv-uoQK.mjs";import{n as r}from"./config-DF-S5_la.mjs";import{t as i}from"./registry-2GjgbSBI.mjs";function a(e,t){return e?t[e]?String(t[e]):e:null}function o(e,t){let n=a(e,t);if(n)return{source:n,requiresPrompt:!1};let r=Object.keys(t)[0];return r?{source:a(r,t),requiresPrompt:!1}:{source:null,requiresPrompt:!0}}function s(e){let t=e.type||`registry:file`,n=Array.isArray(e.files)?e.files.length:0;return`${e.name} (${t}, files: ${n})`}async function c(a){let{config:c}=await r(a.cwd),l=o(a.args.positionals[1],c.registries),u=l.source;if(l.requiresPrompt){let t=await a.runtime.prompt.text({message:`Registry URL/path:`,placeholder:`https://example.com/registry.json`});if(a.runtime.prompt.isCancel(t))return n(e(`UserCancelled`,`Operation cancelled.`));u=String(t)}if(!u)return t({kind:`noop`,message:`No registry source provided.`});let d=await i(u,a.cwd,a.runtime);if(!d.ok)return d;let{items:f}=d.value;if(!f.length)return a.runtime.prompt.warn(`No items found in registry.`),t({kind:`noop`,message:`No items found in registry.`});a.runtime.prompt.info(`Found ${f.length} items.`);for(let e of f)console.log(`- ${s(e)}`);return t({kind:`success`,message:`Listed ${f.length} item(s).`})}export{c as runListCommand};
1
+ import{t as e}from"./index.mjs";import{n as t,t as n}from"./result-Dmv-uoQK.mjs";import{n as r}from"./config-DF-S5_la.mjs";import{t as i}from"./registry-2GjgbSBI.mjs";function a(e,t){return e?t[e]?String(t[e]):e:null}function o(e,t){let n=a(e,t);if(n)return{source:n,requiresPrompt:!1};let r=Object.keys(t)[0];return r?{source:a(r,t),requiresPrompt:!1}:{source:null,requiresPrompt:!0}}function s(e){let t=e.type||`registry:file`,n=Array.isArray(e.files)?e.files.length:0;return`${e.name} (${t}, files: ${n})`}async function c(a){let{config:c}=await r(a.cwd),l=o(a.args.positionals[1],c.registries),u=l.source;if(l.requiresPrompt){let t=await a.runtime.prompt.text({message:`Registry URL/path:`,placeholder:`https://example.com/registry.json`});if(await a.runtime.prompt.isCancel(t))return n(e(`UserCancelled`,`Operation cancelled.`));u=String(t)}if(!u)return t({kind:`noop`,message:`No registry source provided.`});let d=await i(u,a.cwd,a.runtime);if(!d.ok)return d;let{items:f}=d.value;if(!f.length)return a.runtime.prompt.warn(`No items found in registry.`),t({kind:`noop`,message:`No items found in registry.`});a.runtime.prompt.info(`Found ${f.length} items.`);for(let e of f)console.log(`- ${s(e)}`);return t({kind:`success`,message:`Listed ${f.length} item(s).`})}export{c as runListCommand};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "regpick",
3
- "version": "0.6.7",
3
+ "version": "0.7.0",
4
4
  "description": "Lightweight CLI for selecting and installing registry entries.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -1 +0,0 @@
1
- import{t as e}from"./index.mjs";import{n as t,t as n}from"./result-Dmv-uoQK.mjs";import{i as r,n as i,t as a}from"./config-DF-S5_la.mjs";function o(e,t){return e?`cancelled`:t?`overwrite`:`keep`}async function s(s){let c=a(s.cwd),l=await s.runtime.fs.stat(c);if(l.ok){let r=await s.runtime.prompt.confirm({message:`${c} already exists. Overwrite?`,initialValue:!1}),i=o(s.runtime.prompt.isCancel(r),!!r);if(i===`cancelled`)return n(e(`UserCancelled`,`Operation cancelled.`));if(i===`keep`)return s.runtime.prompt.info(`Keeping existing configuration.`),t({kind:`noop`,message:`Keeping existing configuration.`})}let{config:u}=await i(s.cwd),d=await s.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(s.runtime.prompt.isCancel(d))return n(e(`UserCancelled`,`Operation cancelled.`));let f=await s.runtime.prompt.text({message:`W jakim folderze trzymasz komponenty UI?`,placeholder:`src/components/ui`});if(s.runtime.prompt.isCancel(f))return n(e(`UserCancelled`,`Operation cancelled.`));let p=await s.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(s.runtime.prompt.isCancel(p))return n(e(`UserCancelled`,`Operation cancelled.`));let m={...u,packageManager:String(d),overwritePolicy:String(p),targetsByType:{...u.targetsByType,"registry:component":String(f||`src/components/ui`),"registry:file":String(f||`src/components/ui`),"registry:icon":`${String(f||`src/components/ui`)}/icons`}};return await r(s.cwd,m,{overwrite:!0}),s.runtime.prompt.success(`${l.ok?`Overwrote`:`Created`} ${c}`),t({kind:`success`,message:`${l.ok?`Overwrote`:`Created`} ${c}`})}export{s as runInitCommand};