@hubspot/cli 7.2.0-experimental.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/account/info.d.ts +1 -1
- package/commands/account/info.js +8 -5
- package/commands/auth.d.ts +9 -0
- package/commands/auth.js +89 -83
- package/commands/init.d.ts +11 -0
- package/commands/init.js +114 -100
- package/commands/list.d.ts +9 -0
- package/commands/list.js +63 -57
- package/commands/mv.d.ts +10 -0
- package/commands/mv.js +32 -32
- package/commands/open.d.ts +10 -0
- package/commands/open.js +37 -34
- package/commands/project/dev/deprecatedFlow.d.ts +5 -0
- package/commands/project/{dev.js → dev/deprecatedFlow.js} +14 -44
- package/commands/project/{dev.d.ts → dev/index.d.ts} +1 -3
- package/commands/project/dev/index.js +52 -0
- package/commands/project/dev/unifiedFlow.d.ts +5 -0
- package/commands/project/dev/unifiedFlow.js +112 -0
- package/commands/remove.d.ts +9 -0
- package/commands/remove.js +25 -23
- package/lang/en.lyaml +10 -6
- package/lib/DevServerManagerV2.d.ts +34 -0
- package/lib/DevServerManagerV2.js +85 -0
- package/lib/LocalDevManagerV2.d.ts +64 -0
- package/lib/LocalDevManagerV2.js +382 -0
- package/lib/commonOpts.d.ts +1 -0
- package/lib/commonOpts.js +30 -0
- package/lib/constants.d.ts +12 -0
- package/lib/constants.js +13 -1
- package/lib/localDev.d.ts +1 -1
- package/lib/localDev.js +2 -2
- package/lib/projects/structure.d.ts +4 -0
- package/lib/projects/structure.js +9 -0
- package/lib/prompts/accountNamePrompt.d.ts +2 -3
- package/lib/prompts/personalAccessKeyPrompt.d.ts +4 -4
- package/lib/ui/index.d.ts +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/supportHyperlinks.js +2 -2
- package/lib/ui/supportsColor.js +2 -2
- package/lib/usageTracking.d.ts +1 -1
- package/lib/yargsUtils.d.ts +9 -0
- package/lib/yargsUtils.js +40 -0
- package/package.json +3 -3
- package/types/ProjectComponents.d.ts +38 -0
- package/types/ProjectComponents.js +3 -0
- package/types/Yargs.d.ts +1 -0
- package/lib/hasFlag.d.ts +0 -1
- package/lib/hasFlag.js +0 -15
package/commands/remove.d.ts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
+
import { Argv, ArgumentsCamelCase } from 'yargs';
|
|
2
|
+
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs } from '../types/Yargs';
|
|
3
|
+
export declare const command = "remove <path>";
|
|
4
|
+
export declare const describe: string;
|
|
5
|
+
type RemoveArgs = CommonArgs & ConfigArgs & EnvironmentArgs & AccountArgs & {
|
|
6
|
+
path: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function handler(args: ArgumentsCamelCase<RemoveArgs>): Promise<void>;
|
|
9
|
+
export declare function builder(yargs: Argv): Argv<RemoveArgs>;
|
|
1
10
|
export {};
|
package/commands/remove.js
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
3
|
+
exports.describe = exports.command = void 0;
|
|
4
|
+
exports.handler = handler;
|
|
5
|
+
exports.builder = builder;
|
|
6
|
+
const fileMapper_1 = require("@hubspot/local-dev-lib/api/fileMapper");
|
|
7
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
8
|
+
const index_1 = require("../lib/errorHandlers/index");
|
|
9
|
+
const commonOpts_1 = require("../lib/commonOpts");
|
|
10
|
+
const usageTracking_1 = require("../lib/usageTracking");
|
|
11
|
+
const lang_1 = require("../lib/lang");
|
|
10
12
|
const i18nKey = 'commands.remove';
|
|
11
13
|
exports.command = 'remove <path>';
|
|
12
|
-
exports.describe = i18n(`${i18nKey}.describe`);
|
|
13
|
-
|
|
14
|
-
const { path: hsPath, derivedAccountId } =
|
|
15
|
-
trackCommandUsage('remove',
|
|
14
|
+
exports.describe = (0, lang_1.i18n)(`${i18nKey}.describe`);
|
|
15
|
+
async function handler(args) {
|
|
16
|
+
const { path: hsPath, derivedAccountId } = args;
|
|
17
|
+
(0, usageTracking_1.trackCommandUsage)('remove', undefined, derivedAccountId);
|
|
16
18
|
try {
|
|
17
|
-
await deleteFile(derivedAccountId, hsPath);
|
|
18
|
-
logger.log(i18n(`${i18nKey}.deleted`, { accountId: derivedAccountId, path: hsPath }));
|
|
19
|
+
await (0, fileMapper_1.deleteFile)(derivedAccountId, hsPath);
|
|
20
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.deleted`, { accountId: derivedAccountId, path: hsPath }));
|
|
19
21
|
}
|
|
20
22
|
catch (error) {
|
|
21
|
-
logger.error(i18n(`${i18nKey}.errors.deleteFailed`, {
|
|
23
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.deleteFailed`, {
|
|
22
24
|
accountId: derivedAccountId,
|
|
23
25
|
path: hsPath,
|
|
24
26
|
}));
|
|
25
|
-
logError(error, new ApiErrorContext({
|
|
27
|
+
(0, index_1.logError)(error, new index_1.ApiErrorContext({
|
|
26
28
|
accountId: derivedAccountId,
|
|
27
29
|
request: hsPath,
|
|
28
30
|
}));
|
|
29
31
|
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
+
}
|
|
33
|
+
function builder(yargs) {
|
|
34
|
+
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
35
|
+
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
36
|
+
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
37
|
+
(0, commonOpts_1.addGlobalOptions)(yargs);
|
|
32
38
|
yargs.positional('path', {
|
|
33
|
-
describe: i18n(`${i18nKey}.positionals.path.describe`),
|
|
39
|
+
describe: (0, lang_1.i18n)(`${i18nKey}.positionals.path.describe`),
|
|
34
40
|
type: 'string',
|
|
35
41
|
});
|
|
36
|
-
addConfigOptions(yargs);
|
|
37
|
-
addAccountOptions(yargs);
|
|
38
|
-
addUseEnvironmentOptions(yargs);
|
|
39
|
-
addGlobalOptions(yargs);
|
|
40
42
|
return yargs;
|
|
41
|
-
}
|
|
43
|
+
}
|
package/lang/en.lyaml
CHANGED
|
@@ -72,6 +72,9 @@ en:
|
|
|
72
72
|
describe: "Print information about the default account, or about the account specified with the \"account\" option."
|
|
73
73
|
errors:
|
|
74
74
|
notUsingPersonalAccessKey: "This command currently only supports fetching scopes for the personal access key auth type."
|
|
75
|
+
options:
|
|
76
|
+
account:
|
|
77
|
+
describe: "Account name or id to show info for"
|
|
75
78
|
examples:
|
|
76
79
|
default: "Print information for the default account"
|
|
77
80
|
idBased: "Print information for the account with accountId equal to \"1234567\""
|
|
@@ -91,14 +94,14 @@ en:
|
|
|
91
94
|
other: "Remove {{ count }} inactive accounts from the CLI config?"
|
|
92
95
|
removeSuccess: "Removed {{ accountName }} from the CLI config."
|
|
93
96
|
auth:
|
|
94
|
-
describe: "Configure authentication for your HubSpot account.
|
|
97
|
+
describe: "Configure authentication for your HubSpot account."
|
|
98
|
+
verboseDescribe: "Configure authentication for a HubSpot account. This will update the {{ configName }} file that stores your account information.\n\nThe recommended authentication method is {{#bold}}{{ authMethod }}{{/bold}}, which uses an access token tied to a specific user account."
|
|
95
99
|
errors:
|
|
96
100
|
noConfigFileFound: "No config file was found. To create a new config file, use the \"hs init\" command."
|
|
97
101
|
unsupportedAuthType: "Unsupported auth type: {{ type }}. The only supported authentication protocols are {{ supportedProtocols }}."
|
|
98
102
|
options:
|
|
99
103
|
authType:
|
|
100
|
-
describe: "Authentication
|
|
101
|
-
defaultDescription: "\"{{ authMethod }}\": An access token tied to a specific user account. This is the recommended way of authenticating with local development tools."
|
|
104
|
+
describe: "Authentication method"
|
|
102
105
|
account:
|
|
103
106
|
describe: "HubSpot account to authenticate"
|
|
104
107
|
success:
|
|
@@ -446,11 +449,11 @@ en:
|
|
|
446
449
|
success:
|
|
447
450
|
fetch: "Downloaded HubDB table {{ tableId }} to {{ path }}"
|
|
448
451
|
init:
|
|
449
|
-
describe: "
|
|
452
|
+
describe: "Create a CLI config file and configure authentication for your HubSpot account."
|
|
453
|
+
verboseDescribe: "Configure authentication for a HubSpot account. This will create a {{ configName }} file to store your account information. To configure authentication for additional accounts, run {{ command }}.\n\nThe recommended authentication method is {{#bold}}{{ authMethod }}{{/bold}}, which uses an access token tied to a specific user account."
|
|
450
454
|
options:
|
|
451
455
|
authType:
|
|
452
|
-
describe: "Authentication
|
|
453
|
-
defaultDescription: "\"{{ authMethod }}\": An access token tied to a specific user account. This is the recommended way of authenticating with local development tools."
|
|
456
|
+
describe: "Authentication method"
|
|
454
457
|
account:
|
|
455
458
|
describe: "HubSpot account to authenticate"
|
|
456
459
|
useHiddenConfig:
|
|
@@ -529,6 +532,7 @@ en:
|
|
|
529
532
|
noAccountsInConfig: "No accounts found in your config. Run {{ authCommand }} to configure a HubSpot account with the CLI."
|
|
530
533
|
invalidProjectComponents: "Projects cannot contain both private and public apps. Move your apps to separate projects before attempting local development."
|
|
531
534
|
noRunnableComponents: "No supported components were found in this project. Run {{ command }} to see a list of available components and add one to your project."
|
|
535
|
+
invalidUnifiedAppsAccount: "Local development of Unified Apps is currently only supported in standard and developer accounts. Target a standard or developer account with {{ authCommand }} and try again."
|
|
532
536
|
examples:
|
|
533
537
|
default: "Start local dev for the current project"
|
|
534
538
|
create:
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ProjectConfig } from '../types/Projects';
|
|
2
|
+
import { IntermediateRepresentationNodeLocalDev } from '@hubspot/project-parsing-lib/src/lib/types';
|
|
3
|
+
type DevServerInterface = {
|
|
4
|
+
setup?: Function;
|
|
5
|
+
start?: (options: object) => Promise<void>;
|
|
6
|
+
fileChange?: (filePath: string, event: string) => Promise<void>;
|
|
7
|
+
cleanup?: () => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
declare class DevServerManagerV2 {
|
|
10
|
+
private initialized;
|
|
11
|
+
private started;
|
|
12
|
+
private devServers;
|
|
13
|
+
constructor();
|
|
14
|
+
iterateDevServers(callback: (serverInterface: DevServerInterface) => Promise<void>): Promise<void>;
|
|
15
|
+
setup({ projectNodes, onUploadRequired, accountId, setActiveApp, }: {
|
|
16
|
+
projectNodes: {
|
|
17
|
+
[key: string]: IntermediateRepresentationNodeLocalDev;
|
|
18
|
+
};
|
|
19
|
+
onUploadRequired: () => void;
|
|
20
|
+
accountId: number;
|
|
21
|
+
setActiveApp: (appUid: string | undefined) => Promise<void>;
|
|
22
|
+
}): Promise<void>;
|
|
23
|
+
start({ accountId, projectConfig, }: {
|
|
24
|
+
accountId: number;
|
|
25
|
+
projectConfig: ProjectConfig;
|
|
26
|
+
}): Promise<void>;
|
|
27
|
+
fileChange({ filePath, event, }: {
|
|
28
|
+
filePath: string;
|
|
29
|
+
event: string;
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
cleanup(): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
declare const Manager: DevServerManagerV2;
|
|
34
|
+
export default Manager;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
4
|
+
const lang_1 = require("./lang");
|
|
5
|
+
const promptUtils_1 = require("./prompts/promptUtils");
|
|
6
|
+
const ui_extensions_dev_server_1 = require("@hubspot/ui-extensions-dev-server");
|
|
7
|
+
const portManager_1 = require("@hubspot/local-dev-lib/portManager");
|
|
8
|
+
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
9
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
10
|
+
const i18nKey = 'lib.DevServerManager';
|
|
11
|
+
class DevServerManagerV2 {
|
|
12
|
+
initialized;
|
|
13
|
+
started;
|
|
14
|
+
devServers;
|
|
15
|
+
constructor() {
|
|
16
|
+
this.initialized = false;
|
|
17
|
+
this.started = false;
|
|
18
|
+
this.devServers = [ui_extensions_dev_server_1.DevModeUnifiedInterface];
|
|
19
|
+
}
|
|
20
|
+
async iterateDevServers(callback) {
|
|
21
|
+
await Promise.all(this.devServers.map(devServer => callback(devServer)));
|
|
22
|
+
}
|
|
23
|
+
async setup({ projectNodes, onUploadRequired, accountId, setActiveApp, }) {
|
|
24
|
+
let env;
|
|
25
|
+
const accountConfig = (0, config_1.getAccountConfig)(accountId);
|
|
26
|
+
if (accountConfig) {
|
|
27
|
+
env = accountConfig.env;
|
|
28
|
+
}
|
|
29
|
+
await (0, portManager_1.startPortManagerServer)();
|
|
30
|
+
await this.iterateDevServers(async (serverInterface) => {
|
|
31
|
+
if (serverInterface.setup) {
|
|
32
|
+
await serverInterface.setup({
|
|
33
|
+
components: projectNodes,
|
|
34
|
+
onUploadRequired,
|
|
35
|
+
promptUser: promptUtils_1.promptUser,
|
|
36
|
+
logger: logger_1.logger,
|
|
37
|
+
urls: {
|
|
38
|
+
api: (0, urls_1.getHubSpotApiOrigin)(env),
|
|
39
|
+
web: (0, urls_1.getHubSpotWebsiteOrigin)(env),
|
|
40
|
+
},
|
|
41
|
+
setActiveApp,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
this.initialized = true;
|
|
46
|
+
}
|
|
47
|
+
async start({ accountId, projectConfig, }) {
|
|
48
|
+
if (this.initialized) {
|
|
49
|
+
await this.iterateDevServers(async (serverInterface) => {
|
|
50
|
+
if (serverInterface.start) {
|
|
51
|
+
await serverInterface.start({
|
|
52
|
+
accountId,
|
|
53
|
+
projectConfig,
|
|
54
|
+
requestPorts: portManager_1.requestPorts,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.notInitialized`));
|
|
61
|
+
}
|
|
62
|
+
this.started = true;
|
|
63
|
+
}
|
|
64
|
+
async fileChange({ filePath, event, }) {
|
|
65
|
+
if (this.started) {
|
|
66
|
+
this.iterateDevServers(async (serverInterface) => {
|
|
67
|
+
if (serverInterface.fileChange) {
|
|
68
|
+
await serverInterface.fileChange(filePath, event);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async cleanup() {
|
|
74
|
+
if (this.started) {
|
|
75
|
+
await this.iterateDevServers(async (serverInterface) => {
|
|
76
|
+
if (serverInterface.cleanup) {
|
|
77
|
+
await serverInterface.cleanup();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
await (0, portManager_1.stopPortManagerServer)();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const Manager = new DevServerManagerV2();
|
|
85
|
+
exports.default = Manager;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { FSWatcher } from 'chokidar';
|
|
2
|
+
import { Build } from '@hubspot/local-dev-lib/types/Build';
|
|
3
|
+
import { PublicApp } from '@hubspot/local-dev-lib/types/Apps';
|
|
4
|
+
import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
5
|
+
import { ProjectConfig } from '../types/Projects';
|
|
6
|
+
import { IntermediateRepresentationNodeLocalDev } from '@hubspot/project-parsing-lib/src/lib/types';
|
|
7
|
+
import { AppIRNode } from '../types/ProjectComponents';
|
|
8
|
+
type LocalDevManagerConstructorOptions = {
|
|
9
|
+
targetProjectAccountId: number;
|
|
10
|
+
targetTestingAccountId: number;
|
|
11
|
+
projectConfig: ProjectConfig;
|
|
12
|
+
projectDir: string;
|
|
13
|
+
projectId: number;
|
|
14
|
+
debug?: boolean;
|
|
15
|
+
deployedBuild?: Build;
|
|
16
|
+
isGithubLinked: boolean;
|
|
17
|
+
projectNodes: {
|
|
18
|
+
[key: string]: IntermediateRepresentationNodeLocalDev;
|
|
19
|
+
};
|
|
20
|
+
env: Environment;
|
|
21
|
+
};
|
|
22
|
+
declare class LocalDevManagerV2 {
|
|
23
|
+
targetProjectAccountId: number;
|
|
24
|
+
targetTestingAccountId: number;
|
|
25
|
+
projectConfig: ProjectConfig;
|
|
26
|
+
projectDir: string;
|
|
27
|
+
projectId: number;
|
|
28
|
+
debug: boolean;
|
|
29
|
+
deployedBuild?: Build;
|
|
30
|
+
isGithubLinked: boolean;
|
|
31
|
+
watcher: FSWatcher | null;
|
|
32
|
+
uploadWarnings: {
|
|
33
|
+
[key: string]: boolean;
|
|
34
|
+
};
|
|
35
|
+
projectNodes: {
|
|
36
|
+
[key: string]: IntermediateRepresentationNodeLocalDev;
|
|
37
|
+
};
|
|
38
|
+
activeApp: AppIRNode | null;
|
|
39
|
+
activePublicAppData: PublicApp | null;
|
|
40
|
+
env: Environment;
|
|
41
|
+
publicAppActiveInstalls: number | null;
|
|
42
|
+
projectSourceDir: string;
|
|
43
|
+
mostRecentUploadWarning: string | null;
|
|
44
|
+
constructor(options: LocalDevManagerConstructorOptions);
|
|
45
|
+
setActiveApp(appUid?: string): Promise<void>;
|
|
46
|
+
setActivePublicAppData(): Promise<void>;
|
|
47
|
+
checkActivePublicAppInstalls(): Promise<void>;
|
|
48
|
+
start(): Promise<void>;
|
|
49
|
+
stop(showProgress?: boolean): Promise<void>;
|
|
50
|
+
checkPublicAppInstallation(): Promise<void>;
|
|
51
|
+
updateKeypressListeners(): void;
|
|
52
|
+
getUploadCommand(): string;
|
|
53
|
+
logUploadWarning(reason?: string): void;
|
|
54
|
+
monitorConsoleOutput(): void;
|
|
55
|
+
compareLocalProjectToDeployed(): void;
|
|
56
|
+
startWatching(): void;
|
|
57
|
+
stopWatching(): Promise<void>;
|
|
58
|
+
handleWatchEvent(filePath: string, event: string, configPaths: string[]): void;
|
|
59
|
+
devServerSetup(): Promise<boolean>;
|
|
60
|
+
devServerStart(): Promise<void>;
|
|
61
|
+
devServerFileChange(filePath: string, event: string): void;
|
|
62
|
+
devServerCleanup(): Promise<boolean>;
|
|
63
|
+
}
|
|
64
|
+
export default LocalDevManagerV2;
|