@forge/cli-shared 3.11.3-next.3 → 3.12.0-experimental-5ec0ed7

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/out/ui/text.js CHANGED
@@ -195,8 +195,8 @@ What do you like or don't like about Forge? Share your feedback below or press C
195
195
  desc: 'create an app',
196
196
  start: 'Creating app...',
197
197
  success: (appName) => `Created ${appName}`,
198
- successDetails: (directory, validEnvironmentOptions, environmentToOption) => `\nYour app is ready to work on, deploy, and install. We created ${validEnvironmentOptions.length} environments you can deploy to: ${validEnvironmentOptions
199
- .map(environmentToOption)
198
+ successDetails: (directory, validEnvironmentOptions) => `\nYour app is ready to work on, deploy, and install. We created ${validEnvironmentOptions.length} environments you can deploy to: ${validEnvironmentOptions
199
+ .map(environment_1.environmentToOption)
200
200
  .join(', ')}.\n\nChange to directory ${chalk_1.default.bold(directory)} to see your app files.`
201
201
  },
202
202
  intro: (givenDirectory) => `Creating an app in directory ${chalk_1.default.bold(givenDirectory)}.\n`,
@@ -246,25 +246,42 @@ What do you like or don't like about Forge? Share your feedback below or press C
246
246
  desc: "register an app you didn't create so you can run commands for it",
247
247
  start: `Registering app...`,
248
248
  success: (appName) => `Registered ${appName}`,
249
- successDetails: (validEnvironmentOptions, environmentToOption) => `\nYour app is ready to work on, deploy, and install. We created ${validEnvironmentOptions.length} environments you can deploy to: ${validEnvironmentOptions
250
- .map(environmentToOption)
249
+ successDetails: (validEnvironmentOptions) => `\nYour app is ready to work on, deploy, and install. We created ${validEnvironmentOptions.length} environments you can deploy to: ${validEnvironmentOptions
250
+ .map(environment_1.environmentToOption)
251
251
  .join(', ')}.\n\nUse ${chalk_1.default.bold('forge deploy')} to deploy your app to an environment.`
252
252
  },
253
253
  confirmQuestion: 'Are you sure you want to overwrite the existing app details?'
254
254
  },
