Skip to content

Commit b5d32d2

Browse files
fengmk2hanquliu
andauthored
feat: refactor with typescript to support esm and cjs both (#56)
BREAKING CHANGE: Drop Node.js < 16 support 1. 使用 ts 重构 2. 使用 tshy 支持 esm 和 cjs 3. test 使用 test-runner (这里需要 node v18 版本) merge from #51 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new `waitPort` function to asynchronously wait for a specified port to become available. - Added a new ESLint configuration to enforce TypeScript linting rules. - **Bug Fixes** - Reverted a feature in the `detect-port` package due to issues raised. - **Documentation** - Updated `README.md` for improved clarity and updated badge links. - Modified `CONTRIBUTING.md` to reflect changes in testing commands. - **Chores** - Introduced a new TypeScript configuration file (`tsconfig.json`). - Updated `package.json` to reflect changes in dependencies and project structure. - **Tests** - Added comprehensive tests for the new `waitPort` and updated tests for the CLI and `detectPort` function. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: hanquliu <[email protected]>
1 parent 5e8f3ed commit b5d32d2

26 files changed

+559
-576
lines changed

.eslintrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": [
3+
"eslint-config-egg/typescript",
4+
"eslint-config-egg/lib/rules/enforce-node-prefix"
5+
]
6+
}

.eslintrc.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 74 deletions
This file was deleted.

.github/workflows/nodejs.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@ name: CI
33
on:
44
push:
55
branches: [ master ]
6-
76
pull_request:
87
branches: [ master ]
98

10-
workflow_dispatch: {}
11-
129
jobs:
1310
Job:
1411
name: Node.js
15-
uses: artusjs/github-actions/.github/workflows/node-test.yml@v1
12+
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
1613
with:
1714
os: 'ubuntu-latest'
18-
version: '14, 16, 18'
15+
version: '16, 18, 20, 22'

.github/workflows/release.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@ on:
44
push:
55
branches: [ master ]
66

7-
workflow_dispatch: {}
8-
97
jobs:
108
release:
119
name: Node.js
12-
uses: artusjs/github-actions/.github/workflows/node-release.yml@v1
10+
uses: node-modules/github-actions/.github/workflows/node-release.yml@master
1311
secrets:
1412
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1513
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
16-
with:
17-
checkTest: false

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ node_modules
22
coverage
33
*.un~
44
*.sw*
5+
.tshy*
6+
dist/
7+
package-lock.json

CHANGELOG.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,97 @@
1313
### Features
1414

