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

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/lib/projects.js CHANGED
@@ -17,6 +17,9 @@ const {
17
17
  PROJECT_TASK_TYPES,
18
18
  SPINNER_STATUS,
19
19
  } = require('@hubspot/cli-lib/lib/constants');
20
+ const {
21
+ fetchDefaultVersion,
22
+ } = require('@hubspot/cli-lib/lib/projectPlatformVersion');
20
23
  const {
21
24
  createProject,
22
25
  getBuildStatus,
@@ -312,7 +315,8 @@ const uploadProjectFiles = async (
312
315
  accountId,
313
316
  projectName,
314
317
  filePath,
315
- uploadMessage
318
+ uploadMessage,
319
+ platformVersion
316
320
  ) => {
317
321
  SpinniesManager.init({});
318
322
  const accountIdentifier = uiAccountDescription(accountId);
@@ -333,7 +337,8 @@ const uploadProjectFiles = async (
333
337
  accountId,
334
338
  projectName,
335
339
  filePath,
336
- uploadMessage
340
+ uploadMessage,
341
+ platformVersion
337
342
  );
338
343
 
339
344
  buildId = upload.buildId;
@@ -490,7 +495,8 @@ const handleProjectUpload = async (
490
495
  accountId,
491
496
  projectConfig.name,
492
497
  tempFile.name,
493
- uploadMessage
498
+ uploadMessage,
499
+ projectConfig.platformVersion
494
500
  );
495
501
 
496
502
  if (error) {
@@ -807,6 +813,28 @@ const createProjectComponent = async (component, name) => {
807
813
  );
808
814
  };
809
815
 
816
+ const showPlatformVersionWarning = async (accountId, projectConfig) => {
817
+ const platformVersion = projectConfig.platformVersion;
818
+
819
+ if (!platformVersion) {
820
+ try {
821
+ const defaultVersion = await fetchDefaultVersion(accountId);
822
+ logger.log('');
823
+ logger.warn(
824
+ i18n(`${i18nKey}.showPlatformVersionWarning.noPlatformVersion`, {
825
+ defaultVersion,
826
+ })
827
+ );
828
+ } catch (e) {
829
+ logger.log('');
830
+ logger.warn(
831
+ i18n(`${i18nKey}.showPlatformVersionWarning.noPlatformVersionAlt`)
832
+ );
833
+ logger.debug(e.error);
834
+ }
835
+ }
836
+ };
837
+
810
838
  module.exports = {
811
839
  writeProjectConfig,
812
840
  getProjectConfig,
@@ -823,4 +851,5 @@ module.exports = {
823
851
  ensureProjectExists,
824
852
  logFeedbackMessage,
825
853
  createProjectComponent,
854
+ showPlatformVersionWarning,
826
855
  };
package/lib/ui.js CHANGED
@@ -6,6 +6,10 @@ const { getAccountConfig } = require('@hubspot/cli-lib/lib/config');
6
6
  const { i18n } = require('./lang');
7
7
  const { logger } = require('@hubspot/cli-lib/logger');
8
8
 
9
+ const UI_COLORS = {
10
+ orange: '#FF8F59',
11
+ };
12
+
9
13
  /**
10
14
  * Outputs horizontal line
11
15
  *
@@ -105,6 +109,12 @@ const uiFeatureHighlight = (commands, title) => {
105
109
  });
106
110
  };
107
111
 
112
+ const uiBetaMessage = message => {
113
+ const i18nKey = 'cli.lib.ui';
114
+
115
+ logger.log(chalk.hex(UI_COLORS.orange)(i18n(`${i18nKey}.betaTag`)), message);
116
+ };
117
+
108
118
  const uiBetaWarning = logMessage => {
109
119
  const i18nKey = 'cli.lib.ui.betaWarning';
110
120
 
@@ -114,7 +124,9 @@ const uiBetaWarning = logMessage => {
114
124
  };
115
125
 
116
126
  module.exports = {
127
+ UI_COLORS,
117
128
  uiAccountDescription,
129
+ uiBetaMessage,
118
130
  uiBetaWarning,
119
131
  uiFeatureHighlight,
120
132
  uiInfoSection,
@@ -7,6 +7,25 @@ const { version } = require('../package.json');
7
7
  const { getPlatform } = require('./environment');
8
8
  const { setLogLevel } = require('./commonOpts');
9
9
 
10
+ /* **
11
+ Available tracking meta properties
12
+
13
+ - action: "The specific action taken in the CLI"
14
+ - os: "The user's OS"
15
+ - nodeVersion: "The user's version of node.js"
16
+ - nodeMajorVersion: "The user's major version of node.js"
17
+ - version: "The user's version of the CLI"
18
+ - command: "The specific command that the user ran in this interaction"
19
+ - authType: "The configured auth type the user has for the CLI"
20
+ - step: "The specific step in the auth process"
21
+ - assetType: "The CMS asset type"
22
+ - mode: "The CLI mode (draft or publish"
23
+ - type: "The upload type (file or folder)"
24
+ - file: "Whether or not the 'file' flag was used"
25
+ - successful: "Whether or not the CLI interaction was successful"
26
+
27
+ */
28
+
10
29
  const EventClass = {
11
30
  USAGE: 'USAGE',
12
31
  INTERACTION: 'INTERACTION',
@@ -132,10 +151,48 @@ const trackAuthAction = async (command, authType, step, accountId) => {
132
151
  }
133
152
  };
134
153
 
154
+ function trackCommandMetadataUsage(command, meta = {}, accountId) {
155
+ if (!isTrackingAllowed()) {
156
+ return;
157
+ }
158
+ logger.debug('Attempting to track metadata usage of "%s" command', command);
159
+ let authType = 'unknown';
160
+ if (accountId) {
161
+ const accountConfig = getAccountConfig(accountId);
162
+ authType =
163
+ accountConfig && accountConfig.authType
164
+ ? accountConfig.authType
165
+ : API_KEY_AUTH_METHOD.value;
166
+ }
167
+ setImmediate(async () => {
168
+ const usageTrackingEvent = {
169
+ action: 'cli-command-metadata',
170
+ os: getPlatform(),
171
+ ...getNodeVersionData(),
172
+ version,
173
+ command,
174
+ authType,
175
+ ...meta,
176
+ };
177
+ try {
178
+ await trackUsage(
179
+ 'cli-interaction',
180
+ EventClass.INTERACTION,
181
+ usageTrackingEvent,
182
+ accountId
183
+ );
184
+ logger.debug('Sent usage tracking command event: %o', usageTrackingEvent);
185
+ } catch (e) {
186
+ logger.debug('Metadata usage tracking failed: %s', e.message);
187
+ }
188
+ });
189
+ }
190
+
135
191
  module.exports = {
136
192
  trackCommandUsage,
137
193
  trackHelpUsage,
138
194
  addHelpUsageTracking,
139
195
  trackConvertFieldsUsage,
140
196
  trackAuthAction,
197
+ trackCommandMetadataUsage,
141
198
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "4.2.1-beta.0",
3
+ "version": "4.2.1-beta.2",
4
4
  "description": "CLI for working with HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,8 +8,9 @@
8
8
  "url": "https://github.com/HubSpot/hubspot-cms-tools"
9
9
  },
10
10
  "dependencies": {
11
- "@hubspot/cli-lib": "^4.1.14",
12
- "@hubspot/serverless-dev-runtime": "4.1.8-beta.6",
11
+ "@hubspot/cli-lib": "^4.2.1",
12
+ "@hubspot/serverless-dev-runtime": "4.2.1-beta.2",
13
+ "@hubspot/ui-extensions-dev-server": "^0.5.0",
13
14
  "archiver": "^5.3.0",
14
15
  "body-parser": "^1.19.0",
15
16
  "chalk": "^4.1.2",
@@ -35,7 +36,7 @@
35
36
  "mock-stdin": "^1.0.0"
36
37
  },
37
38
  "engines": {
38
- "node": ">=10"
39
+ "node": ">=16"
39
40
  },
40
41
  "bin": {
41
42
  "hs": "./bin/hs",
@@ -44,5 +45,5 @@
44
45
  "publishConfig": {
45
46
  "access": "public"
46
47
  },
47
- "gitHead": "2e2976ffd17135fbc4dcdb8a8b9d078613ed5d53"
48
+ "gitHead": "9a111f2df1b19153efe867f3501599bfa4aedabe"
48
49
  }