"Autotool" is a no-config, plugin-based and extensible CLI tool for automating code and file operations in monorepos. It applies operations on packages based on their archetype, allowing developers to stay up-to-date and in sync across multiple repositories.
MIT License
A code migration tool mainly for distributing tooling configurations in packages within a monorepo.
It's a very generic tool that will apply file operations on your workspace but
it's intended usecase is setting up tooling configurations within your
repository. You are still heavily encouraged to first create your own
plugins/configuration packages for the individual packages (Like an
eslint-plugin
or a prettier-plugin
) but the files that tell the tool still
need to be defined. This is where autotool
comes in and forces your repository
to look the way you want it.
Another usecase is to add and format your package.json
file. For example, a
plugin can set up your prettier
configuration, but not just that, it will also
add related scripts to your package.json
file.
Check out what the individial ElementExecutor
s do as autotool
on itself is
just an orchestrator of plugins. It collects their elements, executors and
validators, checks what packages and files they are targeting based on their
filters, then applies them.
Install autotool
as a devDependency
pnpm i -D autotool
Install some plugins that you want autotool
to apply when you run it.
pnpm i -D @alexaegis/autotool-plugin-ts # automatic ts setup
Run autotool
npx autotool
It will detect all installed plugins in your workspace and apply them.
Create a new npm package and export an AutotoolPlugin
object/function as your
default export. The type definitions are available in the
autotool-plugin
package on which your plugin should depend on.
You can put
autotool-plugin
among your keywords array too in the package.json if you want people to find it!
Elements describe what and how to apply to your workspace. They can be applied to your entire workspace or just specific packages, you can even write filters based on the packageJson of each package.
For example you can have an element that creates a .prettierignore
file in all
your
You can use some basic element types that are defined in the default plugin
Executors describe how to apply an element, they contain the actual logic.
An executor can have a consolidate function that combines multiple elements on the same target file and combine them into another set of elements. (Usually just one but I kept the option to consolidate into more than one element)
For example you can have multiple elements adding properties into your packageJson file. At execution all these elements will get consolidated into one, and written to disk only once!
Some additional safety checks can be performed before trying to apply a set of
plugins to your workspace. For example not letting multiple elements copy to or
delete the same file. (A consolidate
step can help you here if you do want to
execute multiple elements of the same kind, for example the packageJson
element does that)
The main CLI tool
Type definitions and helper functions for plugin development
The default (always on) plugin containing the main element types and validators.