1515
* use address@2 ([#53](https://github.com/node-modules/detect-port/issues/53)) ([55f48d7](https://github.com/node-modules/detect-port/commit/55f48d755f3c8b480d4e4ce1065abc1c8e3c5a19))
16+
17+
---
18+
19+
20+
1.5.1 / 2022-09-23
21+
==================
22+
23+
**fixes**
24+
* [[`9dd9ce3`](http://github.com/node-modules/detect-port/commit/9dd9ce34b560a434ee3a393f6ddea884691f632f)] - fix: add #!/usr/bin/env node header (#49) (达峰的夏天 <<[email protected]>>)
25+
26+
1.5.0 / 2022-09-21
27+
==================
28+
29+
**features**
30+
* [[`618dec5`](http://github.com/node-modules/detect-port/commit/618dec5661d94535800089f9d941f4896825cb69)] - feat: support wait port (#46) (达峰的夏天 <<[email protected]>>)
31+
32+
**fixes**
33+
* [[`a54e2ef`](http://github.com/node-modules/detect-port/commit/a54e2ef70e388ed4b0c7a4b79ad88bc91e0f8ae3)] - fix: typo on line 54 (#45) (Yavuz Akyuz <<[email protected]>>)
34+
35+
**others**
36+
* [[`28f07b3`](http://github.com/node-modules/detect-port/commit/28f07b31a7c591cb28b13281246c7f0c64c3dded)] - 🤖 TEST: Run CI on Github Action (#47) (fengmk2 <<[email protected]>>)
37+
* [[`ae55c95`](http://github.com/node-modules/detect-port/commit/ae55c956ca36749e22c48b8d1a7d98afec2e6a4d)] - Create codeql-analysis.yml (fengmk2 <<[email protected]>>)
38+
* [[`f35409d`](http://github.com/node-modules/detect-port/commit/f35409d53f9298a60e2c6c1560f42ea182025dd4)] - chore: update project config (xudafeng <<[email protected]>>)
39+
* [[`cd21d30`](http://github.com/node-modules/detect-port/commit/cd21d3044db73d1556bf264209c8fd0ee08fa9c4)] - chore: update readme (#43) (XiaoRui <<[email protected]>>)
40+
* [[`da01e68`](http://github.com/node-modules/detect-port/commit/da01e68b43952e06430cc42f873e4253d8cba09e)] - chore: add .editorconfig (#42) (达峰的夏天 <<[email protected]>>)
41+
* [[`a2c6b04`](http://github.com/node-modules/detect-port/commit/a2c6b043954895cba9cbae369e0d79a337c9d73a)] - chore: update repo config (#41) (达峰的夏天 <<[email protected]>>)
42+
* [[`8da6f33`](http://github.com/node-modules/detect-port/commit/8da6f33e10b44cdbcfb9eb5727b0f2117e6929e9)] - chore: update readme (#38) (达峰的夏天 <<[email protected]>>)
43+
* [[`ee88ccb`](http://github.com/node-modules/detect-port/commit/ee88ccb9e2a747dc84a30bcfc1cd4c73b64e3ea5)] - chore: remove unuse file (fengmk2 <<[email protected]>>)
44+
45+
1.3.0 / 2018-11-20
46+
==================
47+
48+
**features**
49+
* [[`a00357a`](http://github.com/node-modules/detect-port/commit/a00357aea32c4f011b7240641cb8da2dfc97b491)] - feat: support detect port with custom hostname (#35) (Ender Lee <<[email protected]>>)
50+
51+
**others**
52+
* [[`671094f`](http://github.com/node-modules/detect-port/commit/671094f3a3660a29a0920d78e39d17f8dead0b7a)] - update readme (xudafeng <<[email protected]>>)
53+
* [[`285e59b`](http://github.com/node-modules/detect-port/commit/285e59b0464d670c886007ff5052892393d57314)] - chore: add files to package.json (fengmk2 <<[email protected]>>)
54+
55+
1.2.3 / 2018-05-16
56+
==================
57+
58+
**fixes**
59+
* [[`64777f8`](http://github.com/node-modules/detect-port/commit/64777f85cc519c9c4c2c84c23d2afed6a916f3c4)] - fix: ignore EADDRNOTAVAIL error when listen localhost (#33) (Haoliang Gao <<[email protected]>>)
60+
* [[`398bc4f`](http://github.com/node-modules/detect-port/commit/398bc4f65f4d61ddfdc9bf7721118ea1a3bb6289)] - fix: handle 0.0.0.0:port binding (#26) (fengmk2 <<[email protected]>>)
61+
62+
**others**
63+
* [[`aedf44f`](http://github.com/node-modules/detect-port/commit/aedf44fc3f949de9ec187bdc8ee4d8daf84d6c2b)] - doc: tweak description (xudafeng <<[email protected]>>)
64+
* [[`b7ff76f`](http://github.com/node-modules/detect-port/commit/b7ff76f24db3d8d9123cbf396b9032b05a6b7146)] - update FAQ & contributor (xudafeng <<[email protected]>>)
65+
* [[`4a9e127`](http://github.com/node-modules/detect-port/commit/4a9e127b6d01bd45d9b689bd931d878aa9b5d397)] - cli tweak to verbose (#25) (xdf <<[email protected]>>),
66+
67+
1.1.3 / 2017-05-24
68+
==================
69+
70+
* fix: should ignore getaddrinfo ENOTFOUND error (#22)
71+
72+
1.1.2 / 2017-05-11
73+
==================
74+
75+
* fix: should double check 0.0.0.0 and localhost (#20)
76+
* docs: ignore type of port when checking if it's occupied (#18)
77+
78+
# 1.1.1 / 2017-03-17
79+
80+
* fix: try to use next available port (#16)
81+
82+
# 1.1.0 / 2016-01-17
83+
84+
* Use server listen to detect port
85+
86+
# 1.0.7 / 2016-12-11
87+
88+
* Early return for rejected promise
89+
* Prevent promsie swallow in callback
90+
91+
# 1.0.6 / 2016-11-29
92+
93+
* Bump version for new Repo
94+
95+
# 0.1.4 / 2015-08-24
96+
97+
* Support promise
98+
99+
# 0.1.2 / 2014-05-31
100+
101+
* Fix commander
102+
103+
# 0.1.1 / 2014-05-30
104+
105+
* Add command line support
106+
107+
# 0.1.0 / 2014-05-29
108+
109+
* Initial release

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
- Fork the project, make a change, and send a pull request;
44
- Have a look at code style now before starting;
5-
- Make sure the tests case (`$ make test`) pass before sending a pull request;
5+
- Make sure the tests case (`$ npm test`) pass before sending a pull request;

HISTORY.md

Lines changed: 0 additions & 91 deletions
This file was deleted.

0 commit comments

Comments
 (0)