@magnolia/cli-jumpstart-plugin 1.0.0-preview.6 → 1.0.0-preview.8

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.
@@ -1,77 +1,86 @@
1
1
  {
2
- "cmd-option-description": "download and set up a new headless or freemarker-based project with Magnolia webapp",
3
- "cmd-option-template": "choose a template from available project templates",
4
- "cmd-option-project-templates-path": "specify the path to load project templates from",
5
- "cmd-option-magnolia-version": "set the Magnolia version; defaults to the latest stable version",
6
- "cmd-option-snapshot": "download the latest snapshot version of the specified or latest stable webapp",
2
+ "description": "download and set up a new headless or freemarker-based project with Magnolia webapp",
3
+ "option-template-description": "choose a template from available project templates",
4
+ "option-projectTemplates-description": "specify the source to load project templates from",
5
+ "option-magnolia-description": "set the Magnolia version; defaults to the latest stable version",
6
+ "option-snapshot-description": "download the latest snapshot version of the specified or latest stable webapp",
7
7
 
8
- "prompt-enter-credentials": "Please enter credentials for {{bundle}}",
9
-
10
- "info-template_not_found": "The '{{template}}' template was not found.",
11
- "info-jumpstart_started": "'JumpstartPlugin' plugin started successfully.",
12
- "info-jumpstart_stopped": "'JumpstartPlugin' stopped",
13
- "info-config-h-will-install-missing-plugins": "Will attempt to install missing plugins",
14
- "info-config-h-mgnl-config-updated": "mgnl.config.js updated",
15
- "info-config-h-mgnl-vars-added": "Shared variables added to mgnl.config.js",
16
- "info-download-preparing": "Preparing to download {{url}}",
8
+ "info-enter-credentials": "Enter the credentials for \"{{bundle}}\"",
9
+ "info-template-not-found": "Template \"{{template}}\" not found",
10
+ "info-download-preparing": "Retrieving download URL from: {{url}}",
17
11
  "info-download-starting": "Starting download from: {{downloadUrl}}",
18
- "info-download-finished": "Download finished",
19
- "info-download-status-error": "Failed to download from: {{downloadUrl}}. Expected 200, but received: {{status}}.",
20
- "info-extensions-calling-fn": "Calling Function {{name}}.",
21
- "info-extensions-install-done": "Installing Extension Dependencies. Done.",
22
- "info-extract-extracting": "Extracting...",
23
- "info-install-dep": "Dependencies installed",
24
- "info-pj-helper-npm-done": "Running 'npm install' done",
25
- "info-pj-helper-pj-created": "package.json created",
26
- "info-pj-helper-add-mgnl-to-pj": "Adding \"mgnl\" script to package.json",
27
- "info-helper-found-lm": "Found existing light-modules path at '{{lightModulesPath}}'",
28
- "info-helper-no-lm-found": "No light-modules folder found. Attempting to create one.",
29
- "info-helper-lm-created": "light-modules folder created at '{{lightModulesPath}}'.",
30
- "info-helper-webapp-prop-setting": "Setting {{key}} to: {{propsKey}} in {{filePath}}",
31
- "info-helper-package-installed": "{{packageName}} installed",
12
+ "info-extensions-calling-fn": "Calling function \"{{name}}\"",
13
+ "info-add-mgnl-to-pj": "Added \"mgnl\" script to package.json",
14
+ "info-found-lm": "Found existing \"light-modules\" directory at: \"{{lightModulesPath}}\"",
15
+ "info-lm-created": "New \"light-modules\" directory created at: \"{{lightModulesPath}}\"",
16
+ "info-webapp-prop-setting": "Set \"{{key}}\" to: \"{{propsKey}}\" in \"{{filePath}}\"",
17
+ "info-project-downloaded": "Project successfully downloaded",
18
+ "info-microprofile-exists": "File \"microprofile-config.properties\" already exists",
19
+ "info-created-microprofile": "Created \"microprofile-config.properties\" at: {{file}}",
20
+ "info-no-node_modules": "Didn't find \"node_modules\" directory",
21
+ "info-plugin-installed": "\"{{plugin}}\" successfully installed",
22
+
23
+ "warn-install-plugins-manually": "Please install following plugins:\n{{installPluginsText}}and register them in \"mgnl.config.js\" file",
24
+ "warn-changed-type": "Changed 'type' property to \"module\" in \"package.json\"",
25
+ "warn-webapp-props-not-exist": "File \"{{filePath}}\" not found; skipping configuration",
26
+ "warn-cannot-modify-webapp": "An error occurred while modifying webapps:\n{{errorMsg}}",
27
+ "warn-cannot-parse-plugin-args": "The provided object:\n{{pluginArgs}}\nis not a valid JSON5 object; arguments will not be added to the plugin: \"{{plugin}}\"",
28
+
29
+ "error-no-tags": "No available tags found",
30
+ "error-problem-accessing-url": "A problem occurred while accessing: {{url}}",
31
+ "error-unable-to-get-local-issuer-certificate": ["The \"unable to get local issuer certificate\" error indicates that something in your infrastructure is preventing the CLI from downloading the Magnolia artifacts", "This is not a bug in the CLI", "For example, you may be behind a proxy that requires certain certificates", "You might be able to ask your infrastructure team to allow requests to the Magnolia artifact repository: https://nexus.magnolia-cms.com/", "Please search the web on \"unable to get local issuer certificate\" for more information"],
32
+ "error-no-artifact-available": "No Magnolia bundle with version \"{{version}}\" is available",
33
+ "error-while-getting-projectTemplates": "An error occurred while getting \"projectTemplates\":",
34
+ "error-no-projectTemplates-from-url": "Cannot fetch remote projectTemplates file located at: \"{{url}}\"; are you connected to the internet? does it point to a JSON file?",
35
+ "error-no-projectTemplates-from-path": "Cannot read projectTemplates from a local file located at: \"{{path}}\"; is it a JSON file?",
36
+ "error-no-projectTemplates-from-default": "Cannot fetch default projectTemplates; are you connected to the internet?",
37
+ "error-extensions-calling-fn-retry": "Error calling function: \"{{name}}\"; {{retry}}/{{maxRetry}}; waiting {{delay}}ms before retry",
38
+ "error-extensions-fn-not-found": "\"{{function}}\" function not found",
39
+ "error-apache-tomcat-not-found": "\"apache-tomcat\" was not found",
40
+ "error-lm-not-found": "\"light-modules\" was not found",
41
+ "error-pj-mod-fail": "An error occurred while modifying \"package.json\":\n{{errorMsg}}",
42
+ "error-lm-create-fail": "An error occurred while creating \"light-modules\" directory:\n{{errorMsg}}",
43
+ "error-webapp-props-update-error": "An error occurred while updating \"magnolia.properties\" in {{path}} file:\n{{errorMsg}}",
44
+ "error-while-adding-vars": "An error occurred while adding variables to \"mgnl.config.js\":\n{{errorMsg}}",
45
+ "error-while-add-plugin": "An error occurred while installing plugin \"{{plugin}}\":\n{{errorMsg}}",
46
+ "error-option-param-is-flag": "Option \"{{option}}\" argument missing; provided value: \"{{value}}\" is a flag",
47
+ "error-mgnl-cli-not-installed": "The \"@magnolia/cli\" package is not installed; try installing it manually: 'npm install @magnolia/cli'",
48
+ "error-download-fail-status": "Download failed from: {{downloadUrl}}; expected status \"200\"; received: \"{{status}}\"",
49
+ "error-while-downloading-bundle": "An error occurred while downloading bundle from: {{url}}",
50
+ "error-auth-fail": "Authentication failed for {{url}}; received 401 status; verify your credentials and try again",
51
+
52
+ "inquirer-prompt-select-tag": "Choose a tag",
53
+ "inquirer-prompt-choose-template": "Choose a template",
54
+
55
+ "ora-start-checking-add-plugin": "Looking for \"@magnolia/cli add-plugin\" command...",
56
+ "ora-start-extracting": "Extracting...",
57
+ "ora-start-creating-config": "Creating \"mgnl.config.js\"...",
58
+ "ora-start-updating-config": "Updating \"mgnl.config.js\"...",
59
+ "ora-start-adding-shared-vars": "Adding variables to \"mgnl.config.js\"...",
60
+ "ora-start-installing-ext-dep": "Installing extension dependencies...",
61
+ "ora-start-running-pm-install": "Running '{{packageManager}} install'...",
62
+ "ora-start-creating-pj": "Creating package.json...",
63
+ "ora-start-installing-package": "Installing \"{{packageName}}\"...",
32
64
 
33
- "warn-config-h-could-not-install-cli": "Couldn't install @magnolia/cli",
34
- "warn-config-h-no-add-plugin": "Cannot find add-plugin command. Please update @magnolia/cli package.",
35
- "warn-config-h-install-plugins-manually": "Please install following plugins:\n{{installPluginsText}}and add them to mgnl.config.js manually.",
36
- "warn-pj-helper-changing-type": "Changing 'type' to \"module\"",
37
- "warn-helper-webapp-props-not-exist": "File {{filePath}} doesn't exists, skipping configuration.",
38
- "warn-helper-cannot-modify-webapp": "Cannot modify webapps: {{errorMsg}}",
39
- "warn-config-h-error-cannot-parse-plugin-args": "Provided plugin argument:\n{{pluginArgs}}\nis not a valid JSON5 object.",
65
+ "ora-succeed-pj-created": "\"package.json\" created",
66
+ "ora-succeed-extracted-to": "Extracted to {{path}}",
67
+ "ora-succeed-shared-vars-added": "Added shared variables to \"mgnl.config.js\"",
68
+ "ora-succeed-extensions-install-done": "Extension dependencies installed",
69
+ "ora-succeed-pm-install": "Completed running '{{packageManager}} install'",
70
+ "ora-succeed-config-created": "Created \"mgnl.config.js\" with logger and plugins properties",
71
+ "ora-succeed-config-updated": "Updated \"mgnl.config.js\" with logger property",
72
+ "ora-succeed-package-installed": "\"{{packageName}}\" installed",
40
73
 
41
- "error-config-h-could-not-read-mgnl-config": "Couldn't read {{configPath}}",
42
- "error-config-h-could-not-parse-mgnl-config": "Couldn't parse {{configPath}}, please check the file for issues",
43
- "error-config-h-while-updating-mgnl-config": "Error occurred while updating mgnl.config.js",
44
- "error-config-h-while-adding-vars": "Error occurred while adding variables to mgnl.config.js",
45
- "error-config-h-while-add-plugin": "An error occurred while installing following plugin: {{plugin}}",
46
- "error-download-no-tags": "There are no available tags",
47
- "error-download-problem-accessing-url": "A problem was detected while accessing: {{url}}.",
48
- "error-download-unable-to-get-local-issuer-certificate": "The \"unable to get local issuer certificate\" error indicates that something in your infrastructure is preventing the CLI from downloading the Magnolia artifacts. This is not a bug in the CLI. For example, you may be behind a proxy that requires certain certificates. You might be able to ask your infrastructure team to allow requests to the Magnolia artifact repository: https://nexus.magnolia-cms.com/ Please search the web on \"unable to get local issuer certificate\" for more information.",
49
- "error-download-no-artifact-available": "No Magnolia bundle with \"{{version}}\" version is available.",
50
- "error-extensions-calling-fn-retry": "Error Calling Function {{name}}. {{retry}}/{{maxRetry}}. Waiting {{delay}}ms before retry.",
51
- "error-extensions-fn-not-found": "{{function}} Function not found",
52
- "error-extensions-path-not-found": "{{extensionsPath}} not found. Could not evaluate custom prompts.",
53
- "error-extensions-install-fail": "'{{packageManager}} install' has failed",
54
- "error-extract-apache-tomcat-not-found": "apache-tomcat was not found.",
55
- "error-install-dep-fail": "Failed to install dependencies",
56
- "error-pj-helper-npm-fail": "'npm install' has failed",
57
- "error-pj-helper-pj-mod-fail": "Failed to modify package.json",
58
- "error-pj-helper-pj-create-fail": "Failed to create package.json",
59
- "error-helper-lm-create-fail": "Failed to create 'light-modules' folder: {{errorMsg}}",
60
- "error-helper-webapp-props-update-error": "An error occurred while updating 'magnolia.properties': {{errorMsg}}",
61
- "error-helper-lm-not-found": "light-modules was not found",
62
- "error-helper-fail-to-install-package": "Failed to install {{packageName}}",
63
- "error-option-param-is-flag": "option \"{{option}}\" argument missing. Provided value: \"{{value}}\" is a flag",
74
+ "ora-warn-no-add-plugin": "Cannot find \"@magnolia/cli add-plugin\" command; you may need to update \"@magnolia/cli\" package",
64
75
 
65
- "ora-updating-mgnl-config": "Updating mgnl.config.js",
66
- "ora-adding-shared-vars": "Adding variables to mgnl.config.js",
67
- "ora-installing-ext-dep": "Installing Extension Dependencies",
68
- "ora-installing-dep": "Installing dependencies",
69
- "ora-running-npm-install": "Didn't find 'node_modules' folder. Running 'npm install'",
70
- "ora-creating-pj": "Creating package.json",
71
- "ora-installing-package": "Installing {{packageName}}",
76
+ "ora-fail-pm-install": "An error occurred while running '{{packageManager}} install':\n{{errorMsg}}",
77
+ "ora-fail-creating-config": "An error occurred while creating \"mgnl.config.js\":\n{{errorMsg}}",
78
+ "ora-fail-updating-config": "An error occurred while updating \"mgnl.config.js\":\n{{errorMsg}}",
79
+ "ora-fail-creating-pj": "An error occurred while creating \"package.json\":\n{{errorMsg}}",
80
+ "ora-fail-installing-package": "An error occurred while installing \"{{packageName}}\":\n{{errorMsg}}",
81
+ "ora-fail-while-add-plugin-check": "An error occurred while looking for \"@magnolia/cli add-plugin\" command:\n{{errorMsg}}",
72
82
 
73
- "install-plugin-with-args-text": "\twith following args: {{pluginArgs}}\n",
83
+ "progress-bar-downloading": "Downloading",
74
84
 
75
- "create-microprofile--info-file-exists-skipping": "File microprofile-config.properties already exists. Skipping...",
76
- "create-microprofile--info-creating-file": "Creating microprofile-config.properties at {{file}}"
85
+ "text-install-plugin-with-args": "\twith following arguments: {{pluginArgs}}\n"
77
86
  }
