Skip to content

Commit 1f218bc

Browse files
committed
document concurrent
1 parent 52a202c commit 1f218bc

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
.mocharc.jsonc
1+
.mocharc.jsonc
2+
CHANGELOG.md

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,19 @@ const localInstaller = new LocalInstaller(
168168
{ npmEnv: Object.assign({}, process.env, { envVar: 'envValue' }) },
169169
);
170170
```
171+
172+
##### Max concurrent installs
173+
174+
In some cases it might be useful to control the max concurrent installs. You can do it by passing `options` to `LocalInstaller`'s constructor.
175+
176+
```javascript
177+
const localInstaller = new LocalInstaller(
178+
{
179+
/*1*/ '.': ['../sibling1', '../sibling2'],
180+
/*2*/ '../dependant': ['.'],
181+
},
182+
{ concurrent: 1 },
183+
);
184+
```
185+
186+
The default concurrency is `os.cpus().length`.

test/unit/LocalInstaller.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,10 @@ describe('LocalInstaller install', () => {
284284
it('should install with the specified concurrency', async () => {
285285
const calls: ((res: Result<Options>) => void)[] = [];
286286
helper.execStub.callsFake((file, args) => {
287-
if(file === 'npm' && args?.includes('pack')) {
287+
if (file === 'npm' && args?.includes('pack')) {
288288
return Promise.resolve(createExecaResult()) as ResultPromise;
289289
}
290-
return new Promise(res => {
290+
return new Promise((res) => {
291291
calls.push(res);
292292
}) as ResultPromise;
293293
});
@@ -301,7 +301,7 @@ describe('LocalInstaller install', () => {
301301
await tick();
302302
expect(calls).to.have.lengthOf(2);
303303
calls[1](createExecaResult());
304-
await onGoingInstall
304+
await onGoingInstall;
305305
});
306306
});
307307

0 commit comments

Comments
 (0)