lwsjs / local-web-server

A lean, modular web server for rapid full-stack development.
MIT License
1.2k stars 85 forks source link

Error: Found extraneous } in Chalk template literal #118

Closed dotnetCarpenter closed 5 years ago

dotnetCarpenter commented 5 years ago

Steps to reproduce:

  1. Copy the code from Creating-middleware to a file named mw-example.js.
    module.exports = MiddlewareBase => class Example extends MiddlewareBase {
    middleware (options) {
    return (ctx, next) => {
      ctx.response.body = 'Hello'
    }
    }
    }
  2. In the terminal write ./node_modules/.bin/ws --stack mw-example.js --help if installed locally.

Error:

Error: Found extraneous } in Chalk template literal
    at tmp.replace (/node_modules/chalk/templates.js:109:11)
    at String.replace (<anonymous>)
    at module.exports (/node_modules/chalk/templates.js:99:6)
    at chalkTag (/node_modules/chalk/index.js:221:9)
    at Chalk.chalk.template (/node_modules/chalk/index.js:36:20)
    at format (/node_modules/command-line-usage/lib/chalk-format.js:4:10)
    at chalkFormat (/node_modules/command-line-usage/lib/chalk-format.js:10:12)
    at ansiFormatRow (/node_modules/command-line-usage/lib/content.js:76:16)
    at content.map.row (/node_modules/command-line-usage/lib/content.js:35:52)
    at Stack.map (<anonymous>)

Edit: removed beginning of paths in error output for brevity

local-web-server version: 2.6.1

75lb commented 5 years ago

Fixed and released in lws v1.3.2, please re-install local-web-server to pick up the change. Thanks for letting me know. 👍

dotnetCarpenter commented 5 years ago

@75lb I'm super confused. Why is there two similar projects with different version numbers?

I reported a bug in version 2.6.1 of https://github.com/lwsjs/local-web-server/, which is the one I have installed in my node_modules folder. But you seem to have fixed that exact same bug in version 1.3.2 of https://github.com/lwsjs/lws/.

Which project do you support?

75lb commented 5 years ago

Hi.. local-web-server uses lws, lws is a module in the dependency tree of local-web-server.. i maintain both projects.

The bug itself was not in local-web-server, it was in lws. I fixed lws so now you need to reinstall local-web-server (which uses lws internally) - this process will ensure you have the latest version of lws installed.

dotnetCarpenter commented 5 years ago

Thanks for clarifying (and so quickly!) - I will revert yarn remove local-web-server && yarn add --dev lws then. I thought lws was the supported project since the commits was much newer.

local-web-server uses lws, lws is a module in the dependency tree of local-web-server

Could you comment be added to the lws README?

75lb commented 5 years ago

I thought lws was the supported project since the commits was much newer.

Makes sense.. I'm actually working on both projects atm.

Could you comment be added to the lws README?

Yes, I will clarify everything in the README as part of the next release, thanks.