UNPKG

5.53 kBJavaScriptView Raw
1"use strict";
2/*
3 * Copyright © 2020 Atomist, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17Object.defineProperty(exports, "__esModule", { value: true });
18const path = require("path");
19var Category;
20(function (Category) {
21 Category["Build"] = "BUILD";
22 Category["CodeReview"] = "CODE_REVIEW";
23 Category["DevEx"] = "DEV_EX";
24 Category["Deploy"] = "DEPLOY";
25 Category["Security"] = "SECURITY";
26 Category["Dependencies"] = "DEPENDENCIES";
27 Category["Notifications"] = "NOTIFICATIONS";
28 Category["CI"] = "CI";
29 Category["CD"] = "CD";
30 Category["Productivity"] = "PRODUCTIVITY";
31 Category["CodeQuality"] = "CODE_QUALITY";
32 Category["Chat"] = "CHAT";
33})(Category = exports.Category || (exports.Category = {}));
34var Technology;
35(function (Technology) {
36 Technology["Java"] = "JAVA";
37 Technology["Maven"] = "MAVEN";
38 Technology["Docker"] = "DOCKER";
39 Technology["JavaScript"] = "JAVASCRIPT";
40 Technology["NPM"] = "NPM";
41 Technology["Leiningen"] = "LEIN";
42 Technology["Clojure"] = "CLOJURE";
43 Technology["Kubernetes"] = "KUBERNETES";
44})(Technology = exports.Technology || (exports.Technology = {}));
45var DispatchStyle;
46(function (DispatchStyle) {
47 DispatchStyle["Single"] = "single";
48 DispatchStyle["Multiple"] = "multiple";
49})(DispatchStyle = exports.DispatchStyle || (exports.DispatchStyle = {}));
50var Platform;
51(function (Platform) {
52 Platform["NodeJs10"] = "nodejs10";
53 Platform["Python37"] = "python37";
54 Platform["Go113"] = "go113";
55})(Platform = exports.Platform || (exports.Platform = {}));
56var ParameterVisibility;
57(function (ParameterVisibility) {
58 ParameterVisibility["Hidden"] = "hidden";
59 ParameterVisibility["Advanced"] = "advanced";
60 ParameterVisibility["Normal"] = "normal";
61})(ParameterVisibility = exports.ParameterVisibility || (exports.ParameterVisibility = {}));
62var LineStyle;
63(function (LineStyle) {
64 LineStyle["Single"] = "single";
65 LineStyle["Multiple"] = "multiple";
66})(LineStyle = exports.LineStyle || (exports.LineStyle = {}));
67var ParameterType;
68(function (ParameterType) {
69 ParameterType["Boolean"] = "boolean";
70 ParameterType["Float"] = "float";
71 ParameterType["Int"] = "int";
72 ParameterType["MultiChoice"] = "multiChoice";
73 ParameterType["SingleChoice"] = "singleChoice";
74 ParameterType["RepoFilter"] = "repoFilter";
75 ParameterType["Schedule"] = "schedule";
76 ParameterType["String"] = "string";
77 ParameterType["StringArray"] = "stringArray";
78})(ParameterType = exports.ParameterType || (exports.ParameterType = {}));
79function slackResourceProvider(options = { minRequired: 0, maxAllowed: 1 }) {
80 return {
81 typeName: "SlackResourceProvider",
82 description: "Slack",
83 minRequired: (options === null || options === void 0 ? void 0 : options.minRequired) !== undefined ? options.minRequired : 0,
84 maxAllowed: (options === null || options === void 0 ? void 0 : options.maxAllowed) !== undefined ? options.maxAllowed : 1,
85 };
86}
87exports.slackResourceProvider = slackResourceProvider;
88function gitHubResourceProvider(options = { minRequired: 1, maxAllowed: 1 }) {
89 return {
90 typeName: "GitHubAppResourceProvider",
91 description: "GitHub",
92 minRequired: (options === null || options === void 0 ? void 0 : options.minRequired) !== undefined ? options.minRequired : 1,
93 maxAllowed: (options === null || options === void 0 ? void 0 : options.maxAllowed) !== undefined ? options.maxAllowed : 1,
94 };
95}
96exports.gitHubResourceProvider = gitHubResourceProvider;
97function repoFilter(required = false) {
98 return {
99 type: ParameterType.RepoFilter,
100 displayName: "Which repositories",
101 description: "",
102 required,
103 };
104}
105exports.repoFilter = repoFilter;
106function packageJson(path = "package.json") {
107 var _a, _b, _c;
108 const pj = require(path);
109 const name = (_a = pj.name) === null || _a === void 0 ? void 0 : _a.split("/");
110 return {
111 name: name.length === 2 ? name[1] : name[0],
112 namespace: name.length === 2 ? name[0].replace(/@/g, "") : undefined,
113 displayName: pj.description,
114 version: pj.version,
115 author: typeof pj.author === "string" ? pj.author : (_b = pj.author) === null || _b === void 0 ? void 0 : _b.name,
116 description: "file://skill/description.md",
117 longDescription: "file://skill/long_description.md",
118 readme: "file://README.md",
119 license: pj.license,
120 categories: pj.keywords,
121 technologies: pj.technologies,
122 homepageUrl: pj.homepage,
123 repositoryUrl: typeof pj.repository === "string" ? pj.repository : (_c = pj.repository) === null || _c === void 0 ? void 0 : _c.url,
124 iconUrl: pj.icon ? pj.icon : "file://skill/icon.svg",
125 };
126}
127exports.packageJson = packageJson;
128function skill(skill, p = path.join(process.cwd(), "package.json")) {
129 return Object.assign(Object.assign({}, packageJson(p)), skill);
130}
131exports.skill = skill;
132//# sourceMappingURL=skill.js.map
\No newline at end of file