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

Feat/bump nodejs to 18 #93

Merged
merged 10 commits into from
Jul 14, 2024
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
build:
strategy:
matrix:
node: [16]
node: [18]
platform: [ubuntu-latest, macos-latest, windows-latest]
name: "${{matrix.platform}} / Node.js ${{ matrix.node }}"
runs-on: ${{matrix.platform}}
Expand All @@ -52,7 +52,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.7.1
version: 9.5.0
run_install: false

- name: Install Node.js
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 8.7.1
version: 9.5.0
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 18
cache: 'pnpm'

- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.7.1
version: 9.5.0
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 18
cache: 'pnpm'

- name: Get pnpm store directory
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
example/.env.local

/coverage/
/docs/
/docs/

/dist
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.20.3
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Introduction](./README.md) | [简体中文](./README_CN.md) |[はじめに](./README_JP.md)
[Introduction](./README.md) | [简体中文](./README_CN.md) |[はじめに](./README_JA.md)

---

Expand All @@ -9,21 +9,22 @@
[![Build and Publish](https://github.com/open-spaced-repetition/ts-fsrs/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/open-spaced-repetition/ts-fsrs/actions/workflows/npm-publish.yml)
[![Deploy](https://github.com/open-spaced-repetition/ts-fsrs/actions/workflows/deploy.yml/badge.svg)](https://github.com/open-spaced-repetition/ts-fsrs/actions/workflows/deploy.yml)

ts-fsrs is a [ES modules package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) based on TypeScript, used to implement the [Free Spaced Repetition Scheduler (FSRS) algorithm](https://github.com/open-spaced-repetition/free-spaced-repetition-scheduler). It helps
developers apply FSRS to their flashcard applications, there by improving the user learning experience.
ts-fsrs is a versatile package based on TypeScript that supports [ES modules](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c), [CommonJS](https://en.wikipedia.org/wiki/CommonJS), and UMD. It implements the [Free Spaced Repetition Scheduler (FSRS) algorithm](https://github.com/open-spaced-repetition/free-spaced-repetition-scheduler), enabling developers to integrate FSRS into their flashcard applications to enhance the user learning experience.

The workflow for TS-FSRS can be referenced from the following resources:
> - google driver: [ts-fsrs-workflow.drawio](https://drive.google.com/file/d/1FLKjpt4T3Iis02vjoA10q7vxKCWwClfR/view?usp=sharing) (You may provide commentary)
> - github: [ts-fsrs-workflow.drawio](./ts-fsrs-workflow.drawio)


# Usage
You need to run on Node.js (>=16.0.0) , using the `"type":"module"` by default in `package.json`.
The ts-fsrs@3.x package requires Node.js version `16.0.0` or higher. Starting with `ts-fsrs@4.x`, the minimum required Node.js version is 18.0.0.
From version `3.5.6` onwards, ts-fsrs supports CommonJS, ESM, and UMD module systems.

```
npm install ts-fsrs
yarn install ts-fsrs
pnpm install ts-fsrs
bun install ts-fsrs
```

# Example
Expand Down
10 changes: 5 additions & 5 deletions README_CN.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Introduction](./README.md) | [简体中文](./README_CN.md) |[はじめに](./README_JP.md)
[Introduction](./README.md) | [简体中文](./README_CN.md) |[はじめに](./README_JA.md)

---

Expand All @@ -9,20 +9,20 @@
[![Build and Publish](https://github.com/open-spaced-repetition/ts-fsrs/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/open-spaced-repetition/ts-fsrs/actions/workflows/npm-publish.yml)
[![Deploy](https://github.com/open-spaced-repetition/ts-fsrs/actions/workflows/deploy.yml/badge.svg)](https://github.com/open-spaced-repetition/ts-fsrs/actions/workflows/deploy.yml)

ts-fsrs 是一个基于TypeScript开发的[ES modules包](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)
,用于实现[自由间隔重复调度器(FSRS)算法](https://github.com/open-spaced-repetition/free-spaced-repetition-scheduler/blob/main/README_CN.md)
的工具。它可以帮助开发者将FSRS应用到他们的记忆卡应用中,从而提升用户的学习体验。
ts-fsrs是一个基于TypeScript的多功能包,支持[ES模块](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)、[CommonJS](https://en.wikipedia.org/wiki/CommonJS)和UMD。它实现了[自由间隔重复调度器(FSRS)算法](https://github.com/open-spaced-repetition/free-spaced-repetition-scheduler/blob/main/README_CN.md),使开发人员能够将FSRS集成到他们的闪卡应用程序中,从而增强用户的学习体验。

> 你可以通过[ts-fsrs-workflow.drawio](./ts-fsrs-workflow.drawio)来获取ts-fsrs的工作流信息。

# 使用ts-fsrs

你需要运行在 Node.js (>=16.0.0)上,并且在`package.json`默认使用 `"type":"module"`。
`ts-fsrs@3.x`需要运行在 Node.js (>=16.0.0)上,`ts-fsrs@4.x`需要运行在 Node.js (>=18.0.0)上。
从`ts-fsrs@3.5.6`开始,ts-fsrs支持CommonJS、ESM和UMD模块系统

```
npm install ts-fsrs
yarn install ts-fsrs
pnpm install ts-fsrs
bun install ts-fsrs
```

# 例子
Expand Down
10 changes: 5 additions & 5 deletions README_JP.md → README_JA.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Introduction](./README.md) | [简体中文](./README_CN.md) |[はじめに](./README_JP.md)
[Introduction](./README.md) | [简体中文](./README_CN.md) |[はじめに](./README_JA.md)

---

Expand All @@ -9,9 +9,7 @@
[![Build and Publish](https://github.com/open-spaced-repetition/ts-fsrs/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/open-spaced-repetition/ts-fsrs/actions/workflows/npm-publish.yml)
[![Deploy](https://github.com/open-spaced-repetition/ts-fsrs/actions/workflows/deploy.yml/badge.svg)](https://github.com/open-spaced-repetition/ts-fsrs/actions/workflows/deploy.yml)

ts-fsrsは[自由間隔重複スケジューラ(FSRS)アルゴリズム](https://github.com/open-spaced-repetition/free-spaced-repetition-scheduler)
を実装するための、TypeScriptで開発された[ESモジュールパッケージ](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)
です。このツールは、開発者がFSRSアルゴリズムを彼らのフラッシュカードアプリケーションに適用し、ユーザーの学習体験を向上させるのに役立ちます。
ts-fsrsはTypeScriptに基づいた多機能なパッケージで、[ESモジュール]((https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c))、[CommonJS](https://en.wikipedia.org/wiki/CommonJS)、UMDに対応しています。[自由間隔重複スケジューラ(FSRS)アルゴリズム](https://github.com/open-spaced-repetition/free-spaced-repetition-scheduler) を実装しており、開発者がFSRSをフラッシュカードアプリケーションに統合することで、ユーザーの学習体験を向上させることができます。

ts-fsrsのワークフローについては、以下のリソースを参照してください。
> - google driver: [ts-fsrs-workflow.drawio](https://drive.google.com/file/d/1FLKjpt4T3Iis02vjoA10q7vxKCWwClfR/view?usp=sharing) (コメントを提供できます)
Expand All @@ -20,12 +18,14 @@ ts-fsrsのワークフローについては、以下のリソースを参照し

# ts-fsrsの使用方法

Node.js (バージョン >= 16.0.0)を実行する環境を準備して、`package.json`で`"type":"module"`をデフォルトに設定してください。
`ts-fsrs@3.x`はNode.js(>=16.0.0)で動作する必要があります。`ts-fsrs@4.x`からは、最小必要なNode.jsバージョンは18.0.0です。
`ts-fsrs@3.5.6`以降、ts-fsrsはCommonJS、ESM、UMDモジュールシステムをサポートしています。

```
npm install ts-fsrs
yarn install ts-fsrs
pnpm install ts-fsrs
bun install ts-fsrs
```

# 例
Expand Down
42 changes: 42 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [
...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"),
{
plugins: {
"@typescript-eslint": typescriptEslint,
},

languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.amd,
},

parser: tsParser,
ecmaVersion: "latest",
sourceType: "module",
},

rules: {
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-namespace": "warn",
},
},
];
73 changes: 37 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,63 @@
{
"name": "ts-fsrs",
"version": "3.5.7",
"description": "ts-fsrs is a ES modules package based on TypeScript, used to implement the Free Spaced Repetition Scheduler (FSRS) algorithm. It helps developers apply FSRS to their flashcard applications, there by improving the user learning experience.",
"description": "ts-fsrs is a versatile package based on TypeScript that supports ES modules, CommonJS, and UMD. It implements the Free Spaced Repetition Scheduler (FSRS) algorithm, enabling developers to integrate FSRS into their flashcard applications to enhance the user learning experience.",
"main": "dist/index.cjs",
"umd": "dist/index.umd.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"keywords": [
"SuperMemo",
"Anki",
"FSRS"
],
"dependencies": {
"seedrandom": "^3.0.5"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/jest": "^29.5.8",
"@types/node": "^20.9.1",
"@types/seedrandom": "^3.0.8",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"decimal.js": "^10.4.3",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"jest": "^29.7.0",
"prettier": "^3.1.0",
"rimraf": "^5.0.5",
"rollup": "^4.4.1",
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-esbuild": "^6.1.1",
"ts-jest": "^29.1.1",
"tslib": "^2.6.2",
"typedoc": "^0.25.13",
"typedoc-plugin-extras": "^3.0.0",
"typedoc-plugin-katex": "^0.1.2",
"typescript": "^5.2.2"
},
"scripts": {
"lint": "eslint src/",
"lint::fix": "eslint --fix src/ && prettier --write src/",
"dev": "rollup -c rollup.config.ts --configPlugin esbuild -w",
"test": "jest --config=jest.config.js --passWithNoTests",
"test::coverage": "jest --config=jest.config.js --coverage",
"test::publish": "yalc publish",
"prebuild": "rimraf ./dist",
"build": "rollup -c rollup.config.ts --configPlugin esbuild",
"build:types": "tsc --project ./tsconfig.json --declaration true",
"major": "npm version major",
"minor": "npm version minor",
"patch": "npm version patch",
"test_publish": "yalc publish",
"predocs": "rimraf ./docs",
"docs": "typedoc",
"clean": "rimraf ./dist ./docs"
},
"dependencies": {
"seedrandom": "^3.0.5"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.10",
"@types/seedrandom": "^3.0.8",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"decimal.js": "^10.4.3",
"eslint": "^9.6.0",
"eslint-config-prettier": "^9.1.0",
"globals": "^15.8.0",
"jest": "^29.7.0",
"prettier": "^3.3.2",
"rimraf": "^6.0.0",
"rollup": "^4.18.1",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-esbuild": "^6.1.1",
"ts-jest": "^29.2.1",
"tslib": "^2.6.3",
"typedoc": "^0.26.4",
"typedoc-plugin-extras": "^3.1.0",
"typedoc-plugin-katex": "^0.1.2",
"typescript": "^5.5.3"
},
"author": "ishiko",
"license": "MIT",
"keywords": [
"SuperMemo",
"Anki",
"FSRS"
],
"files": [
"dist",
"README.md",
Expand All @@ -71,6 +72,6 @@
},
"homepage": "https://github.com/open-spaced-repetition/ts-fsrs#readme",
"engines": {
"node": ">=16.0.0"
"node": ">=18.0.0"
}
}
}
Loading