@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
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
3
|
+
const functions_1 = require("@hubspot/local-dev-lib/cms/functions");
|
|
4
|
+
const createFunctionPrompt_1 = require("../../lib/prompts/createFunctionPrompt");
|
|
5
|
+
const index_1 = require("../../lib/errorHandlers/index");
|
|
6
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
7
|
+
const functionAssetType = {
|
|
8
|
+
hidden: false,
|
|
9
9
|
dest: ({ name }) => name,
|
|
10
10
|
execute: async ({ dest }) => {
|
|
11
|
-
const functionDefinition = await createFunctionPrompt();
|
|
11
|
+
const functionDefinition = await (0, createFunctionPrompt_1.createFunctionPrompt)();
|
|
12
12
|
try {
|
|
13
|
-
await createFunction(functionDefinition, dest);
|
|
13
|
+
await (0, functions_1.createFunction)(functionDefinition, dest);
|
|
14
14
|
}
|
|
15
15
|
catch (e) {
|
|
16
|
-
logError(e);
|
|
17
|
-
process.exit(EXIT_CODES.ERROR);
|
|
16
|
+
(0, index_1.logError)(e);
|
|
17
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
|
+
exports.default = functionAssetType;
|
package/commands/create/index.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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
'
|
|
6
|
+
const api_sample_1 = __importDefault(require("./api-sample"));
|
|
7
|
+
const app_1 = __importDefault(require("./app"));
|
|
8
|
+
const function_1 = __importDefault(require("./function"));
|
|
9
|
+
const module_1 = __importDefault(require("./module"));
|
|
10
|
+
const react_app_1 = __importDefault(require("./react-app"));
|
|
11
|
+
const template_1 = __importDefault(require("./template"));
|
|
12
|
+
const vue_app_1 = __importDefault(require("./vue-app"));
|
|
13
|
+
const webpack_serverless_1 = __importDefault(require("./webpack-serverless"));
|
|
14
|
+
const website_theme_1 = __importDefault(require("./website-theme"));
|
|
15
|
+
const assets = {
|
|
16
|
+
'api-sample': api_sample_1.default,
|
|
17
|
+
app: app_1.default,
|
|
18
|
+
function: function_1.default,
|
|
19
|
+
module: module_1.default,
|
|
20
|
+
'react-app': react_app_1.default,
|
|
21
|
+
template: template_1.default,
|
|
22
|
+
'vue-app': vue_app_1.default,
|
|
23
|
+
'webpack-serverless': webpack_serverless_1.default,
|
|
24
|
+
'website-theme': website_theme_1.default,
|
|
14
25
|
};
|
|
26
|
+
exports.default = assets;
|
|
@@ -1,29 +1,30 @@
|
|
|
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
|
-
|
|
3
|
+
const modules_1 = require("@hubspot/local-dev-lib/cms/modules");
|
|
4
|
+
const createModulePrompt_1 = require("../../lib/prompts/createModulePrompt");
|
|
5
|
+
const index_1 = require("../../lib/errorHandlers/index");
|
|
6
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
7
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
8
|
+
const en_1 = require("../../lang/en");
|
|
9
|
+
const moduleAssetType = {
|
|
10
|
+
hidden: false,
|
|
11
11
|
dest: ({ dest }) => dest,
|
|
12
12
|
validate: ({ name }) => {
|
|
13
13
|
if (!name) {
|
|
14
|
-
|
|
14
|
+
logger_1.uiLogger.error(en_1.commands.create.subcommands.module.errors.nameRequired);
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
17
17
|
return true;
|
|
18
18
|
},
|
|
19
19
|
execute: async ({ name, dest, getInternalVersion }) => {
|
|
20
|
-
const moduleDefinition = await createModulePrompt();
|
|
20
|
+
const moduleDefinition = await (0, createModulePrompt_1.createModulePrompt)();
|
|
21
21
|
try {
|
|
22
|
-
await createModule(moduleDefinition, name, dest, getInternalVersion);
|
|
22
|
+
await (0, modules_1.createModule)(moduleDefinition, name, dest, getInternalVersion);
|
|
23
23
|
}
|
|
24
24
|
catch (e) {
|
|
25
|
-
logError(e);
|
|
26
|
-
process.exit(EXIT_CODES.ERROR);
|
|
25
|
+
(0, index_1.logError)(e);
|
|
26
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
};
|
|
30
|
+
exports.default = moduleAssetType;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
3
|
+
const github_1 = require("@hubspot/local-dev-lib/github");
|
|
4
|
+
const reactAppAssetType = {
|
|
5
|
+
hidden: false,
|
|
6
6
|
dest: ({ name, assetType }) => name || assetType,
|
|
7
|
-
execute: async ({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
execute: async ({ commandArgs, dest, assetType }) => {
|
|
8
|
+
(0, github_1.cloneGithubRepo)('HubSpot/cms-react-boilerplate', dest, {
|
|
9
|
+
...commandArgs,
|
|
10
|
+
type: assetType,
|
|
11
|
+
});
|
|
12
|
+
},
|
|
11
13
|
};
|
|
14
|
+
exports.default = reactAppAssetType;
|
|
@@ -1,30 +1,30 @@
|
|
|
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
|
-
module.exports = {
|
|
3
|
+
const templates_1 = require("@hubspot/local-dev-lib/cms/templates");
|
|
4
|
+
const index_1 = require("../../lib/errorHandlers/index");
|
|
5
|
+
const createTemplatePrompt_1 = require("../../lib/prompts/createTemplatePrompt");
|
|
6
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
7
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
8
|
+
const en_1 = require("../../lang/en");
|
|
9
|
+
const templateAssetType = {
|
|
11
10
|
dest: ({ dest }) => dest,
|
|
11
|
+
hidden: false,
|
|
12
12
|
validate: ({ name }) => {
|
|
13
13
|
if (!name) {
|
|
14
|
-
|
|
14
|
+
logger_1.uiLogger.error(en_1.commands.create.subcommands.template.errors.nameRequired);
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
17
17
|
return true;
|
|
18
18
|
},
|
|
19
19
|
execute: async ({ name, dest }) => {
|
|
20
|
-
const { templateType } = await createTemplatePrompt();
|
|
20
|
+
const { templateType } = await (0, createTemplatePrompt_1.createTemplatePrompt)();
|
|
21
21
|
try {
|
|
22
|
-
await createTemplate(name, dest, templateType);
|
|
22
|
+
await (0, templates_1.createTemplate)(name, dest, templateType);
|
|
23
23
|
}
|
|
24
24
|
catch (e) {
|
|
25
|
-
logError(e);
|
|
26
|
-
process.exit(EXIT_CODES.ERROR);
|
|
25
|
+
(0, index_1.logError)(e);
|
|
26
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
27
27
|
}
|
|
28
|
-
return { templateType };
|
|
29
28
|
},
|
|
30
29
|
};
|
|
30
|
+
exports.default = templateAssetType;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
3
|
+
const github_1 = require("@hubspot/local-dev-lib/github");
|
|
4
|
+
const vueAppAssetType = {
|
|
5
|
+
hidden: false,
|
|
6
6
|
dest: ({ name, assetType }) => name || assetType,
|
|
7
|
-
execute: async ({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
execute: async ({ commandArgs, dest, assetType }) => {
|
|
8
|
+
(0, github_1.cloneGithubRepo)('HubSpot/cms-vue-boilerplate', dest, {
|
|
9
|
+
...commandArgs,
|
|
10
|
+
type: assetType,
|
|
11
|
+
});
|
|
12
|
+
},
|
|
11
13
|
};
|
|
14
|
+
exports.default = vueAppAssetType;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
3
|
+
const github_1 = require("@hubspot/local-dev-lib/github");
|
|
4
|
+
const webpackServerlessAssetType = {
|
|
5
|
+
hidden: false,
|
|
6
6
|
dest: ({ name, assetType }) => name || assetType,
|
|
7
|
-
execute: async ({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
execute: async ({ commandArgs, dest, assetType }) => {
|
|
8
|
+
(0, github_1.cloneGithubRepo)('HubSpot/cms-webpack-serverless-boilerplate', dest, {
|
|
9
|
+
...commandArgs,
|
|
10
|
+
type: assetType,
|
|
11
|
+
});
|
|
12
|
+
},
|
|
11
13
|
};
|
|
14
|
+
exports.default = webpackServerlessAssetType;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const { getIsInProject } = require('../../lib/projects/config');
|
|
3
|
+
const github_1 = require("@hubspot/local-dev-lib/github");
|
|
4
|
+
const config_1 = require("../../lib/projects/config");
|
|
6
5
|
const PROJECT_BOILERPLATE_BRANCH = 'cms-boilerplate-developer-projects';
|
|
7
|
-
|
|
6
|
+
const websiteThemeAssetType = {
|
|
7
|
+
hidden: false,
|
|
8
8
|
dest: ({ name, assetType }) => name || assetType,
|
|
9
|
-
execute: async ({ dest, assetType,
|
|
10
|
-
const isInProject = await getIsInProject(dest);
|
|
9
|
+
execute: async ({ dest, assetType, commandArgs }) => {
|
|
10
|
+
const isInProject = await (0, config_1.getIsInProject)(dest);
|
|
11
11
|
if (isInProject) {
|
|
12
|
-
|
|
12
|
+
commandArgs.branch = PROJECT_BOILERPLATE_BRANCH;
|
|
13
13
|
}
|
|
14
|
-
cloneGithubRepo('HubSpot/cms-theme-boilerplate', dest, {
|
|
14
|
+
(0, github_1.cloneGithubRepo)('HubSpot/cms-theme-boilerplate', dest, {
|
|
15
|
+
...commandArgs,
|
|
15
16
|
type: assetType,
|
|
16
17
|
sourceDir: 'src',
|
|
17
|
-
...options,
|
|
18
18
|
});
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
|
+
exports.default = websiteThemeAssetType;
|
package/commands/create.d.ts
CHANGED
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Note: No changes should be needed to this file when adding new types, unless you need new functionality
|
|
6
|
-
*
|
|
7
|
-
* @export {(Data) => String} dest - A function returning the destination of the asset we are creating
|
|
8
|
-
* @export {(Data) => Object=} execute - The code called once all other checks pass. This should contain the logic
|
|
9
|
-
* for handling your command. Optionally return an object containing KV pairs
|
|
10
|
-
* of any context or data you want passed along to usage tracking
|
|
11
|
-
* @export {Boolean=} hidden - If true, the command will not show up in --help
|
|
12
|
-
* @export {(Data) => Boolean=} validate - If provided, return true if it passes validation, false otherwise.
|
|
13
|
-
* If not provided, validation will automatically succeed
|
|
14
|
-
*
|
|
15
|
-
* The Data object contains
|
|
16
|
-
* {
|
|
17
|
-
* assetType: String - Type of the asset (e.g. api-sample, react-app, template)
|
|
18
|
-
* name: String - Filename of the asset
|
|
19
|
-
* dest: String - The path specified by the user on where to create the asset
|
|
20
|
-
* internal: Boolean - A flag for retrieving the internal spec for the asset type
|
|
21
|
-
* options: Object - The options object passed to the command by Yargs
|
|
22
|
-
* }
|
|
23
|
-
*/
|
|
24
|
-
export {};
|
|
1
|
+
import { CreateArgs } from '../types/Cms';
|
|
2
|
+
import { YargsCommandModule } from '../types/Yargs';
|
|
3
|
+
declare const createCommand: YargsCommandModule<unknown, CreateArgs>;
|
|
4
|
+
export default createCommand;
|
package/commands/create.js
CHANGED
|
@@ -1,97 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* 1. Create a new file under the `create` directory with the command name being the name of the file
|
|
6
|
-
* 2. The file _must_ export a `dest` function and an `execute` function. See below for details
|
|
7
|
-
* Note: No changes should be needed to this file when adding new types, unless you need new functionality
|
|
8
|
-
*
|
|
9
|
-
* @export {(Data) => String} dest - A function returning the destination of the asset we are creating
|
|
10
|
-
* @export {(Data) => Object=} execute - The code called once all other checks pass. This should contain the logic
|
|
11
|
-
* for handling your command. Optionally return an object containing KV pairs
|
|
12
|
-
* of any context or data you want passed along to usage tracking
|
|
13
|
-
* @export {Boolean=} hidden - If true, the command will not show up in --help
|
|
14
|
-
* @export {(Data) => Boolean=} validate - If provided, return true if it passes validation, false otherwise.
|
|
15
|
-
* If not provided, validation will automatically succeed
|
|
16
|
-
*
|
|
17
|
-
* The Data object contains
|
|
18
|
-
* {
|
|
19
|
-
* assetType: String - Type of the asset (e.g. api-sample, react-app, template)
|
|
20
|
-
* name: String - Filename of the asset
|
|
21
|
-
* dest: String - The path specified by the user on where to create the asset
|
|
22
|
-
* internal: Boolean - A flag for retrieving the internal spec for the asset type
|
|
23
|
-
* options: Object - The options object passed to the command by Yargs
|
|
24
|
-
* }
|
|
25
|
-
*/
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
26
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
6
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
7
|
+
const index_1 = require("../lib/errorHandlers/index");
|
|
8
|
+
const commonOpts_1 = require("../lib/commonOpts");
|
|
9
|
+
const filesystem_1 = require("../lib/filesystem");
|
|
10
|
+
const usageTracking_1 = require("../lib/usageTracking");
|
|
11
|
+
const index_2 = __importDefault(require("./create/index"));
|
|
12
|
+
const en_1 = require("../lang/en");
|
|
13
|
+
const logger_1 = require("../lib/ui/logger");
|
|
14
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
15
|
+
const SUPPORTED_ASSET_TYPES = Object.keys(index_2.default)
|
|
16
|
+
.filter(t => !index_2.default[t].hidden)
|
|
37
17
|
.join(', ');
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
setLogLevel(options);
|
|
46
|
-
assetType = typeof assetType === 'string' && assetType.toLowerCase();
|
|
18
|
+
const command = 'create <type> [name] [dest]';
|
|
19
|
+
const describe = en_1.commands.create.describe(SUPPORTED_ASSET_TYPES);
|
|
20
|
+
async function handler(args) {
|
|
21
|
+
const { name, internal: getInternalVersion, type } = args;
|
|
22
|
+
let { dest } = args;
|
|
23
|
+
(0, commonOpts_1.setLogLevel)(args);
|
|
24
|
+
const assetType = type.toLowerCase();
|
|
47
25
|
if (assetType === 'global-partial') {
|
|
48
|
-
|
|
49
|
-
assetType,
|
|
50
|
-
newCommand: 'hs create template',
|
|
51
|
-
type: 'global partial',
|
|
52
|
-
}));
|
|
26
|
+
logger_1.uiLogger.error(en_1.commands.create.errors.deprecatedAssetType(assetType, 'hs create template', 'global partial'));
|
|
53
27
|
return;
|
|
54
28
|
}
|
|
55
|
-
if (!assetType || !
|
|
56
|
-
|
|
57
|
-
assetType,
|
|
58
|
-
supportedAssetTypes: SUPPORTED_ASSET_TYPES,
|
|
59
|
-
}));
|
|
29
|
+
if (!assetType || !index_2.default[assetType]) {
|
|
30
|
+
logger_1.uiLogger.error(en_1.commands.create.errors.unsupportedAssetType(assetType, SUPPORTED_ASSET_TYPES));
|
|
60
31
|
return;
|
|
61
32
|
}
|
|
62
|
-
const asset =
|
|
63
|
-
const argsToPass = {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
33
|
+
const asset = index_2.default[assetType];
|
|
34
|
+
const argsToPass = {
|
|
35
|
+
commandArgs: args,
|
|
36
|
+
assetType,
|
|
37
|
+
name,
|
|
38
|
+
dest,
|
|
39
|
+
getInternalVersion: getInternalVersion || false,
|
|
40
|
+
};
|
|
41
|
+
dest = argsToPass.dest = (0, filesystem_1.resolveLocalPath)(asset.dest(argsToPass));
|
|
42
|
+
const { derivedAccountId } = args;
|
|
43
|
+
(0, usageTracking_1.trackCommandUsage)('create', { assetType }, derivedAccountId);
|
|
67
44
|
try {
|
|
68
|
-
await
|
|
45
|
+
await fs_extra_1.default.ensureDir(dest);
|
|
69
46
|
}
|
|
70
47
|
catch (e) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}));
|
|
74
|
-
logError(e, {
|
|
75
|
-
filepath: dest,
|
|
76
|
-
operation: 'write',
|
|
77
|
-
});
|
|
48
|
+
logger_1.uiLogger.error(en_1.commands.create.errors.unusablePath(dest));
|
|
49
|
+
(0, index_1.logError)(e);
|
|
78
50
|
return;
|
|
79
51
|
}
|
|
80
52
|
if (asset.validate && !asset.validate(argsToPass))
|
|
81
53
|
return;
|
|
82
54
|
await asset.execute(argsToPass);
|
|
83
|
-
}
|
|
84
|
-
|
|
55
|
+
}
|
|
56
|
+
function createBuilder(yargs) {
|
|
85
57
|
yargs.positional('type', {
|
|
86
|
-
describe:
|
|
58
|
+
describe: en_1.commands.create.positionals.type.describe,
|
|
87
59
|
type: 'string',
|
|
88
60
|
});
|
|
89
61
|
yargs.positional('name', {
|
|
90
|
-
describe:
|
|
62
|
+
describe: en_1.commands.create.positionals.name.describe,
|
|
91
63
|
type: 'string',
|
|
92
64
|
});
|
|
93
65
|
yargs.positional('dest', {
|
|
94
|
-
describe:
|
|
66
|
+
describe: en_1.commands.create.positionals.dest.describe,
|
|
95
67
|
type: 'string',
|
|
96
68
|
});
|
|
97
69
|
yargs.option('internal', {
|
|
@@ -99,7 +71,17 @@ exports.builder = yargs => {
|
|
|
99
71
|
type: 'boolean',
|
|
100
72
|
hidden: true,
|
|
101
73
|
});
|
|
102
|
-
addConfigOptions(yargs);
|
|
103
|
-
addGlobalOptions(yargs);
|
|
104
74
|
return yargs;
|
|
75
|
+
}
|
|
76
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(createBuilder, command, describe, {
|
|
77
|
+
useGlobalOptions: true,
|
|
78
|
+
useConfigOptions: true,
|
|
79
|
+
});
|
|
80
|
+
const createCommand = {
|
|
81
|
+
command,
|
|
82
|
+
describe,
|
|
83
|
+
builder,
|
|
84
|
+
handler,
|
|
105
85
|
};
|
|
86
|
+
exports.default = createCommand;
|
|
87
|
+
module.exports = createCommand;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const command = "create [name]";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs;
|
|
6
|
-
type CustomObjectCreateArgs = CombinedArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type CustomObjectCreateArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
7
3
|
name?: string;
|
|
8
4
|
path?: string;
|
|
9
5
|
};
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
export {};
|
|
6
|
+
declare const customObjectCreateCommand: YargsCommandModule<unknown, CustomObjectCreateArgs>;
|
|
7
|
+
export default customObjectCreateCommand;
|
|
@@ -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 customObjects_1 = require("@hubspot/local-dev-lib/api/customObjects");
|
|
8
5
|
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
@@ -13,9 +10,9 @@ const usageTracking_1 = require("../../lib/usageTracking");
|
|
|
13
10
|
const lang_1 = require("../../lib/lang");
|
|
14
11
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
15
12
|
const customObject_1 = require("../../lib/customObject");
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
14
|
+
const command = 'create [name]';
|
|
15
|
+
const describe = (0, lang_1.i18n)(`commands.customObject.subcommands.create.describe`);
|
|
19
16
|
async function handler(args) {
|
|
20
17
|
const { path, name: providedName, derivedAccountId } = args;
|
|
21
18
|
let definitionPath = path;
|
|
@@ -44,10 +41,7 @@ async function handler(args) {
|
|
|
44
41
|
}));
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
|
-
function
|
|
48
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
49
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
50
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
44
|
+
function customObjectCreateBuilder(yargs) {
|
|
51
45
|
yargs
|
|
52
46
|
.positional('name', {
|
|
53
47
|
describe: (0, lang_1.i18n)(`commands.customObject.subcommands.create.positionals.name.describe`),
|
|
@@ -59,3 +53,16 @@ function builder(yargs) {
|
|
|
59
53
|
});
|
|
60
54
|
return yargs;
|
|
61
55
|
}
|
|
56
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(customObjectCreateBuilder, command, describe, {
|
|
57
|
+
useGlobalOptions: true,
|
|
58
|
+
useConfigOptions: true,
|
|
59
|
+
useAccountOptions: true,
|
|
60
|
+
useEnvironmentOptions: true,
|
|
61
|
+
});
|
|
62
|
+
const customObjectCreateCommand = {
|
|
63
|
+
command,
|
|
64
|
+
describe,
|
|
65
|
+
handler,
|
|
66
|
+
builder,
|
|
67
|
+
};
|
|
68
|
+
exports.default = customObjectCreateCommand;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const command = "create";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & TestingArgs;
|
|
6
|
-
type SchemaCreateArgs = CombinedArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, TestingArgs, YargsCommandModule } from '../../../types/Yargs';
|
|
2
|
+
type SchemaCreateArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & TestingArgs & {
|
|
7
3
|
path: string;
|
|
8
4
|
};
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export {};
|
|
5
|
+
declare const schemaCreateCommand: YargsCommandModule<unknown, SchemaCreateArgs>;
|
|
6
|
+
export default schemaCreateCommand;
|