From cb53072b81de0ba2bbcdf368fb8c406c9822629c Mon Sep 17 00:00:00 2001
From: Josh Reisner <1551689+joshreisner@users.noreply.github.com>
Date: Sat, 19 Oct 2024 13:01:47 -0700
Subject: [PATCH] switch laravel mix to vite (#423)
* switching laravel mix to vite
* fix build target
* trying to fix jest issues
* refactors for jest
* removing ts-expect-errors
* fixing issues
* fixing tests
* update workflow
* fix build script
* try to improve efficiency of build step
---
.eslintrc.js | 5 -
.github/workflows/build.yml | 11 +-
.gitignore | 23 +-
babel.config.js | 7 -
eslint.config.js | 28 +
public/tests/aasanjose.html => example.html | 2 +-
public/index.html => index.html | 0
jest.config.js | 14 -
jest.config.ts | 19 +
jest.setup.js | 24 -
jest.setup.ts | 39 +
netlify.toml | 4 +-
package-lock.json | 21417 +++-----
package.json | 78 +-
public/app.js | 5 -
public/app.js.LICENSE.txt | 83 -
public/data/aasepia.json | 41103 ----------------
public/data/al-anon.json | 10692 ----
public/data/atlanta.json | 193 -
public/data/edmonton.json | 5042 --
public/data/invalid.json | 80 -
public/data/sussexaa.json | 3544 --
public/data/times.json | 99 -
public/tests/aasanjose-gsheet.html | 32 -
public/tests/aasepia.html | 41 -
public/tests/aasfmarin.html | 53 -
public/tests/al-anon.html | 107 -
public/tests/area-fellowship.html | 36 -
public/tests/atlanta.html | 41 -
public/tests/ca.html | 45 -
public/tests/fixed-header.html | 70 -
public/tests/flags.html | 25 -
public/tests/invalid.html | 31 -
public/tests/japan.html | 40 -
public/tests/location.html | 36 -
public/tests/manassas.html | 47 -
public/tests/overflow.html | 33 -
public/tests/puerto-rico.html | 32 -
public/tests/puget-sound.html | 32 -
public/tests/river-cities.html | 32 -
public/tests/sussexaa.html | 45 -
public/tests/times.html | 31 -
public/tests/timezones.html | 30 -
public/tests/type-descriptions.html | 43 -
public/tests/women.html | 40 -
src/app.tsx | 9 +-
src/components/Loading.tsx | 9 +-
src/components/Table.tsx | 4 +-
src/components/TsmlUI.tsx | 10 +-
src/helpers/analytics.ts | 26 +-
src/helpers/calculate-distances.ts | 12 +-
src/helpers/filter-meeting-data.ts | 32 +-
src/helpers/format-array.ts | 3 +-
src/helpers/format-conference-provider.ts | 7 +-
src/helpers/format-feedback-email.ts | 7 +-
src/helpers/format-ics.ts | 10 +-
src/helpers/format-search-params.ts | 34 -
src/helpers/format-string.ts | 2 +-
src/helpers/format-url.ts | 20 +-
src/helpers/index.ts | 1 -
src/helpers/load-meeting-data.ts | 4 +-
src/helpers/query-string.ts | 8 +-
src/helpers/settings.ts | 15 +-
src/helpers/translate-google-sheet.ts | 16 +-
src/i18n/en.ts | 3 +
src/i18n/es.ts | 3 +
src/i18n/fr.ts | 3 +
src/i18n/ja.ts | 3 +
src/i18n/nl.ts | 3 +
src/i18n/pt.ts | 3 +
src/i18n/sk.ts | 3 +
src/i18n/sv.ts | 3 +
index.d.ts => src/types/Settings.ts | 49 +-
src/types/State.ts | 5 +-
src/types/Translation.ts | 1 +
src/types/index.ts | 1 +
src/vite-env.d.ts | 2 +
test/__mocks__/fileMock.js | 4 +
test/__tests__/Alert.spec.tsx | 33 +-
test/__tests__/Button.spec.tsx | 2 +
test/__tests__/Controls.spec.tsx | 2 +
test/__tests__/Dropdown.spec.tsx | 25 +-
test/__tests__/Link.spec.tsx | 3 +
test/__tests__/Loading.spec.tsx | 8 +-
test/__tests__/Map.spec.tsx | 8 +-
test/__tests__/Meeting.spec.tsx | 12 +-
test/__tests__/Table.spec.tsx | 2 +
test/__tests__/Title.spec.tsx | 6 +-
.../__snapshots__/Loading.spec.tsx.snap | 29 -
test/__tests__/analytics.spec.ts | 16 +-
test/__tests__/settings.spec.ts | 8 +-
tsconfig.app.json | 24 +
tsconfig.app.tsbuildinfo | 1 +
tsconfig.json | 40 +-
tsconfig.node.json | 22 +
tsconfig.node.tsbuildinfo | 1 +
tsconfig.tsbuildinfo | 5 +
vite.config.ts | 22 +
webpack.mix.js | 14 -
99 files changed, 7081 insertions(+), 76951 deletions(-)
delete mode 100644 babel.config.js
create mode 100644 eslint.config.js
rename public/tests/aasanjose.html => example.html (96%)
rename public/index.html => index.html (100%)
delete mode 100644 jest.config.js
create mode 100644 jest.config.ts
delete mode 100644 jest.setup.js
create mode 100644 jest.setup.ts
delete mode 100644 public/app.js
delete mode 100644 public/app.js.LICENSE.txt
delete mode 100644 public/data/aasepia.json
delete mode 100644 public/data/al-anon.json
delete mode 100644 public/data/atlanta.json
delete mode 100644 public/data/edmonton.json
delete mode 100644 public/data/invalid.json
delete mode 100644 public/data/sussexaa.json
delete mode 100644 public/data/times.json
delete mode 100644 public/tests/aasanjose-gsheet.html
delete mode 100644 public/tests/aasepia.html
delete mode 100644 public/tests/aasfmarin.html
delete mode 100644 public/tests/al-anon.html
delete mode 100644 public/tests/area-fellowship.html
delete mode 100644 public/tests/atlanta.html
delete mode 100644 public/tests/ca.html
delete mode 100644 public/tests/fixed-header.html
delete mode 100644 public/tests/flags.html
delete mode 100644 public/tests/invalid.html
delete mode 100644 public/tests/japan.html
delete mode 100644 public/tests/location.html
delete mode 100644 public/tests/manassas.html
delete mode 100644 public/tests/overflow.html
delete mode 100644 public/tests/puerto-rico.html
delete mode 100644 public/tests/puget-sound.html
delete mode 100644 public/tests/river-cities.html
delete mode 100644 public/tests/sussexaa.html
delete mode 100644 public/tests/times.html
delete mode 100644 public/tests/timezones.html
delete mode 100644 public/tests/type-descriptions.html
delete mode 100644 public/tests/women.html
delete mode 100644 src/helpers/format-search-params.ts
rename index.d.ts => src/types/Settings.ts (50%)
create mode 100644 src/vite-env.d.ts
create mode 100644 test/__mocks__/fileMock.js
delete mode 100644 test/__tests__/__snapshots__/Loading.spec.tsx.snap
create mode 100644 tsconfig.app.json
create mode 100644 tsconfig.app.tsbuildinfo
create mode 100644 tsconfig.node.json
create mode 100644 tsconfig.node.tsbuildinfo
create mode 100644 tsconfig.tsbuildinfo
create mode 100644 vite.config.ts
delete mode 100644 webpack.mix.js
diff --git a/.eslintrc.js b/.eslintrc.js
index da2ed384..8383a471 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -10,11 +10,6 @@ module.exports = {
'plugin:import/errors',
'plugin:import/typescript',
],
- globals: {
- Lang: 'readonly',
- TSMLReactConfig: 'readonly',
- Translation: 'readonly',
- },
'overrides': [
{
'env': {
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 73d014c2..9b6b91b0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -11,16 +11,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
- name: Setup Node
- uses: actions/setup-node@v2
+ uses: actions/setup-node@v4
with:
- node-version: '16'
- cache: 'npm'
- - run: npm install
+ node-version: '18'
+ - run: npm ci
- run: npm run test-coverage
- - run: npx mix --production
+ - run: npm run build
- name: Coveralls
uses: coverallsapp/github-action@master
diff --git a/.gitignore b/.gitignore
index d18f34fe..2a27d10a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,18 @@
-/node_modules
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+dist
+dist-ssr
+*.local
+
+# Editor directories and files
mix-manifest.json
npm-debug.log
coverage
@@ -7,4 +21,9 @@ playwright-report/
public/custom
.vscode
.DS_Store
-.idea
\ No newline at end of file
+.idea
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
diff --git a/babel.config.js b/babel.config.js
deleted file mode 100644
index 77eb84a8..00000000
--- a/babel.config.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/** @type {import("@babel/core").TransformOptions} */
-module.exports = {
- presets: [
- ['@babel/preset-env', { targets: { node: 'current' } }],
- '@babel/preset-typescript',
- ],
-};
diff --git a/eslint.config.js b/eslint.config.js
new file mode 100644
index 00000000..092408a9
--- /dev/null
+++ b/eslint.config.js
@@ -0,0 +1,28 @@
+import js from '@eslint/js'
+import globals from 'globals'
+import reactHooks from 'eslint-plugin-react-hooks'
+import reactRefresh from 'eslint-plugin-react-refresh'
+import tseslint from 'typescript-eslint'
+
+export default tseslint.config(
+ { ignores: ['dist'] },
+ {
+ extends: [js.configs.recommended, ...tseslint.configs.recommended],
+ files: ['**/*.{ts,tsx}'],
+ languageOptions: {
+ ecmaVersion: 2020,
+ globals: globals.browser,
+ },
+ plugins: {
+ 'react-hooks': reactHooks,
+ 'react-refresh': reactRefresh,
+ },
+ rules: {
+ ...reactHooks.configs.recommended.rules,
+ 'react-refresh/only-export-components': [
+ 'warn',
+ { allowConstantExport: true },
+ ],
+ },
+ },
+)
diff --git a/public/tests/aasanjose.html b/example.html
similarity index 96%
rename from public/tests/aasanjose.html
rename to example.html
index 33015531..2cb9931a 100644
--- a/public/tests/aasanjose.html
+++ b/example.html
@@ -53,6 +53,6 @@
: {},
};
-
+