@hubspot/cli 7.1.1 → 7.2.0-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/commands/create/api-sample.js +14 -4
- package/commands/customObject/create.d.ts +11 -0
- package/commands/customObject/create.js +37 -28
- package/commands/customObject/schema/create.d.ts +10 -0
- package/commands/customObject/schema/create.js +40 -42
- package/commands/customObject/schema/delete.d.ts +11 -0
- package/commands/customObject/schema/delete.js +34 -27
- package/commands/customObject/schema/fetch-all.d.ts +10 -0
- package/commands/customObject/schema/fetch-all.js +31 -24
- package/commands/customObject/schema/fetch.d.ts +11 -0
- package/commands/customObject/schema/fetch.js +34 -42
- package/commands/customObject/schema/list.d.ts +7 -0
- package/commands/customObject/schema/list.js +23 -14
- package/commands/customObject/schema/update.d.ts +11 -0
- package/commands/customObject/schema/update.js +44 -46
- package/commands/customObject/schema.d.ts +5 -1
- package/commands/customObject/schema.js +49 -11
- package/commands/customObject.d.ts +4 -1
- package/commands/customObject.js +54 -21
- package/commands/filemanager/fetch.d.ts +12 -0
- package/commands/filemanager/fetch.js +33 -30
- package/commands/filemanager/upload.d.ts +11 -0
- package/commands/filemanager/upload.js +53 -47
- package/commands/filemanager.d.ts +4 -1
- package/commands/filemanager.js +41 -7
- package/commands/hubdb/clear.d.ts +11 -0
- package/commands/hubdb/clear.js +33 -30
- package/commands/hubdb/create.d.ts +10 -0
- package/commands/hubdb/create.js +46 -40
- package/commands/hubdb/delete.d.ts +10 -0
- package/commands/hubdb/delete.js +38 -35
- package/commands/hubdb/fetch.d.ts +11 -0
- package/commands/hubdb/fetch.js +30 -27
- package/commands/hubdb.d.ts +4 -1
- package/commands/hubdb.js +45 -11
- package/commands/project/add.js +62 -16
- package/commands/project/cloneApp.js +3 -3
- package/commands/project/create.js +70 -15
- package/commands/project/dev/deprecatedFlow.d.ts +5 -0
- package/commands/project/dev/deprecatedFlow.js +137 -0
- package/commands/project/dev/index.d.ts +6 -0
- 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/project/migrateApp.js +3 -3
- package/commands/project/upload.js +7 -2
- package/commands/sandbox/create.d.ts +12 -0
- package/commands/sandbox/create.js +90 -72
- package/commands/sandbox/delete.d.ts +11 -0
- package/commands/sandbox/delete.js +112 -95
- package/commands/sandbox.d.ts +4 -1
- package/commands/sandbox.js +44 -10
- package/commands/secret/addSecret.d.ts +10 -0
- package/commands/secret/addSecret.js +32 -31
- package/commands/secret/deleteSecret.d.ts +11 -0
- package/commands/secret/deleteSecret.js +31 -29
- package/commands/secret/listSecret.d.ts +9 -0
- package/commands/secret/listSecret.js +41 -0
- package/commands/secret/updateSecret.d.ts +10 -0
- package/commands/secret/updateSecret.js +33 -31
- package/commands/secret.d.ts +4 -1
- package/commands/secret.js +46 -12
- package/commands/theme/generate-selectors.d.ts +9 -0
- package/commands/theme/generate-selectors.js +61 -43
- package/commands/theme/marketplace-validate.d.ts +10 -0
- package/commands/theme/marketplace-validate.js +32 -26
- package/commands/theme/preview.d.ts +16 -0
- package/commands/theme/preview.js +104 -97
- package/commands/theme.d.ts +4 -1
- package/commands/theme.js +44 -10
- package/lang/en.lyaml +36 -16
- package/lib/DevServerManagerV2.d.ts +34 -0
- package/lib/DevServerManagerV2.js +85 -0
- package/lib/LocalDevManager.d.ts +2 -2
- package/lib/LocalDevManagerV2.d.ts +64 -0
- package/lib/LocalDevManagerV2.js +382 -0
- package/lib/buildAccount.d.ts +2 -3
- package/lib/constants.d.ts +12 -3
- package/lib/constants.js +13 -4
- package/lib/customObject.d.ts +3 -0
- package/lib/customObject.js +15 -0
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +6 -0
- package/lib/doctor/DiagnosticInfoBuilder.js +5 -0
- package/lib/doctor/Doctor.d.ts +1 -0
- package/lib/doctor/Doctor.js +10 -0
- package/lib/localDev.d.ts +3 -2
- package/lib/localDev.js +2 -2
- package/lib/marketplaceValidate.d.ts +2 -2
- package/lib/process.d.ts +1 -0
- package/lib/process.js +11 -10
- package/lib/projects/buildAndDeploy.js +4 -1
- package/lib/projects/create.d.ts +5 -0
- package/lib/projects/create.js +51 -0
- package/lib/projects/index.d.ts +1 -5
- package/lib/projects/index.js +1 -62
- package/lib/projects/structure.d.ts +4 -0
- package/lib/projects/structure.js +9 -0
- package/lib/projects/upload.d.ts +1 -1
- package/lib/projects/upload.js +2 -2
- package/lib/prompts/createProjectPrompt.d.ts +6 -8
- package/lib/prompts/createProjectPrompt.js +26 -54
- package/lib/prompts/projectAddPrompt.d.ts +3 -3
- package/lib/prompts/projectAddPrompt.js +16 -6
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +3 -2
- package/lib/prompts/sandboxesPrompt.d.ts +3 -2
- package/lib/prompts/sandboxesPrompt.js +1 -1
- package/lib/sandboxSync.js +6 -2
- package/lib/sandboxes.d.ts +2 -5
- package/lib/testUtils.d.ts +12 -0
- package/lib/testUtils.js +10 -0
- package/lib/ui/index.d.ts +2 -2
- package/lib/ui/index.js +1 -0
- package/lib/upload.d.ts +1 -1
- package/lib/upload.js +20 -20
- package/lib/validation.d.ts +1 -1
- package/package.json +6 -5
- package/types/ProjectComponents.d.ts +38 -0
- package/types/ProjectComponents.js +3 -0
- package/types/Projects.d.ts +1 -6
- package/types/Prompts.d.ts +7 -0
- package/types/Sandboxes.d.ts +2 -0
- package/types/Yargs.d.ts +15 -0
- package/commands/project/dev.d.ts +0 -1
- package/commands/project/dev.js +0 -146
- package/commands/secret/listSecrets.d.ts +0 -1
- package/commands/secret/listSecrets.js +0 -39
package/commands/theme.js
CHANGED
|
@@ -1,20 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
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
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
36
|
+
exports.describe = exports.command = void 0;
|
|
37
|
+
exports.builder = builder;
|
|
38
|
+
const marketplaceValidate = __importStar(require("./theme/marketplace-validate"));
|
|
39
|
+
const generateSelectors = __importStar(require("./theme/generate-selectors"));
|
|
40
|
+
const previewCommand = __importStar(require("./theme/preview"));
|
|
41
|
+
const commonOpts_1 = require("../lib/commonOpts");
|
|
42
|
+
const lang_1 = require("../lib/lang");
|
|
9
43
|
const i18nKey = 'commands.theme';
|
|
10
44
|
exports.command = ['theme', 'themes'];
|
|
11
|
-
exports.describe = i18n(`${i18nKey}.describe`);
|
|
12
|
-
|
|
13
|
-
addGlobalOptions(yargs);
|
|
45
|
+
exports.describe = (0, lang_1.i18n)(`${i18nKey}.describe`);
|
|
46
|
+
function builder(yargs) {
|
|
47
|
+
(0, commonOpts_1.addGlobalOptions)(yargs);
|
|
14
48
|
yargs
|
|
15
49
|
.command(previewCommand)
|
|
16
50
|
.command(marketplaceValidate)
|
|
17
51
|
.command(generateSelectors)
|
|
18
52
|
.demandCommand(1, '');
|
|
19
53
|
return yargs;
|
|
20
|
-
}
|
|
54
|
+
}
|
package/lang/en.lyaml
CHANGED
|
@@ -207,6 +207,7 @@ en:
|
|
|
207
207
|
create:
|
|
208
208
|
describe: "Create custom object instances."
|
|
209
209
|
errors:
|
|
210
|
+
invalidObjectDefinition: "The object definition is invalid. Please check the schema and try again."
|
|
210
211
|
creationFailed: "Object creation from {{ definition }} failed"
|
|
211
212
|
options:
|
|
212
213
|
path:
|
|
@@ -224,6 +225,7 @@ en:
|
|
|
224
225
|
create:
|
|
225
226
|
describe: "Create a custom object schema."
|
|
226
227
|
errors:
|
|
228
|
+
invalidSchema: "The schema definition is invalid. Please check the schema and try again."
|
|
227
229
|
creationFailed: "Schema creation from {{ definition }} failed"
|
|
228
230
|
options:
|
|
229
231
|
definition:
|
|
@@ -285,6 +287,7 @@ en:
|
|
|
285
287
|
update:
|
|
286
288
|
describe: "Update an existing custom object schema."
|
|
287
289
|
errors:
|
|
290
|
+
invalidSchema: "The schema definition is invalid. Please check the schema and try again."
|
|
288
291
|
update: "Schema update from {{ definition }} failed"
|
|
289
292
|
options:
|
|
290
293
|
path:
|
|
@@ -522,13 +525,21 @@ en:
|
|
|
522
525
|
learnMoreLocalDevServer: "Learn more about the projects local dev server"
|
|
523
526
|
errors:
|
|
524
527
|
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."
|
|
525
530
|
invalidProjectComponents: "Projects cannot contain both private and public apps. Move your apps to separate projects before attempting local development."
|
|
526
531
|
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
|
+
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."
|
|
527
533
|
examples:
|
|
528
534
|
default: "Start local dev for the current project"
|
|
529
535
|
create:
|
|
530
536
|
describe: "Create a new project."
|
|
537
|
+
errors:
|
|
538
|
+
failedToDownloadProject: "Failed to download project. Please try again later."
|
|
539
|
+
failedToFetchProjectList: "Failed to fetch the list of available project templates. Please try again later."
|
|
540
|
+
cannotNestProjects: "A project already exists at {{ projectDir }}. Projects cannot be nested within other projects. Please choose a different destination and try again."
|
|
531
541
|
logs:
|
|
542
|
+
success: "Project {{#bold}}{{ projectName }}{{/bold}} was successfully created in {{ projectDest }}"
|
|
532
543
|
welcomeMessage: "Welcome to HubSpot Developer Projects!"
|
|
533
544
|
examples:
|
|
534
545
|
default: "Create a new project"
|
|
@@ -601,12 +612,13 @@ en:
|
|
|
601
612
|
describe: "The name for your newly created component"
|
|
602
613
|
type:
|
|
603
614
|
describe: "The path to the component type's location within the hubspot-project-components Github repo: https://github.com/HubSpot/hubspot-project-components"
|
|
604
|
-
creatingComponent:
|
|
605
|
-
|
|
606
|
-
success:
|
|
607
|
-
message: "{{ componentName }} was added to your project"
|
|
615
|
+
creatingComponent: "Adding a new component to {{#bold}}{{ projectName }}{{/bold}}"
|
|
616
|
+
success: "{{ componentName }} was successfully added to your project."
|
|
608
617
|
error:
|
|
609
|
-
|
|
618
|
+
failedToDownloadComponent: "Failed to download project component. Please try again later."
|
|
619
|
+
locationInProject: "This command must be run from within a project directory."
|
|
620
|
+
failedToFetchComponentList: "Failed to fetch the list of available components. Please try again later."
|
|
621
|
+
projectContainsPublicApp: "This project contains a public app. This command is currently only compatible with projects that contain private apps."
|
|
610
622
|
examples:
|
|
611
623
|
default: "Create a component within your project"
|
|
612
624
|
withFlags: "Use --name and --type flags to bypass the prompt."
|
|
@@ -813,6 +825,8 @@ en:
|
|
|
813
825
|
invalidAccountType: "Sandboxes must be created from a production account. Your current default account {{#bold}}{{ accountName }}{{/bold}} is a {{ accountType }}.
|
|
814
826
|
\n- Run {{#bold}}hs accounts use{{/bold}} to switch to your default account to your production account.
|
|
815
827
|
\n- Run {{#bold}}hs auth{{/bold}} to connect a production account to the HubSpot CLI.\n"
|
|
828
|
+
noAccountConfig: "There is no account associated with {{ accountId }} in the config file. Please choose another account and try again, or authenticate {{ accountId }} using {{ authCommand }}."
|
|
829
|
+
noSandboxAccountConfig: "There is no sandbox account associated with {{ accountId }} in the config file. Please try to re-authenticate your sandbox account using {{ authCommand}}."
|
|
816
830
|
delete:
|
|
817
831
|
describe: "Delete a sandbox account."
|
|
818
832
|
debug:
|
|
@@ -829,11 +843,12 @@ en:
|
|
|
829
843
|
failure:
|
|
830
844
|
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 }}."
|
|
831
845
|
noAccount: "No account specified. Specify an account by using the --account flag."
|
|
832
|
-
noSandboxAccounts: "There are no sandboxes connected to the CLI. To add a sandbox, run {{
|
|
833
|
-
|
|
846
|
+
noSandboxAccounts: "There are no sandboxes connected to the CLI. To add a sandbox, run {{ authCommand }}."
|
|
847
|
+
noSandboxAccountId: "This sandbox can't be deleted from the CLI because we could not find the associated sandbox account."
|
|
848
|
+
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."
|
|
834
849
|
objectNotFound: "Sandbox {{#bold}}{{ account }}{{/bold}} may have been deleted through the UI. The account has been removed from the config."
|
|
835
|
-
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 {{
|
|
836
|
-
invalidKey: "Your personal access key for account {{#bold}}{{ account }}{{/bold}} is inactive. To re-authenticate, please run {{
|
|
850
|
+
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}}."
|
|
851
|
+
invalidKey: "Your personal access key for account {{#bold}}{{ account }}{{/bold}} is inactive. To re-authenticate, please run {{ authCommand }}."
|
|
837
852
|
options:
|
|
838
853
|
force:
|
|
839
854
|
describe: "Skips all confirmation prompts when deleting a sandbox account."
|
|
@@ -1101,6 +1116,11 @@ en:
|
|
|
1101
1116
|
checkIfParentAccountIsAuthed:
|
|
1102
1117
|
notAuthedError: "To develop this project locally, run {{ authCommand }} to authenticate the App Developer Account {{ accountId }} associated with {{ accountIdentifier }}."
|
|
1103
1118
|
projects:
|
|
1119
|
+
create:
|
|
1120
|
+
errors:
|
|
1121
|
+
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."
|
|
1122
|
+
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."
|
|
1123
|
+
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\"]."
|
|
1104
1124
|
validateProjectConfig:
|
|
1105
1125
|
configNotFound: "Unable to locate a project configuration file. Try running again from a project directory, or run {{ createCommand }} to create a new project."
|
|
1106
1126
|
configMissingFields: "The project configuruation file is missing required fields."
|
|
@@ -1308,12 +1328,9 @@ en:
|
|
|
1308
1328
|
errors:
|
|
1309
1329
|
nameRequired: "A project name is required"
|
|
1310
1330
|
destRequired: "A project dest is required"
|
|
1311
|
-
invalidDest: "
|
|
1331
|
+
invalidDest: "There is an existing project at this destination. Please provide a new path for this project."
|
|
1312
1332
|
invalidCharacters: "The selected destination contains invalid characters. Please provide a new path and try again."
|
|
1313
|
-
invalidTemplate: "[--template] Could not find template {{ template }}. Please choose an available template
|
|
1314
|
-
noProjectsInConfig: "Please ensure that there is a config.json file that contains a \"projects\" field."
|
|
1315
|
-
missingConfigFileTemplateSource: "Please ensure that there is a config.json file in the repository used as the --template-source"
|
|
1316
|
-
missingPropertiesInConfig: "Please ensure that each of the projects in your config.json file contain the following properties: [\"name\", \"label\", \"path\", \"insertPath\"]."
|
|
1333
|
+
invalidTemplate: "[--template] Could not find template \"{{ template }}\". Please choose an available template:"
|
|
1317
1334
|
selectPublicAppPrompt:
|
|
1318
1335
|
selectAppIdMigrate: "[--appId] Choose an app under {{ accountName }} to migrate:"
|
|
1319
1336
|
selectAppIdClone: "[--appId] Choose an app under {{ accountName }} to clone:"
|
|
@@ -1331,11 +1348,11 @@ en:
|
|
|
1331
1348
|
projectNotFound: "Your project {{ projectName }} could not be found in {{ accountId }}. Please select a valid project:"
|
|
1332
1349
|
accountIdRequired: "An account ID is required to download a project."
|
|
1333
1350
|
projectAddPrompt:
|
|
1334
|
-
selectType: "[--type] Select
|
|
1351
|
+
selectType: "[--type] Select a component to add: "
|
|
1335
1352
|
enterName: "[--name] Give your component a name: "
|
|
1336
1353
|
errors:
|
|
1337
1354
|
nameRequired: "A component name is required"
|
|
1338
|
-
invalidType: "[--type] Could not find type {{ type }}. Please choose an available type
|
|
1355
|
+
invalidType: "[--type] Could not find type \"{{ type }}\". Please choose an available type:"
|
|
1339
1356
|
secretPrompt:
|
|
1340
1357
|
enterValue: "Enter a value for your secret: "
|
|
1341
1358
|
enterName: "Enter a name for your secret: "
|
|
@@ -1559,6 +1576,9 @@ en:
|
|
|
1559
1576
|
defaultAccountSubHeader: "Default Account: {{accountDetails}}"
|
|
1560
1577
|
noConfigFile: "CLI configuration not found"
|
|
1561
1578
|
noConfigFileSecondary: "Run {{command}} and follow the prompts to create your CLI configuration file and connect it to your HubSpot account"
|
|
1579
|
+
settings:
|
|
1580
|
+
httpUseLocalhost: "The setting {{#bold}}httpUseLocalhost{{/bold}} is enabled"
|
|
1581
|
+
httpUseLocalhostSecondary: "This setting causes all CLI requests to route to localhost"
|
|
1562
1582
|
projectConfig:
|
|
1563
1583
|
header: "Project configuration"
|
|
1564
1584
|
projectDirSubHeader: "Project dir: {{#bold}}{{ projectDir }}{{/bold}}"
|
|
@@ -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;
|
package/lib/LocalDevManager.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ type LocalDevManagerConstructorOptions = {
|
|
|
10
10
|
projectDir: string;
|
|
11
11
|
projectId: number;
|
|
12
12
|
debug?: boolean;
|
|
13
|
-
deployedBuild
|
|
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
|
|
25
|
+
deployedBuild?: Build;
|
|
26
26
|
isGithubLinked: boolean;
|
|
27
27
|
watcher: FSWatcher | null;
|
|
28
28
|
uploadWarnings: {
|
|
@@ -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;
|