@magnolia/cli-jumpstart-plugin 1.0.6 → 1.1.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,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0 (2025-06-06)
4
+ * Add support for named auth profiles in project templates for reusing credentials across bundles ([MGNLCLI-387](https://magnolia-cms.atlassian.net/browse/MGNLCLI-387))
5
+ * Add support for 6.4 version ([MGNLCLI-389](https://magnolia-cms.atlassian.net/browse/MGNLCLI-389))
6
+ * Use project-templates from gitlab instead of bitbucket ([MGNLCLI-390](https://magnolia-cms.atlassian.net/browse/MGNLCLI-390))
7
+
3
8
  ## 1.0.6 (2025-05-30)
4
9
  * Ignore -overlay webapps from nexus ([MGNLCLI-391](https://magnolia-cms.atlassian.net/browse/MGNLCLI-391))
5
10
 
@@ -13,6 +13,7 @@ export default class JumpstartPlugin extends PluginTemplate {
13
13
  projectTemplates?: Array<Template>;
14
14
  options: Option[];
15
15
  credentials?: Credentials;
16
+ authProfiles: any;
16
17
  description: string;
17
18
  constructor();
18
19
  executePostCommands(bundle: Bundle, file: string): Promise<void>;
@@ -41,6 +41,7 @@ export default class JumpstartPlugin extends PluginTemplate {
41
41
  this.name = 'jumpstart';
42
42
  this.version = pkg.version;
43
43
  this.usage = '[options]';
44
+ this.authProfiles = {};
44
45
  i18nInstance = initI18n(this.name, 'translation', path.join(__dirname, 'lib/locales'));
45
46
  this.description = i18nInstance.t('description');
46
47
  this.options = [
@@ -75,19 +76,29 @@ export default class JumpstartPlugin extends PluginTemplate {
75
76
  }
76
77
  handleTemplate(template, options) {
77
78
  return __awaiter(this, void 0, void 0, function* () {
78
- if (template.auth) {
79
- this.credentials = yield askForCredentials(template.name);
79
+ if (template.auth !== undefined) {
80
+ if (typeof template.auth === 'boolean') {
81
+ this.credentials = yield askForCredentials(template.name);
82
+ }
83
+ else {
84
+ for (const key of Object.keys(template.auth)) {
85
+ const desc = template.auth[key].description;
86
+ if (desc !== undefined) {
87
+ logger.info(desc);
88
+ }
89
+ this.authProfiles[key] = yield askForCredentials(key);
90
+ }
91
+ }
80
92
  }
81
93
  for (const bundle of template.bundles || []) {
82
- let file;
83
94
  try {
84
- if (bundle.auth === true) {
85
- const bundleCredentials = yield askForCredentials(bundle.name ? bundle.name : bundle.url);
86
- file = yield downloadBundle(bundle, bundleCredentials, undefined, options);
87
- }
88
- else {
89
- file = yield downloadBundle(bundle, this.credentials, undefined, options);
90
- }
95
+ const credentials = bundle.auth === true
96
+ ? yield askForCredentials(bundle.name || bundle.url)
97
+ : typeof bundle.auth === 'string'
98
+ ? this.authProfiles[bundle.auth] ||
99
+ (yield askForCredentials(bundle.auth))
100
+ : this.credentials;
101
+ const file = yield downloadBundle(bundle, credentials, undefined, options);
91
102
  if (file) {
92
103
  yield this.executePostCommands(bundle, file);
93
104
  }
@@ -130,7 +141,7 @@ export default class JumpstartPlugin extends PluginTemplate {
130
141
  }
131
142
  else {
132
143
  errorMsg = i18nInstance.t('error-no-projectTemplates-from-default');
133
- const res = yield axios.get('https://bitbucket.org/magnolia-cms/cli-project-templates/raw/HEAD/projectTemplates.json');
144
+ const res = yield axios.get('https://gitlab.magnolia-platform.com/magnolia-cli/plugins/cli-project-templates/-/raw/main/projectTemplates.json');
134
145
  this.projectTemplates = res.data.projectTemplates;
135
146
  }
136
147
  }
@@ -117,6 +117,7 @@ export const getDownloadUrl = (bundle, credentials, options) => __awaiter(void 0
117
117
  }
118
118
  if ((bundle.version.startsWith('latest') ||
119
119
  bundle.version.startsWith('6.3') ||
120
+ bundle.version.startsWith('6.4') ||
120
121
  bundle.version.includes('alpha') ||
121
122
  bundle.version.includes('beta') ||
122
123
  bundle.version.includes('rc')) &&
@@ -12,8 +12,9 @@ import path from 'path';
12
12
  import { getMicroprofileConfigLocation } from './helper.js';
13
13
  import { i18nInstance, logger } from '../jumpstart-plugin.js';
14
14
  export const handleMicroprofileConfig = (bundle, dest) => __awaiter(void 0, void 0, void 0, function* () {
15
- var _a;
16
- if (!((_a = bundle.version) === null || _a === void 0 ? void 0 : _a.startsWith('6.3')))
15
+ var _a, _b;
16
+ if (!((_a = bundle.version) === null || _a === void 0 ? void 0 : _a.startsWith('6.3')) &&
17
+ !((_b = bundle.version) === null || _b === void 0 ? void 0 : _b.startsWith('6.4')))
17
18
  return;
18
19
  const tomcatPath = path.join(path.resolve(dest), '../../');
19
20
  const webappName = path.basename(dest);
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magnolia/cli-jumpstart-plugin",
3
- "version": "1.0.6",
3
+ "version": "1.1.0",
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": {
@@ -21,7 +21,9 @@ export interface Bundle {
21
21
  export interface TemplateBase {
22
22
  name: string;
23
23
  description?: string;
24
- auth?: boolean;
24
+ auth?: boolean | Record<string, {
25
+ description?: string;
26
+ }>;
25
27
  }
26
28
  export interface TemplateWithChildren extends TemplateBase {
27
29
  children: Array<Template>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magnolia/cli-jumpstart-plugin",
3
- "version": "1.0.6",
3
+ "version": "1.1.0",
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": {