From 260edfce72acec77873cea282efd61b1c05674ea Mon Sep 17 00:00:00 2001 From: Julian Grinblat Date: Tue, 5 Jul 2022 11:41:18 +0900 Subject: [PATCH] Use esm json import --- bin/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bin/index.js b/bin/index.js index 74a4e7c..76c69aa 100755 --- a/bin/index.js +++ b/bin/index.js @@ -1,7 +1,6 @@ #!/usr/bin/env node import path from 'node:path'; -import { createRequire } from 'node:module'; import { existsSync } from 'node:fs'; import { mkdir, readFile, writeFile } from 'node:fs/promises'; @@ -18,12 +17,11 @@ import { } from 'i18next-conv'; // eslint-disable-line import/no-unresolved,n/no-extraneous-import // https://github.com/import-js/eslint-plugin-import/issues/1649 -const require = createRequire(import.meta.url); -const { version } = require('../package.json'); +import pkg from "../package.json" assert { type: "json" }; // program program - .version(version) + .version(pkg.version) .option('-b, --base [path]', 'Sepcify path for the base language file. only take effect with -K option', '') .option('-f, --filter ', 'Specify path to gettext filter') .option('-l, --language ', 'Specify the language code, eg. \'en\'')