255
255
  env: {
256
- option: (defaultEnvOption) => `specify the environment (default: ${defaultEnvOption})`,
256
+ option: 'specify the environment (defaults to your development environment)',
257
257
  invalid: 'Invalid environment name',
258
+ developmentOnly: (envKey) => `${(0, environment_1.environmentToOption)(envKey)} cannot be set as default environment. Only development environments can be used.`,
258
259
  error: {
260
+ appOwnerNotExist: 'Missing app owner details',
259
261
  appNotExist: `Your app could not be found. Make sure the app details in the manifest.yml file are correct before trying again.`,
260
- envNotExist: (envKey, environmentToOption) => `Environment ${chalk_1.default.bold(environmentToOption(envKey))} does not exist. Check the environment name and try again.`
262
+ envNotExist: (envKey) => `Environment ${chalk_1.default.bold((0, environment_1.environmentToOption)(envKey))} does not exist. Check the environment name and try again.`
261
263
  },
262
- displayEnvironment: (envKey, envType, environmentToOption) => {
263
- if (envType === graphql_types_1.AppEnvironmentType.Development && envKey !== environment_1.DEFAULT_ENVIRONMENT_KEY) {
264
- return `${chalk_1.default.gray('DEV')} ${environmentToOption(envKey)}`;
264
+ displayEnvironment: (envKey, envType) => {
265
+ if (envType === graphql_types_1.AppEnvironmentType.Development &&
266
+ envKey !== environment_1.DEFAULT_ENVIRONMENT_KEY &&
267
+ envKey !== environment_1.DEFAULT_ENVIRONMENT_OPTION) {
268
+ return `${chalk_1.default.gray('DEV')} ${(0, environment_1.environmentToOption)(envKey)}`;
265
269
  }
266
- return environmentToOption(envKey);
267
- }
270
+ return (0, environment_1.environmentToOption)(envKey);
271
+ },
272
+ warn: {
273
+ envWillBeCreated: (envKey) => `${chalk_1.default.bold('Warning:')} Environment ${chalk_1.default.bold((0, environment_1.environmentToOption)(envKey))} does not exist. If you continue, this development environment will be created for you.`
274
+ },
275
+ confirm: 'Do you want to continue?'
276
+ },
277
+ defaultEnv: {
278
+ info: 'You do not currently have a default development environment set. A default development environment is required to run commands without specifying an environment.',
279
+ prompt: 'Enter a name for your default development environment:',
280
+ warn: `${chalk_1.default.bold('Warning:')} A development environment with this name already exists. If you continue, you may be using the same environment as another contributor.`,
281
+ confirm: 'Do you want to continue?',
282
+ setSuccess: (envKey, envType) => `${exports.Text.env.displayEnvironment(envKey, envType)} has been set as your default development environment`,
283
+ createAndSetSuccess: (envKey, envType) => `${exports.Text.env.displayEnvironment(envKey, envType)} has been created and set as your default development environment`,
284
+ settingsInfo: `You can change your default development environment later by running ${chalk_1.default.bold('forge settings set')}.`
268
285
  },
269
286
  varsSet: {
270
287
  cmd: {
@@ -272,7 +289,7 @@ What do you like or don't like about Forge? Share your feedback below or press C
272
289
  start: 'Setting environment variable...',
273
290
  success: 'Environment variable set.'
274
291
  },
275
- overview: (environment, environmentType, environmentToOption) => `Setting the value of a variable in the ${exports.Text.env.displayEnvironment(environment, environmentType, environmentToOption)} environment.`,
292
+ overview: (environment, environmentType) => `Setting the value of a variable in the ${exports.Text.env.displayEnvironment(environment, environmentType)} environment.`,
276
293
  encryptInfo: 'Encrypting a variable means that the value will not be shown in the terminal.',
277
294
  promptEncrypt: `Select if you want the value encrypted:`,
278
295
  keyInfo: 'Use a new key to create a variable, or use an existing key to override a variable.',
@@ -285,16 +302,16 @@ What do you like or don't like about Forge? Share your feedback below or press C
285
302
  varsUnset: {
286
303
  cmd: {
287
304
  desc: 'remove an environment variable',
288
- start: (environment, envType, environmentToOption) => `Unsetting the variable in the ${exports.Text.env.displayEnvironment(environment, envType, environmentToOption)} environment.`,
305
+ start: (environment, envType) => `Unsetting the variable in the ${exports.Text.env.displayEnvironment(environment, envType)} environment.`,
289
306
  success: (key) => `\n${greenTick} ${key} variable removed.`
290
307
  }
291
308
  },
292
309
  varsList: {
293
310
  hint: `\nRun ${chalk_1.default.bold('forge variables list')} to see your environment variables.\n`,
294
311
  cmd: 'list the environment variables',
295
- empty: (environment, envType, environmentToOption) => `There are no variables in the ${exports.Text.env.displayEnvironment(environment, envType, environmentToOption)} environment.\n\nUse ${chalk_1.default.bold('forge variables set')} to create a variable.\n`,
312
+ empty: (environment, envType) => `There are no variables in the ${exports.Text.env.displayEnvironment(environment, envType)} environment.\n\nUse ${chalk_1.default.bold('forge variables set')} to create a variable.\n`,
296
313
  encryptedValue,
297
- overview: (environment, envType, environmentToOption) => `Showing variables from the ${exports.Text.env.displayEnvironment(environment, envType, environmentToOption)} environment:\n`,
314
+ overview: (environment, envType) => `Showing variables from the ${exports.Text.env.displayEnvironment(environment, envType)} environment:\n`,
298
315
  postfix: `\nNote, the values of encrypted variables are shown as ${encryptedValue}.\n`
299
316
  },
300
317
  providers: {
@@ -306,7 +323,7 @@ What do you like or don't like about Forge? Share your feedback below or press C
306
323
  start: 'Configuring provider credentials...',
307
324
  success: 'oauth provider credentials configuration is finished.'
308
325
  },
309
- overview: (environment, environmentToOption) => `Configuring provider in the ${environmentToOption(environment)} environment.`,
326
+ overview: (environment) => `Configuring provider in the ${(0, environment_1.environmentToOption)(environment)} environment.`,
310
327
  providerKeyInfo: 'Use a provider key from the list for configuration.',
311
328
  noProviders: "Count't find providers in the manifest file. Add one.",
312
329
  promptProviderKey: 'Select provider to configure:',
@@ -320,7 +337,7 @@ What do you like or don't like about Forge? Share your feedback below or press C
320
337
  cmd: {
321
338
  desc: 'create a new development environment',
322
339
  start: 'Creating environment...',
323
- success: (envKey, envType, environmentToOption) => `Created ${exports.Text.env.displayEnvironment(envKey, envType, environmentToOption)}`
340
+ success: (envKey, envType) => `Created ${exports.Text.env.displayEnvironment(envKey, envType)}`
324
341
  },
325
342
  overview: 'Create a new development environment.',
326
343
  promptEnvironmentKey: 'Enter a name for your environment:',
@@ -343,12 +360,12 @@ What do you like or don't like about Forge? Share your feedback below or press C
343
360
  prompt: 'Select development environment:',
344
361
  confirmationInfo: 'You are deleting the following environment(s):',
345
362
  promptConfirmation: 'Do you want to continue?',
346
- individualSuccessMessage: (envKey, envType, environmentToOption) => `${log_symbols_1.default.info} ${exports.Text.env.displayEnvironment(envKey, envType, environmentToOption)} deleted successfully.`,
363
+ individualSuccessMessage: (envKey, envType) => `${log_symbols_1.default.info} ${exports.Text.env.displayEnvironment(envKey, envType)} deleted successfully.`,
347
364
  successMessage: 'Environment(s) deleted.',
348
365
  optionEnvironmentKey: 'specify the environment to delete',
349
366
  warningMessage: `${chalk_1.default.bold('Warning:')} When deleting a development environment, you may impact in progress deployments or tunnels.`,
350
367
  noEnvironmentMessage: 'There are no development environments to delete.',
351
- hasInstallationError: (envKey, environmentToOption) => `${environmentToOption(envKey)} cannot be deleted because the environment is installed on a site. You can show all the current installations of your app by running ${chalk_1.default.bold('forge install list')}.`
368
+ hasInstallationError: (envKey) => `${(0, environment_1.environmentToOption)(envKey)} cannot be deleted because the environment is installed on a site. You can show all the current installations of your app by running ${chalk_1.default.bold('forge install list')}.`
352
369
  },
353
370
  storage: {
354
371
  cmd: {
@@ -430,10 +447,10 @@ What do you like or don't like about Forge? Share your feedback below or press C
430
447
  deploy: {
431
448
  cmd: {
432
449
  desc: 'deploy your app to an environment',
433
- start1: (envKey, environmentToOption) => `Deploying your app to the ${environmentToOption(envKey)} environment.\n${ctrlC}\n`,
434
- start2: (appName, envKey, envType, environmentToOption) => `Deploying ${appName} to ${exports.Text.env.displayEnvironment(envKey, envType, environmentToOption)}...`,
450
+ start1: (envKey, envType) => `Deploying your app to the ${exports.Text.env.displayEnvironment(envKey, envType)} environment.\n${ctrlC}\n`,
451
+ start2: (appName, envKey, envType) => `Deploying ${appName} to ${exports.Text.env.displayEnvironment(envKey, envType)}...`,
435
452
  success: 'Deployed\n',
436
- successDetails: (appName, envKey, envType, environmentToOption) => `Deployed ${appName} to the ${exports.Text.env.displayEnvironment(envKey, envType, environmentToOption)} environment.`,
453
+ successDetails: (appName, envKey, envType) => `Deployed ${appName} to the ${exports.Text.env.displayEnvironment(envKey, envType)} environment.`,
437
454
  distributePageLink: (appId) => `To install on a site that you're an admin of, run ${chalk_1.default.bold('forge install')}.\n` +
438
455
  'To install on any other site, generate an installation link in the developer console and share it with the site admin: ' +
439
456
  `https://developer.atlassian.com/console/myapps/${appId}/distribution`
@@ -481,7 +498,7 @@ What do you like or don't like about Forge? Share your feedback below or press C
481
498
  outdatedInstallations: `We've detected new scopes or egress URLs in your app.\n` +
482
499
  `Run ${chalk_1.default.bold('forge install --upgrade')} and restart your tunnel to put them into effect.`,
483
500
  listIndexes: (environment) => {
484
- const indexCommand = chalk_1.default.bold(`forge storage entities indexes list -e ${environment}`);
501
+ const indexCommand = chalk_1.default.bold(`forge storage entities indexes list -e ${(0, environment_1.environmentToOption)(environment)}`);
485
502
  return (`Run ${indexCommand} to check the status of the indexes.`);
486
503
  },
487
504
  egressURL: {
@@ -528,7 +545,7 @@ What do you like or don't like about Forge? Share your feedback below or press C
528
545
  install: {
529
546
  cmd: {
530
547
  description: 'manage app installations',
531
- start: (envKey, envType, environmentToOption) => `Installing your app on to ${exports.Text.env.displayEnvironment(envKey, envType, environmentToOption)}...`,
548
+ start: (envKey, envType) => `Installing your app on to ${exports.Text.env.displayEnvironment(envKey, envType)}...`,
532
549
  end: (displayTick) => `${displayTick ? greenTick + ' ' : ''}Install complete!`
533
550
  },
534
551
  booleanToScope: (isLatest) => (isLatest ? `Latest` : `Out-of-date`),
@@ -539,17 +556,17 @@ What do you like or don't like about Forge? Share your feedback below or press C
539
556
  .map(({ name, requiresInteractiveConsent }) => `- ${name}${requiresInteractiveConsent ? ' (requires interactive consent)' : ''}`)
540
557
  .join('\n')}\n`,
541
558
  listEgressAddresses: (egressAddresses) => `Your app will exchange data with the following urls:\n${egressAddresses.map((url) => `- ${url}`).join('\n')}\n`,
542
- permissionsMismatch: (environment) => `The scopes or egress URLs in the manifest are different from the scopes in your most recent deployment to ${environment}. Try running ${chalk_1.default.bold(`forge deploy -e ${environment}`)} before installing.\n`,
543
- multiProductScopesDetected: (productsToInstall, productsToUpgrade, site, environment, environmentToOption) => `\nWe detected your app requires scopes across multiple products.\nRun ${chalk_1.default.bold('forge install')} for each of the following:\n${productsToUpgrade
544
- .map((product) => `- forge install --upgrade -p ${(0, case_1.capital)(product)} -s ${site} -e ${environmentToOption(environment)}`)
559
+ permissionsMismatch: (environment) => `The scopes or egress URLs in the manifest are different from the scopes in your most recent deployment to ${(0, environment_1.environmentToOption)(environment)}. Try running ${chalk_1.default.bold(`forge deploy -e ${(0, environment_1.environmentToOption)(environment)}`)} before installing.\n`,
560
+ multiProductScopesDetected: (productsToInstall, productsToUpgrade, site, environment) => `\nWe detected your app requires scopes across multiple products.\nRun ${chalk_1.default.bold('forge install')} for each of the following:\n${productsToUpgrade
561
+ .map((product) => `- forge install --upgrade -p ${(0, case_1.capital)(product)} -s ${site} -e ${(0, environment_1.environmentToOption)(environment)}`)
545
562
  .join('\n')}${productsToUpgrade.length !== 0 && productsToInstall.length !== 0 ? '\n' : ''}${productsToInstall
546
- .map((product) => `- forge install -p ${(0, case_1.capital)(product)} -s ${site} -e ${environmentToOption(environment)}`)
563
+ .map((product) => `- forge install -p ${(0, case_1.capital)(product)} -s ${site} -e ${(0, environment_1.environmentToOption)(environment)}`)
547
564
  .join('\n')}`,
548
565
  promptForPermissionsConfirmation: (permissionsMismatchInDevelopment) => permissionsMismatchInDevelopment
549
566
  ? 'Are you sure you want to continue installing the app?'
550
567
  : 'Do you want to continue?',
551
568
  success: {
552
- banner: (envKey, envType, environmentToOption, product, site) => `Your app in the ${exports.Text.env.displayEnvironment(envKey, envType, environmentToOption)} environment is now installed in ${product} on ${buildTerminalLink(site)}`
569
+ banner: (envKey, envType, product, site) => `Your app in the ${exports.Text.env.displayEnvironment(envKey, envType)} environment is now installed in ${product} on ${buildTerminalLink(site)}`
553
570
  },
554
571
  error: {
555
572
  invalidAtlassianSite: (url) => `The URL you entered doesn't belong to an Atlassian site: ` +
@@ -562,7 +579,7 @@ What do you like or don't like about Forge? Share your feedback below or press C
562
579
  site: (url) => `Site is invalid: ${url}`,
563
580
  alreadyInstalledError: `Installation error: App is already installed.\nIf you're trying to upgrade your app, use the ${chalk_1.default.bold('forge install --upgrade')} command.`,
564
581
  serverSideInstallationError: (message) => `Installation error: ${message}`,
565
- noDeploymentFound: (environmentOption) => `Forge apps must be deployed before installation. Deploy your app by running ${chalk_1.default.bold(`forge deploy -e ${environmentOption}`)}.`,
582
+ noDeploymentFound: (environment) => `Forge apps must be deployed before installation. Deploy your app by running ${chalk_1.default.bold(`forge deploy -e ${(0, environment_1.environmentToOption)(environment)}`)}.`,
566
583
  permissionsDeniedInstructions: (requestId, appId) => `Insufficient permissions to install app (requestId: ${requestId})` +
567
584
  '\n\nTo install the app on this site, generate an installation link ' +
568
585
  'in the developer console and share it with the site admin: ' +
@@ -598,7 +615,7 @@ ${buildTerminalLink(link)}\n`,
598
615
  upgrade: {
599
616
  banner: `\nUpgrading your app on the Atlassian site.\n`,
600
617
  cmd: {
601
- start: (envKey, envType, environmentToOption) => `Upgrading your app in ${exports.Text.env.displayEnvironment(envKey, envType, environmentToOption)}...`,
618
+ start: (envKey, envType) => `Upgrading your app in ${exports.Text.env.displayEnvironment(envKey, envType)}...`,
602
619
  end: (displayTick) => `${displayTick ? greenTick + ' ' : ''}Upgrade complete!`,
603
620
  error: `Upgrade failed`
604
621
  },
@@ -611,11 +628,11 @@ ${buildTerminalLink(link)}\n`,
611
628
  ? 'Are you sure you want to continue upgrading the app?'
612
629
  : 'Do you want to continue?',
613
630
  success: {
614
- banner: (envKey, envType, environmentToOption, product, site) => `Your app in the ${exports.Text.env.displayEnvironment(envKey, envType, environmentToOption)} environment is now the latest in ${product} on ${buildTerminalLink(site)}.`
631
+ banner: (envKey, envType, product, site) => `Your app in the ${exports.Text.env.displayEnvironment(envKey, envType)} environment is now the latest in ${product} on ${buildTerminalLink(site)}.`
615
632
  },
616
633
  alreadyUpdated: {
617
634
  spinner: 'Site is already at the latest version',
618
- banner: (environment, environmentToOption, product, site) => `\nYour app in the ${environmentToOption(environment)} environment is at the latest in ${product} on ${buildTerminalLink(site)}.`
635
+ banner: (environment, product, site) => `\nYour app in the ${(0, environment_1.environmentToOption)(environment)} environment is at the latest in ${product} on ${buildTerminalLink(site)}.`
619
636
  },
620
637
  error: {
621
638
  serverSideInstallationError: (message) => `Upgrade error: ${message}`
@@ -631,7 +648,7 @@ ${buildTerminalLink(link)}\n`,
631
648
  cmd: 'start a tunnel to connect your local code with the app running in the development environment',
632
649
  optionDebugger: 'enable debugger mode',
633
650
  preamble: 'Tunnel redirects requests you make to your local machine. This occurs for any Atlassian site where your app is installed in the specific development environment. You will not see requests from other users.',
634
- startingTunnel: (environmentKey, envType, environmentToOption) => `Tunnelling to: ${exports.Text.env.displayEnvironment(environmentKey, envType, environmentToOption)}`,
651
+ startingTunnel: (environmentKey, envType) => `Tunnelling to: ${exports.Text.env.displayEnvironment(environmentKey, envType)}`,
635
652
  startedServer: (port, isDebug) => `Listening for requests${isDebug ? ' on local port ' + port : ''}...`,
636
653
  startedTunnel: (tunnelUrl) => `Started tunnel at address: ${tunnelUrl}`,
637
654
  stoppingTunnel: 'Stopping tunnel...',
@@ -701,8 +718,8 @@ Debugging in Google Chrome:
701
718
  done: `\n${log_symbols_1.default.success} Apps uninstalled`
702
719
  },
703
720
  info: 'Uninstalling the app by installation ID.',
704
- done: (product, domain, environment, environmentToOption, isMulti) => `${isMulti ? log_symbols_1.default.info : log_symbols_1.default.success} Uninstalled from the ${environmentToOption(environment)} environment in ${product} on ${buildTerminalLink(domain)}.`,
705
- failed: (product, domain, environment, environmentToOption) => `Failed to uninstall the app from the ${environmentToOption(environment)} environment in ${product} on ${buildTerminalLink(domain)}. Try rerunning the command, or ask for help if you continue to see this error.`,
721
+ done: (product, domain, environment, isMulti) => `${isMulti ? log_symbols_1.default.info : log_symbols_1.default.success} Uninstalled from the ${(0, environment_1.environmentToOption)(environment)} environment in ${product} on ${buildTerminalLink(domain)}.`,
722
+ failed: (product, domain, environment) => `Failed to uninstall the app from the ${(0, environment_1.environmentToOption)(environment)} environment in ${product} on ${buildTerminalLink(domain)}. Try rerunning the command, or ask for help if you continue to see this error.`,
706
723
  missingUninstallTask: `Cannot uninstall the app: something went wrong with starting the uninstall task.`
707
724
  },
708
725
  webtrigger: {
@@ -776,7 +793,7 @@ Debugging in Google Chrome:
776
793
  promptMessage: 'Allow Forge to collect CLI usage and error reporting information?'
777
794
  },
778
795
  set: {
779
- description: (choices) => `update Forge CLI setting (choices: ${choices.join(',')})`,
796
+ description: (choices) => `update Forge CLI setting (choices: ${choices.join(', ')})`,
780
797
  invalidSetting: (choices) => `Invalid setting specified. Valid settings: ${choices.join(', ')}`,
781
798
  invalidValue: `Invalid value specified. Valid values: true, false`,
782
799
  success: (setting, value) => `${greenTick} Successfully set ${setting} as ${value}.`
@@ -786,6 +803,9 @@ Debugging in Google Chrome:
786
803
  },
787
804
  usageAnalytics: {
788
805
  description: 'Allow Forge to collect CLI usage and error reporting information'
806
+ },
807
+ defaultEnvironment: {
808
+ description: 'Change your default development environment'
789
809
  }
790
810
  },
791
811
  nonInteractive: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/cli-shared",
3
- "version": "3.11.3-next.3",
3
+ "version": "3.12.0-experimental-5ec0ed7",
4
4
  "description": "Common functionality for Forge CLI",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
@@ -12,7 +12,7 @@
12
12
  "generate-graphql-types": "graphql-codegen --config src/graphql/codegen.yml"
13
13
  },
14
14
  "dependencies": {
15
- "@forge/manifest": "4.13.0-next.2",
15
+ "@forge/manifest": "4.13.0",
16
16
  "@forge/util": "1.2.3",
17
17
  "@sentry/node": "^7.29.0",
18
18
  "array.prototype.flatmap": "^1.2.3",
@@ -64,6 +64,7 @@
64
64
  "@types/tmp": "^0.1.0",
65
65
  "@types/unzipper": "^0.10.5",
66
66
  "graphql-tools": "^6.2.4",
67
- "jest-fixtures": "^0.6.0"
67
+ "jest-fixtures": "^0.6.0",
68
+ "jest-matcher-specific-error": "^1.0.0"
68
69
  }
69
70
  }