Skip to content

Commit

Permalink
Initial version (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospassos authored May 7, 2024
1 parent d011032 commit 9988ad5
Show file tree
Hide file tree
Showing 49 changed files with 18,072 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: "2"
checks:
argument-count:
config:
threshold: 4
complex-logic:
config:
threshold: 4
file-lines:
config:
threshold: 500
method-complexity:
config:
threshold: 5
method-count:
config:
threshold: 30
method-lines:
config:
threshold: 100
nested-control-flow:
config:
threshold: 4
return-statements:
config:
threshold: 4
identical-code:
config:
threshold: 80
similar-code:
enabled: false
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build/
dist/
node_modules/
.snapshots/
*.min.js
25 changes: 25 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-patch/modern-module-resolution');

module.exports = {
root: true,
plugins: ['@croct'],
extends: [
'plugin:@croct/react',
'plugin:@croct/typescript',
],
parserOptions: {
project: ['./tsconfig.json'],
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
version: 'detect',
},
jest: {
version: 'detect',
},
},
};
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: "🐞 Bug report"
about: "Create a report to help us improve"
labels: bug
---

## 🐞 Bug report
Please describe the problem you are experiencing.

### Steps to reproduce
Please provide a minimal code snippet and the detailed steps for reproducing the issue.

1. Step 1
2. Step 2
3. Step 3

### Expected behavior
Please describe the behavior you are expecting.

### Screenshots
If applicable, add screenshots to help explain your problem.

### Additional context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: "✨ Feature request"
about: "Suggest an idea for this project"
labels: enhancement
---

## ✨ Feature request
Please provide a brief explanation of the feature.

### Motivation
Please share the motivation for the new feature, and what problem it is solving.

### Example
If the proposal involves a new or changed API, please include a basic code example.

### Alternatives
Please describe the alternative solutions or features you've considered.

### Additional context
Please provide any other context or screenshots about the feature request here.
18 changes: 18 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Summary
Please include a summary of the change and which issue is addressed.

- Fixes #(issue 1)
- Fixes #(issue 2)
- Fixes #(issue 3)

### Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
- [ ] I have checked my code and corrected any misspellings
34 changes: 34 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name-template: '$NEXT_PATCH_VERSION'
tag-template: '$NEXT_PATCH_VERSION'
prerelease: true
categories:
- title: '🚀 Features'
labels:
- feature
- title: '🔧 Enhancements'
labels:
- enhancement
- title: '🐞 Bug Fixes'
labels:
- bug
- title: '🚧 Maintenance'
labels:
- maintenance
change-template: '- $TITLE (#$NUMBER), thanks [$AUTHOR](https://github.com/$AUTHOR)!'
sort-by: merged_at
sort-direction: descending
branches:
- master
exclude-labels:
- wontfix
- duplicate
- invalid
- question
no-changes-template: 'This release contains minor changes and bugfixes.'
template: |-
## What's Changed
$CHANGES
🎉 **Thanks to all contributors helping with this release:**
$CONTRIBUTORS
111 changes: 111 additions & 0 deletions .github/workflows/branch-validations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Validations

on:
push:
tags-ignore:
- '**'
branches:
- master
pull_request:
types:
- synchronize
- opened

jobs:
security-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20

- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v3
with:
path: node_modules
key: node_modules-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: npm ci

- name: Check dependency vulnerabilities
run: |-
npm audit --omit=dev
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20

- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v3
with:
path: node_modules
key: node_modules-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: npm ci

- name: Check compilation errors
run: npm run validate

lint:
runs-on: ubuntu-latest
needs:
- validate
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20

- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v3
with:
path: node_modules
key: node_modules-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: npm ci

- name: Check coding standard violations
run: npm run lint

test:
runs-on: ubuntu-latest
needs:
- validate
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20

- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v3
with:
path: node_modules
key: node_modules-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: npm ci

- uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: npm test
coverageLocations:
./coverage/lcov.info:lcov
19 changes: 19 additions & 0 deletions .github/workflows/check-required-labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Label requirements
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled

jobs:
check-labels:
name: Check labels
runs-on: ubuntu-latest
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
with:
any_of: maintenance,feature,bug,enhancement
repo_token: ${{ secrets.GITHUB_TOKEN }}
59 changes: 59 additions & 0 deletions .github/workflows/deploy-published-releases.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Release

on:
release:
types:
- published

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20

- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v3
with:
path: node_modules
key: node_modules-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |-
npm ci
rm -rf ~/.npmrc
- name: Build package
run: npm run build

- name: Prepare release
run: |-
cp package.json LICENSE README.md build/
cd build
find . -type f -path '*/*\.js.map' -exec sed -i -e "s~../src~src~" {} +
sed -i -e "s~\"version\": \"0.0.0-dev\"~\"version\": \"${GITHUB_REF##*/}\"~" package.json
sed -i -e "s~\./build~.~" package.json
sed -i -e "s~./src~.~" package.json
cp -r ../src src
- name: Publish pre-release to NPM
if: ${{ github.event.release.prerelease }}
run: |-
cd build
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
npm publish --access public --tag next
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish release to NPM
if: ${{ !github.event.release.prerelease }}
run: |-
cd build
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Release Drafter

on:
push:
branches:
- master
tags-ignore:
- '**'

jobs:
release-draft:
runs-on: ubuntu-latest
steps:
- name: Update release draft
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coverage/
node_modules/
build/
Loading

0 comments on commit 9988ad5

Please sign in to comment.