Rete CLIRollupESLintJestTypeDoc
Rete CLI is a building tool with built-in support for TypeScript and ESLint along with predefined rules. Additionally, it includes Jest. These features make it simple to start building new plugins without having to setup your own environment for building, linting, and testing.
The build feature is based on Rollup and comes with pre-configured Babel presets for TypeScript support.
npm i -g rete-cli
The first step is to create a configuration file called rete.config.ts
import { ReteOptions } from 'rete-cli'
export default<ReteOptions>{
input: 'src/index.ts', // path to entry script
name: 'Namespace' // namespace for UMD bundles
}
Run the command
rete build --config rete.config.ts
The generated dist
directory is publish-ready and includes all required bundles, type definitions, README.md, and package.json files with their corresponding paths.
The --watch
option can be used to trigger automatic project building upon save, while the --outputs
option allows you to specify multiple output paths separated by commas for the build destination.
Let's take a look at several configuration options that are supported:
import { ReteOptions } from 'rete-cli'
export default <ReteOptions>[ // config with multiple entries
{
input: 'src/foo/index.ts',
name: 'Namespace'
babel: {
presets: [
require('@babel/preset-env'), // used by default, but should be declared when you specifies 'presets'
require('@babel/preset-typescript'), // used by default
require('@babel/preset-react'),
]
}
},
{
input: 'src/bar/index.ts',
name: 'Namespace'
globals: {
'rete': 'Rete',
},
plugins: [ // specify Rollup plugins
commonjs(),
],
babel: {
plugins: [
// include Babel plugins
]
}
}
]
By default, running rete build
command includes a linting step prior to generating the bundles. However, you can also perform linting independently by running a separate command.
rete lint