Skip to content

Instantly share code, notes, and snippets.

@GiladShoham
Last active March 18, 2021 18:33
Show Gist options
  • Save GiladShoham/7d6aff51639647debaa7f494d693c04b to your computer and use it in GitHub Desktop.
Save GiladShoham/7d6aff51639647debaa7f494d693c04b to your computer and use it in GitHub Desktop.
pnpm bug reproduce
import createResolverAndFetcher from '@pnpm/client';
async function test(){
const wantedDep = { alias: '@ci/bixdfh4o-remote.comp1', pref: '' }
const resolveOpts = {
projectDir: '/tmp/dir',
registry: 'http://localhost:4873/'
};
const storeDir = '~/.pnpm-store';
const authConfig1 = {
registry: 'https://node.bit.dev/',
'always-auth': true,
'//node.bit.dev/:_authToken': 'some token',
'//localhost:4873/:_authToken': 'some other token',
'//node.bit.dev/:always-auth': true
}
// const pnpmConfig = await readConfig();
// const authConfig = Object.assign({}, pnpmConfig.config.rawConfig, authConfig1);
const opts: ClientOptions = {
authConfig: authConfig1,
storeDir
};
const { resolve } = await createResolverAndFetcher(opts);
const val = await resolve(wantedDep, resolveOpts);
console.log('val', val)
return val;
}
console.log('start')
test().then(res => {
console.log('inside then')
}).catch(e => {
console.log('get error', e)
})
console.log('after')
process.on('unhandledRejection', (e) => {
console.log('unhandledRejection')
})
process.on('uncaughtException', (e)=>{
console.log('uncaughtException')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment