Skip to content

Commit

Permalink
Fixes the corepack binary (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanis authored Sep 29, 2020
1 parent b592a86 commit 3c0af2b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 23 deletions.
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"eslint.nodePath": ".yarn/sdks",
"typescript.enablePromptUseWorkspaceTsdk": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.fixAll.eslint": true
}
}
26 changes: 8 additions & 18 deletions mkshims.ts
Original file line number Diff line number Diff line change
@@ -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`;
Expand Down
6 changes: 2 additions & 4 deletions sources/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));

0 comments on commit 3c0af2b

Please sign in to comment.