Glen Whitney
8a0ece1dde
Construct a proper package.json in the dist file and copy the README there for a reasonably complete shipped package. Reviewed-on: #8 Co-authored-by: Glen Whitney <glen@studioinfinity.org> Co-committed-by: Glen Whitney <glen@studioinfinity.org>
16 lines
533 B
JavaScript
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 ;-)
|