@jongh/cli 1.0.11 → 1.1.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.js +1 -1
- package/package.json +16 -3
- package/dist/components/Accordion/Accordion.tsx +0 -274
- package/dist/components/Accordion/index.tsx +0 -37
- package/dist/components/Accordion/useAccordionHeight.ts +0 -28
- package/dist/components/Avatar/Avatar.tsx +0 -18
- package/dist/components/Avatar/useAvatar.ts +0 -73
- package/dist/components/Button/index.tsx +0 -66
- package/dist/components/Slider/Slider.tsx +0 -140
- package/dist/components/Slider/style.ts +0 -42
- package/dist/components/Tab/Tab.tsx +0 -35
- package/dist/components/Tab/TabContent.tsx +0 -60
- package/dist/components/Tab/TabIndicator.tsx +0 -19
- package/dist/components/Tab/TabList.tsx +0 -118
- package/dist/components/Tab/index.ts +0 -4
- package/dist/components/Tab/style.ts +0 -9
- package/dist/components/Tab/useRovingTabIndex.tsx +0 -172
- package/dist/components/Tab/useTabContext.ts +0 -11
- package/dist/components/TagButton/TagButton.tsx +0 -75
- package/dist/components/TagButton/style.ts +0 -35
- package/dist/components/core/Polymorphic/index.ts +0 -26
- package/dist/components/index.ts +0 -5
- package/park-ui.json +0 -3
- package/src/fetchComponent.ts +0 -30
- package/src/getConfig.ts +0 -53
- package/src/index.ts +0 -46
- package/tsconfig.json +0 -14
- package/tsup.config.ts +0 -14
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { define } from "../../../dev"
|
|
2
|
-
export const tagButtonRecipe = define.recipe({
|
|
3
|
-
className: "tagButton",
|
|
4
|
-
base: {
|
|
5
|
-
textAlign: "center",
|
|
6
|
-
borderRadius: "rounded",
|
|
7
|
-
padding: "4px 10px",
|
|
8
|
-
fontWeight: "normal",
|
|
9
|
-
cursor: "pointer",
|
|
10
|
-
border: "1px solid black",
|
|
11
|
-
color: "text_primary",
|
|
12
|
-
_hover: { boxShadow: "0px 0px 3px", boxShadowColor: "grey_300" },
|
|
13
|
-
_invalid: {
|
|
14
|
-
cursor: "not-allowed",
|
|
15
|
-
},
|
|
16
|
-
_pressed: {
|
|
17
|
-
borderWidth: "2px",
|
|
18
|
-
borderColor: "blue_300",
|
|
19
|
-
},
|
|
20
|
-
maxWidth: "screen",
|
|
21
|
-
},
|
|
22
|
-
variants: {
|
|
23
|
-
size: {
|
|
24
|
-
small: {
|
|
25
|
-
fontSize: "sm",
|
|
26
|
-
},
|
|
27
|
-
large: {
|
|
28
|
-
fontSize: "lg",
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
defaultVariants: {
|
|
33
|
-
size: "small",
|
|
34
|
-
},
|
|
35
|
-
})
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// polymorphic.d.ts
|
|
2
|
-
import {
|
|
3
|
-
type ComponentPropsWithRef,
|
|
4
|
-
type ComponentPropsWithoutRef,
|
|
5
|
-
type ElementType,
|
|
6
|
-
} from "react"
|
|
7
|
-
|
|
8
|
-
type AsProp<C extends ElementType> = {
|
|
9
|
-
as?: C
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type AsRef<C extends ElementType> = ComponentPropsWithRef<C>["ref"]
|
|
13
|
-
|
|
14
|
-
export type AsComponentProps<
|
|
15
|
-
C extends ElementType,
|
|
16
|
-
Props = object,
|
|
17
|
-
> = AsProp<C> &
|
|
18
|
-
ComponentPropsWithoutRef<C> &
|
|
19
|
-
Props & {
|
|
20
|
-
ref?: AsRef<C>
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type AsComponentPropsWithRef<
|
|
24
|
-
C extends ElementType,
|
|
25
|
-
Props = object,
|
|
26
|
-
> = Props & { ref?: AsRef<C> }
|
package/dist/components/index.ts
DELETED
package/park-ui.json
DELETED
package/src/fetchComponent.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// src/copy-components.ts
|
|
2
|
-
import path from "node:path"
|
|
3
|
-
import fs from "fs-extra"
|
|
4
|
-
import { fileURLToPath } from "node:url"
|
|
5
|
-
|
|
6
|
-
// __dirname은 현재 실행되는 스크립트의 디렉토리 경로 (우리 패키지 내부)
|
|
7
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
8
|
-
|
|
9
|
-
const COMPONENTS_DIR = path.join(__dirname, "./components/Button/index.tsx")
|
|
10
|
-
|
|
11
|
-
export async function copyComponent(componentName: string, outputPath: string) {
|
|
12
|
-
try {
|
|
13
|
-
// 1. 우리 패키지 안의 컴포넌트 경로
|
|
14
|
-
const sourceFile = COMPONENTS_DIR
|
|
15
|
-
|
|
16
|
-
// 2. 유저 프로젝트의 목적지 경로 (CLI 실행 위치 기준)
|
|
17
|
-
const targetFile = path.join(
|
|
18
|
-
process.cwd(),
|
|
19
|
-
outputPath,
|
|
20
|
-
`${componentName}.tsx`,
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
// 3. 복사 실행
|
|
24
|
-
await fs.copy(sourceFile, targetFile)
|
|
25
|
-
|
|
26
|
-
console.log(`${componentName} copied to ${outputPath}`)
|
|
27
|
-
} catch (error) {
|
|
28
|
-
throw new Error(`Failed to copy component: ${error}`)
|
|
29
|
-
}
|
|
30
|
-
}
|
package/src/getConfig.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import path from "node:path"
|
|
2
|
-
import fs from "fs-extra"
|
|
3
|
-
import { packageDirectory } from "pkg-dir"
|
|
4
|
-
import * as p from "@clack/prompts"
|
|
5
|
-
//TODO: json schema 제공
|
|
6
|
-
export async function getConfig(): Promise<{ outputPath: string }> {
|
|
7
|
-
const packageDir = await packageDirectory()
|
|
8
|
-
const configPath = path.join(packageDir || process.cwd(), "park-ui.json")
|
|
9
|
-
try {
|
|
10
|
-
// 1. 프로젝트 루트 디렉토리 찾기
|
|
11
|
-
|
|
12
|
-
// 2. 설정 파일 읽기 시도
|
|
13
|
-
const config = await fs.readJSON(configPath)
|
|
14
|
-
return config
|
|
15
|
-
} catch {
|
|
16
|
-
// 4. 설정 파일이 없거나 잘못된 경우 사용자에게 입력받기
|
|
17
|
-
p.note("설정 파일이 존재하지 않습니다")
|
|
18
|
-
const config = await promptConfig() //3. 사용자에게 경로 관련 입력 받기
|
|
19
|
-
|
|
20
|
-
// 5. 새 설정 파일 저장
|
|
21
|
-
await fs.outputJSON(
|
|
22
|
-
configPath,
|
|
23
|
-
{
|
|
24
|
-
...config,
|
|
25
|
-
},
|
|
26
|
-
{ spaces: 2 },
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
return config
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const promptConfig = async () =>
|
|
34
|
-
p.group(
|
|
35
|
-
{
|
|
36
|
-
outputPath: () =>
|
|
37
|
-
p.text({
|
|
38
|
-
message: "컴포넌트 저장 경로를 설정해주세요",
|
|
39
|
-
initialValue: "./src/components/ui",
|
|
40
|
-
validate: (value) => {
|
|
41
|
-
if (!value) return "Please enter a path."
|
|
42
|
-
if (!value.startsWith("."))
|
|
43
|
-
return "Please enter a relative path to the project root."
|
|
44
|
-
},
|
|
45
|
-
}),
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
onCancel: () => {
|
|
49
|
-
p.cancel("Operation cancelled.")
|
|
50
|
-
process.exit(0)
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
)
|
package/src/index.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import yargs from "yargs"
|
|
4
|
-
import { hideBin } from "yargs/helpers"
|
|
5
|
-
import { getConfig } from "./getConfig"
|
|
6
|
-
import * as p from "@clack/prompts"
|
|
7
|
-
import { copyComponent } from "./fetchComponent"
|
|
8
|
-
|
|
9
|
-
const main = async () => {
|
|
10
|
-
await yargs(hideBin(process.argv))
|
|
11
|
-
.command(
|
|
12
|
-
"components add [components..]",
|
|
13
|
-
"Add components to your project",
|
|
14
|
-
(yargs) => {
|
|
15
|
-
return yargs
|
|
16
|
-
.positional("components", {
|
|
17
|
-
describe: "List of components to add",
|
|
18
|
-
type: "string",
|
|
19
|
-
array: true,
|
|
20
|
-
default: [],
|
|
21
|
-
})
|
|
22
|
-
.option("all", {
|
|
23
|
-
type: "boolean",
|
|
24
|
-
description: "Add all components",
|
|
25
|
-
default: false,
|
|
26
|
-
})
|
|
27
|
-
},
|
|
28
|
-
async (argv) => {
|
|
29
|
-
// 컴포넌트가 없고 --all 플래그도 없으면 에러
|
|
30
|
-
if (argv.components.length === 0 && !argv.all) {
|
|
31
|
-
p.note(
|
|
32
|
-
"Error: You need to specify at least one component or use the --all flag",
|
|
33
|
-
)
|
|
34
|
-
console.log('Run "cli --help" for more information')
|
|
35
|
-
return
|
|
36
|
-
}
|
|
37
|
-
const config = await getConfig()
|
|
38
|
-
await copyComponent(argv.components[0], config.outputPath)
|
|
39
|
-
},
|
|
40
|
-
)
|
|
41
|
-
.demandCommand(1, "You need at least one command before moving on")
|
|
42
|
-
.strict()
|
|
43
|
-
.help().argv
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
main()
|
package/tsconfig.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"emitDeclarationOnly": true,
|
|
5
|
-
"noImplicitAny": true,
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"noEmit": false,
|
|
8
|
-
"declarationMap": true,
|
|
9
|
-
"declarationDir": "dist",
|
|
10
|
-
"outDir": "dist",
|
|
11
|
-
"baseUrl": "./"
|
|
12
|
-
},
|
|
13
|
-
"include": ["src"]
|
|
14
|
-
}
|
package/tsup.config.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "tsup"
|
|
2
|
-
import fs from "fs-extra"
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
entry: ["src/index.ts"],
|
|
6
|
-
format: ["esm"],
|
|
7
|
-
dts: true,
|
|
8
|
-
clean: true,
|
|
9
|
-
sourcemap: false,
|
|
10
|
-
minify: true,
|
|
11
|
-
async onSuccess() {
|
|
12
|
-
await fs.copy("../ui/src/components", "./dist/components")
|
|
13
|
-
},
|
|
14
|
-
})
|