Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Commit

Permalink
fix(sh): fix node->tish rewrites (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
iarna authored and zkat committed Mar 6, 2019
1 parent 9d533d4 commit 83e7070
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,17 @@ class Installer {
if (pkg.scripts) {
if (pkg.scripts.preinstall) {
const old = pkg.scripts.preinstall
pkg.scripts.preinstall = pkg.scripts.preinstall.replace('node', 'tish')
pkg.scripts.preinstall = pkg.scripts.preinstall.replace(/\bnode([^-\w]|$)/, 'tish$1')
modified = pkg.scripts.preinstall === old
}
if (pkg.scripts.install) {
const old = pkg.scripts.install
pkg.scripts.install = pkg.scripts.install.replace('node', 'tish')
pkg.scripts.install = pkg.scripts.install.replace(/\bnode([^-\w]|$)/, 'tish$1')
modified = pkg.scripts.install === old
}
if (pkg.scripts.postinstall) {
const old = pkg.scripts.postinstall
pkg.scripts.postinstall = pkg.scripts.postinstall.replace('node', 'tish')
pkg.scripts.postinstall = pkg.scripts.postinstall.replace(/\bnode([^-\w]|$)/, 'tish$1')
modified = pkg.scripts.postinstall === old
}
if (modified) {
Expand Down Expand Up @@ -391,7 +391,7 @@ class Installer {
this.log('verbose', 'tinkifyBins', 'convering installed bins to use tink:', bins)
return BB.map(bins, async bin => {
const real = await realpathAsync(bin)
const data = (await readFileAsync(real, 'utf8')).replace(/(#!\s*.*\s*)node/g, '$1tish')
const data = (await readFileAsync(real, 'utf8')).replace(/^(#!.*\b)node([^-\w]|$)/g, '$1tish$2')
await writeFileAsync(real, data, 'utf8')
}, { concurrency: 50, Promise: BB })
}
Expand Down

0 comments on commit 83e7070

Please sign in to comment.