Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
angular.js/changelog.js at master · smithl/angular.js · GitHub
Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
smithl
angular.js
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
angular.js
/
changelog.js
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
executable file
·
208 lines (154 loc) · 5.35 KB
master
Breadcrumbs
angular.js
/
changelog.js
Copy path
Top
File metadata and controls
Code
Blame
executable file
·
208 lines (154 loc) · 5.35 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#!/usr/bin/env node
// TODO(vojta): pre-commit hook for validating messages
// TODO(vojta): report errors, currently Q silence everything which really sucks
'use strict'
;
var
child
=
require
(
'child_process'
)
;
var
fs
=
require
(
'fs'
)
;
var
util
=
require
(
'util'
)
;
var
q
=
require
(
'qq'
)
;
var
GIT_LOG_CMD
=
'git log --grep="%s" -E --format=%s %s..HEAD'
;
var
GIT_TAG_CMD
=
'git describe --tags --abbrev=0'
;
var
HEADER_TPL
=
'<a name="%s"></a>\n# %s (%s)\n\n'
;
var
LINK_ISSUE
=
'[#%s](https://github.com/angular/angular.js/issues/%s)'
;
var
LINK_COMMIT
=
'[%s](https://github.com/angular/angular.js/commit/%s)'
;
var
EMPTY_COMPONENT
=
'$$'
;
var
warn
=
function
(
)
{
console
.
log
(
'WARNING:'
,
util
.
format
.
apply
(
null
,
arguments
)
)
;
}
;
var
parseRawCommit
=
function
(
raw
)
{
if
(
!
raw
)
return
null
;
var
lines
=
raw
.
split
(
'\n'
)
;
var
msg
=
{
}
,
match
;
msg
.
hash
=
lines
.
shift
(
)
;
msg
.
subject
=
lines
.
shift
(
)
;
msg
.
closes
=
[
]
;
msg
.
breaks
=
[
]
;
lines
.
forEach
(
function
(
line
)
{
match
=
line
.
match
(
/
(?:
C
l
o
s
e
s
|
F
i
x
e
s
)
\s
#
(
\d
+
)
/
)
;
if
(
match
)
msg
.
closes
.
push
(
parseInt
(
match
[
1
]
)
)
;
}
)
;
match
=
raw
.
match
(
/
B
R
E
A
K
I
N
G
C
H
A
N
G
E
:
(
[
\s
\S
]
*
)
/
)
;
if
(
match
)
{
msg
.
breaking
=
match
[
1
]
;
}
msg
.
body
=
lines
.
join
(
'\n'
)
;
match
=
msg
.
subject
.
match
(
/
^
(
.
*
)
\(
(
.
*
)
\)
\:
\s
(
.
*
)
$
/
)
;
if
(
!
match
||
!
match
[
1
]
||
!
match
[
3
]
)
{
warn
(
'Incorrect message: %s %s'
,
msg
.
hash
,
msg
.
subject
)
;
return
null
;
}
msg
.
type
=
match
[
1
]
;
msg
.
component
=
match
[
2
]
;
msg
.
subject
=
match
[
3
]
;
return
msg
;
}
;
var
linkToIssue
=
function
(
issue
)
{
return
util
.
format
(
LINK_ISSUE
,
issue
,
issue
)
;
}
;
var
linkToCommit
=
function
(
hash
)
{
return
util
.
format
(
LINK_COMMIT
,
hash
.
substr
(
0
,
8
)
,
hash
)
;
}
;
var
currentDate
=
function
(
)
{
var
now
=
new
Date
(
)
;
var
pad
=
function
(
i
)
{
return
(
'0'
+
i
)
.
substr
(
-
2
)
;
}
;
return
util
.
format
(
'%d-%s-%s'
,
now
.
getFullYear
(
)
,
pad
(
now
.
getMonth
(
)
+
1
)
,
pad
(
now
.
getDate
(
)
)
)
;
}
;
var
printSection
=
function
(
stream
,
title
,
section
,
printCommitLinks
)
{
printCommitLinks
=
printCommitLinks
===
undefined
?
true
:
printCommitLinks
;
var
components
=
Object
.
getOwnPropertyNames
(
section
)
.
sort
(
)
;
if
(
!
components
.
length
)
return
;
stream
.
write
(
util
.
format
(
'\n## %s\n\n'
,
title
)
)
;
components
.
forEach
(
function
(
name
)
{
var
prefix
=
'-'
;
var
nested
=
section
[
name
]
.
length
>
1
;
if
(
name
!==
EMPTY_COMPONENT
)
{
if
(
nested
)
{
stream
.
write
(
util
.
format
(
'- **%s:**\n'
,
name
)
)
;
prefix
=
' -'
;
}
else
{
prefix
=
util
.
format
(
'- **%s:**'
,
name
)
;
}
}
section
[
name
]
.
forEach
(
function
(
commit
)
{
if
(
printCommitLinks
)
{
stream
.
write
(
util
.
format
(
'%s %s\n (%s'
,
prefix
,
commit
.
subject
,
linkToCommit
(
commit
.
hash
)
)
)
;
if
(
commit
.
closes
.
length
)
{
stream
.
write
(
',\n '
+
commit
.
closes
.
map
(
linkToIssue
)
.
join
(
', '
)
)
;
}
stream
.
write
(
')\n'
)
;
}
else
{
stream
.
write
(
util
.
format
(
'%s %s'
,
prefix
,
commit
.
subject
)
)
;
}
}
)
;
}
)
;
stream
.
write
(
'\n'
)
;
}
;
var
readGitLog
=
function
(
grep
,
from
)
{
var
deferred
=
q
.
defer
(
)
;
// TODO(vojta): if it's slow, use spawn and stream it instead
child
.
exec
(
util
.
format
(
GIT_LOG_CMD
,
grep
,
'%H%n%s%n%b%n==END=='
,
from
)
,
function
(
code
,
stdout
,
stderr
)
{
var
commits
=
[
]
;
stdout
.
split
(
'\n==END==\n'
)
.
forEach
(
function
(
rawCommit
)
{
var
commit
=
parseRawCommit
(
rawCommit
)
;
if
(
commit
)
commits
.
push
(
commit
)
;
}
)
;
deferred
.
resolve
(
commits
)
;
}
)
;
return
deferred
.
promise
;
}
;
var
writeChangelog
=
function
(
stream
,
commits
,
version
)
{
var
sections
=
{
fix
:
{
}
,
feat
:
{
}
,
perf
:
{
}
,
breaks
:
{
}
}
;
sections
.
breaks
[
EMPTY_COMPONENT
]
=
[
]
;
commits
.
forEach
(
function
(
commit
)
{
var
section
=
sections
[
commit
.
type
]
;
var
component
=
commit
.
component
||
EMPTY_COMPONENT
;
if
(
section
)
{
section
[
component
]
=
section
[
component
]
||
[
]
;
section
[
component
]
.
push
(
commit
)
;
}
if
(
commit
.
breaking
)
{
sections
.
breaks
[
component
]
=
sections
.
breaks
[
component
]
||
[
]
;
sections
.
breaks
[
component
]
.
push
(
{
subject
:
util
.
format
(
"due to %s,\n %s"
,
linkToCommit
(
commit
.
hash
)
,
commit
.
breaking
)
,
hash
:
commit
.
hash
,
closes
:
[
]
}
)
;
}
}
)
;
stream
.
write
(
util
.
format
(
HEADER_TPL
,
version
,
version
,
currentDate
(
)
)
)
;
printSection
(
stream
,
'Bug Fixes'
,
sections
.
fix
)
;
printSection
(
stream
,
'Features'
,
sections
.
feat
)
;
printSection
(
stream
,
'Performance Improvements'
,
sections
.
perf
)
;
printSection
(
stream
,
'Breaking Changes'
,
sections
.
breaks
,
false
)
;
}
;
var
getPreviousTag
=
function
(
)
{
var
deferred
=
q
.
defer
(
)
;
child
.
exec
(
GIT_TAG_CMD
,
function
(
code
,
stdout
,
stderr
)
{
if
(
code
)
deferred
.
reject
(
'Cannot get the previous tag.'
)
;
else
deferred
.
resolve
(
stdout
.
replace
(
'\n'
,
''
)
)
;
}
)
;
return
deferred
.
promise
;
}
;
var
generate
=
function
(
version
,
file
)
{
getPreviousTag
(
)
.
then
(
function
(
tag
)
{
console
.
log
(
'Reading git log since'
,
tag
)
;
readGitLog
(
'^fix|^feat|^perf|BREAKING'
,
tag
)
.
then
(
function
(
commits
)
{
console
.
log
(
'Parsed'
,
commits
.
length
,
'commits'
)
;
console
.
log
(
'Generating changelog to'
,
file
||
'stdout'
,
'('
,
version
,
')'
)
;
writeChangelog
(
file
?
fs
.
createWriteStream
(
file
)
:
process
.
stdout
,
commits
,
version
)
;
}
)
;
}
)
;
}
;
// publish for testing
exports
.
parseRawCommit
=
parseRawCommit
;
// hacky start if not run by jasmine :-D
if
(
process
.
argv
.
join
(
''
)
.
indexOf
(
'jasmine-node'
)
===
-
1
)
{
generate
(
process
.
argv
[
2
]
,
process
.
argv
[
3
]
)
;
}
You can’t perform that action at this time.