@@ -17,7 +17,6 @@ const DIST_DIR = path.join(CLI_DIR, 'dist')
17
17
const PJSON = require ( path . join ( CLI_DIR , 'package.json' ) )
18
18
const NODE_VERSION = PJSON . oclif . update . node . version
19
19
const SHORT_VERSION = PJSON . version
20
- const pathToDist = path . join ( DIST_DIR , `cg-v${ SHORT_VERSION } ` )
21
20
async function getText ( url ) {
22
21
return new Promise ( ( resolve , reject ) => {
23
22
https
@@ -65,7 +64,7 @@ async function calculateSHA256(fileName) {
65
64
async function uploadToS3 ( file ) {
66
65
console . log ( `Uploading ${ file } to S3` )
67
66
await new Promise ( ( resolve , reject ) => {
68
- const pathToFile = path . join ( pathToDist , file )
67
+ const pathToFile = path . join ( DIST_DIR , file )
69
68
const fileStream = fs . createReadStream ( pathToFile )
70
69
fileStream . on ( 'error' , err => {
71
70
if ( err ) {
@@ -130,7 +129,7 @@ async function uploadToS3(file) {
130
129
}
131
130
132
131
function getFilesByOS ( os ) {
133
- const files = fs . readdirSync ( pathToDist )
132
+ const files = fs . readdirSync ( DIST_DIR )
134
133
return files . filter ( file => file . includes ( os ) && ! file . includes ( '.xz' ) )
135
134
}
136
135
@@ -145,7 +144,7 @@ async function updateCgFormula(brewDir) {
145
144
const template = fs . readFileSync ( templatePath ) . toString ( 'utf-8' )
146
145
const files = getFilesByOS ( 'darwin-x64' )
147
146
const zipFile = files . find ( file => file . includes ( 'tar.gz' ) )
148
- const pathToFile = path . join ( pathToDist , zipFile )
147
+ const pathToFile = path . join ( DIST_DIR , zipFile )
149
148
const sha256 = await calculateSHA256 ( pathToFile )
150
149
const url = `${ CLI_ASSETS_URL } /cg-v${ SHORT_VERSION } /${ zipFile } `
151
150
0 commit comments