@adobe/aem-cli 16.7.10 → 16.7.11
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 +4 -4
- package/src/fetch-utils.js +1 -0
- package/src/git-utils.js +3 -1
- package/src/import.cmd.js +57 -13
- package/src/import.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [16.7.11](https://github.com/adobe/helix-cli/compare/v16.7.10...v16.7.11) (2024-10-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update dependency cookie to v0.7.1 ([4f10a00](https://github.com/adobe/helix-cli/commit/4f10a00143df39df69dfa2f4dd2fe6d692718de2))
|
|
7
|
+
|
|
1
8
|
## [16.7.10](https://github.com/adobe/helix-cli/compare/v16.7.9...v16.7.10) (2024-09-28)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/aem-cli",
|
|
3
|
-
"version": "16.7.
|
|
3
|
+
"version": "16.7.11",
|
|
4
4
|
"description": "AEM CLI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"@adobe/helix-log": "6.0.4",
|
|
43
43
|
"@adobe/helix-shared-config": "11.0.1",
|
|
44
44
|
"@adobe/helix-shared-git": "3.0.14",
|
|
45
|
-
"@adobe/helix-shared-indexer": "2.1.
|
|
45
|
+
"@adobe/helix-shared-indexer": "2.1.6",
|
|
46
46
|
"camelcase": "8.0.0",
|
|
47
47
|
"chalk-template": "1.1.0",
|
|
48
48
|
"chokidar": "4.0.1",
|
|
49
49
|
"compression": "1.7.4",
|
|
50
|
-
"cookie": "0.
|
|
50
|
+
"cookie": "0.7.1",
|
|
51
51
|
"cookie-parser": "1.4.6",
|
|
52
52
|
"dotenv": "16.4.5",
|
|
53
53
|
"express": "4.21.0",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@adobe/eslint-config-helix": "2.0.7",
|
|
79
|
-
"@adobe/helix-shared-dom": "2.0.
|
|
79
|
+
"@adobe/helix-shared-dom": "2.0.8",
|
|
80
80
|
"@adobe/helix-testutils": "0.4.17",
|
|
81
81
|
"@semantic-release/changelog": "6.0.3",
|
|
82
82
|
"@semantic-release/git": "10.0.1",
|
package/src/fetch-utils.js
CHANGED
|
@@ -35,6 +35,7 @@ const httpProxyHandler = {
|
|
|
35
35
|
: new HttpProxyAgent(proxyUrl);
|
|
36
36
|
// eslint-disable-next-line no-console
|
|
37
37
|
console.debug(`using proxy ${proxyUrl}`);
|
|
38
|
+
// we need to use `node-fetch` directly to pass the agent. adobe-fetch does not support it.
|
|
38
39
|
return nodeFetch(url, {
|
|
39
40
|
...init,
|
|
40
41
|
agent,
|
package/src/git-utils.js
CHANGED
|
@@ -23,6 +23,8 @@ import git from 'isomorphic-git';
|
|
|
23
23
|
const cache = {};
|
|
24
24
|
|
|
25
25
|
export default class GitUtils {
|
|
26
|
+
static DEFAULT_BRANCH = 'main';
|
|
27
|
+
|
|
26
28
|
/**
|
|
27
29
|
* Determines whether the working tree directory contains uncommitted or unstaged changes.
|
|
28
30
|
*
|
|
@@ -141,7 +143,7 @@ export default class GitUtils {
|
|
|
141
143
|
* @param {string} fallback fallback value if no branch or tag is found
|
|
142
144
|
* @returns {Promise<string>} current branch or tag
|
|
143
145
|
*/
|
|
144
|
-
static async getBranch(dir, fallback =
|
|
146
|
+
static async getBranch(dir, fallback = this.DEFAULT_BRANCH) {
|
|
145
147
|
// current commit sha
|
|
146
148
|
const rev = await git.resolveRef({ fs, dir, ref: 'HEAD' });
|
|
147
149
|
// reverse-lookup tag from commit sha
|
package/src/import.cmd.js
CHANGED
|
@@ -14,6 +14,7 @@ import path from 'path';
|
|
|
14
14
|
import chalk from 'chalk-template';
|
|
15
15
|
import git from 'isomorphic-git';
|
|
16
16
|
import http from 'isomorphic-git/http/node/index.js';
|
|
17
|
+
import GitUtils from './git-utils.js';
|
|
17
18
|
import { HelixImportProject } from './server/HelixImportProject.js';
|
|
18
19
|
import pkgJson from './package.cjs';
|
|
19
20
|
import { AbstractServerCommand } from './abstract-server.cmd.js';
|
|
@@ -36,7 +37,20 @@ export default class ImportCommand extends AbstractServerCommand {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
withUIRepo(value) {
|
|
39
|
-
this.
|
|
40
|
+
this._uiBranch = GitUtils.DEFAULT_BRANCH;
|
|
41
|
+
try {
|
|
42
|
+
const url = new URL(value);
|
|
43
|
+
if (url.hash) {
|
|
44
|
+
this._uiBranch = url.hash.substring(1);
|
|
45
|
+
}
|
|
46
|
+
// Ensure a dangling hash does not create an invalid uiRepo.
|
|
47
|
+
url.hash = '';
|
|
48
|
+
this._uiRepo = url.href;
|
|
49
|
+
} catch (e) {
|
|
50
|
+
this.log.error(`Could not process UI Repo correctly: ${value} - ${e.message}`);
|
|
51
|
+
throw e;
|
|
52
|
+
}
|
|
53
|
+
|
|
40
54
|
return this;
|
|
41
55
|
}
|
|
42
56
|
|
|
@@ -45,6 +59,27 @@ export default class ImportCommand extends AbstractServerCommand {
|
|
|
45
59
|
return this;
|
|
46
60
|
}
|
|
47
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Ensure the UI branch the caller specified (or defaulted to) is the one being used.
|
|
64
|
+
* @param uiFolder
|
|
65
|
+
* @returns {Promise<void>}
|
|
66
|
+
*/
|
|
67
|
+
async handleUIBranch(uiFolder) {
|
|
68
|
+
const branch = await GitUtils.getBranch(uiFolder);
|
|
69
|
+
|
|
70
|
+
if (branch !== this._uiBranch) {
|
|
71
|
+
this.log.info(
|
|
72
|
+
chalk`AEM Importer UI was on branch {yellow ${branch}}. Switching to {green ${this._uiBranch}}.`,
|
|
73
|
+
);
|
|
74
|
+
await git.checkout({
|
|
75
|
+
fs: fse,
|
|
76
|
+
http,
|
|
77
|
+
dir: uiFolder,
|
|
78
|
+
ref: this._uiBranch,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
48
83
|
async setupImporterUI() {
|
|
49
84
|
const importerFolder = path.join(this.directory, this._importerSubPath);
|
|
50
85
|
await fse.ensureDir(importerFolder);
|
|
@@ -54,32 +89,41 @@ export default class ImportCommand extends AbstractServerCommand {
|
|
|
54
89
|
const exists = await fse.pathExists(uiFolder);
|
|
55
90
|
if (!exists) {
|
|
56
91
|
this.log.info('AEM Importer UI needs to be installed.');
|
|
57
|
-
this.log.info(`Cloning ${this._uiRepo} in ${importerFolder}.`);
|
|
92
|
+
this.log.info(`Cloning ${this._uiRepo} (branch: ${this._uiBranch}) in ${importerFolder}.`);
|
|
58
93
|
// clone the ui project
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
94
|
+
try {
|
|
95
|
+
await git.clone({
|
|
96
|
+
fs: fse,
|
|
97
|
+
http,
|
|
98
|
+
dir: uiFolder,
|
|
99
|
+
url: this._uiRepo,
|
|
100
|
+
ref: this._uiBranch,
|
|
101
|
+
depth: 1,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
this.log.info(`AEM Importer UI is ready. v${await getUIVersion()} (branch: ${this._uiBranch})`);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
this.log.error(`AEM Importer UI clone failed: ${e.message}`);
|
|
107
|
+
throw e;
|
|
108
|
+
}
|
|
68
109
|
} else {
|
|
69
110
|
this.log.info('Fetching latest version of the AEM Importer UI...');
|
|
70
|
-
|
|
111
|
+
await this.handleUIBranch(uiFolder);
|
|
112
|
+
|
|
113
|
+
// Pull the ui project
|
|
71
114
|
await git.pull({
|
|
72
115
|
fs: fse,
|
|
73
116
|
http,
|
|
74
117
|
dir: uiFolder,
|
|
75
118
|
url: this._uiRepo,
|
|
119
|
+
ref: this._uiBranch,
|
|
76
120
|
depth: 1,
|
|
77
121
|
singleBranch: true,
|
|
78
122
|
author: {
|
|
79
123
|
name: 'hlx import',
|
|
80
124
|
},
|
|
81
125
|
});
|
|
82
|
-
this.log.info(`AEM Importer UI is up-to-date. v${await getUIVersion()}`);
|
|
126
|
+
this.log.info(`AEM Importer UI is up-to-date. v${await getUIVersion()} (branch: ${this._uiBranch})`);
|
|
83
127
|
}
|
|
84
128
|
}
|
|
85
129
|
|
package/src/import.js
CHANGED
|
@@ -29,7 +29,7 @@ export default function up() {
|
|
|
29
29
|
})
|
|
30
30
|
.option('ui-repo', {
|
|
31
31
|
alias: 'uiRepo',
|
|
32
|
-
describe: 'Git repository for the AEM Importer UI',
|
|
32
|
+
describe: 'Git repository for the AEM Importer UI. A fragment may be used to indicated a branch other than main.',
|
|
33
33
|
type: 'string',
|
|
34
34
|
default: 'https://github.com/adobe/helix-importer-ui',
|
|
35
35
|
})
|