Skip to content

Commit a0cc50b

Browse files
committed
Initial commit
0 parents  commit a0cc50b

File tree

283 files changed

+38839
-0
lines changed

Some content is hidden

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

283 files changed

+38839
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// If you want to run as a non-root user in the container, see ../docker-compose.yml.
2+
{
3+
"name": "Node.js & Postgres",
4+
"dockerComposeFile": "../docker-compose.yml",
5+
"service": "dev", // attaches to this service after docker-compose up `runServices`
6+
"workspaceFolder": "/work",
7+
8+
// Use 'settings' to set *default* container specific settings.json values on container create.
9+
// You can edit these settings after create using File > Preferences > Settings > Remote.
10+
"settings": {
11+
"terminal.integrated.shell.linux": "/bin/bash"
12+
},
13+
14+
// Uncomment the next line if you want start specific services in your Docker Compose config.
15+
"runServices": ["dev"], // only run dev, not also server
16+
17+
// Uncomment the line below if you want to keep your containers running after VS Code shuts down.
18+
// "shutdownAction": "none",
19+
20+
// Uncomment next line if you want to copy your .ssh creds and other config files for easier use inside container
21+
//"postCreateCommand": "bash ./docker/scripts/copy-local-config-and-ssh-creds.sh",
22+
23+
// Add the IDs of extensions you want installed when the container is created in the array below.
24+
"extensions": [
25+
"dbaeumer.vscode-eslint",
26+
"esbenp.prettier-vscode",
27+
"msjsdiag.debugger-for-chrome",
28+
"apollographql.vscode-apollo",
29+
"mikestead.dotenv",
30+
"ms-azuretools.vscode-docker",
31+
"p1c2u.docker-compose",
32+
"dzannotti.vscode-babel-coloring",
33+
"aaron-bond.better-comments",
34+
"pranaygp.vscode-css-peek",
35+
"codemooseus.vscode-devtools-for-chrome",
36+
"wix.vscode-import-cost",
37+
"cancerberosgx.vscode-typescript-refactors",
38+
"steoates.autoimport"
39+
]
40+
}

.dockerignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.docker
2+
.env
3+
.git
4+
.github
5+
.vscode
6+
7+
@app/e2e
8+
9+
*Dockerfile*
10+
*docker-compose*
11+
12+
**/.DS_Store
13+
**/.next
14+
**/node_modules
15+
**/dist
16+
**/__tests__

.editorconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# EditorConfig works out of the box with many editors, plugins are available
2+
# for many others - see the website:
3+
# https://EditorConfig.org
4+
5+
root = true
6+
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
charset = utf8
11+
12+
[*.{js,jsx,ts,tsx,graphql,sql,md,html,mjml,json,jsonc,json5,yml,yaml,template,sh,Dockerfile}]
13+
indent_style = space
14+
indent_size = 2
15+
trim_trailing_whitespace = true
16+
17+
[*.{md,html,mjml}]
18+
trim_trailing_whitespace = false
19+
20+
[Dockerfile]
21+
indent_style = space
22+
indent_size = 2

.env.ci

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
NODE_ENV=test
2+
ROOT_DATABASE_URL=postgres://postgres:postgres@localhost/template1
3+
DATABASE_HOST=localhost
4+
DATABASE_NAME=graphile_starter
5+
DATABASE_OWNER=graphile_starter
6+
DATABASE_OWNER_PASSWORD=cisecret1
7+
DATABASE_AUTHENTICATOR=graphile_starter_authenticator
8+
DATABASE_AUTHENTICATOR_PASSWORD=cisecret2
9+
DATABASE_VISITOR=graphile_starter_visitor
10+
SECRET=cisecret3
11+
JWT_SECRET=cisecret4
12+
PORT=5678
13+
ROOT_URL=http://localhost:5678
14+
ENABLE_CYPRESS_COMMANDS=1
15+
DOCKER_MODE=n
16+
17+
# Don't use turbo; we need it to work with Node 10.
18+
GRAPHILE_TURBO=

.eslintignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
**/dist
3+
/data/schema.graphql
4+
/data/schema.sql
5+
/@app/graphql/index.*
6+
/@app/client/.next

