-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support cjs and esm both by tshy (#5)
BREAKING CHANGE: drop Node.js < 18.19.0 support part of eggjs/egg#3644 eggjs/egg#5257 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Configuration Updates** - Updated ESLint configuration to improve code quality and consistency - Removed legacy configuration files (JSHint, Travis CI) - Added TypeScript configuration with strict type checking - **CI/CD Improvements** - Replaced Travis CI with GitHub Actions workflows - Added automated testing and release processes - Configured Node.js version support (18.19.0, 20, 22) - **Project Maintenance** - Updated README with modern badges and documentation - Simplified package configuration - Removed outdated contributor information - **Development Environment** - Updated `.gitignore` to reflect current project structure - Added coverage and build-related ignore rules <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
19 changed files
with
223 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test/fixtures | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": [ | ||
"eslint-config-egg/typescript", | ||
"eslint-config-egg/lib/rules/enforce-node-prefix" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
Job: | ||
name: Node.js | ||
uses: node-modules/github-actions/.github/workflows/node-test.yml@master | ||
with: | ||
version: '18.19.0, 20, 22' | ||
secrets: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Publish Any Commit | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- run: corepack enable | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build | ||
run: npm run prepublishOnly --if-present | ||
|
||
- run: npx pkg-pr-new publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
|
||
jobs: | ||
release: | ||
name: Node.js | ||
uses: node-modules/github-actions/.github/workflows/node-release.yml@master | ||
secrets: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GIT_TOKEN: ${{ secrets.GIT_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
coverage.html | ||
*.seed | ||
*.log | ||
*.csv | ||
*.dat | ||
*.out | ||
*.pid | ||
*.gz | ||
|
||
pids | ||
logs | ||
results | ||
|
||
node_modules | ||
logs/ | ||
npm-debug.log | ||
node_modules/ | ||
coverage/ | ||
test/fixtures/**/run | ||
.DS_Store | ||
.tshy* | ||
.eslintcache | ||
dist | ||
package-lock.json | ||
.package-lock.json |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,14 @@ | ||
{ | ||
"name": "jsonp-body", | ||
"version": "1.1.0", | ||
"description": "Helper to create more safe jsonp response body for koa and other web framework.", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"scripts": { | ||
"test": "mocha test/*.test.js", | ||
"test-cov": "istanbul cover _mocha -- test/*.test.js" | ||
}, | ||
"dependencies": { | ||
|
||
}, | ||
"devDependencies": { | ||
"autod": "*", | ||
"contributors": "*", | ||
"istanbul": "*", | ||
"jshint": "*", | ||
"mocha": "*", | ||
"should": "7" | ||
}, | ||
"description": "Helper to create more safe jsonp response body for koa and other web framework", | ||
"homepage": "https://github.com/node-modules/jsonp-body", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/node-modules/jsonp-body.git", | ||
"web": "https://github.com/node-modules/jsonp-body" | ||
"url": "git://github.com/node-modules/jsonp-body.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/node-modules/jsonp-body/issues", | ||
"email": "[email protected]" | ||
"url": "https://github.com/node-modules/jsonp-body/issues" | ||
}, | ||
"keywords": [ | ||
"jsonp", | ||
|
@@ -36,9 +17,60 @@ | |
"CVE-2014-4671", | ||
"abusing-jsonp-with-rosetta-flash" | ||
], | ||
"author": "fengmk2 <[email protected]> (https://github.com/fengmk2)", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">= 0.10.0" | ||
"node": ">= 18.19.0" | ||
}, | ||
"author": "fengmk2 <[email protected]> (https://github.com/fengmk2)", | ||
"license": "MIT" | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@arethetypeswrong/cli": "^0.17.1", | ||
"@eggjs/tsconfig": "1", | ||
"@types/node": "22", | ||
"@types/mocha": "10", | ||
"@eggjs/bin": "7", | ||
"eslint": "8", | ||
"eslint-config-egg": "14", | ||
"rimraf": "6", | ||
"tshy": "3", | ||
"tshy-after": "1", | ||
"typescript": "5" | ||
}, | ||
"scripts": { | ||
"lint": "eslint --cache src test --ext .ts", | ||
"pretest": "npm run clean && npm run lint -- --fix", | ||
"test": "egg-bin test", | ||
"preci": "npm run clean && npm run lint", | ||
"ci": "egg-bin cov", | ||
"postci": "npm run prepublishOnly && npm run clean", | ||
"clean": "rimraf dist", | ||
"prepublishOnly": "tshy && tshy-after && attw --pack" | ||
}, | ||
"type": "module", | ||
"tshy": { | ||
"exports": { | ||
".": "./src/index.ts", | ||
"./package.json": "./package.json" | ||
} | ||
}, | ||
"exports": { | ||
".": { | ||
"import": { | ||
"types": "./dist/esm/index.d.ts", | ||
"default": "./dist/esm/index.js" | ||
}, | ||
"require": { | ||
"types": "./dist/commonjs/index.d.ts", | ||
"default": "./dist/commonjs/index.js" | ||
} | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"files": [ | ||
"dist", | ||
"src" | ||
], | ||
"types": "./dist/commonjs/index.d.ts", | ||
"main": "./dist/commonjs/index.js", | ||
"module": "./dist/esm/index.js" | ||
} |
Oops, something went wrong.