chore(web): 📦 sync CRA template w/latest

This commit is contained in:
Collin M. Barrett 2021-11-03 03:55:02 -05:00
parent 0b554af623
commit 4526883a96
28 changed files with 83 additions and 65 deletions

BIN
web/package-lock.json generated

Binary file not shown.

View file

@ -25,7 +25,8 @@
"react-router-dom": "^5.3.0",
"react-scripts": "^4.0.3",
"slugify": "^1.6.1",
"typescript": "^4.4.4"
"typescript": "^4.4.4",
"web-vitals": "^1.1.2"
},
"scripts": {
"start": "react-app-rewired start",
@ -37,6 +38,7 @@
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest",
"plugin:prettier/recommended"
]
},

View file

@ -2,6 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<!-- For IE <= 9 -->
<!--[if IE]>
@ -13,29 +14,34 @@
<!-- For IE > 9 -->
<script src="tpl-redirect.js"></script>
<link
rel="shortcut icon"
href="https://filterlists.com/icon_filterlists.png"
/>
<link rel="shortcut icon" href="%PUBLIC_URL%/icon_filterlists.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>
FilterLists | Subscriptions for uBlock Origin, Adblock Plus, AdGuard, ...
</title>
<meta
name="description"
content="FilterLists is the independent, comprehensive directory of filter and host lists for advertisements, trackers, malware, and annoyances. By Collin M. Barrett."
/>
<link
rel="icon"
type="image/png"
href="https://filterlists.com/icon_filterlists.png"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/icon_filterlists.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>
FilterLists | Subscriptions for uBlock Origin, Adblock Plus, AdGuard, ...
</title>
<link rel="canonical" href="https://filterlists.com/" />
</head>
<body>
<div id="root"></div>
<noscript>
<p>
FilterLists is built with JavaScript which does not seem to be supported
@ -47,5 +53,16 @@
>
</p>
</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

View file

@ -3,9 +3,14 @@
"name": "FilterLists | Subscriptions for uBlock Origin, Adblock Plus, AdGuard, ...",
"icons": [
{
"src": "icon_filterlists.png",
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/png"
"type": "image/x-icon"
},
{
"src": "icon_filterlists.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",

View file

@ -1,10 +1,8 @@
import React from "react";
import ReactDOM from "react-dom";
import { render, screen } from "@testing-library/react";
import { App } from "./App";
it("renders without crashing", () => {
const div = document.createElement("div");
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
xtest("renders learn react link", () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

View file

@ -6,7 +6,6 @@ import {
TwitterOutlined,
} from "@ant-design/icons";
import { Layout, Tag } from "antd";
import React from "react";
import {
BrowserRouter as Router,
Link,
@ -14,7 +13,6 @@ import {
RouteComponentProps,
Switch,
} from "react-router-dom";
import { ListsTable } from "./components";
const { Header, Content, Footer } = Layout;

View file

@ -1,5 +1,4 @@
import { Tag } from "antd";
import * as React from "react";
interface Props {
name: string;

View file

@ -1,6 +1,5 @@
import { Button } from "antd";
import { ButtonType } from "antd/lib/button";
import React from "react";
interface Props {
url?: string;

View file

@ -1,9 +1,7 @@
import { InfoCircleOutlined } from "@ant-design/icons";
import { Button } from "antd";
import React from "react";
import { RouteComponentProps } from "react-router-dom";
import slugify from "slugify";
import { SlugifyOptions } from "../constants";
interface Props {

View file

@ -1,7 +1,6 @@
import { ImportOutlined } from "@ant-design/icons";
import { Button } from "antd";
import { ButtonType } from "antd/lib/button";
import React from "react";
interface Props {
name: string;

View file

@ -1,5 +1,4 @@
import { Tag } from "antd";
import * as React from "react";
interface Props {
name: string;

View file

@ -1,4 +1,3 @@
import React from "react";
import { LinkButton } from "./LinkButton";
import { SearchOutlined } from "@ant-design/icons";

View file

@ -1,6 +1,4 @@
import { Tag } from "antd";
import React from "react";
import { Language } from "../../interfaces/Language";
import styles from "./LanguageCloud.module.css";

View file

@ -1,5 +1,4 @@
import "./listInfoDrawer.css";
import { Divider, Drawer } from "antd";
import {
DollarOutlined,
@ -12,8 +11,7 @@ import {
MessageOutlined,
TeamOutlined,
} from "@ant-design/icons";
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import ButtonGroup from "antd/lib/button/button-group";
import { Description } from "../Description";
import { LanguageCloud } from "../languageCloud";

View file

@ -1,11 +1,9 @@
import React from "react";
import {
Redirect,
Route,
RouteComponentProps,
StaticContext,
} from "react-router";
import { List } from "../../interfaces/List";
import { ListInfoDrawer } from "../listInfoDrawer";
import { Language } from "../../interfaces/Language";

View file

@ -3,11 +3,10 @@ import {
SorterResult,
TableCurrentDataSource,
} from "antd/lib/table/interface";
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import { SoftwareCloud, SoftwareIcon } from "../softwareCloud";
import { Table, Tag } from "antd";
import { useSearchColumnFilter, useTablePageSizer } from "../../hooks";
import { Description } from "../Description";
import { Language } from "../../interfaces/Language";
import { LanguageCloud } from "../languageCloud";

View file

@ -1,6 +1,4 @@
import React from "react";
import { RouteComponentProps } from "react-router-dom";
import {
useLanguages,
useLicenses,

View file

@ -1,6 +1,4 @@
import { Tag } from "antd";
import React from "react";
import { Maintainer } from "../../interfaces/Maintainer";
import styles from "./MaintainerCloud.module.css";

View file

@ -1,10 +1,6 @@
import "./maintainers.css";
import { HomeOutlined, MailOutlined, TwitterOutlined } from "@ant-design/icons";
import { Card } from "antd";
import React from "react";
import { Maintainer } from "../../interfaces/Maintainer";
interface Props {

View file

@ -1,5 +1,3 @@
import React from "react";
import { Software } from "../../interfaces/Software";
import styles from "./SoftwareCloud.module.css";
import { SoftwareIcon } from "./SoftwareIcon";

View file

@ -1,5 +1,3 @@
import * as React from "react";
import {
img01,
img02,

View file

@ -1,5 +1,3 @@
import React from "react";
import { Syntax } from "../../interfaces/Syntax";
import { SyntaxTag } from "../SyntaxTag";
import styles from "./SyntaxCloud.module.css";

View file

@ -1,6 +1,4 @@
import { Tag } from "antd";
import React from "react";
import { Tag as TagInterface } from "../../interfaces/Tag";
import styles from "./TagCloud.module.css";

View file

@ -1,5 +1,4 @@
import slugify from "slugify";
import { SlugifyOptions } from "../constants";
import { List } from "../interfaces/List";
import { useApiData } from "./useApiData";

View file

@ -1,8 +1,17 @@
import "./index.css";
import React from "react";
import ReactDOM from "react-dom";
import { App } from "./App";
import "./index.css";
import reportWebVitals from "./reportWebVitals";
ReactDOM.render(<App />, document.getElementById("root"));
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById("root")
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

View file

@ -0,0 +1,15 @@
import { ReportHandler } from "web-vitals";
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

5
web/src/setupTests.ts Normal file
View file

@ -0,0 +1,5 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import "@testing-library/jest-dom";

View file

@ -8,13 +8,13 @@
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"noFallthroughCasesInSwitch": true
"jsx": "react-jsx"
},
"include": ["src"]
}