Skip to content

Commit c2a313c

Browse files
committed
feat: update package to native module
1 parent cf6ee6a commit c2a313c

File tree

7 files changed

+24
-33
lines changed

7 files changed

+24
-33
lines changed

.babelrc

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

package.json

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
{
22
"name": "ir-spectrum",
33
"version": "3.1.0",
4-
"description": "",
5-
"main": "lib/index.js",
6-
"module": "src/index.js",
4+
"description": "Package used to handle IR spectra in SciPeaks.",
5+
"type": "module",
6+
"exports": "src/index.js",
77
"files": [
8-
"lib",
98
"src"
109
],
1110
"scripts": {
1211
"build": "cheminfo-build --entry src/index.js --root IRSpectrum",
1312
"build-doc": "cheminfo doc",
1413
"eslint": "eslint src",
1514
"eslint-fix": "npm run eslint -- --fix",
16-
"prepack": "rollup -c",
1715
"prettier": "prettier --check src",
1816
"prettier-write": "prettier --write src",
1917
"test": "npm run test-coverage && npm run eslint && npm run prettier",
@@ -31,25 +29,20 @@
3129
"url": "https://github.com/cheminfo/ir-spectrum/issues"
3230
},
3331
"homepage": "https://github.com/cheminfo/ir-spectrum#readme",
34-
"jest": {
35-
"testEnvironment": "node"
36-
},
3732
"devDependencies": {
38-
"@babel/plugin-transform-modules-commonjs": "^7.25.9",
39-
"@vitest/coverage-v8": "^2.1.5",
40-
"cheminfo-build": "^1.2.0",
41-
"codecov": "^3.8.3",
42-
"eslint": "^9.14.0",
43-
"eslint-config-cheminfo": "^12.0.1",
33+
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
34+
"@vitest/coverage-v8": "^3.2.4",
35+
"cheminfo-build": "^1.2.1",
36+
"eslint": "^9.32.0",
37+
"eslint-config-cheminfo": "^15.0.1",
4438
"esm": "^3.2.25",
4539
"jest-matcher-deep-close-to": "^3.0.2",
46-
"prettier": "^3.3.3",
47-
"rollup": "^4.26.0",
48-
"vitest": "^2.1.5"
40+
"prettier": "^3.6.2",
41+
"vitest": "^3.2.4"
4942
},
5043
"dependencies": {
5144
"common-spectrum": "2.12.0",
52-
"ml-gsd": "^12.1.8",
45+
"ml-gsd": "^13.0.1",
5346
"spc-parser": "^1.0.0",
5447
"uninstall": "^0.0.0"
5548
},

rollup.config.mjs

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

src/__tests__/index.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { readFileSync } from 'node:fs';
22
import { join } from 'node:path';
33

44
import { toBeDeepCloseTo, toMatchCloseTo } from 'jest-matcher-deep-close-to';
5-
import { test, expect } from 'vitest';
5+
import { expect, test } from 'vitest';
66

7-
import { fromJcamp, autoPeakPicking, peakPicking } from '..';
7+
import { autoPeakPicking, fromJcamp, peakPicking } from '..';
88

99
expect.extend({ toBeDeepCloseTo, toMatchCloseTo });
1010

@@ -14,6 +14,7 @@ test('autoPeakPicking', () => {
1414
const result = fromJcamp(jcamp);
1515

1616
const peak = peakPicking(result.getSpectrum(), 1043);
17+
1718
expect(peak).toBeDeepCloseTo({
1819
wavenumber: 1043.3171784680487,
1920
absorbance: 0.29902676,

src/from/__tests__/fromJcamp.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs';
22
import { join } from 'node:path';
33

44
import { toBeDeepCloseTo, toMatchCloseTo } from 'jest-matcher-deep-close-to';
5-
import { describe, it, expect } from 'vitest';
5+
import { describe, expect, it } from 'vitest';
66

77
import { fromJcamp } from '../fromJcamp';
88

@@ -35,6 +35,7 @@ describe('fromJcamp', () => {
3535
expect(first.variables.t.min).toBeDeepCloseTo(1.6, 5);
3636
expect(first.variables.t.max).toBeDeepCloseTo(91.7, 5);
3737
});
38+
3839
it('transmittance_percent', () => {
3940
let jcamp = readFileSync(
4041
join(__dirname, './data/transmittance_percent.jdx'),
@@ -60,6 +61,7 @@ describe('fromJcamp', () => {
6061
expect(first.variables.t.min).toBeDeepCloseTo(31.233769, 5);
6162
expect(first.variables.t.max).toBeDeepCloseTo(100.400625, 5);
6263
});
64+
6365
it('absorbance', () => {
6466
let jcamp = readFileSync(join(__dirname, './data/absorbance.jdx'), 'utf8');
6567

src/from/__tests__/fromSPC.test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,24 @@ import { join } from 'node:path';
33

44
import { toJcamp } from 'common-spectrum';
55
import { toBeDeepCloseTo, toMatchCloseTo } from 'jest-matcher-deep-close-to';
6-
import { describe, it, expect } from 'vitest';
6+
import { describe, expect, it } from 'vitest';
77

88
import { fromSPC } from '../fromSPC';
99

1010
expect.extend({ toBeDeepCloseTo, toMatchCloseTo });
11+
1112
describe('fromSPC', () => {
1213
it('fromSPC', () => {
1314
let buffer = readFileSync(join(__dirname, './data/absorbance.spc'));
1415

1516
let analysis = fromSPC(buffer);
1617
let jcamp = toJcamp(analysis, {});
18+
1719
expect(jcamp.split('\n')).toHaveLength(1833);
1820
expect(analysis.spectra).toHaveLength(1);
1921

2022
let first = analysis.spectra[0];
23+
2124
expect(first.variables.x.data).toHaveLength(1776);
2225
expect(first.variables.y.data).toHaveLength(1776);
2326
expect(first.variables.a.data).toHaveLength(1776);
@@ -34,11 +37,13 @@ describe('fromSPC', () => {
3437
expect(first.variables.t.max).toBeDeepCloseTo(10000, 5);
3538
expect(Object.keys(first.variables)).toStrictEqual(['x', 'y', 'a', 't']);
3639
});
40+
3741
it('resolutionPro', () => {
3842
let buffer = readFileSync(join(__dirname, './data/resolutionPro.spc'));
3943

4044
let analysis = fromSPC(buffer);
4145
const variables = analysis.spectra[0].variables;
46+
4247
expect(Object.keys(variables)).toStrictEqual(['x', 'y', 'a', 't']);
4348
});
4449
});

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
import { convertPeak } from './convertPeak.js';
88
import { getAnnotations } from './jsgraph/getAnnotations';
99

10-
export { Analysis, AnalysesManager, toJcamp } from 'common-spectrum';
10+
export { AnalysesManager, Analysis, toJcamp } from 'common-spectrum';
1111

1212
export function peakPicking(spectrum, target, options) {
1313
const peak = originalPeakPicking(spectrum, target, options);

0 commit comments

Comments
 (0)