Skip to content

Commit 96f5509

Browse files
committed
feat: migrate fully to ESM
1 parent 33de693 commit 96f5509

File tree

342 files changed

+818
-893
lines changed

Some content is hidden

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

342 files changed

+818
-893
lines changed

.github/workflows/lactame-head.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ on:
77
- main
88

99
env:
10-
NODE_VERSION: 20.x
10+
NODE_VERSION: 24.x
1111

1212
jobs:
1313
deploy:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717
- name: Get package name
1818
run: echo "PACKAGE_NAME=$(jq .name package.json | tr -d '"')" >> $GITHUB_ENV
1919
- uses: actions/setup-node@v4

.github/workflows/lactame.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ on:
55
types: [published]
66

77
env:
8-
NODE_VERSION: 20.x
8+
NODE_VERSION: 24.x
99

1010
jobs:
1111
deploy:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v5
1515
- name: Get package name
1616
run: echo "PACKAGE_NAME=$(jq .name package.json | tr -d '"')" >> $GITHUB_ENV
1717
- uses: actions/setup-node@v4

.github/workflows/typedoc.yml

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,15 @@
1-
name: Deploy TypeDoc on GitHub pages
1+
name: TypeDoc
22

33
on:
44
workflow_dispatch:
55
release:
66
types: [published]
77

8-
env:
9-
NODE_VERSION: 20.x
10-
ENTRY_FILE: 'src/index.ts'
11-
128
jobs:
13-
deploy:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v4
17-
- uses: actions/setup-node@v4
18-
with:
19-
node-version: ${{ env.NODE_VERSION }}
20-
- name: Install dependencies
21-
run: npm install
22-
- name: Build documentation
23-
uses: zakodium/typedoc-action@v2
24-
with:
25-
entry: ${{ env.ENTRY_FILE }}
26-
- name: Deploy to GitHub pages
27-
uses: JamesIves/github-pages-deploy-action@releases/v4
28-
with:
29-
token: ${{ secrets.BOT_TOKEN }}
30-
branch: gh-pages
31-
folder: docs
32-
clean: true
9+
typedoc:
10+
# Documentation: https://github.com/zakodium/workflows#typedoc
11+
uses: zakodium/workflows/.github/workflows/typedoc.yml@typedoc-v1
12+
with:
13+
entry: 'src/index.ts'
14+
secrets:
15+
github-token: ${{ secrets.BOT_TOKEN }}

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ jspm_packages
4040
.node_repl_history
4141

4242
lib
43-
lib-esm
44-
4543
dist
4644

4745
.DS_Store
48-
49-
docs
46+
.eslintcache

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHANGELOG.md

README.md

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# ml-spectra-processing
22

