From d025aaf369c7233a7d79fbcfb42b40b7c3aa6824 Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Tue, 21 Mar 2017 09:29:46 -0700 Subject: [PATCH] [dev] Actually fix tmp dir path in daily --- scripts/daily.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/daily.js b/scripts/daily.js index 053b4ca59..52b352de5 100644 --- a/scripts/daily.js +++ b/scripts/daily.js @@ -6,6 +6,7 @@ const semver = require('semver') const program = require('commander') const pkg = require('../packages/client-app/package.json') +const TMP_DIR = path.join(__dirname, '..', 'tmp') async function spawn(cmd, args, opts = {}) { return new Promise((resolve, reject) => { @@ -41,19 +42,18 @@ function git(subCmd, opts = {}) { } async function prependToFile(filepath, string) { - const tmpDir = path.join(__dirname, '..', 'tmp') - mkdirp.sync(tmpDir) - await exec(`echo "${string}" > ${tmpDir}/tmpfile`) - await exec(`cat ${filepath} >> ${tmpDir}/tmpfile`) - await exec(`mv ${tmpDir}/tmpfile ${filepath}`) + await exec(`echo "${string}" > ${TMP_DIR}/tmpfile`) + await exec(`cat ${filepath} >> ${TMP_DIR}/tmpfile`) + await exec(`mv ${TMP_DIR}/tmpfile ${filepath}`) } async function sliceFileLines(filepath, idx) { - await exec(`tail -n +${1 + idx} ${filepath} > ./tmp/tmpfile`) - await exec(`mv ./tmp/tmpfile ${filepath}`) + await exec(`tail -n +${1 + idx} ${filepath} > ${TMP_DIR}/tmpfile`) + await exec(`mv ${TMP_DIR}/tmpfile ${filepath}`) } async function updateChangelogFile(changelogString) { + mkdirp.sync(TMP_DIR) await sliceFileLines('./packages/client-app/CHANGELOG.md', 2) await prependToFile('./packages/client-app/CHANGELOG.md', changelogString) }