vrml1to97/tools/repackage.mjs

16 lines
533 B
JavaScript

import {stdin, argv} from 'node:process'
import {streamToString} from '../etc/streamToString.js'
import JSON5 from 'json5'
const json5text = await streamToString(stdin)
const json5 = JSON5.parse(json5text)
delete json5.scripts
delete json5.dependencies
delete json5.devDependencies
const distPrefix = /^dist[/]/
json5.main = json5.main.replace(distPrefix, '')
for (const key in json5.bin) {
json5.bin[key] = json5.bin[key].replace(distPrefix, '')
}
console.log(JSON.stringify(json5, undefined, 3)) // I like how 3 looks best ;-)