Skip to content

Commit

Permalink
chore: support ESM (#174)
Browse files Browse the repository at this point in the history
Signed-off-by: 木杉 <[email protected]>
  • Loading branch information
zhmushan authored Jul 26, 2020
1 parent 50b4a85 commit 4739871
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 8,238 deletions.
118 changes: 117 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
"name": "casbin",
"version": "5.0.6",
"description": "An authorization library that supports access control models like ACL, RBAC, ABAC in Node.JS",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"main": "lib/cjs/index.js",
"typings": "lib/cjs/index.d.ts",
"module": "lib/esm/index.js",
"scripts": {
"prepack": "yarn run lint && yarn run test && yarn build",
"postpack": "rimraf lib",
"build": "rimraf lib && tsc",
"prepack": "run-s lint test build",
"postpack": "run-s clean",
"build": "run-s clean && run-p build:*",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:esm": "tsc -p tsconfig.esm.json",
"test": "jest",
"lint": "eslint . --ext .js,.ts",
"fmt": "eslint . --ext .js,.ts --fix",
"semantic-release": "semantic-release",
"commit": "git-cz"
"commit": "git-cz",
"clean": "rimraf lib"
},
"devDependencies": {
"@semantic-release/changelog": "^3.0.6",
Expand All @@ -32,6 +36,7 @@
"husky": "^2.3.0",
"jest": "^24.3.1",
"lint-staged": "^8.1.7",
"npm-run-all": "^4.1.5",
"prettier": "^1.19.1",
"pretty-quick": "^2.0.1",
"rimraf": "^2.6.2",
Expand Down
8 changes: 8 additions & 0 deletions tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"target": "ES6",
"module": "CommonJS",
"outDir": "lib/cjs"
}
}
8 changes: 8 additions & 0 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"outDir": "lib/esm"
}
}
13 changes: 5 additions & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"target": "ES6",
"module": "CommonJS",
"moduleResolution": "Node",
"strict": true,
"strictPropertyInitialization": false,
"declaration": true,
"declarationDir": "lib",
"outDir": "lib"
"downlevelIteration": true
},
"include": [
"src/**/*"
]
"include": ["src/**/*"]
}
Loading

0 comments on commit 4739871

Please sign in to comment.