3-
[![NPM version][npm-image]][npm-url]
4-
[![build status][ci-image]][ci-url]
5-
[![Test coverage][codecov-image]][codecov-url]
6-
[![npm download][download-image]][download-url]
3+
[![NPM version](https://img.shields.io/npm/v/ml-spectra-processing.svg)](https://www.npmjs.com/package/ml-spectra-processing)
4+
[![npm download](https://img.shields.io/npm/dm/ml-spectra-processing.svg)](https://www.npmjs.com/package/ml-spectra-processing)
5+
[![test coverage](https://img.shields.io/codecov/c/github/mljs/spectra-processing.svg)](https://codecov.io/gh/mljs/spectra-processing)
6+
[![license](https://img.shields.io/npm/l/ml-spectra-processing.svg)](https://github.com/mljs/spectra-processing/blob/main/LICENSE)
77
[![DOI](https://www.zenodo.org/badge/196417515.svg)](https://www.zenodo.org/badge/latestdoi/196417515)
88

99
Various functions to process spectra. Those are `pure` functions.
1010

1111
They are sorted in various categories:
1212

13-
- matrix: functions on ml-matrix instances (or array or array)
13+
- matrix: functions on ml-matrix instances (or array of arrays)
1414
- x: functions that apply on a 1D array
1515
- xy: functions that apply on an object `{x: [], y:[]}`
16-
- xy2: functions that apply on an array of array of 2 numbers `[[x,y], [x,y]]`
16+
- xy2: functions that apply on an array of arrays of 2 numbers `[[x,y], [x,y]]`
1717
- xyArray: functions that apply on an array of objects `{x: [], y:[]}`
1818
- xyObject: functions that apply on an array of point `[{x,y}]`
1919
- xreim: functions that apply on an object `{x: [], re:[], im:[]}`
@@ -25,7 +25,9 @@ The name of the functions start with the first argument on which they apply.
2525

2626
## Installation
2727

28-
`$ npm i ml-spectra-processing`
28+
```console
29+
npm install ml-spectra-processing
30+
```
2931

3032
## Usage
3133

@@ -42,12 +44,3 @@ console.log(result);
4244
## License
4345

4446
[MIT](./LICENSE)
45-
46-
[npm-image]: https://img.shields.io/npm/v/ml-spectra-processing.svg
47-
[npm-url]: https://www.npmjs.com/package/ml-spectra-processing
48-
[ci-image]: https://github.com/mljs/spectra-processing/actions/workflows/nodejs.yml/badge.svg
49-
[ci-url]: https://github.com/mljs/spectra-processing/actions/workflows/nodejs.yml
50-
[codecov-image]: https://img.shields.io/codecov/c/github/mljs/spectra-processing.svg
51-
[codecov-url]: https://codecov.io/gh/mljs/spectra-processing
52-
[download-image]: https://img.shields.io/npm/dm/ml-spectra-processing.svg
53-
[download-url]: https://www.npmjs.com/package/ml-spectra-processing

eslint.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { defineConfig, globalIgnores } from 'eslint/config';
2+
import cheminfo from 'eslint-config-cheminfo-typescript';
3+
4+
export default defineConfig(globalIgnores(['coverage', 'lib']), cheminfo);

eslint.config.mjs

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

package.json

Lines changed: 44 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,71 @@
11
{
22
"name": "ml-spectra-processing",
33
"version": "14.16.1",
4+
"license": "MIT",
45
"description": "Various method to process spectra",
5-
"main": "./lib/index.js",
6-
"module": "./lib-esm/index.js",
7-
"types": "./lib/index.d.ts",
6+
"keywords": [],
7+
"author": "Luc Patiny",
8+
"type": "module",
89
"exports": {
9-
".": {
10-
"node": "./lib/index.js",
11-
"default": "./lib-esm/index.js"
12-
},
13-
"./matrix": {
14-
"node": "./lib/matrix/index.js",
15-
"default": "./lib-esm/matrix/index.js"
16-
},
17-
"./reim": {
18-
"node": "./lib/reim/index.js",
19-
"default": "./lib-esm/reim/index.js"
20-
},
21-
"./utils": {
22-
"node": "./lib/utils/index.js",
23-
"default": "./lib-esm/utils/index.js"
24-
},
25-
"./x": {
26-
"node": "./lib/x/index.js",
27-
"default": "./lib-esm/x/index.js"
28-
},
29-
"./xreim": {
30-
"node": "./lib/xreim/index.js",
31-
"default": "./lib-esm/xreim/index.js"
32-
},
33-
"./xy": {
34-
"node": "./lib/xy/index.js",
35-
"default": "./lib-esm/xy/index.js"
36-
},
37-
"./xy2": {
38-
"node": "./lib/xy2/index.js",
39-
"default": "./lib-esm/xy2/index.js"
40-
},
41-
"./xyArray": {
42-
"node": "./lib/xyArray/index.js",
43-
"default": "./lib-esm/xyArray/index.js"
44-
},
45-
"./xyObject": {
46-
"node": "./lib/xyObject/index.js",
47-
"default": "./lib-esm/xyObject/index.js"
48-
},
49-
"./zones": {
50-
"node": "./lib/zones/index.js",
51-
"default": "./lib-esm/zones/index.js"
52-
}
10+
".": "./lib/index.js",
11+
"./matrix": "./lib/matrix/index.js",
12+
"./reim": "./lib/reim/index.js",
13+
"./utils": "./lib/utils/index.js",
14+
"./x": "./lib/x/index.js",
15+
"./xreim": "./lib/xreim/index.js",
16+
"./xy": "./lib/xy/index.js",
17+
"./xy2": "./lib/xy2/index.js",
18+
"./xyArray": "./lib/xyArray/index.js",
19+
"./xyObject": "./lib/xyObject/index.js",
20+
"./zones": "./lib/zones/index.js"
5321
},
5422
"files": [
55-
"src",
5623
"lib",
57-
"lib-esm"
24+
"src"
5825
],
5926
"scripts": {
60-
"build": "npm run tsc-esm && cheminfo-build --entry lib-esm/index.js --root SpectraProcessing",
27+
"build": "npm run tsc && cheminfo-build --entry lib/index.js --root SpectraProcessing",
6128
"check-types": "tsc --noEmit",
62-
"clean": "rimraf lib lib-esm",
63-
"eslint": "eslint src",
64-
"eslint-fix": "npm run eslint -- --fix",
65-
"jscpd": "jscpd -l 10 -i \"**/__tests__/**\" -t 1 src",
29+
"clean": "rimraf coverage dist lib",
30+
"eslint": "eslint . --cache",
31+
"eslint-fix": "eslint . --cache --fix",
6632
"prepack": "npm run tsc",
67-
"prettier": "prettier --check src",
68-
"prettier-write": "prettier --write src",
69-
"test": "npm run test-only && npm run eslint && npm run prettier && npm run check-types",
33+
"prettier": "prettier --check .",
34+
"prettier-write": "prettier --write .",
35+
"test": "npm run test-only && npm run check-types && npm run eslint && npm run prettier",
7036
"test-only": "vitest run --coverage",
71-
"tsc": "npm run clean && npm run tsc-cjs && npm run tsc-esm",
72-
"tsc-cjs": "tsc --project tsconfig.cjs.json",
73-
"tsc-esm": "tsc --project tsconfig.esm.json"
37+
"tsc": "npm run clean && npm run tsc-build",
38+
"tsc-build": "tsc --project tsconfig.build.json"
7439
},
75-
"repository": {
76-
"type": "git",
77-
"url": "git+https://github.com/mljs/spectra-processing.git"
78-
},
79-
"keywords": [],
80-
"author": "Luc Patiny",
81-
"license": "MIT",
82-
"bugs": {
83-
"url": "https://github.com/mljs/spectra-processing/issues"
40+
"dependencies": {
41+
"binary-search": "^1.3.6",
42+
"cheminfo-types": "^1.8.1",
43+
"fft.js": "^4.0.4",
44+
"is-any-array": "^2.0.1",
45+
"ml-matrix": "^6.12.1",
46+
"ml-xsadd": "^3.0.1"
8447
},
85-
"homepage": "https://github.com/mljs/spectra-processing#readme",
8648
"devDependencies": {
87-
"@types/node": "^24.2.0",
49+
"@types/node": "^24.3.0",
8850
"@vitest/coverage-v8": "^3.2.4",
51+
"@zakodium/tsconfig": "^1.0.2",
8952
"cheminfo-build": "^1.2.1",
90-
"eslint": "^9.32.0",
53+
"eslint": "^9.33.0",
9154
"eslint-config-cheminfo-typescript": "^19.0.0",
9255
"jest-matcher-deep-close-to": "^3.0.2",
93-
"jscpd": "^4.0.5",
94-
"ml-spectra-fitting": "^4.2.4",
56+
"ml-spectra-fitting": "^5.0.1",
9557
"prettier": "^3.6.2",
9658
"rimraf": "^6.0.1",
9759
"spectrum-generator": "^8.1.0",
9860
"typescript": "^5.9.2",
9961
"vitest": "^3.2.4"
10062
},
101-
"dependencies": {
102-
"binary-search": "^1.3.6",
103-
"cheminfo-types": "^1.8.1",
104-
"fft.js": "^4.0.4",
105-
"is-any-array": "^2.0.1",
106-
"ml-matrix": "^6.12.1",
107-
"ml-xsadd": "^3.0.1"
108-
}
63+
"repository": {
64+
"type": "git",
65+
"url": "git+https://github.com/mljs/spectra-processing.git"
66+
},
67+
"bugs": {
68+
"url": "https://github.com/mljs/spectra-processing/issues"
69+
},
70+
"homepage": "https://github.com/mljs/spectra-processing#readme"
10971
}

src/.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
__tests__
2+
*.test.*
23
.npmignore

0 commit comments

Comments
 (0)