tools: typograf: use es-modules

This commit is contained in:
He4eT 2023-12-09 09:29:35 +01:00
commit d819ddb655

View file

@ -1,5 +1,5 @@
const Typograf = require('typograf') import Typograf from 'typograf'
const fs = require('fs') import { readFileSync, writeFile } from 'fs'
if (!process.argv[2]) { if (!process.argv[2]) {
console.log('Usage:\n node typograf file [locale]') console.log('Usage:\n node typograf file [locale]')
@ -10,7 +10,7 @@ const filePath =
`${process.cwd()}/${process.argv[2]}` `${process.cwd()}/${process.argv[2]}`
const fileContent = const fileContent =
fs.readFileSync(filePath).toString() readFileSync(filePath).toString()
const locale = const locale =
process.argv[3] || 'en-US' process.argv[3] || 'en-US'
@ -31,7 +31,7 @@ tp.disableRule('*');[
].forEach(rule => ].forEach(rule =>
tp.enableRule(rule)) tp.enableRule(rule))
void fs.writeFile( void writeFile(
filePath, filePath,
tp.execute(fileContent), tp.execute(fileContent),
err => err err => err