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": [ "presets": [
"next/babel" "next/babel"
], ],
"plugins": [ "plugins": [
[ [
"babel-plugin-styled-components", "babel-plugin-styled-components",
{ {
"ssr": true, "ssr": true,
"displayName": true, "displayName": true,
"preprocess": false, "preprocess": false,
"pure": true "pure": true
} }
] ]
] ]
} }
+58 -58
View File
@@ -1,61 +1,61 @@
{ {
"root": true, "root": true,
"env": { "env": {
"browser": true, "browser": true,
"commonjs": true, "commonjs": true,
"es6": true, "es6": true,
"node": 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": [ "ecmaVersion": 2018,
"eslint:recommended", "sourceType": "module",
"plugin:react/recommended", "project": "./tsconfig.json"
"plugin:import/errors", },
"plugin:import/warnings", "plugins": [],
"plugin:jsx-a11y/recommended", "settings": {
"plugin:react-hooks/recommended", "react": {
"plugin:@typescript-eslint/recommended", "version": "detect"
"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"
} }
} },
"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: stages:
- setup - setup
- audit - audit
- lint - lint
- build - build
- test - test
- publish - publish
- deploy - deploy
install: install:
image: node:14 image: node:14
stage: setup stage: setup
script: script:
- npm ci - npm ci
artifacts: artifacts:
paths: paths:
- node_modules - node_modules
expire_in: 1 week expire_in: 1 week
audit: audit:
image: node:14 image: node:14
needs: ["install"] needs: ["install"]
stage: audit stage: audit
script: script:
- npm audit --audit-level=critical - npm audit --audit-level=critical
es:lint: es:lint:
image: node:14 image: node:14
needs: ["install"] needs: ["install"]
stage: lint stage: lint
script: script:
- npm run lint:es - npm run lint:es
css:lint: css:lint:
image: node:14 image: node:14
needs: ["install"] needs: ["install"]
stage: lint stage: lint
script: script:
- npm run lint:css - npm run lint:css
# test:unit: # test:unit:
# image: node:14 # image: node:14
@@ -45,103 +45,103 @@ css:lint:
# - npm run test:unit # - npm run test:unit
build: build:
image: node:14 image: node:14
needs: ["install"] needs: ["install"]
stage: build stage: build
script: script:
- NODE_ENV=test npm run build - NODE_ENV=test npm run build
dependencies: dependencies:
- install - install
artifacts: artifacts:
paths: paths:
- .next - .next
expire_in: 1 week expire_in: 1 week
cache: cache:
key: ${CI_COMMIT_REF_SLUG} key: ${CI_COMMIT_REF_SLUG}
paths: paths:
- node_modules/ - node_modules/
- .next/cache/ - .next/cache/
test:e2e: test:e2e:
image: circleci/node:14-browsers image: circleci/node:14-browsers
needs: ["install", "build"] needs: ["install", "build"]
stage: test stage: test
script: script:
- npm run test:e2e - npm run test:e2e
artifacts: artifacts:
paths: paths:
- e2e-screenshots - e2e-screenshots
expire_in: 1 week expire_in: 1 week
when: on_failure when: on_failure
publish:dev: publish:dev:
stage: publish stage: publish
image: docker:stable image: docker:stable
needs: ["build", "test:e2e", "es:lint", "css:lint"] needs: ["build", "test:e2e", "es:lint", "css:lint"]
services: services:
- docker:stable-dind - docker:stable-dind
only: only:
- master - master
script: script:
- docker info - docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - 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 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 - docker push "$IMAGE_NAME":latest
publish:prod: publish:prod:
stage: publish stage: publish
image: docker:stable image: docker:stable
services: services:
- docker:stable-dind - docker:stable-dind
only: only:
- production - production
script: script:
- docker info - docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build . -t "$IMAGE_NAME":prod - docker build . -t "$IMAGE_NAME":prod
- docker push "$IMAGE_NAME":prod - docker push "$IMAGE_NAME":prod
deploy:dev: deploy:dev:
stage: deploy stage: deploy
image: docker:stable image: docker:stable
only: only:
- master - master
environment: environment:
name: dev name: dev
url: https://dev.sahkoinsinoorikilta.fi url: https://dev.sahkoinsinoorikilta.fi
variables: variables:
DOCKER_HOST: $DEV_CI_DOCKER_HOST DOCKER_HOST: $DEV_CI_DOCKER_HOST
DOCKER_TLS_VERIFY: 1 DOCKER_TLS_VERIFY: 1
before_script: before_script:
- mkdir -p ~/.docker - mkdir -p ~/.docker
- echo "$DEV_TLSCACERT" > ~/.docker/ca.pem - echo "$DEV_TLSCACERT" > ~/.docker/ca.pem
- echo "$DEV_TLSCERT" > ~/.docker/cert.pem - echo "$DEV_TLSCERT" > ~/.docker/cert.pem
- echo "$DEV_TLSKEY" > ~/.docker/key.pem - echo "$DEV_TLSKEY" > ~/.docker/key.pem
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY" - docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"
script: script:
- docker stack deploy --with-registry-auth -c stack-compose-dev.yml "$SERVICE_NAME" - docker stack deploy --with-registry-auth -c stack-compose-dev.yml "$SERVICE_NAME"
after_script: after_script:
- docker logout "$CI_REGISTRY" - docker logout "$CI_REGISTRY"
deploy:prod: deploy:prod:
stage: deploy stage: deploy
image: docker:stable image: docker:stable
only: only:
- production - production
environment: environment:
name: production name: production
url: https://sahkoinsinoorikilta.fi url: https://sahkoinsinoorikilta.fi
when: manual when: manual
variables: variables:
DOCKER_HOST: $CI_DOCKER_HOST DOCKER_HOST: $CI_DOCKER_HOST
DOCKER_TLS_VERIFY: 1 DOCKER_TLS_VERIFY: 1
before_script: before_script:
- mkdir -p ~/.docker - mkdir -p ~/.docker
- echo "$TLSCACERT" > ~/.docker/ca.pem - echo "$TLSCACERT" > ~/.docker/ca.pem
- echo "$TLSCERT" > ~/.docker/cert.pem - echo "$TLSCERT" > ~/.docker/cert.pem
- echo "$TLSKEY" > ~/.docker/key.pem - echo "$TLSKEY" > ~/.docker/key.pem
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY" - docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"
script: script:
- docker stack deploy --with-registry-auth -c stack-compose.yml "$SERVICE_NAME" - docker stack deploy --with-registry-auth -c stack-compose.yml "$SERVICE_NAME"
after_script: after_script:
- docker logout "$CI_REGISTRY" - docker logout "$CI_REGISTRY"
+2 -2
View File
@@ -1,5 +1,5 @@
module.exports = { module.exports = {
siteUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://sahkoinsinoorikilta.fi", siteUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://sahkoinsinoorikilta.fi",
generateRobotsTxt: true, generateRobotsTxt: true,
exclude: ["/events/*", "/feed/*", "/signup/*", "/admin/*"] exclude: ["/events/*", "/feed/*", "/signup/*", "/admin/*"],
} };
+1 -1
View File
@@ -15,6 +15,6 @@ module.exports = withBundleAnalyzer({
], ],
}, },
future: { future: {
webpack5: true webpack5: true,
}, },
}); });
+1 -1
View File
@@ -1,4 +1,4 @@
version: '3.4' version: "3.4"
services: services:
frontend: frontend:
+1 -1
View File
@@ -1,4 +1,4 @@
version: '3.4' version: "3.4"
services: services:
frontend: frontend:
-3
View File
@@ -4,9 +4,6 @@ import { getSiteRoot } from "./utils";
fixture`404 page renders and functions correctly`.page(`${getSiteRoot()}/404`); fixture`404 page renders and functions correctly`.page(`${getSiteRoot()}/404`);
test("Page contains the text 404", async (t) => { test("Page contains the text 404", async (t) => {
/**
* Test if there is a favicon element on the page
*/
const elem = Selector("#not-found"); const elem = Selector("#not-found");
await t.expect(elem.textContent).contains("404"); await t.expect(elem.textContent).contains("404");
}); });
+8 -2
View File
@@ -6,7 +6,10 @@
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"isolatedModules": true, "isolatedModules": true,
"jsx": "preserve", "jsx": "preserve",
"lib": ["dom", "esnext"], "lib": [
"dom",
"esnext"
],
"module": "esnext", "module": "esnext",
"moduleResolution": "node", "moduleResolution": "node",
"noEmit": true, "noEmit": true,
@@ -19,7 +22,10 @@
"sourceMap": true, "sourceMap": true,
"strict": false, // TODO: switch true "strict": false, // TODO: switch true
"target": "esnext", "target": "esnext",
"typeRoots": ["types", "node_modules/@types"], "typeRoots": [
"types",
"node_modules/@types"
],
"baseUrl": "./", "baseUrl": "./",
"paths": { "paths": {
"@api/*": [ "@api/*": [