Skip to content

Commit e790fcc

Browse files
committed
docs spike
1 parent d6a8ce0 commit e790fcc

File tree

16 files changed

+2277
-4
lines changed

16 files changed

+2277
-4
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Setup pnpm
27+
uses: pnpm/action-setup@v4
28+
with:
29+
version: 10
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 22
35+
cache: pnpm
36+
37+
- name: Setup Pages
38+
uses: actions/configure-pages@v5
39+
40+
- name: Install dependencies
41+
run: pnpm install
42+
43+
- name: Build packages
44+
run: pnpm -r run build
45+
46+
- name: Build documentation
47+
run: pnpm run docs:build
48+
49+
- name: Upload artifact
50+
uses: actions/upload-pages-artifact@v3
51+
with:
52+
path: docs/.vitepress/dist
53+
54+
deploy:
55+
environment:
56+
name: github-pages
57+
url: ${{ steps.deployment.outputs.page_url }}
58+
needs: build
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@ package-lock.json
1515
.claude/settings.local.json
1616
.envrc
1717
CLAUDE.md
18+
19+
# VitePress
20+
docs/.vitepress/dist
21+
docs/.vitepress/cache
22+
23+
# TypeDoc generated API docs (regenerated on build)
24+
docs/api/

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ See [Tooling SDK README](./packages/b2c-tooling/README.md) for more details.
1919

2020
```bash
2121
pnpm install
22-
pnpm run dev # start the cli in dev mode
22+
pnpm start # start the cli in dev mode; see CLI readme for more details
23+
pnpm test
2324
```

docs/.vitepress/config.mts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { defineConfig } from 'vitepress';
2+
3+
export default defineConfig({
4+
title: 'B2C CLI',
5+
description: 'Salesforce Commerce Cloud B2C Command Line Tools',
6+
base: '/b2c-cli/',
7+
8+
// Show deeper heading levels in the outline
9+
markdown: {
10+
toc: { level: [2, 3, 4] },
11+
},
12+
13+
themeConfig: {
14+
outline: {
15+
level: [2, 3],
16+
},
17+
nav: [
18+
{ text: 'Guide', link: '/guide/' },
19+
{ text: 'CLI Reference', link: '/cli/' },
20+
{ text: 'API Reference', link: '/api/' },
21+
],
22+
23+
sidebar: {
24+
'/guide/': [
25+
{
26+
text: 'Getting Started',
27+
items: [
28+
{ text: 'Introduction', link: '/guide/' },
29+
{ text: 'Installation', link: '/guide/installation' },
30+
{ text: 'Configuration', link: '/guide/configuration' },
31+
],
32+
},
33+
],
34+
'/cli/': [
35+
{
36+
text: 'CLI Reference',
37+
items: [
38+
{ text: 'Overview', link: '/cli/' },
39+
{ text: 'Code Commands', link: '/cli/code' },
40+
{ text: 'Sites Commands', link: '/cli/sites' },
41+
{ text: 'Sandbox Commands', link: '/cli/sandbox' },
42+
{ text: 'MRT Commands', link: '/cli/mrt' },
43+
],
44+
},
45+
],
46+
'/api/': [
47+
{
48+
text: 'API Reference',
49+
items: [{ text: 'Overview', link: '/api/' }],
50+
},
51+
],
52+
},
53+
54+
socialLinks: [{ icon: 'github', link: 'https://github.com/salesforce/b2c-cli' }],
55+
56+
search: {
57+
provider: 'local',
58+
},
59+
},
60+
});

