File tree Expand file tree Collapse file tree 2 files changed +48
-1
lines changed
Expand file tree Collapse file tree 2 files changed +48
-1
lines changed Original file line number Diff line number Diff line change 1212 "dartanalyzer" : " cd dist/dart && pub install && cd ../.. && ts-node scripts/ci/dart_analyzer" ,
1313 "demo-app" : " ng serve" ,
1414 "test" : " karma start test/karma.conf.js" ,
15- "tslint" : " tslint -c tslint.json 'src/**/*.ts'" ,
15+ "tslint" : " tslint -c tslint.json 'src/**/*.ts'" ,
1616 "typings" : " typings install --ambient" ,
1717 "postinstall" : " npm run typings" ,
1818 "e2e" : " protractor ./protractor.conf.js"
3434 "zone.js" : " 0.5.15"
3535 },
3636 "devDependencies" : {
37+ "add-stream" : " ^1.0.0" ,
3738 "angular-cli" : " ^0.0.24" ,
3839 "angular-cli-github-pages" : " ^0.2.0" ,
3940 "broccoli-autoprefixer" : " ^4.1.0" ,
4243 "broccoli-sass" : " ^0.7.0" ,
4344 "broccoli-source" : " ^1.1.0" ,
4445 "browserstacktunnel-wrapper" : " ^1.4.2" ,
46+ "conventional-changelog" : " ^1.1.0" ,
4547 "ember-cli-inject-live-reload" : " ^1.3.0" ,
4648 "fs-extra" : " ^0.26.5" ,
4749 "glob" : " ^6.0.4" ,
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ /**
3+ * Creates a conventional changelog from the current git repository / metadata.
4+ */
5+
6+ var fs = require ( 'fs' ) ;
7+ var addStream = require ( 'add-stream' ) ;
8+ var cl = require ( 'conventional-changelog' ) ;
9+ var inStream = fs . createReadStream ( 'CHANGELOG.md' ) ;
10+
11+ /**
12+ * When the command line argument `--force` is provided, then the full changelog will created and overwritten.
13+ * By default, it will only create the changelog from the latest tag to head and prepends it to the changelog.
14+ */
15+ var isForce = process . argv . indexOf ( '--force' ) !== - 1 ;
16+
17+ inStream . on ( 'error' , function ( err ) {
18+ console . error ( 'An error occurred, while reading the previous changelog file.\n' +
19+ 'If there is no previous changelog, then you should create an empty file or use the `--force` flag.\n' + err ) ;
20+
21+ process . exit ( 1 ) ;
22+ } ) ;
23+
24+ var config = {
25+ preset : 'angular' ,
26+ releaseCount : isForce ? 0 : 1
27+ } ;
28+
29+ var stream = cl ( config )
30+ . on ( 'error' , function ( err ) {
31+ console . error ( 'An error occurred while generating the changelog: ' + err ) ;
32+ } )
33+ . pipe ( ! isForce && addStream ( inStream ) || getOutputStream ( ) ) ;
34+
35+ // When we are pre-pending the new changelog, then we need to wait for the input stream to be ending,
36+ // otherwise we can't write into the same destination.
37+ if ( ! isForce ) {
38+ inStream . on ( 'end' , function ( ) {
39+ stream . pipe ( getOutputStream ( ) ) ;
40+ } ) ;
41+ }
42+
43+ function getOutputStream ( ) {
44+ return fs . createWriteStream ( 'CHANGELOG.md' ) ;
45+ }
You can’t perform that action at this time.
0 commit comments