Skip to content
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

build: upgrade all the things #67

Open
wants to merge 12 commits into
base: master
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: 0 additions & 2 deletions .eslintignore

This file was deleted.

18 changes: 0 additions & 18 deletions .eslintrc.json

This file was deleted.

16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@ jobs:
build:
runs-on: ubuntu-latest

# Test recent LTS versions of Node.js, as well as the exact version from `node-version-file`.
strategy:
matrix:
node-version: [12.x, 14.x]
node-version: [18, 20, 22, ""]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.2.1
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 #v4.0.4
name: Use Node.js ${{ matrix.node-version }}
with:
cache: npm
node-version: ${{ matrix.node-version }}
- run: npm install
node-version-file: .nvmrc
- run: npm ci
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works.

If you want to disable the postinstall scripts, npm ci --ignore-scripts would be the option to set.
This might prevent malicious scripts from being executed.

- run: npm run lint
- run: npm test
- run: npm run test
- run: npm run build
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
save-exact=true
save-prefix=
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.9.0
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 15.4.0
nodejs 22.9.0
12 changes: 12 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import globals from "globals";
import pluginJs from "@eslint/js";

export default [
{
languageOptions: { globals: globals.browser },
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually see this option at the last position (so it can override previous ones).

I guess giving this configuration it should work ™️ , though.

},
pluginJs.configs.recommended,
{
ignores: ["**/third_party/", "**/lib/", "coverage/"],
},
];
17 changes: 13 additions & 4 deletions index.js → index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,25 @@
* limitations under the License.
*/

import { Font } from "./src/lib-font/lib-font-wrapper";
import Fondue from "./src/fondue/Fondue.js";
import { Font } from "./src/lib-font/lib-font-wrapper.mjs";
import Fondue from "./src/fondue/Fondue.mjs";

export async function fromPath(fontPath) {
const { readFile } = await import("node:fs/promises");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why this wasn't imported in line 16, but that shouldn't block the PR.


export function fromPath(fontPath) {
return new Promise((resolve, reject) => {
const font = new Font(fontPath);
font.onload = () => resolve(new Fondue(font));
font.onerror = (e) => reject(e.detail.message);

font.src = fontPath;
(async () => {
try {
const file = await readFile(fontPath);
font.fromDataBuffer(file.buffer, fontPath).catch(reject);
} catch (e) {
reject(e);
}
})();
});
}

Expand Down
Loading
Loading