Fixes `path.resolve(false)` in `MIDDLEWARE_PATH` declaration.

Đang mở
#9 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
50/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu trong index.js tại phần khai báo MIDDLEWARE_PATH và so sánh cách xử lý hiện tại của process.argv[3] với diff được cung cấp trong issue. Tái hiện trường hợp middleware từ xa của backstop nếu có thể, sau đó xác minh rằng việc khởi động mà không có đường dẫn middleware vẫn hoạt động và rằng một đường dẫn được cung cấp được phân giải mà không truyền false cho path.resolve.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

While debugging backstop remote I came across an issue with the middleware arg here. path.resolve doesn't accept booleans, so this splits the declaration of MIDDLEWARE_PATH into a ternary instead.

Hope this helps. Thanks for all you do!

Here is the diff that solved my problem:

diff --git a/node_modules/super-simple-web-server/index.js b/node_modules/super-simple-web-server/index.js
index 1eb8065..a27c9b9 100644
--- a/node_modules/super-simple-web-server/index.js
+++ b/node_modules/super-simple-web-server/index.js
@@ -34,7 +34,7 @@ function logger(req, res, next) {
  * To add middleware set the third arg to a path that resolves to a file exporting a function like so...
  * module.exports = (app) => { app.use(someCoolThingHere);}
  */
-const MIDDLEWARE_PATH = path.resolve(process.argv[3] || false);
+const MIDDLEWARE_PATH = process.argv[3] ? path.resolve(process.argv[3]) : false;
 if (MIDDLEWARE_PATH) {
   try {
       var initMiddleware = require(MIDDLEWARE_PATH);

This issue body was partially generated by patch-package.

Ngôn ngữ chính
JavaScript
Star
0
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.