@hubspot/cli 7.4.8 → 7.4.9-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/account/createOverride.js +9 -0
- package/commands/account/remove.js +6 -1
- package/commands/account/removeOverride.js +9 -0
- package/commands/cms/convertFields.d.ts +7 -1
- package/commands/cms/convertFields.js +57 -41
- package/commands/cms/getReactModule.d.ts +7 -1
- package/commands/cms/getReactModule.js +52 -34
- package/commands/cms/lighthouseScore.d.ts +8 -1
- package/commands/cms/lighthouseScore.js +129 -100
- package/commands/cms.d.ts +3 -1
- package/commands/cms.js +24 -15
- package/commands/completion.d.ts +3 -1
- package/commands/completion.js +25 -12
- package/commands/create/api-sample.d.ts +3 -1
- package/commands/create/api-sample.js +34 -38
- package/commands/create/app.d.ts +3 -1
- package/commands/create/app.js +9 -7
- package/commands/create/function.d.ts +3 -1
- package/commands/create/function.js +11 -10
- package/commands/create/index.d.ts +5 -1
- package/commands/create/index.js +23 -11
- package/commands/create/module.d.ts +3 -1
- package/commands/create/module.js +14 -13
- package/commands/create/react-app.d.ts +3 -1
- package/commands/create/react-app.js +10 -7
- package/commands/create/template.d.ts +3 -1
- package/commands/create/template.js +14 -14
- package/commands/create/vue-app.d.ts +3 -1
- package/commands/create/vue-app.js +10 -7
- package/commands/create/webpack-serverless.d.ts +3 -1
- package/commands/create/webpack-serverless.js +10 -7
- package/commands/create/website-theme.d.ts +3 -1
- package/commands/create/website-theme.js +10 -9
- package/commands/create.d.ts +4 -24
- package/commands/create.js +55 -73
- package/commands/customObject/create.d.ts +4 -9
- package/commands/customObject/create.js +17 -10
- package/commands/customObject/schema/create.d.ts +4 -9
- package/commands/customObject/schema/create.js +18 -11
- package/commands/customObject/schema/delete.d.ts +4 -9
- package/commands/customObject/schema/delete.js +17 -10
- package/commands/customObject/schema/fetch-all.d.ts +4 -9
- package/commands/customObject/schema/fetch-all.js +17 -10
- package/commands/customObject/schema/fetch.d.ts +4 -9
- package/commands/customObject/schema/fetch.js +17 -10
- package/commands/customObject/schema/list.d.ts +4 -8
- package/commands/customObject/schema/list.js +17 -10
- package/commands/customObject/schema/update.d.ts +4 -9
- package/commands/customObject/schema/update.js +18 -11
- package/commands/customObject/schema.d.ts +3 -5
- package/commands/customObject/schema.js +27 -54
- package/commands/customObject.d.ts +3 -4
- package/commands/customObject.js +20 -45
- package/commands/feedback.d.ts +7 -1
- package/commands/feedback.js +36 -20
- package/commands/fetch.d.ts +12 -1
- package/commands/fetch.js +49 -33
- package/commands/function/deploy.d.ts +6 -1
- package/commands/function/deploy.js +70 -50
- package/commands/function/list.d.ts +6 -1
- package/commands/function/list.js +44 -32
- package/commands/function/server.d.ts +10 -1
- package/commands/function/server.js +49 -38
- package/commands/function.d.ts +5 -1
- package/commands/function.js +24 -10
- package/commands/hubdb/clear.d.ts +4 -9
- package/commands/hubdb/clear.js +17 -10
- package/commands/hubdb/create.d.ts +4 -9
- package/commands/hubdb/create.js +17 -10
- package/commands/hubdb/delete.d.ts +4 -9
- package/commands/hubdb/delete.js +17 -10
- package/commands/hubdb/fetch.d.ts +4 -9
- package/commands/hubdb/fetch.js +17 -10
- package/commands/hubdb.d.ts +3 -2
- package/commands/hubdb.js +23 -45
- package/commands/lint.d.ts +6 -4
- package/commands/lint.js +44 -43
- package/commands/logs.d.ts +10 -1
- package/commands/logs.js +53 -44
- package/commands/module/marketplace-validate.d.ts +6 -1
- package/commands/module/marketplace-validate.js +39 -27
- package/commands/module.d.ts +3 -1
- package/commands/module.js +22 -10
- package/commands/project/dev/unifiedFlow.js +28 -5
- package/commands/sandbox/create.d.ts +4 -9
- package/commands/sandbox/create.js +18 -11
- package/commands/sandbox/delete.d.ts +4 -9
- package/commands/sandbox/delete.js +18 -11
- package/commands/sandbox.d.ts +3 -4
- package/commands/sandbox.js +20 -43
- package/commands/secret/addSecret.d.ts +4 -9
- package/commands/secret/addSecret.js +17 -10
- package/commands/secret/deleteSecret.d.ts +4 -9
- package/commands/secret/deleteSecret.js +17 -10
- package/commands/secret/listSecret.d.ts +4 -9
- package/commands/secret/listSecret.js +17 -10
- package/commands/secret/updateSecret.d.ts +4 -9
- package/commands/secret/updateSecret.js +17 -10
- package/commands/secret.d.ts +3 -4
- package/commands/secret.js +25 -48
- package/commands/upload.d.ts +12 -1
- package/commands/upload.js +118 -97
- package/commands/watch.d.ts +14 -1
- package/commands/watch.js +76 -65
- package/lang/en.d.ts +565 -543
- package/lang/en.js +360 -338
- package/lang/en.lyaml +3 -0
- package/lib/constants.d.ts +5 -0
- package/lib/constants.js +6 -1
- package/lib/errorHandlers/suppressError.js +12 -19
- package/lib/filesystem.d.ts +1 -1
- package/lib/interpolation.d.ts +2 -3
- package/lib/lang.d.ts +2 -3
- package/lib/projects/buildAndDeploy.js +17 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +25 -0
- package/lib/projects/localDev/AppDevModeInterface.js +117 -0
- package/lib/projects/localDev/DevServerManagerV2.d.ts +11 -22
- package/lib/projects/localDev/DevServerManagerV2.js +19 -15
- package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
- package/lib/projects/localDev/LocalDevLogger.js +158 -0
- package/lib/projects/localDev/LocalDevManager.js +2 -3
- package/lib/projects/localDev/LocalDevProcess.d.ts +41 -0
- package/lib/projects/localDev/LocalDevProcess.js +178 -0
- package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
- package/lib/projects/localDev/LocalDevWatcher.js +55 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +15 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +80 -0
- package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
- package/lib/prompts/createTemplatePrompt.d.ts +22 -4
- package/lib/upload.d.ts +1 -1
- package/lib/yargsUtils.d.ts +4 -0
- package/lib/yargsUtils.js +6 -0
- package/package.json +5 -3
- package/types/Cms.d.ts +30 -0
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +22 -0
- package/types/LocalDev.js +2 -0
- package/types/Yargs.d.ts +5 -0
- package/lib/projects/localDev/LocalDevManagerV2.d.ts +0 -64
- package/lib/projects/localDev/LocalDevManagerV2.js +0 -345
package/commands/logs.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const { isHubSpotHttpError } = require('@hubspot/local-dev-lib/errors/index');
|
|
3
|
+
const usageTracking_1 = require("../lib/usageTracking");
|
|
4
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
5
|
+
const serverlessFunctionLogs_1 = require("../lib/ui/serverlessFunctionLogs");
|
|
6
|
+
const functions_1 = require("@hubspot/local-dev-lib/api/functions");
|
|
7
|
+
const serverlessLogs_1 = require("../lib/serverlessLogs");
|
|
8
|
+
const lang_1 = require("../lib/lang");
|
|
9
|
+
const promptUtils_1 = require("../lib/prompts/promptUtils");
|
|
10
|
+
const exitCodes_1 = require("../lib/enums/exitCodes");
|
|
11
|
+
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
12
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
14
13
|
const handleLogsError = (e, accountId, functionPath) => {
|
|
15
|
-
if (isHubSpotHttpError(e) && (e.status === 404 || e.status == 400)) {
|
|
16
|
-
logger.error(i18n(`commands.logs.errors.noLogsFound`, {
|
|
14
|
+
if ((0, index_1.isHubSpotHttpError)(e) && (e.status === 404 || e.status == 400)) {
|
|
15
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.logs.errors.noLogsFound`, {
|
|
17
16
|
accountId,
|
|
18
17
|
functionPath,
|
|
19
18
|
}));
|
|
@@ -21,101 +20,111 @@ const handleLogsError = (e, accountId, functionPath) => {
|
|
|
21
20
|
};
|
|
22
21
|
const endpointLog = async (accountId, functionPath, options) => {
|
|
23
22
|
const { limit, latest, follow, compact } = options;
|
|
24
|
-
const
|
|
23
|
+
const requestParams = {
|
|
25
24
|
limit,
|
|
26
25
|
latest,
|
|
27
26
|
follow,
|
|
28
|
-
compact,
|
|
29
27
|
endpoint: functionPath,
|
|
30
28
|
};
|
|
31
|
-
logger.debug(i18n(`commands.logs.gettingLogs`, {
|
|
29
|
+
logger_1.logger.debug((0, lang_1.i18n)(`commands.logs.gettingLogs`, {
|
|
32
30
|
latest,
|
|
33
31
|
functionPath,
|
|
34
32
|
}));
|
|
35
33
|
let logsResp;
|
|
36
34
|
if (follow) {
|
|
37
|
-
const tailCall = after => getFunctionLogs(accountId, functionPath, { after });
|
|
35
|
+
const tailCall = (after) => (0, functions_1.getFunctionLogs)(accountId, functionPath, { after });
|
|
38
36
|
const fetchLatest = () => {
|
|
39
37
|
try {
|
|
40
|
-
return getLatestFunctionLog(accountId, functionPath);
|
|
38
|
+
return (0, functions_1.getLatestFunctionLog)(accountId, functionPath);
|
|
41
39
|
}
|
|
42
40
|
catch (e) {
|
|
43
41
|
handleLogsError(e, accountId, functionPath);
|
|
42
|
+
return Promise.reject(e);
|
|
44
43
|
}
|
|
45
44
|
};
|
|
46
|
-
await tailLogs(accountId, functionPath, fetchLatest, tailCall, compact);
|
|
45
|
+
await (0, serverlessLogs_1.tailLogs)(accountId, functionPath, fetchLatest, tailCall, compact);
|
|
47
46
|
}
|
|
48
47
|
else if (latest) {
|
|
49
48
|
try {
|
|
50
|
-
const { data } = await getLatestFunctionLog(accountId, functionPath);
|
|
49
|
+
const { data } = await (0, functions_1.getLatestFunctionLog)(accountId, functionPath);
|
|
51
50
|
logsResp = data;
|
|
52
51
|
}
|
|
53
52
|
catch (e) {
|
|
54
53
|
handleLogsError(e, accountId, functionPath);
|
|
55
|
-
process.exit(EXIT_CODES.ERROR);
|
|
54
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
else {
|
|
59
58
|
try {
|
|
60
|
-
const { data } = await getFunctionLogs(accountId, functionPath,
|
|
59
|
+
const { data } = await (0, functions_1.getFunctionLogs)(accountId, functionPath, requestParams);
|
|
61
60
|
logsResp = data;
|
|
62
61
|
}
|
|
63
62
|
catch (e) {
|
|
64
63
|
handleLogsError(e, accountId, functionPath);
|
|
65
|
-
process.exit(EXIT_CODES.ERROR);
|
|
64
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
if (logsResp) {
|
|
69
|
-
return outputLogs(logsResp,
|
|
68
|
+
return (0, serverlessFunctionLogs_1.outputLogs)(logsResp, { compact });
|
|
70
69
|
}
|
|
71
70
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
const command = 'logs [endpoint]';
|
|
72
|
+
const describe = (0, lang_1.i18n)(`commands.logs.describe`);
|
|
73
|
+
const handler = async (options) => {
|
|
75
74
|
const { endpoint: endpointArgValue, latest, derivedAccountId } = options;
|
|
76
|
-
trackCommandUsage('logs', { latest }, derivedAccountId);
|
|
77
|
-
const { endpointPromptValue } = await promptUser({
|
|
75
|
+
(0, usageTracking_1.trackCommandUsage)('logs', latest ? { action: 'latest' } : {}, derivedAccountId);
|
|
76
|
+
const { endpointPromptValue } = await (0, promptUtils_1.promptUser)({
|
|
78
77
|
name: 'endpointPromptValue',
|
|
79
|
-
message: i18n(`commands.logs.endpointPrompt`),
|
|
78
|
+
message: (0, lang_1.i18n)(`commands.logs.endpointPrompt`),
|
|
80
79
|
when: !endpointArgValue,
|
|
81
80
|
});
|
|
82
|
-
endpointLog(derivedAccountId, endpointArgValue || endpointPromptValue, options);
|
|
81
|
+
await endpointLog(derivedAccountId, endpointArgValue || endpointPromptValue, options);
|
|
83
82
|
};
|
|
84
|
-
|
|
83
|
+
function logsBuilder(yargs) {
|
|
85
84
|
yargs.positional('endpoint', {
|
|
86
|
-
describe: i18n(`commands.logs.positionals.endpoint.describe`),
|
|
85
|
+
describe: (0, lang_1.i18n)(`commands.logs.positionals.endpoint.describe`),
|
|
87
86
|
type: 'string',
|
|
88
87
|
});
|
|
89
88
|
yargs
|
|
90
89
|
.options({
|
|
91
90
|
latest: {
|
|
92
91
|
alias: 'l',
|
|
93
|
-
describe: i18n(`commands.logs.options.latest.describe`),
|
|
92
|
+
describe: (0, lang_1.i18n)(`commands.logs.options.latest.describe`),
|
|
94
93
|
type: 'boolean',
|
|
95
94
|
},
|
|
96
95
|
compact: {
|
|
97
|
-
describe: i18n(`commands.logs.options.compact.describe`),
|
|
96
|
+
describe: (0, lang_1.i18n)(`commands.logs.options.compact.describe`),
|
|
98
97
|
type: 'boolean',
|
|
99
98
|
},
|
|
100
99
|
follow: {
|
|
101
100
|
alias: ['f'],
|
|
102
|
-
describe: i18n(`commands.logs.options.follow.describe`),
|
|
101
|
+
describe: (0, lang_1.i18n)(`commands.logs.options.follow.describe`),
|
|
103
102
|
type: 'boolean',
|
|
104
103
|
},
|
|
105
104
|
limit: {
|
|
106
|
-
describe: i18n(`commands.logs.options.limit.describe`),
|
|
105
|
+
describe: (0, lang_1.i18n)(`commands.logs.options.limit.describe`),
|
|
107
106
|
type: 'number',
|
|
108
107
|
},
|
|
109
108
|
})
|
|
110
109
|
.conflicts('follow', 'limit');
|
|
111
110
|
yargs.example([
|
|
112
|
-
['$0 logs my-endpoint', i18n(`commands.logs.examples.default`)],
|
|
113
|
-
['$0 logs my-endpoint --limit=10', i18n(`commands.logs.examples.limit`)],
|
|
114
|
-
['$0 logs my-endpoint --follow', i18n(`commands.logs.examples.follow`)],
|
|
111
|
+
['$0 logs my-endpoint', (0, lang_1.i18n)(`commands.logs.examples.default`)],
|
|
112
|
+
['$0 logs my-endpoint --limit=10', (0, lang_1.i18n)(`commands.logs.examples.limit`)],
|
|
113
|
+
['$0 logs my-endpoint --follow', (0, lang_1.i18n)(`commands.logs.examples.follow`)],
|
|
115
114
|
]);
|
|
116
|
-
addConfigOptions(yargs);
|
|
117
|
-
addAccountOptions(yargs);
|
|
118
|
-
addUseEnvironmentOptions(yargs);
|
|
119
|
-
addGlobalOptions(yargs);
|
|
120
115
|
return yargs;
|
|
116
|
+
}
|
|
117
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(logsBuilder, command, describe, {
|
|
118
|
+
useGlobalOptions: true,
|
|
119
|
+
useConfigOptions: true,
|
|
120
|
+
useAccountOptions: true,
|
|
121
|
+
useEnvironmentOptions: true,
|
|
122
|
+
});
|
|
123
|
+
const logsCommand = {
|
|
124
|
+
command,
|
|
125
|
+
describe,
|
|
126
|
+
builder,
|
|
127
|
+
handler,
|
|
121
128
|
};
|
|
129
|
+
exports.default = logsCommand;
|
|
130
|
+
module.exports = logsCommand;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type MarketplaceValidateArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
3
|
+
src: string;
|
|
4
|
+
};
|
|
5
|
+
declare const marketplaceValidateCommand: YargsCommandModule<unknown, MarketplaceValidateArgs>;
|
|
6
|
+
export default marketplaceValidateCommand;
|
|
@@ -1,38 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const { src, derivedAccountId } =
|
|
13
|
-
trackCommandUsage('validate',
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
text: i18n(`commands.module.subcommands.marketplaceValidate.logs.validatingModule`, {
|
|
6
|
+
const SpinniesManager_1 = __importDefault(require("../../lib/ui/SpinniesManager"));
|
|
7
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
8
|
+
const marketplaceValidate_1 = require("../../lib/marketplaceValidate");
|
|
9
|
+
const lang_1 = require("../../lib/lang");
|
|
10
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
11
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
12
|
+
const command = 'marketplace-validate <src>';
|
|
13
|
+
const describe = (0, lang_1.i18n)(`commands.module.subcommands.marketplaceValidate.describe`);
|
|
14
|
+
async function handler(args) {
|
|
15
|
+
const { src, derivedAccountId } = args;
|
|
16
|
+
(0, usageTracking_1.trackCommandUsage)('validate', undefined, derivedAccountId);
|
|
17
|
+
SpinniesManager_1.default.init();
|
|
18
|
+
SpinniesManager_1.default.add('marketplaceValidation', {
|
|
19
|
+
text: (0, lang_1.i18n)(`commands.module.subcommands.marketplaceValidate.logs.validatingModule`, {
|
|
17
20
|
path: src,
|
|
18
21
|
}),
|
|
19
22
|
});
|
|
20
23
|
const assetType = 'MODULE';
|
|
21
|
-
const validationId = await kickOffValidation(derivedAccountId, assetType, src);
|
|
22
|
-
await pollForValidationFinish(derivedAccountId, validationId);
|
|
23
|
-
|
|
24
|
-
const validationResults = await fetchValidationResults(derivedAccountId, validationId);
|
|
25
|
-
processValidationErrors('commands.module.subcommands.marketplaceValidate', validationResults);
|
|
26
|
-
displayValidationResults('commands.module.subcommands.marketplaceValidate', validationResults);
|
|
27
|
-
process.exit();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
addConfigOptions(yargs);
|
|
31
|
-
addAccountOptions(yargs);
|
|
32
|
-
addUseEnvironmentOptions(yargs);
|
|
24
|
+
const validationId = await (0, marketplaceValidate_1.kickOffValidation)(derivedAccountId, assetType, src);
|
|
25
|
+
await (0, marketplaceValidate_1.pollForValidationFinish)(derivedAccountId, validationId);
|
|
26
|
+
SpinniesManager_1.default.remove('marketplaceValidation');
|
|
27
|
+
const validationResults = await (0, marketplaceValidate_1.fetchValidationResults)(derivedAccountId, validationId);
|
|
28
|
+
(0, marketplaceValidate_1.processValidationErrors)('commands.module.subcommands.marketplaceValidate', validationResults);
|
|
29
|
+
(0, marketplaceValidate_1.displayValidationResults)('commands.module.subcommands.marketplaceValidate', validationResults);
|
|
30
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
31
|
+
}
|
|
32
|
+
function marketplaceValidateBuilder(yargs) {
|
|
33
33
|
yargs.positional('src', {
|
|
34
|
-
describe: i18n(`commands.module.subcommands.marketplaceValidate.positionals.src.describe`),
|
|
34
|
+
describe: (0, lang_1.i18n)(`commands.module.subcommands.marketplaceValidate.positionals.src.describe`),
|
|
35
35
|
type: 'string',
|
|
36
36
|
});
|
|
37
37
|
return yargs;
|
|
38
|
+
}
|
|
39
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(marketplaceValidateBuilder, command, describe, {
|
|
40
|
+
useConfigOptions: true,
|
|
41
|
+
useAccountOptions: true,
|
|
42
|
+
useEnvironmentOptions: true,
|
|
43
|
+
});
|
|
44
|
+
const marketplaceValidateCommand = {
|
|
45
|
+
command,
|
|
46
|
+
describe,
|
|
47
|
+
handler,
|
|
48
|
+
builder,
|
|
38
49
|
};
|
|
50
|
+
exports.default = marketplaceValidateCommand;
|
package/commands/module.d.ts
CHANGED
package/commands/module.js
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
addConfigOptions(yargs);
|
|
10
|
-
addAccountOptions(yargs);
|
|
11
|
-
addGlobalOptions(yargs);
|
|
12
|
-
yargs.command(marketplaceValidate).demandCommand(1, '');
|
|
6
|
+
const marketplace_validate_1 = __importDefault(require("./module/marketplace-validate"));
|
|
7
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
8
|
+
const command = 'module';
|
|
9
|
+
const describe = undefined;
|
|
10
|
+
function moduleBuilder(yargs) {
|
|
11
|
+
yargs.command(marketplace_validate_1.default).demandCommand(1, '');
|
|
13
12
|
return yargs;
|
|
13
|
+
}
|
|
14
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(moduleBuilder, command, describe, {
|
|
15
|
+
useGlobalOptions: true,
|
|
16
|
+
useConfigOptions: true,
|
|
17
|
+
useAccountOptions: true,
|
|
18
|
+
});
|
|
19
|
+
const moduleCommand = {
|
|
20
|
+
command,
|
|
21
|
+
describe,
|
|
22
|
+
builder,
|
|
23
|
+
handler: () => { },
|
|
14
24
|
};
|
|
25
|
+
exports.default = moduleCommand;
|
|
26
|
+
module.exports = moduleCommand;
|
|
@@ -17,11 +17,13 @@ const ensureProjectExists_1 = require("../../../lib/projects/ensureProjectExists
|
|
|
17
17
|
const helpers_1 = require("../../../lib/projects/localDev/helpers");
|
|
18
18
|
const projectDevTargetAccountPrompt_1 = require("../../../lib/prompts/projectDevTargetAccountPrompt");
|
|
19
19
|
const SpinniesManager_1 = __importDefault(require("../../../lib/ui/SpinniesManager"));
|
|
20
|
-
const
|
|
20
|
+
const LocalDevProcess_1 = __importDefault(require("../../../lib/projects/localDev/LocalDevProcess"));
|
|
21
|
+
const LocalDevWatcher_1 = __importDefault(require("../../../lib/projects/localDev/LocalDevWatcher"));
|
|
21
22
|
const process_1 = require("../../../lib/process");
|
|
22
23
|
const accountTypes_1 = require("../../../lib/accountTypes");
|
|
23
24
|
const ui_1 = require("../../../lib/ui");
|
|
24
25
|
const lang_1 = require("../../../lib/lang");
|
|
26
|
+
// import LocalDevWebsocketServer from '../../../lib/projects/localDev/LocalDevWebsocketServer';
|
|
25
27
|
async function unifiedProjectDevFlow(args, accountConfig, projectConfig, projectDir) {
|
|
26
28
|
logger_1.logger.log('Unified Apps Local Dev');
|
|
27
29
|
const targetProjectAccountId = args.derivedAccountId;
|
|
@@ -94,8 +96,9 @@ async function unifiedProjectDevFlow(args, accountConfig, projectConfig, project
|
|
|
94
96
|
project = await (0, helpers_1.createNewProjectForLocalDev)(projectConfig, targetProjectAccountId, false, false);
|
|
95
97
|
deployedBuild = await (0, helpers_1.createInitialBuildForNewProject)(projectConfig, projectDir, targetProjectAccountId, true);
|
|
96
98
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
// End setup, start local dev process
|
|
100
|
+
const localDevProcess = new LocalDevProcess_1.default({
|
|
101
|
+
initialProjectNodes: projectNodes,
|
|
99
102
|
debug: args.debug,
|
|
100
103
|
deployedBuild,
|
|
101
104
|
isGithubLinked,
|
|
@@ -106,6 +109,26 @@ async function unifiedProjectDevFlow(args, accountConfig, projectConfig, project
|
|
|
106
109
|
projectId: project.id,
|
|
107
110
|
env,
|
|
108
111
|
});
|
|
109
|
-
await
|
|
110
|
-
|
|
112
|
+
await localDevProcess.start();
|
|
113
|
+
const watcher = new LocalDevWatcher_1.default(localDevProcess);
|
|
114
|
+
watcher.start();
|
|
115
|
+
// const websocketServer = new LocalDevWebsocketServer(
|
|
116
|
+
// localDevProcess,
|
|
117
|
+
// args.debug
|
|
118
|
+
// );
|
|
119
|
+
// await websocketServer.start();
|
|
120
|
+
(0, process_1.handleKeypress)(async (key) => {
|
|
121
|
+
if ((key.ctrl && key.name === 'c') || key.name === 'q') {
|
|
122
|
+
await Promise.all([
|
|
123
|
+
localDevProcess.stop(),
|
|
124
|
+
watcher.stop(),
|
|
125
|
+
// websocketServer.shutdown(),
|
|
126
|
+
]);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
(0, process_1.handleExit)(({ isSIGHUP }) => {
|
|
130
|
+
localDevProcess.stop(!isSIGHUP);
|
|
131
|
+
watcher.stop();
|
|
132
|
+
// websocketServer.shutdown();
|
|
133
|
+
});
|
|
111
134
|
}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const command = "create";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = ConfigArgs & AccountArgs & EnvironmentArgs & TestingArgs;
|
|
6
|
-
type SandboxCreateArgs = CommonArgs & CombinedArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, TestingArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type SandboxCreateArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & TestingArgs & {
|
|
7
3
|
name?: string;
|
|
8
4
|
force?: boolean;
|
|
9
5
|
type?: string;
|
|
10
6
|
};
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
export {};
|
|
7
|
+
declare const sandboxCreateCommand: YargsCommandModule<unknown, SandboxCreateArgs>;
|
|
8
|
+
export default sandboxCreateCommand;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.describe = exports.command = void 0;
|
|
4
|
-
exports.handler = handler;
|
|
5
|
-
exports.builder = builder;
|
|
6
3
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
7
4
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
8
5
|
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
9
6
|
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
10
7
|
const config_2 = require("@hubspot/local-dev-lib/constants/config");
|
|
11
8
|
const environment_1 = require("@hubspot/local-dev-lib/environment");
|
|
12
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
13
9
|
const lang_1 = require("../../lib/lang");
|
|
14
10
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
15
11
|
const ui_1 = require("../../lib/ui");
|
|
@@ -21,8 +17,9 @@ const sandboxSync_1 = require("../../lib/sandboxSync");
|
|
|
21
17
|
const index_2 = require("../../lib/errorHandlers/index");
|
|
22
18
|
const buildAccount_1 = require("../../lib/buildAccount");
|
|
23
19
|
const accountNamePrompt_1 = require("../../lib/prompts/accountNamePrompt");
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
21
|
+
const command = 'create';
|
|
22
|
+
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.sandbox.subcommands.create.describe`), false);
|
|
26
23
|
async function handler(args) {
|
|
27
24
|
const { name, type, force, derivedAccountId } = args;
|
|
28
25
|
const accountConfig = (0, config_1.getAccountConfig)(derivedAccountId);
|
|
@@ -146,7 +143,7 @@ async function handler(args) {
|
|
|
146
143
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
147
144
|
}
|
|
148
145
|
}
|
|
149
|
-
function
|
|
146
|
+
function sandboxCreateBuilder(yargs) {
|
|
150
147
|
yargs.option('force', {
|
|
151
148
|
type: 'boolean',
|
|
152
149
|
alias: 'f',
|
|
@@ -166,9 +163,19 @@ function builder(yargs) {
|
|
|
166
163
|
(0, lang_1.i18n)(`commands.sandbox.subcommands.create.examples.default`),
|
|
167
164
|
],
|
|
168
165
|
]);
|
|
169
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
170
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
171
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
172
|
-
(0, commonOpts_1.addTestingOptions)(yargs);
|
|
173
166
|
return yargs;
|
|
174
167
|
}
|
|
168
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(sandboxCreateBuilder, command, describe, {
|
|
169
|
+
useGlobalOptions: true,
|
|
170
|
+
useConfigOptions: true,
|
|
171
|
+
useAccountOptions: true,
|
|
172
|
+
useEnvironmentOptions: true,
|
|
173
|
+
useTestingOptions: true,
|
|
174
|
+
});
|
|
175
|
+
const sandboxCreateCommand = {
|
|
176
|
+
command,
|
|
177
|
+
describe,
|
|
178
|
+
handler,
|
|
179
|
+
builder,
|
|
180
|
+
};
|
|
181
|
+
exports.default = sandboxCreateCommand;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const command = "delete";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = ConfigArgs & AccountArgs & EnvironmentArgs & TestingArgs;
|
|
6
|
-
type SandboxDeleteArgs = CommonArgs & CombinedArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, TestingArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type SandboxDeleteArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & TestingArgs & {
|
|
7
3
|
account?: string;
|
|
8
4
|
force?: boolean;
|
|
9
5
|
};
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
export {};
|
|
6
|
+
declare const sandboxDeleteCommand: YargsCommandModule<unknown, SandboxDeleteArgs>;
|
|
7
|
+
export default sandboxDeleteCommand;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.describe = exports.command = void 0;
|
|
4
|
-
exports.handler = handler;
|
|
5
|
-
exports.builder = builder;
|
|
6
3
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
4
|
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
8
5
|
const sandboxHubs_1 = require("@hubspot/local-dev-lib/api/sandboxHubs");
|
|
@@ -10,7 +7,6 @@ const config_1 = require("@hubspot/local-dev-lib/config");
|
|
|
10
7
|
const getAccountIdentifier_1 = require("@hubspot/local-dev-lib/config/getAccountIdentifier");
|
|
11
8
|
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
12
9
|
const environment_1 = require("@hubspot/local-dev-lib/environment");
|
|
13
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
14
10
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
15
11
|
const index_2 = require("../../lib/errorHandlers/index");
|
|
16
12
|
const lang_1 = require("../../lib/lang");
|
|
@@ -19,8 +15,9 @@ const accountsPrompt_1 = require("../../lib/prompts/accountsPrompt");
|
|
|
19
15
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
20
16
|
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
21
17
|
const ui_1 = require("../../lib/ui");
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
19
|
+
const command = 'delete';
|
|
20
|
+
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.describe`), false);
|
|
24
21
|
async function handler(args) {
|
|
25
22
|
const { providedAccountId, force } = args;
|
|
26
23
|
(0, usageTracking_1.trackCommandUsage)('sandbox-delete', {}, providedAccountId);
|
|
@@ -182,7 +179,7 @@ async function handler(args) {
|
|
|
182
179
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
183
180
|
}
|
|
184
181
|
}
|
|
185
|
-
function
|
|
182
|
+
function sandboxDeleteBuilder(yargs) {
|
|
186
183
|
yargs.option('account', {
|
|
187
184
|
describe: (0, lang_1.i18n)(`commands.sandbox.subcommands.delete.options.account.describe`),
|
|
188
185
|
type: 'string',
|
|
@@ -198,9 +195,19 @@ function builder(yargs) {
|
|
|
198
195
|
(0, lang_1.i18n)(`commands.sandbox.subcommands.delete.examples.default`),
|
|
199
196
|
],
|
|
200
197
|
]);
|
|
201
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
202
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
203
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
204
|
-
(0, commonOpts_1.addTestingOptions)(yargs);
|
|
205
198
|
return yargs;
|
|
206
199
|
}
|
|
200
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(sandboxDeleteBuilder, command, describe, {
|
|
201
|
+
useGlobalOptions: true,
|
|
202
|
+
useConfigOptions: true,
|
|
203
|
+
useAccountOptions: true,
|
|
204
|
+
useEnvironmentOptions: true,
|
|
205
|
+
useTestingOptions: true,
|
|
206
|
+
});
|
|
207
|
+
const sandboxDeleteCommand = {
|
|
208
|
+
command,
|
|
209
|
+
describe,
|
|
210
|
+
handler,
|
|
211
|
+
builder,
|
|
212
|
+
};
|
|
213
|
+
exports.default = sandboxDeleteCommand;
|
package/commands/sandbox.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export declare function builder(yargs: Argv): Argv;
|
|
1
|
+
import { YargsCommandModuleBucket } from '../types/Yargs';
|
|
2
|
+
declare const sandboxCommand: YargsCommandModuleBucket;
|
|
3
|
+
export default sandboxCommand;
|
package/commands/sandbox.js
CHANGED
|
@@ -1,49 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
35
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.describe = exports.command = void 0;
|
|
37
|
-
exports.builder = builder;
|
|
38
|
-
const commonOpts_1 = require("../lib/commonOpts");
|
|
39
6
|
const lang_1 = require("../lib/lang");
|
|
40
7
|
const ui_1 = require("../lib/ui");
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
yargs.command(
|
|
8
|
+
const create_1 = __importDefault(require("./sandbox/create"));
|
|
9
|
+
const delete_1 = __importDefault(require("./sandbox/delete"));
|
|
10
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
11
|
+
const command = ['sandbox', 'sandboxes'];
|
|
12
|
+
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.sandbox.describe`), false);
|
|
13
|
+
function sandboxBuilder(yargs) {
|
|
14
|
+
yargs.command(create_1.default).command(delete_1.default).demandCommand(1, '');
|
|
48
15
|
return yargs;
|
|
49
16
|
}
|
|
17
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(sandboxBuilder, command, describe);
|
|
18
|
+
const sandboxCommand = {
|
|
19
|
+
command,
|
|
20
|
+
describe,
|
|
21
|
+
builder,
|
|
22
|
+
handler: () => { },
|
|
23
|
+
};
|
|
24
|
+
exports.default = sandboxCommand;
|
|
25
|
+
// TODO Remove this legacy export once we've migrated all commands to TS
|
|
26
|
+
module.exports = sandboxCommand;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const command = "add [name]";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = ConfigArgs & AccountArgs & EnvironmentArgs;
|
|
6
|
-
type AddSecretArgs = CommonArgs & CombinedArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type AddSecretArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
7
3
|
name?: string;
|
|
8
4
|
};
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export {};
|
|
5
|
+
declare const addSecretCommand: YargsCommandModule<unknown, AddSecretArgs>;
|
|
6
|
+
export default addSecretCommand;
|