@atomist/sdm
Version:
Atomist Software Delivery Machine SDK
52 lines • 2.2 kB
JavaScript
;
/*
* Copyright © 2019 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 });
exports.GitShaRegExp = exports.GitBranchRegExp = exports.GitHubNameRegExp = exports.SemVerRegExp = void 0;
/**
* Validation pattern for semantic versions
* @type {{displayName: string; description: string; pattern: RegExp; validInput: string; minLength: number; maxLength: number}}
*/
exports.SemVerRegExp = {
displayName: "Version",
description: "version of the project, e.g., 1.2.3-SNAPSHOT",
// tslint:disable-next-line:max-line-length
pattern: /^v?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:[1-9]\d*|\d*[-A-Za-z][-A-Za-z\d]*)(?:\.(?:[1-9]\d*|\d*[-A-Za-z][-A-Za-z\d]*))*)?(?:\+[-A-Za-z\d]+(?:\.[-A-Za-z\d]+)*)?$/,
validInput: "a valid semantic version, http://semver.org",
minLength: 1,
maxLength: 50,
};
exports.GitHubNameRegExp = {
displayName: "GitHub name",
description: "valid GitHub name",
pattern: /^[-.\w]+$/,
validInput: "a valid GitHub name which consists of alphanumeric, ., -, and _ characters",
};
exports.GitBranchRegExp = {
displayName: "Branch",
description: "initial version of the project, e.g., 1.2.3-SNAPSHOT",
// not perfect, but pretty good
pattern: /^\w(?:[./]?[-\w])*$/,
validInput: "a valid Git branch name, see" +
" https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html",
};
exports.GitShaRegExp = {
displayName: "Sha",
description: "valid Git SHA",
pattern: /^[0-9a-f]{40}$/,
validInput: "40 hex digits, lowercase",
};
//# sourceMappingURL=commonValidationPatterns.js.map