@adobe/aem-cli 16.1.6 → 16.2.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 CHANGED
@@ -1,3 +1,10 @@
1
+ # [16.2.0](https://github.com/adobe/helix-cli/compare/v16.1.6...v16.2.0) (2024-01-23)
2
+
3
+
4
+ ### Features
5
+
6
+ * **up:** check if the site is on helix 5, and use aem.page as preview host if that's the case ([adc2837](https://github.com/adobe/helix-cli/commit/adc2837a242af82582a7d382c966520bcfd90677))
7
+
1
8
  ## [16.1.6](https://github.com/adobe/helix-cli/compare/v16.1.5...v16.1.6) (2024-01-21)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/aem-cli",
3
- "version": "16.1.6",
3
+ "version": "16.2.0",
4
4
  "description": "AEM CLI",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/up.cmd.js CHANGED
@@ -100,11 +100,39 @@ export default class UpCommand extends AbstractServerCommand {
100
100
  }
101
101
 
102
102
  async verifyUrl(gitUrl, inref) {
103
+ // check if the site is on helix5
104
+ // https://admin.hlx.page/sidekick/adobe/www-aem-live/main/config.json
105
+ // {
106
+ // "host": "aem.live",
107
+ // "liveHost": "main--www-aem-live--adobe.aem.live",
108
+ // "plugins": [
109
+ // {
110
+ // "id": "doc",
111
+ // "title": "Documentation",
112
+ // "url": "https://www.aem.live/docs/"
113
+ // }
114
+ // ],
115
+ // "previewHost": "main--www-aem-live--adobe.aem.page",
116
+ // "project": "Helix Website (AEM Live)",
117
+ // "testProperty": "header";
118
+ // }
119
+ const configUrl = `https://admin.hlx.page/sidekick/${gitUrl.repo}/${gitUrl.owner}/${inref}/config.json`;
120
+ const configResp = await getFetch()(configUrl);
121
+ let previewHostBase = 'hlx.page';
122
+ if (configResp.ok) {
123
+ // this is best effort for now
124
+ const config = await configResp.json();
125
+ const { previewHost } = config;
126
+ if (previewHost && previewHost.endsWith('.aem.page')) {
127
+ previewHostBase = 'aem.page';
128
+ }
129
+ }
130
+
103
131
  let ref = inref;
104
132
 
105
133
  // replace `/` by `-` in ref.
106
134
  ref = ref.replace(/\//g, '-');
107
- this._url = `https://${ref}--${gitUrl.repo}--${gitUrl.owner}.hlx.page`;
135
+ this._url = `https://${ref}--${gitUrl.repo}--${gitUrl.owner}.${previewHostBase}`;
108
136
  // check length limit
109
137
  if (this._url.split('.')
110
138
  .map((part) => part.replace(/^https:\/\//, ''))
@@ -125,7 +153,7 @@ export default class UpCommand extends AbstractServerCommand {
125
153
  this.log.warn(chalk`Unable to verify {yellow main} branch via {blue ${fstabUrl}} (${resp.status}). Maybe not pushed yet?`);
126
154
  } else {
127
155
  this.log.warn(chalk`Unable to verify {yellow ${ref}} branch on {blue ${fstabUrl}} (${resp.status}). Fallback to {yellow main} branch.`);
128
- this._url = `https://main--${gitUrl.repo}--${gitUrl.owner}.hlx.page`;
156
+ this._url = `https://main--${gitUrl.repo}--${gitUrl.owner}.${previewHostBase}`;
129
157
  }
130
158
  }
131
159
  }