@adobe/aem-cli 16.19.14 → 16.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/content/clone.cmd.js +27 -6
- package/src/content/clone.js +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [16.20.0](https://github.com/adobe/helix-cli/compare/v16.19.14...v16.20.0) (2026-06-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **content:** add --org/--site options to aem content clone ([#2738](https://github.com/adobe/helix-cli/issues/2738)) ([58f5b54](https://github.com/adobe/helix-cli/commit/58f5b54c729990359e11a02f569866083ac1c393)), closes [#2725](https://github.com/adobe/helix-cli/issues/2725)
|
|
7
|
+
|
|
1
8
|
## [16.19.14](https://github.com/adobe/helix-cli/compare/v16.19.13...v16.19.14) (2026-06-04)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/content/clone.cmd.js
CHANGED
|
@@ -67,6 +67,8 @@ export default class CloneCommand {
|
|
|
67
67
|
this._force = false;
|
|
68
68
|
this._assumeYes = false;
|
|
69
69
|
this._rootPath = null;
|
|
70
|
+
this._org = null;
|
|
71
|
+
this._site = null;
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
withDirectory(dir) {
|
|
@@ -94,6 +96,16 @@ export default class CloneCommand {
|
|
|
94
96
|
return this;
|
|
95
97
|
}
|
|
96
98
|
|
|
99
|
+
withOrg(org) {
|
|
100
|
+
this._org = org ? org.trim() : null;
|
|
101
|
+
return this;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
withSite(site) {
|
|
105
|
+
this._site = site ? site.trim() : null;
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
108
|
+
|
|
97
109
|
async run() {
|
|
98
110
|
const { log } = this;
|
|
99
111
|
|
|
@@ -101,13 +113,22 @@ export default class CloneCommand {
|
|
|
101
113
|
throw new Error('Clone root path was not set (internal error).');
|
|
102
114
|
}
|
|
103
115
|
|
|
104
|
-
// 1. Resolve org/site
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
116
|
+
// 1. Resolve org/site: explicit --org/--site override, otherwise derive from git remote
|
|
117
|
+
const hasOrg = !!this._org;
|
|
118
|
+
const hasSite = !!this._site;
|
|
119
|
+
let org;
|
|
120
|
+
let site;
|
|
121
|
+
if (hasOrg && hasSite) {
|
|
122
|
+
org = this._org.toLowerCase();
|
|
123
|
+
site = this._site.toLowerCase();
|
|
124
|
+
} else {
|
|
125
|
+
const originUrl = await GitUtils.getOriginURL(this._dir);
|
|
126
|
+
if (!originUrl) {
|
|
127
|
+
throw new Error('No git remote found. Run `aem content clone` inside an AEM project directory.');
|
|
128
|
+
}
|
|
129
|
+
org = originUrl.owner.toLowerCase();
|
|
130
|
+
site = originUrl.repo.toLowerCase();
|
|
108
131
|
}
|
|
109
|
-
const org = originUrl.owner.toLowerCase();
|
|
110
|
-
const site = originUrl.repo.toLowerCase();
|
|
111
132
|
log.info(`Cloning content from da.live: ${org}/${site}${this._rootPath === '/' ? '' : ` @ ${this._rootPath}`}`);
|
|
112
133
|
|
|
113
134
|
// 2. Ensure target path is available (do not create content/ until after file count is known)
|
package/src/content/clone.js
CHANGED
|
@@ -22,6 +22,14 @@ export default function clone() {
|
|
|
22
22
|
description: 'Clone da.live content locally into content/',
|
|
23
23
|
builder: (yargs) => {
|
|
24
24
|
yargs
|
|
25
|
+
.option('org', {
|
|
26
|
+
describe: 'da.live org to clone from. Overrides the org derived from the git remote.',
|
|
27
|
+
type: 'string',
|
|
28
|
+
})
|
|
29
|
+
.option('site', {
|
|
30
|
+
describe: 'da.live site to clone from. Overrides the site derived from the git remote.',
|
|
31
|
+
type: 'string',
|
|
32
|
+
})
|
|
25
33
|
.option('path', {
|
|
26
34
|
describe: 'da.live folder to clone (e.g. /ca/fr_ca). Omit only when using --all.',
|
|
27
35
|
type: 'string',
|
|
@@ -47,6 +55,11 @@ export default function clone() {
|
|
|
47
55
|
default: false,
|
|
48
56
|
})
|
|
49
57
|
.check((argv) => {
|
|
58
|
+
const org = (argv.org || '').trim();
|
|
59
|
+
const site = (argv.site || '').trim();
|
|
60
|
+
if ((org && !site) || (!org && site)) {
|
|
61
|
+
return '--org and --site must be used together.';
|
|
62
|
+
}
|
|
50
63
|
if (argv.all && argv.path !== undefined && argv.path !== '') {
|
|
51
64
|
return 'Do not use --path together with --all.';
|
|
52
65
|
}
|
|
@@ -67,6 +80,8 @@ export default function clone() {
|
|
|
67
80
|
.withToken(argv.token)
|
|
68
81
|
.withForce(argv.force)
|
|
69
82
|
.withAssumeYes(argv.yes)
|
|
83
|
+
.withOrg(argv.org)
|
|
84
|
+
.withSite(argv.site)
|
|
70
85
|
.withRootPath(rootPath)
|
|
71
86
|
.run();
|
|
72
87
|
},
|