@magnolia/cli-jumpstart-plugin 1.1.1 → 1.1.2
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 +3 -0
- package/dist/jumpstart-plugin.js +22 -7
- package/dist/lib/download.d.ts +2 -2
- package/dist/lib/download.js +39 -11
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.2 (2025-08-08)
|
|
4
|
+
* Ask for credentials before checking for tomcat ([MGNLCLI-417](https://magnolia-cms.atlassian.net/browse/MGNLCLI-417))
|
|
5
|
+
|
|
3
6
|
## 1.1.1 (2025-08-07)
|
|
4
7
|
* Set allowVariants property for the magnoliaAuthor ([MGNLCLI-407](https://magnolia-cms.atlassian.net/browse/MGNLCLI-407))
|
|
5
8
|
* Add optional [name] argument to jumpstart command ([MGNLCLI-408](https://magnolia-cms.atlassian.net/browse/MGNLCLI-408))
|
package/dist/jumpstart-plugin.js
CHANGED
|
@@ -95,13 +95,28 @@ export default class JumpstartPlugin extends PluginTemplate {
|
|
|
95
95
|
}
|
|
96
96
|
for (const bundle of template.bundles || []) {
|
|
97
97
|
try {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
let credentials = this.credentials;
|
|
99
|
+
if (bundle.auth === true) {
|
|
100
|
+
const key = bundle.url;
|
|
101
|
+
if (this.authProfiles[key]) {
|
|
102
|
+
credentials = this.authProfiles[key];
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
credentials = yield askForCredentials(key);
|
|
106
|
+
this.authProfiles[key] = credentials;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else if (typeof bundle.auth === 'string') {
|
|
110
|
+
const key = bundle.auth;
|
|
111
|
+
if (this.authProfiles[key]) {
|
|
112
|
+
credentials = this.authProfiles[key];
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
credentials = yield askForCredentials(key);
|
|
116
|
+
this.authProfiles[key] = credentials;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const file = yield downloadBundle(bundle, credentials, undefined, options, template.bundles || [], this.authProfiles);
|
|
105
120
|
if (file) {
|
|
106
121
|
yield this.executePostCommands(bundle, file);
|
|
107
122
|
}
|
package/dist/lib/download.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Bundle, Credentials, PluginOptions } from '../types/types.js';
|
|
2
|
-
export declare const downloadBundle: (bundle: Bundle, credentials: Credentials, dest: string | undefined, options: PluginOptions, allBundles?: Bundle[]) => Promise<string>;
|
|
3
|
-
export declare const getDownloadUrl: (bundle: Bundle, credentials: Credentials, options: PluginOptions) => Promise<string>;
|
|
2
|
+
export declare const downloadBundle: (bundle: Bundle, credentials: Credentials, dest: string | undefined, options: PluginOptions, allBundles?: Bundle[], authProfiles?: Record<string, Credentials>) => Promise<string>;
|
|
3
|
+
export declare const getDownloadUrl: (bundle: Bundle, credentials: Credentials, options: PluginOptions, authProfiles?: Record<string, Credentials>) => Promise<string>;
|
|
4
4
|
export declare const selectTag: (url: string, credentials: Credentials) => Promise<string>;
|
package/dist/lib/download.js
CHANGED
|
@@ -92,7 +92,7 @@ const findItemFromResponse = (response, version) => {
|
|
|
92
92
|
}
|
|
93
93
|
return item;
|
|
94
94
|
};
|
|
95
|
-
const fetchMavenArtifact = (bundle_1, options_1, credentials_1, ...args_1) => __awaiter(void 0, [bundle_1, options_1, credentials_1, ...args_1], void 0, function* (bundle, options, credentials, isTomcatExcluded = false) {
|
|
95
|
+
const fetchMavenArtifact = (bundle_1, options_1, credentials_1, ...args_1) => __awaiter(void 0, [bundle_1, options_1, credentials_1, ...args_1], void 0, function* (bundle, options, credentials, isTomcatExcluded = false, authProfiles) {
|
|
96
96
|
const opts = {
|
|
97
97
|
method: 'get',
|
|
98
98
|
responseType: 'json',
|
|
@@ -101,14 +101,42 @@ const fetchMavenArtifact = (bundle_1, options_1, credentials_1, ...args_1) => __
|
|
|
101
101
|
},
|
|
102
102
|
};
|
|
103
103
|
const { url, modifiedBundle } = constructMavenSearchUrl(bundle, options, isTomcatExcluded);
|
|
104
|
-
|
|
104
|
+
let resolvedCredentials = credentials;
|
|
105
|
+
let profileKey;
|
|
106
|
+
if (bundle.auth === true) {
|
|
107
|
+
profileKey = modifiedBundle.url;
|
|
108
|
+
if (authProfiles && profileKey && authProfiles[profileKey]) {
|
|
109
|
+
resolvedCredentials = authProfiles[profileKey];
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
const promptKey = profileKey || modifiedBundle.url;
|
|
113
|
+
resolvedCredentials = yield askForCredentials(promptKey);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else if (typeof bundle.auth === 'string') {
|
|
117
|
+
profileKey = bundle.auth;
|
|
118
|
+
if (authProfiles && authProfiles[profileKey]) {
|
|
119
|
+
resolvedCredentials = authProfiles[profileKey];
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
resolvedCredentials = yield askForCredentials(profileKey);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const response = (yield get(url.toString(), opts, resolvedCredentials, modifiedBundle.name || modifiedBundle.url));
|
|
126
|
+
if (authProfiles &&
|
|
127
|
+
profileKey &&
|
|
128
|
+
resolvedCredentials &&
|
|
129
|
+
resolvedCredentials.username &&
|
|
130
|
+
resolvedCredentials.password) {
|
|
131
|
+
authProfiles[profileKey] = resolvedCredentials;
|
|
132
|
+
}
|
|
105
133
|
const item = findItemFromResponse(response, modifiedBundle.version);
|
|
106
134
|
return { item, modifiedBundle };
|
|
107
135
|
});
|
|
108
|
-
const getMagnoliaVersionFromBundle = (bundle, options, credentials) => __awaiter(void 0, void 0, void 0, function* () {
|
|
136
|
+
const getMagnoliaVersionFromBundle = (bundle, options, credentials, authProfiles) => __awaiter(void 0, void 0, void 0, function* () {
|
|
109
137
|
var _a;
|
|
110
138
|
try {
|
|
111
|
-
const { item } = yield fetchMavenArtifact(bundle, options, credentials);
|
|
139
|
+
const { item } = yield fetchMavenArtifact(bundle, options, credentials, false, authProfiles);
|
|
112
140
|
if ((_a = item === null || item === void 0 ? void 0 : item.maven2) === null || _a === void 0 ? void 0 : _a.version) {
|
|
113
141
|
return item.maven2.version;
|
|
114
142
|
}
|
|
@@ -118,7 +146,7 @@ const getMagnoliaVersionFromBundle = (bundle, options, credentials) => __awaiter
|
|
|
118
146
|
return null;
|
|
119
147
|
}
|
|
120
148
|
});
|
|
121
|
-
const modifyTomcatBundleUrl = (bundle, allBundles, credentials, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
149
|
+
const modifyTomcatBundleUrl = (bundle, allBundles, credentials, options, authProfiles) => __awaiter(void 0, void 0, void 0, function* () {
|
|
122
150
|
if (!bundle.url.includes('magnolia-tomcat-barebone')) {
|
|
123
151
|
return bundle;
|
|
124
152
|
}
|
|
@@ -128,7 +156,7 @@ const modifyTomcatBundleUrl = (bundle, allBundles, credentials, options) => __aw
|
|
|
128
156
|
if (allBundles && options) {
|
|
129
157
|
for (const otherBundle of allBundles) {
|
|
130
158
|
if (isMagnoliaBundle(otherBundle)) {
|
|
131
|
-
const magnoliaVersion = yield getMagnoliaVersionFromBundle(otherBundle, options, credentials);
|
|
159
|
+
const magnoliaVersion = yield getMagnoliaVersionFromBundle(otherBundle, options, credentials, authProfiles);
|
|
132
160
|
if (magnoliaVersion === null) {
|
|
133
161
|
throw new Error(i18nInstance.t('error-no-artifact-available', {
|
|
134
162
|
version: options.magnolia || otherBundle.version,
|
|
@@ -161,7 +189,7 @@ const updateTomcatBundleUrl = (bundle, magnoliaVersion) => {
|
|
|
161
189
|
}
|
|
162
190
|
return bundle;
|
|
163
191
|
};
|
|
164
|
-
export const downloadBundle = (bundle, credentials, dest, options, allBundles) => __awaiter(void 0, void 0, void 0, function* () {
|
|
192
|
+
export const downloadBundle = (bundle, credentials, dest, options, allBundles, authProfiles) => __awaiter(void 0, void 0, void 0, function* () {
|
|
165
193
|
try {
|
|
166
194
|
const url = bundle.url;
|
|
167
195
|
const downloadDest = dest ? dest : './download-' + new Date().getTime();
|
|
@@ -174,8 +202,8 @@ export const downloadBundle = (bundle, credentials, dest, options, allBundles) =
|
|
|
174
202
|
logger === null || logger === void 0 ? void 0 : logger.info(i18nInstance.t('info-download-preparing', {
|
|
175
203
|
url,
|
|
176
204
|
}));
|
|
177
|
-
const modifiedBundle = yield modifyTomcatBundleUrl(bundle, allBundles, credentials, options);
|
|
178
|
-
downloadUrl = yield getDownloadUrl(modifiedBundle, credentials, options);
|
|
205
|
+
const modifiedBundle = yield modifyTomcatBundleUrl(bundle, allBundles, credentials, options, authProfiles);
|
|
206
|
+
downloadUrl = yield getDownloadUrl(modifiedBundle, credentials, options, authProfiles);
|
|
179
207
|
}
|
|
180
208
|
else {
|
|
181
209
|
downloadUrl = url;
|
|
@@ -235,10 +263,10 @@ export const downloadBundle = (bundle, credentials, dest, options, allBundles) =
|
|
|
235
263
|
throw new CreateError(error.message);
|
|
236
264
|
}
|
|
237
265
|
});
|
|
238
|
-
export const getDownloadUrl = (bundle, credentials, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
266
|
+
export const getDownloadUrl = (bundle, credentials, options, authProfiles) => __awaiter(void 0, void 0, void 0, function* () {
|
|
239
267
|
var _a, _b, _c;
|
|
240
268
|
try {
|
|
241
|
-
const { item, modifiedBundle } = yield fetchMavenArtifact(bundle, options, credentials, true);
|
|
269
|
+
const { item, modifiedBundle } = yield fetchMavenArtifact(bundle, options, credentials, true, authProfiles);
|
|
242
270
|
const params = new URLSearchParams(bundle.url.split('?')[1]);
|
|
243
271
|
bundle.version = modifiedBundle.version;
|
|
244
272
|
if (!item) {
|
package/dist/package.json
CHANGED
package/package.json
CHANGED