Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}