@hubspot/cli 5.0.0 → 5.0.1-beta.0

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/commands/auth.js CHANGED
@@ -31,16 +31,23 @@ const {
31
31
  const {
32
32
  addConfigOptions,
33
33
  setLogLevel,
34
+ getAccountId,
34
35
  addTestingOptions,
35
36
  } = require('../lib/commonOpts');
36
37
  const { logDebugInfo } = require('../lib/debugInfo');
37
- const { trackCommandUsage } = require('../lib/usageTracking');
38
+ const { trackAuthAction, trackCommandUsage } = require('../lib/usageTracking');
38
39
  const { authenticateWithOauth } = require('../lib/oauth');
39
40
  const { EXIT_CODES } = require('../lib/enums/exitCodes');
40
41
  const { uiFeatureHighlight } = require('../lib/ui');
41
42
 
42
43
  const i18nKey = 'cli.commands.auth';
43
44
 
45
+ const TRACKING_STATUS = {
46
+ STARTED: 'started',
47
+ ERROR: 'error',
48
+ COMPLETE: 'complete',
49
+ };
50
+
44
51
  const ALLOWED_AUTH_METHODS = [
45
52
  OAUTH_AUTH_METHOD.value,
46
53
  PERSONAL_ACCESS_KEY_AUTH_METHOD.value,
@@ -71,6 +78,7 @@ exports.handler = async options => {
71
78
  checkAndWarnGitInclusion(getConfigPath());
72
79
 
73
80
  trackCommandUsage('auth');
81
+ trackAuthAction('auth', authType, TRACKING_STATUS.STARTED);
74
82
 
75
83
  let configData;
76
84
  let updatedConfig;
@@ -122,6 +130,7 @@ exports.handler = async options => {
122
130
  }
123
131
 
124
132
  if (!successAuthMethod) {
133
+ await trackAuthAction('auth', authType, TRACKING_STATUS.ERROR);
125
134
  process.exit(EXIT_CODES.ERROR);
126
135
  }
127
136
 
@@ -157,6 +166,9 @@ exports.handler = async options => {
157
166
  'accountsListCommand',
158
167
  ]);
159
168
 
169
+ const accountId = getAccountId({ account: accountName });
170
+ await trackAuthAction('auth', authType, TRACKING_STATUS.COMPLETE, accountId);
171
+
160
172
  process.exit(EXIT_CODES.SUCCESS);
161
173
  };
162
174
 
@@ -76,6 +76,8 @@ exports.handler = async options => {
76
76
  const argsToPass = { assetType, name, dest, options };
77
77
  dest = argsToPass.dest = resolveLocalPath(asset.dest(argsToPass));
78
78
 
79
+ trackCommandUsage('create', { assetType }, getAccountId(options));
80
+
79
81
  try {
80
82
  await fs.ensureDir(dest);
81
83
  } catch (e) {
@@ -94,8 +96,6 @@ exports.handler = async options => {
94
96
  if (asset.validate && !asset.validate(argsToPass)) return;
95
97
 
96
98
  await asset.execute(argsToPass);
97
-
98
- trackCommandUsage('create', { assetType }, getAccountId(options));
99
99
  };
100
100
 
101
101
  exports.builder = yargs => {
package/commands/init.js CHANGED
@@ -133,11 +133,17 @@ exports.handler = async options => {
133
133
  );
134
134
  uiFeatureHighlight(['helpCommand', 'authCommand', 'accountsListCommand']);
135
135
 
136
- trackAuthAction('init', authType, TRACKING_STATUS.COMPLETE, accountId);
136
+ await trackAuthAction(
137
+ 'init',
138
+ authType,
139
+ TRACKING_STATUS.COMPLETE,
140
+ accountId
141
+ );
137
142
  process.exit(EXIT_CODES.SUCCESS);
138
143
  } catch (err) {
139
144
  logErrorInstance(err);
140
- trackAuthAction('init', authType, TRACKING_STATUS.ERROR);
145
+ await trackAuthAction('init', authType, TRACKING_STATUS.ERROR);
146
+ process.exit(EXIT_CODES.ERROR);
141
147
  }
142
148
  };
143
149
 
package/lang/en.lyaml CHANGED
@@ -1071,7 +1071,7 @@ en:
1071
1071
  createProjectPrompt:
1072
1072
  enterName: "[--name] Give your project a name: "
1073
1073
  enterLocation: "[--location] Where should the project be created?"
1074
- selectTemplate: "[--template] Start from a template?"
1074
+ selectTemplate: "[--template] Choose a project template: "
1075
1075
  errors:
1076
1076
  nameRequired: "A project name is required"
1077
1077
  locationRequired: "A project location is required"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "5.0.0",
3
+ "version": "5.0.1-beta.0",
4
4
  "description": "CLI for working with HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -42,5 +42,5 @@
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  },
45
- "gitHead": "c84420be1abb52575cf159de243d41542653d0bb"
45
+ "gitHead": "50781b4dba44aef14d5357a25692e46689141aa3"
46
46
  }