.eslintrc.js

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
const { readFileSync } = require("fs");
2+
const schemaString = readFileSync(`${__dirname}/data/schema.graphql`, "utf8");
3+
4+
module.exports = {
5+
parser: "@typescript-eslint/parser",
6+
extends: [
7+
"plugin:react/recommended",
8+
"plugin:import/errors",
9+
"plugin:import/typescript",
10+
"prettier",
11+
"prettier/@typescript-eslint",
12+
"prettier/react",
13+
],
14+
plugins: [
15+
"jest",
16+
"@typescript-eslint",
17+
"react-hooks",
18+
"react",
19+
"graphql",
20+
"simple-import-sort",
21+
"import",
22+
],
23+
overrides: [
24+
{
25+
files: ["@app/e2e/cypress/**"],
26+
plugins: ["cypress"],
27+
env: {
28+
"cypress/globals": true,
29+
},
30+
},
31+
],
32+
parserOptions: {
33+
ecmaVersion: 2018,
34+
sourceType: "module",
35+
ecmaFeatures: {
36+
jsx: true,
37+
},
38+
},
39+
settings: {
40+
react: {
41+
version: "detect",
42+
},
43+
},
44+
env: {
45+
browser: true,
46+
node: true,
47+
jest: true,
48+
es6: true,
49+
},
50+
rules: {
51+
"react-hooks/rules-of-hooks": "error",
52+
"react-hooks/exhaustive-deps": "error",
53+
"@typescript-eslint/no-unused-vars": [
54+
"error",
55+
{
56+
argsIgnorePattern: "^_",
57+
varsIgnorePattern: "^_",
58+
args: "after-used",
59+
ignoreRestSiblings: true,
60+
},
61+
],
62+
"no-unused-expressions": [
63+
"error",
64+
{
65+
allowTernary: true,
66+
},
67+
],
68+
"no-console": 0,
69+
"no-confusing-arrow": 0,
70+
"no-else-return": 0,
71+
"no-return-assign": [2, "except-parens"],
72+
"no-underscore-dangle": 0,
73+
"jest/no-focused-tests": 2,
74+
"jest/no-identical-title": 2,
75+
camelcase: 0,
76+
"prefer-arrow-callback": [
77+
"error",
78+
{
79+
allowNamedFunctions: true,
80+
},
81+
],
82+
"class-methods-use-this": 0,
83+
"no-restricted-syntax": 0,
84+
"no-param-reassign": [
85+
"error",
86+
{
87+
props: false,
88+
},
89+
],
90+
"react/prop-types": 0,
91+
"react/no-multi-comp": 0,
92+
"react/jsx-filename-extension": 0,
93+
"react/no-unescaped-entities": 0,
94+
95+
"import/no-extraneous-dependencies": 0,
96+
97+
"graphql/template-strings": [
98+
"error",
99+
{
100+
env: "literal",
101+
schemaString,
102+
validators: [
103+
"ExecutableDefinitions",
104+
"FieldsOnCorrectType",
105+
"FragmentsOnCompositeTypes",
106+
"KnownArgumentNames",
107+
"KnownDirectives", // disabled by default in relay
108+
// 'KnownFragmentNames', // disabled by default in all envs
109+
"KnownTypeNames",
110+
"LoneAnonymousOperation",
111+
"NoFragmentCycles",
112+
"NoUndefinedVariables", //disabled by default in relay
113+
// 'NoUnusedFragments' // disabled by default in all envs
114+
// 'NoUnusedVariables' throws even when fragments use the variable
115+
"OverlappingFieldsCanBeMerged",
116+
"PossibleFragmentSpreads",
117+
"ProvidedRequiredArguments", // disabled by default in relay
118+
"ScalarLeafs", // disabled by default in relay
119+
"SingleFieldSubscriptions",
120+
"UniqueArgumentNames",
121+
"UniqueDirectivesPerLocation",
122+
"UniqueFragmentNames",
123+
"UniqueInputFieldNames",
124+
"UniqueOperationNames",
125+
"UniqueVariableNames",
126+
"ValuesOfCorrectType",
127+
"VariablesAreInputTypes",
128+
// "VariablesDefaultValueAllowed",
129+
"VariablesInAllowedPosition",
130+
],
131+
},
132+
],
133+
"graphql/named-operations": [
134+
"error",
135+
{
136+
schemaString,
137+
},
138+
],
139+
"graphql/required-fields": [
140+
"error",
141+
{
142+
env: "literal",
143+
schemaString,
144+
requiredFields: ["nodeId", "id"],
145+
},
146+
],
147+
"react/destructuring-assignment": 0,
148+
149+
"arrow-body-style": 0,
150+
"no-nested-ternary": 0,
151+
152+
/*
153+
* simple-import-sort seems to be the most stable import sorting currently,
154+
* disable others
155+
*/
156+
"simple-import-sort/sort": "error",
157+
"sort-imports": "off",
158+
"import/order": "off",
159+
160+
"import/no-deprecated": "warn",
161+
"import/no-duplicates": "error",
162+
},
163+
};

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.js text=auto eol=lf
2+
*.ts text=auto eol=lf
3+
*.json text=auto eol=lf
4+
*.md text=auto eol=lf
5+
*.sh text=auto eol=lf
6+
*.yml text=auto eol=lf
7+
*.sql text=auto eol=lf

.github/workflows/cypress.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: End-to-end tests
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
cypress-run:
7+
runs-on: ubuntu-latest
8+
9+
env:
10+
CYPRESS_ROOT_URL: http://localhost:5678
11+
CI: true
12+
CONFIRM_DROP: 1
13+
NODE_ENV: test
14+
ENABLE_CYPRESS_COMMANDS: 1
15+
16+
strategy:
17+
matrix:
18+
node-version: [12.x]
19+
20+
services:
21+
postgres:
22+
image: postgres:10.11
23+
env:
24+
POSTGRES_USER: postgres
25+
POSTGRES_PASSWORD: postgres
26+
POSTGRES_DB: postgres
27+
ports:
28+
- "0.0.0.0:5432:5432"
29+
# needed because the postgres container does not provide a healthcheck
30+
options:
31+
--health-cmd pg_isready --health-interval 10s --health-timeout 5s
32+
--health-retries 5
33+
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v2
37+
- name: Use Node.js ${{ matrix.node-version }}
38+
uses: actions/setup-node@v1
39+
with:
40+
node-version: ${{ matrix.node-version }}
41+
- name: Install pg_dump
42+
run: sudo apt-get update && sudo apt-get install postgresql-client-10
43+
- name: Setup
44+
run: |
45+
cp .env.ci .env
46+
yarn --frozen-lockfile
47+
yarn setup
48+
yarn build
49+
- name: Start server in background
50+
run: yarn server start &
51+
- name: Start worker in background
52+
run: yarn worker start &
53+
- name: Cypress run
54+
uses: cypress-io/github-action@v1
55+
with:
56+
wait-on: http://localhost:5678
57+
working-directory: "@app/e2e"
58+
- uses: actions/upload-artifact@v1
59+
if: failure()
60+
with:
61+
name: cypress-screenshots
62+
path: "@app/e2e/cypress/screenshots"
63+
- uses: actions/upload-artifact@v1
64+
if: failure()
65+
with:
66+
name: cypress-videos
67+
path: "@app/e2e/cypress/videos"

0 commit comments

Comments
 (0)