@hubspot/cli 4.2.1-beta.2 → 4.2.1-beta.3

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/lang/en.lyaml CHANGED
@@ -67,6 +67,18 @@ en:
67
67
  nameBased: "Print information for the account in the config with name equal to \"MyAccount\""
68
68
  name: "{{#bold}}Account name{{/bold}}: {{ name }}"
69
69
  scopeGroups: "{{#bold}}Scopes available{{/bold}}:"
70
+ clean:
71
+ describe: "Checks for inactive accounts and removes them from the CLI config"
72
+ noResults: "No inactive accounts found to remove."
73
+ loading:
74
+ add: "Looking for inactive accounts…"
75
+ inactiveAccountsFound:
76
+ one: "1 inactive account found:"
77
+ other: "{{ count }} inactive accounts found:"
78
+ confirm:
79
+ one: "Remove 1 inactive account from the CLI config?"
80
+ other: "Remove {{ count }} inactive accounts from the CLI config?"
81
+ removeSuccess: "Removed {{ accountName }} from the CLI config."
70
82
  auth:
71
83
  describe: "Configure authentication for a HubSpot account. Supported authentication protocols are {{ supportedProtocols }}."
72
84
  errors:
@@ -455,21 +467,16 @@ en:
455
467
  projectMustExistExplanation: "The project {{ projectName }} does not exist in the target account {{ accountIdentifier}}. This command requires the project to exist in the target account."
456
468
  choseNotToCreateProject: "Exiting because this command requires the project to exist in the target account."
457
469
  initialUploadMessage: "HubSpot Local Dev Server Startup"
470
+ declineDefaultSandboxExplanation: "To develop on a different account, run {{ useCommand }} to change your default account, then re-run {{ devCommand }}."
458
471
  status:
459
472
  creatingProject: "Creating project {{ projectName }} in {{ accountIdentifier }}"
460
473
  createdProject: "Created project {{ projectName }} in {{ accountIdentifier }}"
461
474
  failedToCreateProject: "Failed to create project in the target account."
462
- startupMessage: "Starting local dev server for {{#bold}}{{ projectName }}{{/bold}} ..."
463
475
  prompt:
464
476
  createProject: "Create new project {{ projectName}} in {{#bold}}[{{ accountIdentifier }}]{{/bold}}?"
465
- options:
466
- local:
467
- describe: "Run the alpha version of this command with some local dev server functionality"
468
- localAll:
469
- describe: "Run the alpha version of this command with all local dev server functionality"
470
477
  errors:
471
478
  noProjectConfig: "No project detected. Please run this command again from a project directory."
472
- projectLockedError: "Your project is locked. This may mean that another user is running the {{#bold}}`hs project dev`{{/bold}} command for this project. If this is you, unlock the project in Projects UI."
479
+ projectLockedError: "Your project is locked. This may mean that another user is running the {{#bold}}`hs project watch`{{/bold}} command for this project. If this is you, unlock the project in Projects UI."
473
480
  examples:
474
481
  default: "Start local dev for the current project"
475
482
  create:
@@ -595,6 +602,8 @@ en:
595
602
  errors:
596
603
  downloadFailed: "Something went wrong downloading the project"
597
604
  projectNotFound: "Your project {{ projectName }} could not be found in {{ accountId }}"
605
+ warnings:
606
+ cannotDownloadWithinProject: "Cancelling project download. Please run the command again outside the context of an existing project."
598
607
  options:
599
608
  buildNumber:
600
609
  describe: "The build number to download"
@@ -854,68 +863,33 @@ en:
854
863
  portConflict: "The port {{ port }} is already in use."
855
864
  notInitialized: "The Dev Server Manager must be initialized before it is started."
856
865
  noCompatibleComponents: "Skipping call to {{ serverKey }} because there are no compatible components in the project."
857
- LocalDevManagerV2:
866
+ LocalDevManager:
858
867
  failedToInitialize: "Missing required arguments to initialize Local Dev"
859
868
  noComponents: "There are no components in this project."
869
+ noDeployedBuild: "There is no deployed build for this project in {{ accountIdentifier }}."
860
870
  noRunnableComponents: "There are no components in this project that support local development."
861
871
  betaMessage: "HubSpot projects local development"
862
872
  running: "Running {{#bold}}{{ projectName }}{{/bold}} locally on {{ accountIdentifier }}, waiting for changes ..."
863
873
  quitHelper: "Press {{#bold}}'q'{{/bold}} to stop the local dev server"
864
- viewInHubSpotLink: "View in HubSpot"
874
+ viewInHubSpotLink: "View project in HubSpot"
865
875
  exitingStart: "Stopping local dev server ..."
866
876
  exitingSucceed: "Successfully exited"
