detect-port
detect-port copied to clipboard
feat: refactor with typescript to support esm and cjs both
BREAKING CHANGE: Drop Node.js < 16 support
- 使用 ts 重构
- 使用 tshy 支持 esm 和 cjs
- test 使用 test-runner (这里需要 node v18 版本)
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
Package | New capabilities | Transitives | Size | Publisher |
---|---|---|---|---|
npm/[email protected] | environment | 0 |
62.3 kB | fengmk2 |
npm/[email protected] | filesystem, unsafe Transitive: environment, shell | +58 |
2 MB | oss-bot |
npm/[email protected] | Transitive: environment, eval, filesystem, shell, unsafe | +242 |
34.3 MB | fengmk2 |
npm/[email protected] | environment Transitive: filesystem, shell | +16 |
301 kB | ehmicky |
npm/[email protected] | environment, shell Transitive: eval, filesystem, network, unsafe | +84 |
8.98 MB | xudafeng |
npm/[email protected] | None | +1 |
9.99 kB | sindresorhus |
npm/[email protected] | None | 0 |
32.4 MB | typescript-bot |
🚮 Removed packages: npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected]
https://github.com/node-modules/detect-port/blob/master/.github/workflows/nodejs.yml#L18 这里去掉 14,加上 20 的测试环境
想问下 waitPort 方法的使用场景是什么? 看了代码,没太 get 到
Walkthrough
The recent updates enhance the project's configuration, dependencies, and functionality. ESLint rules are refined, Node.js versions in workflows are updated, and the .gitignore
file is expanded. Key scripts now use ES6 syntax, and the detectPort
function is more versatile. New test files ensure robust validation for CLI tools and port detection. These changes collectively improve code quality, compatibility, and functionality.
Changes
File(s) | Change Summary |
---|---|
.eslintrc |
Introduced TypeScript rules, node prefix conventions, and disabled TypeScript comment ban rule. |
.github/workflows/nodejs.yml |
Updated Node.js versions from '14, 16, 18' to '16, 18, 20'. |
.gitignore |
Added exclusions for .tshy* files and dist/ directory. |
bin/detect-port.ts |
Transitioned to ES6 import syntax and updated port detection logic. |
package.json |
Modified main entry, updated dependencies, added new scripts, and introduced new configurations. |
src/detect-port.ts |
Enhanced detectPort function with multiple overloads and new type definitions. |
src/index.ts |
Added imports and exports for detectPort and waitPort . |
src/wait-port.ts |
Introduced waitPort function for asynchronously waiting for port availability. |
test/cli.test.ts |
Added test cases for CLI tool related to port detection. |
test/detect-port.test.ts |
Introduced tests for port detection functionality under various scenarios. |
test/wait-port.test.ts |
Added test cases for waitPort function. |
tsconfig.json |
Extended configuration from @eggjs/tsconfig and set compiler options for target , module , and moduleResolution . |
Poem
In code's vast fields, changes bloom, ESLint rules and ports resume. Node.js versions climb the tree, Testing ports with glee. Scripts now in ES6's light, Dependencies set just right. A rabbit hops with joy to see, A project thriving, wild and free. 🌸🐇
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>.
-
Generate unit testing code for this file.
-
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitai
in a new review comment at the desired location with your query. Examples:-
@coderabbitai generate unit testing code for this file.
-
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitai
in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai generate interesting stats about this repository and render them as a table.
-
@coderabbitai show all the console.log statements in this repository.
-
@coderabbitai read src/utils.ts and generate unit testing code.
-
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
-
@coderabbitai help me debug CodeRabbit configuration file.
-
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (invoked as PR comments)
-
@coderabbitai pause
to pause the reviews on a PR. -
@coderabbitai resume
to resume the paused reviews. -
@coderabbitai review
to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full review
to do a full review from scratch and review all the files again. -
@coderabbitai summary
to regenerate the summary of the PR. -
@coderabbitai resolve
resolve all the CodeRabbit review comments. -
@coderabbitai configuration
to show the current CodeRabbit configuration for the repository. -
@coderabbitai help
to get help.
Additionally, you can add @coderabbitai ignore
anywhere in the PR description to prevent this PR from being reviewed.
CodeRabbit Configration File (.coderabbit.yaml
)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yaml
file to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
想问下 waitPort 方法的使用场景是什么? 看了代码,没太 get 到
一直在尝试等待指定端口可用。
我重新基于你的分支 rebase 一下.