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

fix(sh): fix node->tish rewrites #46

Merged
merged 1 commit into from
Mar 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 })
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's tish? 🤩

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a script that shorthands tink sh, since you can't have arguments in some key places (like shebangs in some platforms). Also just a useful shorthand for it.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ❤️ that mashup!

}
Expand Down