disassemble-package
Version:
Separate the config contained in package.json into a file.
12 lines • 636 B
JavaScript
import { readFile, writeFile } from 'fs/promises';
import { join } from 'path';
import * as disassemblers from './disassemblers';
export const DisassemblePackage = async (path = process.cwd(), { space = 2 }) => {
const json = JSON.parse(await readFile(join(path, 'package.json'), { encoding: 'utf8' }));
await Promise.all(exec([path, json, { space }], Object.values(disassemblers)));
await writeFile(join(path, 'package.json'), JSON.stringify(json, undefined, space));
};
const exec = (args, funcs) => funcs
.filter((func) => func instanceof Function)
.map((func) => func(...args));
//# sourceMappingURL=index.js.map