Skip to content

Commit 066831d

Browse files
committed
readme dev info
1 parent 1f717db commit 066831d

File tree

1 file changed

+122
-13
lines changed

1 file changed

+122
-13
lines changed

README.md

Lines changed: 122 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,141 @@
1-
21
# B2C CLI and Tooling SDK
32

4-
## Features
3+
[![CI](https://github.com/SalesforceCommerceCloud/b2c-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/SalesforceCommerceCloud/b2c-cli/actions/workflows/ci.yml)
54

6-
- Separate CLI and SDK
7-
- Logging
8-
- redaction
9-
- Localization Support
10-
- supply chain security
5+
Salesforce Commerce Cloud B2C Command Line Tools.
6+
7+
## Features
118

12-
## CLI
9+
- Separate CLI and SDK packages
10+
- Structured logging with redaction
11+
- Localization support (i18next)
12+
- Supply chain security via pnpm
1313

14-
See [CLI README](./packages/b2c-cli/README.md) for more details.
14+
## Packages
1515

16-
## Tooling SDK
16+
This is a pnpm monorepo with the following packages:
1717

18-
See [Tooling SDK README](./packages/b2c-tooling/README.md) for more details.
18+
| Package | Description |
19+
|---------|-------------|
20+
| [`@salesforce/b2c-cli`](./packages/b2c-cli/README.md) | Command line interface built with oclif |
21+
| [`@salesforce/b2c-tooling`](./packages/b2c-tooling/README.md) | SDK/library for B2C Commerce operations; supports the CLI and can be used standalone |
1922

2023
## Development
2124

25+
### Prerequisites
26+
27+
- Node.js >= 22.16.0
28+
- pnpm 10.17.1+
29+
30+
### Setup
31+
2232
```bash
2333
pnpm install
24-
pnpm start # start the cli in dev mode; see CLI readme for more details
34+
```
35+
36+
### Running the CLI in Development Mode
37+
38+
```bash
39+
pnpm start
40+
# or directly:
41+
pnpm --filter @salesforce/b2c-cli run dev
42+
# or using convenience script:
43+
./cli
44+
```
45+
46+
The dev mode uses Node.js `--conditions=development` to resolve TypeScript source files directly from `@salesforce/b2c-tooling` without needing to build first.
47+
48+
### Building
49+
50+
```bash
51+
# Build all packages
52+
pnpm -r run build
53+
54+
# Build individual packages
55+
pnpm --filter @salesforce/b2c-cli run build
56+
pnpm --filter @salesforce/b2c-tooling run build
57+
```
58+
59+
### Testing and Linting
60+
61+
```bash
62+
# Run all tests (also runs linter after tests)
2563
pnpm test
64+
65+
# Run linter only
66+
pnpm --filter @salesforce/b2c-cli run lint
67+
pnpm --filter @salesforce/b2c-tooling run lint
2668
```
2769

28-
Docs development
70+
### Code Formatting
71+
72+
This project uses Prettier for code formatting.
73+
74+
```bash
75+
# Format all packages
76+
pnpm -r run format
77+
78+
# Check formatting without modifying files
79+
pnpm -r run format:check
80+
```
81+
82+
## Documentation
83+
84+
Documentation is built using [TypeDoc](https://typedoc.org/) for API reference generation and [VitePress](https://vitepress.dev/) for the documentation site.
85+
86+
### Structure
87+
88+
- `docs/` - VitePress documentation source
89+
- `guide/` - User guide and getting started
90+
- `cli/` - CLI command reference
91+
- `api/` - Generated API documentation (do not edit manually)
92+
- `typedoc.json` - TypeDoc configuration with entry points for SDK modules
93+
94+
### Development Server
2995

3096
```bash
3197
pnpm run docs:dev
3298
```
99+
100+
This runs `typedoc` to generate API docs, then starts VitePress in development mode with hot reload.
101+
102+
### Building Documentation
103+
104+
```bash
105+
pnpm run docs:build
106+
```
107+
108+
### Previewing Built Documentation
109+
110+
```bash
111+
pnpm run docs:preview
112+
```
113+
114+
### API Documentation
115+
116+
API documentation is auto-generated from JSDoc comments in the `@salesforce/b2c-tooling` package. The entry points are defined in `typedoc.json`:
117+
118+
See the [documentation site](https://verbose-adventure-1eqmr1r.pages.github.io/) for the generated API reference.
119+
120+
- `auth` - Authentication strategies (OAuth, API Key, Basic)
121+
- `instance` - B2C instance configuration
122+
- `platform` - MRT and ODS clients
123+
- `operations/code` - Cartridge code operations
124+
- `operations/jobs` - Job execution
125+
- `operations/sites` - Site management
126+
- `i18n` - Internationalization utilities
127+
- `logging` - Structured logging
128+
129+
When adding new public APIs, ensure they have comprehensive JSDoc comments as these will appear in the generated documentation.
130+
131+
## Package Exports
132+
133+
The `@salesforce/b2c-tooling` package uses the `exports` field in package.json to define its public API surface. Each module is available as a subpath export:
134+
135+
```typescript
136+
import { OAuthStrategy } from '@salesforce/b2c-tooling/auth';
137+
import { B2CInstance } from '@salesforce/b2c-tooling/instance';
138+
import { getLogger } from '@salesforce/b2c-tooling/logging';
139+
```
140+
141+
The `development` condition in exports enables direct TypeScript source resolution when using `--conditions=development`, which is how `bin/dev.js` works for local development.

0 commit comments

Comments
 (0)