@hubspot/cli 7.4.8 → 7.4.9-beta.1
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/auth.d.ts +3 -7
- package/commands/account/auth.js +19 -9
- package/commands/account/clean.d.ts +3 -7
- package/commands/account/clean.js +16 -9
- package/commands/account/createOverride.d.ts +3 -7
- package/commands/account/createOverride.js +23 -6
- package/commands/account/info.d.ts +3 -7
- package/commands/account/info.js +13 -5
- package/commands/account/list.d.ts +3 -7
- package/commands/account/list.js +15 -8
- package/commands/account/remove.d.ts +3 -7
- package/commands/account/remove.js +21 -9
- package/commands/account/removeOverride.d.ts +3 -7
- package/commands/account/removeOverride.js +23 -6
- package/commands/account/rename.d.ts +3 -7
- package/commands/account/rename.js +16 -9
- package/commands/account/use.d.ts +5 -9
- package/commands/account/use.js +14 -6
- package/commands/account.d.ts +3 -4
- package/commands/account.js +35 -58
- 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/config/migrate.d.ts +1 -1
- package/commands/config/migrate.js +16 -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 +63 -74
- 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 +4 -1
- package/commands/feedback.js +40 -47
- package/commands/fetch.d.ts +12 -1
- package/commands/fetch.js +49 -33
- package/commands/filemanager/fetch.d.ts +4 -9
- package/commands/filemanager/fetch.js +18 -11
- package/commands/filemanager/upload.d.ts +4 -9
- package/commands/filemanager/upload.js +17 -11
- package/commands/filemanager.d.ts +3 -4
- package/commands/filemanager.js +20 -41
- 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/cloneApp.d.ts +1 -1
- package/commands/project/create.js +3 -3
- package/commands/project/deploy.d.ts +1 -0
- package/commands/project/deploy.js +40 -12
- package/commands/project/dev/index.d.ts +1 -4
- package/commands/project/dev/index.js +44 -15
- package/commands/project/dev/unifiedFlow.d.ts +2 -1
- package/commands/project/dev/unifiedFlow.js +52 -20
- package/commands/project/migrate.d.ts +1 -0
- package/commands/project/profile/add.d.ts +7 -0
- package/commands/project/profile/add.js +190 -0
- package/commands/project/profile/remove.d.ts +6 -0
- package/commands/project/profile/remove.js +119 -0
- package/commands/project/profile.d.ts +3 -0
- package/commands/project/profile.js +25 -0
- package/commands/project/upload.d.ts +1 -0
- package/commands/project/upload.js +38 -8
- package/commands/project.js +2 -0
- 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/theme/generate-selectors.d.ts +3 -7
- package/commands/theme/generate-selectors.js +14 -6
- package/commands/theme/marketplace-validate.d.ts +4 -9
- package/commands/theme/marketplace-validate.js +17 -10
- package/commands/theme/preview.d.ts +4 -9
- package/commands/theme/preview.js +16 -9
- package/commands/theme.d.ts +3 -4
- package/commands/theme.js +23 -46
- 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 +654 -558
- package/lang/en.js +443 -353
- package/lang/en.lyaml +23 -13
- package/lib/app/migrate.d.ts +23 -0
- package/lib/app/migrate.js +14 -3
- package/lib/app/migrate_legacy.js +5 -5
- package/lib/configMigrate.js +24 -10
- package/lib/constants.d.ts +6 -0
- package/lib/constants.js +7 -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/middleware/configMiddleware.js +8 -0
- package/lib/projectProfiles.d.ts +6 -0
- package/lib/projectProfiles.js +65 -0
- 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 +27 -0
- package/lib/projects/localDev/LocalDevProcess.js +171 -0
- package/lib/projects/localDev/LocalDevState.d.ts +37 -0
- package/lib/projects/localDev/LocalDevState.js +78 -0
- package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
- package/lib/projects/localDev/LocalDevWatcher.js +56 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +17 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +92 -0
- package/lib/projects/localDev/helpers.d.ts +1 -1
- package/lib/projects/localDev/helpers.js +2 -1
- package/lib/projects/upload.d.ts +2 -1
- package/lib/projects/upload.js +2 -2
- package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
- package/lib/prompts/createTemplatePrompt.d.ts +22 -4
- package/lib/testUtils.d.ts +3 -3
- package/lib/testUtils.js +8 -9
- package/lib/upload.d.ts +1 -1
- package/lib/validation.js +4 -5
- 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 +24 -0
- package/types/LocalDev.js +2 -0
- package/types/Yargs.d.ts +8 -1
- package/lib/projects/localDev/LocalDevManagerV2.d.ts +0 -64
- package/lib/projects/localDev/LocalDevManagerV2.js +0 -345
|
@@ -1,34 +1,34 @@
|
|
|
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
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
module.exports = {
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const github_1 = require("@hubspot/local-dev-lib/api/github");
|
|
9
|
+
const github_2 = require("@hubspot/local-dev-lib/github");
|
|
10
|
+
const createApiSamplePrompt_1 = require("../../lib/prompts/createApiSamplePrompt");
|
|
11
|
+
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
12
|
+
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
13
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
14
|
+
const en_1 = require("../../lang/en");
|
|
15
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
16
|
+
const apiSampleAssetType = {
|
|
15
17
|
hidden: true,
|
|
16
18
|
dest: ({ dest }) => dest,
|
|
17
19
|
validate: ({ name }) => {
|
|
18
20
|
if (!name) {
|
|
19
|
-
|
|
21
|
+
logger_1.uiLogger.error(en_1.commands.create.subcommands.apiSample.errors.nameRequired);
|
|
20
22
|
return false;
|
|
21
23
|
}
|
|
22
24
|
return true;
|
|
23
25
|
},
|
|
24
|
-
execute: async ({ dest, name, assetType,
|
|
25
|
-
const filePath =
|
|
26
|
-
if (
|
|
27
|
-
const overwrite = await confirmPrompt(
|
|
28
|
-
folderName: filePath,
|
|
29
|
-
}), { defaultAnswer: false });
|
|
26
|
+
execute: async ({ dest, name, assetType, commandArgs }) => {
|
|
27
|
+
const filePath = path_1.default.join(dest, name);
|
|
28
|
+
if (fs_extra_1.default.existsSync(filePath)) {
|
|
29
|
+
const overwrite = await (0, promptUtils_1.confirmPrompt)(en_1.commands.create.subcommands.apiSample.folderOverwritePrompt(filePath), { defaultAnswer: false });
|
|
30
30
|
if (overwrite) {
|
|
31
|
-
|
|
31
|
+
fs_extra_1.default.rmdirSync(filePath, { recursive: true });
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
34
|
return;
|
|
@@ -36,37 +36,33 @@ module.exports = {
|
|
|
36
36
|
}
|
|
37
37
|
let samplesConfig;
|
|
38
38
|
try {
|
|
39
|
-
const { data } = await fetchRepoFile('HubSpot/sample-apps-list', 'samples.json', 'main');
|
|
39
|
+
const { data } = await (0, github_1.fetchRepoFile)('HubSpot/sample-apps-list', 'samples.json', 'main');
|
|
40
40
|
samplesConfig = data;
|
|
41
41
|
}
|
|
42
42
|
catch (err) {
|
|
43
|
-
debugError(err);
|
|
43
|
+
(0, errorHandlers_1.debugError)(err);
|
|
44
44
|
}
|
|
45
45
|
if (!samplesConfig) {
|
|
46
|
-
|
|
47
|
-
process.exit(EXIT_CODES.ERROR);
|
|
46
|
+
logger_1.uiLogger.error(en_1.commands.create.subcommands.apiSample.errors.noSamples);
|
|
47
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
48
48
|
}
|
|
49
|
-
const { sampleType, sampleLanguage } = await createApiSamplePrompt(samplesConfig);
|
|
49
|
+
const { sampleType, sampleLanguage } = await (0, createApiSamplePrompt_1.createApiSamplePrompt)(samplesConfig);
|
|
50
50
|
if (!sampleType || !sampleLanguage) {
|
|
51
|
-
|
|
52
|
-
process.exit(EXIT_CODES.ERROR);
|
|
51
|
+
logger_1.uiLogger.error(en_1.commands.create.subcommands.apiSample.errors.noSamples);
|
|
52
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}));
|
|
58
|
-
const created = await cloneGithubRepo(`HubSpot/${sampleType}`, filePath, {
|
|
54
|
+
logger_1.uiLogger.info(en_1.commands.create.subcommands.apiSample.info.sampleChosen(sampleType, sampleLanguage));
|
|
55
|
+
const created = await (0, github_2.cloneGithubRepo)(`HubSpot/${sampleType}`, filePath, {
|
|
56
|
+
...commandArgs,
|
|
59
57
|
type: assetType,
|
|
60
58
|
sourceDir: sampleLanguage,
|
|
61
|
-
...options,
|
|
62
59
|
});
|
|
63
60
|
if (created) {
|
|
64
|
-
if (
|
|
65
|
-
|
|
61
|
+
if (fs_extra_1.default.existsSync(`${filePath}/.env.template`)) {
|
|
62
|
+
fs_extra_1.default.copySync(`${filePath}/.env.template`, `${filePath}/.env`);
|
|
66
63
|
}
|
|
67
|
-
|
|
68
|
-
filePath,
|
|
69
|
-
}));
|
|
64
|
+
logger_1.uiLogger.success(en_1.commands.create.subcommands.apiSample.success.sampleCreated(filePath));
|
|
70
65
|
}
|
|
71
66
|
},
|
|
72
67
|
};
|
|
68
|
+
exports.default = apiSampleAssetType;
|
package/commands/create/app.d.ts
CHANGED
package/commands/create/app.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
module.exports = {
|
|
3
|
+
const github_1 = require("@hubspot/local-dev-lib/github");
|
|
4
|
+
const appAssetType = {
|
|
6
5
|
hidden: true,
|
|
7
6
|
dest: ({ name, assetType }) => name || assetType,
|
|
8
|
-
execute: async ({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
execute: async ({ commandArgs, dest, assetType }) => {
|
|
8
|
+
await (0, github_1.cloneGithubRepo)('HubSpot/crm-card-weather-app', dest, {
|
|
9
|
+
...commandArgs,
|
|
10
|
+
type: assetType,
|
|
11
|
+
});
|
|
12
|
+
},
|
|
12
13
|
};
|
|
14
|
+
exports.default = appAssetType;
|
|
@@ -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
|
+
await (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
|
+
await (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
|
+
await (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
|
+
await (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;
|