create-genesis-workspace
This is a command line interface (CLI) to enable users to create a new Nx workspace with Genesis defaults and optional plugins. This creates a directory structure like this:
- /apps
- /libs
- /tools
- .gitignore
- .prettierrc
- nx.json
- package.json
- README.md
- tsconfig.base.json
- workspace.json
This folder structure is well suited to the needs of the majority of our projects which benefit from libraries and features being shared across multiple applications.
The Genesis CLI uses the create-nx-workspace command to generate files and applies the "App" preset. The benefit of using the create-genesis-workspace is that it will allow you to choose which Genesis plugins to automatically install and it will build the project using the most recent supported version of Nx that has been tested with Genesis plugins. That being said Genesis plugins should work fine with all versions of Nx that do not contain a breaking change so use of this CLI is mostly for convenience.
Usage
The CLI runs as an NPX script and will prompt you for more input as required. Open a terminal in the folder where you would like to create your project. It will prompt you for a project name and will create files in a directory by that name (in snake case).
npx @genesisx/create-genesis-workspace
Generators & Plugins
Nx provides a large number of generators and executors that can be used by installing plugins. There are a huge number of communitiy maintained plugins which can be found in the Nx Plugin Directory and officially supported plugins for all major frameworks:
React
Angular
React Native
Genesis Plugins
The goal of the Genesis project is to accelerate development and increase quality by providing templates that encapsulate best practices through generators that can be run against your project. Genesis plugins are installed into the node_modules directory and can be run from the command line or from the Nx console in Visual Studio Code. You can also "eject" a plugin which will convert it into a workspace generator which you can customize as required.
Contributing
Build Commands
To build the CLI run this command in the terminal:
nx run create-genesis-workspace:build
Publish to NPM
To publish the package you must first be logged into NPM (npm login) then run this command from the root of the project.
npm publish dist/libs/create-genesis-workspace --access public