summaryrefslogtreecommitdiff
path: root/dev/manifest-util.js
diff options
context:
space:
mode:
authorDarius Jahandarie <djahandarie@gmail.com>2023-11-08 03:11:35 +0900
committerDarius Jahandarie <djahandarie@gmail.com>2023-11-08 03:23:17 +0900
commit0f4d36938fd0d844f548aa5a7f7e7842df8dfb41 (patch)
tree5b6be3620a557d0b9177047003f6d742d9d2a32d /dev/manifest-util.js
parentef79eab44bfd000792c610b968b5ceefd41e76a0 (diff)
Switch to vitest for ESM support; other fixes
Diffstat (limited to 'dev/manifest-util.js')
-rw-r--r--dev/manifest-util.js18
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
-};