@hubspot/cli 5.2.1-beta.10 → 5.2.1-beta.12

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.
@@ -12,20 +12,29 @@ const installPublicAppPrompt = async (
12
12
  targetAccountId,
13
13
  clientId,
14
14
  scopes,
15
- redirectUrls
15
+ redirectUrls,
16
+ isReinstall = false
16
17
  ) => {
17
18
  logger.log('');
18
- logger.log(i18n(`${i18nKey}.explanation`));
19
+ if (isReinstall) {
20
+ logger.log(i18n(`${i18nKey}.reinstallExplanation`));
21
+ } else {
22
+ logger.log(i18n(`${i18nKey}.explanation`));
23
+ }
19
24
 
20
25
  const { shouldOpenBrowser } = await promptUser({
21
26
  name: 'shouldOpenBrowser',
22
27
  type: 'confirm',
23
- message: i18n(`${i18nKey}.prompt`),
28
+ message: i18n(
29
+ isReinstall ? `${i18nKey}.reinstallPrompt` : `${i18nKey}.prompt`
30
+ ),
24
31
  });
25
32
 
26
- if (!shouldOpenBrowser) {
33
+ if (!isReinstall && !shouldOpenBrowser) {
27
34
  logger.log(i18n(`${i18nKey}.decline`));
28
35
  process.exit(EXIT_CODES.SUCCESS);
36
+ } else if (!shouldOpenBrowser) {
37
+ return;
29
38
  }
30
39
 
31
40
  const websiteOrigin = getHubSpotWebsiteOrigin(env);
@@ -10,17 +10,35 @@ const { EXIT_CODES } = require('../../lib/enums/exitCodes');
10
10
 
11
11
  const i18nKey = 'lib.prompts.selectPublicAppPrompt';
12
12
 
13
- const fetchPublicAppOptions = async (accountId, accountName) => {
13
+ const fetchPublicAppOptions = async (
14
+ accountId,
15
+ accountName,
16
+ isMigratingApp = false
17
+ ) => {
14
18
  try {
15
19
  const publicApps = await fetchPublicAppsForPortal(accountId);
16
20
  const filteredPublicApps = publicApps.filter(
17
21
  app => !app.projectId && !app.sourceId
18
22
  );
19
23
 
20
- if (!filteredPublicApps.length) {
24
+ if (
25
+ !filteredPublicApps.length ||
26
+ (isMigratingApp &&
27
+ !filteredPublicApps.some(
28
+ app => !app.preventProjectMigrations || !app.listingInfo
29
+ ))
30
+ ) {
31
+ const headerTranslationKey = isMigratingApp
32
+ ? 'noAppsMigration'
33
+ : 'noAppsClone';
34
+ const messageTranslationKey = isMigratingApp
35
+ ? 'noAppsMigrationMessage'
36
+ : 'noAppsCloneMessage';
21
37
  uiLine();
22
- logger.error(i18n(`${i18nKey}.errors.noApps`));
23
- logger.log(i18n(`${i18nKey}.errors.noAppsMessage`, { accountName }));
38
+ logger.error(i18n(`${i18nKey}.errors.${headerTranslationKey}`));
39
+ logger.log(
40
+ i18n(`${i18nKey}.errors.${messageTranslationKey}`, { accountName })
41
+ );
24
42
  uiLine();
25
43
  process.exit(EXIT_CODES.SUCCESS);
26
44
  }
@@ -35,10 +53,16 @@ const fetchPublicAppOptions = async (accountId, accountName) => {
35
53
  const selectPublicAppPrompt = async ({
36
54
  accountId,
37
55
  accountName,
38
- migrateApp = false,
56
+ isMigratingApp = false,
39
57
  }) => {
40
- const publicApps = await fetchPublicAppOptions(accountId, accountName);
41
- const translationKey = migrateApp ? 'selectAppIdMigrate' : 'selectAppIdClone';
58
+ const publicApps = await fetchPublicAppOptions(
59
+ accountId,
60
+ accountName,
61
+ isMigratingApp
62
+ );
63
+ const translationKey = isMigratingApp
64
+ ? 'selectAppIdMigrate'
65
+ : 'selectAppIdClone';
42
66
 
43
67
  return promptUser([
44
68
  {
@@ -48,10 +72,11 @@ const selectPublicAppPrompt = async ({
48
72
  }),
49
73
  type: 'list',
50
74
  choices: publicApps.map(app => {
51
- if (app.listingInfo) {
75
+ const { preventProjectMigrations, listingInfo } = app;
76
+ if (isMigratingApp && preventProjectMigrations && listingInfo) {
52
77
  return {
53
78
  name: `${app.name} (${app.id})`,
54
- disabled: i18n(`${i18nKey}.errors.marketplaceApp`),
79
+ disabled: i18n(`${i18nKey}.errors.cannotBeMigrated`),
55
80
  };
56
81
  }
57
82
  return {
@@ -64,6 +89,5 @@ const selectPublicAppPrompt = async ({
64
89
  };
65
90
 
66
91
  module.exports = {
67
- fetchPublicAppOptions,
68
92
  selectPublicAppPrompt,
69
93
  };
@@ -52,7 +52,7 @@ const tailLogs = async ({
52
52
  initialAfter = latestLog && base64EncodeString(latestLog.id);
53
53
  } catch (e) {
54
54
  // A 404 means no latest log exists(never executed)
55
- if (e.statusCode !== 404) {
55
+ if (e.response && e.response.status !== 404) {
56
56
  await logServerlessFunctionApiErrorInstance(
57
57
  accountId,
58
58
  e,
@@ -68,7 +68,7 @@ const tailLogs = async ({
68
68
  latestLog = await tailCall(after);
69
69
  nextAfter = latestLog.paging.next.after;
70
70
  } catch (e) {
71
- if (e.statusCode !== 404) {
71
+ if (e.response && e.response.status !== 404) {
72
72
  logApiErrorInstance(
73
73
  e,
74
74
  new ApiErrorContext({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "5.2.1-beta.10",
3
+ "version": "5.2.1-beta.12",
4
4
  "description": "CLI for working with HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,8 +8,8 @@
8
8
  "url": "https://github.com/HubSpot/hubspot-cms-tools"
9
9
  },
10
10
  "dependencies": {
11
- "@hubspot/local-dev-lib": "1.6.0",
12
- "@hubspot/serverless-dev-runtime": "5.2.1-beta.10",
11
+ "@hubspot/local-dev-lib": "1.9.0",
12
+ "@hubspot/serverless-dev-runtime": "5.2.1-beta.11",
13
13
  "@hubspot/theme-preview-dev-server": "0.0.7",
14
14
  "@hubspot/ui-extensions-dev-server": "0.8.20",
15
15
  "archiver": "^5.3.0",
@@ -33,6 +33,7 @@
33
33
  "yargs": "15.4.1"
34
34
  },
35
35
  "devDependencies": {
36
+ "axios": "^1.7.2",
36
37
  "mock-stdin": "^1.0.0"
37
38
  },
38
39
  "engines": {
@@ -45,5 +46,5 @@
45
46
  "publishConfig": {
46
47
  "access": "public"
47
48
  },
48
- "gitHead": "e20391c6bfc2c9de9b7d0b641e5241c409e510ad"
49
+ "gitHead": "24f25e7728f70ea9628e268a08f6d26916c94e40"
49
50
  }