autotool

"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

Downloads
595
Stars
1
Committers
1

autotool workspace

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 ElementExecutors 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.

How to use

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.

How to write a plugin?

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

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

Executors describe how to apply an element, they contain the actual logic.

Consolidation

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!

Validators

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)

Packages

autotool

The main CLI tool

autotool-plugin

Type definitions and helper functions for plugin development

autotool-plugin-default

The default (always on) plugin containing the main element types and validators.

Package Rankings
Top 21.64% on Npmjs.org
Badges
Extracted from project README
npm ci codacy codecov