@atomist/sample-sdm
Version:
Sample Atomist automation for software delivery
41 lines • 2.04 kB
JavaScript
;
/*
* Copyright © 2018 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
const sdm_1 = require("@atomist/sdm");
const sdm_2 = require("@atomist/sdm");
const sdm_3 = require("@atomist/sdm");
const jvmPushTests_1 = require("@atomist/sdm/mapping/pushtest/jvm/jvmPushTests");
const tsPushTests_1 = require("@atomist/sdm/mapping/pushtest/node/tsPushTests");
const addHeader_1 = require("../commands/editors/license/addHeader");
const addLicenseFile_1 = require("./addLicenseFile");
exports.AddAtomistJavaHeader = addAtomistHeader("Java header", "**/*.java", jvmPushTests_1.IsJava);
exports.AddAtomistTypeScriptHeader = addAtomistHeader("TypeScript header", "**/*.ts", tsPushTests_1.IsTypeScript);
function addAtomistHeader(name, glob, pushTest) {
const parameters = new addHeader_1.AddHeaderParameters();
parameters.glob = glob;
// Stop it continually editing the barrel and graphql types
parameters.excludeGlob = "src/typings/types.ts,src/index.ts";
return sdm_1.editorAutofixRegistration({
name,
pushTest: sdm_3.allSatisfied(pushTest, sdm_2.hasFileContaining(addLicenseFile_1.LicenseFilename, /Apache License/)),
// Ignored any parameters passed in, which will be undefined in an autofix, and provide predefined parameters
editor: addHeader_1.addHeaderProjectEditor,
parameters,
});
}
exports.addAtomistHeader = addAtomistHeader;
//# sourceMappingURL=addAtomistHeader.js.map