@forsakringskassan/commitlint-config 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -0
- package/bin/cli.js +2 -0
- package/bin/install.js +2 -0
- package/dist/cli/commitlint.js +40729 -0
- package/dist/cli/templates/commit.hbs +61 -0
- package/dist/cli/templates/footer.hbs +11 -0
- package/dist/cli/templates/header.hbs +25 -0
- package/dist/cli/templates/template.hbs +16 -0
- package/dist/config/default.js +179 -0
- package/dist/config/no-jira.js +154 -0
- package/dist/config/templates/commit.hbs +30 -0
- package/dist/config/templates/footer.hbs +0 -0
- package/dist/config/templates/header.hbs +9 -0
- package/dist/config/templates/template.hbs +23 -0
- package/dist/format.js +1667 -0
- package/dist/install.js +316 -0
- package/dist/parser.js +491 -0
- package/gitmessage +52 -0
- package/package.json +64 -0
package/dist/install.js
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
4
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// node_modules/ci-info/vendors.json
|
|
8
|
+
var require_vendors = __commonJS({
|
|
9
|
+
"node_modules/ci-info/vendors.json"(exports2, module2) {
|
|
10
|
+
module2.exports = [
|
|
11
|
+
{
|
|
12
|
+
name: "AppVeyor",
|
|
13
|
+
constant: "APPVEYOR",
|
|
14
|
+
env: "APPVEYOR",
|
|
15
|
+
pr: "APPVEYOR_PULL_REQUEST_NUMBER"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "Azure Pipelines",
|
|
19
|
+
constant: "AZURE_PIPELINES",
|
|
20
|
+
env: "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",
|
|
21
|
+
pr: "SYSTEM_PULLREQUEST_PULLREQUESTID"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "Appcircle",
|
|
25
|
+
constant: "APPCIRCLE",
|
|
26
|
+
env: "AC_APPCIRCLE"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "Bamboo",
|
|
30
|
+
constant: "BAMBOO",
|
|
31
|
+
env: "bamboo_planKey"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "Bitbucket Pipelines",
|
|
35
|
+
constant: "BITBUCKET",
|
|
36
|
+
env: "BITBUCKET_COMMIT",
|
|
37
|
+
pr: "BITBUCKET_PR_ID"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "Bitrise",
|
|
41
|
+
constant: "BITRISE",
|
|
42
|
+
env: "BITRISE_IO",
|
|
43
|
+
pr: "BITRISE_PULL_REQUEST"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "Buddy",
|
|
47
|
+
constant: "BUDDY",
|
|
48
|
+
env: "BUDDY_WORKSPACE_ID",
|
|
49
|
+
pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "Buildkite",
|
|
53
|
+
constant: "BUILDKITE",
|
|
54
|
+
env: "BUILDKITE",
|
|
55
|
+
pr: { env: "BUILDKITE_PULL_REQUEST", ne: "false" }
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "CircleCI",
|
|
59
|
+
constant: "CIRCLE",
|
|
60
|
+
env: "CIRCLECI",
|
|
61
|
+
pr: "CIRCLE_PULL_REQUEST"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "Cirrus CI",
|
|
65
|
+
constant: "CIRRUS",
|
|
66
|
+
env: "CIRRUS_CI",
|
|
67
|
+
pr: "CIRRUS_PR"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "AWS CodeBuild",
|
|
71
|
+
constant: "CODEBUILD",
|
|
72
|
+
env: "CODEBUILD_BUILD_ARN"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "Codefresh",
|
|
76
|
+
constant: "CODEFRESH",
|
|
77
|
+
env: "CF_BUILD_ID",
|
|
78
|
+
pr: { any: ["CF_PULL_REQUEST_NUMBER", "CF_PULL_REQUEST_ID"] }
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "Codeship",
|
|
82
|
+
constant: "CODESHIP",
|
|
83
|
+
env: { CI_NAME: "codeship" }
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "Drone",
|
|
87
|
+
constant: "DRONE",
|
|
88
|
+
env: "DRONE",
|
|
89
|
+
pr: { DRONE_BUILD_EVENT: "pull_request" }
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: "dsari",
|
|
93
|
+
constant: "DSARI",
|
|
94
|
+
env: "DSARI"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: "GitHub Actions",
|
|
98
|
+
constant: "GITHUB_ACTIONS",
|
|
99
|
+
env: "GITHUB_ACTIONS",
|
|
100
|
+
pr: { GITHUB_EVENT_NAME: "pull_request" }
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "GitLab CI",
|
|
104
|
+
constant: "GITLAB",
|
|
105
|
+
env: "GITLAB_CI",
|
|
106
|
+
pr: "CI_MERGE_REQUEST_ID"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: "GoCD",
|
|
110
|
+
constant: "GOCD",
|
|
111
|
+
env: "GO_PIPELINE_LABEL"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "LayerCI",
|
|
115
|
+
constant: "LAYERCI",
|
|
116
|
+
env: "LAYERCI",
|
|
117
|
+
pr: "LAYERCI_PULL_REQUEST"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "Hudson",
|
|
121
|
+
constant: "HUDSON",
|
|
122
|
+
env: "HUDSON_URL"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "Jenkins",
|
|
126
|
+
constant: "JENKINS",
|
|
127
|
+
env: ["JENKINS_URL", "BUILD_ID"],
|
|
128
|
+
pr: { any: ["ghprbPullId", "CHANGE_ID"] }
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "Magnum CI",
|
|
132
|
+
constant: "MAGNUM",
|
|
133
|
+
env: "MAGNUM"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: "Netlify CI",
|
|
137
|
+
constant: "NETLIFY",
|
|
138
|
+
env: "NETLIFY",
|
|
139
|
+
pr: { env: "PULL_REQUEST", ne: "false" }
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "Nevercode",
|
|
143
|
+
constant: "NEVERCODE",
|
|
144
|
+
env: "NEVERCODE",
|
|
145
|
+
pr: { env: "NEVERCODE_PULL_REQUEST", ne: "false" }
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "Render",
|
|
149
|
+
constant: "RENDER",
|
|
150
|
+
env: "RENDER",
|
|
151
|
+
pr: { IS_PULL_REQUEST: "true" }
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: "Sail CI",
|
|
155
|
+
constant: "SAIL",
|
|
156
|
+
env: "SAILCI",
|
|
157
|
+
pr: "SAIL_PULL_REQUEST_NUMBER"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "Semaphore",
|
|
161
|
+
constant: "SEMAPHORE",
|
|
162
|
+
env: "SEMAPHORE",
|
|
163
|
+
pr: "PULL_REQUEST_NUMBER"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: "Screwdriver",
|
|
167
|
+
constant: "SCREWDRIVER",
|
|
168
|
+
env: "SCREWDRIVER",
|
|
169
|
+
pr: { env: "SD_PULL_REQUEST", ne: "false" }
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "Shippable",
|
|
173
|
+
constant: "SHIPPABLE",
|
|
174
|
+
env: "SHIPPABLE",
|
|
175
|
+
pr: { IS_PULL_REQUEST: "true" }
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: "Solano CI",
|
|
179
|
+
constant: "SOLANO",
|
|
180
|
+
env: "TDDIUM",
|
|
181
|
+
pr: "TDDIUM_PR_ID"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: "Strider CD",
|
|
185
|
+
constant: "STRIDER",
|
|
186
|
+
env: "STRIDER"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: "TaskCluster",
|
|
190
|
+
constant: "TASKCLUSTER",
|
|
191
|
+
env: ["TASK_ID", "RUN_ID"]
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: "TeamCity",
|
|
195
|
+
constant: "TEAMCITY",
|
|
196
|
+
env: "TEAMCITY_VERSION"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: "Travis CI",
|
|
200
|
+
constant: "TRAVIS",
|
|
201
|
+
env: "TRAVIS",
|
|
202
|
+
pr: { env: "TRAVIS_PULL_REQUEST", ne: "false" }
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: "Vercel",
|
|
206
|
+
constant: "VERCEL",
|
|
207
|
+
env: "NOW_BUILDER"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: "Visual Studio App Center",
|
|
211
|
+
constant: "APPCENTER",
|
|
212
|
+
env: "APPCENTER_BUILD_ID"
|
|
213
|
+
}
|
|
214
|
+
];
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// node_modules/ci-info/index.js
|
|
219
|
+
var require_ci_info = __commonJS({
|
|
220
|
+
"node_modules/ci-info/index.js"(exports2) {
|
|
221
|
+
"use strict";
|
|
222
|
+
var vendors = require_vendors();
|
|
223
|
+
var env = process.env;
|
|
224
|
+
Object.defineProperty(exports2, "_vendors", {
|
|
225
|
+
value: vendors.map(function(v) {
|
|
226
|
+
return v.constant;
|
|
227
|
+
})
|
|
228
|
+
});
|
|
229
|
+
exports2.name = null;
|
|
230
|
+
exports2.isPR = null;
|
|
231
|
+
vendors.forEach(function(vendor) {
|
|
232
|
+
const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
|
|
233
|
+
const isCI2 = envs.every(function(obj) {
|
|
234
|
+
return checkEnv(obj);
|
|
235
|
+
});
|
|
236
|
+
exports2[vendor.constant] = isCI2;
|
|
237
|
+
if (isCI2) {
|
|
238
|
+
exports2.name = vendor.name;
|
|
239
|
+
switch (typeof vendor.pr) {
|
|
240
|
+
case "string":
|
|
241
|
+
exports2.isPR = !!env[vendor.pr];
|
|
242
|
+
break;
|
|
243
|
+
case "object":
|
|
244
|
+
if ("env" in vendor.pr) {
|
|
245
|
+
exports2.isPR = vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne;
|
|
246
|
+
} else if ("any" in vendor.pr) {
|
|
247
|
+
exports2.isPR = vendor.pr.any.some(function(key) {
|
|
248
|
+
return !!env[key];
|
|
249
|
+
});
|
|
250
|
+
} else {
|
|
251
|
+
exports2.isPR = checkEnv(vendor.pr);
|
|
252
|
+
}
|
|
253
|
+
break;
|
|
254
|
+
default:
|
|
255
|
+
exports2.isPR = null;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
exports2.isCI = !!(env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari
|
|
260
|
+
env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
|
|
261
|
+
env.BUILD_NUMBER || // Jenkins, TeamCity
|
|
262
|
+
env.RUN_ID || // TaskCluster, dsari
|
|
263
|
+
exports2.name || false);
|
|
264
|
+
function checkEnv(obj) {
|
|
265
|
+
if (typeof obj === "string")
|
|
266
|
+
return !!env[obj];
|
|
267
|
+
return Object.keys(obj).every(function(k) {
|
|
268
|
+
return env[k] === obj[k];
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
// node_modules/is-ci/index.js
|
|
275
|
+
var require_is_ci = __commonJS({
|
|
276
|
+
"node_modules/is-ci/index.js"(exports2, module2) {
|
|
277
|
+
"use strict";
|
|
278
|
+
module2.exports = require_ci_info().isCI;
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// src/install.js
|
|
283
|
+
var fs = require("fs");
|
|
284
|
+
var path = require("path");
|
|
285
|
+
var { spawnSync } = require("child_process");
|
|
286
|
+
var isCI = require_is_ci();
|
|
287
|
+
function findGit(cwd) {
|
|
288
|
+
let current = cwd;
|
|
289
|
+
while (true) {
|
|
290
|
+
const search = path.join(current, ".git");
|
|
291
|
+
if (fs.existsSync(search)) {
|
|
292
|
+
return path.resolve(current);
|
|
293
|
+
}
|
|
294
|
+
const child = current;
|
|
295
|
+
current = path.dirname(current);
|
|
296
|
+
if (current === child) {
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
function configureCommitTemplate() {
|
|
303
|
+
const gitDir = findGit(process.cwd());
|
|
304
|
+
if (!gitDir) {
|
|
305
|
+
console.warn("Failed to locate git directory, skipping gitmessage");
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
const relPath = path.relative(gitDir, path.join(__dirname, ".."));
|
|
309
|
+
const gitmessage = path.join(relPath, "gitmessage");
|
|
310
|
+
const args = ["config", "commit.template", gitmessage];
|
|
311
|
+
console.info(`git ${args.join(" ")}`);
|
|
312
|
+
spawnSync("git", args);
|
|
313
|
+
}
|
|
314
|
+
if (!isCI) {
|
|
315
|
+
configureCommitTemplate();
|
|
316
|
+
}
|