UNPKG

2.23 kBJavaScriptView Raw
1"use strict";
2/*
3 * Copyright © 2018 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 automation_client_1 = require("@atomist/automation-client");
19const sdm_1 = require("@atomist/sdm");
20const closeCodeInspectionIssues_1 = require("./event/closeCodeInspectionIssues");
21const labelIssueOnDeployment_1 = require("./event/labelIssueOnDeployment");
22/**
23 * @deprecated Use issueSupport(options: IssueSupportOptions) instead
24 */
25exports.IssueSupport = Object.assign({}, sdm_1.metadata(), { configure: sdm => {
26 sdm.addEvent(labelIssueOnDeployment_1.labelIssuesOnDeployment(sdm));
27 return sdm;
28 } });
29const DefaultIssueSupportOptions = {
30 labelIssuesOnDeployment: true,
31 closeCodeInspectionIssuesOnBranchDeletion: {
32 enabled: false,
33 source: [],
34 },
35};
36/**
37 * Configure the issue extension pack
38 * @param options
39 */
40function issueSupport(options = {}) {
41 return Object.assign({}, sdm_1.metadata(), { configure: sdm => {
42 const optsToUse = Object.assign({}, DefaultIssueSupportOptions, options);
43 if (optsToUse.labelIssuesOnDeployment) {
44 sdm.addEvent(labelIssueOnDeployment_1.labelIssuesOnDeployment(sdm));
45 }
46 if (optsToUse.closeCodeInspectionIssuesOnBranchDeletion &&
47 optsToUse.closeCodeInspectionIssuesOnBranchDeletion.enabled) {
48 sdm.addEvent(closeCodeInspectionIssues_1.closeCodeInspectionIssues(sdm, ...automation_client_1.toStringArray(optsToUse.closeCodeInspectionIssuesOnBranchDeletion.source)));
49 }
50 } });
51}
52exports.issueSupport = issueSupport;
53//# sourceMappingURL=issue.js.map
\No newline at end of file