1.0.0-beta.1 • Published 3 years ago

tidy-config v1.0.0-beta.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Tidy Config

About

Tidy Config (or tidy-config) is a small utility designed to enhance two things when working with a Node project:

  1. Create a version of your package.json file that uses the YAML format, allowing for easier reading, and more importantly, inline comments.
  2. Move configuration files for other packages from the root into a configuration folder, leaving behind symlinks which can be hidden in your code editor.

Using the utility

Setting up for the first time

If you are adding tidy-config for the first time in a project you should run this command in the root of your project where the package.json file is located:

tidy-config --init

This will walk you through the options and will add settings to your package.json, create a configuration folder and optionally move configuration files.

If you have pulled a repository that is already using tidy-config (i.e. there is a tidyConfig setting in package.json) then you should have an initial sequence run to populate and sync for the first time:

tidy-config --hydrate

Keeping the YAML file in sync

Keeping the package.json and package.yaml file in sync can be a little tricky. By default we add a postinstall script in package.json to automatically run a sync anytime there is a package installed.

If changes are detected in both package.json and the YAML file, then by default the package.json content will be considered the master. It is therefore important to run the sync command any time there are changes in either of the two files.

tidy-config --sync

Command-line options

OptionDescription
--initSets up some initial settings in your package.json file
--hydrateAttempts to populate package.json and the root folder with settings and files that are located in a configuration folder for the first time
--moveMove any files listed in package.json in the setting tidyConfig.files setting from the project root folder into your configuration folder, leaving behind a symlink
--vscodeUpdate the workspace settings for Visual Studio Code to ignore any symlinked files that now reside in the configuration folder
--restoreRestore any configuration files that were moved from the root folder
--syncSync the settings between the root package.json and the package.yaml file located in the configuration folder
--forceWhen performing a package.json sync, force wither the root package.json file (--force=json) or the package.yaml (--force=yaml) in the configuration folder to be considered the master
--debugShow tool debugging messages
--quietHide output - good for automated usage