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

Added more things in template from CRA-boiler-plate #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[{package,bower}.json]
indent_style = space
indent_size = 2

[{.eslintrc,.scss-lint.yml}]
indent_style = space
indent_size = 2

[*.{scss,sass}]
indent_style = space
indent_size = 2
25 changes: 25 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## React Boilerplate CRA Template

### ⚠️ Clear this template before you submit (after you read the things below)

Thank you for contributing! Please take a moment to review our [**contributing guidelines**](https://github.com/react-boilerplate/react-boilerplate/blob/master/CONTRIBUTING.md)
to make the process easy and effective for everyone involved.

**Please open an issue** before embarking on any significant pull request, especially those that
add a new library or change existing tests, otherwise you risk spending a lot of time working
on something that might not end up being merged into the project.

Before opening a pull request, please ensure:

- [ ] You have followed our [**contributing guidelines**](https://github.com/react-boilerplate/react-boilerplate/blob/master/CONTRIBUTING.md)
- [ ] Double-check your branch is based on `dev` and targets `dev`
- [ ] Pull request has tests (we are going for 100% coverage!)
- [ ] Code is well-commented, linted and follows project conventions
- [ ] Documentation is updated (if necessary)
- [ ] Internal code generators and templates are updated (if necessary)
- [ ] Description explains the issue/use-case resolved and auto-closes related issues

Be kind to code reviewers, please try to keep pull requests as small and focused as possible :)

**IMPORTANT**: By submitting a patch, you agree to allow the project
owners to license your work under the terms of the [MIT License](https://github.com/react-boilerplate/react-boilerplate/blob/master/LICENSE.md).
69 changes: 69 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: build

on:
- push
- pull_request
- workflow_dispatch

jobs:
createNpmPackage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- run: yarn add shelljs
- run: yarn run create:npm-package
- name: Upload template
uses: actions/upload-artifact@v1
with:
name: cra-template-rb
path: .cra-template-rb

createAndTestCRA:
needs: createNpmPackage
runs-on: ubuntu-latest
steps:
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Download template
uses: actions/download-artifact@v1
with:
name: cra-template-rb
path: ../cra-template-rb # Put into the upper folder. create-react-app wants the current directory empty
- name: Create CRA from downloaded template
run: yarn create react-app --template file:../cra-template-rb .
- run: yarn run build
- run: yarn run test:generators
- run: yarn run lint
- run: yarn run checkTs
- run: yarn run test
- run: yarn run cleanAndSetup
- run: yarn run build
- run: yarn run test:generators
- run: yarn run lint
- run: yarn run checkTs
createCRAWithMultipleNodeVersions:
needs: createNpmPackage
strategy:
matrix:
node-version: [14.x, 18.x]
runs-on: ubuntu-latest
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Download template
uses: actions/download-artifact@v1
with:
name: cra-template-rb
path: ../cra-template-rb # Put into the upper folder. create-react-app wants the current directory empty
- name: Create CRA from downloaded template
run: yarn create react-app --template file:../cra-template-rb .
- run: yarn run build
- run: yarn run test
25 changes: 0 additions & 25 deletions .github/workflows/code_validation.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Run commitlint on Pull Requests and commits
name: commitlint
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']
push:
branches:
- master
- dev

jobs:
lint-pull-request-name:
# Only on pull requests
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: yarn add @commitlint/config-conventional
- uses: JulienKode/[email protected]
lint-commits:
# Only if we are pushing or merging PR to the master
if: (github.event_name == 'pull_request' && github.base_ref == 'refs/heads/master') || github.event_name == 'push'
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 30 # Its fine to lint last 30 commits only
- run: yarn add @commitlint/config-conventional
- uses: wagoid/commitlint-github-action@v1
11 changes: 11 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: lint
on:
- push
- pull_request
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn --frozen-lockfile
- run: yarn run lint
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: release

on:
release:
types:
- created
workflow_dispatch:

jobs:
createAndTestCRAFromNpm:
strategy:
matrix:
node-version: [16.x, 18.x]

runs-on: ubuntu-latest
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Create CRA from npm template
run: yarn create react-app --template cra-template-rb .
- run: yarn run build
- run: yarn run test:generators
- run: yarn run lint
- run: yarn run checkTs
- run: yarn run cleanAndSetup
- run: yarn run build
- run: yarn run test:generators
- run: yarn run lint
- run: yarn run checkTs
31 changes: 31 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: test
on:
- push
- pull_request
- workflow_dispatch

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- run: yarn --frozen-lockfile
- run: yarn run test:coverage
- name: Upload to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
testInternals:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- run: yarn --frozen-lockfile
- run: yarn run test:internals
6 changes: 6 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

if yarn git-branch-is dev;
then yarn commitlint --edit $1;
fi
8 changes: 5 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
yarn checkTs
yarn lint-staged
yarn verify-startingTemplate-changes
4 changes: 4 additions & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn devmoji -e
6 changes: 5 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"trailingComma": "all",
"arrowParens": "avoid"
}
35 changes: 35 additions & 0 deletions .versionrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const internalSection = `Internals`;
/*
* Used for creating CHANGELOG.md automatically.
* Anything under the internalSection should be boilerplate internals
* and shouldn't interest the end users, meaning that the template shouldn't be effected.
*/

// Check the descriptions of the types -> https://github.com/commitizen/conventional-commit-types/blob/master/index.json
module.exports = {
types: [
{ type: 'feat', section: 'Features', hidden: false },
{ type: 'fix', section: 'Bug Fixes', hidden: false },
{ type: 'docs', section: 'Documentation', hidden: false },
{ type: 'perf', section: 'Performance Updates', hidden: false },

// Other changes that don't modify src or test files
{ type: 'chore', section: internalSection, hidden: false },

// Adding missing tests or correcting existing tests
{ type: 'test', section: internalSection, hidden: false },

// Changes to our CI configuration files and scripts
{ type: 'ci', section: internalSection, hidden: false },

// A code change that neither fixes a bug nor adds a feature
{ type: 'refactor', section: internalSection, hidden: false },

// Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
{ type: 'style', section: internalSection, hidden: false },
],
skip: {
changelog: true,
},
commitAll: true,
};
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"orta.vscode-jest"
]
}
Loading