@@ -11,7 +11,7 @@ import path from "path";
11
11
  import ora from "ora";
12
12
  import fs from "fs-extra";
13
13
  import { execa } from "execa";
14
- import { determinePackageManager, installPackage } from "./helper.js";
14
+ import { determinePackageManager, installCLI } from "./helper.js";
15
15
  import { i18nInstance, logger } from "../jumpstart-plugin.js";
16
16
  export const handlePackageJSON = () => __awaiter(void 0, void 0, void 0, function* () {
17
17
  const pjPath = path.join(process.cwd(), 'package.json');
@@ -24,27 +24,27 @@ export const modifyPackageJSON = (pjPath) => __awaiter(void 0, void 0, void 0, f
24
24
  let pj = JSON.parse(fs.readFileSync(pjPath, 'utf8'));
25
25
  let isMgnlCliInstalled = (pj === null || pj === void 0 ? void 0 : pj.dependencies) && (pj === null || pj === void 0 ? void 0 : pj.dependencies['@magnolia/cli']);
26
26
  if (!isMgnlCliInstalled) {
27
- isMgnlCliInstalled = yield installPackage(determinePackageManager(), "@magnolia/cli@preview", "mgnl-cli");
27
+ isMgnlCliInstalled = yield installCLI();
28
28
  if (isMgnlCliInstalled) {
29
29
  pj = JSON.parse(fs.readFileSync(pjPath, 'utf8'));
30
30
  }
31
31
  }
32
32
  const nodeModulesPath = path.join(process.cwd(), "node_modules");
33
33
  if (!fs.existsSync(nodeModulesPath)) {
34
- const npmISpinner = ora().start(i18nInstance.t("ora-running-npm-install"));
34
+ logger === null || logger === void 0 ? void 0 : logger.info(i18nInstance.t('info-no-node_modules'));
35
+ const pm = determinePackageManager();
36
+ const npmISpinner = ora().start(i18nInstance.t("ora-start-running-pm-install", { packageManager: pm }));
35
37
  try {
36
- yield execa(determinePackageManager(), ["install"], {
38
+ yield execa(pm, ["install"], {
37
39
  buffer: true,
38
40
  cwd: process.cwd()
39
41
  });
42
+ npmISpinner.succeed(i18nInstance.t("ora-succeed-pm-install", { packageManager: pm }));
40
43
  }
41
44
  catch (e) {
42
- npmISpinner.stop();
43
- logger === null || logger === void 0 ? void 0 : logger.error(i18nInstance.t("error-pj-helper-npm-fail"));
45
+ npmISpinner.fail(i18nInstance.t("ora-fail-pm-install", { packageManager: pm, errorMsg: e.message }));
44
46
  return;
45
47
  }
46
- npmISpinner.stop();
47
- logger === null || logger === void 0 ? void 0 : logger.info(i18nInstance.t("info-pj-helper-npm-done"));
48
48
  }
49
49
  if (isMgnlCliInstalled) {
50
50
  const mgnlScript = { "mgnl": "node node_modules/@magnolia/cli" };
@@ -53,39 +53,40 @@ export const modifyPackageJSON = (pjPath) => __awaiter(void 0, void 0, void 0, f
53
53
  pj.scripts = {};
54
54
  }
55
55
  if (!pj.scripts[scriptKey] || pj.scripts[scriptKey] !== mgnlScript[scriptKey]) {
56
- logger === null || logger === void 0 ? void 0 : logger.info(i18nInstance.t("info-pj-helper-add-mgnl-to-pj"));
57
56
  pj.scripts[scriptKey] = mgnlScript[scriptKey];
58
57
  }
59
58
  }
59
+ let changedTypeMsg;
60
60
  if (!pj.type) {
61
61
  pj.type = "module";
62
62
  }
63
63
  else if (pj.type !== "module") {
64
- logger === null || logger === void 0 ? void 0 : logger.warn(i18nInstance.t("warn-pj-helper-changing-type"));
64
+ changedTypeMsg = "warn-changed-type";
65
65
  pj.type = "module";
66
66
  }
67
67
  try {
68
68
  fs.writeFileSync(pjPath, JSON.stringify(pj, null, '\t'), 'utf8');
69
+ logger === null || logger === void 0 ? void 0 : logger.info(i18nInstance.t("info-add-mgnl-to-pj"));
70
+ if (changedTypeMsg) {
71
+ logger === null || logger === void 0 ? void 0 : logger.warn(i18nInstance.t(changedTypeMsg));
72
+ }
69
73
  }
70
74
  catch (e) {
71
- logger === null || logger === void 0 ? void 0 : logger.error(i18nInstance.t("error-pj-helper-pj-mod-fail"));
75
+ logger === null || logger === void 0 ? void 0 : logger.error(i18nInstance.t("error-pj-mod-fail", { errorMsg: e.message }));
72
76
  return;
73
77
  }
74
78
  });
75
79
  export const initPackageJSON = () => __awaiter(void 0, void 0, void 0, function* () {
76
- const pjSpinner = ora().start(i18nInstance.t("ora-creating-pj"));
80
+ const pjSpinner = ora().start(i18nInstance.t("ora-start-creating-pj"));
77
81
  try {
78
82
  yield execa(determinePackageManager(), ['init', '-y'], {
79
83
  buffer: true,
80
84
  cwd: process.cwd()
81
85
  });
86
+ pjSpinner.succeed(i18nInstance.t("ora-succeed-pj-created"));
82
87
  }
83
88
  catch (e) {
84
- pjSpinner.stop();
85
- logger === null || logger === void 0 ? void 0 : logger.error(i18nInstance.t("error-pj-helper-pj-create-fail"));
86
- console.error(e);
89
+ pjSpinner.fail(i18nInstance.t("ora-fail-creating-pj", { errorMsg: e.message }));
87
90
  return;
88
91
  }
89
- pjSpinner.stop();
90
- logger === null || logger === void 0 ? void 0 : logger.info(i18nInstance.t("info-pj-helper-pj-created"));
91
92
  });
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@magnolia/cli-jumpstart-plugin",
3
- "version": "1.0.0-preview.6",
4
- "description": "Plugin to set up new projects using predefined templates and bundles. Easily select and configure project templates, and let the plugin handle bundle downloads, extraction, and post-command execution.",
3
+ "version": "1.0.0-preview.8",
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": {
7
7
  "test": "npm run build && node --experimental-vm-modules node_modules/jest/bin/jest.js",
@@ -21,7 +21,6 @@
21
21
  "@types/progress": "^2.0.5",
22
22
  "@types/underscore": "^1.11.14",
23
23
  "@types/walk": "^2.3.1",
24
- "@types/yauzl": "^2.10.1",
25
24
  "cpy-cli": "^5.0.0",
26
25
  "jest": "^29.6.2",
27
26
  "standard": "^17.1.0",
@@ -34,7 +33,6 @@
34
33
  "@babel/types": "^7.23.6",
35
34
  "@magnolia/cli-plugin-template": "^1.1.0",
36
35
  "axios": "^1.4.0",
37
- "chalk": "^5.3.0",
38
36
  "commander": "^11.0.0",
39
37
  "decompress": "^4.2.1",
40
38
  "dotenv": "^16.3.1",
@@ -1,7 +1,7 @@
1
1
  export interface PluginOptions {
2
2
  template: string | boolean;
3
- projectTemplatesPath: string;
4
- magnoliaVersion?: string;
3
+ projectTemplates: string;
4
+ magnolia?: string;
5
5
  snapshot?: boolean;
6
6
  }
7
7
  export interface Bundle {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@magnolia/cli-jumpstart-plugin",
3
- "version": "1.0.0-preview.6",
4
- "description": "Plugin to set up new projects using predefined templates and bundles. Easily select and configure project templates, and let the plugin handle bundle downloads, extraction, and post-command execution.",
3
+ "version": "1.0.0-preview.8",
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": {
7
7
  "test": "npm run build && node --experimental-vm-modules node_modules/jest/bin/jest.js",
@@ -21,7 +21,6 @@
21
21
  "@types/progress": "^2.0.5",
22
22
  "@types/underscore": "^1.11.14",
23
23
  "@types/walk": "^2.3.1",
24
- "@types/yauzl": "^2.10.1",
25
24
  "cpy-cli": "^5.0.0",
26
25
  "jest": "^29.6.2",
27
26
  "standard": "^17.1.0",
@@ -34,7 +33,6 @@
34
33
  "@babel/types": "^7.23.6",
35
34
  "@magnolia/cli-plugin-template": "^1.1.0",
36
35
  "axios": "^1.4.0",
37
- "chalk": "^5.3.0",
38
36
  "commander": "^11.0.0",
39
37
  "decompress": "^4.2.1",
40
38
  "dotenv": "^16.3.1",