Skip to content

Raise minimum Node.js version to v20 #230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
fail-fast: false
matrix:
node-version:
- 18
- 20
- lts/*
- latest
steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 1 addition & 2 deletions lib/properties/font.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ module.exports.parse = function parse(v) {
return;
}
} else {
// FIXME: Switch to toReversed() when we can drop Node.js 18 support.
const revParts = [...parsers.splitValue(fontBlockA.trim())].reverse();
const revParts = parsers.splitValue(fontBlockA.trim()).toReversed();
const revFontFamily = [];
const properties = ["font-style", "font-variant", "font-weight", "line-height"];
font["font-style"] = "normal";
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@
},
"license": "MIT",
"engines": {
"node": ">=18"
"node": ">=20"
}
}
13 changes: 4 additions & 9 deletions scripts/generateImplementedProperties.mjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { camelCaseToDashed } from "../lib/utils/camelize.js";

const { dirname } = import.meta;
const dashedProperties = fs
.readdirSync(resolve("../lib/properties"))
.readdirSync(path.resolve(dirname, "../lib/properties"))
.filter((propertyFile) => path.extname(propertyFile) === ".js")
.map((propertyFile) => camelCaseToDashed(path.basename(propertyFile, ".js")));

const outputFile = resolve("../lib/generated/implementedProperties.js");
const outputFile = path.resolve(dirname, "../lib/generated/implementedProperties.js");

const propertyNamesJSON = JSON.stringify(dashedProperties, undefined, 2);
const propertyNamesJSON = JSON.stringify(dashedProperties.toSorted(), undefined, 2);
const dateToday = new Date();
const [dateTodayFormatted] = dateToday.toISOString().split("T");
const output = `"use strict";
Expand All @@ -21,8 +21,3 @@ module.exports = new Set(${propertyNamesJSON});
`;

fs.writeFileSync(outputFile, output);

// TODO: remove when we can drop Node.js 18 support and use import.meta.dirname.
function resolve(relativePath) {
return path.resolve(path.dirname(fileURLToPath(import.meta.url)), relativePath);
}