@hubspot/cli 7.1.1 → 7.2.0-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/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.d.ts +7 -0
- package/commands/project/dev.js +96 -75
- 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 +35 -16
- package/lib/LocalDevManager.d.ts +2 -2
- package/lib/buildAccount.d.ts +2 -3
- package/lib/constants.d.ts +0 -3
- package/lib/constants.js +1 -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 +2 -1
- 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/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 +5 -4
- 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 +14 -0
- 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,20 @@ 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."
|
|
527
532
|
examples:
|
|
528
533
|
default: "Start local dev for the current project"
|
|
529
534
|
create:
|
|
530
535
|
describe: "Create a new project."
|
|
536
|
+
errors:
|
|
537
|
+
failedToDownloadProject: "Failed to download project. Please try again later."
|
|
538
|
+
failedToFetchProjectList: "Failed to fetch the list of available project templates. Please try again later."
|
|
539
|
+
cannotNestProjects: "A project already exists at {{ projectDir }}. Projects cannot be nested within other projects. Please choose a different destination and try again."
|
|
531
540
|
logs:
|
|
541
|
+
success: "Project {{#bold}}{{ projectName }}{{/bold}} was successfully created in {{ projectDest }}"
|
|
532
542
|
welcomeMessage: "Welcome to HubSpot Developer Projects!"
|
|
533
543
|
examples:
|
|
534
544
|
default: "Create a new project"
|
|
@@ -601,12 +611,13 @@ en:
|
|
|
601
611
|
describe: "The name for your newly created component"
|
|
602
612
|
type:
|
|
603
613
|
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"
|
|
614
|
+
creatingComponent: "Adding a new component to {{#bold}}{{ projectName }}{{/bold}}"
|
|
615
|
+
success: "{{ componentName }} was successfully added to your project."
|
|
608
616
|
error:
|
|
609
|
-
|
|
617
|
+
failedToDownloadComponent: "Failed to download project component. Please try again later."
|
|
618
|
+
locationInProject: "This command must be run from within a project directory."
|
|
619
|
+
failedToFetchComponentList: "Failed to fetch the list of available components. Please try again later."
|
|
620
|
+
projectContainsPublicApp: "This project contains a public app. This command is currently only compatible with projects that contain private apps."
|
|
610
621
|
examples:
|
|
611
622
|
default: "Create a component within your project"
|
|
612
623
|
withFlags: "Use --name and --type flags to bypass the prompt."
|
|
@@ -813,6 +824,8 @@ en:
|
|
|
813
824
|
invalidAccountType: "Sandboxes must be created from a production account. Your current default account {{#bold}}{{ accountName }}{{/bold}} is a {{ accountType }}.
|
|
814
825
|
\n- Run {{#bold}}hs accounts use{{/bold}} to switch to your default account to your production account.
|
|
815
826
|
\n- Run {{#bold}}hs auth{{/bold}} to connect a production account to the HubSpot CLI.\n"
|
|
827
|
+
noAccountConfig: "There is no account associated with {{ accountId }} in the config file. Please choose another account and try again, or authenticate {{ accountId }} using {{ authCommand }}."
|
|
828
|
+
noSandboxAccountConfig: "There is no sandbox account associated with {{ accountId }} in the config file. Please try to re-authenticate your sandbox account using {{ authCommand}}."
|
|
816
829
|
delete:
|
|
817
830
|
describe: "Delete a sandbox account."
|
|
818
831
|
debug:
|
|
@@ -829,11 +842,12 @@ en:
|
|
|
829
842
|
failure:
|
|
830
843
|
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
844
|
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
|
-
|
|
845
|
+
noSandboxAccounts: "There are no sandboxes connected to the CLI. To add a sandbox, run {{ authCommand }}."
|
|
846
|
+
noSandboxAccountId: "This sandbox can't be deleted from the CLI because we could not find the associated sandbox account."
|
|
847
|
+
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
848
|
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 {{
|
|
849
|
+
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}}."
|
|
850
|
+
invalidKey: "Your personal access key for account {{#bold}}{{ account }}{{/bold}} is inactive. To re-authenticate, please run {{ authCommand }}."
|
|
837
851
|
options:
|
|
838
852
|
force:
|
|
839
853
|
describe: "Skips all confirmation prompts when deleting a sandbox account."
|
|
@@ -1101,6 +1115,11 @@ en:
|
|
|
1101
1115
|
checkIfParentAccountIsAuthed:
|
|
1102
1116
|
notAuthedError: "To develop this project locally, run {{ authCommand }} to authenticate the App Developer Account {{ accountId }} associated with {{ accountIdentifier }}."
|
|
1103
1117
|
projects:
|
|
1118
|
+
create:
|
|
1119
|
+
errors:
|
|
1120
|
+
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."
|
|
1121
|
+
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."
|
|
1122
|
+
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
1123
|
validateProjectConfig:
|
|
1105
1124
|
configNotFound: "Unable to locate a project configuration file. Try running again from a project directory, or run {{ createCommand }} to create a new project."
|
|
1106
1125
|
configMissingFields: "The project configuruation file is missing required fields."
|
|
@@ -1308,12 +1327,9 @@ en:
|
|
|
1308
1327
|
errors:
|
|
1309
1328
|
nameRequired: "A project name is required"
|
|
1310
1329
|
destRequired: "A project dest is required"
|
|
1311
|
-
invalidDest: "
|
|
1330
|
+
invalidDest: "There is an existing project at this destination. Please provide a new path for this project."
|
|
1312
1331
|
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\"]."
|
|
1332
|
+
invalidTemplate: "[--template] Could not find template \"{{ template }}\". Please choose an available template:"
|
|
1317
1333
|
selectPublicAppPrompt:
|
|
1318
1334
|
selectAppIdMigrate: "[--appId] Choose an app under {{ accountName }} to migrate:"
|
|
1319
1335
|
selectAppIdClone: "[--appId] Choose an app under {{ accountName }} to clone:"
|
|
@@ -1331,11 +1347,11 @@ en:
|
|
|
1331
1347
|
projectNotFound: "Your project {{ projectName }} could not be found in {{ accountId }}. Please select a valid project:"
|
|
1332
1348
|
accountIdRequired: "An account ID is required to download a project."
|
|
1333
1349
|
projectAddPrompt:
|
|
1334
|
-
selectType: "[--type] Select
|
|
1350
|
+
selectType: "[--type] Select a component to add: "
|
|
1335
1351
|
enterName: "[--name] Give your component a name: "
|
|
1336
1352
|
errors:
|
|
1337
1353
|
nameRequired: "A component name is required"
|
|
1338
|
-
invalidType: "[--type] Could not find type {{ type }}. Please choose an available type
|
|
1354
|
+
invalidType: "[--type] Could not find type \"{{ type }}\". Please choose an available type:"
|
|
1339
1355
|
secretPrompt:
|
|
1340
1356
|
enterValue: "Enter a value for your secret: "
|
|
1341
1357
|
enterName: "Enter a name for your secret: "
|
|
@@ -1559,6 +1575,9 @@ en:
|
|
|
1559
1575
|
defaultAccountSubHeader: "Default Account: {{accountDetails}}"
|
|
1560
1576
|
noConfigFile: "CLI configuration not found"
|
|
1561
1577
|
noConfigFileSecondary: "Run {{command}} and follow the prompts to create your CLI configuration file and connect it to your HubSpot account"
|
|
1578
|
+
settings:
|
|
1579
|
+
httpUseLocalhost: "The setting {{#bold}}httpUseLocalhost{{/bold}} is enabled"
|
|
1580
|
+
httpUseLocalhostSecondary: "This setting causes all CLI requests to route to localhost"
|
|
1562
1581
|
projectConfig:
|
|
1563
1582
|
header: "Project configuration"
|
|
1564
1583
|
projectDirSubHeader: "Project dir: {{#bold}}{{ projectDir }}{{/bold}}"
|
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: {
|
package/lib/buildAccount.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
|
|
2
1
|
import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
3
2
|
import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
4
3
|
import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
5
4
|
import { SandboxResponse } from '@hubspot/local-dev-lib/types/Sandbox';
|
|
5
|
+
import { SandboxAccountType } from '../types/Sandboxes';
|
|
6
6
|
export declare function saveAccountToConfig(accountId: number | undefined, accountName: string, env: Environment, personalAccessKey?: string, force?: boolean): Promise<string>;
|
|
7
7
|
export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: CLIAccount, env: Environment, portalLimit: number): Promise<DeveloperTestAccount>;
|
|
8
|
-
type SandboxType = typeof HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX | typeof HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX;
|
|
9
8
|
type SandboxAccount = SandboxResponse & {
|
|
10
9
|
name: string;
|
|
11
10
|
};
|
|
12
|
-
export declare function buildSandbox(sandboxName: string, parentAccountConfig: CLIAccount, sandboxType:
|
|
11
|
+
export declare function buildSandbox(sandboxName: string, parentAccountConfig: CLIAccount, sandboxType: SandboxAccountType, env: Environment, force?: boolean): Promise<SandboxAccount>;
|
|
13
12
|
export {};
|
package/lib/constants.d.ts
CHANGED
|
@@ -3,9 +3,6 @@ export declare const DEFAULT_PROJECT_TEMPLATE_BRANCH: "main";
|
|
|
3
3
|
export declare const FEEDBACK_INTERVAL: 10;
|
|
4
4
|
export declare const HUBSPOT_FOLDER: "@hubspot";
|
|
5
5
|
export declare const MARKETPLACE_FOLDER: "@marketplace";
|
|
6
|
-
export declare const CONFIG_FLAGS: {
|
|
7
|
-
readonly USE_CUSTOM_OBJECT_HUBFILE: "useCustomObjectHubfile";
|
|
8
|
-
};
|
|
9
6
|
export declare const DEFAULT_POLLING_DELAY = 2000;
|
|
10
7
|
export declare const PROJECT_CONFIG_FILE: "hsproject.json";
|
|
11
8
|
export declare const PROJECT_BUILD_STATES: {
|
package/lib/constants.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PLATFORM_VERSION_ERROR_TYPES = exports.PROJECT_COMPONENT_TYPES = exports.PROJECT_TASK_TYPES = exports.PROJECT_ERROR_TYPES = exports.PROJECT_DEPLOY_TEXT = exports.PROJECT_BUILD_TEXT = exports.PROJECT_DEPLOY_STATES = exports.PROJECT_BUILD_STATES = exports.PROJECT_CONFIG_FILE = exports.DEFAULT_POLLING_DELAY = exports.
|
|
3
|
+
exports.PLATFORM_VERSION_ERROR_TYPES = exports.PROJECT_COMPONENT_TYPES = exports.PROJECT_TASK_TYPES = exports.PROJECT_ERROR_TYPES = exports.PROJECT_DEPLOY_TEXT = exports.PROJECT_BUILD_TEXT = exports.PROJECT_DEPLOY_STATES = exports.PROJECT_BUILD_STATES = exports.PROJECT_CONFIG_FILE = exports.DEFAULT_POLLING_DELAY = exports.MARKETPLACE_FOLDER = exports.HUBSPOT_FOLDER = exports.FEEDBACK_INTERVAL = exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = void 0;
|
|
4
4
|
exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = 'HubSpot/hubspot-project-components';
|
|
5
5
|
exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = 'main';
|
|
6
6
|
exports.FEEDBACK_INTERVAL = 10;
|
|
7
7
|
exports.HUBSPOT_FOLDER = '@hubspot';
|
|
8
8
|
exports.MARKETPLACE_FOLDER = '@marketplace';
|
|
9
|
-
exports.CONFIG_FLAGS = {
|
|
10
|
-
USE_CUSTOM_OBJECT_HUBFILE: 'useCustomObjectHubfile',
|
|
11
|
-
};
|
|
12
9
|
exports.DEFAULT_POLLING_DELAY = 2000;
|
|
13
10
|
exports.PROJECT_CONFIG_FILE = 'hsproject.json';
|
|
14
11
|
exports.PROJECT_BUILD_STATES = {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSchemaDefinition = isSchemaDefinition;
|
|
4
|
+
exports.isObjectDefinition = isObjectDefinition;
|
|
5
|
+
function isSchemaDefinition(schema) {
|
|
6
|
+
return (typeof schema === 'object' &&
|
|
7
|
+
schema !== null &&
|
|
8
|
+
'labels' in schema &&
|
|
9
|
+
'name' in schema &&
|
|
10
|
+
'properties' in schema &&
|
|
11
|
+
'requiredProperties' in schema);
|
|
12
|
+
}
|
|
13
|
+
function isObjectDefinition(object) {
|
|
14
|
+
return typeof object === 'object' && object !== null && 'inputs' in object;
|
|
15
|
+
}
|
|
@@ -21,6 +21,9 @@ export interface DiagnosticInfo extends FilesInfo {
|
|
|
21
21
|
npm: string | null;
|
|
22
22
|
};
|
|
23
23
|
config: string | null;
|
|
24
|
+
configSettings: {
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
};
|
|
24
27
|
project: {
|
|
25
28
|
details?: Project;
|
|
26
29
|
config?: ProjectConfig;
|
|
@@ -41,6 +44,9 @@ export interface DiagnosticInfo extends FilesInfo {
|
|
|
41
44
|
}
|
|
42
45
|
export declare class DiagnosticInfoBuilder {
|
|
43
46
|
accountId: number | null;
|
|
47
|
+
readonly configSettings: {
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
};
|
|
44
50
|
readonly env?: Environment;
|
|
45
51
|
readonly authType?: AuthType;
|
|
46
52
|
readonly accountType?: AccountType;
|
|
@@ -27,6 +27,7 @@ const configFiles = [
|
|
|
27
27
|
];
|
|
28
28
|
class DiagnosticInfoBuilder {
|
|
29
29
|
accountId;
|
|
30
|
+
configSettings;
|
|
30
31
|
env;
|
|
31
32
|
authType;
|
|
32
33
|
accountType;
|
|
@@ -39,6 +40,9 @@ class DiagnosticInfoBuilder {
|
|
|
39
40
|
constructor(processInfo) {
|
|
40
41
|
this.accountId = (0, config_1.getAccountId)();
|
|
41
42
|
const accountConfig = (0, config_2.getAccountConfig)(this.accountId);
|
|
43
|
+
this.configSettings = {
|
|
44
|
+
httpUseLocalhost: (0, config_1.isConfigFlagEnabled)('httpUseLocalhost'),
|
|
45
|
+
};
|
|
42
46
|
this.env = accountConfig?.env;
|
|
43
47
|
this.authType = accountConfig?.authType;
|
|
44
48
|
this.accountType = accountConfig?.accountType;
|
|
@@ -60,6 +64,7 @@ class DiagnosticInfoBuilder {
|
|
|
60
64
|
arch,
|
|
61
65
|
path: mainModule?.path,
|
|
62
66
|
config: (0, config_2.getConfigPath)(),
|
|
67
|
+
configSettings: this.configSettings,
|
|
63
68
|
versions: {
|
|
64
69
|
[hubspotCli]: package_json_1.default.version,
|
|
65
70
|
node,
|
package/lib/doctor/Doctor.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare class Doctor {
|
|
|
10
10
|
private performCliChecks;
|
|
11
11
|
private performProjectChecks;
|
|
12
12
|
private performCliConfigChecks;
|
|
13
|
+
private performCliConfigSettingsChecks;
|
|
13
14
|
private checkIfAccessTokenValid;
|
|
14
15
|
private checkIfNodeIsInstalled;
|
|
15
16
|
private checkIfNpmIsInstalled;
|
package/lib/doctor/Doctor.js
CHANGED
|
@@ -51,6 +51,7 @@ class Doctor {
|
|
|
51
51
|
...this.performCliConfigChecks(),
|
|
52
52
|
...(this.projectConfig?.projectConfig ? this.performProjectChecks() : []),
|
|
53
53
|
]);
|
|
54
|
+
this.performCliConfigSettingsChecks();
|
|
54
55
|
SpinniesManager_1.default.succeed('runningDiagnostics', {
|
|
55
56
|
text: i18n(`${i18nKey}.diagnosticsComplete`),
|
|
56
57
|
succeedColor: 'white',
|
|
@@ -87,6 +88,15 @@ class Doctor {
|
|
|
87
88
|
}
|
|
88
89
|
return [this.checkIfAccessTokenValid()];
|
|
89
90
|
}
|
|
91
|
+
performCliConfigSettingsChecks() {
|
|
92
|
+
if (this.diagnosticInfo?.configSettings.httpUseLocalhost) {
|
|
93
|
+
this.diagnosis?.addCLIConfigSection({
|
|
94
|
+
type: 'warning',
|
|
95
|
+
message: i18n(`${i18nKey}.diagnosis.cliConfig.settings.httpUseLocalhost`),
|
|
96
|
+
secondaryMessaging: i18n(`${i18nKey}.diagnosis.cliConfig.settings.httpUseLocalhostSecondary`),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
90
100
|
async checkIfAccessTokenValid() {
|
|
91
101
|
const localI18nKey = `${i18nKey}.accountChecks`;
|
|
92
102
|
try {
|
package/lib/localDev.d.ts
CHANGED
|
@@ -3,12 +3,13 @@ import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
|
3
3
|
import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
4
4
|
import { Project } from '@hubspot/local-dev-lib/types/Project';
|
|
5
5
|
import { ProjectConfig } from '../types/Projects';
|
|
6
|
+
import { ProjectDevTargetAccountPromptResponse } from '../types/Prompts';
|
|
6
7
|
import { Build } from '@hubspot/local-dev-lib/types/Build';
|
|
7
8
|
export declare function confirmDefaultAccountIsTarget(accountConfig: CLIAccount): Promise<void>;
|
|
8
9
|
export declare function checkIfDefaultAccountIsSupported(accountConfig: CLIAccount, hasPublicApps: boolean): void;
|
|
9
10
|
export declare function checkIfParentAccountIsAuthed(accountConfig: CLIAccount): void;
|
|
10
11
|
export declare function checkIfAccountFlagIsSupported(accountConfig: CLIAccount, hasPublicApps: boolean): void;
|
|
11
|
-
export declare function suggestRecommendedNestedAccount(accounts: CLIAccount[], accountConfig: CLIAccount, hasPublicApps: boolean): Promise<
|
|
12
|
+
export declare function suggestRecommendedNestedAccount(accounts: CLIAccount[], accountConfig: CLIAccount, hasPublicApps: boolean): Promise<ProjectDevTargetAccountPromptResponse>;
|
|
12
13
|
export declare function createSandboxForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment): Promise<number>;
|
|
13
14
|
export declare function createDeveloperTestAccountForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment): Promise<number>;
|
|
14
15
|
export declare function useExistingDevTestAccount(env: Environment, account: DeveloperTestAccount): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetValidationResultsResponse } from '@hubspot/local-dev-lib/types/MarketplaceValidation';
|
|
2
2
|
export declare function kickOffValidation(accountId: number, assetType: string, src: string): Promise<number>;
|
|
3
|
-
export declare function pollForValidationFinish(accountId: number, validationId:
|
|
4
|
-
export declare function fetchValidationResults(accountId: number, validationId:
|
|
3
|
+
export declare function pollForValidationFinish(accountId: number, validationId: number): Promise<void>;
|
|
4
|
+
export declare function fetchValidationResults(accountId: number, validationId: number): Promise<GetValidationResultsResponse>;
|
|
5
5
|
export declare function processValidationErrors(i18nKey: string, validationResults: GetValidationResultsResponse): void;
|
|
6
6
|
export declare function displayValidationResults(i18nKey: string, validationResults: GetValidationResultsResponse): void;
|
package/lib/process.d.ts
CHANGED
package/lib/process.js
CHANGED
|
@@ -3,24 +3,25 @@ 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.TERMINATION_SIGNALS = void 0;
|
|
6
7
|
exports.handleExit = handleExit;
|
|
7
8
|
exports.handleKeypress = handleKeypress;
|
|
8
9
|
const readline_1 = __importDefault(require("readline"));
|
|
9
10
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
11
|
const lang_1 = require("./lang");
|
|
11
12
|
const i18nKey = 'lib.process';
|
|
13
|
+
exports.TERMINATION_SIGNALS = [
|
|
14
|
+
'beforeExit',
|
|
15
|
+
'SIGINT', // Terminal trying to interrupt (Ctrl + C)
|
|
16
|
+
'SIGUSR1', // Start Debugger User-defined signal 1
|
|
17
|
+
'SIGUSR2', // User-defined signal 2
|
|
18
|
+
'uncaughtException',
|
|
19
|
+
'SIGTERM', // Represents a graceful termination
|
|
20
|
+
'SIGHUP', // Parent terminal has been closed
|
|
21
|
+
];
|
|
12
22
|
function handleExit(callback) {
|
|
13
|
-
const terminationSignals = [
|
|
14
|
-
'beforeExit',
|
|
15
|
-
'SIGINT', // Terminal trying to interrupt (Ctrl + C)
|
|
16
|
-
'SIGUSR1', // Start Debugger User-defined signal 1
|
|
17
|
-
'SIGUSR2', // User-defined signal 2
|
|
18
|
-
'uncaughtException',
|
|
19
|
-
'SIGTERM', // Represents a graceful termination
|
|
20
|
-
'SIGHUP', // Parent terminal has been closed
|
|
21
|
-
];
|
|
22
23
|
let exitInProgress = false;
|
|
23
|
-
|
|
24
|
+
exports.TERMINATION_SIGNALS.forEach(signal => {
|
|
24
25
|
process.removeAllListeners(signal);
|
|
25
26
|
process.on(signal, async () => {
|
|
26
27
|
// Prevent duplicate exit handling
|
|
@@ -24,8 +24,11 @@ function useV3Api(platformVersion) {
|
|
|
24
24
|
if (!platformVersion || typeof platformVersion !== 'string') {
|
|
25
25
|
return false;
|
|
26
26
|
}
|
|
27
|
+
if (platformVersion.toLowerCase() === 'unstable') {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
27
30
|
const [year, minor] = platformVersion.split('.');
|
|
28
|
-
return Number(year) >= 2025 && Number(minor) >=
|
|
31
|
+
return Number(year) >= 2025 && Number(minor) >= 2;
|
|
29
32
|
}
|
|
30
33
|
function getSubtasks(task) {
|
|
31
34
|
if ('subbuildStatuses' in task) {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RepoPath } from '@hubspot/local-dev-lib/types/Github';
|
|
2
|
+
import { ProjectTemplate, ComponentTemplate } from '../../types/Projects';
|
|
3
|
+
export declare const EMPTY_PROJECT_TEMPLATE_NAME = "no-template";
|
|
4
|
+
export declare function getProjectComponentListFromRepo(githubRef: string): Promise<ComponentTemplate[]>;
|
|
5
|
+
export declare function getProjectTemplateListFromRepo(templateSource: RepoPath, githubRef: string): Promise<ProjectTemplate[]>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EMPTY_PROJECT_TEMPLATE_NAME = void 0;
|
|
4
|
+
exports.getProjectComponentListFromRepo = getProjectComponentListFromRepo;
|
|
5
|
+
exports.getProjectTemplateListFromRepo = getProjectTemplateListFromRepo;
|
|
6
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
|
+
const github_1 = require("@hubspot/local-dev-lib/api/github");
|
|
8
|
+
const constants_1 = require("../constants");
|
|
9
|
+
const exitCodes_1 = require("../enums/exitCodes");
|
|
10
|
+
const lang_1 = require("../lang");
|
|
11
|
+
const index_1 = require("../errorHandlers/index");
|
|
12
|
+
const i18nKey = 'lib.projects.create';
|
|
13
|
+
exports.EMPTY_PROJECT_TEMPLATE_NAME = 'no-template';
|
|
14
|
+
const PROJECT_TEMPLATE_PROPERTIES = ['name', 'label', 'path', 'insertPath'];
|
|
15
|
+
async function getProjectComponentListFromRepo(githubRef) {
|
|
16
|
+
let config;
|
|
17
|
+
try {
|
|
18
|
+
const { data } = await (0, github_1.fetchRepoFile)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'config.json', githubRef);
|
|
19
|
+
config = data;
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
(0, index_1.debugError)(err);
|
|
23
|
+
}
|
|
24
|
+
if (config) {
|
|
25
|
+
return config[constants_1.PROJECT_COMPONENT_TYPES.COMPONENTS] || [];
|
|
26
|
+
}
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
async function getProjectTemplateListFromRepo(templateSource, githubRef) {
|
|
30
|
+
let config;
|
|
31
|
+
try {
|
|
32
|
+
const { data } = await (0, github_1.fetchRepoFile)(templateSource, 'config.json', githubRef);
|
|
33
|
+
config = data;
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
(0, index_1.debugError)(e);
|
|
37
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.missingConfigFileTemplateSource`));
|
|
38
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
39
|
+
}
|
|
40
|
+
if (!config || !config[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS]) {
|
|
41
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.noProjectsInConfig`));
|
|
42
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
43
|
+
}
|
|
44
|
+
const templates = config[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS];
|
|
45
|
+
const templatesContainAllProperties = templates.every(config => PROJECT_TEMPLATE_PROPERTIES.every(p => Object.prototype.hasOwnProperty.call(config, p)));
|
|
46
|
+
if (!templatesContainAllProperties) {
|
|
47
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.errors.missingPropertiesInConfig`));
|
|
48
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
49
|
+
}
|
|
50
|
+
return templates;
|
|
51
|
+
}
|
package/lib/projects/index.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { RepoPath } from '@hubspot/local-dev-lib/types/Github';
|
|
2
1
|
import { Project } from '@hubspot/local-dev-lib/types/Project';
|
|
3
|
-
import {
|
|
2
|
+
import { ProjectConfig } from '../../types/Projects';
|
|
4
3
|
export declare function writeProjectConfig(configPath: string, config: ProjectConfig): boolean;
|
|
5
4
|
export declare function getIsInProject(dir?: string): boolean;
|
|
6
5
|
export declare function getProjectConfig(dir?: string): Promise<{
|
|
7
6
|
projectDir: string | null;
|
|
8
7
|
projectConfig: ProjectConfig | null;
|
|
9
8
|
}>;
|
|
10
|
-
export declare function createProjectConfig(projectPath: string, projectName: string, template: ProjectTemplate, templateSource: RepoPath, githubRef: string): Promise<boolean>;
|
|
11
9
|
export declare function validateProjectConfig(projectConfig: ProjectConfig, projectDir: string): void;
|
|
12
10
|
export declare function ensureProjectExists(accountId: number, projectName: string, { forceCreate, allowCreate, noLogs, withPolling, uploadCommand, }?: {
|
|
13
11
|
forceCreate?: boolean | undefined;
|
|
@@ -20,5 +18,3 @@ export declare function ensureProjectExists(accountId: number, projectName: stri
|
|
|
20
18
|
project?: Project;
|
|
21
19
|
}>;
|
|
22
20
|
export declare function logFeedbackMessage(buildId: number): void;
|
|
23
|
-
export declare function createProjectComponent(component: ProjectAddComponentData, name: string, projectComponentsVersion: string): Promise<void>;
|
|
24
|
-
export declare function getProjectComponentsByVersion(projectComponentsVersion: string): Promise<ComponentTemplate[]>;
|
package/lib/projects/index.js
CHANGED
|
@@ -6,17 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.writeProjectConfig = writeProjectConfig;
|
|
7
7
|
exports.getIsInProject = getIsInProject;
|
|
8
8
|
exports.getProjectConfig = getProjectConfig;
|
|
9
|
-
exports.createProjectConfig = createProjectConfig;
|
|
10
9
|
exports.validateProjectConfig = validateProjectConfig;
|
|
11
10
|
exports.ensureProjectExists = ensureProjectExists;
|
|
12
11
|
exports.logFeedbackMessage = logFeedbackMessage;
|
|
13
|
-
exports.createProjectComponent = createProjectComponent;
|
|
14
|
-
exports.getProjectComponentsByVersion = getProjectComponentsByVersion;
|
|
15
12
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
16
13
|
const path_1 = __importDefault(require("path"));
|
|
17
14
|
const findup_sync_1 = __importDefault(require("findup-sync"));
|
|
18
15
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
19
|
-
const github_1 = require("@hubspot/local-dev-lib/github");
|
|
20
16
|
const projects_1 = require("@hubspot/local-dev-lib/api/projects");
|
|
21
17
|
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
22
18
|
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
@@ -53,7 +49,7 @@ function getProjectConfigPath(dir) {
|
|
|
53
49
|
return configPath;
|
|
54
50
|
}
|
|
55
51
|
async function getProjectConfig(dir) {
|
|
56
|
-
const configPath =
|
|
52
|
+
const configPath = getProjectConfigPath(dir);
|
|
57
53
|
if (!configPath) {
|
|
58
54
|
return { projectConfig: null, projectDir: null };
|
|
59
55
|
}
|
|
@@ -70,45 +66,6 @@ async function getProjectConfig(dir) {
|
|
|
70
66
|
return { projectConfig: null, projectDir: null };
|
|
71
67
|
}
|
|
72
68
|
}
|
|
73
|
-
async function createProjectConfig(projectPath, projectName, template, templateSource, githubRef) {
|
|
74
|
-
const { projectConfig, projectDir } = await getProjectConfig(projectPath);
|
|
75
|
-
if (projectConfig) {
|
|
76
|
-
logger_1.logger.warn(projectPath === projectDir
|
|
77
|
-
? 'A project already exists in that location.'
|
|
78
|
-
: `Found an existing project definition in ${projectDir}.`);
|
|
79
|
-
const { shouldContinue } = await (0, promptUtils_1.promptUser)([
|
|
80
|
-
{
|
|
81
|
-
name: 'shouldContinue',
|
|
82
|
-
message: () => {
|
|
83
|
-
return projectPath === projectDir
|
|
84
|
-
? 'Do you want to overwrite the existing project definition with a new one?'
|
|
85
|
-
: `Continue creating a new project in ${projectPath}?`;
|
|
86
|
-
},
|
|
87
|
-
type: 'confirm',
|
|
88
|
-
default: false,
|
|
89
|
-
},
|
|
90
|
-
]);
|
|
91
|
-
if (!shouldContinue) {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
const projectConfigPath = path_1.default.join(projectPath, constants_1.PROJECT_CONFIG_FILE);
|
|
96
|
-
logger_1.logger.log(`Creating project config in ${projectPath ? projectPath : 'the current folder'}`);
|
|
97
|
-
const hasCustomTemplateSource = Boolean(templateSource);
|
|
98
|
-
await (0, github_1.cloneGithubRepo)(templateSource || constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, projectPath, {
|
|
99
|
-
sourceDir: template.path,
|
|
100
|
-
tag: hasCustomTemplateSource ? undefined : githubRef,
|
|
101
|
-
});
|
|
102
|
-
const _config = JSON.parse(fs_extra_1.default.readFileSync(projectConfigPath).toString());
|
|
103
|
-
writeProjectConfig(projectConfigPath, {
|
|
104
|
-
..._config,
|
|
105
|
-
name: projectName,
|
|
106
|
-
});
|
|
107
|
-
if (template.name === 'no-template') {
|
|
108
|
-
fs_extra_1.default.ensureDirSync(path_1.default.join(projectPath, 'src'));
|
|
109
|
-
}
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
69
|
function validateProjectConfig(projectConfig, projectDir) {
|
|
113
70
|
if (!projectConfig) {
|
|
114
71
|
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.validateProjectConfig.configNotFound`, {
|
|
@@ -235,21 +192,3 @@ function logFeedbackMessage(buildId) {
|
|
|
235
192
|
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.logFeedbackMessage.feedbackMessage`));
|
|
236
193
|
}
|
|
237
194
|
}
|
|
238
|
-
async function createProjectComponent(component, name, projectComponentsVersion) {
|
|
239
|
-
const i18nKey = 'commands.project.subcommands.add';
|
|
240
|
-
const componentName = name;
|
|
241
|
-
const configInfo = await getProjectConfig();
|
|
242
|
-
if (!configInfo.projectDir || !configInfo.projectConfig) {
|
|
243
|
-
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.error.locationInProject`));
|
|
244
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
245
|
-
}
|
|
246
|
-
const componentPath = path_1.default.join(configInfo.projectDir, configInfo.projectConfig.srcDir, component.insertPath, componentName);
|
|
247
|
-
await (0, github_1.cloneGithubRepo)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, componentPath, {
|
|
248
|
-
sourceDir: component.path,
|
|
249
|
-
tag: projectComponentsVersion,
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
async function getProjectComponentsByVersion(projectComponentsVersion) {
|
|
253
|
-
const config = await (0, github_1.fetchFileFromRepository)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'config.json', projectComponentsVersion);
|
|
254
|
-
return config[constants_1.PROJECT_COMPONENT_TYPES.COMPONENTS] || [];
|
|
255
|
-
}
|