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",
|
"eslint.nodePath": ".yarn/sdks",
|
||||||
"typescript.enablePromptUseWorkspaceTsdk": true,
|
"typescript.enablePromptUseWorkspaceTsdk": true,
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll": true,
|
|
||||||
"source.fixAll.eslint": true
|
"source.fixAll.eslint": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
26
mkshims.ts
26
mkshims.ts
|
|
@ -1,24 +1,14 @@
|
||||||
import cmdShim from '@zkochan/cmd-shim';
|
import cmdShim from '@zkochan/cmd-shim';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import {SupportedPackageManagers} from 'sources/types';
|
|
||||||
|
|
||||||
import config from './config.json';
|
import {Engine} from './sources/Engine';
|
||||||
|
import {SupportedPackageManagerSet} from './sources/types';
|
||||||
|
|
||||||
|
const engine = new Engine();
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
for (const packageManager of Object.keys(config.definitions) as Array<SupportedPackageManagers>) {
|
for (const packageManager of SupportedPackageManagerSet) {
|
||||||
const binSet = new Set<string>();
|
const binSet = engine.getBinariesFor(packageManager);
|
||||||
|
|
||||||
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 binaryName of binSet) {
|
for (const binaryName of binSet) {
|
||||||
const entryPath = `${__dirname}/dist/${binaryName}.js`;
|
const entryPath = `${__dirname}/dist/${binaryName}.js`;
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,6 @@ export function runMain(argv: Array<string>) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
declare const __non_webpack_require__: any;
|
// Using `eval` to be sure that Webpack doesn't transform it
|
||||||
|
if (process.mainModule === eval(`module`))
|
||||||
if (typeof __non_webpack_require__ === `undefined` && process.mainModule === module)
|
|
||||||
runMain(process.argv.slice(2));
|
runMain(process.argv.slice(2));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue