@hubspot/cli 5.2.1-beta.4 → 5.2.1-beta.5

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,7 +1,7 @@
1
1
  const open = require('open');
2
2
 
3
3
  const { i18n } = require('../lib/lang');
4
- const { FEEDBACK_OPTIONS, FEEDBACK_URLS } = require('../lib/constants');
4
+ const { FEEDBACK_URLS } = require('../lib/constants');
5
5
  const { logger } = require('@hubspot/local-dev-lib/logger');
6
6
 
7
7
  const {
@@ -22,10 +22,8 @@ exports.handler = async options => {
22
22
  const { shouldOpen } = await shouldOpenBrowserPrompt(type, usedTypeFlag);
23
23
 
24
24
  if (shouldOpen || usedTypeFlag) {
25
- const url =
26
- type === FEEDBACK_OPTIONS.BUG || bugFlag
27
- ? FEEDBACK_URLS.BUG
28
- : FEEDBACK_URLS.GENERAL;
25
+ // NOTE: for now, all feedback should go to the hubspot-cli repository
26
+ const url = FEEDBACK_URLS.BUG;
29
27
  open(url, { url: true });
30
28
  logger.success(i18n(`${i18nKey}.success`, { url }));
31
29
  }
@@ -79,8 +79,8 @@ exports.handler = async options => {
79
79
 
80
80
  const components = await findProjectComponents(projectDir);
81
81
  const componentTypes = getProjectComponentTypes(components);
82
- const hasPrivateApps = componentTypes[COMPONENT_TYPES.privateApp];
83
- const hasPublicApps = componentTypes[COMPONENT_TYPES.publicApp];
82
+ const hasPrivateApps = !!componentTypes[COMPONENT_TYPES.privateApp];
83
+ const hasPublicApps = !!componentTypes[COMPONENT_TYPES.publicApp];
84
84
 
85
85
  if (hasPrivateApps && hasPublicApps) {
86
86
  logger.error(i18n(`${i18nKey}.errors.invalidProjectComponents`));
@@ -178,7 +178,7 @@ exports.handler = async options => {
178
178
  targetProjectAccountId = accountId;
179
179
  }
180
180
 
181
- const { projectExists, project } = await ensureProjectExists(
181
+ let { projectExists, project } = await ensureProjectExists(
182
182
  targetProjectAccountId,
183
183
  projectConfig.name,
184
184
  {
@@ -199,7 +199,7 @@ exports.handler = async options => {
199
199
  project.sourceIntegration &&
200
200
  project.sourceIntegration.source === 'GITHUB';
201
201
  } else {
202
- await createNewProjectForLocalDev(
202
+ project = await createNewProjectForLocalDev(
203
203
  projectConfig,
204
204
  targetProjectAccountId,
205
205
  createNewSandbox,
@@ -93,7 +93,7 @@ exports.handler = async options => {
93
93
  uiLine();
94
94
  logFeedbackMessage(result.buildId);
95
95
 
96
- displayWarnLogs(accountId, projectConfig.name, result.buildId);
96
+ await displayWarnLogs(accountId, projectConfig.name, result.buildId);
97
97
  process.exit(EXIT_CODES.SUCCESS);
98
98
  }
99
99
  } catch (e) {
package/lang/en.lyaml CHANGED
@@ -648,7 +648,7 @@ en:
648
648
  bug:
649
649
  describe: "Open Github issues in your browser to report a bug."
650
650
  general:
651
- describe: "Open the projects feedback form in your browser."
651
+ describe: "Open Github issues in your browser to give feedback."
652
652
  remove:
653
653
  describe: "Delete a file or folder from HubSpot."
654
654
  deleted: "Deleted \"{{ path }}\" from account {{ accountId }}"
@@ -917,7 +917,7 @@ en:
917
917
  noCompatibleComponents: "Skipping call to {{ serverKey }} because there are no compatible components in the project."
918
918
  LocalDevManager:
919
919
  failedToInitialize: "Missing required arguments to initialize Local Dev"
920
- noDeployedBuild: "There is no deployed build for this project in {{ accountIdentifier }}. Run {{ uploadCommand }} to upload and deploy your project."
920
+ noDeployedBuild: "Your project {{#bold}}{{ projectName }}{{/bold}} exists in {{ accountIdentifier }}, but has no deployed build. Projects must be successfully deployed to be developed locally. Address any build and deploy errors your project may have, then run {{ uploadCommand }} to upload and deploy your project."
921
921
  noComponents: "There are no components in this project."
922
922
  noRunnableComponents: "No supported components were found under {{#bold}}{{ projectSourceDir }}{{/bold}}. Run {{ command }} to see a list of available components."
923
923
  betaMessage: "HubSpot projects local development"
@@ -933,11 +933,18 @@ en:
933
933
  uiExtensionLabel: "[UI Extension]"
934
934
  missingComponents: "Couldn't find the following components in the deployed build for this project: {{#bold}}'{{ missingComponents }}'{{/bold}}. This may cause issues in local development."
935
935
  defaultWarning: "Changing project configuration requires a new project build."
936
+ defaultPublicAppWarning: "Changing project configuration requires a new project build. This will affect existing users of your public app. If your app has users in production, we strongly recommend creating a copy of this app to test your changes before proceding."
936
937
  header: "{{ warning }} To reflect these changes and continue testing:"
937
938
  stopDev: " * Stop {{ command }}"
938
939
  runUpload: " * Run {{ command }}"
939
940
  restartDev: " * Re-run {{ command }}"
940
941
  pushToGithub: " * Commit and push your changes to GitHub"
942
+ activeInstallWarning:
943
+ installCount: "{{#bold}}The app {{ appName }} has {{ installCount }} production installs{{/bold}}"
944
+ genericHeader: "{{#bold}}Local development can affect existing installs of your public app.{{/bold}}"
945
+ genericExplanation: "Some changes made during local development may need to be synced to HubSpot, which will impact users with existing installs. You will always be asked to confirm these changes before uploading them. If your app has any production installs, we strongly recommend creating a copy of this app to develop on instead."
946
+ explanation: "Some changes made during local development may need to be synced to HubSpot, which will impact those existing installs. We strongly recommend creating a copy of this app to use instead."
947
+ confirmation: "You will always be asked to confirm any permanent changes to your app’s configuration before uploading them."
941
948
  devServer:
942
949
  cleanupError: "Failed to cleanup local dev server: {{ message }}"
943
950
  setupError: "Failed to setup local dev server: {{ message }}"
@@ -951,7 +958,7 @@ en:
951
958
  suggestRecommendedNestedAccount:
952
959
  nonSandboxWarning: "Testing in a sandbox is strongly recommended. To switch the target account, select an option below or run {{#bold}}`hs accounts use`{{/bold}} before running the command again."
953
960
  publicAppNonDeveloperTestAccountWarning: "Local development of public apps is only supported in {{#bold}}developer test accounts{{/bold}}."
954
- privateAppNonDeveloperTestAccountWarning: "Local development of private apps is only supported in {{#bold}}developer test accounts{{/bold}}"
961
+ privateAppInAppDeveloperAccountError: "Local development of private apps is not supported in {{#bold}}app developer accounts{{/bold}}"
955
962
  createNewProjectForLocalDev:
956
963
  projectMustExistExplanation: "The project {{ projectName }} does not exist in the target account {{ accountIdentifier}}. This command requires the project to exist in the target account."
957
964
  publicAppProjectMustExistExplanation: "The project {{ projectName }} does not exist in {{ accountIdentifier}}, the app developer account associated with your target account. This command requires the project to exist in this app developer account."
@@ -1217,7 +1224,7 @@ en:
1217
1224
  bug: "[--bug] Report a bug"
1218
1225
  general: "[--general] Tell us about your experience with HubSpot's developer tools"
1219
1226
  bugPrompt: "Create an issue on Github in your browser?"
1220
- generalPrompt: "Open the projects feedback form in your browser?"
1227
+ generalPrompt: "Create an issue on Github in your browser?"
1221
1228
  buildIdPrompt:
1222
1229
  enterBuildId: "[--build] Deploy which build?"
1223
1230
  errors:
@@ -111,6 +111,7 @@ class LocalDevManager {
111
111
  if (this.activeApp.type === COMPONENT_TYPES.publicApp) {
112
112
  try {
113
113
  await this.setActivePublicAppData();
114
+ await this.checkActivePublicAppInstalls();
114
115
  await this.checkPublicAppInstallation();
115
116
  } catch (e) {
116
117
  logErrorInstance(e);
@@ -134,6 +135,19 @@ class LocalDevManager {
134
135
  this.activePublicAppData = activePublicAppData;
135
136
  }
136
137
 
138
+ async checkActivePublicAppInstalls() {
139
+ // TODO: Add check for installs once we have that info
140
+ if (!this.activePublicAppData) {
141
+ return;
142
+ }
143
+ uiLine();
144
+ // TODO: Replace with final copy
145
+
146
+ logger.warn(i18n(`${i18nKey}.activeInstallWarning.genericHeader`));
147
+ logger.log(i18n(`${i18nKey}.activeInstallWarning.genericExplanation`));
148
+ uiLine();
149
+ }
150
+
137
151
  async start() {
138
152
  SpinniesManager.stopAll();
139
153
  SpinniesManager.init();
@@ -142,6 +156,7 @@ class LocalDevManager {
142
156
  if (!this.deployedBuild) {
143
157
  logger.error(
144
158
  i18n(`${i18nKey}.noDeployedBuild`, {
159
+ projectName: this.projectConfig.name,
145
160
  accountIdentifier: uiAccountDescription(this.targetProjectAccountId),
146
161
  uploadCommand: this.getUploadCommand(),
147
162
  })
@@ -268,7 +283,13 @@ class LocalDevManager {
268
283
  }
269
284
 
270
285
  logUploadWarning(reason) {
271
- const warning = reason || i18n(`${i18nKey}.uploadWarning.defaultWarning`);
286
+ let warning = reason;
287
+ if (!reason) {
288
+ warning =
289
+ this.activeApp.type === COMPONENT_TYPES.publicApp
290
+ ? i18n(`${i18nKey}.uploadWarning.defaultPublicAppWarning`)
291
+ : i18n(`${i18nKey}.uploadWarning.defaultWarning`);
292
+ }
272
293
 
273
294
  // Avoid logging the warning to the console if it is currently the most
274
295
  // recently logged warning. We do not want to spam the console with the same message.
package/lib/localDev.js CHANGED
@@ -114,19 +114,20 @@ const suggestRecommendedNestedAccount = async (
114
114
  logger.log();
115
115
  uiLine();
116
116
  if (hasPublicApps) {
117
- logger.warn(
117
+ logger.log(
118
118
  i18n(
119
119
  `${i18nKey}.suggestRecommendedNestedAccount.publicAppNonDeveloperTestAccountWarning`
120
120
  )
121
121
  );
122
122
  } else if (isAppDeveloperAccount(accountConfig)) {
123
- logger.warn(
123
+ logger.error(
124
124
  i18n(
125
- `${i18nKey}.suggestRecommendedNestedAccount.publicAppNonDeveloperTestAccountWarning`
125
+ `${i18nKey}.suggestRecommendedNestedAccount.privateAppInAppDeveloperAccountError`
126
126
  )
127
127
  );
128
+ process.exit(EXIT_CODES.ERROR);
128
129
  } else {
129
- logger.warn(
130
+ logger.log(
130
131
  i18n(`${i18nKey}.suggestRecommendedNestedAccount.nonSandboxWarning`)
131
132
  );
132
133
  }
@@ -290,7 +291,7 @@ const useExistingDevTestAccount = async (env, account) => {
290
291
  }
291
292
  const devTestAcctConfigName = await saveDevTestAccountToConfig(env, account);
292
293
  logger.success(
293
- i18n(`cli.lib.developerTestAccount.create.success.configFileUpdated`, {
294
+ i18n(`lib.developerTestAccount.create.success.configFileUpdated`, {
294
295
  accountName: devTestAcctConfigName,
295
296
  authType: PERSONAL_ACCESS_KEY_AUTH_METHOD.name,
296
297
  })
@@ -319,7 +320,7 @@ const createNewProjectForLocalDev = async (
319
320
  );
320
321
  logger.log();
321
322
  uiLine();
322
- logger.warn(explanationString);
323
+ logger.log(explanationString);
323
324
  uiLine();
324
325
 
325
326
  shouldCreateProject = await confirmPrompt(
@@ -339,7 +340,7 @@ const createNewProjectForLocalDev = async (
339
340
  });
340
341
 
341
342
  try {
342
- await createProject(targetAccountId, projectConfig.name);
343
+ const project = await createProject(targetAccountId, projectConfig.name);
343
344
  SpinniesManager.succeed('createProject', {
344
345
  text: i18n(`${i18nKey}.createNewProjectForLocalDev.createdProject`, {
345
346
  accountIdentifier: uiAccountDescription(targetAccountId),
@@ -347,6 +348,7 @@ const createNewProjectForLocalDev = async (
347
348
  }),
348
349
  succeedColor: 'white',
349
350
  });
351
+ return project;
350
352
  } catch (err) {
351
353
  SpinniesManager.fail('createProject');
352
354
  logger.log(
@@ -417,7 +419,7 @@ const createInitialBuildForNewProject = async (
417
419
 
418
420
  logger.log();
419
421
  failedSubTasks.forEach(failedSubTask => {
420
- console.error(failedSubTask.errorMessage);
422
+ logger.error(failedSubTask.errorMessage);
421
423
  });
422
424
  logger.log();
423
425
 
package/lib/projects.js CHANGED
@@ -893,9 +893,17 @@ const displayWarnLogs = async (
893
893
  let result;
894
894
 
895
895
  if (isDeploy) {
896
- result = await fetchDeployWarnLogs(accountId, projectName, taskId);
896
+ try {
897
+ result = await fetchDeployWarnLogs(accountId, projectName, taskId);
898
+ } catch (e) {
899
+ logApiErrorInstance(e);
900
+ }
897
901
  } else {
898
- result = await fetchBuildWarnLogs(accountId, projectName, taskId);
902
+ try {
903
+ result = await fetchBuildWarnLogs(accountId, projectName, taskId);
904
+ } catch (e) {
905
+ logApiErrorInstance(e);
906
+ }
899
907
  }
900
908
 
901
909
  if (result && result.logs.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "5.2.1-beta.4",
3
+ "version": "5.2.1-beta.5",
4
4
  "description": "CLI for working with HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -10,8 +10,8 @@
10
10
  "dependencies": {
11
11
  "@hubspot/local-dev-lib": "1.1.0",
12
12
  "@hubspot/serverless-dev-runtime": "5.2.1-beta.4",
13
- "@hubspot/theme-preview-dev-server": "0.0.5",
14
- "@hubspot/ui-extensions-dev-server": "0.8.16",
13
+ "@hubspot/theme-preview-dev-server": "0.0.6",
14
+ "@hubspot/ui-extensions-dev-server": "0.8.17",
15
15
  "archiver": "^5.3.0",
16
16
  "chalk": "^4.1.2",
17
17
  "chokidar": "^3.0.1",
@@ -45,5 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "59dbc8bff2ca377c95e1eea4dcc52389e98ac644"
48
+ "gitHead": "21195f0f24e2e148f37c0320f0b31c2ebad817ff"
49
49
  }