Skip to content

Commit 146610a

Browse files
committed
build: use pkgroll to bundle library
1 parent 351f405 commit 146610a

File tree

7 files changed

+2142
-964
lines changed

7 files changed

+2142
-964
lines changed

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# /.gitattributes
2+
# Makes sure all line endings are LF
3+
4+
* text=auto eol=lf

.npmrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# .npmrc
2+
# Configuration for npm and pnpm
3+
4+
# Uses the exact version instead of any within-patch-range version of an
5+
# installed package
6+
save-exact=true

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# /.prettierignore
2+
# Tells Prettier to ignore certain files
3+
14
package.json
25
package-lock.json
36

config/jest.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"rootDir": "../",
3+
"preset": "ts-jest/presets/default-esm",
4+
"collectCoverage": true,
5+
"collectCoverageFrom": ["source/**/*.ts"],
6+
"testTimeout": 30000,
7+
"testMatch": ["**/test/*-test.ts"],
8+
"moduleFileExtensions": ["js", "jsx", "json", "ts", "tsx"],
9+
"moduleNameMapper": {
10+
"^(\\.{1,2}/.*)\\.js$": "$1"
11+
}
12+
}

package-lock.json

Lines changed: 2075 additions & 900 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 41 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
{
22
"name": "ratelimit-header-parser",
33
"version": "0.1.0",
4-
"description": "Parse RateLimit headers of various forms, including the combined form from draft 7 of the IETF standard, into a normalized format.",
4+
"description": "Parse `RateLimit` headers of various forms, including the combined form from draft 7 of the IETF standard, into a normalized format.",
5+
"author": "Nathan Friedly <https://www.nfriedly.com/>",
6+
"license": "MIT",
7+
"homepage": "https://github.com/express-rate-limit/ratelimit-header-parser#readme",
8+
"repository": "https://github.com/express-rate-limit/ratelimit-header-parser",
9+
"keywords": [
10+
"ratelimit",
11+
"x-ratelimit-limit",
12+
"headers",
13+
"parser",
14+
"express-rate-limit",
15+
"ratelimit-policy"
16+
],
517
"type": "module",
618
"exports": {
719
".": {
@@ -26,78 +38,42 @@
2638
"license.md",
2739
"changelog.md"
2840
],
41+
"engines": {
42+
"node": ">= 16"
43+
},
2944
"scripts": {
3045
"clean": "del-cli dist/ coverage/ *.log *.tmp *.bak *.tgz",
31-
"build:cjs": "esbuild --platform=node --bundle --target=es2019 --format=cjs --outfile=dist/index.cjs source/index.ts",
32-
"build:esm": "esbuild --platform=node --bundle --target=es2019 --format=esm --outfile=dist/index.mjs source/index.ts",
33-
"build:types": "dts-bundle-generator --out-file=dist/index.d.ts source/index.ts && cp dist/index.d.ts dist/index.d.cts && cp dist/index.d.ts dist/index.d.mts",
34-
"compile": "run-s clean build:*",
46+
"build": "pkgroll --src source/",
47+
"compile": "run-s clean build",
3548
"lint:code": "xo",
3649
"lint:rest": "prettier --ignore-unknown --check .",
3750
"lint": "run-s lint:*",
38-
"format:code": "npm run lint:code -- --fix",
39-
"format:rest": "npm run lint:rest -- --write .",
51+
"format:code": "xo --fix",
52+
"format:rest": "prettier --ignore-unknown --write .",
4053
"format": "run-s format:*",
41-
"test:lib": "jest",
54+
"test:lib": "jest --config config/jest.json",
4255
"test": "run-s lint test:lib",
4356
"pre-commit": "lint-staged",
4457
"prepare": "run-s compile && husky install config/husky"
4558
},
46-
"repository": {
47-
"type": "git",
48-
"url": "git+https://github.com/express-rate-limit/ratelimit-header-parser.git"
49-
},
50-
"keywords": [
51-
"ratelimit",
52-
"x-ratelimit-limit",
53-
"headers",
54-
"parser",
55-
"express-rate-limit",
56-
"ratelimit-policy"
57-
],
58-
"author": "Nathan Friedly <https://www.nfriedly.com/>",
59-
"license": "MIT",
60-
"bugs": {
61-
"url": "https://github.com/express-rate-limit/ratelimit-header-parser/issues"
62-
},
63-
"homepage": "https://github.com/express-rate-limit/ratelimit-header-parser#readme",
6459
"devDependencies": {
65-
"@express-rate-limit/prettier": "^1.0.0",
66-
"@express-rate-limit/tsconfig": "^1.0.0",
67-
"@jest/globals": "^29.6.3",
68-
"@jest/types": "^29.6.3",
69-
"@types/node": "^20.5.1",
70-
"del-cli": "^5.0.0",
71-
"dts-bundle-generator": "^8.0.1",
72-
"esbuild": "^0.19.2",
73-
"husky": "^8.0.3",
74-
"jest": "^29.6.3",
75-
"lint-staged": "^14.0.1",
76-
"npm-run-all": "^4.1.5",
77-
"ts-jest": "^29.1.1",
78-
"typescript": "^5.1.6",
79-
"xo": "^0.56.0"
80-
},
81-
"jest": {
82-
"preset": "ts-jest/presets/default-esm",
83-
"collectCoverage": true,
84-
"collectCoverageFrom": [
85-
"source/**/*.ts"
86-
],
87-
"testTimeout": 30000,
88-
"testMatch": [
89-
"**/test/*-test.ts"
90-
],
91-
"moduleFileExtensions": [
92-
"js",
93-
"jsx",
94-
"json",
95-
"ts",
96-
"tsx"
97-
],
98-
"moduleNameMapper": {
99-
"^(\\.{1,2}/.*)\\.js$": "$1"
100-
}
60+
"@express-rate-limit/prettier": "1.1.0",
61+
"@express-rate-limit/tsconfig": "1.0.0",
62+
"@jest/globals": "29.6.3",
63+
"@jest/types": "29.6.3",
64+
"@types/node": "20.5.1",
65+
"del-cli": "5.0.0",
66+
"dts-bundle-generator": "8.0.1",
67+
"esbuild": "0.19.2",
68+
"husky": "8.0.3",
69+
"jest": "29.6.3",
70+
"lint-staged": "14.0.1",
71+
"npm-run-all": "4.1.5",
72+
"pkgroll": "1.11.0",
73+
"ts-jest": "29.1.1",
74+
"tsx": "3.12.7",
75+
"typescript": "5.1.6",
76+
"xo": "0.56.0"
10177
},
10278
"xo": {
10379
"prettier": true,
@@ -116,7 +92,9 @@
11692
}
11793
}
11894
],
119-
"ignores": ["examples/"]
95+
"ignores": [
96+
"examples/"
97+
]
12098
},
12199
"prettier": "@express-rate-limit/prettier",
122100
"lint-staged": {

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
"exclude": ["node_modules/"],
44
"extends": "@express-rate-limit/tsconfig",
55
"compilerOptions": {
6-
"target": "ES2019"
6+
"target": "es2021"
77
}
88
}

0 commit comments

Comments
 (0)