npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

config-modules

v1.0.0

Published

Turning static config files into dynamic in a modular approach

Downloads

2

Readme

config-modules

Is turning static config files into dynamic in a modular approach.

What I mean by that?

Take a static i3wm config file. You open it, change a bunch of variables, save it, reload your config and this has changed your color theme. What if you could simply predefine little files (called modules), each containing the same variables holding different colors and then easily switch between those modules, concatenated to your i3wm config? Or even turn whole parts of your config into individual modules that you can apply by choice. This is where config-modules comes into play!

Here's what I used it for:

How it works

You create a text file (called static). You create a folder containing multiple text files (modules). Later, running this utility will allow you to dynamically (or only via CLI options) choose which module to be concatenated to the static file (to the top/to the bottom of the static file, specified in a special config file called entryconfig) and it will export the resulting concatenated file to a specified place (specified in the same entryconfig). This whooole thing is called an entry. An entry is simply a program you want to generate a config for (from static & modules). You can have multiple entries in the folder that you specified via config-modules-dir slash entries.

A visual example of what I just explained can be seen in ./examples/config-modules-dir.

entry vs module

An entry is a single program that has its own static file, entryconfig and modules directory containing the different modules that can be concatenated to the static and exported on the specified in entryconfig place. All of this is a single entry. It is located under its own directory residing in config-modules-dir slash entries.

config vs entryconfig

The config usually resides in ~/.config/config-modules/config-modules.yaml and it is used to both set up how config-modules behaves as well as to store cache by the utility. It is self-explanatory, for info about each option look at ./config.yaml.

Entryconfig on the other hand is a per-entry config file. You use it to configure default entry behavior, the most important of which is where the concatenated static + chosen module should be exported to (export-to property). An example entryconfig file is ./examples/config-modules-dir/entries/i3-wm/entryconfig.yaml, self-explanatory as well.

Installation

$ npm install config-modules

Initialize the config-modules-dir

Look at ./examples/config-modules-dir for the file structure and configuration options you can define in entryconfig.

Initial run

Upon its first run, specify which directory should be used as config-modules-dir, like that:

$ config-modules --config-modules-dir ~/.config-modules-dir

It will as well ask you whether you want it to generate a config file at ~/.config/config-modules/config-modules.yaml. This config file is used both for storing cache by config-modules and by you, to pass configuration parameters. Press Y to confirm. The default self-explanatory config file is available at ./config.yaml.

Note

Both config and entryconfig are self-explanatory, meaning their few parameters are explained with comments in the files. Repeating parameters in entryconfig (if supported) have precedence over the ones defined in the default config.

For more info, see --help.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT