@@ -321,17 +321,17 @@ class Installer {
321
321
if ( pkg . scripts ) {
322
322
if ( pkg . scripts . preinstall ) {
323
323
const old = pkg . scripts . preinstall
324
- pkg . scripts . preinstall = pkg . scripts . preinstall . replace ( 'node' , 'tish' )
324
+ pkg . scripts . preinstall = pkg . scripts . preinstall . replace ( / \b n o d e ( [ ^ - \w ] | $ ) / , 'tish$1 ' )
325
325
modified = pkg . scripts . preinstall === old
326
326
}
327
327
if ( pkg . scripts . install ) {
328
328
const old = pkg . scripts . install
329
- pkg . scripts . install = pkg . scripts . install . replace ( 'node' , 'tish' )
329
+ pkg . scripts . install = pkg . scripts . install . replace ( / \b n o d e ( [ ^ - \w ] | $ ) / , 'tish$1 ' )
330
330
modified = pkg . scripts . install === old
331
331
}
332
332
if ( pkg . scripts . postinstall ) {
333
333
const old = pkg . scripts . postinstall
334
- pkg . scripts . postinstall = pkg . scripts . postinstall . replace ( 'node' , 'tish' )
334
+ pkg . scripts . postinstall = pkg . scripts . postinstall . replace ( / \b n o d e ( [ ^ - \w ] | $ ) / , 'tish$1 ' )
335
335
modified = pkg . scripts . postinstall === old
336
336
}
337
337
if ( modified ) {
@@ -391,7 +391,7 @@ class Installer {
391
391
this . log ( 'verbose' , 'tinkifyBins' , 'convering installed bins to use tink:' , bins )
392
392
return BB . map ( bins , async bin => {
393
393
const real = await realpathAsync ( bin )
394
- const data = ( await readFileAsync ( real , 'utf8' ) ) . replace ( / ( # ! \s * .* \s * ) n o d e / g, '$1tish' )
394
+ const data = ( await readFileAsync ( real , 'utf8' ) ) . replace ( / ^ ( # ! .* \b ) n o d e ( [ ^ - \w ] | $ ) / g, '$1tish$2 ' )
395
395
await writeFileAsync ( real , data , 'utf8' )
396
396
} , { concurrency : 50 , Promise : BB } )
397
397
}
0 commit comments