@forge/cli-shared
9.2.0-next.5-experimental-a1600ff9.2.0-next.3-experimental-fda9df6
out/ui/text.js~
out/ui/text.jsModified+41−23
Index: package/out/ui/text.js
===================================================================
--- package/out/ui/text.js
+++ package/out/ui/text.js
@@ -2,18 +2,18 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.Text = exports.capitalise = void 0;
exports.itemList = itemList;
const tslib_1 = require("tslib");
-const manifest_1 = require("@forge/manifest");
-const case_1 = require("case");
const chalk_1 = tslib_1.__importDefault(require("chalk"));
const terminal_link_1 = tslib_1.__importDefault(require("terminal-link"));
+const case_1 = require("case");
+const log_symbols_1 = tslib_1.__importDefault(require("./log-symbols"));
+const log_color_1 = require("./log-color");
const graphql_types_1 = require("../graphql/graphql-types");
const cli_details_1 = require("../shared/cli-details");
const environment_1 = require("../shared/environment");
+const manifest_1 = require("@forge/manifest");
const installations_1 = require("../shared/installations");
-const log_color_1 = require("./log-color");
-const log_symbols_1 = tslib_1.__importDefault(require("./log-symbols"));
const ctrlC = 'Press Ctrl+C to cancel.';
const encryptedValue = '****';
const greenTick = `${chalk_1.default.bold(chalk_1.default.green('✔'))}`;
const buildTerminalLink = (text) => (0, terminal_link_1.default)(chalk_1.default.bold(text), text, { fallback: () => chalk_1.default.underline.bold(text) });
@@ -32,12 +32,13 @@
const keytarAccessErrorBase = (message) => `Keytar error detected: ${message}`;
const capitalise = (word) => word.charAt(0).toUpperCase() + word.slice(1);
exports.capitalise = capitalise;
const getLintMessage = (line, column, message, level, colourFunction, reference) => `${chalk_1.default.dim(`${line}:${column}`.padEnd(7))} ${colourFunction(level.padEnd(8))} ${message} ${chalk_1.default.dim(reference)}\n`;
-const checkLintTotalPlurals = (numErrors, numWarnings, numFixableErrors, numFixableWarnings) => ({
+const checkLintTotalPlurals = (numErrors, numWarnings, numApprovals, numFixableErrors, numFixableWarnings) => ({
pluralCheckedErrors: `${numErrors} ${numErrors === 1 ? 'error' : 'errors'}`,
pluralCheckedWarnings: `${numWarnings} ${numWarnings === 1 ? 'warning' : 'warnings'}`,
- pluralCheckedTotal: `${numErrors + numWarnings} ${numErrors + numWarnings === 1 ? 'issue' : 'issues'}`,
+ pluralCheckedApprovals: `${numApprovals} ${numApprovals === 1 ? 'approval' : 'approvals'}`,
+ pluralCheckedTotal: `${numErrors + numWarnings + numApprovals} ${numErrors + numWarnings + numApprovals === 1 ? 'issue' : 'issues'}`,
pluralCheckedFixableErrors: `${numFixableErrors} ${numFixableErrors === 1 ? 'error' : 'errors'}`,
pluralCheckedFixableWarnings: `${numFixableWarnings} ${numFixableWarnings === 1 ? 'warning' : 'warnings'}`
});
const platformKeytarRecommendations = () => {
@@ -252,9 +253,8 @@
create: {
cmd: {
desc: 'create an app',
start: 'Creating app...',
- startPersonal: 'Creating personal app...',
success: (appName) => `Created ${appName}`,
successDetails: (directory, validEnvironmentOptions) => `\nYour app is ready to work on, deploy, and install. We created ${validEnvironmentOptions.length} environments you can deploy to: ${validEnvironmentOptions
.map(environment_1.environmentToOption)
.join(', ')}.\n\nChange to directory ${chalk_1.default.bold(directory)} to see your app files.`
@@ -264,9 +264,8 @@
optionTemplate: 'specify the template to use',
optionDirectory: 'specify the directory to create (uses the template name by default)',
optionSpace: 'specify the Developer Space id to use',
optionAcceptTerms: 'automatically accept terms and conditions in non-interactive mode',
- optionPersonal: 'register as a personal app',
overviewAppName: `\nName your app. The app name can include dashes, spaces, and underscores.\n`,
overviewTemplates: '\nStart with a template. Each template contains the required files to be a valid app.\n',
waitTemplates: 'Getting template list...',
promptName: 'Enter a name for your app:',
@@ -368,9 +367,8 @@
register: {
intro: 'Registering the app to you.',
cmd: {
desc: "register an app you didn't create so you can run commands for it",
- startPersonal: `Registering personal app..`,
start: `Registering app...`,
success: (appName) => `Registered ${appName}`,
successDetails: (validEnvironmentOptions) => `\nYour app is ready to work on, deploy, and install. We created ${validEnvironmentOptions.length} environments you can deploy to: ${validEnvironmentOptions
.map(environment_1.environmentToOption)
@@ -517,8 +515,9 @@
artifact: {
error: {
noDeployUrl: "Couldn't find deployment URL",
noPresignedUrls: "Couldn't find presigned URLs",
+ noManifestUrl: "Couldn't find manifest URL",
noUploadId: "Couldn't find uploadId",
noManifestInZip: (manifestFilename) => `Couldn't find ${manifestFilename} file in the zip archive. Add one.`,
noManifestAtPath: (path) => `We couldn't find the artifact file ${path}.`,
empty: 'The provided artifact file was empty.',
@@ -831,10 +830,14 @@
},
taskLint: {
lintError: log_color_1.LogColor.error(`Error: The build failed due to errors in the app code. Fix the errors before rerunning ${forge('build')}, or run ${forge('build', '--no-verify')} to skip the linter.\n`),
lintWarning: (numWarnings) => {
- const { pluralCheckedTotal } = checkLintTotalPlurals(0, numWarnings, 0, 0);
+ const { pluralCheckedTotal } = checkLintTotalPlurals(0, numWarnings, 0, 0, 0);
return log_color_1.LogColor.warn(`${pluralCheckedTotal} found. Run ${forge('lint')} to review the warnings.`);
+ },
+ lintApproval: (numApprovals) => {
+ const { pluralCheckedApprovals } = checkLintTotalPlurals(0, 0, numApprovals, 0, 0);
+ return log_color_1.LogColor.approval(`The deploy failed due to ${pluralCheckedApprovals} requested. Approve the rule by running ${forge('deploy', '--approve=[ruleName]')}\n`);
}
},
list: {
cmd: {
@@ -862,22 +865,31 @@
const buildTagText = buildTag ? ` using build with tag ${buildTag}` : '';
return `Deploying ${appName}${buildTagText} to ${exports.Text.env.displayEnvironment(envKey, envType)}...`;
},
success: 'Deployed\n',
- successDetails: (appName, envKey, envType, buildTag) => {
+ successDetails: (appName, envKey, envType, buildTag, numApprovals) => {
const buildTagText = buildTag ? ` using build with tag ${buildTag}` : '';
- return `Deployed ${appName}${buildTagText} to the ${exports.Text.env.displayEnvironment(envKey, envType)} environment.`;
+ const approvalsText = numApprovals && numApprovals > 0
+ ? ` with ${numApprovals} ${numApprovals === 1 ? 'approval' : 'approvals'} acknowledged`
+ : '';
+ return `Deployed ${appName}${buildTagText} to the ${exports.Text.env.displayEnvironment(envKey, envType)} environment${approvalsText}.`;
},
distributePageLink: (appId) => `To install on a site that you're an admin of, run ${forge('install')}.\n` +
'To install on any other site, generate an installation link in the developer console and share it with the site admin: ' +
`https://developer.atlassian.com/console/myapps/${appId}/manage/distribution`
},
taskLint: {
lintError: log_color_1.LogColor.error(`Error: The deploy failed due to errors in the app code. Fix the errors before rerunning ${forge('deploy')}, or run ${forge('deploy', '--no-verify')} to skip the linter.\n`),
lintWarning: (numWarnings) => {
- const { pluralCheckedTotal } = checkLintTotalPlurals(0, numWarnings, 0, 0);
+ const { pluralCheckedTotal } = checkLintTotalPlurals(0, numWarnings, 0, 0, 0);
return log_color_1.LogColor.warn(`${pluralCheckedTotal} found. Run ${forge('lint')} to review the warnings.`);
- }
+ },
+ lintApproval: (numApprovals, ruleNames) => {
+ const { pluralCheckedApprovals } = checkLintTotalPlurals(0, 0, numApprovals, 0, 0);
+ const rulesArg = ruleNames && ruleNames.length > 0 ? ruleNames.join(' ') : '[ruleName]';
+ return log_color_1.LogColor.approval(`The deploy failed due to ${pluralCheckedApprovals} requested. Run ${forge('deploy', `--approve ${rulesArg}`)} to acknowledge and proceed.\n`);
+ },
+ lintErrorsWithApprovals: log_color_1.LogColor.error(`Fix the error above before approving deployment rules.\n`)
},
hasNoAppInstallationsForEnv: {
hasNoAppInstallationsForEnvError: log_color_1.LogColor.error(`Error: The deployment failed due to errors while trying to determine if the app has any installations for the deployed environment.`)
},
@@ -895,8 +907,11 @@
},
skipRollout: {
description: 'Skip rolling release rollout after deployment'
},
+ approveRule: {
+ description: 'list of validation rules to approve'
+ },
connectKeyChange: {
continueChange: `Do you wish to continue with changing the Connect key?`,
continueDelete: `Do you wish to continue with deleting the Connect key?`,
mpacAppConnectKeyChangeAnalyticsError: 'Cannot change app.connect.key for an app with an Atlassian Marketplace listing.',
@@ -1018,10 +1033,9 @@
'in the developer console and share it with the site admin: ' +
`https://developer.atlassian.com/console/myapps/${appId}/distribution`,
appendRequestIdToErrorMessage: (message, requestId) => `${message} For more help on this issue, please reach out to support (${buildTerminalLink('https://developer.atlassian.com/support')}) and provide them the following request ID: ${requestId}`,
majorVersionNotFound: 'The major version you specified does not exist. Check the version number and try again.',
- installationLimitReached: 'Installation error: The target site already has the maximum number of apps installed. To install this app there, uninstall any unused apps first.',
- tooManyRequests: 'Too many requests'
+ installationLimitReached: 'Installation error: The target site already has the maximum number of apps installed. To install this app there, uninstall any unused apps first.'
},
debug: {
ccpEntitlementQueryFailed: `Non-essential request failed. Continuing installation.`
},
@@ -1283,30 +1297,34 @@
blurb: "The linter checks the app code for known errors. Warnings are issues you should fix, but they won't stop the app code from building.\nPress Ctrl+C to cancel.\n",
cmd: 'check the source files for common errors',
running: `Running ${forge('lint')}...`,
noProblems: 'No issues found.',
+ approvalRequired: chalk_1.default.cyan(` Approval required, fixable with ${forge('deploy', '--approve=[ruleName]')}.`),
noFixableProblem: chalk_1.default.red(` Issue found is not automatically fixable with ${forge('lint')}.`),
noFixableProblems: chalk_1.default.red(` Issues found are not automatically fixable with ${forge('lint')}.`),
filename: chalk_1.default.underline,
+ errorMissingManifest: `Missing manifest`,
+ errorInvalidManifest: `Invalid manifest`,
linterFailed: (linterClass, failure) => chalk_1.default.yellow(`${chalk_1.default.bold('Warning:')} Could not perform some linting actions for ${chalk_1.default.bold(linterClass)} due to unhandled error "${failure}".\n`),
fixed: (numFixableErrors, numFixableWarnings) => {
- const { pluralCheckedFixableErrors, pluralCheckedFixableWarnings } = checkLintTotalPlurals(0, 0, numFixableErrors, numFixableWarnings);
+ const { pluralCheckedFixableErrors, pluralCheckedFixableWarnings } = checkLintTotalPlurals(0, 0, 0, numFixableErrors, numFixableWarnings);
return `${greenTick} Fixed ${pluralCheckedFixableErrors} and ${pluralCheckedFixableWarnings}`;
},
fixFollowUp: `Run ${forge('lint')} to review outstanding errors and warnings`,
error: (line, column, message, reference) => getLintMessage(line, column, message, 'error', log_color_1.LogColor.error, reference),
- summary: (numErrors, numWarnings, numFixableErrors, numFixableWarnings) => {
- const { pluralCheckedErrors, pluralCheckedWarnings, pluralCheckedTotal } = checkLintTotalPlurals(numErrors, numWarnings, numFixableErrors, numFixableWarnings);
- const colourFunction = numErrors ? log_color_1.LogColor.error : log_color_1.LogColor.warn;
+ summary: (numErrors, numWarnings, numApprovals, numFixableErrors, numFixableWarnings) => {
+ const { pluralCheckedErrors, pluralCheckedWarnings, pluralCheckedApprovals, pluralCheckedTotal } = checkLintTotalPlurals(numErrors, numWarnings, numApprovals, numFixableErrors, numFixableWarnings);
+ const colourFunction = numErrors ? log_color_1.LogColor.error : numWarnings ? log_color_1.LogColor.warn : log_color_1.LogColor.approval;
const warningCharacter = numErrors ? 'X' : '⚠';
- return colourFunction(`${warningCharacter} ${pluralCheckedTotal} (${pluralCheckedErrors}, ${pluralCheckedWarnings})`);
+ return colourFunction(`${warningCharacter} ${pluralCheckedTotal} (${pluralCheckedErrors}, ${pluralCheckedWarnings}, ${pluralCheckedApprovals})`);
},
fixSummary: (numErrors, numFixableErrors, numFixableWarnings) => {
- const { pluralCheckedFixableErrors, pluralCheckedFixableWarnings } = checkLintTotalPlurals(0, 0, numFixableErrors, numFixableWarnings);
+ const { pluralCheckedFixableErrors, pluralCheckedFixableWarnings } = checkLintTotalPlurals(0, 0, 0, numFixableErrors, numFixableWarnings);
const colourFunction = numErrors ? log_color_1.LogColor.error : log_color_1.LogColor.warn;
return colourFunction(` Run ${forge('lint', '--fix')} to automatically fix ${pluralCheckedFixableErrors} and ${pluralCheckedFixableWarnings}.\n`);
},
- warning: (line, column, message, reference) => getLintMessage(line, column, message, 'warning', log_color_1.LogColor.warn, reference)
+ warning: (line, column, message, reference) => getLintMessage(line, column, message, 'warning', log_color_1.LogColor.warn, reference),
+ approval: (line, column, message, reference) => getLintMessage(line, column, message, 'approval', log_color_1.LogColor.approval, reference)
},
repositories: {
cmd: {
desc: 'view repositories and repository images'