@magnolia/cli-jumpstart-plugin 1.2.0 → 1.2.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 CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.1 (2026-06-30)
4
+ * Fix jumpstart failing to download Magnolia bundles after the Nexus 3.88.0 upgrade to SQL search ([MGNLCLI-486](https://magnolia-cms.atlassian.net/browse/MGNLCLI-486))
5
+
3
6
  ## 1.2.0 (2026-05-15)
4
7
  * Install Magnolia CLI as a devDependency in jumpstarted projects ([MGNLCLI-440](https://magnolia-cms.atlassian.net/browse/MGNLCLI-440))
5
8
  * Add resolver for US and AP nexus regions ([MGNLCLI-442](https://magnolia-cms.atlassian.net/browse/MGNLCLI-442))
@@ -1,5 +1,15 @@
1
1
  import { Bundle, Credentials, PluginOptions } from '../types/types.js';
2
2
  export declare const isMagnoliaBundle: (bundle: Bundle) => boolean;
3
+ export declare const getTomcatVersionLine: (magnoliaVersion: string) => string;
4
+ export declare const isVersionLine: (spec: string) => boolean;
5
+ export declare const normalizeVersionLine: (spec: string) => string;
6
+ export declare const matchesVersionLine: (version: string | undefined, line: string) => boolean;
7
+ export declare const isReleaseVersion: (version: string | undefined) => boolean;
8
+ export declare const constructMavenSearchUrl: (bundle: Bundle, options: PluginOptions, isTomcatExcluded?: boolean) => {
9
+ url: URL;
10
+ modifiedBundle: Bundle;
11
+ };
12
+ export declare const findItemFromResponse: (response: any, version?: string, versionLine?: string) => any;
3
13
  export declare const downloadBundle: (bundle: Bundle, credentials: Credentials, dest: string | undefined, options: PluginOptions, allBundles?: Bundle[], authProfiles?: Record<string, Credentials>) => Promise<string>;
4
14
  export declare const getDownloadUrl: (bundle: Bundle, credentials: Credentials, options: PluginOptions, authProfiles?: Record<string, Credentials>) => Promise<string>;
5
15
  export declare const selectTag: (url: string, credentials: Credentials) => Promise<string>;
@@ -22,7 +22,17 @@ export const isMagnoliaBundle = (bundle) => {
22
22
  return (bundle.url.includes('maven.groupId=info.magnolia') &&
23
23
  !bundle.url.includes('magnolia-tomcat-barebone'));
24
24
  };
25
- const constructMavenSearchUrl = (bundle, options, isTomcatExcluded = false) => {
25
+ export const getTomcatVersionLine = (magnoliaVersion) => {
26
+ const [major, minor] = magnoliaVersion
27
+ .split('.')
28
+ .map((part) => parseInt(part, 10));
29
+ return major > 6 || (major === 6 && minor >= 4) ? '2' : '1';
30
+ };
31
+ export const isVersionLine = (spec) => spec.includes('*') || /^\d+(\.\d+)?$/.test(spec);
32
+ export const normalizeVersionLine = (spec) => spec.replace(/\*+$/, '').replace(/\.+$/, '');
33
+ export const matchesVersionLine = (version, line) => !!version && (version === line || version.startsWith(`${line}.`));
34
+ export const isReleaseVersion = (version) => !!version && /^\d+(\.\d+)*$/.test(version);
35
+ export const constructMavenSearchUrl = (bundle, options, isTomcatExcluded = false) => {
26
36
  const bundleCopy = Object.assign({}, bundle);
27
37
  const url = new URL(bundleCopy.url);
28
38
  url.searchParams.set('prerelease', 'false');
@@ -55,14 +65,31 @@ const constructMavenSearchUrl = (bundle, options, isTomcatExcluded = false) => {
55
65
  bundleCopy.version.toLowerCase() !== 'alpha' &&
56
66
  bundleCopy.version.toLowerCase() !== 'beta' &&
57
67
  bundleCopy.version.toLowerCase() !== 'rc') {
58
- url.searchParams.set('maven.baseVersion', options.snapshot
59
- ? bundleCopy.version + '-SNAPSHOT'
60
- : bundleCopy.version);
68
+ if (!options.snapshot && isVersionLine(bundleCopy.version)) {
69
+ const line = normalizeVersionLine(bundleCopy.version);
70
+ bundleCopy.versionLine = line;
71
+ if (line.length >= 3) {
72
+ url.searchParams.set('maven.baseVersion', `${line}*`);
73
+ }
74
+ }
75
+ else {
76
+ url.searchParams.set('maven.baseVersion', options.snapshot
77
+ ? bundleCopy.version + '-SNAPSHOT'
78
+ : bundleCopy.version);
79
+ }
61
80
  }
62
81
  }
63
82
  return { url, modifiedBundle: bundleCopy };
64
83
  };
65
- const findItemFromResponse = (response, version) => {
84
+ export const findItemFromResponse = (response, version, versionLine) => {
85
+ var _a, _b;
86
+ if (versionLine) {
87
+ return ((_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : []).find((item) => {
88
+ var _a, _b;
89
+ return matchesVersionLine((_a = item === null || item === void 0 ? void 0 : item.maven2) === null || _a === void 0 ? void 0 : _a.version, versionLine) &&
90
+ isReleaseVersion((_b = item === null || item === void 0 ? void 0 : item.maven2) === null || _b === void 0 ? void 0 : _b.version);
91
+ });
92
+ }
66
93
  let item = response.data.items[0];
67
94
  if ((version === null || version === void 0 ? void 0 : version.toLowerCase()) === 'latest') {
68
95
  item = response.data.items.find((item) => {
@@ -134,7 +161,7 @@ const fetchMavenArtifact = (bundle_1, options_1, credentials_1, ...args_1) => __
134
161
  resolvedCredentials.password) {
135
162
  authProfiles[profileKey] = resolvedCredentials;
136
163
  }
137
- const item = findItemFromResponse(response, modifiedBundle.version);
164
+ const item = findItemFromResponse(response, modifiedBundle.version, modifiedBundle.versionLine);
138
165
  return { item, modifiedBundle };
139
166
  });
140
167
  const getMagnoliaVersionFromBundle = (bundle, options, credentials, authProfiles) => __awaiter(void 0, void 0, void 0, function* () {
@@ -155,9 +182,6 @@ const modifyTomcatBundleUrl = (bundle, allBundles, credentials, options, authPro
155
182
  return bundle;
156
183
  }
157
184
  if (options === null || options === void 0 ? void 0 : options.apacheTomcat) {
158
- if (!bundle.url.includes('maven.baseVersion=') || bundle.version) {
159
- bundle.url = `${bundle.url}&maven.baseVersion=${options.apacheTomcat}`;
160
- }
161
185
  bundle.version = options.apacheTomcat;
162
186
  return bundle;
163
187
  }
@@ -183,16 +207,8 @@ const modifyTomcatBundleUrl = (bundle, allBundles, credentials, options, authPro
183
207
  return bundle;
184
208
  });
185
209
  const updateTomcatBundleUrl = (bundle, magnoliaVersion) => {
186
- const versionParts = magnoliaVersion.split('.');
187
- const majorVersion = parseInt(versionParts[0]);
188
- const minorVersion = parseInt(versionParts[1]);
189
- let baseVersion = '1.*'; // Default for 6.3 and below
190
- if (majorVersion > 6 || (majorVersion === 6 && minorVersion >= 4)) {
191
- baseVersion = '2.*';
192
- }
193
- // Change the version only if the version isn't set in projectTemplates
194
210
  if (!bundle.url.includes('maven.baseVersion=') || bundle.version) {
195
- bundle.url = `${bundle.url}&maven.baseVersion=${baseVersion}`;
211
+ bundle.versionLine = getTomcatVersionLine(magnoliaVersion);
196
212
  }
197
213
  return bundle;
198
214
  };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magnolia/cli-jumpstart-plugin",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A plugin for Magnolia CLI to download and set up a new headless or freemarker-based project with Magnolia webapp",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -14,6 +14,7 @@ export interface Bundle {
14
14
  downloadDest?: string;
15
15
  name?: string;
16
16
  version?: string;
17
+ versionLine?: string;
17
18
  alternative: {
18
19
  groupId: string;
19
20
  artifactId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magnolia/cli-jumpstart-plugin",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A plugin for Magnolia CLI to download and set up a new headless or freemarker-based project with Magnolia webapp",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1 +0,0 @@
1
- {"t":0,"agent":"a0b40ff","agent_type":"unknown","event":"agent_stop","success":true}
@@ -1,7 +0,0 @@
1
- {
2
- "agents": [],
3
- "total_spawned": 0,
4
- "total_completed": 0,
5
- "total_failed": 0,
6
- "last_updated": "2026-05-15T10:21:31.045Z"
7
- }