@adobe/aem-cli 16.10.44 → 16.10.46
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 +15 -0
- package/README.md +23 -16
- package/package.json +1 -1
- package/src/import.cmd.js +8 -1
- package/src/import.js +7 -0
- package/src/log-common.js +6 -6
- package/src/server/HelixImportProject.js +10 -0
- package/src/server/HelixImportServer.js +13 -2
- package/src/up.cmd.js +6 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [16.10.46](https://github.com/adobe/helix-cli/compare/v16.10.45...v16.10.46) (2025-08-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **2576:** provide a way to dump all headers ([#2577](https://github.com/adobe/helix-cli/issues/2577)) ([38c2275](https://github.com/adobe/helix-cli/commit/38c2275a8ceec531aa9f4abb4d3cafe66c15a222))
|
|
7
|
+
|
|
8
|
+
## [16.10.45](https://github.com/adobe/helix-cli/compare/v16.10.44...v16.10.45) (2025-08-26)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* make logger compatible with helix-log v7.0.0 ([#2574](https://github.com/adobe/helix-cli/issues/2574)) ([3b937c5](https://github.com/adobe/helix-cli/commit/3b937c5bee112eadd3f5bb7b4e12b1a2651e0c03))
|
|
14
|
+
* preserve --pagesUrl as proxy with git changes ([#2573](https://github.com/adobe/helix-cli/issues/2573)) ([b5f0dfc](https://github.com/adobe/helix-cli/commit/b5f0dfca2d63c2fbccce6f15f2a241a636940b7a))
|
|
15
|
+
|
|
1
16
|
## [16.10.44](https://github.com/adobe/helix-cli/compare/v16.10.43...v16.10.44) (2025-08-25)
|
|
2
17
|
|
|
3
18
|
|
package/README.md
CHANGED
|
@@ -17,22 +17,7 @@ Install `aem` as a global command. You need Node 12.11 or newer.
|
|
|
17
17
|
npm install -g @adobe/aem-cli
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Starting with version 15.0.0, this tool is named `aem` and published as `@adobe/aem-cli`. If you previously had installed this tool under its old name `hlx` aka `@adobe/helix-cli` you might get an error like:
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
npm error EEXIST: file already exists
|
|
26
|
-
npm error File exists: /opt/homebrew/bin/hlx
|
|
27
|
-
npm error Remove the existing file and try again, or run npm
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
To solve, first uninstall the old version, then try again:
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
npm uninstall -g @adobe/helix-cli
|
|
34
|
-
npm install -g @adobe/aem-cli
|
|
35
|
-
```
|
|
20
|
+
If this fails with `File exists: /opt/homebrew/bin/hlx`, please [see here](#npm-install-fails-with-file-exists-opthomebrewbinhlx).
|
|
36
21
|
|
|
37
22
|
## Quick Start
|
|
38
23
|
|
|
@@ -204,3 +189,25 @@ aem up
|
|
|
204
189
|
```
|
|
205
190
|
|
|
206
191
|
This will make Node.js trust the server certificate and `aem up` should work.
|
|
192
|
+
|
|
193
|
+
## `npm install` fails with `File exists: /opt/homebrew/bin/hlx`
|
|
194
|
+
|
|
195
|
+
If you try to install `@adobe/aem-cli`:
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
> npm install -g @adobe/aem-cli
|
|
199
|
+
...
|
|
200
|
+
npm error EEXIST: file already exists
|
|
201
|
+
npm error File exists: /opt/homebrew/bin/hlx
|
|
202
|
+
npm error Remove the existing file and try again, or run npm
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
This can happen when you previously had installed this tool under its old package name [@adobe/helix-cli](https://www.npmjs.com/package/@adobe/helix-cli). Starting with version 15.0.0, this tool was renamed `aem` and published as `@adobe/aem-cli`. The previous `@adobe/helix-cli` has been deprecated. However, the new package still provides the command line binary under the old name `hlx` in addition to `aem`, for backwards compatibility, which can lead to the npm install error.
|
|
206
|
+
|
|
207
|
+
To solve, first uninstall the old version, then install again with the new name:
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
npm uninstall -g @adobe/helix-cli
|
|
211
|
+
npm install -g @adobe/aem-cli
|
|
212
|
+
```
|
|
213
|
+
|
package/package.json
CHANGED
package/src/import.cmd.js
CHANGED
|
@@ -24,6 +24,7 @@ export default class ImportCommand extends AbstractServerCommand {
|
|
|
24
24
|
super(logger);
|
|
25
25
|
this._importerSubPath = 'tools/importer';
|
|
26
26
|
this._allowInsecure = true;
|
|
27
|
+
this._dumpHeaders = false;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
withAllowInsecure(value) {
|
|
@@ -59,6 +60,11 @@ export default class ImportCommand extends AbstractServerCommand {
|
|
|
59
60
|
return this;
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
withDumpHeaders(value) {
|
|
64
|
+
this._dumpHeaders = value;
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
|
|
62
68
|
/**
|
|
63
69
|
* Ensure the UI branch the caller specified (or defaulted to) is the one being used.
|
|
64
70
|
* @param uiFolder
|
|
@@ -136,7 +142,8 @@ export default class ImportCommand extends AbstractServerCommand {
|
|
|
136
142
|
.withLogger(this._logger)
|
|
137
143
|
.withKill(this._kill)
|
|
138
144
|
.withAllowInsecure(this._allowInsecure)
|
|
139
|
-
.withHeadersFile(this._headersFile)
|
|
145
|
+
.withHeadersFile(this._headersFile)
|
|
146
|
+
.withDumpHeaders(this._dumpHeaders);
|
|
140
147
|
this.log.info(chalk`{yellow ___ ________ ___ __}`);
|
|
141
148
|
this.log.info(chalk`{yellow / | / ____/ |/ / (_)___ ___ ____ ____ _____/ /____ _____}`);
|
|
142
149
|
this.log.info(chalk`{yellow / /| | / __/ / /|_/ / / / __ \`__ \\/ __ \\/ __ \\/ ___/ __/ _ \\/ ___/}`);
|
package/src/import.js
CHANGED
|
@@ -80,6 +80,12 @@ export default function up() {
|
|
|
80
80
|
type: 'string',
|
|
81
81
|
default: undefined,
|
|
82
82
|
})
|
|
83
|
+
.option('dump-headers', {
|
|
84
|
+
alias: 'dumpHeaders',
|
|
85
|
+
describe: 'Dump request headers to console for debugging',
|
|
86
|
+
type: 'boolean',
|
|
87
|
+
default: false,
|
|
88
|
+
})
|
|
83
89
|
.group(['port', 'addr', 'stop-other', 'tls-cert', 'tls-key'], 'Server options')
|
|
84
90
|
.option('cache', {
|
|
85
91
|
describe: 'Path to local folder to cache the responses',
|
|
@@ -118,6 +124,7 @@ export default function up() {
|
|
|
118
124
|
.withSkipUI(argv.skipUI)
|
|
119
125
|
.withUIRepo(argv.uiRepo)
|
|
120
126
|
.withHeadersFile(argv.headersFile)
|
|
127
|
+
.withDumpHeaders(argv.dumpHeaders)
|
|
121
128
|
.run();
|
|
122
129
|
},
|
|
123
130
|
};
|
package/src/log-common.js
CHANGED
|
@@ -100,21 +100,21 @@ export function getOrCreateLogger(config = 'cli') {
|
|
|
100
100
|
? config.logFile
|
|
101
101
|
: ['-', (config && config.logFile) || path.join(logsDir, `${categ}-server.log`)];
|
|
102
102
|
|
|
103
|
-
const loggers =
|
|
103
|
+
const loggers = {};
|
|
104
104
|
logFiles.forEach((logFile) => {
|
|
105
|
-
const name = loggers.
|
|
105
|
+
const name = loggers.default ? logFile : 'default';
|
|
106
106
|
if (logFile === '-') {
|
|
107
|
-
loggers
|
|
107
|
+
loggers[name] = new ConsoleLogger({
|
|
108
108
|
filter: categ === 'cli' ? suppressProgress : filterProgress,
|
|
109
109
|
level,
|
|
110
110
|
formatter: categoryAwareMessageFormatConsole,
|
|
111
|
-
})
|
|
111
|
+
});
|
|
112
112
|
} else {
|
|
113
113
|
fs.ensureDirSync(path.dirname(logFile));
|
|
114
|
-
loggers
|
|
114
|
+
loggers[name] = new FileLogger(logFile, {
|
|
115
115
|
level: 'debug',
|
|
116
116
|
formatter: /\.json/.test(logFile) ? messageFormatJsonString : messageFormatTechnical,
|
|
117
|
-
})
|
|
117
|
+
});
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
|
|
@@ -18,6 +18,7 @@ export class HelixImportProject extends BaseProject {
|
|
|
18
18
|
super(HelixImportServer);
|
|
19
19
|
|
|
20
20
|
this._allowInsecure = true;
|
|
21
|
+
this._dumpHeaders = false;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
withAllowInsecure(value) {
|
|
@@ -42,6 +43,15 @@ export class HelixImportProject extends BaseProject {
|
|
|
42
43
|
return this._cliHeaders;
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
withDumpHeaders(value) {
|
|
47
|
+
this._dumpHeaders = value;
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get dumpHeaders() {
|
|
52
|
+
return this._dumpHeaders;
|
|
53
|
+
}
|
|
54
|
+
|
|
45
55
|
async start() {
|
|
46
56
|
this.log.debug('Launching AEM import server for importing content...');
|
|
47
57
|
await super.start();
|
|
@@ -108,6 +108,17 @@ export class HelixImportServer extends BaseServer {
|
|
|
108
108
|
delete headers['accept-encoding'];
|
|
109
109
|
await this._updateHeaders(headers);
|
|
110
110
|
|
|
111
|
+
// Dump headers if dump mode is enabled
|
|
112
|
+
if (this._project.dumpHeaders) {
|
|
113
|
+
ctx.log.info('=== REQUEST HEADERS ===');
|
|
114
|
+
ctx.log.info(`Request URL: ${url}`);
|
|
115
|
+
ctx.log.info(`Request Method: ${req.method}`);
|
|
116
|
+
Object.entries(headers).forEach(([key, value]) => {
|
|
117
|
+
ctx.log.info(`${key}: ${value}`);
|
|
118
|
+
});
|
|
119
|
+
ctx.log.info('=======================');
|
|
120
|
+
}
|
|
121
|
+
|
|
111
122
|
const ret = await getFetch(ctx.config.allowInsecure)(url, {
|
|
112
123
|
method: req.method,
|
|
113
124
|
headers,
|
|
@@ -186,8 +197,8 @@ export class HelixImportServer extends BaseServer {
|
|
|
186
197
|
host = new URL(host).origin;
|
|
187
198
|
const url = this._makeProxyURL(ctx.url, host);
|
|
188
199
|
await this._doProxyRequest(ctx, url, host, req, res);
|
|
189
|
-
|
|
190
|
-
|
|
200
|
+
// codecov:ignore:start
|
|
201
|
+
/* c8 ignore start */
|
|
191
202
|
} catch (err) {
|
|
192
203
|
log.error(`Failed to proxy AEM request ${ctx.path}: ${err.message}`);
|
|
193
204
|
res.status(502).send(`Failed to proxy AEM request: ${err.message}`);
|
package/src/up.cmd.js
CHANGED
|
@@ -25,7 +25,7 @@ export default class UpCommand extends AbstractServerCommand {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
withUrl(value) {
|
|
28
|
-
this.
|
|
28
|
+
this._originalUrl = value;
|
|
29
29
|
return this;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -90,13 +90,7 @@ export default class UpCommand extends AbstractServerCommand {
|
|
|
90
90
|
if (!this._gitUrl) {
|
|
91
91
|
throw Error('No git remote found. Make sure you have a remote "origin" configured.');
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
await this.verifyUrl(this._gitUrl, ref);
|
|
95
|
-
} else if (/\{\{(owner|repo)+\}\}/.test(this._url)) {
|
|
96
|
-
this._url = this._url
|
|
97
|
-
.replace(/\{\{owner\}\}/, this._gitUrl.owner)
|
|
98
|
-
.replace(/\{\{repo\}\}/, this._gitUrl.repo);
|
|
99
|
-
}
|
|
93
|
+
await this.initUrl(this._gitUrl, ref);
|
|
100
94
|
this._project.withProxyUrl(this._url);
|
|
101
95
|
const { site, org } = this.extractSiteAndOrg(this._url);
|
|
102
96
|
if (site && org) {
|
|
@@ -138,7 +132,7 @@ export default class UpCommand extends AbstractServerCommand {
|
|
|
138
132
|
return { site, org };
|
|
139
133
|
}
|
|
140
134
|
|
|
141
|
-
async
|
|
135
|
+
async initUrl(gitUrl, ref) {
|
|
142
136
|
const dnsName = `${ref.replace(/\//g, '-')}--${gitUrl.repo}--${gitUrl.owner}`;
|
|
143
137
|
// check length limit
|
|
144
138
|
if (dnsName.length > 63) {
|
|
@@ -148,8 +142,8 @@ export default class UpCommand extends AbstractServerCommand {
|
|
|
148
142
|
throw Error('branch name too long');
|
|
149
143
|
}
|
|
150
144
|
|
|
151
|
-
|
|
152
|
-
this._url =
|
|
145
|
+
const url = this._originalUrl || 'https://main--{{repo}}--{{owner}}.aem.page';
|
|
146
|
+
this._url = url.replace(/\{\{(owner|repo)\}\}/g, (_, key) => gitUrl[key]);
|
|
153
147
|
}
|
|
154
148
|
|
|
155
149
|
/**
|
|
@@ -182,7 +176,7 @@ export default class UpCommand extends AbstractServerCommand {
|
|
|
182
176
|
if (gitUrl.toString() !== this._gitUrl.toString()) {
|
|
183
177
|
this.log.info('git HEAD or remotes changed, reconfiguring server...');
|
|
184
178
|
this._gitUrl = gitUrl;
|
|
185
|
-
await this.
|
|
179
|
+
await this.initUrl(gitUrl, ref);
|
|
186
180
|
this._project.withProxyUrl(this._url);
|
|
187
181
|
await this._project.initHeadHtml();
|
|
188
182
|
this.log.info(`Updated proxy to ${this._url}`);
|