https://github.com/olaoluwam/scaffy
A CLI tool for boostrapping your favourite tools with your custom configurations
https://github.com/olaoluwam/scaffy
cli typescript
Last synced: 12 months ago
JSON representation
A CLI tool for boostrapping your favourite tools with your custom configurations
- Host: GitHub
- URL: https://github.com/olaoluwam/scaffy
- Owner: OlaoluwaM
- License: mit
- Created: 2022-02-06T10:55:39.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-16T10:04:39.000Z (almost 4 years ago)
- Last Synced: 2025-06-20T17:09:17.514Z (about 1 year ago)
- Topics: cli, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@olaolum/scaffy
- Size: 7.23 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Scaffy

- [Scaffy](#scaffy)
- [Description](#description)
- [Built with :boxing_glove:](#built-with-boxing_glove)
- [Perquisites](#perquisites)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [LICENSE](#license)
## Description
Configuring tools can suck. That's why we customize them once, then store them in some
repo for reuse. This works, but most tools require a set of dependencies, alongside your
custom configurations, to work. This can be a pain, but scaffy is here to help.
I built scaffy because I didn't enjoy constantly browsing for the right combination of
dependencies to get my configurations to work. Furthermore, I'd sometimes use other
people's configs but they would almost always get buried in my abyss of Github
stars/bookmarks which would make searching for them such a hassle.
But with scaffy, I can aggregate all related dependencies and configurations under an
alias and, with that alias, bootstrap my projects with a single command.

### Built with :boxing_glove:
Scaffy is built with Typescript and it is meant to be used as a standalone CLI utility
## Perquisites
Scaffy doesn't ask much :smile:. All it needs is for node (v16+) and npm to be installed
## Installation
```bash
npm i -g @olaolum/scaffy
```
## Configuration
Taking inspiration from the tsconfig.json, any json file that ends in **.scaffy.json** is
a valid configuration file.
Scaffy will search the root of your project directory for a your configuration file. If it
stumbles upon many, it will give you the option to choose.
The schema for the configuration file is as follows:
```typescript
interface ConfigSchema {
[name: string]: {
readonly extends:
| string
| {
readonly from: string;
readonly merge: (
| 'depNames'
| 'devDepNames'
| 'remoteConfigurationUrls'
| 'localConfigurationPaths'
)[];
};
depNames?: string[];
devDepNames?: string[];
remoteConfigurationUrls?: string[];
localConfigurationPaths?: string[];
};
}
```
The schema above states that each entry in the scaffy configuration file must be given a
name. This name can be anything you desire, literally `anything-you-desire`. The names are
naught but a means by which scaffy groups dependencies and configuration files.
All entry members are optional, but at least one member must be valid for the entry to not
be ignored.
Here is an example scaffy config entry
```json
{
"some-other-config": {
"devDepNames": ["eslint@latest", "eslint-config-prettier@1.0.0"]
},
"cra-eslint": {
"extends": "some-other-config",
"devDepNames": ["eslint-plugin-better-styled-components", "eslint-plugin-prettier"],
"remoteConfigurationUrls": [
"https://raw.githubusercontent.com/OlaoluwaM/planets-facts-challenge/main/.eslintrc.js",
"https://raw.githubusercontent.com/OlaoluwaM/planets-facts-challenge/main/.prettierrc"
]
}
}
```
You can also add version information like `@latest` or specific version number like
`@7.3.0` to any of the dependencies listed in the `depNames` or `devDepNames` options
Additionally, in the spirit of DRY, scaffy allows you to extend other configs in whole or
in part. When extending one entry from another, a merge will occur with all properties of
the entries involved (excluding the merging of the `extends` property of course).
To have an entry extend from another, simply add an `extends` key to the extending entry
with the value being the name of the entry to be extended from. An example has been
provided above
For more specific extensions, where you only wish to extend part of an entry, scaffy's got
your back with that too! Here is an example
```json
{
"sample-parent": {
"devDepNames": ["eslint", "jest"],
"remoteConfigurationUrls": [
"https://raw.githubusercontent.com/OlaoluwaM/configs-deperacated-/master/jsconfig.json"
]
},
"extending-entry": {
"extends": {
"from": "sample-parent",
"merge": ["devDepNames", "remoteConfigurationUrls"]
},
"devDepNames": ["zod"],
"depNames": ["eslint-plugin-react", "emotion", "yup"],
"remoteConfigurationUrls": [
"https://raw.githubusercontent.com/OlaoluwaM/configs/old-do-not-delete/typescript/.eslintrc.js"
],
"localConfigurationPaths": ["../local-configs/.prettierrc"]
}
}
```
Here, we have the entry `extending-entry` extending only the `devDepNames` and
`remoteConfigurationUrls` from the `sample-parent` entry
## Usage
With the example configuration above, here is how scaffy is used
```bash
# To bootstrap cra-eslint we can do
scaffy bootstrap cra-eslint
# If we feel cra-eslint doesn't do what we want we can remove it using
scaffy remove cra-eslint
# For the version
scaffy -v
# You can also specify a config file with the following option
scaffy bootstrap cra-eslint -c ./example.scaffy.json
# You can get more info run
scaffy -h
```
## LICENSE
Copyright © 2022 Olaoluwa Mustapha Released under the MIT license.