Skip to content

Commit

Permalink
feat: Add ESM (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed May 22, 2022
1 parent 1ce0c7c commit 57a5c62
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 25 deletions.
13 changes: 13 additions & 0 deletions package-lock.json

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

10 changes: 9 additions & 1 deletion package.json
Expand Up @@ -13,6 +13,11 @@
},
"main": "lib/index.js",
"types": "lib/index.d.ts",
"module": "lib/esm/index.js",
"exports": {
"require": "./lib/index.js",
"import": "./lib/esm/index.js"
},
"files": [
"lib/**/*"
],
Expand All @@ -26,7 +31,9 @@
"format:es": "npm run lint:es -- --fix",
"format:prettier": "npm run prettier -- --write",
"prettier": "prettier '**/*.{ts,md,json,yml}'",
"build": "tsc",
"build": "npm run build:cjs && npm run build:esm",
"build:cjs": "tsc --sourceRoot https://raw.githubusercontent.com/fb55/nth-check/$(git rev-parse HEAD)/src/",
"build:esm": "npm run build:cjs -- --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json",
"prepare": "npm run build"
},
"repository": {
Expand All @@ -46,6 +53,7 @@
"boolbase": "^1.0.0"
},
"devDependencies": {
"@types/boolbase": "^1.0.1",
"@types/jest": "^27.5.0",
"@types/node": "^17.0.35",
"@typescript-eslint/eslint-plugin": "^5.25.0",
Expand Down
4 changes: 0 additions & 4 deletions src/declarations/boolbase.d.ts

This file was deleted.

40 changes: 20 additions & 20 deletions tsconfig.json
@@ -1,32 +1,32 @@
{
"compilerOptions": {
/* Basic Options */
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
// "lib": [], /* Specify library files to be included in the compilation. */
"declaration": true /* Generates corresponding '.d.ts' file. */,
"declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */,
// "sourceMap": true, /* Generates corresponding '.map' file. */
"outDir": "lib" /* Redirect output structure to the directory. */,
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
"target": "es5",
"module": "commonjs",
"lib": ["ES2015.Core"],
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "lib",

/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
"strict": true,

/* Additional Checks */
"noUnusedLocals": true /* Report errors on unused locals. */,
"noUnusedParameters": true /* Report errors on unused parameters. */,
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
"forceConsistentCasingInFileNames": true,
"importsNotUsedAsValues": "error",
"isolatedModules": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUnusedLocals": true,
"noUnusedParameters": true,

/* Module Resolution Options */
"baseUrl": "./" /* Base directory to resolve non-absolute module names. */,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
"resolveJsonModule": true,

"paths": {
"*": ["src/declarations/*", "*"]
}
"esModuleInterop": true,
"moduleResolution": "node",
"resolveJsonModule": true
},
"include": ["src"],
"exclude": [
Expand Down

0 comments on commit 57a5c62

Please sign in to comment.