Suffering from package.json
dependency chaos? π© package-doctor
π¨ββοΈ to the rescue! This Python script automatically scans your package.json
and updates date-fns
and next
versions to your desired specifications, ensuring dependency sanity and project consistency.
- β¨ Features
- π Getting Started
- βοΈ Configuration
- π οΈ Usage
- Output Explanation
- π€ Contributing
- π License
- π§βπ» Author
- Automated Dependency Correction: Specifically targets and corrects versions for
date-fns
andnext
dependencies in yourpackage.json
. - Customizable Desired Versions: Easily modify the script to adjust the target versions for
date-fns
,next
, or add more dependencies to manage. - Descriptive Console Output: Provides clear and informative messages with emojis to indicate changes made, successes, or issues encountered during the process.
- Checks Both
dependencies
anddevDependencies
: Ensures comprehensive coverage by scanning both sections of yourpackage.json
for the specified dependencies. - Error Handling: Gracefully handles common issues like missing
package.json
file or invalid JSON format, providing helpful error messages. - Non-destructive (mostly): Only modifies the
package.json
file if changes are needed and outputs to the console if no updates are required. (Always recommended to backup yourpackage.json
before running any script that modifies it).
Get started with package-doctor
in just a few simple steps!
- Python 3.x: You need Python 3.x installed on your system. You can download it from python.org.
- Download the Script: Download the
update_dependencies.py
script (or copy the code from this repository) and save it to your local machine. - Place in your Project: Ideally, place the script in the root directory of your project where your
package.json
file is located. This makes running the script easier.
-
Open your Terminal: Navigate to the directory where you saved the
update_dependencies.py
script and yourpackage.json
file using your terminal or command prompt. -
Execute the Script: Run the script using the Python interpreter:
python update_dependencies.py
If your
package.json
is in a different location, you can specify the path as an argument:python update_dependencies.py path/to/your/package.json
-
Observe the Output: The script will analyze your
package.json
and output descriptive messages to your console, indicating any changes made or if no updates were needed.
The script is configured through the desired_dependencies
dictionary within the update_dependencies.py
file.
desired_dependencies = {
"date-fns": "^3.0.0",
"next": "14.2.23"
}