This is my personal, opinionated collection of Yeoman generators to make spinning up and configuring TypeScript projects easy and enjoyable.
npx yo @landonschropp/init
npx yo @landonschropp/typescript
npx yo @landonschropp/jest
npx yo @landonschropp/eslint
This project includes several generators.
- generator-init: Sets up a brand-new Node.js repository. This
is similar to
yarn init
, but it includes different configuration and a few extras. - generator-typescript: Sets up TypeScript.
- generator-jest: Configures a Jest testing environment.
- generator-eslint: Adds my ESLint configuration to a project.
These generators a built to prompt as little as possible, so they tend to use the package.json file to determine their configuration. Make sure you have your core tools installed (such as React) before running the generators that depend on them.
You can run the generator of your choice with NPX. NPX allows you to run the generator once without having to install anything.
npx yo @landonschropp/<generator>
You can also see the documentation and options for each generator by including the --help
flag.
npx @landonschropp/eslint --help
You can run any of these generators independently, but if you're running more than one do so in the order listed above.
This repo uses Yarn workspaces, so updating all of the packages is easy.
yarn upgrade-interactive --latest
Publishing all of the packages is also a breeze thanks to Lerna. First, make sure the
NPM_TOKEN
environment variable is set. Then, all you need to do is run the following command.
lerna publish
While developing a generator, it's common to create an empty directory to run the generator in. Because this is done so frequently, this repository includes a handy script that does this automatically.
yarn set-up-example-project
This script does a few things for you:
- It automatically runs
yarn install
so you don't have to. - It creates a new
example
directory, sets it up as a Node package, and initializes a Git repository so you can any changes your package may introduce. - It links all of the packages in the
packages
directory via Yarn.
Once the script is done, all you need to do is change into the example
directory and run
yo @landonschropp/<generator>
to test out one of the generators.