Skip to content

Commit

Permalink
fix(build): fix listNpmPackages (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax authored Feb 1, 2021
1 parent 2b42ede commit 2004622
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
13 changes: 13 additions & 0 deletions packages/build/src/npm-packages.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { expect } from 'chai';
import { listNpmPackages } from './npm-packages';

describe('listNpmPackages', () => {
it('lists packages', () => {
const packages = listNpmPackages();
expect(packages.length).to.be.greaterThan(1);
for (const { name, version } of packages) {
expect(name).to.be.a('string');
expect(version).to.be.a('string');
}
});
});
9 changes: 5 additions & 4 deletions packages/build/src/npm-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,17 @@ export function publishNpmPackages(): void {
});
}

function listNpmPackages(): {version: string}[] {
export function listNpmPackages(): {name: string; version: string}[] {
const lernaListOutput = spawn.sync(
LERNA_BIN, [
'list',
'--json',
],
{
cwd: PROJECT_ROOT
cwd: PROJECT_ROOT,
encoding: 'utf8'
}
).toString();
);

return JSON.parse(lernaListOutput);
return JSON.parse(lernaListOutput.stdout);
}

0 comments on commit 2004622

Please sign in to comment.