Files
tipsi-stripe/example/scripts/replaceToTarball.js
2017-11-06 17:14:53 +03:00

23 lines
550 B
JavaScript
Executable File

#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const exampleRoot = process.cwd()
const string = '"tipsi-stripe": "file:../'
function replaceConstant(filePath) {
fs.readFile(filePath, 'utf8', (err, data) => {
if (err) {
return err
}
const result = data.replace(string, `${string}${process.env.tarball_name}`)
return fs.writeFile(filePath, result, 'utf8', error => (
error && console.error(error) // eslint-disable-line
))
})
}
replaceConstant(path.join(exampleRoot, 'package.json'))