867
877
  exitingFail: "Failed to cleanup before exiting"
868
878
  uploadWarning:
869
- missingComponents: "Your deployed project does not contain the components {{#bold}}'{{ missingComponents }}'{{/bold}}. This may cause issues in local development."
879
+ appLabel: "[App]"
880
+ uiExtensionLabel: "[UI Extension]"
881
+ configEdit: "You edited the configuration file {{#bold}}{{ path }}{{/bold}}. Changes to configuration files cannot be handled by the local dev server."
882
+ missingComponents: "The deployed build for this project does not contain {{#bold}}'{{ missingComponents }}'{{/bold}}. This may cause issues in local development."
870
883
  header: "{{ reason }} To reflect these changes:"
871
- stopDev: " * Stop {{#bold}}`hs project dev`{{/bold}}"
872
- runUpload: " * Run {{#bold}}`hs project upload`{{/bold}}"
873
- runUploadWithAccount: " * Run {{#bold}}`hs project upload --account={{ accountId }}`{{/bold}}"
874
- restartDev: " * Re-run {{#bold}}`hs project dev`{{/bold}}"
884
+ stopDev: " * Stop {{ command }}"
885
+ runUpload: " * Run {{ command }}"
886
+ runUploadWithAccount: " * Run {{ command }}"
887
+ restartDev: " * Re-run {{ command }}"
875
888
  devServer:
876
889
  cleanupError: "Failed to cleanup local dev server: {{ message }}"
877
890
  setupError: "Failed to setup local dev server: {{ message }}"
878
891
  startError: "Failed to start local dev server: {{ message }}"
879
- LocalDevManager:
880
- failedToInitialize: "Missing required arguments to initialize Local Dev Manager"
881
- exitingStart: "Stopping local dev server ..."
882
- exitingSucceed: "Successfully exited"
883
- exitingFail: "Failed to clean up before exiting"
884
- previousStagingBuildCancelled: "Failed to create a staging build because the project was already locked. It is now unlocked. Run the command again."
885
- cancelledFromUI: "The dev process has been cancelled from the UI. Any changes made since cancelling have not been uploaded. To resume dev mode, rerun {{#yellow}}`hs project dev`{{/yellow}}."
886
- header:
887
- betaMessage: "{{#yellow}}{{#bold}}[beta]{{/bold}}{{/yellow}} HubSpot projects local development"
888
- running: "Running {{#bold}}{{ projectName }}{{/bold}} locally on {{ accountIdentifier }}, waiting for changes ..."
889
- quitHelper: "Press {{#bold}}'q'{{/bold}} to stop the local dev server"
890
- viewInHubSpotLink: "View in HubSpot"
891
- status:
892
- clean: "{{#bold}}Status:{{/bold}} {{#green}}Everything up to date{{/green}}"
893
- buildError: "{{#bold}}Status:{{/bold}} {{#red}}Latest build failed{{/red}}"
894
- deployError: "{{#bold}}Status:{{/bold}} {{#red}}Latest deploy failed{{/red}}"
895
- uploadPending: "{{#bold}}Status:{{/bold}} {{#yellow}}Upload is pending{{/yellow}}"
896
- noUploadsAllowed: "{{#bold}}Status:{{/bold}} {{#red}}Change requires upload, but uploads are not allowed{{/red}}"
897
- manualUploadRequired: "{{#bold}}Status:{{/bold}} {{#yellow}}Change requires manual upload{{/yellow}}"
898
- manualUpload: "{{#bold}}Status:{{/bold}} {{#green}}Manually uploading pending changes{{/green}}"
899
- upload:
900
- noUploadsAllowed: "The change to {{ filePath }} requires an upload, but the CLI cannot upload to a project that is using a github integration."
901
- manualUploadSkipped: "Manually upload and deploy project to production account: {{#green}}(n){{/green}}"
902
- manualUploadConfirmed: "Manually upload and deploy project to production account: {{#green}}(Y){{/green}}"
903
- manualUploadRequired: "Project file changes require a manual upload and deploy ..."
904
- manualUploadExplanation1: "{{#yellow}}> Dev server is running on a {{#bold}}non-sandbox account{{/bold}}.{{/yellow}}"
905
- manualUploadExplanation2: "{{#yellow}}> Uploading changes may overwrite production data.{{/yellow}}"
906
- manualUploadPrompt: "? Manually upload and deploy project? {{#green}}Y/n{{/green}}"
907
- extensionNotAllowed: "Extension not allowed for {{ filePath }}"
908
- fileIgnored: "File ignored: {{ filePath }}"
909
- uploadingAddChange: "[INFO] Uploading {{ filePath }}"
910
- uploadedAddChange: "[INFO] Uploaded {{ filePath }}"
911
- uploadingRemoveChange: "[INFO] Removing {{ filePath }}"
912
- uploadedRemoveChange: "[INFO] Removed {{ filePath }}"
913
- uploadingChanges: "{{#bold}}Building #{{ buildId }} and deploying recent changes on {{ accountIdentifier }}{{/bold}}"
914
- uploadedChangesSucceeded: "{{#bold}}Built #{{ buildId }} and deployed recent changes on {{ accountIdentifier }}{{/bold}}"
915
- uploadedChangesFailed: "{{#bold}}Failed to build #{{ buildId }} and deploy recent changes on {{ accountIdentifier }}{{/bold}}"
916
- devServer:
917
- startError: "{{#red}}[ERROR]{{/red}} Failed to start local dev server"
918
- cleanupError: "{{#red}}[ERROR]{{/red}} Failed to cleanup local dev server"
892
+ fileChangeError: "Failed to notify local dev server of file change: {{ message }}"
919
893
  projects:
