@hubspot/cli 7.7.34-experimental.0 → 7.7.35-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.
package/commands/app.js CHANGED
@@ -1,16 +1,11 @@
1
1
  import migrateCommand from './app/migrate.js';
2
2
  import appSecretCommand from './app/secret.js';
3
- import installAppCommand from './app/install.js';
4
3
  import { makeYargsBuilder } from '../lib/yargsUtils.js';
5
4
  const command = ['app', 'apps'];
6
5
  // Keep the command hidden for now
7
6
  const describe = undefined;
8
7
  function appBuilder(yargs) {
9
- yargs
10
- .command(migrateCommand)
11
- .command(appSecretCommand)
12
- .command(installAppCommand)
13
- .demandCommand(1, '');
8
+ yargs.command(migrateCommand).command(appSecretCommand).demandCommand(1, '');
14
9
  return yargs;
15
10
  }
16
11
  const builder = makeYargsBuilder(appBuilder, command, describe);
@@ -125,7 +125,7 @@ function projectCreateBuilder(yargs) {
125
125
  hidden: true,
126
126
  type: 'string',
127
127
  choices: [v2023_2, v2025_1, v2025_2],
128
- default: v2023_2,
128
+ default: v2025_2,
129
129
  },
130
130
  'project-base': {
131
131
  describe: commands.project.create.options.projectBase.describe,
@@ -1,5 +1,5 @@
1
- import { CommonArgs, EnvironmentArgs, JSONOutputArgs, YargsCommandModule } from '../../types/Yargs.js';
2
- type ProjectUploadArgs = CommonArgs & JSONOutputArgs & EnvironmentArgs & {
1
+ import { CommonArgs, JSONOutputArgs, YargsCommandModule } from '../../types/Yargs.js';
2
+ type ProjectUploadArgs = CommonArgs & JSONOutputArgs & {
3
3
  forceCreate: boolean;
4
4
  message: string;
5
5
  m: string;
@@ -25,7 +25,7 @@ async function handler(args) {
25
25
  validateProjectConfig(projectConfig, projectDir);
26
26
  let targetAccountId;
27
27
  if (useV3Api(projectConfig.platformVersion)) {
28
- targetAccountId = await loadAndValidateProfile(projectConfig, projectDir, profile, args.useEnv);
28
+ targetAccountId = await loadAndValidateProfile(projectConfig, projectDir, profile);
29
29
  }
30
30
  targetAccountId = targetAccountId || derivedAccountId;
31
31
  const accountConfig = getAccountConfig(targetAccountId);
@@ -75,9 +75,6 @@ async function handler(args) {
75
75
  resultJson.personalAccessKey = createResult.personalAccessKey;
76
76
  }
77
77
  catch (err) {
78
- SpinniesManager.fail('createTestAccount', {
79
- text: commands.testAccount.create.polling.createFailure,
80
- });
81
78
  logError(err);
82
79
  SpinniesManager.fail('createTestAccount', {
83
80
  text: commands.testAccount.create.polling.createFailure,
package/lang/en.d.ts CHANGED
@@ -1553,28 +1553,6 @@ ${string}`;
1553
1553
  readonly app: {
1554
1554
  readonly describe: "Commands for managing apps.";
1555
1555
  readonly subcommands: {
1556
- readonly install: {
1557
- readonly describe: "Install an OAuth app into a test account.";
1558
- readonly options: {
1559
- readonly appUid: "The uid of the app to install";
1560
- readonly projectName: "The name of the project that contains the app";
1561
- };
1562
- readonly positionals: {
1563
- readonly testAccountId: "The id of the test account to install the app into";
1564
- };
1565
- readonly errors: {
1566
- readonly mustSpecifyProjectName: `You must specify a project name. Use the ${string} flag to specify the project name or run this command from within a project directory.`;
1567
- readonly noAppUidFound: `No app uid found. Please specify the app uid with the ${string} flag or run this command from within a project that contains an app.`;
1568
- readonly appMustBeOauth: "This command only supports installing oauth apps. Please specify an app with oauth auth type.";
1569
- };
1570
- readonly polling: {
1571
- readonly start: "Installing app...";
1572
- readonly success: "App installed successfully";
1573
- readonly failure: "App installation failed";
1574
- readonly error: "Error installing app";
1575
- };
1576
- readonly example: "Install the app with uid my-app-uid from the project named \"my-project\" into the target account with id 1234567890";
1577
- };
1578
1556
  readonly secret: {
1579
1557
  readonly describe: "Commands for managing secrets.";
1580
1558
  readonly subcommands: {
package/lang/en.js CHANGED
@@ -1550,28 +1550,6 @@ export const commands = {
1550
1550
  app: {
1551
1551
  describe: 'Commands for managing apps.',
1552
1552
  subcommands: {
1553
- install: {
1554
- describe: 'Install an OAuth app into a test account.',
1555
- options: {
1556
- appUid: 'The uid of the app to install',
1557
- projectName: 'The name of the project that contains the app',
1558
- },
1559
- positionals: {
1560
- testAccountId: 'The id of the test account to install the app into',
1561
- },
1562
- errors: {
1563
- mustSpecifyProjectName: `You must specify a project name. Use the ${uiCommandReference('--project-name')} flag to specify the project name or run this command from within a project directory.`,
1564
- noAppUidFound: `No app uid found. Please specify the app uid with the ${uiCommandReference('--app-uid')} flag or run this command from within a project that contains an app.`,
1565
- appMustBeOauth: 'This command only supports installing oauth apps. Please specify an app with oauth auth type.',
1566
- },
1567
- polling: {
1568
- start: 'Installing app...',
1569
- success: 'App installed successfully',
1570
- failure: 'App installation failed',
1571
- error: 'Error installing app',
1572
- },
1573
- example: 'Install the app with uid my-app-uid from the project named "my-project" into the target account with id 1234567890',
1574
- },
1575
1553
  secret: {
1576
1554
  describe: 'Commands for managing secrets.',
1577
1555
  subcommands: {
@@ -4,4 +4,4 @@ export declare function logProfileHeader(profileName: string): void;
4
4
  export declare function logProfileFooter(profile: HsProfileFile, includeVariables?: boolean): void;
5
5
  export declare function loadProfile(projectConfig: ProjectConfig | null, projectDir: string | null, profileName: string): HsProfileFile | undefined;
6
6
  export declare function exitIfUsingProfiles(projectConfig: ProjectConfig | null, projectDir: string | null): Promise<void>;
7
- export declare function loadAndValidateProfile(projectConfig: ProjectConfig | null, projectDir: string | null, argsProfile: string | undefined, useEnv?: boolean): Promise<number | undefined>;
7
+ export declare function loadAndValidateProfile(projectConfig: ProjectConfig | null, projectDir: string | null, argsProfile: string | undefined): Promise<number | undefined>;
@@ -38,12 +38,7 @@ export function loadProfile(projectConfig, projectDir, profileName) {
38
38
  uiLogger.error(lib.projectProfiles.loadProfile.errors.missingAccountId(profileFilename));
39
39
  return;
40
40
  }
41
- return {
42
- ...profile,
43
- accountId: process.env.HUBSPOT_ACCOUNT_ID
44
- ? Number(process.env.HUBSPOT_ACCOUNT_ID)
45
- : profile.accountId,
46
- };
41
+ return profile;
47
42
  }
48
43
  catch (e) {
49
44
  uiLogger.error(lib.projectProfiles.loadProfile.errors.failedToLoadProfile(profileFilename));
@@ -59,7 +54,7 @@ export async function exitIfUsingProfiles(projectConfig, projectDir) {
59
54
  }
60
55
  }
61
56
  }
62
- export async function loadAndValidateProfile(projectConfig, projectDir, argsProfile, useEnv = false) {
57
+ export async function loadAndValidateProfile(projectConfig, projectDir, argsProfile) {
63
58
  if (argsProfile) {
64
59
  logProfileHeader(argsProfile);
65
60
  const profile = loadProfile(projectConfig, projectDir, argsProfile);
@@ -68,9 +63,6 @@ export async function loadAndValidateProfile(projectConfig, projectDir, argsProf
68
63
  process.exit(EXIT_CODES.ERROR);
69
64
  }
70
65
  logProfileFooter(profile, true);
71
- if (useEnv) {
72
- return Number(process.env.HUBSPOT_ACCOUNT_ID);
73
- }
74
66
  return profile.accountId;
75
67
  }
76
68
  else {
@@ -1,5 +1,5 @@
1
1
  import { ComponentTypes, Component, GenericComponentConfig, PublicAppComponentConfig, PrivateAppComponentConfig, AppCardComponentConfig } from '../../types/Projects.js';
2
- import { IntermediateRepresentationNode, IntermediateRepresentationNodeLocalDev } from '@hubspot/project-parsing-lib/src/lib/types.js';
2
+ import { IntermediateRepresentationNodeLocalDev } from '@hubspot/project-parsing-lib/src/lib/types.js';
3
3
  import { AppIRNode } from '../../types/ProjectComponents.js';
4
4
  export declare const CONFIG_FILES: {
5
5
  [k in ComponentTypes]: string;
@@ -15,4 +15,4 @@ export declare function getProjectComponentTypes(components: Array<Component>):
15
15
  export declare function getComponentUid(component?: Component | null): string | null;
16
16
  export declare function componentIsApp(component?: Component | null): component is Component<PublicAppComponentConfig | PrivateAppComponentConfig>;
17
17
  export declare function componentIsPublicApp(component?: Component | null): component is Component<PublicAppComponentConfig>;
18
- export declare function isAppIRNode(component: IntermediateRepresentationNodeLocalDev | IntermediateRepresentationNode): component is AppIRNode;
18
+ export declare function isAppIRNode(component: IntermediateRepresentationNodeLocalDev): component is AppIRNode;
@@ -1,5 +1,4 @@
1
1
  import { FileResult } from 'tmp';
2
- import { IntermediateRepresentation } from '@hubspot/project-parsing-lib';
3
2
  import { ProjectConfig } from '../../types/Projects.js';
4
3
  type ProjectUploadCallbackFunction<T> = (accountId: number, projectConfig: ProjectConfig, tempFile: FileResult, buildId: number) => Promise<T>;
5
4
  type ProjectUploadResult<T> = {
@@ -21,5 +20,5 @@ type HandleProjectUploadArg<T> = {
21
20
  export declare function handleProjectUpload<T>({ accountId, projectConfig, projectDir, callbackFunc, profile, uploadMessage, forceCreate, isUploadCommand, sendIR, skipValidation, }: HandleProjectUploadArg<T>): Promise<ProjectUploadResult<T>>;
22
21
  export declare function validateSourceDirectory(srcDir: string, projectConfig: ProjectConfig): void;
23
22
  export declare function validateNoHSMetaMismatch(srcDir: string, projectConfig: ProjectConfig): Promise<void>;
24
- export declare function handleTranslate(projectDir: string, projectConfig: ProjectConfig, accountId: number, skipValidation: boolean, profile: string | undefined): Promise<IntermediateRepresentation | undefined>;
23
+ export declare function handleTranslate(projectDir: string, projectConfig: ProjectConfig, accountId: number, skipValidation: boolean, profile: string | undefined): Promise<unknown>;
25
24
  export {};
@@ -133,5 +133,4 @@ export async function handleTranslate(projectDir, projectConfig, accountId, skip
133
133
  }
134
134
  throw e;
135
135
  }
136
- return undefined;
137
136
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "7.7.34-experimental.0",
3
+ "version": "7.7.35-experimental.0",
4
4
  "description": "The official CLI for developing on HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/HubSpot/hubspot-cli",
package/types/Yargs.d.ts CHANGED
@@ -15,7 +15,7 @@ export type AccountArgs = {
15
15
  account?: string;
16
16
  };
17
17
  export type EnvironmentArgs = {
18
- 'use-env'?: boolean;
18
+ 'use-env'?: string;
19
19
  };
20
20
  export type OverwriteArgs = Options & {
21
21
  o?: boolean;
@@ -1 +0,0 @@
1
- export {};
@@ -1,47 +0,0 @@
1
- import yargs from 'yargs';
2
- import { addAccountOptions, addConfigOptions, addUseEnvironmentOptions, addGlobalOptions, addJSONOutputOptions, } from '../../../lib/commonOpts.js';
3
- import installCommand from '../install.js';
4
- vi.mock('../../../lib/commonOpts');
5
- describe('commands/app/install', () => {
6
- const yargsMock = yargs;
7
- describe('command', () => {
8
- it('should have the correct command structure', () => {
9
- expect(installCommand.command).toEqual('install <test-account-id>');
10
- });
11
- });
12
- describe('describe', () => {
13
- it('should provide a description', () => {
14
- expect(installCommand.describe).not.toBeDefined();
15
- });
16
- });
17
- describe('builder', () => {
18
- it('should support the correct options', () => {
19
- installCommand.builder(yargsMock);
20
- expect(addGlobalOptions).toHaveBeenCalledTimes(1);
21
- expect(addGlobalOptions).toHaveBeenCalledWith(yargsMock);
22
- expect(addAccountOptions).toHaveBeenCalledTimes(1);
23
- expect(addAccountOptions).toHaveBeenCalledWith(yargsMock);
24
- expect(addConfigOptions).toHaveBeenCalledTimes(1);
25
- expect(addConfigOptions).toHaveBeenCalledWith(yargsMock);
26
- expect(addUseEnvironmentOptions).toHaveBeenCalledTimes(1);
27
- expect(addUseEnvironmentOptions).toHaveBeenCalledWith(yargsMock);
28
- expect(addJSONOutputOptions).toHaveBeenCalledTimes(1);
29
- expect(addJSONOutputOptions).toHaveBeenCalledWith(yargsMock);
30
- expect(yargsMock.positional).toHaveBeenCalledTimes(1);
31
- expect(yargsMock.positional).toHaveBeenCalledWith('test-account-id', expect.objectContaining({
32
- type: 'number',
33
- required: true,
34
- describe: expect.any(String),
35
- }));
36
- expect(yargsMock.option).toHaveBeenCalledTimes(2);
37
- expect(yargsMock.option).toHaveBeenCalledWith('app-uid', expect.objectContaining({
38
- type: 'string',
39
- describe: expect.any(String),
40
- }));
41
- expect(yargsMock.option).toHaveBeenCalledWith('project-name', expect.objectContaining({
42
- type: 'string',
43
- describe: expect.any(String),
44
- }));
45
- });
46
- });
47
- });
@@ -1,8 +0,0 @@
1
- import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule, JSONOutputArgs } from '../../types/Yargs.js';
2
- type InstallAppArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & JSONOutputArgs & {
3
- appUid?: string;
4
- projectName?: string;
5
- testAccountId: number;
6
- };
7
- declare const installAppCommand: YargsCommandModule<unknown, InstallAppArgs>;
8
- export default installAppCommand;
@@ -1,122 +0,0 @@
1
- import { fetchDeveloperTestAccountOauthAppInstallStatus, installOauthAppIntoDeveloperTestAccount, } from '@hubspot/local-dev-lib/api/developerTestAccounts';
2
- import { trackCommandUsage } from '../../lib/usageTracking.js';
3
- import { commands } from '../../lang/en.js';
4
- import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
5
- import { makeYargsBuilder } from '../../lib/yargsUtils.js';
6
- import { APP_AUTH_TYPES } from '../../lib/constants.js';
7
- import { uiLogger } from '../../lib/ui/logger.js';
8
- import SpinniesManager from '../../lib/ui/SpinniesManager.js';
9
- import { poll } from '../../lib/polling.js';
10
- import { getProjectConfig, validateProjectConfig, } from '../../lib/projects/config.js';
11
- import { handleTranslate } from '../../lib/projects/upload.js';
12
- import { isAppIRNode } from '../../lib/projects/structure.js';
13
- import { logError } from '../../lib/errorHandlers/index.js';
14
- const command = 'install <test-account-id>';
15
- const describe = undefined; // commands.app.subcommands.install.describe;
16
- async function handler(args) {
17
- const { derivedAccountId, appUid, projectName, testAccountId, formatOutputAsJson, } = args;
18
- trackCommandUsage('app-install', {}, derivedAccountId);
19
- const jsonOutput = {};
20
- let targetProjectName = projectName;
21
- let targetAppUid = appUid;
22
- const { projectConfig, projectDir } = await getProjectConfig();
23
- if (!targetProjectName) {
24
- validateProjectConfig(projectConfig, projectDir);
25
- targetProjectName = projectConfig?.name;
26
- }
27
- if (!targetProjectName) {
28
- uiLogger.error(commands.app.subcommands.install.errors.mustSpecifyProjectName);
29
- process.exit(EXIT_CODES.ERROR);
30
- }
31
- let isAppOauth = true;
32
- if (!targetAppUid) {
33
- const intermediateRepresentation = await handleTranslate(projectDir, projectConfig, derivedAccountId, true, undefined);
34
- if (intermediateRepresentation) {
35
- Object.values(intermediateRepresentation.intermediateNodesIndexedByUid).forEach(node => {
36
- if (isAppIRNode(node)) {
37
- targetAppUid = node.uid;
38
- isAppOauth = node.config.auth.type === APP_AUTH_TYPES.OAUTH;
39
- }
40
- });
41
- }
42
- }
43
- if (!targetAppUid) {
44
- uiLogger.error(commands.app.subcommands.install.errors.noAppUidFound);
45
- process.exit(EXIT_CODES.ERROR);
46
- }
47
- if (!isAppOauth) {
48
- uiLogger.error(commands.app.subcommands.install.errors.appMustBeOauth);
49
- process.exit(EXIT_CODES.ERROR);
50
- }
51
- try {
52
- const { data } = await installOauthAppIntoDeveloperTestAccount(derivedAccountId, testAccountId, targetProjectName, targetAppUid);
53
- if (data?.authCodes.length > 0) {
54
- jsonOutput.authCode = data.authCodes[0].authCode;
55
- }
56
- }
57
- catch (err) {
58
- logError(err);
59
- process.exit(EXIT_CODES.ERROR);
60
- }
61
- SpinniesManager.init({
62
- succeedColor: 'white',
63
- });
64
- SpinniesManager.add('installApp', {
65
- text: commands.app.subcommands.install.polling.start,
66
- });
67
- let appInstallSucceeded = false;
68
- try {
69
- await poll(() => fetchDeveloperTestAccountOauthAppInstallStatus(derivedAccountId, targetProjectName, targetAppUid), {
70
- successStates: ['SUCCESS'],
71
- errorStates: [],
72
- });
73
- appInstallSucceeded = true;
74
- }
75
- catch (err) {
76
- SpinniesManager.fail('installApp');
77
- logError(err);
78
- process.exit(EXIT_CODES.ERROR);
79
- }
80
- if (!appInstallSucceeded) {
81
- SpinniesManager.fail('installApp');
82
- process.exit(EXIT_CODES.ERROR);
83
- }
84
- SpinniesManager.succeed('installApp', {
85
- text: commands.app.subcommands.install.polling.success,
86
- });
87
- if (formatOutputAsJson) {
88
- uiLogger.json(jsonOutput);
89
- }
90
- process.exit(EXIT_CODES.SUCCESS);
91
- }
92
- function installAppBuilder(yargs) {
93
- yargs.positional('test-account-id', {
94
- describe: commands.app.subcommands.install.positionals.testAccountId,
95
- required: true,
96
- type: 'number',
97
- });
98
- yargs.option('app-uid', {
99
- describe: commands.app.subcommands.install.options.appUid,
100
- type: 'string',
101
- });
102
- yargs.option('project-name', {
103
- describe: commands.app.subcommands.install.options.projectName,
104
- type: 'string',
105
- });
106
- yargs.example('install 1234567890 --app-uid=my-app-uid --project-name=my-project', commands.app.subcommands.install.example);
107
- return yargs;
108
- }
109
- const builder = makeYargsBuilder(installAppBuilder, command, commands.app.subcommands.install.describe, {
110
- useGlobalOptions: true,
111
- useAccountOptions: true,
112
- useConfigOptions: true,
113
- useEnvironmentOptions: true,
114
- useJSONOutputOptions: true,
115
- });
116
- const installAppCommand = {
117
- command,
118
- describe,
119
- handler,
120
- builder,
121
- };
122
- export default installAppCommand;