UNPKG

4.01 kBJavaScriptView Raw
1#! /usr/bin/env node
2"use strict";
3/*
4 * Copyright © 2020 Atomist, Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18Object.defineProperty(exports, "__esModule", { value: true });
19// tslint:disable-next-line:no-import-side-effect
20require("source-map-support/register");
21const yargs = require("yargs");
22const log_1 = require("../lib/log");
23// tslint:disable-next-line:no-unused-expression
24yargs
25 .command("run", "Start container skill", args => args.options({
26 skill: { type: "string", description: "Name of skill to load", demandOption: false },
27}), async (argv) => {
28 return (await Promise.resolve().then(() => require("../lib/scripts/skill_run"))).runSkill(argv.skill);
29})
30 .command(["generate", "gen"], "Generate skill metadata", args => args.option({
31 cwd: { type: "string", description: "Set working directory", default: process.cwd(), demandOption: false },
32 verbose: { type: "boolean", description: "Enable verbose logging", default: false, demandOption: false },
33}), async (argv) => {
34 try {
35 await (await Promise.resolve().then(() => require("../lib/scripts/skill_input"))).generateSkill(argv.cwd, argv.verbose);
36 return 0;
37 }
38 catch (e) {
39 log_1.error(e.message);
40 process.exit(1);
41 }
42})
43 .command(["bundle"], "Bundle skill and dependencies", args => args.option({
44 cwd: { type: "string", description: "Set working directory", default: process.cwd(), demandOption: false },
45 minify: { type: "boolean", description: "Minify bundled sources", default: true, demandOption: false },
46 sourceMap: { type: "boolean", description: "Create source map", default: true, demandOption: false },
47 verbose: { type: "boolean", description: "Enable verbose logging", default: false, demandOption: false },
48}), async (argv) => {
49 try {
50 await (await Promise.resolve().then(() => require("../lib/scripts/skill_bundle"))).bundleSkill(argv.cwd, argv.minify, argv.sourceMap, argv.verbose);
51 return 0;
52 }
53 catch (e) {
54 log_1.error(e.message);
55 process.exit(1);
56 }
57})
58 .command(["package", "pkg"], "Package skill archive", args => args.option({
59 cwd: { type: "string", description: "Set working directory", default: process.cwd(), demandOption: false },
60 verbose: { type: "boolean", description: "Enable verbose logging", default: false, demandOption: false },
61}), async (argv) => {
62 try {
63 await (await Promise.resolve().then(() => require("../lib/scripts/skill_package"))).packageSkill(argv.cwd, argv.verbose);
64 return 0;
65 }
66 catch (e) {
67 log_1.error(e.message);
68 process.exit(1);
69 }
70})
71 .command(["register", "reg"], "Register skill", args => args.option({
72 cwd: { type: "string", description: "Set working directory", default: process.cwd(), demandOption: false },
73 workspace: { type: "string", description: "Id of workspace to register", demandOption: false },
74 version: { type: "string", description: "Version of skill", demandOption: false },
75 verbose: { type: "boolean", description: "Enable verbose logging", default: false, demandOption: false },
76}), async (argv) => {
77 try {
78 await (await Promise.resolve().then(() => require("../lib/scripts/skill_register"))).registerSkill(argv.cwd, argv.workspace, argv.version, argv.verbose);
79 return 0;
80 }
81 catch (e) {
82 log_1.error(e.message);
83 process.exit(1);
84 }
85})
86 .strict()
87 .help()
88 .argv;
89//# sourceMappingURL=start.js.map
\No newline at end of file