mirror of https://github.com/nodejs/corepack.git
Fixes the corepack binary (#16)
This commit is contained in:
parent
b592a8673d
commit
3c0af2b36b
|
|
@ -7,7 +7,6 @@
|
|||
"eslint.nodePath": ".yarn/sdks",
|
||||
"typescript.enablePromptUseWorkspaceTsdk": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll": true,
|
||||
"source.fixAll.eslint": true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
26
mkshims.ts
26
mkshims.ts
|
|
@ -1,24 +1,14 @@
|
|||
import cmdShim from '@zkochan/cmd-shim';
|
||||
import fs from 'fs';
|
||||
import {SupportedPackageManagers} from 'sources/types';
|
||||
import cmdShim from '@zkochan/cmd-shim';
|
||||
import fs from 'fs';
|
||||
|
||||
import config from './config.json';
|
||||
import {Engine} from './sources/Engine';
|
||||
import {SupportedPackageManagerSet} from './sources/types';
|
||||
|
||||
const engine = new Engine();
|
||||
|
||||
async function main() {
|
||||
for (const packageManager of Object.keys(config.definitions) as Array<SupportedPackageManagers>) {
|
||||
const binSet = new Set<string>();
|
||||
|
||||
for (const spec of Object.values(config.definitions[packageManager].ranges)) {
|
||||
if (Array.isArray(spec.bin)) {
|
||||
for (const entry of spec.bin) {
|
||||
binSet.add(entry);
|
||||
}
|
||||
} else {
|
||||
for (const entry of Object.keys(spec.bin)) {
|
||||
binSet.add(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const packageManager of SupportedPackageManagerSet) {
|
||||
const binSet = engine.getBinariesFor(packageManager);
|
||||
|
||||
for (const binaryName of binSet) {
|
||||
const entryPath = `${__dirname}/dist/${binaryName}.js`;
|
||||
|
|
|
|||
|
|
@ -95,8 +95,6 @@ export function runMain(argv: Array<string>) {
|
|||
});
|
||||
}
|
||||
|
||||
declare const __non_webpack_require__: any;
|
||||
|
||||
if (typeof __non_webpack_require__ === `undefined` && process.mainModule === module)
|
||||
// Using `eval` to be sure that Webpack doesn't transform it
|
||||
if (process.mainModule === eval(`module`))
|
||||
runMain(process.argv.slice(2));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue