@jongh/cli 1.0.1 → 1.0.11
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.js +1 -1
- package/package.json +1 -1
- package/src/fetchComponent.ts +3 -0
- package/tsup.config.ts +1 -1
- package/dist/index.cjs +0 -2
- package/dist/index.d.cts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import y from"yargs";import{hideBin as w}from"yargs/helpers";import m from"node:path";import a from"fs-extra";import{packageDirectory as l}from"pkg-dir";import*as t from"@clack/prompts";async function i(){let o=await l(),n=m.join(o||process.cwd(),"park-ui.json");try{return await a.readJSON(n)}catch{t.note("\uC124\uC815 \uD30C\uC77C\uC774 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");let e=await f();return await a.outputJSON(n,{...e},{spaces:2}),e}}var f=async()=>t.group({outputPath:()=>t.text({message:"\uCEF4\uD3EC\uB10C\uD2B8 \uC800\uC7A5 \uACBD\uB85C\uB97C \uC124\uC815\uD574\uC8FC\uC138\uC694",initialValue:"./src/components/ui",validate:o=>{if(!o)return"Please enter a path.";if(!o.startsWith("."))return"Please enter a relative path to the project root."}})},{onCancel:()=>{t.cancel("Operation cancelled."),process.exit(0)}});import*as s from"@clack/prompts";import r from"node:path";import d from"fs-extra";import{fileURLToPath as u}from"node:url";var g=r.dirname(u(import.meta.url)),h=r.join(g,"./components/Button/index.tsx");async function c(o,n){try{let e=h,p=r.join(process.cwd(),n,`${o}.tsx`);await d.copy(e,p),console.log(`${o} copied to ${n}`)}catch(e){throw new Error(`Failed to copy component: ${e}`)}}var C=async()=>{await y(w(process.argv)).command("components add [components..]","Add components to your project",o=>o.positional("components",{describe:"List of components to add",type:"string",array:!0,default:[]}).option("all",{type:"boolean",description:"Add all components",default:!1}),async o=>{if(o.components.length===0&&!o.all){s.note("Error: You need to specify at least one component or use the --all flag"),console.log('Run "cli --help" for more information');return}let n=await i();await c(o.components[0],n.outputPath)}).demandCommand(1,"You need at least one command before moving on").strict().help().argv};C();
|
package/package.json
CHANGED
package/src/fetchComponent.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// src/copy-components.ts
|
|
2
2
|
import path from "node:path"
|
|
3
3
|
import fs from "fs-extra"
|
|
4
|
+
import { fileURLToPath } from "node:url"
|
|
4
5
|
|
|
5
6
|
// __dirname은 현재 실행되는 스크립트의 디렉토리 경로 (우리 패키지 내부)
|
|
7
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
8
|
+
|
|
6
9
|
const COMPONENTS_DIR = path.join(__dirname, "./components/Button/index.tsx")
|
|
7
10
|
|
|
8
11
|
export async function copyComponent(componentName: string, outputPath: string) {
|
package/tsup.config.ts
CHANGED
package/dist/index.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";var w=Object.create;var p=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var O=(o,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of x(t))!j.call(o,a)&&a!==n&&p(o,a,{get:()=>t[a],enumerable:!(i=C(t,a))||i.enumerable});return o};var r=(o,t,n)=>(n=o!=null?w(P(o)):{},O(t||!o||!o.__esModule?p(n,"default",{value:o,enumerable:!0}):n,o));var g=r(require("yargs"),1),y=require("yargs/helpers");var m=r(require("path"),1),c=r(require("fs-extra"),1),l=require("pkg-dir"),e=r(require("@clack/prompts"),1);async function f(){let o=await(0,l.packageDirectory)(),t=m.default.join(o||process.cwd(),"park-ui.json");try{return await c.default.readJSON(t)}catch{e.note("\uC124\uC815 \uD30C\uC77C\uC774 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");let n=await b();return await c.default.outputJSON(t,{...n},{spaces:2}),n}}var b=async()=>e.group({outputPath:()=>e.text({message:"\uCEF4\uD3EC\uB10C\uD2B8 \uC800\uC7A5 \uACBD\uB85C\uB97C \uC124\uC815\uD574\uC8FC\uC138\uC694",initialValue:"./src/components/ui",validate:o=>{if(!o)return"Please enter a path.";if(!o.startsWith("."))return"Please enter a relative path to the project root."}})},{onCancel:()=>{e.cancel("Operation cancelled."),process.exit(0)}});var h=r(require("@clack/prompts"),1);var s=r(require("path"),1),d=r(require("fs-extra"),1),$=s.default.join(__dirname,"./components/Button/index.tsx");async function u(o,t){try{let n=$,i=s.default.join(process.cwd(),t,`${o}.tsx`);await d.default.copy(n,i),console.log(`${o} copied to ${t}`)}catch(n){throw new Error(`Failed to copy component: ${n}`)}}var k=async()=>{await(0,g.default)((0,y.hideBin)(process.argv)).command("components add [components..]","Add components to your project",o=>o.positional("components",{describe:"List of components to add",type:"string",array:!0,default:[]}).option("all",{type:"boolean",description:"Add all components",default:!1}),async o=>{if(o.components.length===0&&!o.all){h.note("Error: You need to specify at least one component or use the --all flag"),console.log('Run "cli --help" for more information');return}let t=await f();await u(o.components[0],t.outputPath)}).demandCommand(1,"You need at least one command before moving on").strict().help().argv};k();
|
package/dist/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|