@hubspot/cli 4.1.8-beta.7 → 4.2.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/list.js CHANGED
@@ -52,44 +52,35 @@ exports.handler = async options => {
52
52
  process.exit(EXIT_CODES.SUCCESS);
53
53
  }
54
54
 
55
- if (contentsResp.children.length) {
56
- const mappedContents = contentsResp.children.map(fileOrFolder => {
57
- if (!isPathFolder(fileOrFolder)) {
58
- return fileOrFolder;
59
- }
60
-
61
- return chalk.reset.blue(fileOrFolder);
62
- });
63
- const hubspotFolder = `/${HUBSPOT_FOLDER}`;
64
- const marketplaceFolder = `/${MARKETPLACE_FOLDER}`;
65
- const folderContentsOutput = mappedContents
66
- .sort(function(a, b) {
67
- // Pin @hubspot folder to top
68
- if (a === hubspotFolder) {
69
- return -1;
70
- } else if (b === hubspotFolder) {
71
- return 1;
72
- }
73
-
74
- // Pin @marketplace folder to top
75
- if (a === marketplaceFolder) {
76
- return -1;
77
- } else if (b === marketplaceFolder) {
78
- return 1;
79
- }
80
-
81
- return a.localeCompare(b);
55
+ if (!contentsResp.folder) {
56
+ logger.info(
57
+ i18n(`${i18nKey}.noFilesFoundAtPath`, {
58
+ path: directoryPath,
82
59
  })
83
- .join('\n');
60
+ );
61
+ return;
62
+ }
63
+ // getDirectoryContentsByPath omits @hubspot
64
+ const contents =
65
+ directoryPath === '/'
66
+ ? ['@hubspot', ...contentsResp.children]
67
+ : contentsResp.children;
84
68
 
85
- logger.log(folderContentsOutput);
86
- } else {
69
+ if (contents.length === 0) {
87
70
  logger.info(
88
- i18n(`${i18nKey}.noFilesFoundInPath`, {
71
+ i18n(`${i18nKey}.noFilesFoundAtPath`, {
89
72
  path: directoryPath,
90
73
  })
91
74
  );
75
+ return;
92
76
  }
77
+
78
+ const folderContentsOutput = contents
79
+ .map(addColorToContents)
80
+ .sort(sortContents)
81
+ .join('\n');
82
+
83
+ logger.log(folderContentsOutput);
93
84
  };
94
85
 
95
86
  exports.builder = yargs => {
@@ -105,3 +96,31 @@ exports.builder = yargs => {
105
96
 
106
97
  return yargs;
107
98
  };
99
+
100
+ const addColorToContents = fileOrFolder => {
101
+ if (!isPathFolder(fileOrFolder)) {
102
+ return chalk.reset.cyan(fileOrFolder);
103
+ }
104
+ if (fileOrFolder === HUBSPOT_FOLDER || fileOrFolder === MARKETPLACE_FOLDER) {
105
+ return chalk.reset.bold.blue(fileOrFolder);
106
+ }
107
+ return chalk.reset.blue(fileOrFolder);
108
+ };
109
+
110
+ const sortContents = (a, b) => {
111
+ // Pin @hubspot folder to top
112
+ if (a === HUBSPOT_FOLDER) {
113
+ return -1;
114
+ } else if (b === HUBSPOT_FOLDER) {
115
+ return 1;
116
+ }
117
+
118
+ // Pin @marketplace folder to top
119
+ if (a === MARKETPLACE_FOLDER) {
120
+ return -1;
121
+ } else if (b === MARKETPLACE_FOLDER) {
122
+ return 1;
123
+ }
124
+
125
+ return a.localeCompare(b);
126
+ };
@@ -29,7 +29,11 @@ exports.handler = async options => {
29
29
 
30
30
  const { name, template, location } = await createProjectPrompt(options);
31
31
 
32
- trackCommandUsage('project-create', null, accountId);
32
+ trackCommandUsage(
33
+ 'project-create',
34
+ { type: options.template || template },
35
+ accountId
36
+ );
33
37
 
34
38
  await createProjectConfig(
35
39
  path.resolve(getCwd(), options.location || location),
package/lang/en.lyaml CHANGED
@@ -998,7 +998,7 @@ en:
998
998
  invalidName: "You entered an invalid name. Please try again."
999
999
  nameRequired: "The name may not be blank. Please try again."
1000
1000
  spacesInName: "The name may not contain spaces. Please try again."
1001
- accountNameExists: "Account name \"{{ name }}\" already exists, please enter a different name."
1001
+ accountNameExists: "Account with name \"{{ name }}\" already exists in the CLI config, please enter a different name."
1002
1002
  personalAccessKeyPrompt:
1003
1003
  enterAccountId: "Enter the account ID for your account (the number under the DOMAIN column at https://app.hubspot.com/myaccounts-beta ): "
1004
1004
  enterClientId: "Enter your OAuth2 client ID: "
@@ -1077,7 +1077,7 @@ en:
1077
1077
  errors:
1078
1078
  invalidName: "You entered an invalid name. Please try again."
1079
1079
  nameRequired: "The name may not be blank. Please try again."
1080
- accountNameExists: "Account name \"{{ name }}\" already exists, please enter a different name."
1080
+ accountNameExists: "Account with name \"{{ name }}\" already exists in the CLI config, please enter a different name."
1081
1081
  selectAccountName: "Select the sandbox account you want to delete"
1082
1082
  selectParentAccountName: "Select the account that the sandbox belongs to"
1083
1083
  type:
@@ -1174,14 +1174,14 @@ en:
1174
1174
  standard: "Sync all supported assets to {{#cyan}}{{#bold}}{{ sandboxName }}{{/bold}}{{/cyan}} from {{#bold}}{{ parentAccountName }}{{/bold}}?"
1175
1175
  developer: "Sync CRM object definitions to {{#cyan}}{{#bold}}{{ sandboxName }}{{/bold}}{{/cyan}} from {{#bold}}{{ parentAccountName }}{{/bold}}?"
1176
1176
  syncContactRecords:
1177
- standard: "Include up to 5000 most recent contact records and associations in this sync? Syncing contact records may take some time"
1178
- developer: "Include up to 100 most recent contact records and associations in this sync? Syncing contact records may take some time"
1177
+ standard: "Include up to 5000 most recently updated contacts? This includes up to 100 of each of the following: associated deals, tickets, and companies. This can be done once per sandbox."
1178
+ developer: "Include up to 100 most recently updated contacts? This includes up to 100 of each of the following: associated deals, tickets, and companies. This can be done once per sandbox."
1179
1179
  loading:
1180
1180
  startSync: "Initiating sync..."
1181
1181
  fail: "Failed to sync sandbox."
1182
1182
  succeed: "Sandbox sync initiated to {{ accountName }}."
1183
1183
  skipPolling: "Syncing CRM object definitions."
1184
- skipPollingWithContacts: "Syncing CRM object definitions and up to 100 most recent contacts and associated records."
1184
+ skipPollingWithContacts: "Syncing CRM object definitions and up to 100 most recently updated contacts with associated deals, tickets, and companies (up to 100 each)."
1185
1185
  polling:
1186
1186
  syncing: "Syncing sandbox..."
1187
1187
  fail: "Failed to fetch sync updates. View the sync status at: {{ url }}"
package/lib/sandboxes.js CHANGED
@@ -256,19 +256,20 @@ const saveSandboxToConfig = async (env, result, force = false) => {
256
256
  const invalidAccountName = accountNameExistsInConfig(nameForConfig);
257
257
  if (invalidAccountName) {
258
258
  if (!force) {
259
- logger.log(
259
+ logger.log('');
260
+ logger.warn(
260
261
  i18n(
261
262
  `cli.lib.prompts.enterAccountNamePrompt.errors.accountNameExists`,
262
263
  { name: nameForConfig }
263
264
  )
264
265
  );
265
266
  const { name: promptName } = await enterAccountNamePrompt(
266
- nameForConfig
267
+ nameForConfig + `_${result.sandbox.sandboxHubId}`
267
268
  );
268
269
  validName = promptName;
269
270
  } else {
270
271
  // Basic invalid name handling when force flag is passed
271
- validName = nameForConfig + `_${Date.now()}`;
272
+ validName = nameForConfig + `_${result.sandbox.sandboxHubId}`;
272
273
  }
273
274
  }
274
275
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "4.1.8-beta.7",
3
+ "version": "4.2.0",
4
4
  "description": "CLI for working with HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "3116f0d518598a1b72d07457edf2374181a8f35e"
46
+ "gitHead": "a60ba8c2375e1102cfc98826147dbadaa94e8f31"
47
47
  }