Skip to content

Various Python scripts to help manage the DSV mod and its many files.

License

Notifications You must be signed in to change notification settings

DiverseStardewValley/Scripts

DSV - Scripts

Release Python Build CodeQL CodeFactor

Various Python scripts to help manage the Diverse Stardew Valley mod and its many files.

While these scripts are/were developed primarily with DSV's use cases in mind, they can be quite handy for general purposes too - and they're fairly easy for anyone to set up and use!

Requirements

Installation

If you just want to use these scripts, this command will work for initial installation as well as subsequent updates:

pip install -U git+https://github.com/DiverseStardewValley/Scripts.git
However, if you want to play around with the code (and maybe contribute your own script!) - you'll most likely want to use these steps instead... (click to expand)

Editable/Development Installation

  1. First, clone this repository (i.e. download the code).

    git clone https://github.com/DiverseStardewValley/Scripts.git
    
  2. Then, change directory into the one you just cloned.

    cd Scripts
    
  3. Lastly, install the Python package contained in that directory.

    pip install -e .
    

Note: The -e flag indicates an editable install, which means that any changes you make to the code will immediately take effect when you run the program locally.

Usage

Once you've installed this package, you can view its help menu by using this command from any directory:

dsv-scripts
If everything was set up correctly, you should see something like this... (click to expand)
┌────────────────────────────────────────────────────────────────────┐
│              _                            _       _                │
│           __| |_____   __   ___  ___ _ __(_)_ __ | |_ ___          │
│          / _` / __\ \ / /__/ __|/ __| '__| | '_ \| __/ __|         │
│         | (_| \__ \\ V /___\__ \ (__| |  | | |_) | |_\__ \         │
│          \__,_|___/ \_/    |___/\___|_|  |_| .__/ \__|___/         │
│                                            |_|   v0.1.3            │
│                                                                    │
│   Various scripts to help manage the Diverse Stardew Valley mod.   │
│                                                                    │
│  Command              Description                                  │
│  minify-json          Saves minified copies of JSON/JSON5 files.   │
│  remove-blank-lines   Removes blank lines in text-based files.     │
│  tinify-pngs          Saves compressed copies of PNG images.       │
└────────────────────────────────────────────────────────────────────┘

Just like the primary dsv-scripts command, all of the additional listed commands can be used from any directory. To see more information about a command or script, use its -h option (for example, minify-json -h).

Git Hooks

Most of these scripts can also be installed as pre-commit hooks for seamless integration into your workflow. (If you're unfamiliar with pre-commit, here's its quickstart guide. Highly recommend it for any project!)

When your .pre-commit-config.yaml is ready, simply add this repo and the hooks you want to use. For example:

- repo: https://github.com/DiverseStardewValley/Scripts
  rev: 0.1.3
  hooks:
    - id: minify-json
      args: ["--input=src", "--output=pkg"]
    - id: remove-blank-lines
      files: ^src/.+\.json$

Contributing

Contributions to this repository are always encouraged and very much appreciated! If you think something in the documentation should be clarified, or if you have an idea for a script that would be useful, you're more than welcome to open a pull request. 💗

For general information about contributing to DSV, check out our contributing guidelines.

License

Copyright © 2022 The DSV Team. Released under the BSD 3-Clause License.

About

Various Python scripts to help manage the DSV mod and its many files.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Languages