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

Migrate to Vite #493

Merged
merged 3 commits into from
Oct 20, 2023
Merged
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: 12 additions & 12 deletions .env
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
REACT_APP_ORIGIN=
REACT_APP_API_URI=
REACT_APP_CMS_URI=
REACT_APP_APPLICATION_NAME=$npm_package_name
REACT_APP_ELIGIBLE_CITIES=helsinki,helsingfors
REACT_APP_OIDC_AUTHORITY=
REACT_APP_OIDC_CLIENT_ID="https://api.hel.fi/auth/kukkuu-ui"
REACT_APP_OIDC_SCOPE="openid profile https://api.hel.fi/auth/kukkuu"
REACT_APP_SENTRY_DSN=https://97e1d346d32a4b9798a08efb263d147c@sentry.hel.ninja/47
REACT_APP_VERSION=$npm_package_version
REACT_APP_FEATURE_FLAG_SHOW_CORONAVIRUS_INFO=false
REACT_APP_ADMIN_TICKET_VALIDATION_URL=https://kukkuu-admin-ui.test.hel.ninja/check-ticket-validity
VITE_ORIGIN=
VITE_API_URI=
VITE_CMS_URI=
VITE_APPLICATION_NAME=$npm_package_name
VITE_ELIGIBLE_CITIES=helsinki,helsingfors
VITE_OIDC_AUTHORITY=
VITE_OIDC_CLIENT_ID="https://api.hel.fi/auth/kukkuu-ui"
VITE_OIDC_SCOPE="openid profile https://api.hel.fi/auth/kukkuu"
VITE_SENTRY_DSN=https://97e1d346d32a4b9798a08efb263d147c@sentry.hel.ninja/47
VITE_VERSION=$npm_package_version
VITE_FEATURE_FLAG_SHOW_CORONAVIRUS_INFO=false
VITE_ADMIN_TICKET_VALIDATION_URL=https://kukkuu-admin-ui.test.hel.ninja/check-ticket-validity
BROWSER_TESTS_ENV_URL=http://localhost:3000
BROWSER_TESTS_USER_NAME=
BROWSER_TESTS_USER_PASSWORD=
8 changes: 4 additions & 4 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
REACT_APP_ORIGIN=http://localhost:3000
REACT_APP_API_URI=https://kukkuu.api.test.hel.ninja/graphql
REACT_APP_OIDC_AUTHORITY=https://tunnistamo.test.kuva.hel.ninja
REACT_APP_CMS_URI=https://kukkuu.hkih.stage.geniem.io/graphql
VITE_ORIGIN=http://localhost:3000
VITE_API_URI=https://kukkuu.api.test.hel.ninja/graphql
VITE_OIDC_AUTHORITY=https://tunnistamo.test.kuva.hel.ninja
VITE_CMS_URI=https://kukkuu.hkih.stage.geniem.io/graphql
6 changes: 3 additions & 3 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
REACT_APP_ORIGIN=
REACT_APP_CMS_URI=https://kukkuu.hkih.stage.geniem.io/graphql
REACT_APP_OIDC_AUTHORITY="https://tunnistamo.test.kuva.hel.ninja"
VITE_ORIGIN=
VITE_CMS_URI=https://kukkuu.hkih.stage.geniem.io/graphql
VITE_OIDC_AUTHORITY="https://tunnistamo.test.kuva.hel.ninja"
14 changes: 4 additions & 10 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
{
"extends": [
"react-app",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:prettier/recommended"
"plugin:prettier/recommended",
"plugin:testcafe/recommended"
],
"rules": {
"@typescript-eslint/brace-style": [
"error",
"1tbs",
{ "allowSingleLine": true }
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/func-call-spacing": ["error"],
"@typescript-eslint/member-ordering": ["warn"],
"@typescript-eslint/no-require-imports": ["error"],
"@typescript-eslint/no-redeclare": "off",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
"react/no-unused-prop-types": ["warn", { "skipShapeProps": true }],
"array-bracket-spacing": ["warn", "never"],
"import/order": [
Expand Down Expand Up @@ -51,6 +44,7 @@
],
"globals": {
"React": true,
"JSX": true
"JSX": true,
"vi": true
}
}
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"trailingComma": "es5",
"semi": true,
"singleQuote": true
}
}
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.14.1"
}
}
2 changes: 1 addition & 1 deletion .testcaferc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"module": "@testing-library/dom/dist/@testing-library/dom.umd.js"
}
]
}
}
57 changes: 26 additions & 31 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Tests",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
"args": [
"test",
"--runInBand",
"--no-cache",
"--watchAll=false"
],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"env": { "CI": "true" },
"disableOptimisticBPs": true
},
{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}/src",
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}
"version": "0.2.0",
"configurations": [
{
"name": "Debug Tests",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
"args": ["test", "--runInBand", "--no-cache", "--watchAll=false"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"env": { "CI": "true" },
"disableOptimisticBPs": true
},
{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}/src",
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}
]
}
}
]
}
9 changes: 3 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -401,22 +401,19 @@ See https://github.com/City-of-Helsinki/kukkuu-ui/milestone/6?closed=1

## [1.14.1](https://github.com/City-of-Helsinki/kukkuu-ui/compare/kukkuu-ui-v1.14.0...kukkuu-ui-v1.14.1) (2023-08-31)


### Bug Fixes

* **dockerfile:** Add REACT_APP_ADMIN_TICKET_VALIDATION_URL argument ([7642b17](https://github.com/City-of-Helsinki/kukkuu-ui/commit/7642b17eeae2226df085b29774b26b32789a65e4))
- **dockerfile:** Add VITE_ADMIN_TICKET_VALIDATION_URL argument ([7642b17](https://github.com/City-of-Helsinki/kukkuu-ui/commit/7642b17eeae2226df085b29774b26b32789a65e4))

## [1.14.0](https://github.com/City-of-Helsinki/kukkuu-ui/compare/kukkuu-ui-v1.13.1...kukkuu-ui-v1.14.0) (2023-08-31)


### Features

* **logos:** Add Tiedemuseo Liekki & update Hotelli- ja ravintolamuseo ([4d4bfee](https://github.com/City-of-Helsinki/kukkuu-ui/commit/4d4bfeea410419598b14643d7e13445df79484d2))

- **logos:** Add Tiedemuseo Liekki & update Hotelli- ja ravintolamuseo ([4d4bfee](https://github.com/City-of-Helsinki/kukkuu-ui/commit/4d4bfeea410419598b14643d7e13445df79484d2))

### Bug Fixes

* Dockerfile base on ubi image DEVOPS-560 ([#486](https://github.com/City-of-Helsinki/kukkuu-ui/issues/486)) ([d9b119b](https://github.com/City-of-Helsinki/kukkuu-ui/commit/d9b119be6ef8a64c18aeed3a2b593222de11fbea))
- Dockerfile base on ubi image DEVOPS-560 ([#486](https://github.com/City-of-Helsinki/kukkuu-ui/issues/486)) ([d9b119b](https://github.com/City-of-Helsinki/kukkuu-ui/commit/d9b119be6ef8a64c18aeed3a2b593222de11fbea))

## 0.1.2 (February 6th, 2020)

Expand Down
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ CMD ["yarn", "start"]
FROM appbase as staticbuilder
# ===================================

ARG REACT_APP_ORIGIN
ARG REACT_APP_ADMIN_TICKET_VALIDATION_URL
ARG REACT_APP_API_URI
ARG REACT_APP_CMS_URI
ARG REACT_APP_OIDC_AUTHORITY
ARG REACT_APP_ENVIRONMENT
ARG REACT_APP_OIDC_CLIENT_ID
ARG REACT_APP_OIDC_SCOPE
ARG REACT_APP_FEATURE_FLAG_SHOW_CORONAVIRUS_INFO
ARG VITE_ORIGIN
ARG VITE_ADMIN_TICKET_VALIDATION_URL
ARG VITE_API_URI
ARG VITE_CMS_URI
ARG VITE_OIDC_AUTHORITY
ARG VITE_ENVIRONMENT
ARG VITE_OIDC_CLIENT_ID
ARG VITE_OIDC_SCOPE
ARG VITE_FEATURE_FLAG_SHOW_CORONAVIRUS_INFO

COPY . /app
RUN yarn build
Expand Down
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ For isolated developing environment, you can use our Docker instructions.

### .env variables

Change REACT_APP_ELIGIBLE_CITIES if you wish to use the project in another city or municipality.
Change VITE_ELIGIBLE_CITIES if you wish to use the project in another city or municipality.

## Available Scripts

Expand All @@ -62,25 +62,33 @@ In the project directory, you can run:
### `yarn start`

Runs the app in the development mode.<br>
Aliases: `vite dev`, `vite serve`.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br>
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
See more from [CLI guide](https://vitejs.dev/guide/cli.html#vite).

### `yarn run build`
### `yarn build`

Builds the app for production to the `build` folder.<br>
Builds the app for production.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
See the section about [building for production](https://vitejs.dev/guide/build.html) and [CLI guide](https://vitejs.dev/guide/cli.html#vite-build) for more information.

### `yarn serve`

Locally preview the production build. Do not use this as a production server as it's not designed for it.
See more from [CLI guide](https://vitejs.dev/guide/cli.html#vite-preview).

### `yarn test`

Launches the test runner in the interactive watch mode.<br>
See the section about [Getting started](https://vitest.dev/guide/) for more information.

### `yarn update-translations`

Expand Down Expand Up @@ -164,12 +172,12 @@ Clone the repository (https://github.com/City-of-Helsinki/kukkuu). Follow the in

### Headless CMS

A headless CMS system is used to produce some dynamic pages. The Headless CMS server endpoint is set with `REACT_APP_CMS_URI` environment variable.
A headless CMS system is used to produce some dynamic pages. The Headless CMS server endpoint is set with `VITE_CMS_URI` environment variable.

The default server that is used is the test / staging server:

```
REACT_APP_CMS_URI="https://kukkuu.hkih.stage.geniem.io/graphql"
VITE_CMS_URI="https://kukkuu.hkih.stage.geniem.io/graphql"
```

### kukkuu-ui
Expand Down Expand Up @@ -221,6 +229,6 @@ Redux internal state can be visualized with [Redux-devtools](https://github.com/

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
You can learn more in the [Vite documentation](https://vitejs.dev/guide/).

To learn React, check out the [React documentation](https://reactjs.org/).
30 changes: 15 additions & 15 deletions azure-pipelines-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@
trigger: none

# Pull request (PR) triggers cause a pipeline to run whenever a pull request is
# opened with one of the specified target branches, or when updates are made to
# opened with one of the specified target branches, or when updates are made to
# such a pull request.
#
# GitHub creates a new ref when a pull request is created. The ref points to a
# merge commit, which is the merged code between the source and target branches
# GitHub creates a new ref when a pull request is created. The ref points to a
# merge commit, which is the merged code between the source and target branches
# of the pull request.
#
# Opt out of pull request validation
# Opt out of pull request validation
pr:
# PR target branch
branches:
include:
- master
- master
paths:
exclude:
- '*release-please*'
- '**/*.md'
- '.github/'
- 'azure-pipelines-release.yml'
- 'azure-pipelines-test.yml'
- 'docker-compose*'
- '*release-please*'
- '**/*.md'
- '.github/'
- 'azure-pipelines-release.yml'
- 'azure-pipelines-test.yml'
- 'docker-compose*'

# By default, use self-hosted agents
pool: Default
Expand All @@ -51,8 +51,8 @@ extends:
# Does not contain all buildArguments, the rest located in harrastukset-pipelines/harrastukset-variables-development.yml and harrastukset-variables-common.yml
# The values here will override the values defined in the harrastukset-pipelines repository
buildArgs:
REACT_APP_CMS_URI: 'https://kukkuu.hkih.stage.geniem.io/graphql'
REACT_APP_API_URI: 'https://kukkuu-local.api.dev.hel.ninja/graphql'
REACT_APP_ADMIN_TICKET_VALIDATION_URL: 'https://kukkuu-admin.test.hel.ninja/check-ticket-validity'
REACT_APP_FEATURE_FLAG_SHOW_CORONAVIRUS_INFO: false
VITE_CMS_URI: 'https://kukkuu.hkih.stage.geniem.io/graphql'
VITE_API_URI: 'https://kukkuu-local.api.dev.hel.ninja/graphql'
VITE_ADMIN_TICKET_VALIDATION_URL: 'https://kukkuu-admin.test.hel.ninja/check-ticket-validity'
VITE_FEATURE_FLAG_SHOW_CORONAVIRUS_INFO: false
# configMap: # pod environment variables
6 changes: 3 additions & 3 deletions azure-pipelines-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ trigger:
- master
paths:
exclude:
- '*release-please*'
- '**/*.md'
- '.github/'
- '*release-please*'
- '**/*.md'
- '.github/'

# Pull request (PR) triggers cause a pipeline to run whenever a pull request is
# opened with one of the specified target branches, or when updates are made to
Expand Down
6 changes: 3 additions & 3 deletions browser-tests/api/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ export const loginPage = {
};

export const login = async (t: TestController) => {
const username = testUsername(), password = testUserPassword();
const username = testUsername(),
password = testUserPassword();

await t
.click(loginPage.loginButton)
await t.click(loginPage.loginButton);

await t
.typeText(loginPage.username, username)
Expand Down
Loading