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

switch to Webpack v5 #4778

Draft
wants to merge 10 commits into
base: v3
Choose a base branch
from
Draft
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
14 changes: 10 additions & 4 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
module.exports = {
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module',
// ecmaVersion: 2020,
// ecmaFeatures: {
// jsx: true,
// },
},
extends: [
'plugin:compat/recommended',
'plugin:jsx-a11y/recommended',
'airbnb',
'prettier',
'prettier/react',
'plugin:prettier/recommended',
],
rules: {
curly: ['error', 'all'],
Expand All @@ -15,10 +20,11 @@ module.exports = {
'no-console': 'error',
'import/no-extraneous-dependencies': 'off',
'import/no-named-default': 'off',
'import/extensions': ['error', 'always'],
// react
'react/button-has-type': 'warn',
'react/destructuring-assignment': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['.js'] }],
// 'react/jsx-filename-extension': ['error', { extensions: ['.js'] }],
'react/jsx-fragments': 'off',
'react/jsx-key': 'error',
'react/jsx-props-no-spreading': 'off',
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/dev-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ on:
# - v3
# todo: remove
- improve-ci-speed
# todo: remove
- node16-upstream
pull_request:
branches:
# - v3
# todo: remove
- improve-ci-speed
# todo: remove
- node16-upstream

env:
# We tell Playwright not to download browser binaries because we use microsoft/playwright-github-action.
Expand Down Expand Up @@ -44,8 +48,8 @@ jobs:
uses: actions/cache@v3
with:
path: '.yarn/cache'
key: yarn-cache-${{ github.ref_name }}
restore-keys: yarn-cache-v3
key: yarn-v3-cache-${{ github.ref_name }}
restore-keys: yarn-v3-cache-v3
- name: Install dependencies
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: yarn install --immutable
Expand Down Expand Up @@ -90,8 +94,8 @@ jobs:
uses: actions/cache@v3
with:
path: '.yarn/cache'
key: yarn-cache-${{ github.ref_name }}
restore-keys: yarn-cache-v3
key: yarn-v3-cache-${{ github.ref_name }}
restore-keys: yarn-v3-cache-v3
- name: Install dependencies
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: yarn install --immutable
Expand Down Expand Up @@ -143,8 +147,8 @@ jobs:
uses: actions/cache@v3
with:
path: '.yarn/cache'
key: yarn-cache-${{ github.ref_name }}
restore-keys: yarn-cache-v3
key: yarn-v3-cache-${{ github.ref_name }}
restore-keys: yarn-v3-cache-v3
- name: Install dependencies
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: yarn install --immutable
Expand Down
539 changes: 506 additions & 33 deletions .yarn/plugins/@yarnpkg/plugin-version.cjs

Large diffs are not rendered by default.

873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.4.1.cjs

Large diffs are not rendered by default.

55 changes: 0 additions & 55 deletions .yarn/releases/yarn-berry.cjs

This file was deleted.

3 changes: 1 addition & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"

yarnPath: .yarn/releases/yarn-berry.cjs
yarnPath: .yarn/releases/yarn-3.4.1.cjs

packageExtensions:
"@endemolshinegroup/cosmiconfig-typescript-loader@*":
Expand Down Expand Up @@ -34,4 +34,3 @@ packageExtensions:
"@lerna/publish@*":
peerDependencies:
"@octokit/core": "*"

11 changes: 5 additions & 6 deletions app/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import htmlParser from 'htm-to-json';
import defaultConfig from './configurations/config.default';
import configMerger from './util/configMerger';
import { boundWithMinimumAreaSimple } from './util/geo-utils';
import defaultConfig from './configurations/config.default.js';
import configMerger from './util/configMerger.js';
import { boundWithMinimumAreaSimple } from './util/geo-utils.js';

const configs = {}; // cache merged configs for speed
const themeMap = {};
Expand Down Expand Up @@ -61,14 +61,13 @@ function addMetaData(config) {
});
}

