@extrahorizon/exh-cli 1.13.0-dev-181-b645884 → 1.13.0-dev-182-0eb2cbe
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/build/commands/tasks/create-repo.d.ts +2 -1
- package/build/commands/tasks/create-repo.js +4 -3
- package/build/commands/tasks/init.d.ts +22 -0
- package/build/commands/tasks/init.js +30 -0
- package/build/index.js +1 -0
- package/build/services/tasks/index.d.ts +1 -1
- package/build/services/tasks/index.js +3 -3
- package/build/services/tasks/init.d.ts +8 -0
- package/build/services/tasks/{createRepo.js → init.js} +5 -5
- package/package.json +1 -1
- package/build/services/tasks/createRepo.d.ts +0 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="yargs" />
|
|
2
2
|
export declare const command = "create-repo <name>";
|
|
3
|
-
export declare const desc =
|
|
3
|
+
export declare const desc = false;
|
|
4
|
+
export declare const deprecated = "Use \"exh tasks init\" instead, which has more consistent behavior with other \"init\" commands.";
|
|
4
5
|
export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs").Omit<{
|
|
5
6
|
name: string;
|
|
6
7
|
}, "path" | "repo" | "git"> & import("yargs").InferredOptionTypes<{
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
3
|
+
exports.handler = exports.builder = exports.deprecated = exports.desc = exports.command = void 0;
|
|
4
4
|
const util_1 = require("../../helpers/util");
|
|
5
5
|
const tasksService = require("../../services/tasks");
|
|
6
6
|
exports.command = 'create-repo <name>';
|
|
7
|
-
exports.desc =
|
|
7
|
+
exports.desc = false;
|
|
8
|
+
exports.deprecated = 'Use "exh tasks init" instead, which has more consistent behavior with other "init" commands.';
|
|
8
9
|
const builder = (yargs) => (0, util_1.epilogue)(yargs)
|
|
9
10
|
.positional('name', {
|
|
10
11
|
demandOption: true,
|
|
@@ -30,6 +31,6 @@ const builder = (yargs) => (0, util_1.epilogue)(yargs)
|
|
|
30
31
|
});
|
|
31
32
|
exports.builder = builder;
|
|
32
33
|
const handler = async ({ name, repo, git, path }) => {
|
|
33
|
-
await tasksService.
|
|
34
|
+
await tasksService.init({ name, repo, git, path });
|
|
34
35
|
};
|
|
35
36
|
exports.handler = handler;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="yargs" />
|
|
2
|
+
export declare const command = "init <name>";
|
|
3
|
+
export declare const desc = "Create a new task";
|
|
4
|
+
export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs").Omit<{
|
|
5
|
+
name: string;
|
|
6
|
+
}, "path" | "repo"> & import("yargs").InferredOptionTypes<{
|
|
7
|
+
repo: {
|
|
8
|
+
description: string;
|
|
9
|
+
type: "string";
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
path: {
|
|
13
|
+
description: string;
|
|
14
|
+
type: "string";
|
|
15
|
+
default: string;
|
|
16
|
+
};
|
|
17
|
+
}>>;
|
|
18
|
+
export declare const handler: ({ name, repo, path }: {
|
|
19
|
+
name: any;
|
|
20
|
+
repo: any;
|
|
21
|
+
path: any;
|
|
22
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
+
const util_1 = require("../../helpers/util");
|
|
5
|
+
const tasksService = require("../../services/tasks");
|
|
6
|
+
exports.command = 'init <name>';
|
|
7
|
+
exports.desc = 'Create a new task';
|
|
8
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs)
|
|
9
|
+
.positional('name', {
|
|
10
|
+
demandOption: true,
|
|
11
|
+
description: 'The name of the new task',
|
|
12
|
+
type: 'string',
|
|
13
|
+
})
|
|
14
|
+
.options({
|
|
15
|
+
repo: {
|
|
16
|
+
description: 'Git repository template to clone',
|
|
17
|
+
type: 'string',
|
|
18
|
+
default: 'https://github.com/ExtraHorizon/template-task',
|
|
19
|
+
},
|
|
20
|
+
path: {
|
|
21
|
+
description: 'the path where the new task should be created',
|
|
22
|
+
type: 'string',
|
|
23
|
+
default: './tasks',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
exports.builder = builder;
|
|
27
|
+
const handler = async ({ name, repo, path }) => {
|
|
28
|
+
await tasksService.init({ name, repo, path });
|
|
29
|
+
};
|
|
30
|
+
exports.handler = handler;
|
package/build/index.js
CHANGED
|
@@ -13,6 +13,7 @@ yargs((0, helpers_1.hideBin)(process.argv))
|
|
|
13
13
|
(0, lodash_1.isEqual)(argv._, ['data', 'schemas', 'init']) ||
|
|
14
14
|
(0, lodash_1.isEqual)(argv._, ['data', 'schemas', 'verify']) ||
|
|
15
15
|
(0, lodash_1.isEqual)(argv._, ['dispatchers', 'init']) ||
|
|
16
|
+
(0, lodash_1.isEqual)(argv._, ['tasks', 'init']) ||
|
|
16
17
|
(0, lodash_1.isEqual)(argv._, ['tasks', 'create-repo']) ||
|
|
17
18
|
(0, lodash_1.isEqual)(argv._, ['templates', 'init']) ||
|
|
18
19
|
(0, lodash_1.isEqual)(argv._, ['completion']) ||
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { sync } from './sync';
|
|
2
|
-
export {
|
|
2
|
+
export { init } from './init';
|
|
3
3
|
export { assertExecutionPermission } from './taskConfig';
|
|
4
4
|
export declare function list(isTTY: boolean): Promise<void>;
|
|
5
5
|
export declare function remove(name: string): Promise<void>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.remove = exports.list = exports.assertExecutionPermission = exports.
|
|
3
|
+
exports.remove = exports.list = exports.assertExecutionPermission = exports.init = exports.sync = void 0;
|
|
4
4
|
const chalk = require("chalk");
|
|
5
5
|
const functionRepository = require("../../repositories/functions");
|
|
6
6
|
var sync_1 = require("./sync");
|
|
7
7
|
Object.defineProperty(exports, "sync", { enumerable: true, get: function () { return sync_1.sync; } });
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "
|
|
8
|
+
var init_1 = require("./init");
|
|
9
|
+
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return init_1.init; } });
|
|
10
10
|
var taskConfig_1 = require("./taskConfig");
|
|
11
11
|
Object.defineProperty(exports, "assertExecutionPermission", { enumerable: true, get: function () { return taskConfig_1.assertExecutionPermission; } });
|
|
12
12
|
async function list(isTTY) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.init = void 0;
|
|
4
4
|
const promises_1 = require("fs/promises");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const chalk = require("chalk");
|
|
7
7
|
const util_1 = require("../../helpers/util");
|
|
8
|
-
async function
|
|
8
|
+
async function init({ name, repo, git, path }) {
|
|
9
9
|
try {
|
|
10
10
|
await (0, util_1.asyncExec)('git --version');
|
|
11
11
|
}
|
|
12
12
|
catch (err) {
|
|
13
13
|
console.log(chalk.red('Git is not installed. Please install git first.'));
|
|
14
14
|
}
|
|
15
|
-
console.log(`Creating new
|
|
15
|
+
console.log(`Creating new task ${chalk.green(name)}...`);
|
|
16
16
|
try {
|
|
17
17
|
const repoPath = (0, path_1.join)(path || '', name);
|
|
18
18
|
await (0, util_1.asyncExec)(`git clone ${repo} ${repoPath}`);
|
|
@@ -28,11 +28,11 @@ async function createRepo({ name, repo, git, path }) {
|
|
|
28
28
|
console.log('Done! 🎉');
|
|
29
29
|
}
|
|
30
30
|
catch (err) {
|
|
31
|
-
console.log(chalk.red('Failed to create
|
|
31
|
+
console.log(chalk.red('Failed to create task'));
|
|
32
32
|
console.log(err);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
exports.
|
|
35
|
+
exports.init = init;
|
|
36
36
|
async function changePackageFile(repoPath, name) {
|
|
37
37
|
try {
|
|
38
38
|
const pkg = JSON.parse((await (0, promises_1.readFile)(`${repoPath}/package.json`)).toString());
|
package/package.json
CHANGED