aboutsummaryrefslogtreecommitdiff
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/dictionary-validate.js5
-rw-r--r--dev/generate-css-json.js15
2 files changed, 13 insertions, 7 deletions
diff --git a/dev/dictionary-validate.js b/dev/dictionary-validate.js
index b3654e75..a6948bfe 100644
--- a/dev/dictionary-validate.js
+++ b/dev/dictionary-validate.js
@@ -20,14 +20,17 @@ import fs from 'fs';
import JSZip from 'jszip';
import path from 'path';
import {performance} from 'perf_hooks';
+import {fileURLToPath} from 'url';
import {createJsonSchema} from './schema-validate.js';
+const dirname = path.dirname(fileURLToPath(import.meta.url));
+
/**
* @param {string} relativeFileName
* @returns {import('dev/dictionary-validate').Schema}
*/
function readSchema(relativeFileName) {
- const fileName = path.join(__dirname, relativeFileName);
+ const fileName = path.join(dirname, relativeFileName);
const source = fs.readFileSync(fileName, {encoding: 'utf8'});
return JSON.parse(source);
}
diff --git a/dev/generate-css-json.js b/dev/generate-css-json.js
index 02e54530..e5d4d7f0 100644
--- a/dev/generate-css-json.js
+++ b/dev/generate-css-json.js
@@ -19,6 +19,9 @@
import css from 'css';
import fs from 'fs';
import path from 'path';
+import {fileURLToPath} from 'url';
+
+const dirname = path.dirname(fileURLToPath(import.meta.url));
/**
* @returns {{cssFile: string, overridesCssFile: string, outputPath: string}[]}
@@ -26,14 +29,14 @@ import path from 'path';
export function getTargets() {
return [
{
- cssFile: path.join(__dirname, '..', 'ext/css/structured-content.css'),
- overridesCssFile: path.join(__dirname, 'data/structured-content-overrides.css'),
- outputPath: path.join(__dirname, '..', 'ext/data/structured-content-style.json')
+ cssFile: path.join(dirname, '..', 'ext/css/structured-content.css'),
+ overridesCssFile: path.join(dirname, 'data/structured-content-overrides.css'),
+ outputPath: path.join(dirname, '..', 'ext/data/structured-content-style.json')
},
{
- cssFile: path.join(__dirname, '..', 'ext/css/display-pronunciation.css'),
- overridesCssFile: path.join(__dirname, 'data/display-pronunciation-overrides.css'),
- outputPath: path.join(__dirname, '..', 'ext/data/pronunciation-style.json')
+ cssFile: path.join(dirname, '..', 'ext/css/display-pronunciation.css'),
+ overridesCssFile: path.join(dirname, 'data/display-pronunciation-overrides.css'),
+ outputPath: path.join(dirname, '..', 'ext/data/pronunciation-style.json')
}
];
}