mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
14 lines
500 B
JavaScript
14 lines
500 B
JavaScript
import { writeFile } from 'fs/promises';
|
|
import { join } from 'path';
|
|
// A quick script to regenerate package.jsons for each cjs and esm after tsup cleans distributions
|
|
const locations = process.argv;
|
|
locations.shift();
|
|
locations.shift();
|
|
for (const loc of locations) {
|
|
if (loc.endsWith('cjs')) {
|
|
await writeFile(join(loc, 'package.json'), JSON.stringify({ type: 'commonjs' }));
|
|
} else {
|
|
await writeFile(join(loc, 'package.json'), JSON.stringify({ type: 'module' }));
|
|
}
|
|
}
|