Skip to content

Commit

Permalink
Fixed generatePackageList for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Joery-M committed Mar 26, 2024
1 parent 3d37808 commit e3f056d
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions packages/safelight/buildscripts/generatePackageList.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { spawn } from 'child_process';
import { existsSync } from 'fs';
import { spawnSync } from 'child_process';
import { existsSync, writeFileSync } from 'fs';
import { mkdir } from 'fs/promises';
import { join } from 'path';
import { mkdir, writeFile } from 'fs/promises';

const projects = [
{
Expand Down Expand Up @@ -30,21 +30,19 @@ const bannedKeys = ['unsavedDependencies', 'path'];

function generatePackagesForProject(projectPath: string, outputFileName: string) {
return new Promise<void>((resolve) => {
const output = spawn('pnpm', ['list', '--depth', '2', '--json', '--long'], {
const output = spawnSync('pnpm', ['list', '--depth', '2', '--json', '--long'], {
cwd: join(process.cwd(), '../../', projectPath),
stdio: ['inherit', 'pipe', 'inherit'],
shell: true
});

// Everything is spat out in one go
output.stdout.once('data', async (msg) => {
const filteredFile = removePath(JSON.parse(msg.toString())[0]);
await writeFile(
join('./src/generated/', outputFileName),
JSON.stringify(filteredFile, undefined, 4)
);
resolve();
});
const filteredFile = removePath(JSON.parse(output.stdout.toString())[0]);
writeFileSync(
join('./src/generated/', outputFileName),
JSON.stringify(filteredFile, undefined, 4)
);

resolve();
});
}

Expand Down

0 comments on commit e3f056d

Please sign in to comment.