Skip to content

Commit 3fdea56

Browse files
committed
feat: initial commit
setup the repo with graasp-starter-ts-vite
0 parents  commit 3fdea56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+16493
-0
lines changed

.eslintignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
build
2+
public
3+
coverage
4+
5+
node_modules
6+
.yarn/.cache
7+
.husky
8+
.nyc_output
9+
.yarn
10+
commitlint.config.js

.eslintrc

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"extends": [
3+
"airbnb",
4+
"plugin:import/typescript", // this is needed because airbnb uses eslint-plugin-import
5+
"prettier",
6+
"plugin:cypress/recommended",
7+
"plugin:react/recommended",
8+
"plugin:react-hooks/recommended",
9+
"plugin:@typescript-eslint/recommended"
10+
],
11+
"plugins": ["@typescript-eslint", "prettier", "react-hooks"],
12+
"env": {
13+
"browser": true,
14+
"node": true,
15+
"mocha": true,
16+
"jest": true
17+
},
18+
"globals": {
19+
"cy": true,
20+
"Cypress": true
21+
},
22+
"parser": "@typescript-eslint/parser",
23+
"parserOptions": {
24+
"ecmaFeatures": {
25+
"jsx": true
26+
},
27+
"ecmaVersion": "latest",
28+
"sourceType": "module"
29+
},
30+
"rules": {
31+
"react/no-array-index-key": "off",
32+
"react/jsx-props-no-spreading": "off",
33+
"react/destructuring-assignment": "off",
34+
"react/require-default-props": "off",
35+
"react/react-in-jsx-scope": "off",
36+
"@typescript-eslint/ban-ts-comment": "off",
37+
"import/no-import-module-exports": "off",
38+
"import/no-extraneous-dependencies": [
39+
"error",
40+
{
41+
"devDependencies": true
42+
}
43+
],
44+
"import/prefer-default-export": "off",
45+
"prettier/prettier": "error",
46+
"import/extensions": [
47+
"error",
48+
"ignorePackages",
49+
{
50+
"ts": "never",
51+
"js": "never",
52+
"tsx": "never"
53+
}
54+
],
55+
"@typescript-eslint/explicit-function-return-type": [
56+
"error",
57+
{
58+
"allowExpressions": true
59+
}
60+
],
61+
"@typescript-eslint/no-var-requires": "off",
62+
"global-require": "off",
63+
"react-hooks/rules-of-hooks": "error",
64+
"react-hooks/exhaustive-deps": "warn",
65+
"comma-dangle": "off",
66+
"@typescript-eslint/comma-dangle": "off",
67+
"react/jsx-one-expression-per-line": "off",
68+
"react/jsx-filename-extension": [
69+
"warn",
70+
{
71+
"extensions": [".tsx"]
72+
}
73+
],
74+
"react/function-component-definition": [
75+
2,
76+
{
77+
"namedComponents": "arrow-function"
78+
}
79+
],
80+
// eslint rule reports false error
81+
"no-shadow": "off",
82+
"@typescript-eslint/no-shadow": ["error"]
83+
},
84+
"settings": {
85+
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
86+
"import/parsers": {
87+
"@typescript-eslint/parser": [".ts", ".tsx"]
88+
},
89+
"import/resolver": {
90+
"typescript": {
91+
"alwaysTryTypes": true
92+
},
93+
"node": {
94+
"extensions": [".js", ".jsx", ".ts", ".tsx"]
95+
}
96+
}
97+
}
98+
}

.github/workflows/auto-tag.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Auto Tag
2+
3+
on:
4+
issues:
5+
types:
6+
- reopened
7+
- closed
8+
pull_request:
9+
types:
10+
- closed
11+
12+
jobs:
13+
auto-tag:
14+
name: Auto tag issues and PRs
15+
uses: graasp/graasp-deploy/.github/workflows/auto-tag.yml@v1

.github/workflows/cypress.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: cypress tests
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'release-please-**'
7+
8+
jobs:
9+
cypress-run:
10+
concurrency: cypress-${{ github.head_ref || github.ref }}
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: checkout
14+
uses: actions/checkout@v3
15+
16+
- name: set up node
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '16'
20+
21+
- name: Yarn Install and Cache
22+
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1
23+
with:
24+
cypress: true
25+
26+
- name: cypress run
27+
uses: cypress-io/github-action@v5
28+
env:
29+
VITE_PORT: 3000
30+
VITE_API_HOST: http://localhost:3636
31+
VITE_GRAASP_APP_ID: id-1234567890
32+
VITE_MOCK_API: true
33+
VITE_VERSION: cypress-tests
34+
with:
35+
install: false
36+
build: yarn build
37+
config: baseUrl=http://localhost:3000
38+
start: yarn dev
39+
browser: chrome
40+
quiet: true
41+
# point to new cypress@10 config file
42+
config-file: cypress.config.ts
43+
44+
# - name: Run Component tests 🧪
45+
# uses: cypress-io/github-action@v5
46+
# with:
47+
# # we have already installed everything
48+
# install: false
49+
# # to run component tests we need to use "component: true"
50+
# component: true
51+
52+
- uses: actions/upload-artifact@v3
53+
if: failure()
54+
with:
55+
name: cypress-screenshots
56+
path: cypress/screenshots
57+
58+
- name: coverage report
59+
run: npx nyc report --reporter=text-summary
60+
61+
- name: coverage commit status
62+
run: |
63+
total=$(cat coverage/coverage-summary.json | jq .total.lines.pct)
64+
echo Total coverage ${total}
65+
curl -S -s \
66+
-X POST \
67+
-H "Accept: application/vnd.github+json" \
68+
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
69+
https://api.github.com/repos/${REPO_PATH}/statuses/${COMMIT_SHA} \
70+
-d "{\"state\":\"success\",\"target_url\":\"https://github.com/${REPO_PATH}/actions/runs/${RUN_ID}\",\"description\":\"${total}%\",\"context\":\"code-coverage\"}"
71+
env:
72+
GITHUB_TOKEN: ${{ github.token }}
73+
REPO_PATH: ${{ github.repository }}
74+
COMMIT_SHA: ${{ github.sha }}
75+
RUN_ID: ${{ github.run_id }}

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
/.nyc_output
11+
12+
# production
13+
/build
14+
15+
# misc
16+
.DS_Store
17+
18+
# env files
19+
.env.*
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
25+
# yarn
26+
.yarn/*
27+
!.yarn/patches
28+
!.yarn/plugins
29+
!.yarn/releases
30+
!.yarn/sdks
31+
!.yarn/versions
32+
yarn-error.log*
33+
yarn-debug.log*
34+
35+
# editor files
36+
/.idea
37+
/.vscode
38+
39+
# cypress
40+
cypress/screenshots/
41+
cypress/videos/
42+
cypress/downloads/

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn commitlint --edit ${1}

.husky/post-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
git status

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn pretty-quick --staged && yarn lint && yarn test

.husky/pre-push

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn lint && yarn build

.prettierrc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"trailingComma": "all",
3+
"tabWidth": 2,
4+
"semi": true,
5+
"singleQuote": true,
6+
"importOrder": [
7+
"^react",
8+
"^@?mui",
9+
"^@?graasp",
10+
"<THIRD_PARTY_MODULES>",
11+
"^@/",
12+
"^[./]"
13+
],
14+
"importOrderSeparation": true,
15+
"importOrderSortSpecifiers": true
16+
}

0 commit comments

Comments
 (0)