@@ -17,7 +17,6 @@ const DIST_DIR = path.join(CLI_DIR, 'dist')
1717const PJSON = require ( path . join ( CLI_DIR , 'package.json' ) )
1818const NODE_VERSION = PJSON . oclif . update . node . version
1919const SHORT_VERSION = PJSON . version
20- const pathToDist = path . join ( DIST_DIR , `cg-v${ SHORT_VERSION } ` )
2120async function getText ( url ) {
2221 return new Promise ( ( resolve , reject ) => {
2322 https
@@ -65,7 +64,7 @@ async function calculateSHA256(fileName) {
6564async function uploadToS3 ( file ) {
6665 console . log ( `Uploading ${ file } to S3` )
6766 await new Promise ( ( resolve , reject ) => {
68- const pathToFile = path . join ( pathToDist , file )
67+ const pathToFile = path . join ( DIST_DIR , file )
6968 const fileStream = fs . createReadStream ( pathToFile )
7069 fileStream . on ( 'error' , err => {
7170 if ( err ) {
@@ -130,7 +129,7 @@ async function uploadToS3(file) {
130129}
131130
132131function getFilesByOS ( os ) {
133- const files = fs . readdirSync ( pathToDist )
132+ const files = fs . readdirSync ( DIST_DIR )
134133 return files . filter ( file => file . includes ( os ) && ! file . includes ( '.xz' ) )
135134}
136135
@@ -145,7 +144,7 @@ async function updateCgFormula(brewDir) {
145144 const template = fs . readFileSync ( templatePath ) . toString ( 'utf-8' )
146145 const files = getFilesByOS ( 'darwin-x64' )
147146 const zipFile = files . find ( file => file . includes ( 'tar.gz' ) )
148- const pathToFile = path . join ( pathToDist , zipFile )
147+ const pathToFile = path . join ( DIST_DIR , zipFile )
149148 const sha256 = await calculateSHA256 ( pathToFile )
150149 const url = `${ CLI_ASSETS_URL } /cg-v${ SHORT_VERSION } /${ zipFile } `
151150
0 commit comments