Skip to content

Commit 6d8de9a

Browse files
committed
first commit
0 parents  commit 6d8de9a

1 file changed

Lines changed: 158 additions & 0 deletions

File tree

README.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# Contentstack CLI - Plugin Packages
2+
3+
This repository contains business functionality plugins for the Contentstack CLI, including export, import, clone, audit, and variants functionality.
4+
5+
## Packages
6+
7+
- **@contentstack/cli-cm-export** - Content export functionality
8+
- **@contentstack/cli-cm-import** - Content import functionality
9+
- **@contentstack/cli-cm-clone** - Stack cloning functionality
10+
- **@contentstack/cli-audit** - Content auditing functionality
11+
- **@contentstack/cli-variants** - Variants management
12+
13+
## Development Setup
14+
15+
### Standalone Development (Within this repo only)
16+
17+
```bash
18+
# Install dependencies
19+
pnpm install
20+
21+
# Build all packages
22+
pnpm build
23+
24+
# Run tests
25+
pnpm test
26+
27+
# Clean build artifacts
28+
pnpm clean
29+
```
30+
31+
### Cross-Repository Development (With cli-core)
32+
33+
For local development with the `cli-core` repository, you should work from the parent workspace:
34+
35+
```bash
36+
# Navigate to parent workspace
37+
cd ..
38+
39+
# Install all dependencies (links both repos)
40+
pnpm install
41+
42+
# Build all packages
43+
pnpm build:all
44+
45+
# Test a plugin directly
46+
pnpm dev:export cm:stacks:export --help
47+
pnpm dev:import cm:stacks:import --help
48+
49+
# Or test through the main CLI
50+
pnpm dev:cli cm:stacks:export --help
51+
```
52+
53+
See the [parent workspace README](../README.md) for more details on cross-repository development.
54+
55+
## Project Structure
56+
57+
```
58+
cli-plugins/
59+
├── packages/
60+
│ ├── contentstack-export/ # Export functionality
61+
│ ├── contentstack-import/ # Import functionality
62+
│ ├── contentstack-clone/ # Clone functionality
63+
│ ├── contentstack-audit/ # Audit functionality
64+
│ └── contentstack-variants/ # Variants functionality
65+
├── scripts/
66+
│ └── prepare-publish.js # Publishing helper
67+
├── package.json
68+
├── pnpm-workspace.yaml
69+
└── README.md
70+
```
71+
72+
## Making Changes
73+
74+
1. Make your changes in the relevant package under `packages/`
75+
2. Build the package: `cd packages/[package-name] && pnpm build`
76+
3. Test your changes:
77+
- Direct test: `./bin/run.js [command]`
78+
- Through main CLI: Test from parent workspace
79+
4. If you need to modify core dependencies, work from the parent workspace
80+
81+
## Testing Plugins
82+
83+
### Test a Plugin Directly
84+
85+
```bash
86+
cd packages/contentstack-export
87+
pnpm build
88+
./bin/run.js cm:stacks:export --help
89+
```
90+
91+
### Test Through Main CLI
92+
93+
From the parent workspace:
94+
95+
```bash
96+
cd ..
97+
pnpm dev:cli cm:stacks:export --help
98+
```
99+
100+
This tests the plugin as it would be used in production.
101+
102+
## Publishing
103+
104+
Before publishing, workspace protocol dependencies need to be resolved to actual versions:
105+
106+
```bash
107+
# Prepare packages for publishing (converts workspace:* to actual versions)
108+
pnpm prepare-publish
109+
110+
# Publish all packages
111+
pnpm publish:packages
112+
113+
# After publishing, restore workspace protocol
114+
git restore packages/*/package.json
115+
```
116+
117+
## Git Workflow
118+
119+
This repository is independent of the `cli-core` repository. Commit and push changes normally:
120+
121+
```bash
122+
git add .
123+
git commit -m "feat: your changes"
124+
git push
125+
```
126+
127+
## Dependencies
128+
129+
### Core Dependencies
130+
131+
Plugin packages depend on core packages from the `cli-core` repository:
132+
133+
- `@contentstack/cli-command` - Base command framework
134+
- `@contentstack/cli-utilities` - Shared utilities
135+
- `@contentstack/cli-auth` - Authentication (dev dependency)
136+
- `@contentstack/cli-config` - Configuration (dev dependency)
137+
138+
### Local Development
139+
140+
When developing locally with the parent workspace, these dependencies are automatically linked using the `workspace:*` protocol.
141+
142+
### Published Versions
143+
144+
When published to npm, workspace protocol is replaced with specific version ranges (e.g., `~1.7.1`).
145+
146+
## CI/CD
147+
148+
Each package in this repository can be published independently or as a batch. The publishing workflow:
149+
150+
1. Ensure cli-core packages are published first (if they have changes)
151+
2. Update plugin package versions as needed
152+
3. Run `pnpm prepare-publish` to resolve workspace dependencies
153+
4. Run `pnpm publish -r` to publish all packages
154+
5. Restore workspace protocol with `git restore packages/*/package.json`
155+
156+
## License
157+
158+
MIT

0 commit comments

Comments
 (0)