Skip to content

Commit

Permalink
fix missing/wrong native extensions in scripts (DataDog#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
rochdev authored Dec 3, 2019
1 parent b43978b commit 9c9e961
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
16 changes: 6 additions & 10 deletions scripts/post_install.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function extract () {
console.log('Extracting prebuilt binaries.')

const promise = tar.extract({
file: `addons-${name}.tgz`,
file: `prebuilds.tgz`,
cwd: path.join(__dirname, '..')
})

Expand All @@ -62,13 +62,9 @@ function extract () {
}

function cleanup () {
platforms
.map(name => path.join(cwd, `addons-${name}.tgz`))
.forEach(file => {
try {
fs.unlinkSync(file)
} catch (e) {
// Ignore as it's just to save space
}
})
try {
fs.unlinkSync(path.join(cwd, `prebuilds.tgz`))
} catch (e) {
// Ignore as it's just to save space
}
}
11 changes: 11 additions & 0 deletions scripts/prepublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ getPipeline()
.then(getPrebuildArtifacts)
.then(downloadArtifacts)
.then(validatePrebuilds)
.then(copyPrebuilds)
.then(bundle)
.catch(e => {
process.exitCode = 1
Expand Down Expand Up @@ -153,6 +154,16 @@ function validatePrebuilds () {
}
}

function copyPrebuilds () {
const basename = path.normalize(path.join(__dirname, '..'))
const filename = 'prebuilds.tgz'

fs.copyFileSync(
path.join(os.tmpdir(), filename),
path.join(basename, filename)
)
}

function bundle () {
exec('yarn bundle')
}

0 comments on commit 9c9e961

Please sign in to comment.