@jongh/cli 1.0.0 → 1.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/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
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.js CHANGED
@@ -1,2 +1,2 @@
1
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")),y=require("yargs/helpers");var m=r(require("path")),c=r(require("fs-extra")),l=require("pkg-dir"),e=r(require("@clack/prompts"));async function f(){let o=(0,l.packageDirectorySync)()||process.cwd(),t=m.default.join(o,"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"));var s=r(require("path")),d=r(require("fs-extra")),S=s.default.join(__dirname,"./components/Button/index.tsx");async function u(o,t){try{let n=S,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 $=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};$();
2
+ import g from"yargs";import{hideBin as y}from"yargs/helpers";import m from"node:path";import r from"fs-extra";import{packageDirectory as l}from"pkg-dir";import*as t from"@clack/prompts";async function a(){let o=await l(),n=m.join(o||process.cwd(),"park-ui.json");try{return await r.readJSON(n)}catch{t.note("\uC124\uC815 \uD30C\uC77C\uC774 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");let e=await f();return await r.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 i from"node:path";import d from"fs-extra";var u=i.join(__dirname,"./components/Button/index.tsx");async function c(o,n){try{let e=u,p=i.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 h=async()=>{await g(y(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 a();await c(o.components[0],n.outputPath)}).demandCommand(1,"You need at least one command before moving on").strict().help().argv};h();
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@jongh/cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": "./dist/index.js",
7
+ "type": "module",
7
8
  "keywords": [],
8
9
  "author": "",
9
10
  "license": "ISC",
package/src/getConfig.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import path from "node:path"
2
2
  import fs from "fs-extra"
3
- import { packageDirectorySync } from "pkg-dir"
3
+ import { packageDirectory } from "pkg-dir"
4
4
  import * as p from "@clack/prompts"
5
5
  //TODO: json schema 제공
6
6
  export async function getConfig(): Promise<{ outputPath: string }> {
7
- const packageDirectory = packageDirectorySync() || process.cwd()
8
- const configPath = path.join(packageDirectory, "park-ui.json")
7
+ const packageDir = await packageDirectory()
8
+ const configPath = path.join(packageDir || process.cwd(), "park-ui.json")
9
9
  try {
10
10
  // 1. 프로젝트 루트 디렉토리 찾기
11
11
 
package/dist/index.mjs DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import g from"yargs";import{hideBin as y}from"yargs/helpers";import m from"node:path";import r from"fs-extra";import{packageDirectorySync as l}from"pkg-dir";import*as t from"@clack/prompts";async function a(){let o=l()||process.cwd(),n=m.join(o,"park-ui.json");try{return await r.readJSON(n)}catch{t.note("\uC124\uC815 \uD30C\uC77C\uC774 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");let e=await f();return await r.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 i from"node:path";import d from"fs-extra";var u=i.join(__dirname,"./components/Button/index.tsx");async function c(o,n){try{let e=u,p=i.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 h=async()=>{await g(y(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 a();await c(o.components[0],n.outputPath)}).demandCommand(1,"You need at least one command before moving on").strict().help().argv};h();
File without changes