Skip to content

Commit

Permalink
feat: initialise repository
Browse files Browse the repository at this point in the history
  • Loading branch information
rozsival committed Oct 26, 2023
0 parents commit 81e9f28
Show file tree
Hide file tree
Showing 61 changed files with 5,780 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: ['@apitree'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
};
147 changes: 147 additions & 0 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: QA

on:
push:
branches:
- '*'
pull_request:
branches:
- develop
- main

env:
CACHE_KEY: ${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt }}
CACHE_PATH: ./*

jobs:
setup:
runs-on: ubuntu-latest
env:
ACCESS_TOKEN_SECRET: ${{ secrets.TEST_ACCESS_TOKEN_SECRET }}
REFRESH_TOKEN_SECRET: ${{ secrets.TEST_REFRESH_TOKEN_SECRET }}
SESSION_SECRET: ${{ secrets.TEST_SESSION_SECRET }}
TOKEN_AUTHORITY: ${{ secrets.TEST_TOKEN_AUTHORITY }}
strategy:
matrix:
node-version:
- 20.9.0
pnpm-version:
- 8.9.2
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm v${{ matrix.pnpm-version }}
uses: pnpm/action-setup@v2
with:
version: ${{ matrix.pnpm-version }}
- name: Setup node.js v${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: pnpm
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: pnpm install
- name: Cache setup
uses: actions/cache@v3
id: cache-setup
with:
key: ${{ env.CACHE_KEY }}
path: ${{ env.CACHE_PATH }}
- name: Set node-version
id: set-node-version
run: echo "node-version=${{ matrix.node-version }}" >> $GITHUB_OUTPUT
- name: Set pnpm-version
id: set-pnpm-version
run: echo "pnpm-version={{ matrix.pnpm-version }}" >> $GITHUB_OUTPUT
commitlint:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: ${{ needs.setup.outputs.pnpm-version }}
- name: Setup node.js
uses: actions/setup-node@v3
with:
cache: pnpm
node-version: ${{ needs.setup.outputs.node-version }}
- name: Restore setup
uses: actions/cache@v3
id: restore-setup
with:
key: ${{ env.CACHE_KEY }}
path: ${{ env.CACHE_PATH }}
- name: Run commitlint
run: pnpm commitlint --from=${{ github.sha }}
eslint:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: ${{ needs.setup.outputs.pnpm-version }}
- name: Setup node.js
uses: actions/setup-node@v3
with:
cache: pnpm
node-version: ${{ needs.setup.outputs.node-version }}
- name: Restore setup
uses: actions/cache@v3
id: restore-setup
with:
key: ${{ env.CACHE_KEY }}
path: ${{ env.CACHE_PATH }}
- name: Run eslint
run: pnpm run lint
tsc:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: ${{ needs.setup.outputs.pnpm-version }}
- name: Setup node.js
uses: actions/setup-node@v3
with:
cache: pnpm
node-version: ${{ needs.setup.outputs.node-version }}
- name: Restore setup
uses: actions/cache@v3
id: restore-setup
with:
key: ${{ env.CACHE_KEY }}
path: ${{ env.CACHE_PATH }}
- name: Run tsc
run: pnpm run ts
prettier:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: ${{ needs.setup.outputs.pnpm-version }}
- name: Setup node.js
uses: actions/setup-node@v3
with:
cache: pnpm
node-version: ${{ needs.setup.outputs.node-version }}
- name: Restore setup
uses: actions/cache@v3
id: restore-setup
with:
key: ${{ env.CACHE_KEY }}
path: ${{ env.CACHE_PATH }}
- name: Run prettier
run: pnpm run format
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# IDE
.idea
.vscode
.history

# Dependencies
node_modules

# Temporary files
*.log
.eslintcache
.turbo
tsconfig.tsbuildinfo
tsconfig.build.tsbuildinfo

# Builds
/packages/*/dist
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm lint-staged
4 changes: 4 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
auto-install-peers=true
enable-pre-post-scripts=true
strict-peer-deps=true
use-node-version=20.9.0
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea
.vscode
node_modules
pnpm-lock.yaml
70 changes: 70 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Contribution Guidelines

Please follow the contribution process outlined below.

## Contribution Process

