-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f83a463
commit c1e86ee
Showing
2 changed files
with
40 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
'use strict' | ||
const { spawn } = require('child_process') | ||
const { realpathSync } = require('fs') | ||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
const realFilename = realpathSync(__filename) | ||
|
@@ -14,9 +15,24 @@ async function main () { | |
const pnpmpath = await require('./link.cjs')(path.join(realDirname, 'bin'), 'pnpm') | ||
process.exitCode = 1 | ||
const injectionpath = path.join(realDirname, 'pnpm-injection.cjs') | ||
console.log(process.execPath) | ||
const pnpmModulePath = `${process.env.PNPM_HOME}/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/pnpm.cjs` | ||
|
||
// require.cache[process.argv[1]] = { exports: {} } | ||
// require.cache[pnpmModulePath] = { get exports() {console.log(123)} } | ||
// require('module').Module.runMain = () => {} | ||
|
||
// Read module file | ||
// await fs.readFile(pnpmModulePath, 'utf-8' , (err, data) => { | ||
// if (err) throw err; | ||
// console.log(data); | ||
// }); | ||
|
||
// Require the installed pnpm module | ||
require(pnpmModulePath) | ||
|
||
// spawn(process.execPath, ['--require', injectionpath, pnpmpath, ...process.argv.slice(2)], { | ||
// spawn(process.execPath, ['--require', injectionpath, pnpmModulePath, ...process.argv.slice(2)], { | ||
// spawn(process.execPath, ['--require', pnpmModulePath, ...process.argv.slice(2)], { | ||
// stdio: 'inherit' | ||
// }).on('exit', (code, signal) => { | ||
// if (signal) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters