1
1
/* eslint-disable no-console */
2
- const execa = require ( 'execa ' )
2
+ const childProcess = require ( 'child_process ' )
3
3
const _ = require ( 'lodash' )
4
4
const { Octokit } = require ( '@octokit/core' )
5
5
6
+ const { getCurrentReleaseData } = require ( './get-current-release-data' )
6
7
const { getNextVersionForBinary } = require ( '../get-next-version' )
7
8
const { getLinkedIssues } = require ( './get-linked-issues' )
8
9
9
10
const octokit = new Octokit ( { auth : process . env . GITHUB_TOKEN } )
10
11
11
- /**
12
- * Get the version, commit date and git sha of the latest tag published on npm.
13
- */
14
- const getCurrentReleaseData = async ( ) => {
15
- console . log ( 'Get Current Release Information\n' )
16
- const { stdout } = await execa ( 'npm' , [ 'info' , 'cypress' , '--json' ] )
17
- const npmInfo = JSON . parse ( stdout )
18
-
19
- const latestReleaseInfo = {
20
- version : npmInfo [ 'dist-tags' ] . latest ,
21
- commitDate : npmInfo . buildInfo . commitDate ,
22
- buildSha : npmInfo . buildInfo . commitSha ,
23
- }
24
-
25
- console . log ( { latestReleaseInfo } )
26
-
27
- return latestReleaseInfo
28
- }
29
-
30
12
/**
31
13
* Get the list of file names that have been added, deleted or changed since the git
32
14
* sha associated with the latest tag published on npm.
@@ -36,8 +18,8 @@ const getCurrentReleaseData = async () => {
36
18
* @param {string } latestReleaseInfo.commitDate - data of release
37
19
* @param {string } latestReleaseInfo.buildSha - git commit associated with published content
38
20
*/
39
- const getChangedFilesSinceLastRelease = async ( latestReleaseInfo ) => {
40
- const { stdout } = await execa ( ' git' , [ ' diff' , ` ${ latestReleaseInfo . buildSha } ..` , ' --name-only' ] )
21
+ const getChangedFilesSinceLastRelease = ( latestReleaseInfo ) => {
22
+ const stdout = childProcess . execSync ( ` git diff ${ latestReleaseInfo . buildSha } .. --name-only` )
41
23
42
24
if ( ! stdout ) {
43
25
console . log ( 'no files changes since last release' )
@@ -117,7 +99,6 @@ const getReleaseData = async (latestReleaseInfo) => {
117
99
118
100
if ( require . main !== module ) {
119
101
module . exports = {
120
- getCurrentReleaseData,
121
102
getReleaseData,
122
103
}
123
104
0 commit comments