Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
neotrow committed Aug 29, 2024
0 parents commit 8e6f7ca
Show file tree
Hide file tree
Showing 19 changed files with 7,684 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.eslintrc.cjs
rollup.config.mjs
107 changes: 107 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
module.exports = {
settings: {},
env: {
node: true,
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:import/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
"plugin:jsdoc/recommended-typescript",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "tsconfig.json",
ecmaVersion: 2018,
sourceType: "module",
},
plugins: ["@typescript-eslint", "import", "jest", "jsdoc"],
settings: {
react: {
version: "detect",
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
typescript: {
alwaysTryTypes: true,
project: ["tsconfig.json"],
},
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
},
ignorePatterns: ["dist", "cypress"],
globals: {},
rules: {
// Enforce double quotes
quotes: [
"error",
"double",
{
avoidEscape: true,
},
],
// Prefer string interpolation
"prefer-template": "error",
"max-lines": [
"error",
{
max: 200,
},
],
complexity: [
"error",
{
max: 12,
},
],
"prefer-destructuring": "error",
"no-empty-function": "error",
"arrow-body-style": ["error", "as-needed"],

"jsdoc/require-jsdoc": [
"warn",
{
publicOnly: false,
require: {
ArrowFunctionExpression: true,
ClassDeclaration: true,
ClassExpression: true,
FunctionDeclaration: true,
FunctionExpression: true,
MethodDefinition: true,
},
contexts: [
"ArrowFunctionExpression",
"FunctionDeclaration",
"FunctionExpression",
"MethodDefinition",
"PropertyDefinition",
"TSDeclareFunction",
"TSEnumDeclaration",
"TSInterfaceDeclaration",
"TSMethodSignature",
"TSPropertySignature",
"TSTypeAliasDeclaration",
],
checkGetters: true,
},
],
},
overrides: [
{
files: ["*.spec.ts"],
rules: {
"jsdoc/require-jsdoc": "off",
},
},
],
};
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @drebrez
90 changes: 90 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: CI

on:
workflow_dispatch:
pull_request:
branches: [main, develop]
types: [opened, synchronize, ready_for_review]

# cancel running actions for current PR if new commits were pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
depandabot-modify-changelog:
if: ${{ github.actor == 'dependabot[bot]' }}
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}

- run: |
insertText="### dependabot: \\\#${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}"
# check if file doesn't contain the text already
if ! grep -q "$insertText" CHANGELOG.md; then
echo "Changelog entry not found, adding it"
sed -i "/## \[Unreleased\]/a \
$insertText" CHANGELOG.md
else
echo "Changelog entry already exists, skipping"
exit 0
fi
- name: initialize mandatory git config
run: |
git config user.name "GitHub Changelog Bot"
git config user.email [email protected]
- run: npx prettier --write CHANGELOG.md

- name: commit and push
run: |
git add CHANGELOG.md
git commit -m "Add changelog entry for ${{ github.event.pull_request.title }}"
git push
check-changelog:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41

- name: Check if changelog was touched
run: |
changelogFound=$(echo ${{ steps.changed-files.outputs.all_changed_files }} | grep -ow "CHANGELOG.md" | wc -w)
if [ $changelogFound -eq 0 ]; then
echo '### :boom: Please update the changelog accordingly (https://keepachangelog.com)' >> $GITHUB_STEP_SUMMARY
exit 1
fi
ci:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"

- run: yarn --frozen-lockfile
- run: yarn prettier-check
- run: yarn lint
- run: yarn build
- run: yarn jest
74 changes: 74 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Create Release

on:
workflow_dispatch:
inputs:
version_type:
type: choice
description: Semantic Version Type
options:
- major
- minor
- patch
- no-version-update

pre_release:
type: choice
description: Pre Rlease?
options:
- stable
- alpha
- beta
- rc

jobs:
release-it:
runs-on: ubuntu-latest
steps:
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.RELEASE_BOT_APP_ID }}
private_key: ${{ secrets.RELEASE_BOT_APP_PRIVATE_KEY }}

- name: checkout
uses: actions/checkout@v3
with:
token: ${{ steps.generate-token.outputs.token }}
# we need everything so release-it can compare the current version with the latest tag
fetch-depth: 0

- name: initialize mandatory git config
run: |
git config user.name "GitHub Release Bot"
git config user.email [email protected]
- name: install yarn packages
run: |
yarn --frozen-lockfile
- name: set NPM Token
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN_NEOLUTION }}

- name: run release-it
run: |
params=()
if [[ ${{ github.event.inputs.version_type }} != "no-version-update" ]]; then
params+=(${{ github.event.inputs.version_type }})
fi
if [[ ${{ github.event.inputs.pre_release }} != "stable" ]]; then
params+=(--preRelease=${{ github.event.inputs.pre_release }})
params+=(--plugins.@release-it/keep-a-changelog.keepUnreleased)
params+=(--no-plugins.@release-it/keep-a-changelog.strictLatest)
fi
params+=(--ci)
yarn release-it "${params[@]}"
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
14 changes: 14 additions & 0 deletions .github/workflows/notify-slack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Notify Slack Channel

on:
release:
types: [published]

jobs:
notify:
runs-on: ubuntu-latest
steps:
- uses: neolution-ch/action-release-notifier@v1
with:
slack-token: ${{ secrets.SLACK_RELEASE_NOTIFIER_TOKEN }}
slack-channel-ids: ${{ vars.SLACK_CHANNEL_ID_RELEASE_ANNOUNCEMENTS }}
24 changes: 24 additions & 0 deletions .github/workflows/pkg.pr.new.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: pkg.pr.new publish
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, ready_for_review]
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20

- run: yarn --frozen-lockfile

- run: npx pkg-pr-new publish
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
node_modules

# builds
build
dist
.rpt2_cache

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Optional eslint cache
.eslintcache

coverage

storybook-static
.terraform
terraform

.npmrc
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ignore artifacts
dist
node_modules
storybook-static
.next
6 changes: 6 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# reference: https://prettier.io/docs/en/options.html
printWidth: 140
useTabs: false
tabWidth: 2
endOfLine: auto
trailingComma: all
23 changes: 23 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"git": {
"push": true
},
"npm": {
"publish": true,
"skipChecks": true
},
"github": {
"release": true
},
"plugins": {
"@release-it/keep-a-changelog": {
"filename": "CHANGELOG.md",
"addVersionUrl": true,
"addUnreleased": true,
"strictLatest": false
}
},
"hooks": {
"before:git:release": "yarn prettier --write CHANGELOG.md && git add CHANGELOG.md"
}
}
Loading

0 comments on commit 8e6f7ca

Please sign in to comment.