@hubspot/cli 7.2.0-experimental.0 → 7.2.2-experimental.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.
Files changed (108) hide show
  1. package/bin/cli.js +52 -3
  2. package/commands/account/auth.d.ts +10 -0
  3. package/commands/account/auth.js +154 -0
  4. package/commands/account/createOverride.d.ts +10 -0
  5. package/commands/account/createOverride.js +62 -0
  6. package/commands/account/list.js +4 -0
  7. package/commands/account.js +4 -0
  8. package/commands/auth.js +9 -5
  9. package/commands/config/migrate.d.ts +10 -0
  10. package/commands/config/migrate.js +86 -0
  11. package/commands/config/set.d.ts +12 -0
  12. package/commands/config/set.js +30 -29
  13. package/commands/config.d.ts +4 -1
  14. package/commands/config.js +45 -10
  15. package/commands/create/api-sample.js +4 -14
  16. package/commands/customObject/create.d.ts +0 -11
  17. package/commands/customObject/create.js +28 -37
  18. package/commands/customObject/schema/create.d.ts +0 -10
  19. package/commands/customObject/schema/create.js +42 -40
  20. package/commands/customObject/schema/delete.d.ts +0 -11
  21. package/commands/customObject/schema/delete.js +27 -34
  22. package/commands/customObject/schema/fetch-all.d.ts +0 -10
  23. package/commands/customObject/schema/fetch-all.js +24 -31
  24. package/commands/customObject/schema/fetch.d.ts +0 -11
  25. package/commands/customObject/schema/fetch.js +42 -34
  26. package/commands/customObject/schema/list.d.ts +0 -7
  27. package/commands/customObject/schema/list.js +14 -23
  28. package/commands/customObject/schema/update.d.ts +0 -11
  29. package/commands/customObject/schema/update.js +46 -44
  30. package/commands/customObject/schema.d.ts +1 -5
  31. package/commands/customObject/schema.js +11 -49
  32. package/commands/customObject.d.ts +1 -4
  33. package/commands/customObject.js +21 -54
  34. package/commands/filemanager/fetch.d.ts +0 -12
  35. package/commands/filemanager/fetch.js +30 -33
  36. package/commands/filemanager/upload.d.ts +0 -11
  37. package/commands/filemanager/upload.js +47 -53
  38. package/commands/filemanager.d.ts +1 -4
  39. package/commands/filemanager.js +7 -41
  40. package/commands/init.js +15 -26
  41. package/commands/project/add.js +16 -62
  42. package/commands/project/cloneApp.js +3 -3
  43. package/commands/project/create.js +15 -70
  44. package/commands/project/dev.d.ts +0 -7
  45. package/commands/project/dev.js +75 -96
  46. package/commands/project/migrateApp.js +3 -3
  47. package/commands/project/upload.js +2 -7
  48. package/commands/sandbox/create.d.ts +0 -12
  49. package/commands/sandbox/create.js +72 -90
  50. package/commands/sandbox/delete.d.ts +0 -11
  51. package/commands/sandbox/delete.js +95 -112
  52. package/commands/sandbox.d.ts +1 -4
  53. package/commands/sandbox.js +10 -44
  54. package/commands/theme/generate-selectors.d.ts +0 -9
  55. package/commands/theme/generate-selectors.js +43 -61
  56. package/commands/theme/marketplace-validate.d.ts +0 -10
  57. package/commands/theme/marketplace-validate.js +26 -32
  58. package/commands/theme/preview.d.ts +0 -16
  59. package/commands/theme/preview.js +97 -104
  60. package/commands/theme.d.ts +1 -4
  61. package/commands/theme.js +10 -44
  62. package/lang/en.lyaml +67 -39
  63. package/lib/LocalDevManager.d.ts +2 -2
  64. package/lib/buildAccount.d.ts +3 -2
  65. package/lib/configMigrate.d.ts +2 -0
  66. package/lib/configMigrate.js +83 -0
  67. package/lib/constants.d.ts +3 -0
  68. package/lib/constants.js +4 -1
  69. package/lib/doctor/Diagnosis.d.ts +1 -0
  70. package/lib/doctor/Diagnosis.js +7 -0
  71. package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -6
  72. package/lib/doctor/DiagnosticInfoBuilder.js +1 -5
  73. package/lib/doctor/Doctor.d.ts +1 -1
  74. package/lib/doctor/Doctor.js +14 -6
  75. package/lib/localDev.d.ts +1 -2
  76. package/lib/marketplaceValidate.d.ts +2 -2
  77. package/lib/projects/buildAndDeploy.js +1 -4
  78. package/lib/projects/index.d.ts +5 -1
  79. package/lib/projects/index.js +62 -1
  80. package/lib/projects/upload.d.ts +1 -1
  81. package/lib/projects/upload.js +2 -2
  82. package/lib/prompts/accountNamePrompt.d.ts +1 -1
  83. package/lib/prompts/createProjectPrompt.d.ts +8 -6
  84. package/lib/prompts/createProjectPrompt.js +54 -26
  85. package/lib/prompts/projectAddPrompt.d.ts +3 -3
  86. package/lib/prompts/projectAddPrompt.js +6 -16
  87. package/lib/prompts/projectDevTargetAccountPrompt.d.ts +2 -3
  88. package/lib/prompts/sandboxesPrompt.d.ts +2 -3
  89. package/lib/prompts/sandboxesPrompt.js +1 -1
  90. package/lib/sandboxSync.js +2 -6
  91. package/lib/sandboxes.d.ts +5 -2
  92. package/lib/ui/index.d.ts +1 -1
  93. package/lib/ui/index.js +0 -1
  94. package/lib/upload.d.ts +1 -1
  95. package/lib/upload.js +20 -20
  96. package/lib/usageTracking.d.ts +1 -1
  97. package/lib/validation.d.ts +1 -1
  98. package/package.json +3 -4
  99. package/types/Projects.d.ts +6 -1
  100. package/types/Prompts.d.ts +0 -7
  101. package/types/Sandboxes.d.ts +0 -2
  102. package/types/Yargs.d.ts +0 -7
  103. package/lib/customObject.d.ts +0 -3
  104. package/lib/customObject.js +0 -15
  105. package/lib/projects/create.d.ts +0 -5
  106. package/lib/projects/create.js +0 -51
  107. package/lib/testUtils.d.ts +0 -12
  108. package/lib/testUtils.js +0 -10
