Skip to content

Commit

Permalink
perf: link in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Apr 18, 2022
1 parent 137428d commit b9182b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import { linkPackage } from './link-package';

const { packagePaths } = argv._;

for (const packagePath of packagePaths) {
await linkPackage(packagePath);
}
await Promise.all(
packagePaths.map(
packagePath => linkPackage(packagePath),
),
);
})().catch((error) => {
console.error('Error:', error.message);
process.exit(1);
Expand Down
6 changes: 2 additions & 4 deletions tests/specs/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ export default testSuite(({ describe }, nodePath: string) => {
});

expect(linkProcess.exitCode).toBe(1);
expect(linkProcess.stdout).toBe([
'βœ” Symlinked package-binary: node_modules/package-binary β†’ ../package-binary',
'βœ” Symlinked @organization/package-organization: node_modules/@organization/package-organization β†’ ../package-organization',
].join('\n'));
expect(linkProcess.stdout).toMatch('βœ” Symlinked package-binary: node_modules/package-binary β†’ ../package-binary');
expect(linkProcess.stdout).toMatch('βœ” Symlinked @organization/package-organization: node_modules/@organization/package-organization β†’ ../package-organization');
expect(linkProcess.stderr).toMatch('βœ– Failed to symlink');

await fixture.rm();
Expand Down

0 comments on commit b9182b5

Please sign in to comment.