Skip to content

Commit

Permalink
Merge pull request nestjsx#781 from nestjsx/chore/mrepo
Browse files Browse the repository at this point in the history
Chore/mrepo
  • Loading branch information
michaelyali authored Apr 21, 2022
2 parents bbea082 + 7c47407 commit 7ddffa2
Show file tree
Hide file tree
Showing 53 changed files with 6,851 additions and 5,901 deletions.
Empty file added .eslintignore
Empty file.
59 changes: 59 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.eslint.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: ['plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-var-requires': 'off',
'lines-between-class-members': ['error', 'always'],
'padded-blocks': ['error', 'never'],
semi: ['error', 'always'],
quotes: ['error', 'single', { avoidEscape: true }],
'max-len': ['error', { code: 150, comments: 200 }],
'comma-dangle': ['error', 'always-multiline'],
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/member-ordering': [
'error',
{
default: [
'signature',
'public-static-field',
'protected-static-field',
'private-static-field',
'public-instance-field',
'protected-instance-field',
'private-instance-field',
'public-abstract-field',
'protected-abstract-field',
'private-abstract-field',
'public-constructor',
'protected-constructor',
'private-constructor',
'public-static-method',
'protected-static-method',
'private-static-method',
'public-instance-method',
'protected-instance-method',
'private-instance-method',
'public-abstract-method',
'protected-abstract-method',
'private-abstract-method',
],
},
],
},
};
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/Bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: "\U0001F41B Bug Report"
about: "If something isn't working as expected \U0001F914."
title: ''
labels: 'type: potential issue'
assignees: ''
---

## Bug Report

## Current behavior

<!-- Describe how the issue manifests. -->

## Input Code

<!-- REPL or Repo link if applicable: -->

```ts
const your = (code) => here;
```

## Expected behavior

<!-- A clear and concise description of what you expected to happen (or code). -->

## Possible Solution

<!--- Only if you have suggestions on a fix for the bug -->

## Environment

<pre><code>
Package version: X.Y.Z
<!-- Check whether this is still an issue in the most recent package(s) version -->

For Tooling issues:
- Node version: XX <!-- run `node --version` -->
- Platform: <!-- Mac, Linux, Windows -->
- Database <!-- MySQL, Postgres, etc. (with version) -->

Others:
<!-- Anything else relevant? Operating system version, IDE, ... -->
</code></pre>

## Repository with minimal reproduction
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/Feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: "\U0001F680 Feature Request"
about: "I have a suggestion \U0001F63B!"
title: ''
labels: 'type: enhancement'
assignees: ''
---

## Feature Request

## Is your feature request related to a problem? Please describe.

<!-- A clear and concise description of what the problem is. Ex. I have an issue when [...] -->

## Describe the solution you'd like

<!-- A clear and concise description of what you want to happen. Add any considered drawbacks. -->

## Teachability, Documentation, Adoption, Migration Strategy

<!-- If you can, explain how users will be able to use this and possibly write out a version the docs. Maybe a screenshot or design? -->

## What is the motivation / use case for changing the behavior?

<!-- Describe the motivation or the concrete use case. -->
43 changes: 43 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## PR Checklist

Please check if your PR fulfills the following requirements:

- [ ] The commit message was generated by `yarn commit`
- [ ] Tests for the changes have been added (for bug fixes / features)

## PR Type

What kind of change does this PR introduce?

<!-- Please check the one that applies to this PR using "x". -->

```
[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] Tests
[ ] Release
[ ] CI related changes
[ ] Other... Please describe:
```

## What is the current behavior?

<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->

Issue Number: N/A

## What is the new behavior?

## Does this PR introduce a breaking change?

```
[ ] Yes
[ ] No
```

<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->

## Other information
121 changes: 121 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Release

on:
pull_request:
types: [closed]

jobs:
release:
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release')
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: '0'

- name: Set NPM Token
uses: actions/setup-node@v2
with:
registry-url: https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Install
run: yarn boot

- name: Build
run: yarn build

- name: Run Tests
run: yarn test

