You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@W-22453800 site library support in libraries config (#422)
* site library support in libraries config
Extends libraries to accept {id, siteLibrary?} entries (mixed with strings).
b2c content list/export default --site-library from a matching entry; the
flag is now allowNo with no default so explicit values still win. The VS
Code Content Libraries tree auto-seeds every entry on activation. Adds
libraries, assetQuery, and realm rows to the documented package.json /
dw.json field tables.
* docs: example libraries config in content commands
Add a concrete example of the libraries config (mixed shared + site
entries) under b2c content export, and a corresponding inferred-flag
example under b2c content list, so the new behavior is visible in the
CLI command docs and not just the configuration guide.
* docs: use idiomatic library/site IDs in libraries examples
The site library example now uses SiteGenesis (a real site ID) and the
shared library is RefArchSharedLibrary so the difference between a
site-private and shared library is obvious from the IDs alone.
* fix(vs-extension): include contentLibrary alongside libraries in tree
When both contentLibrary and libraries are configured, the Content
Libraries tree now seeds the union of both rather than only the
libraries array. Uses a new getExplicitContentLibrary accessor so the
seeder doesn't double-add a library that's already in the libraries
list via the existing libraries[0] fallback in getContentLibrary.
The `libraries` config field now accepts `{id, siteLibrary?}` objects in addition to bare strings (mixed forms allowed in the same array). This lets you mark site-private libraries in `dw.json` or `package.json` so `b2c content list` / `content export` can default `--site-library` based on which library you target, and the VS Code Content Libraries tree auto-loads every configured library on activation. To upgrade, optionally replace `"libraries": ["RefArchSharedLibrary"]` with `"libraries": ["RefArchSharedLibrary", {"id": "SiteGenesis", "siteLibrary": true}]`. The existing string-only form continues to work unchanged. Also adds `libraries`, `assetQuery`, and `realm` to the documented `package.json` allowed fields list (already supported in code).
|`--site-library`| Treat the library as a site-private library|`false`|
56
+
|`--site-library`/ `--no-site-library`| Treat the library as a site-private library. Defaults from a matching `libraries` config entry, otherwise `false`| from config|
57
57
|`--asset-query`, `-q`| JSON dot-paths for static asset extraction (can be repeated) |`image.path`|
58
58
|`--regex`, `-r`| Treat page IDs as regular expressions |`false`|
59
59
|`--folder`| Filter by folder classification (can be repeated) ||
# With a libraries config entry (see below) marking the site library as
107
+
# site-private, --site-library is inferred automatically:
108
+
b2c content export homepage --library SiteGenesis
109
+
```
110
+
111
+
### Configuring multiple libraries
112
+
113
+
Listing libraries under `b2c.libraries` in `package.json` (or `libraries` in `dw.json`) lets the CLI pick a default library and infer `--site-library` per entry. Bare strings are shared libraries; `{id, siteLibrary: true}` marks a site-private library. Both forms can be mixed:
114
+
115
+
```json
116
+
{
117
+
"b2c": {
118
+
"libraries": [
119
+
"RefArchSharedLibrary",
120
+
{ "id": "SiteGenesis", "siteLibrary": true }
121
+
]
122
+
}
123
+
}
124
+
```
125
+
126
+
With this config:
127
+
128
+
```bash
129
+
# Uses RefArchSharedLibrary (first entry) as the default library
130
+
b2c content export hero-banner
131
+
132
+
# --site-library is inferred from the matching entry
@@ -116,7 +148,7 @@ With `--json`, returns a structured result including the library tree, output pa
116
148
117
149
### Notes
118
150
119
-
- The `--library` flag can be set in `dw.json` as `content-library` or in `package.json` under `b2c.contentLibrary` to avoid passing it every time
151
+
- The `--library` flag can be set in `dw.json` as `content-library` or in `package.json` under `b2c.contentLibrary` to avoid passing it every time. You can also list libraries under `b2c.libraries` (mixed strings or `{id, siteLibrary?}` objects); when the resolved library matches an entry marked `siteLibrary: true`, `--site-library` defaults to true automatically. The CLI flag still wins when passed explicitly
120
152
- Use `b2c content list` to discover available page IDs before exporting
121
153
- You can export pages, content assets, or individual components by their content ID. When a component ID is specified, it is promoted to the root of the export with its full child tree
122
154
- The `--asset-query` flag specifies JSON dot-notation paths within component data to extract static asset references. The default `image.path` covers the common Page Designer image component pattern
@@ -141,7 +173,7 @@ In addition to [global flags](./index#global-flags):
141
173
| Flag | Description | Default |
142
174
|------|-------------|---------|
143
175
|`--library`| Library ID or site ID. Also configurable via `content-library` in dw.json. ||
144
-
|`--site-library`| Treat the library as a site-private library|`false`|
176
+
|`--site-library`/ `--no-site-library`| Treat the library as a site-private library. Defaults from a matching `libraries` config entry, otherwise `false`| from config|
145
177
|`--library-file`| Use a local library XML file instead of fetching from instance ||
146
178
|`--type`| Filter by node type: `page`, `content`, or `component`||
147
179
|`--components`| Include components in table output |`false`|
@@ -166,6 +198,11 @@ b2c content list --library SharedLibrary --tree
166
198
# List from a site-private library
167
199
b2c content list --library RefArch --site-library
168
200
201
+
# With a libraries config entry marking the site library as site-private,
202
+
# --site-library is inferred automatically (see "b2c content export"
203
+
# above for an example b2c.libraries config):
204
+
b2c content list --library SiteGenesis
205
+
169
206
# List from a local XML file
170
207
b2c content list --library SharedLibrary --library-file ./library.xml
Copy file name to clipboardExpand all lines: docs/guide/configuration.md
+39-9Lines changed: 39 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -258,8 +258,11 @@ For the full command reference with all flags, see [Setup Commands](/cli/setup).
258
258
|`account-manager-host`| Account Manager hostname for OAuth |
259
259
|`shortCode`| SCAPI short code. Also accepts `short-code` or `scapi-shortcode`. |
260
260
|`content-library`| Default content library ID for `content export` and `content list` commands |
261
+
|`libraries`| Library IDs for the WebDAV browser and Content Libraries tree. Accepts `string[]` or `[{id, siteLibrary?}]`; elements may be mixed |
262
+
|`asset-query`| JSON dot-paths used to extract static asset URLs during content library parsing (default `["image.path"]`). Also accepts `assetQuery`|
261
263
|`tenant-id`| Organization/tenant ID for SCAPI |
262
264
|`sandbox-api-host`| ODS (sandbox) API hostname |
265
+
|`realm`| Default ODS realm for sandbox operations |
263
266
|`cip-host`| CIP analytics host override |
264
267
|`mrtApiKey`| MRT API key |
265
268
|`mrtProject`| MRT project slug |
@@ -319,15 +322,18 @@ You can store project-level defaults in your `package.json` file under the `b2c`
319
322
320
323
Only non-sensitive, project-level fields can be configured in `package.json`. Both camelCase and kebab-case are accepted (e.g., `shortCode` or `short-code`):
|`clientId`| OAuth client ID (for implicit login discovery) |
329
+
|`contentLibrary`| Default content library ID for `content export` and `content list` commands |
330
+
|`libraries`| Library IDs for the WebDAV browser and Content Libraries tree. Accepts `string[]` or `[{id, siteLibrary?}]`; elements may be mixed |
331
+
|`assetQuery`| JSON dot-paths used to extract static asset URLs during content library parsing (default `["image.path"]`) |
332
+
|`mrtProject`| MRT project slug |
333
+
|`mrtOrigin`| MRT API origin URL override |
334
+
|`accountManagerHost`| Account Manager hostname for OAuth |
335
+
|`sandboxApiHost`| ODS (sandbox) API hostname |
336
+
|`realm`| Default ODS realm for sandbox operations |
331
337
332
338
::: warning Security Note
333
339
Sensitive fields like `hostname`, `password`, `clientSecret`, `username`, and `mrtApiKey` are intentionally **not** supported in `package.json`. These should be configured via `dw.json` (which should be in `.gitignore`), environment variables, or secure credential stores.
@@ -337,6 +343,30 @@ Sensitive fields like `hostname`, `password`, `clientSecret`, `username`, and `m
337
343
`package.json` has the lowest priority of all configuration sources. Values from `dw.json`, environment variables, or CLI flags will always override `package.json` settings. This makes it ideal for project defaults that can be overridden per-environment.
338
344
:::
339
345
346
+
### Content Libraries Example
347
+
348
+
The `libraries` field can list the content libraries your project works with so that the VS Code Content Libraries tree auto-loads them and `b2c content list/export` can default `--site-library` based on the entry.
349
+
350
+
A bare string is treated as a shared library; an object can mark a library as site-private. Both forms can appear in the same array:
351
+
352
+
```json
353
+
{
354
+
"b2c": {
355
+
"libraries": [
356
+
"RefArchSharedLibrary",
357
+
{ "id": "SiteGenesis", "siteLibrary": true }
358
+
]
359
+
}
360
+
}
361
+
```
362
+
363
+
With this config:
364
+
365
+
-`b2c content list --library SiteGenesis` calls the site-library API automatically (no need to pass `--site-library`); the library ID is the site ID.
366
+
-`b2c content list --library RefArchSharedLibrary` treats `RefArchSharedLibrary` as a shared library.
367
+
-`--site-library` / `--no-site-library` on the command line still wins over the config default.
368
+
- The VS Code Content Libraries tree shows both entries on activation, with `SiteGenesis` marked `[site]`.
369
+
340
370
### Resolution Priority
341
371
342
372
Configuration is resolved with the following precedence (highest to lowest):
0 commit comments