question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add - between words in npm scripts

See original GitHub issue

Description

I’m trying to submit my first PR to this awesome project. There were some challenges that I was/am facing e.g.

  • I can’t run npm run format from command line on Windows since it complains of not being able to run .sh scripts C:\dev\idea\nx>npm run format
C:\dev\idea\nx>npm run format

> @nrwl/nx-source@10.1.0 format C:\dev\idea\nx
> ./scripts/format.sh

'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @nrwl/nx-source@10.1.0 format: `./scripts/format.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @nrwl/nx-source@10.1.0 format script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\vivzt\AppData\Roaming\npm-cache\_logs\2020-09-06T14_40_28_761Z-debug.log

  • Running the same format script from my IDE (IntelliJ) results in *.md files changing to have LF line endings and show up as changed.
    • There are few ways we could resolve this issue. One option that comes to mind is adding .gitattributes to make this platform agnostic. I’m open to suggestions and willing to submit a PR for this based on Nx team’s feedback.

Now about the trivial change I was trying to submit as my first PR - https://github.com/nrwl/nx/pull/3672 I’d like to suggest that the scripts

  • checkcommit
  • checkformat
  • checkimports
  • checkversions

be renamed to:

  • check-commit
  • check-format
  • check-imports
  • check-versions

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
vivekmorecommented, Feb 7, 2021

I realized my issue was due to the stale state of my node_modules 😞 Running npm i solved the issue for me.

As for adding .gitattributes, thats a step in the right direction, not sure if that’s enough (as you may have already discovered). I’m given to understand that nx team has tried to have the workspace Windows-friendly/compatible but never succeeded in achieving a configuration that was agnostic to MacOS/Linux/Windows operating systems. - Hence I’ve resorted to developing nx in WSL2. background

Although, I share some of your sentiments, but it’s open-source and I can appreciate that the nrwl team needs to prioritize their business over the tool. Moreover, I see this as an opportunity to fix some easy bugs and contribute to an otherwise awesome tool. I’m slightly biased because I’m huge fan of scaffolding tools 😄

0reactions
vivekmorecommented, Feb 7, 2021

I tried to reproduce your issue locally, but got stuck somewhere else after:

npm run local-registry enable

My WSL2 doesn’t seem to expose the port 4873

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I write multiline scripts in npm scripts? - Stack Overflow
You can chain independent tasks. Here is an example: "scripts": { "lint-jshint": "jshint --verbose --show-non-errors ./src/main/js", "lint-eslint": "eslint ...
Read more >
Mastering NPM Scripts - DEV Community ‍ ‍
I've been using NPM Scripts for years, but I wanted to pass a parameter ... However, it doesn't add much value if your...
Read more >
How I Organize my NPM Scripts - Gleb Bahmutov
Notice that our scripts use several words separated by the : character (the - works as well). We can give the prefix for...
Read more >
replace-in-file - npm
A simple utility to quickly replace text in one or more files.. Latest version: 6.3.5, last published: 7 months ago.
Read more >
How to have better NPM Scripts - Raul Melo
A quick npm package to ease your complex npm scripts ... The real problem starts when we need an extensive command, adding environment ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found