Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/misc 20240822 #7

Merged
merged 19 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 0 additions & 62 deletions .github/workflows/shipjs-manual-prepare.yml

This file was deleted.

11 changes: 3 additions & 8 deletions .github/workflows/shipjs-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,14 @@ jobs:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/v')
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
registry-url: "https://registry.npmjs.org"
- run: |
if [ -f "yarn.lock" ]; then
yarn install
else
npm install
fi
- run: npm ci
- run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**/.env
!**/.env.example
coverage
node_modules
**/package-lock.json
54 changes: 12 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
# Yeoman generator for library
# Yeoman 12deg-library generator

This yeoman generator helps set up a library (monorepo).
This yeoman generator helps set up a library. The library is designed as a monorepo that is expected to contain several independent but related packages.

The generator includes a child generator that helps generate a Fastify plugin as one such package in the library.

## Generators
- **app**: sets up a new monorepo
- **fastify-plugin**: sets up a fastify plugin within the monorepo
- **app**: sets up a new library as a 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
```
- [yo](https://github.com/yeoman/yo)

## Installation
1. Clone this repo locally and navigate to the project directory and install dependencies:
To install `yo` globally, run:

```bash
make install
```

2. Link this generator locally so that the `yo` command can recognize it:

```bash
npm link
npm install -g yo
```

## Usage
Expand All @@ -35,34 +23,16 @@ npm link
Run the following command and follow the prompts to generate your monorepo setup:

```bash
yo library
yo 12deg-library
```

This command will create a directory with the name you provide as `Package name`. Navigate to this directory:

```bash
cd <Package name>
```

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
```
This command will create a directory with the name you provide as `Package name`.

### Generate a fastify plugin only (experimental)
To generate only the fastify plugin, use:

```bash
yo library:fastify-plugin
yo 12deg-library:fastify-plugin
```

This will create the fastify plugin setup without the rest of the monorepo structure.
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default [
...tseslint.configs.recommended,
{
ignores: [
"**/.giignore",
"**/.gitignore",
"**/templates",
"coverage",
"eslint.config.js",
Expand Down
1 change: 0 additions & 1 deletion generators/app/templates/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
GITHUB_TOKEN=SECRET
NPM_TOKEN=SECRET
6 changes: 3 additions & 3 deletions generators/app/templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
"@commitlint/config-conventional": "19.2.2",
"@types/node": "22.4.0",
"husky": "9.1.4",
"shipjs": "0.26.3",
"shipjs": "0.26.4",
"turbo": "2.0.14",
"typescript": "5.5.4"
},
"packageManager": "pnpm@8.10.5",
"packageManager": "pnpm@9.7.1",
"engines": {
"node": ">=16",
"node": ">=20 <22",
"pnpm": ">=8"
}
}
4 changes: 2 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ outdated:

publish:
@printf "\033[0;32m>>> Publish packages\033[0m\n"
shipjs trigger
npx shipjs trigger

release:
@printf "\033[0;32m>>> Prepare packages for release\033[0m\n"
shipjs prepare
npx shipjs prepare

sort-package:
@printf "\033[0;32m>>> Format package.json\033[0m\n"
Expand Down
Loading