1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const jovo_cli_core_1 = require("jovo-cli-core");
|
4 | const project = jovo_cli_core_1.getProject();
|
5 | const projectLevelCommands = [
|
6 | 'build',
|
7 | 'convert',
|
8 | 'deploy',
|
9 | 'get',
|
10 | 'init',
|
11 | 'run',
|
12 | 'scaffold',
|
13 | 'update',
|
14 | ];
|
15 | const versionArgs = ['-v', '-V', '--version', 'version'];
|
16 | async function hook() {
|
17 | if (projectLevelCommands.indexOf(process.argv[2]) !== -1 &&
|
18 | versionArgs.indexOf(process.argv[2]) === -1) {
|
19 | if (!(await project.isInProjectDirectory()) && process.argv.indexOf('--help') === -1) {
|
20 | console.error('\nTo use this command, please go into the directory of a valid Jovo project.\n');
|
21 | process.exit(1);
|
22 | }
|
23 | }
|
24 | }
|
25 | exports.default = hook;
|
26 |
|
\ | No newline at end of file |