@hubspot/cli 7.4.9-beta.1 → 7.4.10-beta.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/bin/cli.js +3 -6
- package/commands/app/migrate.d.ts +1 -2
- package/commands/app/migrate.js +7 -8
- package/commands/app.d.ts +2 -5
- package/commands/app.js +9 -7
- package/commands/auth.d.ts +3 -7
- package/commands/auth.js +12 -5
- package/commands/config/migrate.d.ts +3 -7
- package/commands/config/migrate.js +11 -5
- package/commands/config/set.d.ts +5 -6
- package/commands/config/set.js +38 -14
- package/commands/config.d.ts +3 -4
- package/commands/config.js +20 -44
- package/commands/create.js +1 -0
- package/commands/doctor.d.ts +6 -8
- package/commands/doctor.js +32 -21
- package/commands/init.d.ts +3 -7
- package/commands/init.js +12 -5
- package/commands/list.d.ts +3 -7
- package/commands/list.js +19 -11
- package/commands/mv.d.ts +3 -7
- package/commands/mv.js +19 -11
- package/commands/open.d.ts +3 -7
- package/commands/open.js +19 -11
- package/commands/project/dev/index.js +4 -1
- package/commands/remove.d.ts +3 -7
- package/commands/remove.js +19 -11
- package/lang/en.d.ts +49 -19
- package/lang/en.js +48 -19
- package/lang/en.lyaml +1 -6
- package/lib/app/urls.d.ts +16 -0
- package/lib/app/urls.js +16 -0
- package/lib/configOptions.d.ts +4 -0
- package/lib/configOptions.js +41 -46
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +13 -39
- package/lib/doctor/Doctor.js +2 -1
- package/lib/middleware/autoUpdateMiddleware.d.ts +1 -0
- package/lib/middleware/autoUpdateMiddleware.js +89 -0
- package/lib/npm.d.ts +9 -0
- package/lib/npm.js +36 -0
- package/lib/projects/localDev/AppDevModeInterface.d.ts +1 -0
- package/lib/projects/localDev/AppDevModeInterface.js +42 -3
- package/lib/projects/localDev/LocalDevManager.js +10 -2
- package/lib/prompts/installAppPrompt.d.ts +1 -0
- package/lib/prompts/installAppPrompt.js +35 -0
- package/lib/prompts/projectDevTargetAccountPrompt.js +9 -2
- package/lib/prompts/promptUtils.d.ts +2 -1
- package/lib/prompts/promptUtils.js +2 -1
- package/lib/ui/index.js +4 -1
- package/package.json +3 -2
- package/lib/prompts/installPublicAppPrompt.d.ts +0 -1
- package/lib/prompts/installPublicAppPrompt.js +0 -41
package/bin/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ const { setLogLevel, getCommandName } = require('../lib/commonOpts');
|
|
|
7
7
|
const { trackHelpUsage, trackConvertFieldsUsage, } = require('../lib/usageTracking');
|
|
8
8
|
const { EXIT_CODES } = require('../lib/enums/exitCodes');
|
|
9
9
|
const { loadConfigMiddleware, injectAccountIdMiddleware, validateAccountOptions, handleDeprecatedEnvVariables, } = require('../lib/middleware/configMiddleware');
|
|
10
|
-
const {
|
|
10
|
+
const { autoUpdateCLI } = require('../lib/middleware/autoUpdateMiddleware');
|
|
11
11
|
const { checkAndWarnGitInclusionMiddleware, } = require('../lib/middleware/gitMiddleware');
|
|
12
12
|
const { performChecks } = require('../lib/middleware/yargsChecksMiddleware');
|
|
13
13
|
const { setRequestHeaders } = require('../lib/middleware/requestMiddleware');
|
|
@@ -40,7 +40,6 @@ const feedbackCommand = require('../commands/feedback');
|
|
|
40
40
|
const doctorCommand = require('../commands/doctor');
|
|
41
41
|
const completionCommand = require('../commands/completion');
|
|
42
42
|
const appCommand = require('../commands/app');
|
|
43
|
-
notifyAboutUpdates();
|
|
44
43
|
const getTerminalWidth = () => {
|
|
45
44
|
const width = yargs.terminalWidth();
|
|
46
45
|
if (width >= 100)
|
|
@@ -71,6 +70,7 @@ const argv = yargs
|
|
|
71
70
|
handleDeprecatedEnvVariables,
|
|
72
71
|
loadConfigMiddleware,
|
|
73
72
|
injectAccountIdMiddleware,
|
|
73
|
+
autoUpdateCLI,
|
|
74
74
|
checkAndWarnGitInclusionMiddleware,
|
|
75
75
|
validateAccountOptions,
|
|
76
76
|
checkFireAlarms,
|
|
@@ -105,10 +105,7 @@ const argv = yargs
|
|
|
105
105
|
.command(secretCommands)
|
|
106
106
|
.command(customObjectCommand)
|
|
107
107
|
.command(functionCommands)
|
|
108
|
-
.command(
|
|
109
|
-
...listCommand,
|
|
110
|
-
aliases: 'ls',
|
|
111
|
-
})
|
|
108
|
+
.command(listCommand)
|
|
112
109
|
.command(openCommand)
|
|
113
110
|
.command(mvCommand)
|
|
114
111
|
.command(projectCommands)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ArgumentsCamelCase } from 'yargs';
|
|
2
2
|
import { YargsCommandModule } from '../../types/Yargs';
|
|
3
3
|
import { MigrateAppArgs } from '../../lib/app/migrate';
|
|
4
|
-
export declare function handlerGenerator(commandTrackingName: string): (
|
|
5
|
-
export declare const handler: (options: ArgumentsCamelCase<MigrateAppArgs>) => Promise<void>;
|
|
4
|
+
export declare function handlerGenerator(commandTrackingName: string): (args: ArgumentsCamelCase<MigrateAppArgs>) => Promise<void>;
|
|
6
5
|
declare const migrateCommand: YargsCommandModule<unknown, MigrateAppArgs>;
|
|
7
6
|
export default migrateCommand;
|
package/commands/app/migrate.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handler = void 0;
|
|
4
3
|
exports.handlerGenerator = handlerGenerator;
|
|
5
4
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
6
5
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
@@ -18,8 +17,8 @@ const { v2023_2, v2025_2 } = projects_1.PLATFORM_VERSIONS;
|
|
|
18
17
|
const command = 'migrate';
|
|
19
18
|
const describe = undefined; // uiBetaTag(i18n(`commands.project.subcommands.migrateApp.header.text.describe`), false);
|
|
20
19
|
function handlerGenerator(commandTrackingName) {
|
|
21
|
-
return async function handler(
|
|
22
|
-
const { derivedAccountId, platformVersion, unstable } =
|
|
20
|
+
return async function handler(args) {
|
|
21
|
+
const { derivedAccountId, platformVersion, unstable } = args;
|
|
23
22
|
await (0, usageTracking_1.trackCommandUsage)(commandTrackingName, {}, derivedAccountId);
|
|
24
23
|
const accountConfig = (0, config_1.getAccountConfig)(derivedAccountId);
|
|
25
24
|
if (!accountConfig) {
|
|
@@ -36,13 +35,13 @@ function handlerGenerator(commandTrackingName) {
|
|
|
36
35
|
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.errors.notAllowedWithinProject`, { command: (0, ui_1.uiCommandReference)('hs project migrate') }));
|
|
37
36
|
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
38
37
|
}
|
|
39
|
-
|
|
38
|
+
args.platformVersion = unstable
|
|
40
39
|
? projects_1.PLATFORM_VERSIONS.unstable
|
|
41
40
|
: platformVersion;
|
|
42
|
-
await (0, migrate_1.migrateApp2025_2)(derivedAccountId,
|
|
41
|
+
await (0, migrate_1.migrateApp2025_2)(derivedAccountId, args);
|
|
43
42
|
}
|
|
44
43
|
else {
|
|
45
|
-
await (0, migrate_legacy_1.migrateApp2023_2)(derivedAccountId,
|
|
44
|
+
await (0, migrate_legacy_1.migrateApp2023_2)(derivedAccountId, args, accountConfig);
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
catch (error) {
|
|
@@ -62,7 +61,7 @@ function handlerGenerator(commandTrackingName) {
|
|
|
62
61
|
return process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
63
62
|
};
|
|
64
63
|
}
|
|
65
|
-
|
|
64
|
+
const handler = handlerGenerator('app-migrate');
|
|
66
65
|
function appMigrateBuilder(yargs) {
|
|
67
66
|
yargs.options({
|
|
68
67
|
name: {
|
|
@@ -106,7 +105,7 @@ const builder = (0, yargsUtils_1.makeYargsBuilder)(appMigrateBuilder, command, (
|
|
|
106
105
|
const migrateCommand = {
|
|
107
106
|
command,
|
|
108
107
|
describe,
|
|
109
|
-
handler
|
|
108
|
+
handler,
|
|
110
109
|
builder,
|
|
111
110
|
};
|
|
112
111
|
exports.default = migrateCommand;
|
package/commands/app.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const describe: undefined;
|
|
4
|
-
export declare function builder(yargs: Argv): Argv<{}>;
|
|
5
|
-
declare const appCommand: CommandModule;
|
|
1
|
+
import { YargsCommandModuleBucket } from '../types/Yargs';
|
|
2
|
+
declare const appCommand: YargsCommandModuleBucket;
|
|
6
3
|
export default appCommand;
|
package/commands/app.js
CHANGED
|
@@ -3,19 +3,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
exports.builder = builder;
|
|
6
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
8
7
|
const migrate_1 = __importDefault(require("./app/migrate"));
|
|
9
|
-
|
|
8
|
+
const command = ['app', 'apps'];
|
|
10
9
|
// Keep the command hidden for now
|
|
11
|
-
|
|
12
|
-
function
|
|
10
|
+
const describe = undefined;
|
|
11
|
+
function appBuilder(yargs) {
|
|
13
12
|
return yargs.command(migrate_1.default).demandCommand(1, '');
|
|
14
13
|
}
|
|
14
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(appBuilder, command, describe);
|
|
15
15
|
const appCommand = {
|
|
16
|
-
command
|
|
17
|
-
describe
|
|
16
|
+
command,
|
|
17
|
+
describe,
|
|
18
18
|
builder,
|
|
19
19
|
handler: () => { },
|
|
20
20
|
};
|
|
21
21
|
exports.default = appCommand;
|
|
22
|
+
// TODO Remove this legacy export once we've migrated all commands to TS
|
|
23
|
+
module.exports = appCommand;
|
package/commands/auth.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AccountArgs, CommonArgs, ConfigArgs, TestingArgs } from '../types/Yargs';
|
|
3
|
-
export declare const command = "auth";
|
|
4
|
-
export declare const describe: string;
|
|
1
|
+
import { AccountArgs, CommonArgs, ConfigArgs, TestingArgs, YargsCommandModule } from '../types/Yargs';
|
|
5
2
|
type AuthArgs = CommonArgs & ConfigArgs & TestingArgs & AccountArgs & {
|
|
6
3
|
authType?: string;
|
|
7
4
|
};
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export {};
|
|
5
|
+
declare const authCommand: YargsCommandModule<unknown, AuthArgs>;
|
|
6
|
+
export default authCommand;
|
package/commands/auth.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.builder = exports.describe = exports.command = void 0;
|
|
4
|
-
exports.handler = handler;
|
|
5
3
|
const git_1 = require("../lib/ui/git");
|
|
6
4
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
5
|
const auth_1 = require("@hubspot/local-dev-lib/constants/auth");
|
|
@@ -32,8 +30,8 @@ const ALLOWED_AUTH_METHODS = [
|
|
|
32
30
|
auth_1.PERSONAL_ACCESS_KEY_AUTH_METHOD.value,
|
|
33
31
|
];
|
|
34
32
|
const SUPPORTED_AUTHENTICATION_PROTOCOLS_TEXT = (0, text_1.commaSeparatedValues)(ALLOWED_AUTH_METHODS);
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
const command = 'auth';
|
|
34
|
+
const describe = (0, lang_1.i18n)('commands.auth.describe');
|
|
37
35
|
async function handler(args) {
|
|
38
36
|
const { authType: authTypeFlagValue, config: configFlagValue, qa, providedAccountId, } = args;
|
|
39
37
|
const authType = (authTypeFlagValue && authTypeFlagValue.toLowerCase()) ||
|
|
@@ -159,7 +157,7 @@ function authBuilder(yargs) {
|
|
|
159
157
|
});
|
|
160
158
|
return yargs;
|
|
161
159
|
}
|
|
162
|
-
|
|
160
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(authBuilder, command, (0, lang_1.i18n)('commands.auth.verboseDescribe', {
|
|
163
161
|
authMethod: auth_1.PERSONAL_ACCESS_KEY_AUTH_METHOD.value,
|
|
164
162
|
configName: config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
|
|
165
163
|
}), {
|
|
@@ -167,3 +165,12 @@ exports.builder = (0, yargsUtils_1.makeYargsBuilder)(authBuilder, exports.comman
|
|
|
167
165
|
useConfigOptions: true,
|
|
168
166
|
useTestingOptions: true,
|
|
169
167
|
});
|
|
168
|
+
const authCommand = {
|
|
169
|
+
command,
|
|
170
|
+
describe,
|
|
171
|
+
handler,
|
|
172
|
+
builder,
|
|
173
|
+
};
|
|
174
|
+
exports.default = authCommand;
|
|
175
|
+
// TODO Remove this legacy export once we've migrated all commands to TS
|
|
176
|
+
module.exports = authCommand;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CommonArgs, ConfigArgs } from '../../types/Yargs';
|
|
3
|
-
export declare const describe: string;
|
|
4
|
-
export declare const command = "migrate";
|
|
1
|
+
import { CommonArgs, ConfigArgs, YargsCommandModule } from '../../types/Yargs';
|
|
5
2
|
type ConfigMigrateArgs = CommonArgs & ConfigArgs & {
|
|
6
3
|
force?: boolean;
|
|
7
4
|
};
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export {};
|
|
5
|
+
declare const configMigrateCommand: YargsCommandModule<unknown, ConfigMigrateArgs>;
|
|
6
|
+
export default configMigrateCommand;
|
|
@@ -3,8 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.builder = exports.command = exports.describe = void 0;
|
|
7
|
-
exports.handler = handler;
|
|
8
6
|
const fs_1 = __importDefault(require("fs"));
|
|
9
7
|
const config_1 = require("@hubspot/local-dev-lib/constants/config");
|
|
10
8
|
const migrate_1 = require("@hubspot/local-dev-lib/config/migrate");
|
|
@@ -15,11 +13,11 @@ const usageTracking_1 = require("../../lib/usageTracking");
|
|
|
15
13
|
const index_1 = require("../../lib/errorHandlers/index");
|
|
16
14
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
17
15
|
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
18
|
-
|
|
16
|
+
const describe = (0, lang_1.i18n)('commands.config.subcommands.migrate.describe', {
|
|
19
17
|
deprecatedConfigPath: config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
|
|
20
18
|
globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
|
|
21
19
|
});
|
|
22
|
-
|
|
20
|
+
const command = 'migrate';
|
|
23
21
|
async function handler(args) {
|
|
24
22
|
const { config: configPath, force, derivedAccountId } = args;
|
|
25
23
|
if (configPath && !fs_1.default.existsSync(configPath)) {
|
|
@@ -81,8 +79,16 @@ function configMigrateBuilder(yargs) {
|
|
|
81
79
|
],
|
|
82
80
|
]);
|
|
83
81
|
}
|
|
84
|
-
|
|
82
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(configMigrateBuilder, command, (0, lang_1.i18n)('commands.config.subcommands.migrate.verboseDescribe', {
|
|
85
83
|
archivedConfigPath: config_1.ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME,
|
|
86
84
|
}), {
|
|
85
|
+
useGlobalOptions: true,
|
|
87
86
|
useConfigOptions: true,
|
|
88
87
|
});
|
|
88
|
+
const configMigrateCommand = {
|
|
89
|
+
command,
|
|
90
|
+
describe,
|
|
91
|
+
handler,
|
|
92
|
+
builder,
|
|
93
|
+
};
|
|
94
|
+
exports.default = configMigrateCommand;
|
package/commands/config/set.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { ArgumentsCamelCase, Argv } from 'yargs';
|
|
2
|
-
import { CommonArgs } from '../../types/Yargs';
|
|
3
1
|
import { CmsPublishMode } from '@hubspot/local-dev-lib/types/Files';
|
|
4
|
-
|
|
2
|
+
import { CommonArgs, ConfigArgs, YargsCommandModule } from '../../types/Yargs';
|
|
3
|
+
type ConfigSetArgs = CommonArgs & ConfigArgs & {
|
|
5
4
|
defaultCmsPublishMode: CmsPublishMode;
|
|
6
5
|
allowUsageTracking?: boolean;
|
|
7
6
|
httpTimeout?: string;
|
|
7
|
+
allowAutoUpdates?: boolean;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export {};
|
|
9
|
+
declare const configSetCommand: YargsCommandModule<unknown, ConfigSetArgs>;
|
|
10
|
+
export default configSetCommand;
|
package/commands/config/set.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handler = handler;
|
|
4
|
-
exports.builder = builder;
|
|
5
3
|
const lang_1 = require("../../lib/lang");
|
|
6
4
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
7
5
|
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
8
6
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
9
7
|
const configOptions_1 = require("../../lib/configOptions");
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const en_1 = require("../../lang/en");
|
|
9
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
10
|
+
const command = 'set';
|
|
11
|
+
const describe = en_1.commands.config.subcommands.set.describe;
|
|
12
12
|
async function selectOptions() {
|
|
13
|
-
const {
|
|
13
|
+
const { configOption } = await (0, promptUtils_1.promptUser)([
|
|
14
14
|
{
|
|
15
15
|
type: 'list',
|
|
16
|
-
name: '
|
|
16
|
+
name: 'configOption',
|
|
17
17
|
pageSize: 20,
|
|
18
|
-
message:
|
|
18
|
+
message: en_1.commands.config.subcommands.set.promptMessage,
|
|
19
19
|
choices: [
|
|
20
20
|
{
|
|
21
21
|
name: 'Default CMS publish mode',
|
|
@@ -23,13 +23,14 @@ async function selectOptions() {
|
|
|
23
23
|
},
|
|
24
24
|
{ name: 'Allow usage tracking', value: { allowUsageTracking: '' } },
|
|
25
25
|
{ name: 'HTTP timeout', value: { httpTimeout: '' } },
|
|
26
|
+
// TODO enable when we unhide this option { name: 'Allow auto updates', value: { allowAutoUpdates: '' } },
|
|
26
27
|
],
|
|
27
28
|
},
|
|
28
29
|
]);
|
|
29
|
-
return
|
|
30
|
+
return configOption;
|
|
30
31
|
}
|
|
31
|
-
async function handleConfigUpdate(accountId,
|
|
32
|
-
const { allowUsageTracking, defaultCmsPublishMode, httpTimeout } =
|
|
32
|
+
async function handleConfigUpdate(accountId, args) {
|
|
33
|
+
const { allowAutoUpdates, allowUsageTracking, defaultCmsPublishMode, httpTimeout, } = args;
|
|
33
34
|
if (typeof defaultCmsPublishMode !== 'undefined') {
|
|
34
35
|
await (0, configOptions_1.setDefaultCmsPublishMode)({ defaultCmsPublishMode, accountId });
|
|
35
36
|
return true;
|
|
@@ -42,6 +43,10 @@ async function handleConfigUpdate(accountId, options) {
|
|
|
42
43
|
await (0, configOptions_1.setAllowUsageTracking)({ allowUsageTracking, accountId });
|
|
43
44
|
return true;
|
|
44
45
|
}
|
|
46
|
+
else if (typeof allowAutoUpdates !== 'undefined') {
|
|
47
|
+
await (0, configOptions_1.setAllowAutoUpdates)({ allowAutoUpdates, accountId });
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
45
50
|
return false;
|
|
46
51
|
}
|
|
47
52
|
async function handler(args) {
|
|
@@ -54,25 +59,33 @@ async function handler(args) {
|
|
|
54
59
|
}
|
|
55
60
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
56
61
|
}
|
|
57
|
-
function
|
|
62
|
+
function configSetBuilder(yargs) {
|
|
58
63
|
yargs
|
|
59
64
|
.options({
|
|
60
65
|
'default-cms-publish-mode': {
|
|
61
|
-
describe:
|
|
66
|
+
describe: en_1.commands.config.subcommands.set.options.defaultMode.describe,
|
|
62
67
|
type: 'string',
|
|
63
68
|
},
|
|
64
69
|
'allow-usage-tracking': {
|
|
65
|
-
describe:
|
|
70
|
+
describe: en_1.commands.config.subcommands.set.options.allowUsageTracking.describe,
|
|
66
71
|
type: 'boolean',
|
|
67
72
|
},
|
|
68
73
|
'http-timeout': {
|
|
69
|
-
describe:
|
|
74
|
+
describe: en_1.commands.config.subcommands.set.options.httpTimeout.describe,
|
|
70
75
|
type: 'string',
|
|
71
76
|
},
|
|
77
|
+
'allow-auto-updates': {
|
|
78
|
+
describe: en_1.commands.config.subcommands.set.options.allowAutoUpdates.describe,
|
|
79
|
+
type: 'boolean',
|
|
80
|
+
hidden: true,
|
|
81
|
+
},
|
|
72
82
|
})
|
|
73
83
|
.conflicts('defaultCmsPublishMode', 'allowUsageTracking')
|
|
74
84
|
.conflicts('defaultCmsPublishMode', 'httpTimeout')
|
|
75
85
|
.conflicts('allowUsageTracking', 'httpTimeout')
|
|
86
|
+
.conflicts('allowAutoUpdates', 'defaultCmsPublishMode')
|
|
87
|
+
.conflicts('allowAutoUpdates', 'allowUsageTracking')
|
|
88
|
+
.conflicts('allowAutoUpdates', 'httpTimeout')
|
|
76
89
|
.example([
|
|
77
90
|
[
|
|
78
91
|
'$0 config set',
|
|
@@ -81,3 +94,14 @@ function builder(yargs) {
|
|
|
81
94
|
]);
|
|
82
95
|
return yargs;
|
|
83
96
|
}
|
|
97
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(configSetBuilder, command, describe, {
|
|
98
|
+
useGlobalOptions: true,
|
|
99
|
+
useConfigOptions: true,
|
|
100
|
+
});
|
|
101
|
+
const configSetCommand = {
|
|
102
|
+
command,
|
|
103
|
+
describe,
|
|
104
|
+
handler,
|
|
105
|
+
builder,
|
|
106
|
+
};
|
|
107
|
+
exports.default = configSetCommand;
|
package/commands/config.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export declare function builder(yargs: Argv): Argv;
|
|
1
|
+
import { YargsCommandModuleBucket } from '../types/Yargs';
|
|
2
|
+
declare const configCommand: YargsCommandModuleBucket;
|
|
3
|
+
export default configCommand;
|
package/commands/config.js
CHANGED
|
@@ -1,49 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
35
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.describe = exports.command = void 0;
|
|
37
|
-
exports.builder = builder;
|
|
38
|
-
const commonOpts_1 = require("../lib/commonOpts");
|
|
39
6
|
const lang_1 = require("../lib/lang");
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
(
|
|
47
|
-
yargs.command(set).command(migrate).demandCommand(1, '');
|
|
7
|
+
const set_1 = __importDefault(require("./config/set"));
|
|
8
|
+
const migrate_1 = __importDefault(require("./config/migrate"));
|
|
9
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
10
|
+
const command = 'config';
|
|
11
|
+
const describe = (0, lang_1.i18n)('commands.config.describe');
|
|
12
|
+
function configBuilder(yargs) {
|
|
13
|
+
yargs.command(set_1.default).command(migrate_1.default).demandCommand(1, '');
|
|
48
14
|
return yargs;
|
|
49
15
|
}
|
|
16
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(configBuilder, command, describe);
|
|
17
|
+
const configCommand = {
|
|
18
|
+
command,
|
|
19
|
+
describe,
|
|
20
|
+
builder,
|
|
21
|
+
handler: () => { },
|
|
22
|
+
};
|
|
23
|
+
exports.default = configCommand;
|
|
24
|
+
// TODO Remove this legacy export once we've migrated all commands to TS
|
|
25
|
+
module.exports = configCommand;
|
package/commands/create.js
CHANGED
package/commands/doctor.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export declare const handler: ({ outputDir, }: ArgumentsCamelCase<DoctorOptions>) => Promise<never>;
|
|
8
|
-
export declare const builder: BuilderCallback<DoctorOptions, DoctorOptions>;
|
|
1
|
+
import { CommonArgs, YargsCommandModule } from '../types/Yargs';
|
|
2
|
+
export type DoctorArgs = CommonArgs & {
|
|
3
|
+
outputDir?: string;
|
|
4
|
+
};
|
|
5
|
+
declare const doctorCommand: YargsCommandModule<unknown, DoctorArgs>;
|
|
6
|
+
export default doctorCommand;
|
package/commands/doctor.js
CHANGED
|
@@ -3,46 +3,47 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
8
|
const usageTracking_1 = require("../lib/usageTracking");
|
|
8
9
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
9
|
-
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const Doctor_1 = require("../lib/doctor/Doctor");
|
|
11
11
|
const exitCodes_1 = require("../lib/enums/exitCodes");
|
|
12
|
-
const path_1 = __importDefault(require("path"));
|
|
13
12
|
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const handler = async (
|
|
13
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
14
|
+
const lang_1 = require("../lib/lang");
|
|
15
|
+
const command = 'doctor';
|
|
16
|
+
const describe = (0, lang_1.i18n)(`commands.doctor.describe`);
|
|
17
|
+
const handler = async (args) => {
|
|
18
|
+
const { outputDir } = args;
|
|
19
19
|
const doctor = new Doctor_1.Doctor();
|
|
20
|
-
(0, usageTracking_1.trackCommandUsage)(
|
|
20
|
+
(0, usageTracking_1.trackCommandUsage)(command, undefined, doctor.accountId || undefined);
|
|
21
21
|
const output = await doctor.diagnose();
|
|
22
22
|
const totalCount = (output?.errorCount || 0) + (output?.warningCount || 0);
|
|
23
23
|
if (totalCount > 0) {
|
|
24
|
-
(0, usageTracking_1.trackCommandMetadataUsage)(
|
|
24
|
+
(0, usageTracking_1.trackCommandMetadataUsage)(command, { successful: false, type: totalCount }, doctor.accountId || undefined);
|
|
25
25
|
}
|
|
26
26
|
if (!outputDir) {
|
|
27
27
|
if (output?.diagnosis) {
|
|
28
28
|
logger_1.logger.log(output.diagnosis);
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
|
-
logger_1.logger.error(i18n(`commands.doctor.errors.generatingDiagnosis`));
|
|
31
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.doctor.errors.generatingDiagnosis`));
|
|
32
32
|
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
33
33
|
}
|
|
34
34
|
return process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
let outputDirPath = outputDir;
|
|
37
|
+
if (!path_1.default.isAbsolute(outputDirPath)) {
|
|
38
|
+
outputDirPath = path_1.default.join((0, path_2.getCwd)(), outputDirPath);
|
|
38
39
|
}
|
|
39
|
-
const outputFile = path_1.default.join(
|
|
40
|
+
const outputFile = path_1.default.join(outputDirPath, `hubspot-doctor-${new Date().toISOString()}.json`);
|
|
40
41
|
try {
|
|
41
42
|
fs_1.default.writeFileSync(outputFile, JSON.stringify(output, null, 4));
|
|
42
|
-
logger_1.logger.success(i18n(`commands.doctor.outputWritten`, { filename: outputFile }));
|
|
43
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.doctor.outputWritten`, { filename: outputFile }));
|
|
43
44
|
}
|
|
44
45
|
catch (e) {
|
|
45
|
-
logger_1.logger.error(i18n(`commands.doctor.errors.unableToWriteOutputFile`, {
|
|
46
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.doctor.errors.unableToWriteOutputFile`, {
|
|
46
47
|
file: outputFile,
|
|
47
48
|
errorMessage: e instanceof Error ? e.message : e,
|
|
48
49
|
}));
|
|
@@ -50,12 +51,22 @@ const handler = async ({ outputDir, }) => {
|
|
|
50
51
|
}
|
|
51
52
|
return process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
52
53
|
};
|
|
53
|
-
|
|
54
|
-
const builder = yargs => {
|
|
54
|
+
function doctorBuilder(yargs) {
|
|
55
55
|
yargs.option('output-dir', {
|
|
56
|
-
describe: i18n(`commands.doctor.options.outputDir`),
|
|
56
|
+
describe: (0, lang_1.i18n)(`commands.doctor.options.outputDir`),
|
|
57
57
|
type: 'string',
|
|
58
58
|
});
|
|
59
|
-
|
|
59
|
+
return yargs;
|
|
60
|
+
}
|
|
61
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(doctorBuilder, command, describe, {
|
|
62
|
+
useGlobalOptions: true,
|
|
63
|
+
});
|
|
64
|
+
const doctorCommand = {
|
|
65
|
+
command,
|
|
66
|
+
describe,
|
|
67
|
+
handler,
|
|
68
|
+
builder,
|
|
60
69
|
};
|
|
61
|
-
exports.
|
|
70
|
+
exports.default = doctorCommand;
|
|
71
|
+
// TODO Remove this after cli.ts is ported to TS
|
|
72
|
+
module.exports = doctorCommand;
|
package/commands/init.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ConfigArgs, CommonArgs, TestingArgs, AccountArgs } from '../types/Yargs';
|
|
3
|
-
export declare const command = "init";
|
|
4
|
-
export declare const describe: string;
|
|
1
|
+
import { ConfigArgs, CommonArgs, TestingArgs, AccountArgs, YargsCommandModule } from '../types/Yargs';
|
|
5
2
|
type InitArgs = CommonArgs & ConfigArgs & TestingArgs & AccountArgs & {
|
|
6
3
|
authType?: string;
|
|
7
4
|
'disable-tracking'?: boolean;
|
|
8
5
|
'use-hidden-config'?: boolean;
|
|
9
6
|
};
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
export {};
|
|
7
|
+
declare const initCommand: YargsCommandModule<unknown, InitArgs>;
|
|
8
|
+
export default initCommand;
|
package/commands/init.js
CHANGED
|
@@ -3,8 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.builder = exports.describe = exports.command = void 0;
|
|
7
|
-
exports.handler = handler;
|
|
8
6
|
const path_1 = __importDefault(require("path"));
|
|
9
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
8
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
@@ -62,8 +60,8 @@ const AUTH_TYPE_NAMES = {
|
|
|
62
60
|
[auth_1.PERSONAL_ACCESS_KEY_AUTH_METHOD.value]: auth_1.PERSONAL_ACCESS_KEY_AUTH_METHOD.name,
|
|
63
61
|
[auth_1.OAUTH_AUTH_METHOD.value]: auth_1.OAUTH_AUTH_METHOD.name,
|
|
64
62
|
};
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
const command = 'init';
|
|
64
|
+
const describe = (0, lang_1.i18n)(`commands.init.describe`);
|
|
67
65
|
async function handler(args) {
|
|
68
66
|
const { authType: authTypeFlagValue, c: configFlagValue, providedAccountId, disableTracking, useHiddenConfig, } = args;
|
|
69
67
|
const authType = (authTypeFlagValue && authTypeFlagValue.toLowerCase()) ||
|
|
@@ -174,7 +172,7 @@ function initBuilder(yargs) {
|
|
|
174
172
|
yargs.conflicts('use-hidden-config', 'config');
|
|
175
173
|
return yargs;
|
|
176
174
|
}
|
|
177
|
-
|
|
175
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(initBuilder, command, (0, lang_1.i18n)(`commands.init.verboseDescribe`, {
|
|
178
176
|
command: (0, ui_1.uiCommandReference)('hs auth'),
|
|
179
177
|
configName: config_2.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
|
|
180
178
|
authMethod: auth_1.PERSONAL_ACCESS_KEY_AUTH_METHOD.value,
|
|
@@ -183,3 +181,12 @@ exports.builder = (0, yargsUtils_1.makeYargsBuilder)(initBuilder, exports.comman
|
|
|
183
181
|
useConfigOptions: true,
|
|
184
182
|
useTestingOptions: true,
|
|
185
183
|
});
|
|
184
|
+
const initCommand = {
|
|
185
|
+
command,
|
|
186
|
+
describe,
|
|
187
|
+
handler,
|
|
188
|
+
builder,
|
|
189
|
+
};
|
|
190
|
+
exports.default = initCommand;
|
|
191
|
+
// TODO Remove this legacy export once we've migrated all commands to TS
|
|
192
|
+
module.exports = initCommand;
|
package/commands/list.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs } from '../types/Yargs';
|
|
3
|
-
export declare const command = "list [path]";
|
|
4
|
-
export declare const describe: string;
|
|
1
|
+
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs, YargsCommandModule } from '../types/Yargs';
|
|
5
2
|
type ListArgs = CommonArgs & ConfigArgs & EnvironmentArgs & AccountArgs & {
|
|
6
3
|
path: string;
|
|
7
4
|
};
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export {};
|
|
5
|
+
declare const cmsListCommand: YargsCommandModule<unknown, ListArgs>;
|
|
6
|
+
export default cmsListCommand;
|