subaya 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/README.md +54 -118
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,156 +1,92 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Subaya
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A CLI tool for frontend development that automates image optimization, state management, API configuration, and more.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
├── core/ # 코어 시스템
|
|
10
|
-
│ ├── BaseCommand.ts # 모든 커맨드의 베이스 클래스
|
|
11
|
-
│ ├── BaseExtensionCommands.ts # API, State, Route 커맨드 베이스
|
|
12
|
-
│ ├── CommandRegistry.ts # 커맨드 등록 및 관리
|
|
13
|
-
│ ├── ConfigManager.ts # 설정 관리 (Singleton)
|
|
14
|
-
│ ├── FileSystemService.ts # 파일 시스템 유틸리티
|
|
15
|
-
│ └── FrameworkDetector.ts # 프레임워크 감지
|
|
16
|
-
│
|
|
17
|
-
├── commands/ # 커맨드 구현
|
|
18
|
-
│ ├── image/
|
|
19
|
-
│ │ ├── ImageOptimizeCommand.ts # 이미지 최적화
|
|
20
|
-
│ │ ├── ImageResizeCommand.ts # 이미지 리사이즈
|
|
21
|
-
│ │ └── BackgroundRemoveCommand.ts # 배경 제거
|
|
22
|
-
│ ├── api/ # (향후 확장) axios, orpc
|
|
23
|
-
│ ├── state/ # (향후 확장) zustand, redux
|
|
24
|
-
│ └── route/ # (향후 확장) route 생성
|
|
25
|
-
│
|
|
26
|
-
├── utils/ # 유틸리티
|
|
27
|
-
│ └── PathSearcher.ts # 파일 검색
|
|
28
|
-
│
|
|
29
|
-
├── types/ # 타입 정의
|
|
30
|
-
│ └── index.ts
|
|
31
|
-
│
|
|
32
|
-
├── config/ # 기본 설정
|
|
33
|
-
│ └── index.ts
|
|
34
|
-
│
|
|
35
|
-
├── template/ # 템플릿
|
|
36
|
-
│ └── nextImage.ts
|
|
37
|
-
│
|
|
38
|
-
└── index.ts # CLI 진입점
|
|
7
|
+
```bash
|
|
8
|
+
npm i subaya
|
|
39
9
|
```
|
|
40
10
|
|
|
41
|
-
##
|
|
11
|
+
## Usage
|
|
42
12
|
|
|
43
|
-
|
|
44
|
-
- **BaseCommand**: 모든 커맨드가 상속받는 추상 클래스
|
|
45
|
-
- **CommandRegistry**: 커맨드 등록 및 디스패칭
|
|
46
|
-
- **ConfigManager**: Singleton 패턴으로 설정 관리
|
|
47
|
-
- **FileSystemService**: 파일 시스템 작업 추상화
|
|
48
|
-
- **FrameworkDetector**: Next.js/React 자동 감지
|
|
13
|
+
Run commands with `npx subaya` from your project root.
|
|
49
14
|
|
|
50
|
-
###
|
|
51
|
-
각 커맨드는 `ICommand` 인터페이스를 구현하며 `execute()` 메서드를 통해 실행됩니다.
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
54
|
-
export interface ICommand {
|
|
55
|
-
execute(): Promise<void>
|
|
56
|
-
}
|
|
15
|
+
### Single-command categories
|
|
57
16
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
17
|
+
| Command | Description |
|
|
18
|
+
| ------------------------- | ------------------------------------------------- |
|
|
19
|
+
| `npx subaya route` | Generate Next.js route files |
|
|
20
|
+
| `npx subaya icon` | Convert SVG files to React components |
|
|
21
|
+
| `npx subaya api` | Generate API client files (oRPC) |
|
|
22
|
+
| `npx subaya env` | Generate `.env` template and env type definitions |
|
|
23
|
+
| `npx subaya localstorage` | Generate LocalStorage state utility |
|
|
24
|
+
| `npx subaya state` | Generate global state (Zustand-based) |
|
|
25
|
+
| `npx subaya supabase` | Connect and configure Supabase |
|
|
26
|
+
| `npx subaya share` | Generate SNS sharing utility and hook |
|
|
63
27
|
|
|
64
|
-
###
|
|
65
|
-
새로운 기능 추가 시:
|
|
28
|
+
### Image subcommands
|
|
66
29
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
30
|
+
| Command | Description |
|
|
31
|
+
| --------------------------- | --------------------------------------------------------------------- |
|
|
32
|
+
| `npx subaya image optimize` | Optimize images (WebP conversion; optional resize by filename suffix) |
|
|
33
|
+
| `npx subaya image removebg` | Remove background from PNG images |
|
|
34
|
+
| `npx subaya image resize` | Resize specific images |
|
|
72
35
|
|
|
73
|
-
|
|
36
|
+
---
|
|
74
37
|
|
|
75
|
-
|
|
76
|
-
# 설치
|
|
77
|
-
npm install -g image-optimization-generator
|
|
38
|
+
## Configuration
|
|
78
39
|
|
|
79
|
-
|
|
80
|
-
iog image optimize
|
|
40
|
+
Configuration is optional. Create `subaya.config.js` in your **project root** (the directory where you run `npx subaya`). If the file is missing, defaults are used and a warning is printed.
|
|
81
41
|
|
|
82
|
-
|
|
83
|
-
|
|
42
|
+
**Location:** `./subaya.config.js` (resolved from the current working directory)
|
|
43
|
+
**Format:** CommonJS module exporting a default object.
|
|
84
44
|
|
|
85
|
-
|
|
86
|
-
iog image removebg
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## 설정 파일
|
|
90
|
-
|
|
91
|
-
프로젝트 루트에 `iog.config.js` 생성:
|
|
45
|
+
### Schema
|
|
92
46
|
|
|
93
47
|
```javascript
|
|
94
|
-
|
|
48
|
+
// subaya.config.js
|
|
49
|
+
module.exports = {
|
|
95
50
|
image: {
|
|
96
|
-
inputImageDir: "public/images",
|
|
97
51
|
optimize: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
componentsPath: "src/components",
|
|
52
|
+
// Optional. Max width (px) for images whose filename ends with _bg, _mbg, _thumb, or _icon.
|
|
53
|
+
// Only the keys below are read; values must be numbers.
|
|
101
54
|
maxWidth: {
|
|
102
|
-
bg: 1920,
|
|
103
|
-
mbg:
|
|
104
|
-
thumb:
|
|
105
|
-
icon:
|
|
55
|
+
bg: 1920, // e.g. hero_bg.png → resized to max 1920px width
|
|
56
|
+
mbg: 800, // e.g. section_mbg.png
|
|
57
|
+
thumb: 400, // e.g. photo_thumb.png
|
|
58
|
+
icon: 64, // e.g. logo_icon.png
|
|
106
59
|
},
|
|
107
60
|
},
|
|
108
61
|
removebg: {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
resize: {
|
|
112
|
-
maxWidth: 1920,
|
|
62
|
+
// Required for `subaya image removebg`. API key for the background-removal service.
|
|
63
|
+
removebgApiKey: process.env.REMOVEBG_API_KEY || null,
|
|
113
64
|
},
|
|
114
65
|
},
|
|
115
|
-
// 향후 확장
|
|
116
66
|
api: {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
state: {
|
|
121
|
-
type: "zustand",
|
|
122
|
-
outputDir: "src/store",
|
|
67
|
+
// Used by `subaya api` (oRPC) to fetch schema from your API.
|
|
68
|
+
baseUrl: process.env.API_BASE_URL || null,
|
|
123
69
|
},
|
|
124
70
|
}
|
|
125
71
|
```
|
|
126
72
|
|
|
127
|
-
|
|
73
|
+
### Config reference
|
|
128
74
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
-
|
|
132
|
-
|
|
75
|
+
| Field | Used by | Description |
|
|
76
|
+
| ------------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
77
|
+
| `image.optimize.maxWidth` | `subaya image optimize` | When an image filename ends with `_bg`, `_mbg`, `_thumb`, or `_icon`, the image is resized so its width does not exceed the corresponding value (in pixels). Omitted keys are ignored. Percent-based resize (e.g. `_50%`) is handled automatically and does not use this config. |
|
|
78
|
+
| `image.removebg.removebgApiKey` | `subaya image removebg` | API key for the background-removal service. If not set, the command will warn and skip API-based removal. |
|
|
79
|
+
| `api.baseUrl` | `subaya api` | Base URL of your API. Used by the oRPC generator to fetch the schema. If not set, the command will warn. |
|
|
133
80
|
|
|
134
|
-
|
|
135
|
-
- Zustand store 생성
|
|
136
|
-
- Redux toolkit 설정
|
|
137
|
-
- Jotai/Recoil 지원
|
|
81
|
+
---
|
|
138
82
|
|
|
139
|
-
|
|
140
|
-
- Next.js App Router 자동 생성
|
|
141
|
-
- React Router 설정
|
|
83
|
+
## Requirements
|
|
142
84
|
|
|
143
|
-
|
|
85
|
+
- **Node.js** (see your project’s supported version).
|
|
86
|
+
- **Optional:** `@imgly/background-removal-node` is a peer dependency for `subaya image removebg`. Install it in your project if you use background removal.
|
|
144
87
|
|
|
145
|
-
|
|
146
|
-
# 빌드
|
|
147
|
-
npm run build
|
|
148
|
-
|
|
149
|
-
# 로컬 테스트
|
|
150
|
-
npm link
|
|
151
|
-
iog image optimize
|
|
152
|
-
```
|
|
88
|
+
---
|
|
153
89
|
|
|
154
|
-
##
|
|
90
|
+
## License
|
|
155
91
|
|
|
156
92
|
ISC
|