@hubspot/cli 5.0.0 → 5.0.1
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 +13 -1
- package/commands/create.js +2 -2
- package/commands/init.js +8 -2
- package/lang/en.lyaml +1 -1
- package/lib/projectStructure.js +16 -12
- package/package.json +2 -2
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
|
|
package/commands/create.js
CHANGED
|
@@ -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(
|
|
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]
|
|
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/lib/projectStructure.js
CHANGED
|
@@ -32,11 +32,13 @@ function getAppCardConfigs(appConfig, appPath) {
|
|
|
32
32
|
|
|
33
33
|
if (cards) {
|
|
34
34
|
cards.forEach(({ file }) => {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
if (typeof file === 'string') {
|
|
36
|
+
const cardConfigPath = path.join(appPath, file);
|
|
37
|
+
const cardConfig = loadConfigFile(cardConfigPath);
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
if (cardConfig) {
|
|
40
|
+
cardConfigs.push(cardConfig);
|
|
41
|
+
}
|
|
40
42
|
}
|
|
41
43
|
});
|
|
42
44
|
}
|
|
@@ -84,14 +86,16 @@ async function findProjectComponents(projectSourceDir) {
|
|
|
84
86
|
0,
|
|
85
87
|
projectFile.indexOf(APP_COMPONENT_CONFIG)
|
|
86
88
|
);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
if (typeof appPath === 'string') {
|
|
90
|
+
const isLegacy = getIsLegacyApp(parsedAppConfig, appPath);
|
|
91
|
+
|
|
92
|
+
components.push({
|
|
93
|
+
type: COMPONENT_TYPES.app,
|
|
94
|
+
config: parsedAppConfig,
|
|
95
|
+
runnable: !isLegacy,
|
|
96
|
+
path: appPath,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
95
99
|
}
|
|
96
100
|
}
|
|
97
101
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
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": "
|
|
45
|
+
"gitHead": "0f88273233124d513c4338fed7bd01fa4678251d"
|
|
46
46
|
}
|