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

Revert back to Laravel Mix #428

Merged
merged 2 commits into from
Nov 15, 2024
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
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ module.exports = {
'plugin:import/errors',
'plugin:import/typescript',
],
globals: {
Lang: 'readonly',
TSMLReactConfig: 'readonly',
Translation: 'readonly',
},
'overrides': [
{
'env': {
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v4
uses: actions/setup-node@v2
with:
node-version: '18'
- run: npm ci
node-version: '16'
cache: 'npm'
- run: npm install
- run: npm run test-coverage
- run: npm run build
- run: npx mix --production

- name: Coveralls
uses: coverallsapp/github-action@master
Expand Down
23 changes: 2 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
# 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
/node_modules
mix-manifest.json
npm-debug.log
coverage
Expand All @@ -21,9 +7,4 @@ playwright-report/
public/custom
.vscode
.DS_Store
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.idea
7 changes: 7 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import("@babel/core").TransformOptions} */
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
};
28 changes: 0 additions & 28 deletions eslint.config.js

This file was deleted.

49 changes: 41 additions & 8 deletions src/types/Settings.ts → index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { Language } from '@code4recovery/spec';
/* eslint-disable no-unused-vars */

import type { Translation } from './Translation';
type Translation = import('./src/types/Translation').Translation;
type Lang = import('@code4recovery/spec').Language;

export type Settings = {
interface TSMLReactConfig {
cache: boolean;
calendar_enabled: boolean;
columns: string[];
conference_providers: Record<string, string>;
Expand All @@ -12,10 +14,10 @@ export type Settings = {
mode: 'search' | 'location' | 'me';
region: string[];
search: string;
time: Settings['times'];
time: TSMLReactConfig['times'];
type: string[];
view: 'table' | 'map';
weekday: Settings['weekdays'];
weekday: TSMLReactConfig['weekdays'];
};
distance_options: number[];
distance_unit: 'mi' | 'km';
Expand All @@ -24,7 +26,7 @@ export type Settings = {
filters: Array<'region' | 'distance' | 'weekday' | 'time' | 'type'>;
flags?: string[];
in_person_types: string[];
language: Language;
language: Lang;
map: {
markers: {
location: {
Expand All @@ -43,8 +45,39 @@ export type Settings = {
title: boolean;
};
strings: {
[lang in Language]: Translation;
[lang in Lang]: Translation;
};
times: Array<'morning' | 'midday' | 'evening' | 'night'>;
weekdays: string[];
};
}

declare var tsml_react_config: TSMLReactConfig | undefined;

//google analytics globals
declare var gtag:
| ((
type: 'event',
action: string,
params: {
event_category: string;
event_label: string;
}
) => void)
| undefined;

declare var ga:
| ((
type: 'send',
params: {
hitType: 'event';
eventCategory: string;
eventAction: string;
eventLabel: string;
}
) => void)
| undefined;

//declaration merge for IE compat
interface Navigator {
msSaveBlob: (blob: Blob, name: string) => void;
}
14 changes: 14 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @type {import("@jest/types").Config.InitialOptions} */
module.exports = {
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
collectCoverageFrom: [
'<rootDir>/src/**/*.(j|t)s*',
'!<rootDir>/src/(types|i18n)/*',
'!<rootDir>/**/__snapshots__/*',
'!<rootDir>/src/**/index.ts',
],
moduleNameMapper: {
'\\.(css)$': '<rootDir>/test/__mocks__/styleMock.js',
},
};
19 changes: 0 additions & 19 deletions jest.config.ts

This file was deleted.

24 changes: 24 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import '@testing-library/jest-dom/extend-expect';
import React from 'react';

global.React = React;

const savedLocation = window.location;
const savedHistory = window.history;

beforeEach(() => {
delete window.location;
delete window.history;

window.history = {
pushState: jest.fn(),
};

window.location = new URL('https://test.com');
window.location.reload = jest.fn();
});

afterEach(() => {
window.location = savedLocation;
window.history = savedHistory;
});
39 changes: 0 additions & 39 deletions jest.setup.ts

This file was deleted.

4 changes: 2 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[build]
publish = "dist/"
command = "npm run build"
publish = "public/"
command = "npx mix --production"

Loading
Loading