use cross-env for platform-independent scripts #25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: Add
cross-envfor universal script executionProblem:
The current
devandprodscripts, which use theNODE_ENV=...syntax, are not compatible with Windows command prompts (e.g.,cmd.exeor PowerShell). This results in the error:'NODE_ENV' is not recognized as an internal or external command, operable program or batch file.This prevents Windows-based developers from easily running the project in development or production mode as intended.
Solution:
This PR introduces the
cross-envpackage as adevDependencyand updates thedevandprodscripts to use it."dev": "cross-env NODE_ENV=development node index.js""prod": "cross-env NODE_ENV=production node index.js"cross-envis a standard, lightweight solution for setting environment variables in a way that works on all major operating systems, including Windows, Linux, and macOS.Benefits:
package.jsonscripts are now truly cross-platform, which is a best practice for open-source projects.