@hubspot/cli 7.3.0 → 7.4.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/bin/cli.js +2 -0
- package/commands/app/migrate.d.ts +7 -0
- package/commands/app/migrate.js +94 -0
- package/commands/app.d.ts +6 -0
- package/commands/app.js +23 -0
- package/commands/project/cloneApp.d.ts +9 -1
- package/commands/project/cloneApp.js +91 -76
- package/commands/project/create.js +0 -1
- package/commands/project/migrateApp.d.ts +9 -1
- package/commands/project/migrateApp.js +43 -170
- package/lang/en.js +1 -6
- package/lang/en.lyaml +32 -4
- package/lib/DevServerManagerV2.d.ts +2 -1
- package/lib/DevServerManagerV2.js +2 -1
- package/lib/LocalDevManagerV2.js +15 -10
- package/lib/app/migrate.d.ts +7 -0
- package/lib/app/migrate.js +345 -0
- package/lib/polling.d.ts +4 -0
- package/lib/polling.js +3 -3
- package/lib/projects/structure.d.ts +2 -1
- package/lib/projects/structure.js +4 -0
- package/lib/prompts/promptUtils.d.ts +6 -4
- package/lib/prompts/promptUtils.js +3 -1
- package/lib/ui/index.d.ts +2 -2
- package/lib/ui/index.js +6 -5
- package/package.json +3 -3
- package/types/ProjectComponents.d.ts +15 -0
- package/types/Prompts.d.ts +2 -2
- package/types/Yargs.d.ts +10 -0
|
@@ -1,188 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const { uiBetaTag, uiLine, uiLink, uiCommandReference, uiAccountDescription, } = require('../../lib/ui');
|
|
12
|
-
const SpinniesManager = require('../../lib/ui/SpinniesManager');
|
|
13
|
-
const { logError, ApiErrorContext } = require('../../lib/errorHandlers/index');
|
|
14
|
-
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
15
|
-
const { promptUser } = require('../../lib/prompts/promptUtils');
|
|
16
|
-
const { isAppDeveloperAccount } = require('../../lib/accountTypes');
|
|
17
|
-
const { ensureProjectExists } = require('../../lib/projects');
|
|
18
|
-
const { handleKeypress } = require('../../lib/process');
|
|
19
|
-
const { migrateApp, checkMigrationStatus, } = require('@hubspot/local-dev-lib/api/projects');
|
|
20
|
-
const { getCwd, sanitizeFileName } = require('@hubspot/local-dev-lib/path');
|
|
21
|
-
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
22
|
-
const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
|
|
23
|
-
const { downloadProject } = require('@hubspot/local-dev-lib/api/projects');
|
|
24
|
-
const { extractZipArchive } = require('@hubspot/local-dev-lib/archive');
|
|
25
|
-
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
|
|
26
|
-
const { fetchPublicAppMetadata, } = require('@hubspot/local-dev-lib/api/appsDev');
|
|
27
|
-
const i18nKey = 'commands.project.subcommands.migrateApp';
|
|
3
|
+
exports.deprecated = exports.describe = exports.command = void 0;
|
|
4
|
+
exports.handler = handler;
|
|
5
|
+
exports.builder = builder;
|
|
6
|
+
const lang_1 = require("../../lib/lang");
|
|
7
|
+
const ui_1 = require("../../lib/ui");
|
|
8
|
+
const migrate_1 = require("../app/migrate");
|
|
9
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
|
+
const commonOpts_1 = require("../../lib/commonOpts");
|
|
28
11
|
exports.command = 'migrate-app';
|
|
29
|
-
|
|
30
|
-
exports.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
useCommand: uiCommandReference('hs accounts use'),
|
|
44
|
-
authCommand: uiCommandReference('hs auth'),
|
|
45
|
-
}));
|
|
46
|
-
uiLine();
|
|
47
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
48
|
-
}
|
|
49
|
-
const { appId } = 'appId' in options
|
|
50
|
-
? options
|
|
51
|
-
: await selectPublicAppPrompt({
|
|
52
|
-
accountId: derivedAccountId,
|
|
53
|
-
accountName,
|
|
54
|
-
isMigratingApp: true,
|
|
55
|
-
});
|
|
56
|
-
try {
|
|
57
|
-
const { data: selectedApp } = await fetchPublicAppMetadata(appId, derivedAccountId);
|
|
58
|
-
// preventProjectMigrations returns true if we have not added app to allowlist config.
|
|
59
|
-
// listingInfo will only exist for marketplace apps
|
|
60
|
-
const preventProjectMigrations = selectedApp.preventProjectMigrations;
|
|
61
|
-
const listingInfo = selectedApp.listingInfo;
|
|
62
|
-
if (preventProjectMigrations && listingInfo) {
|
|
63
|
-
logger.error(i18n(`${i18nKey}.errors.invalidApp`, { appId }));
|
|
64
|
-
process.exit(EXIT_CODES.ERROR);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
logError(error, new ApiErrorContext({ accountId: derivedAccountId }));
|
|
69
|
-
process.exit(EXIT_CODES.ERROR);
|
|
70
|
-
}
|
|
71
|
-
let projectName;
|
|
72
|
-
let projectDest;
|
|
73
|
-
try {
|
|
74
|
-
const createProjectPromptResponse = await createProjectPrompt(options);
|
|
75
|
-
projectName = createProjectPromptResponse.name;
|
|
76
|
-
projectDest = createProjectPromptResponse.dest;
|
|
77
|
-
const { projectExists } = await ensureProjectExists(derivedAccountId, projectName, {
|
|
78
|
-
allowCreate: false,
|
|
79
|
-
noLogs: true,
|
|
80
|
-
});
|
|
81
|
-
if (projectExists) {
|
|
82
|
-
logger.error(i18n(`${i18nKey}.errors.projectAlreadyExists`, {
|
|
83
|
-
projectName,
|
|
84
|
-
}));
|
|
85
|
-
process.exit(EXIT_CODES.ERROR);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
logError(error, new ApiErrorContext({ accountId: derivedAccountId }));
|
|
90
|
-
process.exit(EXIT_CODES.ERROR);
|
|
91
|
-
}
|
|
92
|
-
await trackCommandMetadataUsage('migrate-app', { status: 'STARTED' }, derivedAccountId);
|
|
93
|
-
logger.log('');
|
|
94
|
-
uiLine();
|
|
95
|
-
logger.warn(i18n(`${i18nKey}.warning.title`));
|
|
96
|
-
logger.log('');
|
|
97
|
-
logger.log(i18n(`${i18nKey}.warning.projectConversion`));
|
|
98
|
-
logger.log(i18n(`${i18nKey}.warning.appConfig`));
|
|
99
|
-
logger.log('');
|
|
100
|
-
logger.log(i18n(`${i18nKey}.warning.buildAndDeploy`));
|
|
101
|
-
logger.log('');
|
|
102
|
-
logger.log(i18n(`${i18nKey}.warning.existingApps`));
|
|
103
|
-
logger.log('');
|
|
104
|
-
logger.log(i18n(`${i18nKey}.warning.copyApp`));
|
|
105
|
-
uiLine();
|
|
106
|
-
const { shouldCreateApp } = await promptUser({
|
|
107
|
-
name: 'shouldCreateApp',
|
|
108
|
-
type: 'confirm',
|
|
109
|
-
message: i18n(`${i18nKey}.createAppPrompt`),
|
|
110
|
-
});
|
|
111
|
-
process.stdin.resume();
|
|
112
|
-
if (!shouldCreateApp) {
|
|
113
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
114
|
-
}
|
|
115
|
-
try {
|
|
116
|
-
SpinniesManager.init();
|
|
117
|
-
SpinniesManager.add('migrateApp', {
|
|
118
|
-
text: i18n(`${i18nKey}.migrationStatus.inProgress`),
|
|
119
|
-
});
|
|
120
|
-
handleKeypress(async (key) => {
|
|
121
|
-
if ((key.ctrl && key.name === 'c') || key.name === 'q') {
|
|
122
|
-
SpinniesManager.remove('migrateApp');
|
|
123
|
-
logger.log(i18n(`${i18nKey}.migrationInterrupted`));
|
|
124
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
const { data: migrateResponse } = await migrateApp(derivedAccountId, appId, projectName);
|
|
128
|
-
const { id } = migrateResponse;
|
|
129
|
-
const pollResponse = await poll(() => checkMigrationStatus(derivedAccountId, id));
|
|
130
|
-
const { status, project } = pollResponse;
|
|
131
|
-
if (status === 'SUCCESS') {
|
|
132
|
-
const absoluteDestPath = path.resolve(getCwd(), projectDest);
|
|
133
|
-
const { env } = accountConfig;
|
|
134
|
-
const baseUrl = getHubSpotWebsiteOrigin(env);
|
|
135
|
-
const { data: zippedProject } = await downloadProject(derivedAccountId, projectName, 1);
|
|
136
|
-
await extractZipArchive(zippedProject, sanitizeFileName(projectName), path.resolve(absoluteDestPath), { includesRootDir: true, hideLogs: true });
|
|
137
|
-
SpinniesManager.succeed('migrateApp', {
|
|
138
|
-
text: i18n(`${i18nKey}.migrationStatus.done`),
|
|
139
|
-
succeedColor: 'white',
|
|
140
|
-
});
|
|
141
|
-
logger.log('');
|
|
142
|
-
uiLine();
|
|
143
|
-
logger.success(i18n(`${i18nKey}.migrationStatus.success`));
|
|
144
|
-
logger.log('');
|
|
145
|
-
logger.log(uiLink(i18n(`${i18nKey}.projectDetailsLink`), `${baseUrl}/developer-projects/${derivedAccountId}/project/${encodeURIComponent(project.name)}`));
|
|
146
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
catch (error) {
|
|
150
|
-
await trackCommandMetadataUsage('migrate-app', { status: 'FAILURE' }, derivedAccountId);
|
|
151
|
-
SpinniesManager.fail('migrateApp', {
|
|
152
|
-
text: i18n(`${i18nKey}.migrationStatus.failure`),
|
|
153
|
-
failColor: 'white',
|
|
154
|
-
});
|
|
155
|
-
if (error.errors) {
|
|
156
|
-
error.errors.forEach(logError);
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
logError(error, new ApiErrorContext({ accountId: derivedAccountId }));
|
|
160
|
-
}
|
|
161
|
-
process.exit(EXIT_CODES.ERROR);
|
|
162
|
-
}
|
|
163
|
-
await trackCommandMetadataUsage('migrate-app', { status: 'SUCCESS' }, derivedAccountId);
|
|
164
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
165
|
-
};
|
|
166
|
-
exports.builder = yargs => {
|
|
12
|
+
// TODO: Leave this as deprecated and remove in the next major release
|
|
13
|
+
exports.describe = (0, ui_1.uiDeprecatedTag)((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.describe`), false);
|
|
14
|
+
exports.deprecated = true;
|
|
15
|
+
async function handler(yargs) {
|
|
16
|
+
logger_1.logger.warn((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.deprecationWarning`, {
|
|
17
|
+
oldCommand: (0, ui_1.uiCommandReference)('hs project migrate-app'),
|
|
18
|
+
newCommand: (0, ui_1.uiCommandReference)('hs app migrate'),
|
|
19
|
+
}));
|
|
20
|
+
await (0, migrate_1.handler)(yargs);
|
|
21
|
+
}
|
|
22
|
+
function builder(yargs) {
|
|
23
|
+
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
24
|
+
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
25
|
+
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
167
26
|
yargs.options({
|
|
168
27
|
name: {
|
|
169
|
-
describe: i18n(
|
|
28
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.migrateApp.options.name.describe`),
|
|
170
29
|
type: 'string',
|
|
171
30
|
},
|
|
172
31
|
dest: {
|
|
173
|
-
describe: i18n(
|
|
32
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.migrateApp.options.dest.describe`),
|
|
174
33
|
type: 'string',
|
|
175
34
|
},
|
|
176
35
|
'app-id': {
|
|
177
|
-
describe: i18n(
|
|
36
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.migrateApp.options.appId.describe`),
|
|
178
37
|
type: 'number',
|
|
179
38
|
},
|
|
39
|
+
'platform-version': {
|
|
40
|
+
type: 'string',
|
|
41
|
+
choices: migrate_1.validMigrationTargets,
|
|
42
|
+
hidden: true,
|
|
43
|
+
default: '2023.2',
|
|
44
|
+
},
|
|
180
45
|
});
|
|
181
46
|
yargs.example([
|
|
182
|
-
[
|
|
47
|
+
[
|
|
48
|
+
`$0 project migrate-app`,
|
|
49
|
+
(0, lang_1.i18n)(`commands.project.subcommands.migrateApp.examples.default`),
|
|
50
|
+
],
|
|
183
51
|
]);
|
|
184
|
-
addConfigOptions(yargs);
|
|
185
|
-
addAccountOptions(yargs);
|
|
186
|
-
addUseEnvironmentOptions(yargs);
|
|
187
52
|
return yargs;
|
|
53
|
+
}
|
|
54
|
+
const migrateAppCommand = {
|
|
55
|
+
command: exports.command,
|
|
56
|
+
describe: exports.describe,
|
|
57
|
+
deprecated: exports.deprecated,
|
|
58
|
+
handler,
|
|
59
|
+
builder,
|
|
188
60
|
};
|
|
61
|
+
exports.default = migrateAppCommand;
|
package/lang/en.js
CHANGED
|
@@ -2841,7 +2841,7 @@ export const lib = {
|
|
|
2841
2841
|
disabledUrlText: 'See all HubSpot CLI commands here.',
|
|
2842
2842
|
featureHighlight: {
|
|
2843
2843
|
defaultTitle: "What's next?",
|
|
2844
|
-
|
|
2844
|
+
commandKeys: {
|
|
2845
2845
|
accountOption: {
|
|
2846
2846
|
command: '--account',
|
|
2847
2847
|
message: command =>
|
|
@@ -2895,11 +2895,6 @@ export const lib = {
|
|
|
2895
2895
|
message: command =>
|
|
2896
2896
|
`Run ${command} to set up your test environment and start local development`,
|
|
2897
2897
|
},
|
|
2898
|
-
projectInstallDepsCommand: {
|
|
2899
|
-
command: 'hs project install-deps',
|
|
2900
|
-
message: command =>
|
|
2901
|
-
`Run ${command} to install dependencies for your project components`,
|
|
2902
|
-
},
|
|
2903
2898
|
sampleProjects: {
|
|
2904
2899
|
linkText: "HubSpot's sample projects",
|
|
2905
2900
|
url: 'https://developers.hubspot.com/docs/platform/sample-projects?utm_source=cli&utm_content=project_create_whats_next',
|
package/lang/en.lyaml
CHANGED
|
@@ -570,6 +570,7 @@ en:
|
|
|
570
570
|
header:
|
|
571
571
|
text: "Migrate an app to the projects framework"
|
|
572
572
|
link: "Learn more about migrating apps to the projects framework"
|
|
573
|
+
deprecationWarning: "The {{ oldCommand }} command is deprecated and will be removed. Use {{ newCommand }} going forward."
|
|
573
574
|
migrationStatus:
|
|
574
575
|
inProgress: "Converting app configuration to {{#bold}}public-app.json{{/bold}} component definition ..."
|
|
575
576
|
success: "{{#bold}}Your app was converted and build #1 is deployed{{/bold}}"
|
|
@@ -585,11 +586,41 @@ en:
|
|
|
585
586
|
migrationInterrupted: "\nThe command is terminated, but app migration is still in progress. Please check your account to ensure that the project and associated app have been created successfully."
|
|
586
587
|
createAppPrompt: "Proceed with migrating this app to a project component (this process can't be aborted)?"
|
|
587
588
|
projectDetailsLink: "View project details in your developer account"
|
|
589
|
+
componentsToBeMigrated: "The following component types will be migrated: {{ components }}"
|
|
590
|
+
componentsThatWillNotBeMigrated: "[NOTE] These component types are not yet supported for migration but will be available later: {{ components }}"
|
|
588
591
|
errors:
|
|
592
|
+
noApps: "No apps found in account {{ accountId }}"
|
|
593
|
+
noAppsEligible: "No apps in account {{ accountId }} are currently migratable"
|
|
594
|
+
noAccountConfig: "There is no account associated with {{ accountId }} in the config file. Please choose another account and try again, or authenticate {{ accountId }} using {{ authCommand }}."
|
|
589
595
|
invalidAccountTypeTitle: "{{#bold}}Developer account not targeted{{/bold}}"
|
|
590
596
|
invalidAccountTypeDescription: "Only public apps created in a developer account can be converted to a project component. Select a connected developer account with {{useCommand}} or {{authCommand}} and try again."
|
|
591
597
|
projectAlreadyExists: "A project with name {{ projectName }} already exists. Please choose another name."
|
|
592
598
|
invalidApp: "Could not migrate appId {{ appId }}. This app cannot be migrated at this time. Please choose another public app."
|
|
599
|
+
appWithAppIdNotFound: "Could not find an app with the id {{ appId }} "
|
|
600
|
+
prompt:
|
|
601
|
+
chooseApp: 'Which app would you like to migrate?'
|
|
602
|
+
inputName: '[--name] What would you like to name the project?'
|
|
603
|
+
inputDest: '[--dest] Where would you like to save the project?'
|
|
604
|
+
uidForComponent: 'What UID would you like to use for {{ componentName }}?'
|
|
605
|
+
proceed: 'Would you like to proceed?'
|
|
606
|
+
spinners:
|
|
607
|
+
beginningMigration: "Beginning migration"
|
|
608
|
+
migrationStarted: "Migration started"
|
|
609
|
+
unableToStartMigration: "Unable to begin migration"
|
|
610
|
+
finishingMigration: "Wrapping up migration"
|
|
611
|
+
migrationComplete: "Migration completed"
|
|
612
|
+
migrationFailed: "Migration failed"
|
|
613
|
+
downloadingProjectContents: "Downloading migrated project files"
|
|
614
|
+
downloadingProjectContentsComplete: "Migrated project files downloaded"
|
|
615
|
+
downloadingProjectContentsFailed: "Unable to download migrated project files"
|
|
616
|
+
copyingProjectFiles: "Copying migrated project files"
|
|
617
|
+
copyingProjectFilesComplete: "Migrated project files copied"
|
|
618
|
+
copyingProjectFilesFailed: "Unable to copy migrated project files"
|
|
619
|
+
unmigratableReasons:
|
|
620
|
+
upToDate: 'App is already up to date'
|
|
621
|
+
isPrivateApp: 'Private apps are not currently migratable'
|
|
622
|
+
listedInMarketplace: 'Listed apps are not currently migratable'
|
|
623
|
+
generic: "Unable to migrate app: {{ reasonCode }}"
|
|
593
624
|
cloneApp:
|
|
594
625
|
describe: "Clone a public app using the projects framework."
|
|
595
626
|
examples:
|
|
@@ -608,6 +639,7 @@ en:
|
|
|
608
639
|
invalidAccountTypeTitle: "{{#bold}}Developer account not targeted{{/bold}}"
|
|
609
640
|
invalidAccountTypeDescription: "Only public apps created in a developer account can be converted to a project component. Select a connected developer account with {{useCommand}} or {{authCommand}} and try again."
|
|
610
641
|
couldNotWriteConfigPath: "Failed to write project config at {{ configPath }}"
|
|
642
|
+
noAccountConfig: "There is no account associated with {{ accountId }} in the config file. Please choose another account and try again, or authenticate {{ accountId }} using {{ authCommand }}."
|
|
611
643
|
add:
|
|
612
644
|
describe: "Create a new component within a project."
|
|
613
645
|
options:
|
|
@@ -1077,7 +1109,6 @@ en:
|
|
|
1077
1109
|
missingComponents: "Couldn't find the following components in the deployed build for this project: {{#bold}}'{{ missingComponents }}'{{/bold}}. This may cause issues in local development."
|
|
1078
1110
|
defaultWarning: "{{#bold}}Changing project configuration requires a new project build.{{/bold}}"
|
|
1079
1111
|
defaultPublicAppWarning: "{{#bold}}Changing project configuration requires a new project build.{{/bold}}\n\nThis will affect your public app's {{#bold}}{{ installCount }} existing {{ installText }}{{/bold}}. If your app has users in production, we strongly recommend creating a copy of this app to test your changes before proceding."
|
|
1080
|
-
defaultMarketplaceAppWarning: "{{#bold}}Changing project configuration requires creating a new project build.{{/bold}}\n\nYour marketplace app is currently installed in {{#bold}}{{ installCount }} {{ accountText }}{{/bold}}. Any uploaded changes will impact your app's users. We strongly recommend creating a copy of this app to test your changes before proceding."
|
|
1081
1112
|
header: "{{ warning }} To reflect these changes and continue testing:"
|
|
1082
1113
|
stopDev: " * Stop {{ command }}"
|
|
1083
1114
|
runUpload: " * Run {{ command }}"
|
|
@@ -1213,9 +1244,6 @@ en:
|
|
|
1213
1244
|
projectDevCommand:
|
|
1214
1245
|
command: "hs project dev"
|
|
1215
1246
|
message: "Run {{ command }} to set up your test environment and start local development"
|
|
1216
|
-
projectInstallDepsCommand:
|
|
1217
|
-
command: "hs project install-deps"
|
|
1218
|
-
message: "Run {{ command }} to install dependencies for your project components"
|
|
1219
1247
|
projectCommandTip:
|
|
1220
1248
|
message: "Tip: All project commands must be run from within a project directory"
|
|
1221
1249
|
sampleProjects:
|
|
@@ -12,10 +12,11 @@ declare class DevServerManagerV2 {
|
|
|
12
12
|
private devServers;
|
|
13
13
|
constructor();
|
|
14
14
|
iterateDevServers(callback: (serverInterface: DevServerInterface) => Promise<void>): Promise<void>;
|
|
15
|
-
setup({ projectNodes, accountId, setActiveApp, }: {
|
|
15
|
+
setup({ projectNodes, onUploadRequired, accountId, setActiveApp, }: {
|
|
16
16
|
projectNodes: {
|
|
17
17
|
[key: string]: IntermediateRepresentationNodeLocalDev;
|
|
18
18
|
};
|
|
19
|
+
onUploadRequired: () => void;
|
|
19
20
|
accountId: number;
|
|
20
21
|
setActiveApp: (appUid: string | undefined) => Promise<void>;
|
|
21
22
|
}): Promise<void>;
|
|
@@ -20,7 +20,7 @@ class DevServerManagerV2 {
|
|
|
20
20
|
async iterateDevServers(callback) {
|
|
21
21
|
await Promise.all(this.devServers.map(devServer => callback(devServer)));
|
|
22
22
|
}
|
|
23
|
-
async setup({ projectNodes, accountId, setActiveApp, }) {
|
|
23
|
+
async setup({ projectNodes, onUploadRequired, accountId, setActiveApp, }) {
|
|
24
24
|
let env;
|
|
25
25
|
const accountConfig = (0, config_1.getAccountConfig)(accountId);
|
|
26
26
|
if (accountConfig) {
|
|
@@ -31,6 +31,7 @@ class DevServerManagerV2 {
|
|
|
31
31
|
if (serverInterface.setup) {
|
|
32
32
|
await serverInterface.setup({
|
|
33
33
|
components: projectNodes,
|
|
34
|
+
onUploadRequired,
|
|
34
35
|
promptUser: promptUtils_1.promptUser,
|
|
35
36
|
logger: logger_1.logger,
|
|
36
37
|
urls: {
|
package/lib/LocalDevManagerV2.js
CHANGED
|
@@ -10,7 +10,6 @@ const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
|
10
10
|
const localDevAuth_1 = require("@hubspot/local-dev-lib/api/localDevAuth");
|
|
11
11
|
const appsDev_1 = require("@hubspot/local-dev-lib/api/appsDev");
|
|
12
12
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
13
|
-
const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
|
|
14
13
|
const constants_1 = require("./constants");
|
|
15
14
|
const SpinniesManager_1 = __importDefault(require("./ui/SpinniesManager"));
|
|
16
15
|
const DevServerManagerV2_1 = __importDefault(require("./DevServerManagerV2"));
|
|
@@ -213,13 +212,16 @@ class LocalDevManagerV2 {
|
|
|
213
212
|
: (0, ui_1.uiCommandReference)('hs project upload');
|
|
214
213
|
}
|
|
215
214
|
logUploadWarning(reason) {
|
|
216
|
-
let warning
|
|
217
|
-
if (
|
|
215
|
+
let warning;
|
|
216
|
+
if (reason) {
|
|
217
|
+
warning = reason;
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
218
220
|
warning =
|
|
219
221
|
this.publicAppActiveInstalls && this.publicAppActiveInstalls > 0
|
|
220
|
-
? (0, lang_1.i18n)(`${i18nKey}.uploadWarning.
|
|
222
|
+
? (0, lang_1.i18n)(`${i18nKey}.uploadWarning.defaultPublicAppWarning`, {
|
|
221
223
|
installCount: this.publicAppActiveInstalls,
|
|
222
|
-
|
|
224
|
+
installText: this.publicAppActiveInstalls === 1 ? 'install' : 'installs',
|
|
223
225
|
})
|
|
224
226
|
: (0, lang_1.i18n)(`${i18nKey}.uploadWarning.defaultWarning`);
|
|
225
227
|
}
|
|
@@ -266,10 +268,10 @@ class LocalDevManagerV2 {
|
|
|
266
268
|
const deployedComponentNames = this.deployedBuild.subbuildStatuses.map(subbuildStatus => subbuildStatus.buildName);
|
|
267
269
|
const missingProjectNodes = [];
|
|
268
270
|
Object.values(this.projectNodes).forEach(node => {
|
|
269
|
-
if (
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
if ((0, structure_1.isAppIRNode)(node) || (0, structure_1.isCardIRNode)(node)) {
|
|
272
|
+
if (!deployedComponentNames.includes(node.uid)) {
|
|
273
|
+
missingProjectNodes.push(`${(0, lang_1.i18n)(`${i18nKey}.uploadWarning.appLabel`)} ${node.uid}`);
|
|
274
|
+
}
|
|
273
275
|
}
|
|
274
276
|
});
|
|
275
277
|
if (missingProjectNodes.length) {
|
|
@@ -282,7 +284,9 @@ class LocalDevManagerV2 {
|
|
|
282
284
|
this.watcher = chokidar_1.default.watch(this.projectDir, {
|
|
283
285
|
ignoreInitial: true,
|
|
284
286
|
});
|
|
285
|
-
const configPaths = Object.values(this.projectNodes)
|
|
287
|
+
const configPaths = Object.values(this.projectNodes)
|
|
288
|
+
.filter(structure_1.isAppIRNode)
|
|
289
|
+
.map(component => component.localDev.componentConfigPath);
|
|
286
290
|
const projectConfigPath = path_1.default.join(this.projectDir, constants_1.PROJECT_CONFIG_FILE);
|
|
287
291
|
configPaths.push(projectConfigPath);
|
|
288
292
|
this.watcher.on('add', filePath => {
|
|
@@ -313,6 +317,7 @@ class LocalDevManagerV2 {
|
|
|
313
317
|
try {
|
|
314
318
|
await DevServerManagerV2_1.default.setup({
|
|
315
319
|
projectNodes: this.projectNodes,
|
|
320
|
+
onUploadRequired: this.logUploadWarning.bind(this),
|
|
316
321
|
accountId: this.targetTestingAccountId,
|
|
317
322
|
setActiveApp: this.setActiveApp.bind(this),
|
|
318
323
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
2
|
+
import { ArgumentsCamelCase } from 'yargs';
|
|
3
|
+
import { MigrateAppOptions } from '../../types/Yargs';
|
|
4
|
+
export declare function downloadProjectFiles(derivedAccountId: number, projectName: string, buildId: number, projectDest: string): Promise<void>;
|
|
5
|
+
export declare function migrateApp2025_2(derivedAccountId: number, options: ArgumentsCamelCase<MigrateAppOptions>): Promise<void>;
|
|
6
|
+
export declare function logInvalidAccountError(i18nKey: string): void;
|
|
7
|
+
export declare function migrateApp2023_2(derivedAccountId: number, options: ArgumentsCamelCase<MigrateAppOptions>, accountConfig: CLIAccount): Promise<void>;
|