- name: Get Latest Tag
id: get_latest_tag
uses: actions-ecosystem/action-get-latest-tag@v1

- name: Parse Latest Git Tag
id: parse_latest_tag
run: |
TAG=$(echo ${{ steps.get_latest_tag.outputs.tag }} | cut -d 'v' -f 2)
echo "::set-output name=tag::${TAG}"
- name: Get Next Tag Semver
id: get_next_tag_semver
uses: WyriHaximus/github-action-next-semvers@v1
with:
version: ${{ steps.parse_latest_tag.outputs.tag }}

- name: Define Publishing Strategy
id: lerna_strategy
run: |
MREPO_LERNA_STRATEGY=$(cat lerna.json | npx jase version)
echo "MREPO_LERNA_STRATEGY=${MREPO_LERNA_STRATEGY}" >> $GITHUB_ENV
- name: Define Current Version
run: |
echo ${{ env.MREPO_LERNA_STRATEGY }}
if [ "${{ env.MREPO_LERNA_STRATEGY }}" = "independent" ]; then
CURRENT_VERSION=${{ steps.get_next_tag_semver.outputs.v_minor }}
DIST_TAG=$(cat lerna.json | npx jase distTag)
else
CURRENT_VERSION=$(cat lerna.json | npx jase version)
[[ $CURRENT_VERSION =~ "-" ]] && DIST_TAG=$(echo $CURRENT_VERSION | cut -d '-' -f 2 | cut -d '.' -f 1) || DIST_TAG="latest"
CURRENT_VERSION=v$CURRENT_VERSION
fi
echo $CURRENT_VERSION
echo $DIST_TAG
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
echo "DIST_TAG=${DIST_TAG}" >> $GITHUB_ENV
- name: Ensure Latest Git Tag
uses: mukunku/[email protected]
id: checkTag
with:
tag: ${{ env.CURRENT_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Git Tag
if: steps.checkTag.outputs.exists == 'false'
uses: negz/create-tag@v1
with:
version: ${{ env.CURRENT_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Create Release
if: steps.checkTag.outputs.exists == 'false'
uses: actions/create-release@v1
with:
tag_name: ${{ env.CURRENT_VERSION }}
release_name: ${{ env.CURRENT_VERSION }}
body: |
${{ github.event.pull_request.body }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Packages to NPM Registry
if: steps.checkTag.outputs.exists == 'false'
run: |
lerna publish from-package --no-git-reset --no-verify-access --yes --registry https://registry.npmjs.org --dist-tag ${{ env.DIST_TAG }}
git update-index --assume-unchanged ./packages/**/package.json
env:
GH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create a Comment
uses: actions/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Packages with version [${{ env.CURRENT_VERSION }}](https://github.com/${{ github.repository }}/releases/tag/${{ env.CURRENT_VERSION }}) have been released 🎉'
})
14 changes: 1 addition & 13 deletions .github/workflows/main.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,34 @@
# This is a basic workflow to help you get started with Actions

name: Tests

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [master]
pull_request:
branches: [master]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
test:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
COMPOSE_FILE: ./docker-compose.yml

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Runs a single command using the runners shell
- name: build docker db
run: docker-compose up -d

- name: install
run: yarn bootstrap
run: yarn boot

- name: build
run: yarn build

- name: check docker
run: docker-compose up -d

# Runs a set of commands using the runners shell
- name: tests
run: yarn test:coverage

Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ npm-debug.log
# misc
.DS_Store
lerna-debug.log
/.npmrc
.npmrc
.nvmrc

# tests
/coverage
Expand All @@ -20,3 +21,4 @@ lerna-debug.log
# dist
packages/**/lib
packages/**/tsconfig.tsbuildinfo
.mrepo
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"

yarn lint && yarn format
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"printWidth": 90,
"printWidth": 120,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "always"
Expand Down
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-prefix ""
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
- nestjsx_crud

mysql:
platform: linux/x86_64
image: mysql:5.7
ports:
- 3316:3306
Expand Down
Loading

0 comments on commit 7ddffa2

Please sign in to comment.