@hubspot/cli 7.5.1-experimental.0 → 7.5.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.
@@ -20,7 +20,9 @@ async function handler(args) {
20
20
  const response = await (0, personalAccessKey_1.getAccessToken)(personalAccessKey, env, derivedAccountId);
21
21
  scopeGroups = response.scopeGroups.map(s => [s]);
22
22
  logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.name`, { name: name }));
23
- logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.accountId`, { accountId: derivedAccountId }));
23
+ logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.accountId`, {
24
+ accountId: derivedAccountId,
25
+ }));
24
26
  logger_1.logger.log((0, lang_1.i18n)(`commands.account.subcommands.info.scopeGroups`));
25
27
  logger_1.logger.log((0, table_1.getTableContents)(scopeGroups, { border: { bodyLeft: ' ' } }));
26
28
  }
@@ -34,9 +36,18 @@ function accountInfoBuilder(yargs) {
34
36
  type: 'string',
35
37
  });
36
38
  yargs.example([
37
- ['$0 accounts info', (0, lang_1.i18n)(`commands.account.subcommands.info.examples.default`)],
38
- ['$0 accounts info MyAccount', (0, lang_1.i18n)(`commands.account.subcommands.info.examples.nameBased`)],
39
- ['$0 accounts info 1234567', (0, lang_1.i18n)(`commands.account.subcommands.info.examples.idBased`)],
39
+ [
40
+ '$0 accounts info',
41
+ (0, lang_1.i18n)(`commands.account.subcommands.info.examples.default`),
42
+ ],
43
+ [
44
+ '$0 accounts info MyAccount',
45
+ (0, lang_1.i18n)(`commands.account.subcommands.info.examples.nameBased`),
46
+ ],
47
+ [
48
+ '$0 accounts info 1234567',
49
+ (0, lang_1.i18n)(`commands.account.subcommands.info.examples.idBased`),
50
+ ],
40
51
  ]);
41
52
  return yargs;
42
53
  }
@@ -80,7 +80,9 @@ async function handler(args) {
80
80
  (0, lang_1.i18n)('commands.account.subcommands.list.labels.accountId'),
81
81
  (0, lang_1.i18n)('commands.account.subcommands.list.labels.authType'),
82
82
  ]));
83
- logger_1.logger.log((0, lang_1.i18n)('commands.account.subcommands.list.configPath', { configPath: configPath }));
83
+ logger_1.logger.log((0, lang_1.i18n)('commands.account.subcommands.list.configPath', {
84
+ configPath: configPath,
85
+ }));
84
86
  logger_1.logger.log((0, lang_1.i18n)('commands.account.subcommands.list.defaultAccount', {
85
87
  account: (0, config_1.getConfigDefaultAccount)(),
86
88
  }));
@@ -45,8 +45,14 @@ function builder(yargs) {
45
45
  type: 'string',
46
46
  });
47
47
  yargs.example([
48
- ['$0 accounts remove', (0, lang_1.i18n)(`commands.account.subcommands.remove.examples.default`)],
49
- ['$0 accounts remove MyAccount', (0, lang_1.i18n)(`commands.account.subcommands.remove.examples.byName`)],
48
+ [
49
+ '$0 accounts remove',
50
+ (0, lang_1.i18n)(`commands.account.subcommands.remove.examples.default`),
51
+ ],
52
+ [
53
+ '$0 accounts remove MyAccount',
54
+ (0, lang_1.i18n)(`commands.account.subcommands.remove.examples.byName`),
55
+ ],
50
56
  ]);
51
57
  return yargs;
52
58
  }
@@ -34,9 +34,18 @@ function builder(yargs) {
34
34
  type: 'string',
35
35
  });
36
36
  yargs.example([
37
- ['$0 accounts use', (0, lang_1.i18n)('commands.account.subcommands.use.examples.default')],
38
- ['$0 accounts use MyAccount', (0, lang_1.i18n)('commands.account.subcommands.use.examples.nameBased')],
39
- ['$0 accounts use 1234567', (0, lang_1.i18n)('commands.account.subcommands.use.examples.idBased')],
37
+ [
38
+ '$0 accounts use',
39
+ (0, lang_1.i18n)('commands.account.subcommands.use.examples.default'),
40
+ ],
41
+ [
42
+ '$0 accounts use MyAccount',
43
+ (0, lang_1.i18n)('commands.account.subcommands.use.examples.nameBased'),
44
+ ],
45
+ [
46
+ '$0 accounts use 1234567',
47
+ (0, lang_1.i18n)('commands.account.subcommands.use.examples.idBased'),
48
+ ],
40
49
  ]);
41
50
  return yargs;
42
51
  }
@@ -67,7 +67,9 @@ exports.handler = async (options) => {
67
67
  isValidTheme = false;
68
68
  }
69
69
  if (!isValidTheme) {
70
- logger.error(i18n(`commands.cms.subcommands.lighthouseScore.errors.themeNotFound`, { theme: themeToCheck }));
70
+ logger.error(i18n(`commands.cms.subcommands.lighthouseScore.errors.themeNotFound`, {
71
+ theme: themeToCheck,
72
+ }));
71
73
  process.exit(EXIT_CODES.ERROR);
72
74
  }
73
75
  }
@@ -206,7 +208,9 @@ exports.handler = async (options) => {
206
208
  });
207
209
  }
208
210
  logger.log();
209
- logger.info(i18n(`commands.cms.subcommands.lighthouseScore.info.targetDeviceNote`, { target }));
211
+ logger.info(i18n(`commands.cms.subcommands.lighthouseScore.info.targetDeviceNote`, {
212
+ target,
213
+ }));
210
214
  }
211
215
  else {
212
216
  logger.log(`Theme: ${themeToCheck}`);
@@ -73,6 +73,11 @@ exports.builder = yargs => {
73
73
  .conflicts('defaultCmsPublishMode', 'allowUsageTracking')
74
74
  .conflicts('defaultCmsPublishMode', 'httpTimeout')
75
75
  .conflicts('allowUsageTracking', 'httpTimeout')
76
- .example([['$0 config set', i18n(`commands.config.subcommands.set.examples.default`)]]);
76
+ .example([
77
+ [
78
+ '$0 config set',
79
+ i18n(`commands.config.subcommands.set.examples.default`),
80
+ ],
81
+ ]);
77
82
  return yargs;
78
83
  };
@@ -24,7 +24,9 @@ module.exports = {
24
24
  execute: async ({ dest, name, assetType, options }) => {
25
25
  const filePath = path.join(dest, name);
26
26
  if (fs.existsSync(filePath)) {
27
- const overwrite = await confirmPrompt(i18n(`commands.create.subcommands.apiSample.folderOverwritePrompt`, { folderName: filePath }), { defaultAnswer: false });
27
+ const overwrite = await confirmPrompt(i18n(`commands.create.subcommands.apiSample.folderOverwritePrompt`, {
28
+ folderName: filePath,
29
+ }), { defaultAnswer: false });
28
30
  if (overwrite) {
29
31
  fs.rmdirSync(filePath, { recursive: true });
30
32
  }
@@ -50,7 +50,10 @@ function builder(yargs) {
50
50
  (0, commonOpts_1.addUseEnvironmentOptions)(yargs);
51
51
  yargs
52
52
  .example([
53
- ['$0 schema delete schemaName', (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.delete.examples.default`)],
53
+ [
54
+ '$0 schema delete schemaName',
55
+ (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.delete.examples.default`),
56
+ ],
54
57
  ])
55
58
  .positional('name', {
56
59
  describe: (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.delete.positionals.name.describe`),
@@ -17,7 +17,8 @@ async function handler(args) {
17
17
  const { derivedAccountId, dest: providedDest } = args;
18
18
  (0, usageTracking_1.trackCommandUsage)('custom-object-schema-fetch-all', {}, derivedAccountId);
19
19
  try {
20
- const dest = providedDest || (await (0, promptUtils_1.inputPrompt)((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetchAll.inputDest`)));
20
+ const dest = providedDest ||
21
+ (await (0, promptUtils_1.inputPrompt)((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetchAll.inputDest`)));
21
22
  const schemas = await (0, customObjects_1.downloadSchemas)(derivedAccountId, dest);
22
23
  (0, schema_1.logSchemas)(schemas);
23
24
  logger_1.logger.success((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetchAll.success.fetch`, {
@@ -25,7 +25,8 @@ async function handler(args) {
25
25
  (await (0, promptUtils_1.listPrompt)((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetch.selectSchema`), {
26
26
  choices: schemaNames,
27
27
  }));
28
- const dest = providedDest || (await (0, promptUtils_1.inputPrompt)((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetch.inputDest`)));
28
+ const dest = providedDest ||
29
+ (await (0, promptUtils_1.inputPrompt)((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetch.inputDest`)));
29
30
  await (0, customObjects_2.downloadSchema)(derivedAccountId, name, dest);
30
31
  logger_1.logger.success((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetch.success.savedToPath`, {
31
32
  path: (0, customObjects_2.getResolvedPath)(dest, name),
@@ -114,19 +114,23 @@ async function handleMigrationSetup(derivedAccountId, options, projectConfig) {
114
114
  if (!proceed) {
115
115
  return {};
116
116
  }
117
+ const projectName = projectConfig?.projectConfig?.name ||
118
+ name ||
119
+ (await (0, promptUtils_1.inputPrompt)((0, lang_1.i18n)('commands.project.subcommands.migrateApp.prompt.inputName')));
120
+ const { projectExists } = await (0, projects_3.ensureProjectExists)(derivedAccountId, projectName, { allowCreate: false, noLogs: true });
117
121
  // If it's a project we don't want to prompt for dest and name, so just return early
118
122
  if (projectConfig &&
119
123
  projectConfig?.projectConfig &&
120
124
  projectConfig?.projectDir) {
125
+ if (!projectExists) {
126
+ throw new Error('The project you are trying to migrate does not exist');
127
+ }
121
128
  return {
122
129
  appIdToMigrate,
123
130
  projectName: projectConfig.projectConfig.name,
124
131
  projectDest: projectConfig.projectDir,
125
132
  };
126
133
  }
127
- const projectName = name ||
128
- (await (0, promptUtils_1.inputPrompt)((0, lang_1.i18n)('commands.project.subcommands.migrateApp.prompt.inputName')));
129
- const { projectExists } = await (0, projects_3.ensureProjectExists)(derivedAccountId, projectName, { allowCreate: false, noLogs: true });
130
134
  if (projectExists) {
131
135
  throw new Error((0, lang_1.i18n)('commands.project.subcommands.migrateApp.errors.projectAlreadyExists', {
132
136
  projectName,
@@ -22,7 +22,7 @@ declare class SpinniesManager {
22
22
  succeed(name: string, options?: Partial<SpinnerState>): SpinnerState;
23
23
  fail(name: string, options?: Partial<SpinnerState>): SpinnerState;
24
24
  remove(name: string): SpinnerState;
25
- stopAll(newStatus?: typeof VALID_STATUSES[number]): {
25
+ stopAll(newStatus?: (typeof VALID_STATUSES)[number]): {
26
26
  [key: string]: SpinnerState;
27
27
  };
28
28
  private hasAnySpinners;
@@ -6,14 +6,14 @@ export type Spinner = {
6
6
  };
7
7
  export type SpinnerOptions = {
8
8
  text?: string;
9
- status?: typeof VALID_STATUSES[number];
9
+ status?: (typeof VALID_STATUSES)[number];
10
10
  indent?: number;
11
11
  spinner?: Partial<Spinner>;
12
12
  disableSpins?: boolean;
13
- color?: typeof VALID_COLORS[number];
14
- spinnerColor?: typeof VALID_COLORS[number];
15
- succeedColor?: typeof VALID_COLORS[number];
16
- failColor?: typeof VALID_COLORS[number];
13
+ color?: (typeof VALID_COLORS)[number];
14
+ spinnerColor?: (typeof VALID_COLORS)[number];
15
+ succeedColor?: (typeof VALID_COLORS)[number];
16
+ failColor?: (typeof VALID_COLORS)[number];
17
17
  succeedPrefix?: string;
18
18
  failPrefix?: string;
19
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "7.5.1-experimental.0",
3
+ "version": "7.5.2-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",
@@ -62,9 +62,9 @@
62
62
  },
63
63
  "scripts": {
64
64
  "build": "ts-node ./scripts/build.ts",
65
- "lint": "eslint . && prettier --list-different ./**/*.{js,json}",
65
+ "lint": "eslint . && prettier --list-different './**/*.{ts,js,json}'",
66
66
  "list-all-commands": "yarn ts-node ./scripts/get-all-commands.ts",
67
- "prettier:write": "prettier --write ./**/*.{ts,js,json}",
67
+ "prettier:write": "prettier --write './**/*.{ts,js,json}'",
68
68
  "test": "yarn node --experimental-vm-modules $(yarn bin jest)",
69
69
  "test-cli": "yarn build && yarn --cwd 'acceptance-tests' test-ci",
70
70
  "test-cli-debug": "yarn build && yarn --cwd 'acceptance-tests' test-debug",