We use [GitHub](https://github.com/ApiTreeCZ/toolbox) for version control and issue tracking. Here's a
step-by-step guide on how to contribute:

### 1. Create a Feature Branch

To work on a new feature or fix, create a new branch from the `develop` branch. Name your branch descriptively.

```bash
git checkout -b feature/my-feature
```

### 2. Committing Your Changes

Please follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard when making commits.
This will help with automated versioning and changelogs.

Additionally, we use [Changesets](https://github.com/atlassian/changesets) to manage the release process. Be sure to
document your changes accordingly.

### 3. Open a Pull Request

When your work is ready for review, push your branch to the main repository and open a Pull Request (PR).

- Assign the PR to the appropriate reviewers.
- Provide a clear and concise description of your changes.
- Reference any issues that the MR addresses.

### 4. Review and Approval

Reviewers will assess your PR for code quality, adherence to coding standards, and functional correctness. They may
request changes or provide feedback. Make necessary adjustments to address these comments.

### 5. Merge to `develop`

Once your MR is approved, a maintainer will merge it into the `develop` branch.

## Conventional Commits and Changesets

We use Conventional Commits and Changesets to keep our changelogs accurate and to facilitate version management. Commit
messages should follow the format:

```
<type>(<scope>): <message>
```

- `<type>`: Describes the purpose of the commit (e.g., `feat`, `fix`, `chore`).
- `<scope>`: Specifies the component or area of the code affected by the change.
- `<message>`: Provides a concise description of the change.

Please, briefly describe changes, enhancements, and fixes with this commit format.

Changesets are used to group changes into releases. When creating a Changeset, include a summary of the changes, a list
of PRs, and any breaking changes. This is critical for generating accurate changelogs.

## Code Style

Please adhere to our coding style guidelines, which are controlled by `eslint` and `prettier`. Ensure
that your code follows the established patterns and conventions described and used in each package.

## Reporting Issues

If you encounter any issues or have suggestions for improvement, please use
the [GitHub issue tracker](https://github.com/ApiTreeCZ/toolbox/issues) to report them. Be
as descriptive as possible and follow the issue template to provide the necessary details.
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<div align="center">

# ApiTree Toolbox

### Shared configurations and utilities for ApiTree projects

Powered by [Turbo](https://turbo.build/repo/docs)

</div>

## Getting Started

### Prerequisites

- node.js `>=20`
- pnpm `>=8`

> **Note:** This repository contains [pure ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) packages.
### Installation

```bash
git clone [email protected]:ApiTreeCZ/toolbox.git
cd toolbox
pnpm install
```

### Workspaces

This monorepo is structured as follows:

- `packages/`
- `eslint-config/`: Contains the ESLint configurations.
- `prettier-config/`: Contains the Prettier configuration .
- `ts-config/`: Contains the TypeScript configurations.

## Authors

- Vít Rozsíval ([[email protected]](mailto:[email protected]))

## Versioning

We use [SemVer](http://semver.org/) for versioning. For the versions available, see
the [tags on this repository](https://gitlab.tools.eon.cz/ece/selfcare-2/sc20-ui-kit/-/tags).

## Contributing

Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull
requests.
3 changes: 3 additions & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: '@commitlint/config-conventional',
};
4 changes: 4 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
'./*.{cjs,js}': 'eslint --cache --fix',
'./*.{json,md}': 'prettier --write',
};
63 changes: 63 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "apitree-toolbox",
"version": "0.0.0",
"private": true,
"description": "Shared configuration and utilities for ApiTree projects.",
"repository": {
"type": "git",
"url": "https://github.com/ApiTreeCZ/toolbox"
},
"license": "MIT",
"author": "ApiTree <[email protected]>",
"contributors": [
"Vít Rozsíval <[email protected]"
],
"type": "module",
"workspaces": [
"./packages/*"
],
"scripts": {
"build": "turbo run build",
"cleanup": "turbo run cleanup",
"postcleanup": "rimraf .eslintcache node_modules",
"fix": "turbo run fix",
"postfix": "run-p postformat:fix postlint:fix",
"format": "turbo run format --parallel",
"postformat": "prettier --check \"./*.{json,md,yaml}\" \".github/**/*.yaml\"",
"format:fix": "turbo run format:fix --parallel",
"postformat:fix": "pnpm run postformat --write",
"lint": "turbo run lint",
"postlint": "eslint --cache \"./*.{cjs,js}\"",
"lint:fix": "turbo run lint:fix",
"postlint:fix": "pnpm run postlint --fix",
"prepare": "is-ci || run-p prepare:husky build",
"prepare:husky": "husky install",
"postinstall": "check-dependency-version-consistency .",
"qa": "turbo run qa",
"postqa": "run-p postlint postformat",
"test": "turbo run test",
"ts": "turbo run ts"
},
"devDependencies": {
"@apitree/eslint-config": "workspace:*",
"@apitree/prettier-config": "workspace:*",
"@apitree/ts-config": "workspace:*",
"@commitlint/cli": "^18.2.0",
"@commitlint/config-conventional": "^18.1.0",
"@types/node": "^20.8.9",
"check-dependency-version-consistency": "^4.1.0",
"eslint": "^8.52.0",
"husky": "^8.0.3",
"is-ci": "^3.0.1",
"lint-staged": "^15.0.2",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.3",
"rimraf": "^5.0.5",
"turbo": "^1.10.16",
"typescript": "^5.2.2"
},
"packageManager": "[email protected]",
"engines": {
"node": ">=20"
}
}
Loading

0 comments on commit 81e9f28

Please sign in to comment.