format project files

This commit is contained in:
Aarni Halinen
2021-05-07 22:15:17 +03:00
parent 30abec3f16
commit 8406725740
9 changed files with 202 additions and 199 deletions
+11 -11
View File
@@ -1,16 +1,16 @@
{
"presets": [
"next/babel"
"next/babel"
],
"plugins": [
[
"babel-plugin-styled-components",
{
"ssr": true,
"displayName": true,
"preprocess": false,
"pure": true
}
]
[
"babel-plugin-styled-components",
{
"ssr": true,
"displayName": true,
"preprocess": false,
"pure": true
}
]
]
}
}
+58 -58
View File
@@ -1,61 +1,61 @@
{
"root": true,
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
"root": true,
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:jsx-a11y/recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended",
"airbnb-typescript"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:jsx-a11y/recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended",
"airbnb-typescript"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": [],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"@typescript-eslint/naming-convention": "off",
"max-len": [
"warn",
240
],
"@typescript-eslint/quotes": [
"error",
"double"
],
"import/prefer-default-export": "warn",
"react/jsx-props-no-spreading": "off",
"react/prop-types": "off",
// Temp
"react/jsx-one-expression-per-line": "off",
"react/no-array-index-key": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"jsx-a11y/label-has-associated-control": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/no-noninteractive-element-interactions": "off",
"jsx-a11y/no-static-element-interactions": "off"
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": [],
"settings": {
"react": {
"version": "detect"
}
}
},
"rules": {
"@typescript-eslint/naming-convention": "off",
"max-len": [
"warn",
240
],
"@typescript-eslint/quotes": [
"error",
"double"
],
"import/prefer-default-export": "warn",
"react/jsx-props-no-spreading": "off",
"react/prop-types": "off",
// Temp
"react/jsx-one-expression-per-line": "off",
"react/no-array-index-key": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"jsx-a11y/label-has-associated-control": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/no-noninteractive-element-interactions": "off",
"jsx-a11y/no-static-element-interactions": "off"
}
}
+120 -120
View File
@@ -1,42 +1,42 @@
stages:
- setup
- audit
- lint
- build
- test
- publish
- deploy
- setup
- audit
- lint
- build
- test
- publish
- deploy
install:
image: node:14
stage: setup
script:
- npm ci
artifacts:
paths:
- node_modules
expire_in: 1 week
image: node:14
stage: setup
script:
- npm ci
artifacts:
paths:
- node_modules
expire_in: 1 week
audit:
image: node:14
needs: ["install"]
stage: audit
script:
- npm audit --audit-level=critical
image: node:14
needs: ["install"]
stage: audit
script:
- npm audit --audit-level=critical
es:lint:
image: node:14
needs: ["install"]
stage: lint
script:
- npm run lint:es
image: node:14
needs: ["install"]
stage: lint
script:
- npm run lint:es
css:lint:
image: node:14
needs: ["install"]
stage: lint
script:
- npm run lint:css
image: node:14
needs: ["install"]
stage: lint
script:
- npm run lint:css
# test:unit:
# image: node:14
@@ -45,103 +45,103 @@ css:lint:
# - npm run test:unit
build:
image: node:14
needs: ["install"]
stage: build
script:
- NODE_ENV=test npm run build
dependencies:
- install
artifacts:
paths:
- .next
expire_in: 1 week
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- .next/cache/
image: node:14
needs: ["install"]
stage: build
script:
- NODE_ENV=test npm run build
dependencies:
- install
artifacts:
paths:
- .next
expire_in: 1 week
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- .next/cache/
test:e2e:
image: circleci/node:14-browsers
needs: ["install", "build"]
stage: test
script:
- npm run test:e2e
artifacts:
paths:
- e2e-screenshots
expire_in: 1 week
when: on_failure
image: circleci/node:14-browsers
needs: ["install", "build"]
stage: test
script:
- npm run test:e2e
artifacts:
paths:
- e2e-screenshots
expire_in: 1 week
when: on_failure
publish:dev:
stage: publish
image: docker:stable
needs: ["build", "test:e2e", "es:lint", "css:lint"]
services:
- docker:stable-dind
only:
- master
script:
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build . -t "$IMAGE_NAME":latest --build-arg NEXT_PUBLIC_API_URL=https://api.dev.sahkoinsinoorikilta.fi/api --build-arg NEXT_PUBLIC_SITE_URL=https://dev.sahkoinsinoorikilta.fi
- docker push "$IMAGE_NAME":latest
stage: publish
image: docker:stable
needs: ["build", "test:e2e", "es:lint", "css:lint"]
services:
- docker:stable-dind
only:
- master
script:
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build . -t "$IMAGE_NAME":latest --build-arg NEXT_PUBLIC_API_URL=https://api.dev.sahkoinsinoorikilta.fi/api --build-arg NEXT_PUBLIC_SITE_URL=https://dev.sahkoinsinoorikilta.fi
- docker push "$IMAGE_NAME":latest
publish:prod:
stage: publish
image: docker:stable
services:
- docker:stable-dind
only:
- production
script:
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build . -t "$IMAGE_NAME":prod
- docker push "$IMAGE_NAME":prod
stage: publish
image: docker:stable
services:
- docker:stable-dind
only:
- production
script:
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build . -t "$IMAGE_NAME":prod
- docker push "$IMAGE_NAME":prod
deploy:dev:
stage: deploy
image: docker:stable
only:
- master
environment:
name: dev
url: https://dev.sahkoinsinoorikilta.fi
variables:
DOCKER_HOST: $DEV_CI_DOCKER_HOST
DOCKER_TLS_VERIFY: 1
before_script:
- mkdir -p ~/.docker
- echo "$DEV_TLSCACERT" > ~/.docker/ca.pem
- echo "$DEV_TLSCERT" > ~/.docker/cert.pem
- echo "$DEV_TLSKEY" > ~/.docker/key.pem
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"
script:
- docker stack deploy --with-registry-auth -c stack-compose-dev.yml "$SERVICE_NAME"
after_script:
- docker logout "$CI_REGISTRY"
stage: deploy
image: docker:stable
only:
- master
environment:
name: dev
url: https://dev.sahkoinsinoorikilta.fi
variables:
DOCKER_HOST: $DEV_CI_DOCKER_HOST
DOCKER_TLS_VERIFY: 1
before_script:
- mkdir -p ~/.docker
- echo "$DEV_TLSCACERT" > ~/.docker/ca.pem
- echo "$DEV_TLSCERT" > ~/.docker/cert.pem
- echo "$DEV_TLSKEY" > ~/.docker/key.pem
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"
script:
- docker stack deploy --with-registry-auth -c stack-compose-dev.yml "$SERVICE_NAME"
after_script:
- docker logout "$CI_REGISTRY"
deploy:prod:
stage: deploy
image: docker:stable
only:
- production
environment:
name: production
url: https://sahkoinsinoorikilta.fi
when: manual
variables:
DOCKER_HOST: $CI_DOCKER_HOST
DOCKER_TLS_VERIFY: 1
before_script:
- mkdir -p ~/.docker
- echo "$TLSCACERT" > ~/.docker/ca.pem
- echo "$TLSCERT" > ~/.docker/cert.pem
- echo "$TLSKEY" > ~/.docker/key.pem
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"
script:
- docker stack deploy --with-registry-auth -c stack-compose.yml "$SERVICE_NAME"
after_script:
- docker logout "$CI_REGISTRY"
stage: deploy
image: docker:stable
only:
- production
environment:
name: production
url: https://sahkoinsinoorikilta.fi
when: manual
variables:
DOCKER_HOST: $CI_DOCKER_HOST
DOCKER_TLS_VERIFY: 1
before_script:
- mkdir -p ~/.docker
- echo "$TLSCACERT" > ~/.docker/ca.pem
- echo "$TLSCERT" > ~/.docker/cert.pem
- echo "$TLSKEY" > ~/.docker/key.pem
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"
script:
- docker stack deploy --with-registry-auth -c stack-compose.yml "$SERVICE_NAME"
after_script:
- docker logout "$CI_REGISTRY"
+2 -2
View File
@@ -1,5 +1,5 @@
module.exports = {
siteUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://sahkoinsinoorikilta.fi",
generateRobotsTxt: true,
exclude: ["/events/*", "/feed/*", "/signup/*", "/admin/*"]
}
exclude: ["/events/*", "/feed/*", "/signup/*", "/admin/*"],
};
+1 -1
View File
@@ -15,6 +15,6 @@ module.exports = withBundleAnalyzer({
],
},
future: {
webpack5: true
webpack5: true,
},
});
+1 -1
View File
@@ -1,4 +1,4 @@
version: '3.4'
version: "3.4"
services:
frontend:
+1 -1
View File
@@ -1,4 +1,4 @@
version: '3.4'
version: "3.4"
services:
frontend:
-3
View File
@@ -4,9 +4,6 @@ import { getSiteRoot } from "./utils";
fixture`404 page renders and functions correctly`.page(`${getSiteRoot()}/404`);
test("Page contains the text 404", async (t) => {
/**
* Test if there is a favicon element on the page
*/
const elem = Selector("#not-found");
await t.expect(elem.textContent).contains("404");
});
+8 -2
View File
@@ -6,7 +6,10 @@
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "esnext"],
"lib": [
"dom",
"esnext"
],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
@@ -19,7 +22,10 @@
"sourceMap": true,
"strict": false, // TODO: switch true
"target": "esnext",
"typeRoots": ["types", "node_modules/@types"],
"typeRoots": [
"types",
"node_modules/@types"
],
"baseUrl": "./",
"paths": {
"@api/*": [