docs/cli/code.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Code Commands
2+
3+
Commands for managing cartridge code on B2C Commerce instances.
4+
5+
## b2c code deploy
6+
7+
Deploy cartridges to a B2C Commerce instance.
8+
9+
### Usage
10+
11+
```bash
12+
b2c code deploy [CARTRIDGEPATH]
13+
```
14+
15+
### Arguments
16+
17+
| Argument | Description | Default |
18+
|----------|-------------|---------|
19+
| `CARTRIDGEPATH` | Path to cartridges directory | `./cartridges` |
20+
21+
### Flags
22+
23+
In addition to [global flags](./index#global-flags):
24+
25+
| Flag | Short | Description |
26+
|------|-------|-------------|
27+
| `--code-version` | `-v` | Code version to deploy to (required) |
28+
29+
### Examples
30+
31+
```bash
32+
# Deploy from default ./cartridges directory
33+
b2c code deploy --server my-sandbox.demandware.net --code-version v1
34+
35+
# Deploy from custom path
36+
b2c code deploy ./my-cartridges --server my-sandbox.demandware.net --code-version v1
37+
38+
# Using environment variables
39+
export SFCC_SERVER=my-sandbox.demandware.net
40+
export SFCC_CODE_VERSION=v1
41+
export SFCC_USERNAME=my-user
42+
export SFCC_PASSWORD=my-access-key
43+
b2c code deploy
44+
```
45+
46+
### Authentication
47+
48+
This command supports both Basic Authentication and OAuth:
49+
50+
- **Basic Auth** (recommended for WebDAV): Provide `--username` and `--password`
51+
- **OAuth**: Provide `--client-id` and `--client-secret`
52+
53+
Basic authentication is preferred for WebDAV operations due to better performance.

docs/cli/index.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# CLI Reference
2+
3+
The `b2c` CLI provides commands for managing Salesforce B2C Commerce instances.
4+
5+
## Global Flags
6+
7+
These flags are available on all commands that interact with B2C instances:
8+
9+
### Instance Flags
10+
11+
| Flag | Short | Environment Variable | Description |
12+
|------|-------|---------------------|-------------|
13+
| `--server` | `-s` | `SFCC_SERVER` | B2C instance hostname |
14+
| `--webdav-server` | | `SFCC_WEBDAV_SERVER` | Separate WebDAV hostname (if different) |
15+
| `--code-version` | `-v` | `SFCC_CODE_VERSION` | Code version |
16+
17+
### Authentication Flags
18+
19+
| Flag | Short | Environment Variable | Description |
20+
|------|-------|---------------------|-------------|
21+
| `--client-id` | | `SFCC_CLIENT_ID` | OAuth client ID |
22+
| `--client-secret` | | `SFCC_CLIENT_SECRET` | OAuth client secret |
23+
| `--username` | `-u` | `SFCC_USERNAME` | Username for Basic Auth |
24+
| `--password` | `-p` | `SFCC_PASSWORD` | Password/access key for Basic Auth |
25+
26+
## Command Topics
27+
28+
- [Code Commands](./code) - Deploy cartridges and manage code versions
29+
- [Sites Commands](./sites) - List and manage sites
30+
- [Sandbox Commands](./sandbox) - Create and manage sandboxes
31+
- [MRT Commands](./mrt) - Manage Managed Runtime environments
32+
33+
## Getting Help
34+
35+
Get help for any command:
36+
37+
```bash
38+
b2c --help
39+
b2c code --help
40+
b2c code deploy --help
41+
```

docs/cli/mrt.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# MRT Commands
2+
3+
Commands for managing Managed Runtime (MRT) environments.
4+
5+
## b2c mrt env-var set
6+
7+
Set an environment variable on a Managed Runtime project.
8+
9+
### Usage
10+
11+
```bash
12+
b2c mrt env-var set <KEY> <VALUE>
13+
```
14+
15+
### Arguments
16+
17+
| Argument | Description | Required |
18+
|----------|-------------|----------|
19+
| `KEY` | Environment variable name | Yes |
20+
| `VALUE` | Environment variable value | Yes |
21+
22+
### Flags
23+
24+
| Flag | Short | Description | Required |
25+
|------|-------|-------------|----------|
26+
| `--project` | | MRT project ID | Yes |
27+
| `--environment` | `-e` | Target environment | Yes |
28+
| `--api-key` | | MRT API key | Yes |
29+
30+
### Examples
31+
32+
```bash
33+
# Set an environment variable
34+
b2c mrt env-var set MY_VAR "my value" \
35+
--project acme-storefront \
36+
--environment production \
37+
--api-key your-api-key
38+
39+
# Using environment variables
40+
export SFCC_MRT_API_KEY=your-api-key
41+
b2c mrt env-var set MY_VAR "my value" \
42+
--project acme-storefront \
43+
--environment production
44+
```
45+
46+
### Authentication
47+
48+
MRT commands use API key authentication. Provide `--api-key` or set the `SFCC_MRT_API_KEY` environment variable.
49+
50+
::: warning
51+
This command is currently a stub and not yet fully implemented.
52+
:::

docs/cli/sandbox.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Sandbox Commands
2+
3+
Commands for managing on-demand sandboxes.
4+
5+
## b2c sandbox create
6+
7+
Create a new on-demand sandbox.
8+
9+
### Usage
10+
11+
```bash
12+
b2c sandbox create <REALM>
13+
```
14+
15+
### Arguments
16+
17+
| Argument | Description | Required |
18+
|----------|-------------|----------|
19+
| `REALM` | Realm ID | Yes |
20+
21+
### Flags
22+
23+
| Flag | Description | Default |
24+
|------|-------------|---------|
25+
| `--ttl` | Time to live in hours | `24` |
26+
| `--profile` | Sandbox profile (small, medium, large) | `medium` |
27+
| `--client-id` | OAuth client ID | |
28+
| `--client-secret` | OAuth client secret | |
29+
30+
### Examples
31+
32+
```bash
33+
# Create a sandbox with default settings
34+
b2c sandbox create abcd --client-id xxx --client-secret yyy
35+
36+
# Create a sandbox with custom TTL and profile
37+
b2c sandbox create abcd --ttl 48 --profile large --client-id xxx --client-secret yyy
38+
```
39+
40+
### Authentication
41+
42+
This command requires OAuth authentication. Provide `--client-id` and `--client-secret` or set the corresponding `SFCC_CLIENT_ID` and `SFCC_CLIENT_SECRET` environment variables.
43+
44+
::: warning
45+
This command is currently a stub and not yet fully implemented.
46+
:::

docs/cli/sites.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Sites Commands
2+
3+
Commands for managing sites on B2C Commerce instances.
4+
5+
## b2c sites list
6+
7+
List sites on a B2C Commerce instance.
8+
9+
### Usage
10+
11+
```bash
12+
b2c sites list
13+
```
14+
15+
### Flags
16+
17+
Uses [global instance and authentication flags](./index#global-flags).
18+
19+
### Examples
20+
21+
```bash
22+
# List sites on an instance
23+
b2c sites list --server my-sandbox.demandware.net --client-id xxx --client-secret yyy
24+
25+
# Using environment variables
26+
export SFCC_SERVER=my-sandbox.demandware.net
27+
export SFCC_CLIENT_ID=your-client-id
28+
export SFCC_CLIENT_SECRET=your-client-secret
29+
b2c sites list
30+
```
31+
32+
### Output
33+
34+
The command displays a list of sites with their:
35+
36+
- Site ID
37+
- Display name
38+
- Status
39+
40+
Example output:
41+
42+
```
43+
Found 2 site(s):
44+
45+
RefArch
46+
Display Name: Reference Architecture
47+
Status: online
48+
49+
SiteGenesis
50+
Display Name: Site Genesis
51+
Status: online
52+
```
53+
54+
### Authentication
55+
56+
This command requires OAuth authentication. Provide `--client-id` and `--client-secret` or set the corresponding `SFCC_CLIENT_ID` and `SFCC_CLIENT_SECRET` environment variables.

0 commit comments

Comments
 (0)