diff options
author | Darius Jahandarie <djahandarie@gmail.com> | 2023-11-08 03:11:35 +0900 |
---|---|---|
committer | Darius Jahandarie <djahandarie@gmail.com> | 2023-11-08 03:23:17 +0900 |
commit | 0f4d36938fd0d844f548aa5a7f7e7842df8dfb41 (patch) | |
tree | 5b6be3620a557d0b9177047003f6d742d9d2a32d /dev/manifest-util.js | |
parent | ef79eab44bfd000792c610b968b5ceefd41e76a0 (diff) |
Switch to vitest for ESM support; other fixes
Diffstat (limited to 'dev/manifest-util.js')
-rw-r--r-- | dev/manifest-util.js | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/dev/manifest-util.js b/dev/manifest-util.js index 082cf57c..15175e7f 100644 --- a/dev/manifest-util.js +++ b/dev/manifest-util.js @@ -16,19 +16,21 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -const fs = require('fs'); -const path = require('path'); -const childProcess = require('child_process'); +import childProcess from 'child_process'; +import fs from 'fs'; +import {fileURLToPath} from 'node:url'; +import path from 'path'; +const dirname = path.dirname(fileURLToPath(import.meta.url)); function clone(value) { return JSON.parse(JSON.stringify(value)); } -class ManifestUtil { +export class ManifestUtil { constructor() { - const fileName = path.join(__dirname, 'data', 'manifest-variants.json'); + const fileName = path.join(dirname, 'data', 'manifest-variants.json'); const {manifest, variants, defaultVariant} = JSON.parse(fs.readFileSync(fileName)); this._manifest = manifest; this._variants = variants; @@ -74,7 +76,7 @@ class ManifestUtil { _evaluateModificationCommand(data) { const {command, args, trim} = data; const {stdout, stderr, status} = childProcess.spawnSync(command, args, { - cwd: __dirname, + cwd: dirname, stdio: 'pipe', shell: false }); @@ -263,7 +265,3 @@ class ManifestUtil { } } - -module.exports = { - ManifestUtil -}; |