920
894
  uploadProjectFiles:
921
895
  add: "Uploading {{#bold}}{{ projectName }}{{/bold}} project files to {{ accountIdentifier }}"
@@ -930,6 +904,8 @@ en:
930
904
  createPrompt: "The project {{ projectName }} does not exist in {{ accountIdentifier }}. Would you like to create it?"
931
905
  createSuccess: "New project {{#bold}}{{ projectName }}{{/bold}} successfully created in {{#bold}}{{ accountIdentifier }}{{/bold}}."
932
906
  notFound: "Your project {{#bold}}{{ projectName }}{{/bold}} could not be found in {{#bold}}{{ accountIdentifier }}{{/bold}}."
907
+ pollFetchProject:
908
+ checkingProject: "Checking if project exists in {{ accountIdentifier }}"
933
909
  makePollTaskStatusFunc:
934
910
  componentCountSingular: "Found 1 component in this project"
935
911
  componentCount: "Found {{ numComponents }} components in this project"
@@ -945,7 +921,7 @@ en:
945
921
  noPlatformVersion: "No platformVersion found in hsproject.json. Falling back to version \"{{ defaultVersion }}\"."
946
922
  noPlatformVersionAlt: "No platformVersion found in hsproject.json. Falling back to default version."
947
923
  ui:
948
- betaTag: "{{#bold}}[beta]{{/bold}}"
924
+ betaTag: "{{#bold}}[BETA]{{/bold}}"
949
925
  betaWarning:
950
926
  header: "{{#yellow}}***************************** WARNING ****************************{{/yellow}}"
951
927
  footer: "{{#yellow}}******************************************************************{{/yellow}}"
@@ -1011,9 +987,10 @@ en:
1011
987
  prompts:
1012
988
  projectDevTargetAccountPrompt:
1013
989
  createNewSandboxOption: "<Test on a new development sandbox>"
1014
- chooseDefaultAccountOption: "<{{#bold}}!{{/bold}} Test on this production account {{#bold}}!{{/bold}}>"
990
+ chooseDefaultAccountOption: "<{{#bold}}\U00002757{{/bold}} Test on this production account {{#bold}}\U00002757{{/bold}}>"
1015
991
  promptMessage: "[--account] Choose a sandbox under {{ accountIdentifier }} to test with:"
1016
992
  sandboxLimit: "You’ve reached the limit of {{ limit }} development sandboxes"
993
+ confirmDefaultSandboxAccount: "Continue testing on {{#bold}}{{ accountName }} ({{ accountType }}){{/bold}}? (Y/n)"
1017
994
  projectLogsPrompt:
1018
995
  projectName:
1019
996
  message: "[--project] Enter the project name:"
@@ -1,17 +1,12 @@
1
- const express = require('express');
2
- const bodyParser = require('body-parser');
3
- const cors = require('cors');
4
1
  const httpClient = require('@hubspot/cli-lib/http');
5
2
  const { logger } = require('@hubspot/cli-lib/logger');
6
- const { getProjectDetailUrl } = require('./projects');
7
3
  const { COMPONENT_TYPES } = require('./projectStructure');
8
4
  const { i18n } = require('./lang');
9
- const { EXIT_CODES } = require('./enums/exitCodes');
10
5
  const { promptUser } = require('./prompts/promptUtils');
6
+ const { DevModeInterface } = require('@hubspot/ui-extensions-dev-server');
11
7
 
12
8
  const i18nKey = 'cli.lib.DevServerManager';
13
9
 
14
- const DEFAULT_PORT = 8080;
15
10
  const SERVER_KEYS = {
16
11
  app: 'app',
17
12
  };