package/lang/en.lyaml CHANGED
@@ -11,6 +11,9 @@ en:
11
11
  portalEnvVarDeprecated: "The HUBSPOT_PORTAL_ID environment variable is deprecated. Please use HUBSPOT_ACCOUNT_ID instead."
12
12
  loadConfigMiddleware:
13
13
  configFileExists: "A configuration file already exists at {{ configPath }}. To specify a new configuration file, delete the existing one and try again."
14
+ injectAccountIdMiddleware:
15
+ invalidAccountId: "In the default override file ({{ hsAccountFileName }}), the account ID must be a number. Please delete the current file and generate a new one using {{ overrideCommand }}."
16
+ accountNotFound: "The account in the default override file ({{ hsAccountFileName }}) wasn't found in your configured accounts. You can authorize this account using {{ authCommand }}."
14
17
  completion:
15
18
  describe: "Enable bash completion shortcuts for commands. Concat the generated script to your .bashrc, .bash_profile, or .zshrc file."
16
19
  examples:
@@ -18,11 +21,35 @@ en:
18
21
  account:
19
22
  describe: "Commands for managing configured accounts."
20
23
  subcommands:
24
+ auth:
25
+ describe: "Configure authentication for your HubSpot account."
26
+ options:
27
+ account:
28
+ describe: "HubSpot account to authenticate"
29
+ errors:
30
+ failedToUpdateConfig: "Failed to update the configuration file. Please try again."
31
+ bothConfigFilesNotAllowed: "Unable to create config file, because there is an existing \"{{ deprecatedConfig }}\" file. To create a new config file, delete the existing one and try again."
32
+ success:
33
+ configFileCreated: "Created config file \"{{ configPath }}\""
34
+ configFileUpdated: "Connected account \"{{ account }}\" and set it as the default account"
35
+ createOverride:
36
+ describe: "Create a new default account override file (.hs-account) in the current working directory."
37
+ success: "Default account override file created at {{ overrideFilePath }}"
38
+ errors:
39
+ accountNotFound: "The specified account could not be found in the config file {{ configPath }}"
40
+ options:
41
+ account:
42
+ describe: "Name or ID of the account to create an override file for."
43
+ examples:
44
+ default: "Create a new default account override file (.hs-account) in the current working directory"
45
+ idBased: "Create a new default account override file (.hs-account) in the current working directory, using the account with accountId \"1234567\""
46
+ nameBased: "Create a new default account override file (.hs-account) in the current working directory, using the account with name \"MyAccount\""
21
47
  list:
22
48
  accounts: "{{#bold}}Accounts{{/bold}}:"
23
49
  defaultAccount: "{{#bold}}Default account{{/bold}}: {{ account }}"
24
50
  describe: "List names of accounts defined in config."
25
51
  configPath: "{{#bold}}Config path{{/bold}}: {{ configPath }}"
52
+ overrideFilePath: "{{#bold}}Default account override file path{{/bold}}: {{ overrideFilePath }}"
26
53
  labels:
27
54
  accountId: "Account ID"
28
55
  authType: "Auth Type"
@@ -93,8 +120,8 @@ en:
93
120
  auth:
94
121
  describe: "Configure authentication for your HubSpot account. This will update the {{ configName }} file that stores your account information."
95
122
  errors:
96
- noConfigFileFound: "No config file was found. To create a new config file, use the \"hs init\" command."
97
123
  unsupportedAuthType: "Unsupported auth type: {{ type }}. The only supported authentication protocols are {{ supportedProtocols }}."
124
+ globalConfigFileExists: "A global config file exists at {{ configPath }}. To authorize an account, please use {{ authCommand }}."
98
125
  options:
99
126
  authType:
100
127
  describe: "Authentication mechanism"
@@ -106,6 +133,16 @@ en:
106
133
  config:
107
134
  describe: "Commands for managing the CLI config file."
108
135
  subcommands:
136
+ migrate:
137
+ describe: "Migrate from the deprecated {{ deprecatedConfigPath }} file to the new global config file at {{ globalConfigPath }}."
138
+ migrationAlreadyCompleted: "A global configuration file already exists at {{ globalConfigPath }}. No migration necessary."
139
+ errors:
140
+ configNotFound: "A configuration file at {{ configPath }} could not be found. Please try again with a valid file path."
141
+ options:
142
+ force: "When merging a deprecated configuration file with an existing global configuration file, overwrite any conflicting values in the global config with the deprecated config values."
143
+ examples:
144
+ default: "Migrate from the deprecated {{ deprecatedConfigPath }} file to the new global config file at {{ globalConfigPath }}"
145
+ configFlag: "Migrate a specific config file (specified with the config flag) to the new global config file at {{ globalConfigPath }}"
109
146
  set:
110
147
  describe: "Set various configuration options within the hubspot.config.yml file."
111
148
  promptMessage: "Select a config option to update"
@@ -207,7 +244,6 @@ en:
207
244
  create:
208
245
  describe: "Create custom object instances."
