diff options
author | Darius Jahandarie <djahandarie@gmail.com> | 2023-11-09 13:30:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-09 13:30:31 +0000 |
commit | 5c5a167b4792af379cdacf633513cebf20728cd2 (patch) | |
tree | 5b6be3620a557d0b9177047003f6d742d9d2a32d /dev/manifest-util.js | |
parent | b64f51c3b13a46af4dd7f1e43048ac19c781ca7b (diff) | |
parent | 0f4d36938fd0d844f548aa5a7f7e7842df8dfb41 (diff) |
Merge pull request #307 from themoeway/modernize
Modernize codebase
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 -}; |