@@ -23,20 +18,13 @@ class DevServerManager {
23
18
  this.componentsByType = {};
24
19
  this.server = null;
25
20
  this.path = null;
26
- this.devServers = {};
27
- this.debug = false;
28
- }
29
-
30
- safeLoadServer() {
31
- try {
32
- const { DevModeInterface } = require('@hubspot/ui-extensions-dev-server');
33
- this.devServers[SERVER_KEYS.app] = {
21
+ this.devServers = {
22
+ [SERVER_KEYS.app]: {
34
23
  componentType: COMPONENT_TYPES.app,
35
24
  serverInterface: DevModeInterface,
36
- };
37
- } catch (e) {
38
- logger.debug('Failed to load dev server interface: ', e);
39
- }
25
+ },
26
+ };
27
+ this.debug = false;
40
28
  }
41
29
 
42
30
  async iterateDevServers(callback) {
@@ -57,10 +45,6 @@ class DevServerManager {
57
45
  }
58
46
  }
59
47
 
60
- generateURL(path) {
61
- return this.path ? `${this.path}/${path}` : null;
62
- }
63
-
64
48
  arrangeComponentsByType(components) {
65
49
  return components.reduce((acc, component) => {
66
50
  if (!acc[component.type]) {
@@ -73,18 +57,14 @@ class DevServerManager {
73
57
  }, {});
74
58
  }
75
59
 
76
- async setup({ alpha, components, debug, onUploadRequired }) {
60
+ async setup({ components, debug, onUploadRequired }) {
77
61
  this.debug = debug;
78
-
79
62
  this.componentsByType = this.arrangeComponentsByType(components);
80
63
 
81
- this.safeLoadServer();
82
-
83
64
  await this.iterateDevServers(
84
65
  async (serverInterface, compatibleComponents) => {
85
66
  if (serverInterface.setup) {
86
67
  await serverInterface.setup({
87
- alpha,
88
68
  components: compatibleComponents,
89
69
  debug,
90
70
  onUploadRequired,
@@ -97,42 +77,11 @@ class DevServerManager {
97
77
  this.initialized = true;
98
78
  }
99
79
 
100
- async start({ alpha, accountId, projectConfig }) {
80
+ async start({ accountId, projectConfig }) {
101
81
  if (this.initialized) {
102
- const app = express();
103
-
104
- // Install Middleware
105
- app.use(bodyParser.json({ limit: '50mb' }));
106
- app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }));
107
- app.use(cors());
108
-
109
- // Configure
110
- app.set('trust proxy', true);
111
-
112
- // Initialize a base route
113
- app.get('/', (req, res) => {
114
- res.send('HubSpot local dev server');
115
- });
116
-
117
- // Initialize URL redirects
118
- app.get('/hs/project', (req, res) => {
119
- res.redirect(getProjectDetailUrl(projectConfig.name, accountId));
120
- });
121
-
122
- // Start server
123
- this.server = await app.listen(DEFAULT_PORT).on('error', err => {
124
- if (err.code === 'EADDRINUSE') {
125
- logger.error(i18n(`${i18nKey}.portConflict`, { port: DEFAULT_PORT }));
126
- logger.log();
127
- process.exit(EXIT_CODES.ERROR);
128
- }
129
- });
130
-
131
- // Initialize component servers
132
82
  await this.iterateDevServers(async serverInterface => {
133
83
  if (serverInterface.start) {
134
84
  await serverInterface.start({
135
- alpha,
136
85
  accountId,
137
86
  debug: this.debug,
138
87
  httpClient,
@@ -140,10 +89,6 @@ class DevServerManager {
140
89
  });
141
90
  }
142
91
  });
143
-
144
- this.path = this.server.address()
145
- ? `http://localhost:${this.server.address().port}`
146
- : null;
147
92
  } else {
148
93
  throw new Error(i18n(`${i18nKey}.notInitialized`));
149
94
  }
@@ -151,6 +96,16 @@ class DevServerManager {
151
96
  this.started = true;
152
97
  }
153
98
 
99
+ fileChange({ filePath, event }) {
100
+ if (this.started) {
101
+ this.iterateDevServers(async serverInterface => {
102
+ if (serverInterface.fileChange) {
103
+ await serverInterface.fileChange(filePath, event);
104
+ }
105
+ });
106
+ }
107
+ }
108
+
154
109
  async cleanup() {
155
110
  if (this.started) {
156
111
  await this.iterateDevServers(async serverInterface => {
@@ -158,10 +113,6 @@ class DevServerManager {
158
113
  await serverInterface.cleanup();
159
114
  }
160
115
  });
161
-
162
- if (this.server) {
163
- await this.server.close();
164
- }
165
116
  }
166
117
  }
167
118
  }