Skip to content

Commit f10d3cc

Browse files
Copilothotlong
andcommitted
Add create-plugin CLI tool for scaffolding new plugins
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 0716d20 commit f10d3cc

6 files changed

Lines changed: 571 additions & 0 deletions

File tree

packages/create-plugin/README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# @object-ui/create-plugin
2+
3+
CLI tool to quickly scaffold new ObjectUI plugins with best practices.
4+
5+
## Usage
6+
7+
```bash
8+
# Using pnpm
9+
pnpm create @object-ui/plugin my-plugin
10+
11+
# Using npm
12+
npm create @object-ui/plugin my-plugin
13+
14+
# Using npx
15+
npx @object-ui/create-plugin my-plugin
16+
```
17+
18+
## What Gets Generated
19+
20+
The tool creates a complete plugin package structure:
21+
22+
```
23+
packages/plugin-my-plugin/
24+
├── src/
25+
│ ├── index.tsx # Plugin export & registration
26+
│ ├── MyPluginImpl.tsx # Component implementation
27+
│ ├── MyPluginImpl.test.tsx # Tests
28+
│ └── types.ts # Schema definitions
29+
├── package.json
30+
├── tsconfig.json
31+
├── vite.config.ts
32+
└── README.md
33+
```
34+
35+
## Features
36+
37+
- ✅ TypeScript support out of the box
38+
- ✅ Vite build configuration
39+
- ✅ Component registration with ComponentRegistry
40+
- ✅ Test setup with Vitest
41+
- ✅ Proper package.json with workspace dependencies
42+
- ✅ README template
43+
- ✅ Type definitions
44+
45+
## Interactive Mode
46+
47+
Run without arguments for interactive prompts:
48+
49+
```bash
50+
pnpm create @object-ui/plugin
51+
```
52+
53+
You'll be prompted for:
54+
- Plugin name
55+
- Description
56+
- Author name
57+
58+
## Options
59+
60+
```bash
61+
pnpm create @object-ui/plugin my-plugin --description "My awesome plugin" --author "Your Name"
62+
```
63+
64+
## After Creation
65+
66+
1. Navigate to the plugin directory:
67+
```bash
68+
cd packages/plugin-my-plugin
69+
```
70+
71+
2. Install dependencies:
72+
```bash
73+
pnpm install
74+
```
75+
76+
3. Build the plugin:
77+
```bash
78+
pnpm build
79+
```
80+
81+
4. Run tests:
82+
```bash
83+
pnpm test
84+
```
85+
86+
## License
87+
88+
MIT
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "@object-ui/create-plugin",
3+
"version": "0.3.1",
4+
"description": "CLI tool to scaffold ObjectUI plugins",
5+
"type": "module",
6+
"license": "MIT",
7+
"bin": {
8+
"create-plugin": "./dist/index.js"
9+
},
10+
"files": [
11+
"dist",
12+
"templates"
13+
],
14+
"scripts": {
15+
"build": "tsup",
16+
"dev": "tsup --watch",
17+
"test": "vitest run",
18+
"lint": "eslint ."
19+
},
20+
"dependencies": {
21+
"chalk": "^5.4.1",
22+
"commander": "^14.0.2",
23+
"fs-extra": "^11.2.0",
24+
"prompts": "^2.4.2"
25+
},
26+
"devDependencies": {
27+
"@types/fs-extra": "^11.0.4",
28+
"@types/node": "^25.0.10",
29+
"@types/prompts": "^2.4.9",
30+
"tsup": "^8.0.0",
31+
"typescript": "^5.9.3",
32+
"vitest": "^4.0.18"
33+
}
34+
}

0 commit comments

Comments
 (0)