Skip to content

Commit

Permalink
Packaging as a library: ESM and CJS
Browse files Browse the repository at this point in the history
  • Loading branch information
rafasofizada committed Nov 24, 2022
1 parent 4d64237 commit 9d6501a
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 10 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ Desktop.ini
.directory
*~


# npm
node_modules
*.log
*.gz


# Coveralls
coverage
21 changes: 21 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# OS X
.DS_Store*
Icon?
._*

# Windows
Thumbs.db
ehthumbs.db
Desktop.ini

# Linux
.directory
*~

# npm
node_modules
*.log
*.gz

# Coveralls
coverage
3 changes: 3 additions & 0 deletions package-lock.json

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

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
"name": "pechkin",
"version": "0.1.0",
"description": "Async `multipart/form-data` middleware",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"scripts": {
"build": "tsc",
"prepublishOnly": "npm run build",
"build": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json",
"test": "vitest"
},
"author": "Rafael Sofi-zada",
"author": "Rafael Sofi-zada <[email protected]>",
"license": "MIT",
"dependencies": {
"busboy": "^1.6.0"
Expand Down
7 changes: 7 additions & 0 deletions tsconfig-cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"outDir": "./dist/cjs"
}
}
12 changes: 6 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "ES6",
"outDir": "dist",
"outDir": "./dist/esm",
"target": "ES2015",
"module": "ES2020",
"declaration": true,
"esModuleInterop": true,
"moduleResolution": "node",
"module": "CommonJS",
"sourceMap": true
},
"include": ["src"],
"exclude": ["node_modules"]
"include": ["src/**/*"]
}

0 comments on commit 9d6501a

Please sign in to comment.