@adobe/aem-cli 16.2.14 → 16.3.1
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 +14 -0
- package/README.md +1 -1
- package/package.json +2 -2
- package/src/up.cmd.js +19 -39
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [16.3.1](https://github.com/adobe/helix-cli/compare/v16.3.0...v16.3.1) (2024-03-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update dependency express to v4.19.1 ([c6a4299](https://github.com/adobe/helix-cli/commit/c6a429947a6adea4307de5a89a48e6783c4088b7))
|
|
7
|
+
|
|
8
|
+
# [16.3.0](https://github.com/adobe/helix-cli/compare/v16.2.14...v16.3.0) (2024-03-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* always proxy from main branch by default ([#2333](https://github.com/adobe/helix-cli/issues/2333)) ([e0b9be2](https://github.com/adobe/helix-cli/commit/e0b9be2f3d21f429c3b1b206145d50debacbac3c)), closes [#2331](https://github.com/adobe/helix-cli/issues/2331) [#2328](https://github.com/adobe/helix-cli/issues/2328)
|
|
14
|
+
|
|
1
15
|
## [16.2.14](https://github.com/adobe/helix-cli/compare/v16.2.13...v16.2.14) (2024-03-14)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/aem-cli",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.3.1",
|
|
4
4
|
"description": "AEM CLI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"cookie": "0.6.0",
|
|
51
51
|
"cookie-parser": "1.4.6",
|
|
52
52
|
"dotenv": "16.4.5",
|
|
53
|
-
"express": "4.
|
|
53
|
+
"express": "4.19.1",
|
|
54
54
|
"faye-websocket": "0.11.4",
|
|
55
55
|
"fs-extra": "11.2.0",
|
|
56
56
|
"glob": "10.3.10",
|
package/src/up.cmd.js
CHANGED
|
@@ -74,22 +74,16 @@ export default class UpCommand extends AbstractServerCommand {
|
|
|
74
74
|
this.log.info('');
|
|
75
75
|
|
|
76
76
|
const ref = await GitUtils.getBranch(this.directory);
|
|
77
|
-
|
|
78
|
-
let explicitURL = true;
|
|
77
|
+
this._gitUrl = await GitUtils.getOriginURL(this.directory, { ref });
|
|
79
78
|
if (!this._url) {
|
|
80
|
-
|
|
81
|
-
// check if remote already has the `ref`
|
|
82
|
-
await this.verifyUrl(gitUrl, ref);
|
|
79
|
+
await this.verifyUrl(this._gitUrl, ref);
|
|
83
80
|
}
|
|
84
81
|
this._project.withProxyUrl(this._url);
|
|
85
82
|
await this.initSeverOptions();
|
|
86
83
|
|
|
87
84
|
try {
|
|
88
85
|
await this._project.init();
|
|
89
|
-
|
|
90
|
-
if (!explicitURL) {
|
|
91
|
-
this.watchGit();
|
|
92
|
-
}
|
|
86
|
+
this.watchGit();
|
|
93
87
|
} catch (e) {
|
|
94
88
|
throw Error(`Unable to start AEM: ${e.message}`);
|
|
95
89
|
}
|
|
@@ -99,7 +93,7 @@ export default class UpCommand extends AbstractServerCommand {
|
|
|
99
93
|
});
|
|
100
94
|
}
|
|
101
95
|
|
|
102
|
-
async verifyUrl(gitUrl,
|
|
96
|
+
async verifyUrl(gitUrl, ref) {
|
|
103
97
|
// check if the site is on helix5
|
|
104
98
|
// https://admin.hlx.page/sidekick/adobe/www-aem-live/main/config.json
|
|
105
99
|
// {
|
|
@@ -116,7 +110,7 @@ export default class UpCommand extends AbstractServerCommand {
|
|
|
116
110
|
// "project": "Helix Website (AEM Live)",
|
|
117
111
|
// "testProperty": "header";
|
|
118
112
|
// }
|
|
119
|
-
const configUrl = `https://admin.hlx.page/sidekick/${gitUrl.owner}/${gitUrl.repo}
|
|
113
|
+
const configUrl = `https://admin.hlx.page/sidekick/${gitUrl.owner}/${gitUrl.repo}/main/config.json`;
|
|
120
114
|
const configResp = await getFetch()(configUrl);
|
|
121
115
|
let previewHostBase = 'hlx.page';
|
|
122
116
|
if (configResp.ok) {
|
|
@@ -128,34 +122,17 @@ export default class UpCommand extends AbstractServerCommand {
|
|
|
128
122
|
}
|
|
129
123
|
}
|
|
130
124
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
// replace `/` by `-` in ref.
|
|
134
|
-
ref = ref.replace(/\//g, '-');
|
|
135
|
-
this._url = `https://${ref}--${gitUrl.repo}--${gitUrl.owner}.${previewHostBase}`;
|
|
125
|
+
const dnsName = `${ref.replace(/\//g, '-')}--${gitUrl.repo}--${gitUrl.owner}`;
|
|
136
126
|
// check length limit
|
|
137
|
-
if (
|
|
138
|
-
.
|
|
139
|
-
.some((part) => part.length > 63)) {
|
|
140
|
-
this.log.error(chalk`URL {yellow ${this._url}} exceeds the 63 character limit for DNS labels.`);
|
|
127
|
+
if (dnsName.length > 63) {
|
|
128
|
+
this.log.error(chalk`URL {yellow https://${dnsName}.${previewHostBase}} exceeds the 63 character limit for DNS labels.`);
|
|
141
129
|
this.log.error(chalk`Please use a shorter branch name or a shorter repository name.`);
|
|
142
130
|
await this.stop();
|
|
143
131
|
throw Error('branch name too long');
|
|
144
132
|
}
|
|
145
133
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
await resp.buffer();
|
|
149
|
-
if (!resp.ok) {
|
|
150
|
-
if (resp.status === 401) {
|
|
151
|
-
this.log.warn(chalk`Unable to verify {yellow ${ref}} branch via {blue ${fstabUrl}} for authenticated sites.`);
|
|
152
|
-
} else if (ref === 'main') {
|
|
153
|
-
this.log.warn(chalk`Unable to verify {yellow main} branch via {blue ${fstabUrl}} (${resp.status}). Maybe not pushed yet?`);
|
|
154
|
-
} else {
|
|
155
|
-
this.log.warn(chalk`Unable to verify {yellow ${ref}} branch on {blue ${fstabUrl}} (${resp.status}). Fallback to {yellow main} branch.`);
|
|
156
|
-
this._url = `https://main--${gitUrl.repo}--${gitUrl.owner}.${previewHostBase}`;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
134
|
+
// always proxy to main
|
|
135
|
+
this._url = `https://main--${gitUrl.repo}--${gitUrl.owner}.${previewHostBase}`;
|
|
159
136
|
}
|
|
160
137
|
|
|
161
138
|
/**
|
|
@@ -183,14 +160,17 @@ export default class UpCommand extends AbstractServerCommand {
|
|
|
183
160
|
}
|
|
184
161
|
try {
|
|
185
162
|
// restart if any of the files is not ignored
|
|
186
|
-
this.log.info('git HEAD or remotes changed, reconfiguring server...');
|
|
187
163
|
const ref = await GitUtils.getBranch(this.directory);
|
|
188
164
|
const gitUrl = await GitUtils.getOriginURL(this.directory, { ref });
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
165
|
+
if (gitUrl.toString() !== this._gitUrl.toString()) {
|
|
166
|
+
this.log.info('git HEAD or remotes changed, reconfiguring server...');
|
|
167
|
+
this._gitUrl = gitUrl;
|
|
168
|
+
await this.verifyUrl(gitUrl, ref);
|
|
169
|
+
this._project.withProxyUrl(this._url);
|
|
170
|
+
await this._project.initHeadHtml();
|
|
171
|
+
this.log.info(`Updated proxy to ${this._url}`);
|
|
172
|
+
this.emit('changed', this);
|
|
173
|
+
}
|
|
194
174
|
} catch {
|
|
195
175
|
// ignore
|
|
196
176
|
}
|