Default executors and validators for autotool
npm install autotool-plugin-default



This plugin provides the default element executors and some validators. It is
always included you don't need to install it separately.
Allows you to add and remove elements from a packageJson file. Will also sort it
for you based on a preference. To delete an element, set it to undefined.
Example:
``ts`
// Add a build script to the package json, and remove another if exists
{
type: 'packageJson',
data: {
scripts: {
build: 'vite',
'build-but-legacy': undefined
}
}
}
> It will also apply prettier formatting with your config on the package json.JSON.stringify
> Which means if you don't have prettier your file will come out using using a
> simple 2 space formatting straight out of .
Copies a file that has been shipped with your plugin to the target location.
It's important that the file that you are copying will be copied from the
node_modules folder when it is executed at the user.
> If you can't ship the files you need to create, you can use a custom element
> and create it manually.
Example:
`ts`
{
executor: 'fileCopy',
description: 'Create root prettierrc',
targetFile: '.prettierrc.cjs',
packageKind: 'root',
sourcePluginPackageName: packageJson.name, // import packageJson from '../package.json';
sourceFile: join('static', 'prettierrc.cjs'), // import { join } from 'node:path';
},
This element will create a .prettierrc.cjs file at your workspace root.
You need to define a sourceFile, that's a relative path from your pluginsourcePluginPackageName
package and which has to be your package's name. Thesenode_modules
two are needed to know where the file will end up at the consumers folder.
This is the simplest element. You define a function and are given the context
all other elements have. The element it's applying (always itself), the target
and the options containing data like if it's a dryish run, and the logger.
`ts``
{
executor: 'custom',
description: 'say hello to all public packages!',
packageJsonFilter: {
private: false,
},
apply: (_e, target, options) =>
options.logger.info('Hello', target.targetPackage.packageJson.name),
},
Use elements that are executing right at that package