export function getNamedConfiguration(configName) {
export async function getNamedConfiguration(configName) {
if (!configs[configName]) {
let additionalConfig;

if (configName !== 'default') {
// eslint-disable-next-line global-require, import/no-dynamic-require
additionalConfig = require(`./configurations/config.${configName}`)
.default;
additionalConfig = await import (`./configurations/config.${configName}.js`).default;
}

// use cached baseConfig that is potentially patched in server start up
Expand Down
6 changes: 3 additions & 3 deletions app/configurations/config.default.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable prefer-template */
import safeJsonParse from '../util/safeJsonParser';
import { BIKEAVL_WITHMAX } from '../util/citybikes';
import safeJsonParse from '../util/safeJsonParser.js';
import { BIKEAVL_WITHMAX } from '../util/citybikes.js';
import realtime from './realtimeUtils.js';

const CONFIG = process.env.CONFIG || 'default';
const API_URL = process.env.API_URL || 'https://dev-api.digitransit.fi';
Expand All @@ -27,7 +28,6 @@ const PORT = process.env.PORT || 8080;
const APP_DESCRIPTION = 'Digitransit journey planning UI';
const OTP_TIMEOUT = process.env.OTP_TIMEOUT || 12000;
const YEAR = 1900 + new Date().getYear();
const realtime = require('./realtimeUtils').default;

const REALTIME_PATCH = safeJsonParse(process.env.REALTIME_PATCH) || {};

Expand Down
5 changes: 2 additions & 3 deletions app/configurations/config.hameenlinna.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* eslint-disable prefer-template */
import configMerger from '../util/configMerger';
import configMerger from '../util/configMerger.js';
import walttiConfig from './config.waltti.js';

const CONFIG = 'hameenlinna';
const APP_TITLE = 'reittiopas.hameenlinna.fi';
const APP_DESCRIPTION = '';

const walttiConfig = require('./config.waltti').default;

export default configMerger(walttiConfig, {
CONFIG,

Expand Down
8 changes: 5 additions & 3 deletions app/configurations/config.hsl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable prefer-template */
import { BIKEAVL_WITHMAX } from '../util/citybikes';
import { BIKEAVL_WITHMAX } from '../util/citybikes.js';

const CONFIG = 'hsl';
const API_URL = process.env.API_URL || 'https://dev-api.digitransit.fi';
Expand All @@ -9,8 +9,10 @@ const MAP_URL =
const POI_MAP_PREFIX = `${MAP_URL}/map/v3/hsl`;
const APP_DESCRIPTION = 'Helsingin seudun liikenteen Reittiopas.';

const HSLTimetables = require('./timetableConfigUtils').default.HSL;
const HSLParkAndRideUtils = require('../util/ParkAndRideUtils').default.HSL;
import _timetables from './timetableConfigUtils.js';
const { HSL: HSLTimetables } = _timetables;
import _parkAndRideUtils from '../util/ParkAndRideUtils.js';
const { HSL: HSLParkAndRideUtils } = _parkAndRideUtils;

const rootLink = process.env.ROOTLINK || 'https://test.hslfi.hsldev.com';
const BANNER_URL = 'https://content.hsl.fi/api/v1/banners?site=JourneyPlanner';
Expand Down
5 changes: 2 additions & 3 deletions app/configurations/config.joensuu.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* eslint-disable prefer-template */
import configMerger from '../util/configMerger';
import configMerger from '../util/configMerger.js';
import walttiConfig from './config.waltti.js';

const CONFIG = 'joensuu';
const APP_TITLE = 'Joensuun reittiopas';
const APP_DESCRIPTION = 'Joensuun uusi reittiopas';

const walttiConfig = require('./config.waltti').default;

export default configMerger(walttiConfig, {
CONFIG,

Expand Down
5 changes: 2 additions & 3 deletions app/configurations/config.jyvaskyla.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* eslint-disable prefer-template */
import configMerger from '../util/configMerger';
import configMerger from '../util/configMerger.js';
import walttiConfig from './config.waltti.js';

const CONFIG = 'jyvaskyla';
const APP_TITLE = 'Reittiopas Jyväskylä';
const APP_DESCRIPTION = 'Jyväskylän uusi reittiopas';

const walttiConfig = require('./config.waltti').default;

const minLat = 61.835318;
const maxLat = 62.603473;
const minLon = 25.230388;
Expand Down
7 changes: 3 additions & 4 deletions app/configurations/config.kotka.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/* eslint-disable prefer-template */
import configMerger from '../util/configMerger';
import { BIKEAVL_WITHMAX } from '../util/citybikes';
import configMerger from '../util/configMerger.js';
import walttiConfig from './config.waltti.js';
import { BIKEAVL_WITHMAX } from '../util/citybikes.js';

const CONFIG = 'kotka';
const APP_TITLE = 'Kotkan seudun reittiopas';
const APP_DESCRIPTION = 'Kotkan seudun reittiopas';

const walttiConfig = require('./config.waltti').default;

const minLat = 60.423693;
const maxLat = 60.688566;
const minLon = 26.422982;
Expand Down
7 changes: 3 additions & 4 deletions app/configurations/config.kouvola.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/* eslint-disable prefer-template */
import configMerger from '../util/configMerger';
import { BIKEAVL_WITHMAX } from '../util/citybikes';
import configMerger from '../util/configMerger.js';
import walttiConfig from './config.waltti.js';
import { BIKEAVL_WITHMAX } from '../util/citybikes.js';

const CONFIG = 'kouvola';
const APP_TITLE = 'Kouvolan reittiopas';
const APP_DESCRIPTION = 'Kouvolan reittiopas';

const walttiConfig = require('./config.waltti').default;

const minLat = 60.574886232976134;
const maxLat = 61.2909051236272;
const minLon = 26.230533247455586;
Expand Down
7 changes: 3 additions & 4 deletions app/configurations/config.kuopio.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/* eslint-disable prefer-template */
import configMerger from '../util/configMerger';
import { BIKEAVL_BIKES } from '../util/citybikes';
import configMerger from '../util/configMerger.js';
import walttiConfig from './config.waltti.js';
import { BIKEAVL_BIKES } from '../util/citybikes.js';

const CONFIG = 'kuopio';
const APP_TITLE = 'Reittiopas Kuopio';
const APP_DESCRIPTION = 'Reittiopas Kuopio';

const walttiConfig = require('./config.waltti').default;

export default configMerger(walttiConfig, {
CONFIG,

Expand Down
5 changes: 2 additions & 3 deletions app/configurations/config.lahti.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* eslint-disable prefer-template */
import configMerger from '../util/configMerger';
import configMerger from '../util/configMerger.js';
import walttiConfig from './config.waltti.js';

const CONFIG = 'lahti';
const APP_TITLE = 'LSL reittiopas';
const APP_DESCRIPTION = 'Lahden seudun liikenteen reittiopas';

const walttiConfig = require('./config.waltti').default;

const minLat = 60.692506;
const maxLat = 61.790694;
const minLon = 24.873833;
Expand Down
7 changes: 3 additions & 4 deletions app/configurations/config.lappeenranta.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/* eslint-disable prefer-template */
import configMerger from '../util/configMerger';
import { BIKEAVL_WITHMAX } from '../util/citybikes';
import configMerger from '../util/configMerger.js';
import { BIKEAVL_WITHMAX } from '../util/citybikes.js';
import walttiConfig from './config.waltti.js';

const CONFIG = 'lappeenranta';
const APP_TITLE = 'reittiopas.lappeenranta.fi';
const APP_DESCRIPTION = '';

const walttiConfig = require('./config.waltti').default;

export default configMerger(walttiConfig, {
CONFIG,

Expand Down
16 changes: 9 additions & 7 deletions app/configurations/config.matka.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
/* eslint-disable prefer-template */
import { BIKEAVL_WITHMAX, BIKEAVL_BIKES } from '../util/citybikes';
import HSLConfig from './config.hsl';
import TurkuConfig from './config.turku';
import LappeenrantaConfig from './config.lappeenranta';
import TampereConfig from './config.tampere';
import KuopioConfig from './config.kuopio';
import HSLConfig from './config.hsl.js';
import TurkuConfig from './config.turku.js';
import LappeenrantaConfig from './config.lappeenranta.js';
import TampereConfig from './config.tampere.js';
import KuopioConfig from './config.kuopio.js';

const CONFIG = 'matka';
const APP_DESCRIPTION = 'Matka.fi–palvelu.';
const APP_TITLE = 'Matka.fi';
const YEAR = 1900 + new Date().getYear();

const HSLParkAndRideUtils = require('../util/ParkAndRideUtils').default.HSL;
import _parkAndRideUtils from '../util/ParkAndRideUtils.js';
const { HSL: HSLParkAndRideUtils } = _parkAndRideUtils;

// route timetable data needs to be up-to-date before this is enabled
// const HSLRouteTimetable = require('./timetableConfigUtils').default.HSLRoutes;
// import _timetableConfigUtils from './timetableConfigUtils.js';
// const { HSLRoutes: HSLRouteTimetable } = _timetableConfigUtils;

export default {
CONFIG,
Expand Down
5 changes: 2 additions & 3 deletions app/configurations/config.mikkeli.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* eslint-disable prefer-template */
import configMerger from '../util/configMerger';
import configMerger from '../util/configMerger.js';
import walttiConfig from './config.waltti.js';

const CONFIG = 'mikkeli';
const APP_TITLE = 'Mikkelin Reittiopas';
const APP_DESCRIPTION = 'Mikkelin julkisen liikenteen reittiopas';

const walttiConfig = require('./config.waltti').default;

const minLat = 61.65922;
const maxLat = 61.717372;
const minLon = 27.155849;
Expand Down
5 changes: 2 additions & 3 deletions app/configurations/config.oulu.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* eslint-disable prefer-template */
import configMerger from '../util/configMerger';
import configMerger from '../util/configMerger.js';
import walttiConfig from './config.waltti.js';

const CONFIG = 'oulu';
const APP_DESCRIPTION = 'Oulun seudun reittiopas';
const APP_TITLE = 'Reittiopas';

const walttiConfig = require('./config.waltti').default;

export default configMerger(walttiConfig, {
CONFIG,

Expand Down
5 changes: 2 additions & 3 deletions app/configurations/config.rovaniemi.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* eslint-disable prefer-template */
import configMerger from '../util/configMerger';
import configMerger from '../util/configMerger.js';
import walttiConfig from './config.waltti.js';

const CONFIG = 'rovaniemi';
const APP_TITLE = 'Rovaniemen reittiopas';
const APP_DESCRIPTION = 'Rovaniemen uusi reittiopas';

const walttiConfig = require('./config.waltti').default;

const minLat = 66.147037;
const maxLat = 67.180128;
const minLon = 24.634987;
Expand Down
10 changes: 5 additions & 5 deletions app/configurations/config.tampere.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/* eslint-disable prefer-template */
import configMerger from '../util/configMerger';
import { BIKEAVL_WITHMAX } from '../util/citybikes';
import configMerger from '../util/configMerger.js';
import { BIKEAVL_WITHMAX } from '../util/citybikes.js';
import walttiConfig from './config.waltti.js';
import _timetableConfigUtils from './timetableConfigUtils.js';
const { tampere: tampereTimetables } = _timetableConfigUtils;

const CONFIG = 'tampere';
const APP_TITLE = 'Nyssen reittiopas';
const APP_DESCRIPTION = 'Nyssen reittiopas';

const walttiConfig = require('./config.waltti').default;
const tampereTimetables = require('./timetableConfigUtils').default.tampere;

const minLat = 61.16;
const maxLat = 62.31;
const minLon = 22.68;
Expand Down
Loading