209
246
  errors:
210
- invalidObjectDefinition: "The object definition is invalid. Please check the schema and try again."
211
247
  creationFailed: "Object creation from {{ definition }} failed"
212
248
  options:
213
249
  path:
@@ -225,7 +261,6 @@ en:
225
261
  create:
226
262
  describe: "Create a custom object schema."
227
263
  errors:
228
- invalidSchema: "The schema definition is invalid. Please check the schema and try again."
229
264
  creationFailed: "Schema creation from {{ definition }} failed"
230
265
  options:
231
266
  definition:
@@ -287,7 +322,6 @@ en:
287
322
  update:
288
323
  describe: "Update an existing custom object schema."
289
324
  errors:
290
- invalidSchema: "The schema definition is invalid. Please check the schema and try again."
291
325
  update: "Schema update from {{ definition }} failed"
292
326
  options:
293
327
  path:
@@ -453,8 +487,6 @@ en:
453
487
  defaultDescription: "\"{{ authMethod }}\": An access token tied to a specific user account. This is the recommended way of authenticating with local development tools."
454
488
  account:
455
489
  describe: "HubSpot account to authenticate"
456
- useHiddenConfig:
457
- describe: "Use the new HubSpot configuration file located in a hidden file in the user's home directory"
458
490
  success:
459
491
  configFileCreated: "Created config file \"{{ configPath }}\""
460
492
  configFileUpdated: "Connected account \"{{ account }}\" using \"{{ authType }}\" and set it as the default account"
@@ -462,7 +494,7 @@ en:
462
494
  updateConfig: "To update an existing config file, use the \"hs auth\" command."
463
495
  errors:
464
496
  configFileExists: "The config file {{ configPath }} already exists."
465
- bothConfigFilesNotAllowed: "Unable to create config file, because there is an existing one at \"{{ path }}\". To create a new config file, delete the existing one and try again."
497
+ globalConfigFileExists: "A global config file already exists at {{ configPath }}. To specify a new local config file, delete the existing one and try again."
466
498
  lint:
467
499
  issuesFound: "{{ count }} issues found."
468
500
  groupName: "Linting {{ path }}"
@@ -525,20 +557,13 @@ en:
525
557
  learnMoreLocalDevServer: "Learn more about the projects local dev server"
526
558
  errors:
527
559
  noProjectConfig: "No project detected. Please run this command again from a project directory."
528
- noAccount: "An error occurred while reading account {{ accountId }} from your config. Run {{ authCommand }} to re-auth this account."
529
- noAccountsInConfig: "No accounts found in your config. Run {{ authCommand }} to configure a HubSpot account with the CLI."
530
560
  invalidProjectComponents: "Projects cannot contain both private and public apps. Move your apps to separate projects before attempting local development."
531
561
  noRunnableComponents: "No supported components were found in this project. Run {{ command }} to see a list of available components and add one to your project."
532
562
  examples:
533
563
  default: "Start local dev for the current project"
534
564
  create:
535
565
  describe: "Create a new project."
536
- errors:
537
- failedToDownloadProject: "Failed to download project. Please try again later."
538
- failedToFetchProjectList: "Failed to fetch the list of available project templates. Please try again later."
539
- cannotNestProjects: "A project already exists at {{ projectDir }}. Projects cannot be nested within other projects. Please choose a different destination and try again."
540
566
  logs:
541
- success: "Project {{#bold}}{{ projectName }}{{/bold}} was successfully created in {{ projectDest }}"
542
567
  welcomeMessage: "Welcome to HubSpot Developer Projects!"
543
568
  examples:
544
569
  default: "Create a new project"
@@ -611,13 +636,12 @@ en:
611
636
  describe: "The name for your newly created component"
612
637
  type:
613
638
  describe: "The path to the component type's location within the hubspot-project-components Github repo: https://github.com/HubSpot/hubspot-project-components"
614
- creatingComponent: "Adding a new component to {{#bold}}{{ projectName }}{{/bold}}"
615
- success: "{{ componentName }} was successfully added to your project."
639
+ creatingComponent:
640
+ message: "Adding a new component to your project"
641
+ success:
642
+ message: "{{ componentName }} was added to your project"
616
643
  error:
617
- failedToDownloadComponent: "Failed to download project component. Please try again later."
618
- locationInProject: "This command must be run from within a project directory."
619
- failedToFetchComponentList: "Failed to fetch the list of available components. Please try again later."
620
- projectContainsPublicApp: "This project contains a public app. This command is currently only compatible with projects that contain private apps."
644
+ locationInProject: "The component location must be within a project folder"
621
645
  examples:
622
646
  default: "Create a component within your project"
623
647
  withFlags: "Use --name and --type flags to bypass the prompt."
@@ -824,8 +848,6 @@ en:
824
848
  invalidAccountType: "Sandboxes must be created from a production account. Your current default account {{#bold}}{{ accountName }}{{/bold}} is a {{ accountType }}.
