fix: build package for nodejs

This commit is contained in:
Dmitriy Pleshevskiy 2022-11-17 14:51:58 +03:00
parent 72ba39e8d9
commit 37331a4869
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215
6 changed files with 34 additions and 23 deletions

2
.gitignore vendored
View file

@ -3,4 +3,4 @@ cov_profile/
node_modules/ node_modules/
package-lock.json package-lock.json
dest/ dist/

View file

@ -1,5 +0,0 @@
{
"deno.enable": true,
"deno.lint": true,
"editor.tabSize": 2
}

View file

@ -22,4 +22,4 @@ fmt-check:
$(FMT) --check $(FMT) --check
clean: clean:
rm -rf cov_profile rm -rf cov_profile dist

View file

@ -1,12 +1,13 @@
{ {
"name": "it-fsm", "name": "it-fsm",
"version": "2.0.1", "version": "2.0.2",
"description": "Simple finite state machine for nodejs", "description": "Simple finite state machine for nodejs",
"main": "./dest/fsm.js",
"types": "./dest/fsm.d.ts",
"readme": "README.md", "readme": "README.md",
"scripts": { "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": { "repository": {
"type": "git", "type": "git",
@ -21,13 +22,23 @@
"ood", "ood",
"oop" "oop"
], ],
"author": "Dmitriy Pleshevskiy <dmitriy@ideascup.me>", "author": "Dmitriy Pleshevskiy <dmitriy@pleshevski.ru>",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"bugs": { "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", "homepage": "https://git.pleshevski.ru/pleshevskiy/it-fsm#readme",
"devDependencies": { "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"]
} }

8
tsconfig.cjs.json Normal file
View file

@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"outDir": "dist/cjs"
}
}

View file

@ -1,21 +1,18 @@
{ {
"compilerOptions": { "compilerOptions": {
"allowJs": false, "allowJs": false,
"lib": ["es2017"], "module": "es2020",
"target": "es2017",
"lib": ["esnext"],
"moduleResolution": "nodenext",
"declaration": true, "declaration": true,
"module": "commonjs",
"moduleResolution": "node",
"target": "es6",
"charset": "utf-8",
"pretty": true,
"noImplicitAny": true, "noImplicitAny": true,
"noImplicitReturns": true, "noImplicitReturns": true,
"noImplicitThis": true, "noImplicitThis": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"strict": true, "strict": true,
"strictNullChecks": true, "strictNullChecks": true,
"esModuleInterop": true, "outDir": "dist/esm"
"outDir": "dest"
}, },
"include": [ "include": [
"fsm.ts" "fsm.ts"