accurat / accurapp

Create JS apps with flexible build configuration, tailored for the specific needs of Accurat
MIT License
21 stars 5 forks source link

Detect if a `package-lock.json` is present, and error out blocking everything if true #69

Open caesarsol opened 4 years ago

caesarsol commented 4 years ago

Is your feature request related to a problem? Please describe.

Sometimes for developers overlook, an npm command gets run in the repo and a package-lock.json gets created even if a yarn.lock is already present. This creates problems in Netlify and other auto-deploy platforma, because they choose the tool depending on which files they find.

Describe the solution you'd like

Any accurapp command (start / build / lint) could check: if package-lock.json AND yarn.lock are present, block everything and alert with a big red flashy warning. Solution for the user: delete one of the two files (preferably the NPM one)

Thoughts?

marcofugaro commented 4 years ago

What about simply adding package-lock.json to the .gitignore?

caesarsol commented 4 years ago

That would make it behave strangely only on developers machines... And I fear anyone would think "this is wrong!" and remove the line from the gitignore!

marcofugaro commented 4 years ago

You're right @caesarsol

Should the big red message block the execution of the script in your opinion? Or just be a message like the "upgrade accurapp" one?

I think it's safe to tell the user to just use yarn. I've already put the yarn command in the start one because people would forget to reinstall the new dependencies when pulling updates your teammates did:

https://github.com/accurat/accurapp/blob/c21fbe7277c4e72c258152b99f70bd246968ff2e/packages/create-accurapp/index.js#L91

caesarsol commented 4 years ago

I'd say ZERO TOLERANCE, because noone really reads the alert messages.

caesarsol commented 4 years ago

We could also simply update that script to something similar to:

start: '[[ ! -f package-lock.json ]] && yarn && accurapp-scripts start',