1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | const path = require("path");
|
19 | var 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 = {}));
|
34 | var 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 = {}));
|
45 | var DispatchStyle;
|
46 | (function (DispatchStyle) {
|
47 | DispatchStyle["Single"] = "single";
|
48 | DispatchStyle["Multiple"] = "multiple";
|
49 | })(DispatchStyle = exports.DispatchStyle || (exports.DispatchStyle = {}));
|
50 | var Platform;
|
51 | (function (Platform) {
|
52 | Platform["NodeJs10"] = "nodejs10";
|
53 | Platform["Python37"] = "python37";
|
54 | Platform["Go113"] = "go113";
|
55 | })(Platform = exports.Platform || (exports.Platform = {}));
|
56 | var ParameterVisibility;
|
57 | (function (ParameterVisibility) {
|
58 | ParameterVisibility["Hidden"] = "hidden";
|
59 | ParameterVisibility["Advanced"] = "advanced";
|
60 | ParameterVisibility["Normal"] = "normal";
|
61 | })(ParameterVisibility = exports.ParameterVisibility || (exports.ParameterVisibility = {}));
|
62 | var LineStyle;
|
63 | (function (LineStyle) {
|
64 | LineStyle["Single"] = "single";
|
65 | LineStyle["Multiple"] = "multiple";
|
66 | })(LineStyle = exports.LineStyle || (exports.LineStyle = {}));
|
67 | var 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 = {}));
|
79 | function 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 | }
|
87 | exports.slackResourceProvider = slackResourceProvider;
|
88 | function 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 | }
|
96 | exports.gitHubResourceProvider = gitHubResourceProvider;
|
97 | function repoFilter(required = false) {
|
98 | return {
|
99 | type: ParameterType.RepoFilter,
|
100 | displayName: "Which repositories",
|
101 | description: "",
|
102 | required,
|
103 | };
|
104 | }
|
105 | exports.repoFilter = repoFilter;
|
106 | function 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 | }
|
127 | exports.packageJson = packageJson;
|
128 | function skill(skill, p = path.join(process.cwd(), "package.json")) {
|
129 | return Object.assign(Object.assign({}, packageJson(p)), skill);
|
130 | }
|
131 | exports.skill = skill;
|
132 |
|
\ | No newline at end of file |