From 2a478f0eaa8b7ebd5800211d071341377f8293e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Mon, 16 Jun 2025 12:15:50 +0200 Subject: [PATCH 1/2] fix: expose FilterXYSchema.json in exports Also fixes the readme with correct links. BREAKING-CHANGE: The JSON schema must now be imported like this: `import filterXY from 'ml-signal-processing/FilterXYSchema.json' with { type: 'json' };` --- .gitignore | 1 - .prettierignore | 1 - FilterXYSchema.d.ts | 2 -- README.md | 23 ++++++++--------------- eslint.config.mjs => eslint.config.js | 2 +- package.json | 10 +++++----- scripts/create_js_schema.mjs | 12 ------------ tsconfig.json | 3 +-- 8 files changed, 15 insertions(+), 39 deletions(-) delete mode 100644 FilterXYSchema.d.ts rename eslint.config.mjs => eslint.config.js (73%) delete mode 100644 scripts/create_js_schema.mjs diff --git a/.gitignore b/.gitignore index 78ba258..741cc55 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -FilterXYSchema.js FilterXYSchema.json # Logs diff --git a/.prettierignore b/.prettierignore index df16c0b..4bb6dd8 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,4 +2,3 @@ CHANGELOG.md lib coverage FilterXYSchema.json -FilterXYSchema.js \ No newline at end of file diff --git a/FilterXYSchema.d.ts b/FilterXYSchema.d.ts deleted file mode 100644 index d8230f2..0000000 --- a/FilterXYSchema.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const schema: typeof import('./FilterXYSchema.json'); -export = schema; diff --git a/README.md b/README.md index 48c1997..534ec55 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,17 @@ -# signal-processing +# ml-signal-processing -[![NPM version][npm-image]][npm-url] -[![build status][ci-image]][ci-url] -[![Test coverage][codecov-image]][codecov-url] -[![npm download][download-image]][download-url] +[![NPM version](https://img.shields.io/npm/v/ml-signal-processing.svg)](https://www.npmjs.com/package/ml-signal-processing) +[![npm download](https://img.shields.io/npm/dm/ml-signal-processing.svg)](https://www.npmjs.com/package/ml-signal-processing) +[![test coverage](https://img.shields.io/codecov/c/github/mljs/signal-processing.svg)](https://codecov.io/gh/mljs/signal-processing) +[![license](https://img.shields.io/npm/l/ml-signal-processing.svg)](https://github.com/mljs/signal-processing/blob/main/LICENSE) Process data in the form of {x:[], y:[]}. ## Installation -`$ npm i signal-processing` +```console +npm install ml-signal-processing +``` ## Usage @@ -38,12 +40,3 @@ const result = filterXY(data, filters); ## License [MIT](./LICENSE) - -[npm-image]: https://img.shields.io/npm/v/signal-processing.svg -[npm-url]: https://www.npmjs.com/package/signal-processing -[ci-image]: https://github.com/cheminfo/signal-processing/workflows/Node.js%20CI/badge.svg?branch=main -[ci-url]: https://github.com/cheminfo/signal-processing/actions?query=workflow%3A%22Node.js+CI%22 -[codecov-image]: https://img.shields.io/codecov/c/github/cheminfo/signal-processing.svg -[codecov-url]: https://codecov.io/gh/cheminfo/signal-processing -[download-image]: https://img.shields.io/npm/dm/signal-processing.svg -[download-url]: https://www.npmjs.com/package/signal-processing diff --git a/eslint.config.mjs b/eslint.config.js similarity index 73% rename from eslint.config.mjs rename to eslint.config.js index 1c14ed9..ba13143 100644 --- a/eslint.config.mjs +++ b/eslint.config.js @@ -2,6 +2,6 @@ import { defineConfig, globalIgnores } from 'eslint/config'; import cheminfo from 'eslint-config-cheminfo-typescript'; export default defineConfig( - globalIgnores(['coverage', 'lib', 'FilterXYSchema.*']), + globalIgnores(['coverage', 'lib']), cheminfo, ); diff --git a/package.json b/package.json index 696fdf9..e6a5118 100644 --- a/package.json +++ b/package.json @@ -3,22 +3,22 @@ "version": "1.2.0", "description": "Process data in the form of {x:[], y:[]}", "type": "module", - "exports": "./lib/index.js", + "exports": { + ".": "./lib/index.js", + "./FilterXYSchema.json": "./FilterXYSchema.json" + }, "keywords": [], "author": "Luc Patiny", "license": "MIT", "files": [ "src", "lib", - "FilterXYSchema.d.ts", - "FilterXYSchema.js", "FilterXYSchema.json" ], "scripts": { "check-types": "tsc --noEmit", "clean": "rimraf lib", "createSchema": "typescript-json-schema --refs false ./tsconfig.json FilterXYType > FilterXYSchema.json", - "postcreateSchema": "node scripts/create_js_schema.mjs", "eslint": "eslint . --cache", "eslint-fix": "node --run eslint -- --fix", "prepack": "npm run createSchema && npm run tsc", @@ -39,7 +39,7 @@ "homepage": "https://github.com/mljs/signal-processing#readme", "devDependencies": { "@vitest/coverage-v8": "^3.2.3", - "@zakodium/tsconfig": "^1.0.1", + "@zakodium/tsconfig": "^1.0.2", "eslint": "^9.29.0", "eslint-config-cheminfo-typescript": "^18.0.1", "jest-matcher-deep-close-to": "^3.0.2", diff --git a/scripts/create_js_schema.mjs b/scripts/create_js_schema.mjs deleted file mode 100644 index 2cf535c..0000000 --- a/scripts/create_js_schema.mjs +++ /dev/null @@ -1,12 +0,0 @@ -import fs from 'node:fs'; - -const schema = fs.readFileSync( - new URL('../FilterXYSchema.json', import.meta.url), - 'utf8', -); - -const schemaJs = `'use strict'; - -module.exports = ${schema}`; - -fs.writeFileSync(new URL('../FilterXYSchema.js', import.meta.url), schemaJs); diff --git a/tsconfig.json b/tsconfig.json index 79b37a0..e4f3895 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,8 +2,7 @@ "extends": "@zakodium/tsconfig", "compilerOptions": { "outDir": "lib", - "noUncheckedIndexedAccess": false, - "allowImportingTsExtensions": true + "noUncheckedIndexedAccess": false }, "include": ["src", "vite*.ts"] } From bcd7b20a717efef5749ea41a9a7751688be38b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Mon, 16 Jun 2025 12:20:53 +0200 Subject: [PATCH 2/2] lint --- eslint.config.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index ba13143..00cc43d 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,7 +1,4 @@ import { defineConfig, globalIgnores } from 'eslint/config'; import cheminfo from 'eslint-config-cheminfo-typescript'; -export default defineConfig( - globalIgnores(['coverage', 'lib']), - cheminfo, -); +export default defineConfig(globalIgnores(['coverage', 'lib']), cheminfo);