825
849
  \n- Run {{#bold}}hs accounts use{{/bold}} to switch to your default account to your production account.
826
850
  \n- Run {{#bold}}hs auth{{/bold}} to connect a production account to the HubSpot CLI.\n"
827
- noAccountConfig: "There is no account associated with {{ accountId }} in the config file. Please choose another account and try again, or authenticate {{ accountId }} using {{ authCommand }}."
828
- noSandboxAccountConfig: "There is no sandbox account associated with {{ accountId }} in the config file. Please try to re-authenticate your sandbox account using {{ authCommand}}."
829
851
  delete:
830
852
  describe: "Delete a sandbox account."
831
853
  debug:
@@ -842,12 +864,11 @@ en:
842
864
  failure:
843
865
  invalidUser: "Couldn't delete {{ accountName }} because your account has been removed from {{ parentAccountName }} or your permission set doesn't allow you to delete the sandbox. To update your permissions, contact a super admin in {{ parentAccountName }}."
844
866
  noAccount: "No account specified. Specify an account by using the --account flag."
845
- noSandboxAccounts: "There are no sandboxes connected to the CLI. To add a sandbox, run {{ authCommand }}."
846
- noSandboxAccountId: "This sandbox can't be deleted from the CLI because we could not find the associated sandbox account."
847
- noParentAccount: "This sandbox can't be deleted from the CLI because you haven't given the CLI access to its parent account. To do this, run {{ authCommand }} and add the parent account."
867
+ noSandboxAccounts: "There are no sandboxes connected to the CLI. To add a sandbox, run {{#bold}}hs auth{{/bold}}."
868
+ noParentAccount: "This sandbox can't be deleted from the CLI because you haven't given the CLI access to its parent account. To do this, run {{#bold}}hs auth{{/bold}} and add the parent account."
848
869
  objectNotFound: "Sandbox {{#bold}}{{ account }}{{/bold}} may have been deleted through the UI. The account has been removed from the config."
849
- noParentPortalAvailable: "This sandbox can't be deleted from the CLI because you haven't given the CLI access to its parent account. To do this, run {{ command }}. You can also delete the sandbox from the HubSpot management tool: {{#bold}}{{ url }}{{/bold}}."
850
- invalidKey: "Your personal access key for account {{#bold}}{{ account }}{{/bold}} is inactive. To re-authenticate, please run {{ authCommand }}."
870
+ noParentPortalAvailable: "This sandbox can't be deleted from the CLI because you haven't given the CLI access to its parent account. To do this, run {{#bold}}{{ command }}{{/bold}}. You can also delete the sandbox from the HubSpot management tool: {{#bold}}{{ url }}{{/bold}}."
871
+ invalidKey: "Your personal access key for account {{#bold}}{{ account }}{{/bold}} is inactive. To re-authenticate, please run {{#bold}}hs auth personalaccesskey{{/bold}}."
851
872
  options:
852
873
  force:
853
874
  describe: "Skips all confirmation prompts when deleting a sandbox account."
@@ -1115,11 +1136,6 @@ en:
1115
1136
  checkIfParentAccountIsAuthed:
1116
1137
  notAuthedError: "To develop this project locally, run {{ authCommand }} to authenticate the App Developer Account {{ accountId }} associated with {{ accountIdentifier }}."
1117
1138
  projects:
1118
- create:
1119
- errors:
1120
- noProjectsInConfig: "Unable to find any projects in the target repository's config.json file. Please ensure that there is a \"projects\" array in the config file."
1121
- missingConfigFileTemplateSource: "Failed to fetch the config.json file from the target repository. Please ensure that there is a valid config.json file at the root of the repository and try again."
1122
- missingPropertiesInConfig: "Found misconfigured projects in the target repository's config.json file. Please ensure that each project in the target repository's config.json file contains the following properties: [\"name\", \"label\", \"path\", \"insertPath\"]."
1123
1139
  validateProjectConfig:
1124
1140
  configNotFound: "Unable to locate a project configuration file. Try running again from a project directory, or run {{ createCommand }} to create a new project."
1125
1141
  configMissingFields: "The project configuruation file is missing required fields."
@@ -1243,6 +1259,13 @@ en:
1243
1259
  describe: "Use environment variable config"
1244
1260
  debug:
1245
1261
  describe: "Set log level to debug"
1262
+ configMigrate:
1263
+ migrateConfigPrompt: "Migrate config?\n From deprecated config file: {{ deprecatedConfigPath }}\n To new global config file: {{ globalConfigPath }}\n (This action will delete the deprecated config file).\n"
1264
+ mergeConfigConflictPrompt: "Overwrite the conflicting property in the global config?\n {{ property }}: {{ values }} "
1265
+ mergeConfigsPrompt: "Two config files detected. Merge them?\n Deprecated config file: {{ deprecatedConfigPath }}\n Global config: {{ globalConfigPath }}\n (This action will delete the deprecated config file).\n"
1266
+ migrationSuccess: "The deprecated config file has been migrated to the new global config file at {{ globalConfigPath }}."
1267
+ mergeSuccess: "The deprecated config file has been merged with the global config file at {{ globalConfigPath }}."
1268
+ skippedExistingAccounts: "\nThe following accounts were not merged, because they already exist in the global config: {{ skippedAccountIds }}.\n"
1246
1269
  prompts:
1247
1270
  projectDevTargetAccountPrompt:
1248
1271
  createNewSandboxOption: "<Test on a new development sandbox>"
@@ -1327,9 +1350,12 @@ en:
1327
1350
  errors:
1328
1351
  nameRequired: "A project name is required"
1329
1352
  destRequired: "A project dest is required"
1330
- invalidDest: "There is an existing project at this destination. Please provide a new path for this project."
1353
+ invalidDest: "The selected destination already exists. Please provide a new path for this project."
1331
1354
  invalidCharacters: "The selected destination contains invalid characters. Please provide a new path and try again."
1332
- invalidTemplate: "[--template] Could not find template \"{{ template }}\". Please choose an available template:"
1355
+ invalidTemplate: "[--template] Could not find template {{ template }}. Please choose an available template."
1356
+ noProjectsInConfig: "Please ensure that there is a config.json file that contains a \"projects\" field."
1357
+ missingConfigFileTemplateSource: "Please ensure that there is a config.json file in the repository used as the --template-source"
1358
+ missingPropertiesInConfig: "Please ensure that each of the projects in your config.json file contain the following properties: [\"name\", \"label\", \"path\", \"insertPath\"]."
1333
1359
  selectPublicAppPrompt:
1334
1360
  selectAppIdMigrate: "[--appId] Choose an app under {{ accountName }} to migrate:"
1335
1361
  selectAppIdClone: "[--appId] Choose an app under {{ accountName }} to clone:"
@@ -1347,11 +1373,11 @@ en:
1347
1373
  projectNotFound: "Your project {{ projectName }} could not be found in {{ accountId }}. Please select a valid project:"
1348
1374
  accountIdRequired: "An account ID is required to download a project."
1349
1375
  projectAddPrompt:
1350
- selectType: "[--type] Select a component to add: "
1376
+ selectType: "[--type] Select your component type:"
1351
1377
  enterName: "[--name] Give your component a name: "
1352
1378
  errors:
1353
1379
  nameRequired: "A component name is required"
1354
- invalidType: "[--type] Could not find type \"{{ type }}\". Please choose an available type:"
1380
+ invalidType: "[--type] Could not find type {{ type }}. Please choose an available type."
1355
1381
  secretPrompt:
1356
1382
  enterValue: "Enter a value for your secret: "
1357
1383
  enterName: "Enter a name for your secret: "
@@ -1527,6 +1553,9 @@ en:
1527
1553
  doctor:
1528
1554
  runningDiagnostics: "Running diagnostics..."
1529
1555
  diagnosticsComplete: "Diagnostics complete"
1556
+ defaultAccountOverrideFileChecks:
1557
+ overrideActive: "Default account override file active: {{ defaultAccountOverrideFile }}"
1558
+ overrideAccountId: "Active account ID: {{ overrideAccountId }}"
1530
1559
  accountChecks:
1531
1560
  active: "Default account active"
1532
1561
  inactive: "Default account isn't active"
@@ -1575,9 +1604,8 @@ en:
1575
1604
  defaultAccountSubHeader: "Default Account: {{accountDetails}}"
1576
1605
  noConfigFile: "CLI configuration not found"
1577
1606
  noConfigFileSecondary: "Run {{command}} and follow the prompts to create your CLI configuration file and connect it to your HubSpot account"
1578
- settings:
1579
- httpUseLocalhost: "The setting {{#bold}}httpUseLocalhost{{/bold}} is enabled"
1580
- httpUseLocalhostSecondary: "This setting causes all CLI requests to route to localhost"
1607
+ defaultAccountOverrideFile:
1608
+ header: "Default account override file path:"
1581
1609
  projectConfig:
1582
1610
  header: "Project configuration"
1583
1611
  projectDirSubHeader: "Project dir: {{#bold}}{{ projectDir }}{{/bold}}"
@@ -10,7 +10,7 @@ type LocalDevManagerConstructorOptions = {
10
10
  projectDir: string;
11
11
  projectId: number;
12
12
  debug?: boolean;
13
- deployedBuild?: Build;
13
+ deployedBuild: Build;
14
14
  isGithubLinked: boolean;
15
15
  runnableComponents: Component[];
16
16
  env: Environment;
@@ -22,7 +22,7 @@ declare class LocalDevManager {
22
22
  projectDir: string;
23
23
  projectId: number;
24
24
  debug: boolean;
25
- deployedBuild?: Build;
25
+ deployedBuild: Build;
26
26
  isGithubLinked: boolean;
27
27
  watcher: FSWatcher | null;
28
28
  uploadWarnings: {
@@ -1,12 +1,13 @@
1
+ import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
1
2
  import { Environment } from '@hubspot/local-dev-lib/types/Config';
2
3
  import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
3
4
  import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
4
5
  import { SandboxResponse } from '@hubspot/local-dev-lib/types/Sandbox';
5
- import { SandboxAccountType } from '../types/Sandboxes';
6
6
  export declare function saveAccountToConfig(accountId: number | undefined, accountName: string, env: Environment, personalAccessKey?: string, force?: boolean): Promise<string>;
7
7
  export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: CLIAccount, env: Environment, portalLimit: number): Promise<DeveloperTestAccount>;
8
+ type SandboxType = typeof HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX | typeof HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX;
8
9
  type SandboxAccount = SandboxResponse & {
9
10
  name: string;
10
11
  };
11
- export declare function buildSandbox(sandboxName: string, parentAccountConfig: CLIAccount, sandboxType: SandboxAccountType, env: Environment, force?: boolean): Promise<SandboxAccount>;
12
+ export declare function buildSandbox(sandboxName: string, parentAccountConfig: CLIAccount, sandboxType: SandboxType, env: Environment, force?: boolean): Promise<SandboxAccount>;
12
13
  export {};
@@ -0,0 +1,2 @@
1
+ export declare function handleMigration(configPath?: string): Promise<void>;
2
+ export declare function handleMerge(configPath?: string, force?: boolean): Promise<void>;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleMigration = handleMigration;
4
+ exports.handleMerge = handleMerge;
5
+ const migrate_1 = require("@hubspot/local-dev-lib/config/migrate");
6
+ const config_1 = require("@hubspot/local-dev-lib/constants/config");
7
+ const logger_1 = require("@hubspot/local-dev-lib/logger");
8
+ const promptUtils_1 = require("./prompts/promptUtils");
9
+ const lang_1 = require("./lang");
10
+ const i18nKey = 'lib.configMigrate';
11
+ async function handleMigration(configPath) {
12
+ const { shouldMigrateConfig } = await (0, promptUtils_1.promptUser)({
13
+ name: 'shouldMigrateConfig',
14
+ type: 'confirm',
15
+ message: (0, lang_1.i18n)(`${i18nKey}.migrateConfigPrompt`, {
16
+ deprecatedConfigPath: (0, migrate_1.getConfigPath)(configPath, false) ||
17
+ config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
18
+ globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
19
+ }),
20
+ });
21
+ if (!shouldMigrateConfig) {
22
+ return;
23
+ }
24
+ const deprecatedConfig = (0, migrate_1.getConfig)(false, configPath);
25
+ // @ts-ignore Cannot reconcile CLIConfig_NEW and CLIConfig_DEPRECATED
26
+ (0, migrate_1.migrateConfig)(deprecatedConfig);
27
+ logger_1.logger.success((0, lang_1.i18n)(`${i18nKey}.migrationSuccess`, {
28
+ globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
29
+ }));
30
+ return;
31
+ }
32
+ async function mergeConfigProperties(globalConfig, deprecatedConfig, force) {
33
+ const { initialConfig, conflicts, } = (0, migrate_1.mergeConfigProperties)(globalConfig, deprecatedConfig, force);
34
+ if (conflicts.length > 0 && !force) {
35
+ for (const conflict of conflicts) {
36
+ const { property, newValue, oldValue } = conflict;
37
+ const { shouldOverwrite } = await (0, promptUtils_1.promptUser)({
38
+ name: 'shouldOverwrite',
39
+ type: 'confirm',
40
+ message: (0, lang_1.i18n)(`${i18nKey}.mergeConfigConflictPrompt`, {
41
+ property,
42
+ values: `${oldValue} (deprecated) vs ${newValue} (global)`,
43
+ }),
44
+ });
45
+ if (shouldOverwrite) {
46
+ // @ts-ignore Cannot reconcile CLIConfig_NEW and CLIConfig_DEPRECATED
47
+ initialConfig[property] = oldValue;
48
+ }
49
+ }
50
+ }
51
+ return initialConfig;
52
+ }
53
+ async function handleMerge(configPath, force) {
54
+ const { shouldMergeConfigs } = await (0, promptUtils_1.promptUser)({
55
+ name: 'shouldMergeConfigs',
56
+ type: 'confirm',
57
+ message: (0, lang_1.i18n)(`${i18nKey}.mergeConfigsPrompt`, {
58
+ deprecatedConfigPath: (0, migrate_1.getConfigPath)(configPath, false) ||
59
+ config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
60
+ globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
61
+ }),
62
+ });
63
+ if (!shouldMergeConfigs) {
64
+ return;
65
+ }
66
+ const deprecatedConfig = (0, migrate_1.getConfig)(false, configPath);
67
+ const globalConfig = (0, migrate_1.getConfig)(true);
68
+ const mergedConfig = await mergeConfigProperties(
69
+ // @ts-ignore Cannot reconcile CLIConfig_NEW and CLIConfig_DEPRECATED
70
+ globalConfig, deprecatedConfig, force);
71
+ const { skippedAccountIds } = (0, migrate_1.mergeExistingConfigs)(mergedConfig,
72
+ // @ts-ignore Cannot reconcile CLIConfig_NEW and CLIConfig_DEPRECATED
73
+ deprecatedConfig);
74
+ if (skippedAccountIds.length > 0) {
75
+ logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.skippedExistingAccounts`, {
76
+ skippedAccountIds: skippedAccountIds.join(', '),
77
+ }));
78
+ }
79
+ logger_1.logger.success((0, lang_1.i18n)(`${i18nKey}.mergeSuccess`, {
80
+ globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
81
+ }));
82
+ return;
83
+ }
@@ -3,6 +3,9 @@ export declare const DEFAULT_PROJECT_TEMPLATE_BRANCH: "main";
3
3
  export declare const FEEDBACK_INTERVAL: 10;
4
4
  export declare const HUBSPOT_FOLDER: "@hubspot";
5
5
  export declare const MARKETPLACE_FOLDER: "@marketplace";
6
+ export declare const CONFIG_FLAGS: {
7
+ readonly USE_CUSTOM_OBJECT_HUBFILE: "useCustomObjectHubfile";
8
+ };
6
9
  export declare const DEFAULT_POLLING_DELAY = 2000;
7
10
  export declare const PROJECT_CONFIG_FILE: "hsproject.json";
8
11
  export declare const PROJECT_BUILD_STATES: {
package/lib/constants.js CHANGED
@@ -1,11 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PLATFORM_VERSION_ERROR_TYPES = exports.PROJECT_COMPONENT_TYPES = exports.PROJECT_TASK_TYPES = exports.PROJECT_ERROR_TYPES = exports.PROJECT_DEPLOY_TEXT = exports.PROJECT_BUILD_TEXT = exports.PROJECT_DEPLOY_STATES = exports.PROJECT_BUILD_STATES = exports.PROJECT_CONFIG_FILE = exports.DEFAULT_POLLING_DELAY = exports.MARKETPLACE_FOLDER = exports.HUBSPOT_FOLDER = exports.FEEDBACK_INTERVAL = exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = void 0;
3
+ exports.PLATFORM_VERSION_ERROR_TYPES = exports.PROJECT_COMPONENT_TYPES = exports.PROJECT_TASK_TYPES = exports.PROJECT_ERROR_TYPES = exports.PROJECT_DEPLOY_TEXT = exports.PROJECT_BUILD_TEXT = exports.PROJECT_DEPLOY_STATES = exports.PROJECT_BUILD_STATES = exports.PROJECT_CONFIG_FILE = exports.DEFAULT_POLLING_DELAY = exports.CONFIG_FLAGS = exports.MARKETPLACE_FOLDER = exports.HUBSPOT_FOLDER = exports.FEEDBACK_INTERVAL = exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = void 0;
4
4
  exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = 'HubSpot/hubspot-project-components';
5
5
  exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = 'main';
6
6
  exports.FEEDBACK_INTERVAL = 10;
7
7
  exports.HUBSPOT_FOLDER = '@hubspot';
8
8
  exports.MARKETPLACE_FOLDER = '@marketplace';
9
+ exports.CONFIG_FLAGS = {
10
+ USE_CUSTOM_OBJECT_HUBFILE: 'useCustomObjectHubfile',
11
+ };
9
12
  exports.DEFAULT_POLLING_DELAY = 2000;
10
13
  exports.PROJECT_CONFIG_FILE = 'hsproject.json';
11
14
  exports.PROJECT_BUILD_STATES = {
@@ -21,6 +21,7 @@ export declare class Diagnosis {
21
21
  addCliSection(section: Section): void;
22
22
  addProjectSection(section: Section): void;
23
23
  addCLIConfigSection(section: Section): void;
24
+ addDefaultAccountOverrideFileSection(section: Section): void;
24
25
  toString(): string;
25
26
  private generateSections;
26
27
  }
@@ -29,6 +29,10 @@ class Diagnosis {
29
29
  header: i18n(`${i18nKey}.cliConfig.header`),
30
30
  sections: [],
31
31
  },
32
+ defaultAccountOverrideFile: {
33
+ header: i18n(`${i18nKey}.defaultAccountOverrideFile.header`),
34
+ sections: [],
35
+ },
32
36
  project: {
33
37
  header: i18n(`${i18nKey}.projectConfig.header`),
34
38
  subheaders: [
@@ -71,6 +75,9 @@ class Diagnosis {
71
75
  addCLIConfigSection(section) {
72
76
  this.diagnosis.cliConfig.sections.push(section);
73
77
  }
78
+ addDefaultAccountOverrideFileSection(section) {
79
+ this.diagnosis.defaultAccountOverrideFile.sections.push(section);
80
+ }
74
81
  toString() {
75
82
  const output = [];
76
83
  for (const value of Object.values(this.diagnosis)) {
@@ -21,9 +21,7 @@ export interface DiagnosticInfo extends FilesInfo {
21
21
  npm: string | null;
22
22
  };
23
23
  config: string | null;
24
- configSettings: {
25
- [key: string]: unknown;
26
- };
24
+ defaultAccountOverrideFile: string | null | undefined;
27
25
  project: {
28
26
  details?: Project;
29
27
  config?: ProjectConfig;
@@ -44,9 +42,6 @@ export interface DiagnosticInfo extends FilesInfo {
44
42
  }
45
43
  export declare class DiagnosticInfoBuilder {
46
44
  accountId: number | null;
47
- readonly configSettings: {
48
- [key: string]: unknown;
49
- };
50
45
  readonly env?: Environment;
51
46
  readonly authType?: AuthType;
52
47
  readonly accountType?: AccountType;
@@ -27,7 +27,6 @@ const configFiles = [
27
27
  ];
28
28
  class DiagnosticInfoBuilder {
29
29
  accountId;
30
- configSettings;
31
30
  env;
32
31
  authType;
33
32
  accountType;
@@ -40,9 +39,6 @@ class DiagnosticInfoBuilder {
40
39
  constructor(processInfo) {
41
40
  this.accountId = (0, config_1.getAccountId)();
42
41
  const accountConfig = (0, config_2.getAccountConfig)(this.accountId);
43
- this.configSettings = {
44
- httpUseLocalhost: (0, config_1.isConfigFlagEnabled)('httpUseLocalhost'),
45
- };
46
42
  this.env = accountConfig?.env;
47
43
  this.authType = accountConfig?.authType;
48
44
  this.accountType = accountConfig?.accountType;
@@ -64,7 +60,7 @@ class DiagnosticInfoBuilder {
64
60
  arch,
65
61
  path: mainModule?.path,
66
62
  config: (0, config_2.getConfigPath)(),
67
- configSettings: this.configSettings,
63
+ defaultAccountOverrideFile: (0, config_1.getDefaultAccountOverrideFilePath)(),
68
64
  versions: {
69
65
  [hubspotCli]: package_json_1.default.version,
70
66
  node,
@@ -10,7 +10,7 @@ export declare class Doctor {
10
10
  private performCliChecks;
11
11
  private performProjectChecks;
12
12
  private performCliConfigChecks;
13
- private performCliConfigSettingsChecks;
13
+ private performDefaultAccountOverrideFileChecks;
14
14
  private checkIfAccessTokenValid;
15
15
  private checkIfNodeIsInstalled;
16
16
  private checkIfNpmIsInstalled;
@@ -51,7 +51,7 @@ class Doctor {
51
51
  ...this.performCliConfigChecks(),
52
52
  ...(this.projectConfig?.projectConfig ? this.performProjectChecks() : []),
53
53
  ]);
54
- this.performCliConfigSettingsChecks();
54
+ this.performDefaultAccountOverrideFileChecks();
55
55
  SpinniesManager_1.default.succeed('runningDiagnostics', {
56
56
  text: i18n(`${i18nKey}.diagnosticsComplete`),
57
57
  succeedColor: 'white',
@@ -88,12 +88,20 @@ class Doctor {
88
88
  }
89
89
  return [this.checkIfAccessTokenValid()];
90
90
  }
91
- performCliConfigSettingsChecks() {
92
- if (this.diagnosticInfo?.configSettings.httpUseLocalhost) {
93
- this.diagnosis?.addCLIConfigSection({
91
+ performDefaultAccountOverrideFileChecks() {
92
+ const localI18nKey = `${i18nKey}.defaultAccountOverrideFileChecks`;
93
+ if (this.diagnosticInfo?.defaultAccountOverrideFile) {
94
+ this.diagnosis?.addDefaultAccountOverrideFileSection({
94
95
  type: 'warning',
95
- message: i18n(`${i18nKey}.diagnosis.cliConfig.settings.httpUseLocalhost`),
96
- secondaryMessaging: i18n(`${i18nKey}.diagnosis.cliConfig.settings.httpUseLocalhostSecondary`),
96
+ message: i18n(`${localI18nKey}.overrideActive`, {
97
+ defaultAccountOverrideFile: this.diagnosticInfo.defaultAccountOverrideFile,
98
+ }),
99
+ });
100
+ this.diagnosis?.addDefaultAccountOverrideFileSection({
101
+ type: 'warning',
102
+ message: i18n(`${localI18nKey}.overrideAccountId`, {
103
+ overrideAccountId: (0, config_1.getCWDAccountOverride)(),
104
+ }),
97
105
  });
98
106
  }
99
107
  }
package/lib/localDev.d.ts CHANGED
@@ -3,13 +3,12 @@ import { Environment } from '@hubspot/local-dev-lib/types/Config';
3
3
  import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
4
4
  import { Project } from '@hubspot/local-dev-lib/types/Project';
5
5
  import { ProjectConfig } from '../types/Projects';
6
- import { ProjectDevTargetAccountPromptResponse } from '../types/Prompts';
7
6
  import { Build } from '@hubspot/local-dev-lib/types/Build';
8
7
  export declare function confirmDefaultAccountIsTarget(accountConfig: CLIAccount): Promise<void>;
9
8
  export declare function checkIfDefaultAccountIsSupported(accountConfig: CLIAccount, hasPublicApps: boolean): void;
10
9
  export declare function checkIfParentAccountIsAuthed(accountConfig: CLIAccount): void;
11
10
  export declare function checkIfAccountFlagIsSupported(accountConfig: CLIAccount, hasPublicApps: boolean): void;
12
- export declare function suggestRecommendedNestedAccount(accounts: CLIAccount[], accountConfig: CLIAccount, hasPublicApps: boolean): Promise<ProjectDevTargetAccountPromptResponse>;
11
+ export declare function suggestRecommendedNestedAccount(accounts: CLIAccount[], accountConfig: CLIAccount, hasPublicApps: boolean): Promise<CLIAccount | DeveloperTestAccount>;
13
12
  export declare function createSandboxForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment): Promise<number>;
14
13
  export declare function createDeveloperTestAccountForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment): Promise<number>;
15
14
  export declare function useExistingDevTestAccount(env: Environment, account: DeveloperTestAccount): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import { GetValidationResultsResponse } from '@hubspot/local-dev-lib/types/MarketplaceValidation';
2
2
  export declare function kickOffValidation(accountId: number, assetType: string, src: string): Promise<number>;
3
- export declare function pollForValidationFinish(accountId: number, validationId: number): Promise<void>;
4
- export declare function fetchValidationResults(accountId: number, validationId: number): Promise<GetValidationResultsResponse>;
3
+ export declare function pollForValidationFinish(accountId: number, validationId: string): Promise<void>;
4
+ export declare function fetchValidationResults(accountId: number, validationId: string): Promise<GetValidationResultsResponse>;
5
5
  export declare function processValidationErrors(i18nKey: string, validationResults: GetValidationResultsResponse): void;
6
6
  export declare function displayValidationResults(i18nKey: string, validationResults: GetValidationResultsResponse): void;
@@ -24,11 +24,8 @@ function useV3Api(platformVersion) {
24
24
  if (!platformVersion || typeof platformVersion !== 'string') {
25
25
  return false;
26
26
  }
27
- if (platformVersion.toLowerCase() === 'unstable') {
28
- return true;
29
- }
30
27
  const [year, minor] = platformVersion.split('.');
31
- return Number(year) >= 2025 && Number(minor) >= 2;
28
+ return Number(year) >= 2025 && Number(minor) >= 1;
32
29
  }
33
30
  function getSubtasks(task) {
34
31
  if ('subbuildStatuses' in task) {
@@ -1,11 +1,13 @@
1
+ import { RepoPath } from '@hubspot/local-dev-lib/types/Github';
1
2
  import { Project } from '@hubspot/local-dev-lib/types/Project';
2
- import { ProjectConfig } from '../../types/Projects';
3
+ import { ProjectTemplate, ProjectConfig, ProjectAddComponentData, ComponentTemplate } from '../../types/Projects';
3
4
  export declare function writeProjectConfig(configPath: string, config: ProjectConfig): boolean;
4
5
  export declare function getIsInProject(dir?: string): boolean;
5
6
  export declare function getProjectConfig(dir?: string): Promise<{
6
7
  projectDir: string | null;
7
8
  projectConfig: ProjectConfig | null;
8
9
  }>;
10
+ export declare function createProjectConfig(projectPath: string, projectName: string, template: ProjectTemplate, templateSource: RepoPath, githubRef: string): Promise<boolean>;
9
11
  export declare function validateProjectConfig(projectConfig: ProjectConfig, projectDir: string): void;
10
12
  export declare function ensureProjectExists(accountId: number, projectName: string, { forceCreate, allowCreate, noLogs, withPolling, uploadCommand, }?: {
11
13
  forceCreate?: boolean | undefined;
@@ -18,3 +20,5 @@ export declare function ensureProjectExists(accountId: number, projectName: stri
18
20
  project?: Project;
19
21
  }>;
20
22
  export declare function logFeedbackMessage(buildId: number): void;
23
+ export declare function createProjectComponent(component: ProjectAddComponentData, name: string, projectComponentsVersion: string): Promise<void>;
24
+ export declare function getProjectComponentsByVersion(projectComponentsVersion: string): Promise<ComponentTemplate[]>;