From 37331a4869bcad99e16e82576486b6490a94b223 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Thu, 17 Nov 2022 14:51:58 +0300 Subject: [PATCH] fix: build package for nodejs --- .gitignore | 2 +- .vscode/settings.json | 5 ----- makefile | 2 +- package.json | 27 +++++++++++++++++++-------- tsconfig.cjs.json | 8 ++++++++ tsconfig.json | 13 +++++-------- 6 files changed, 34 insertions(+), 23 deletions(-) delete mode 100644 .vscode/settings.json create mode 100644 tsconfig.cjs.json diff --git a/.gitignore b/.gitignore index c91b622..aa16360 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ cov_profile/ node_modules/ package-lock.json -dest/ +dist/ diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 8b2ec0f..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "deno.enable": true, - "deno.lint": true, - "editor.tabSize": 2 -} \ No newline at end of file diff --git a/makefile b/makefile index 66de737..cbe1478 100644 --- a/makefile +++ b/makefile @@ -22,4 +22,4 @@ fmt-check: $(FMT) --check clean: - rm -rf cov_profile + rm -rf cov_profile dist diff --git a/package.json b/package.json index ca37a1f..14025b6 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,13 @@ { "name": "it-fsm", - "version": "2.0.1", + "version": "2.0.2", "description": "Simple finite state machine for nodejs", - "main": "./dest/fsm.js", - "types": "./dest/fsm.d.ts", "readme": "README.md", "scripts": { - "prepublishOnly": "rm -rf ./dest && tsc" + "build": "tsc && tsc -p tsconfig.cjs.json", + "check": "tsc --noEmit && tsc -p tsconfig.cjs.json --noEmit", + "clean": "rm -rf ./dist", + "prepublishOnly": "npm run clean && npm run build" }, "repository": { "type": "git", @@ -21,13 +22,23 @@ "ood", "oop" ], - "author": "Dmitriy Pleshevskiy ", + "author": "Dmitriy Pleshevskiy ", "license": "GPL-3.0-or-later", "bugs": { - "url": "https://github.com/icetemple/it-fsm/issues" + "url": "https://github.com/pleshevskiy/it-fsm/issues" }, "homepage": "https://git.pleshevski.ru/pleshevskiy/it-fsm#readme", "devDependencies": { - "typescript": "^4.3.5" - } + "typescript": "^4.9.3" + }, + "main": "./dist/cjs/fsm.js", + "module": "./dist/esm/fsm.js", + "types": "./dist/esm/fsm.d.ts", + "typings": "dist/esm/fsm.d.ts", + "typescript": { + "definition": "dist/esm/fsm.d.ts" + }, + "type": "module", + "sideEffects": false, + "files": ["dist"] } diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json new file mode 100644 index 0000000..d2d7a69 --- /dev/null +++ b/tsconfig.cjs.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node", + "outDir": "dist/cjs" + } +} diff --git a/tsconfig.json b/tsconfig.json index 2c96e48..5c63883 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,21 +1,18 @@ { "compilerOptions": { "allowJs": false, - "lib": ["es2017"], + "module": "es2020", + "target": "es2017", + "lib": ["esnext"], + "moduleResolution": "nodenext", "declaration": true, - "module": "commonjs", - "moduleResolution": "node", - "target": "es6", - "charset": "utf-8", - "pretty": true, "noImplicitAny": true, "noImplicitReturns": true, "noImplicitThis": true, "noUnusedParameters": true, "strict": true, "strictNullChecks": true, - "esModuleInterop": true, - "outDir": "dest" + "outDir": "dist/esm" }, "include": [ "fsm.ts"