Skip to content

Commit d609403

Browse files
chore!: upgrade to typescript
* chore: migrate project to TypeScript * chore: migrate project to TypeScript * docs: create documentation with typedoc and add a plugin to display mathematical expressions properly * docs: add correction to "dice distance" in the documentation * docs: remove type of parameter and return description * docs: make math expressions align to the left * docs: remove the rest of parameter types in documentation * chore: change the delimiters of math expressions to "$" instead of "$$" * chore: build ts doc in github action and other CI and release actions
1 parent 8252e71 commit d609403

File tree

168 files changed

+1004
-486
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+1004
-486
lines changed

.babelrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extends: cheminfo
1+
extends: cheminfo-typescript
22
parserOptions:
33
sourceType: module
44
env:

.github/workflows/nodejs.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Node.js CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
nodejs:
11+
# Documentation: https://github.com/zakodium/workflows#nodejs-ci
12+
uses: zakodium/workflows/.github/workflows/nodejs.yml@nodejs-v1
13+
with:
14+
lint-check-types: true

.github/workflows/release.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
release:
10+
# Documentation: https://github.com/zakodium/workflows#release
11+
uses: zakodium/workflows/.github/workflows/release.yml@release-v1
12+
with:
13+
npm: true
14+
secrets:
15+
github-token: ${{ secrets.BOT_TOKEN }}
16+
npm-token: ${{ secrets.NPM_BOT_TOKEN }}

.github/workflows/typedoc.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Deploy TypeDoc on GitHub pages
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-node@v3
14+
with:
15+
node-version: 16.x
16+
- name: Install dependencies
17+
run: npm install
18+
- name: Build documentation
19+
uses: zakodium/typedoc-action@feat-katex
20+
with:
21+
entry: src/index.ts
22+
23+
- name: Deploy to GitHub pages
24+
uses: JamesIves/github-pages-deploy-action@releases/v4
25+
with:
26+
token: ${{ secrets.BOT_TOKEN }}
27+
branch: gh-pages
28+
folder: docs
29+
clean: true

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ lib
44
coverage
55

66
.DS_Store
7+
8+
lib-esm
9+
10+
docs

.travis.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion

babel.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
presets: ['@babel/preset-typescript'],
3+
plugins: ['@babel/plugin-transform-modules-commonjs'],
4+
};

package.json

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,27 @@
33
"version": "3.0.0",
44
"description": "Distance and similarity functions to compare vectors",
55
"main": "lib/index.js",
6-
"module": "src/index.js",
6+
"module": "./lib-esm/index.js",
77
"files": [
88
"src",
9-
"lib"
9+
"lib",
10+
"lib-esm"
1011
],
12+
"types": "./lib/index.d.ts",
1113
"scripts": {
12-
"compile": "rollup -c",
14+
"check-types": "tsc --noEmit",
15+
"clean": "rimraf lib lib-esm",
1316
"eslint": "eslint src",
1417
"eslint-fix": "npm run eslint -- --fix",
15-
"prepublishOnly": "npm run compile",
18+
"prepack": "npm run tsc",
1619
"prettier": "prettier --check src",
1720
"prettier-write": "prettier --write src",
18-
"test": "npm run test-coverage && npm run eslint",
21+
"test": "npm run test-coverage && npm run eslint && npm run check-types",
1922
"test-only": "jest",
20-
"test-coverage": "jest --coverage"
23+
"test-coverage": "jest --coverage",
24+
"tsc": "npm run clean && npm run tsc-cjs && npm run tsc-esm",
25+
"tsc-cjs": "tsc --project tsconfig.cjs.json",
26+
"tsc-esm": "tsc --project tsconfig.esm.json"
2127
},
2228
"repository": {
2329
"type": "git",
@@ -45,17 +51,18 @@
4551
"homepage": "https://github.com/mljs/distance",
4652
"devDependencies": {
4753
"@babel/plugin-transform-modules-commonjs": "^7.20.7",
54+
"@babel/preset-typescript": "^7.18.6",
55+
"@types/jest": "^29.2.4",
56+
"cheminfo-types": "^1.4.0",
4857
"eslint": "^8.30.0",
49-
"eslint-config-cheminfo": "^8.1.3",
50-
"eslint-plugin-import": "^2.26.0",
51-
"eslint-plugin-jest": "^27.1.7",
58+
"eslint-config-cheminfo-typescript": "^11.2.2",
5259
"esm": "^3.2.25",
5360
"jest": "^29.3.1",
5461
"prettier": "^2.8.1",
55-
"rollup": "^3.8.1"
62+
"rimraf": "^3.0.2",
63+
"typescript": "^4.9.4"
5664
},
5765
"dependencies": {
58-
"cheminfo-types": "^1.4.0",
5966
"ml-array-mean": "^1.1.6",
6067
"ml-distance-euclidean": "^2.0.0",
6168
"ml-tree-similarity": "^1.0.0"

0 commit comments

Comments
 (0)