-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
Copy pathchange-categories.js
114 lines (108 loc) · 3 KB
/
change-categories.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
const changeLinkPhrases = {
default: {
hasIssue: 'Addresses',
onlyPR: 'Addressed in',
},
fix: {
hasIssue: 'Fixes',
onlyPR: 'Fixed in',
},
}
const userFacingChanges = {
breaking: {
description: 'A breaking change that will require a MVB',
section: '**Breaking Changes:**',
message: changeLinkPhrases.default,
breaking: true,
release: 'major',
},
dependency: {
description: 'A change to a dependency that impact the user',
section: '**Dependency Updates:**',
message: changeLinkPhrases.default,
release: 'patch',
},
deprecation: {
description: 'A API deprecation notice for users',
section: '**Deprecations:**',
message: changeLinkPhrases.default,
release: 'minor',
},
feat: {
description: 'A new feature',
section: '**Features:**',
message: changeLinkPhrases.default,
release: 'minor',
},
fix: {
description: 'A bug or regression fix',
section: '**Bugfixes:**',
message: changeLinkPhrases.fix,
release: 'patch',
},
misc: {
description: 'Misc user-facing changes, like a UI update, which is not a fix or enhancement to how Cypress works',
section: '**Misc:**',
message: changeLinkPhrases.default,
release: 'patch',
},
perf: {
description: 'Changes that improves performance',
section: '**Performance:**',
message: changeLinkPhrases.fix,
release: 'patch',
},
}
const changeCatagories = {
...userFacingChanges,
chore: {
description: 'Changes to the build process or auxiliary tools and libraries such as documentation generation',
release: false,
},
docs: {
description: 'Documentation only changes',
release: false,
},
refactor: {
description: 'A code change that neither fixes a bug nor adds a feature that is not user-facing',
release: false,
},
revert: {
description: 'Reverts a previous commit',
release: false,
revert: true,
},
test: {
description: 'Adding missing or correcting existing tests',
release: false,
},
}
// Used by @semantic-release/commit-analyzer to determine next version for npm packages
const releaseRules = Object.entries(changeCatagories).map(([type, attrs]) => {
return {
type,
breaking: attrs.breaking,
release: attrs.release,
revert: attrs.revert,
}
})
// https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-angular/parser-opts.js
const parserOpts = {
headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/,
headerCorrespondence: [
'type',
'scope',
'subject',
],
noteKeywords: ['BREAKING CHANGE'],
revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
revertCorrespondence: ['header', 'hash'],
}
const migrationGuideBlurb = (version) => `Please read our Migration Guide which explains the changes in more detail and how to change your code to migrate to Cypress ${version}.`
module.exports = {
changeCatagories,
parserOpts,
releaseRules,
userFacingChanges,
migrationGuideBlurb,
}