diff --git a/README.md b/README.md new file mode 100644 index 0000000..47038f7 --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ +# Yeoman generator for library + +This yeoman generator helps set up a library (monorepo). + +## Generators + - **app**: sets up a new monorepo + - **fastify-plugin**: sets up a fastify plugin within the monorepo + +## Requirements + - [yo](https://github.com/yeoman/yo) + - [shipjs](https://github.com/algolia/shipjs) (optional, for deployment purposes) + +To install `shipjs` and `yo` globally, run: + +```bash +npm install -g shipjs yo +``` + +## Installation +1. Clone this repo locally and navigate to the project directory and install dependencies: + +```bash +make install +``` + +2. Link this generator locally so that the `yo` command can recognize it: + +```bash +npm link +``` + +## Usage + +### Generate the monorepo +Run the following command and follow the prompts to generate your monorepo setup: + +```bash +yo library +``` + +This command will create a directory with the name you provide as `Package name`. Navigate to this directory: + +```bash +cd +``` + +This command install the required dependencies and create a `pnpm-lock.yaml` file: + +```bash +make install +``` + +### Initialize git repository + +Initialize a Git repository in your new project directory: + +```bash +git init +``` + +### Generate a fastify plugin only (experimental) +To generate only the fastify plugin, use: + +```bash +yo library:fastify-plugin +``` + +This will create the fastify plugin setup without the rest of the monorepo structure. diff --git a/makefile b/makefile index 451fd4b..0065f5c 100644 --- a/makefile +++ b/makefile @@ -7,11 +7,11 @@ install: lint: @printf "\033[0;32m>>> Lint code\033[0m\n" - npm lint + npm run lint lint.fix: @printf "\033[0;32m>>> Lint code\033[0m\n" - npm lint:fix + npm run lint:fix outdated: @printf "\033[0;32m>>> Check for outdated dependencies\033[0m\n" @@ -27,8 +27,4 @@ release: sort-package: @printf "\033[0;32m>>> Format package.json\033[0m\n" - npm sort-package - -typecheck: - @printf "\033[0;32m>>> Running Type check\033[0m\n" - npm typecheck + npm run sort-package diff --git a/package.json b/package.json index 3f5493e..6dab516 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "generator-package-monorepo", + "name": "generator-library", "version": "0.1.0", "description": "", "keywords": [ @@ -7,10 +7,10 @@ "yeoman-generator" ], "homepage": "", - "repository": "generator-package-monorepo", + "repository": "generator-library", "license": "MIT", "author": { - "name": "12 Degres SAS", + "name": "12 Degree SAS", "email": "info@12deg.com", "url": "https://12deg.com" }, diff --git a/ship.config.cjs b/ship.config.cjs index 7d1c473..20396e4 100644 --- a/ship.config.cjs +++ b/ship.config.cjs @@ -1,5 +1,5 @@ module.exports = { - appname: "@dzangolab/generator-package-monorepo", + appname: "@dzangolab/generator-library", buildCommand: () => null, publishCommand: () => { return "npm publish --access public";