summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCashew <52880648+Scrub1492@users.noreply.github.com>2023-12-19 13:53:03 +0900
committerGitHub <noreply@github.com>2023-12-19 04:53:03 +0000
commitae2e2db90945705c965b3a10e414bb142e492792 (patch)
treec5d0755db5713032c4302977a1985058d7f11b8d
parent6b07b1e6e158f718fd30c44878a72c3b6ad83fa0 (diff)
change *file to *filePath in function parameters (#385)
* change *file to *filePath * fix merge issues --------- Co-authored-by: Darius Jahandarie <djahandarie@gmail.com>
-rw-r--r--dev/bin/generate-css-json.js4
-rw-r--r--dev/generate-css-json.js20
-rw-r--r--test/css-json.test.js4
3 files changed, 14 insertions, 14 deletions
diff --git a/dev/bin/generate-css-json.js b/dev/bin/generate-css-json.js
index 73c406e0..57419b41 100644
--- a/dev/bin/generate-css-json.js
+++ b/dev/bin/generate-css-json.js
@@ -21,8 +21,8 @@ import {formatRulesJson, generateRules, getTargets} from '../generate-css-json.j
/** */
function main() {
- for (const {cssFile, overridesCssFile, outputPath} of getTargets()) {
- const json = formatRulesJson(generateRules(cssFile, overridesCssFile));
+ for (const {cssFilePath, overridesCssFilePath, outputPath} of getTargets()) {
+ const json = formatRulesJson(generateRules(cssFilePath, overridesCssFilePath));
fs.writeFileSync(outputPath, json, {encoding: 'utf8'});
}
}
diff --git a/dev/generate-css-json.js b/dev/generate-css-json.js
index a0035346..88f103ee 100644
--- a/dev/generate-css-json.js
+++ b/dev/generate-css-json.js
@@ -24,18 +24,18 @@ import {fileURLToPath} from 'url';
const dirname = path.dirname(fileURLToPath(import.meta.url));
/**
- * @returns {{cssFile: string, overridesCssFile: string, outputPath: string}[]}
+ * @returns {{cssFilePath: string, overridesCssFilePath: string, outputPath: string}[]}
*/
export function getTargets() {
return [
{
- cssFile: path.join(dirname, '..', 'ext/css/structured-content.css'),
- overridesCssFile: path.join(dirname, 'data/structured-content-overrides.css'),
+ cssFilePath: path.join(dirname, '..', 'ext/css/structured-content.css'),
+ overridesCssFilePath: 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'),
+ cssFilePath: path.join(dirname, '..', 'ext/css/display-pronunciation.css'),
+ overridesCssFilePath: path.join(dirname, 'data/display-pronunciation-overrides.css'),
outputPath: path.join(dirname, '..', 'ext/data/pronunciation-style.json')
}
];
@@ -124,14 +124,14 @@ export function formatRulesJson(rules) {
/**
* Generates a CSS ruleset.
- * @param {string} cssFile Path to CSS file.
- * @param {string} overridesCssFile Path to override CSS file.
+ * @param {string} cssFilePath
+ * @param {string} overridesCssFilePath
* @returns {import('css-style-applier').RawStyleData}
* @throws {Error}
*/
-export function generateRules(cssFile, overridesCssFile) {
- const content1 = fs.readFileSync(cssFile, {encoding: 'utf8'});
- const content2 = fs.readFileSync(overridesCssFile, {encoding: 'utf8'});
+export function generateRules(cssFilePath, overridesCssFilePath) {
+ const content1 = fs.readFileSync(cssFilePath, {encoding: 'utf8'});
+ const content2 = fs.readFileSync(overridesCssFilePath, {encoding: 'utf8'});
const stylesheet1 = /** @type {css.StyleRules} */ (css.parse(content1, {}).stylesheet);
const stylesheet2 = /** @type {css.StyleRules} */ (css.parse(content2, {}).stylesheet);
diff --git a/test/css-json.test.js b/test/css-json.test.js
index 66ecfeba..e4155ca3 100644
--- a/test/css-json.test.js
+++ b/test/css-json.test.js
@@ -23,9 +23,9 @@ import {formatRulesJson, generateRules, getTargets} from '../dev/generate-css-js
/** */
function main() {
test('css-json', () => {
- for (const {cssFile, overridesCssFile, outputPath} of getTargets()) {
+ for (const {cssFilePath, overridesCssFilePath, outputPath} of getTargets()) {
const actual = fs.readFileSync(outputPath, {encoding: 'utf8'});
- const expected = formatRulesJson(generateRules(cssFile, overridesCssFile));
+ const expected = formatRulesJson(generateRules(cssFilePath, overridesCssFilePath));
expect(actual).toStrictEqual(expected);
}
});