remove font imports from appreader

This commit is contained in:
Satindar Dhillon 2022-03-21 21:55:01 -07:00
parent 1893e36375
commit fd9170788e
7 changed files with 49 additions and 109 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,26 +0,0 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json"
},
"plugins": ["@typescript-eslint", "functional"],
"extends": [
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"prettier",
"plugin:functional/no-object-orientation"
],
"root": true,
"env": {
"es6": true,
"browser": true,
"jest": true,
"node": true
},
"ignorePatterns": ["next.config.js", "jest.config.js"],
"rules": {
"functional/no-mixed-type": 0,
"react/react-in-jsx-scope": 0
}
}

View file

@ -1,9 +0,0 @@
export {}
declare global {
interface Window {
omnivoreArticle?: any
omnivoreEnv?: any
fontSize?: number
}
}

View file

@ -2,18 +2,20 @@
<html>
<head>
<meta charset="utf-8" />
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no' />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"
/>
</head>
<body>
<div id="root">
<!-- {{INJECT_SWIFT_STRING_HERE!!}} -->
<script type="text/javascript">
function loadEnv() {
window.omnivoreEnv = {
"NEXT_PUBLIC_APP_ENV":"local",
"NEXT_PUBLIC_LOCAL_BASE_URL":"http://localhost:3000",
"NEXT_PUBLIC_LOCAL_SERVER_BASE_URL":"http://localhost:4000",
"NEXT_PUBLIC_LOCAL_HIGHLIGHTS_BASE_URL":"http://localhost:4000"
NEXT_PUBLIC_APP_ENV: 'local',
NEXT_PUBLIC_LOCAL_BASE_URL: 'http://localhost:3000',
NEXT_PUBLIC_LOCAL_SERVER_BASE_URL: 'http://localhost:4000',
NEXT_PUBLIC_LOCAL_HIGHLIGHTS_BASE_URL: 'http://localhost:4000',
}
}
@ -23,19 +25,19 @@
<p data-omnivore-anchor-idx="3">I didn't have time to write a short email so I scheduled a long meeting.</p><p data-omnivore-anchor-idx="4">
<a href="https://twitter.com/jacksonh" data-omnivore-anchor-idx="5">jacksonh</a> Jackson Harper <a href="https://twitter.com/jacksonh/status/1069798258141159425" data-omnivore-anchor-idx="6">December 4, 2018, 3:39 AM UTC</a>
</p></div></div>
`;
`
window.omnivoreArticle = {
id: "test",
linkId: "test",
slug: "test-slug",
id: 'test',
linkId: 'test',
slug: 'test-slug',
createdAt: new Date().toISOString(),
savedAt: new Date().toISOString(),
url: "https://example.com",
title: "Test Article",
url: 'https://example.com',
title: 'Test Article',
content: CONTENT,
originalArticleUrl: "https://example.com",
contentReader: "WEB",
originalArticleUrl: 'https://example.com',
contentReader: 'WEB',
readingProgressPercent: 0,
readingProgressAnchorIndex: 0,
highlights: [],
@ -48,4 +50,4 @@
</div>
<script src="bundle.js"></script>
</body>
</html>
</html>

View file

@ -2,7 +2,6 @@ import React from 'react'
import ReactDOM from 'react-dom'
import { Box, VStack } from '@omnivore/web/components/elements/LayoutPrimitives'
import { ArticleContainer } from '@omnivore/web/components/templates/article/ArticleContainer'
import { ArticleAttributes } from '@omnivore/web/lib/networking/queries/useGetArticleQuery'
import { applyStoredTheme } from '@omnivore/web/lib/themeUpdater'
import '@omnivore/web/styles/globals.css'
import '@omnivore/web/styles/articleInnerStyling.css'
@ -26,7 +25,7 @@ const App = () => {
>
<ArticleContainer
viewerUsername="test"
article={window.omnivoreArticle as ArticleAttributes}
article={window.omnivoreArticle}
scrollElementRef={React.createRef()}
isAppleAppEmbed={true}
highlightBarDisabled={true}

View file

@ -1,17 +0,0 @@
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"esModuleInterop": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": ["additional.d.ts", "src"]
}

View file

@ -1,19 +1,13 @@
import path from "path"
import glob from 'glob'
import path from 'path'
import { DefinePlugin } from 'webpack'
import { Configuration } from "webpack"
import { Configuration } from 'webpack'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
const analyze = process.env.ANALYZE
const config: Configuration = {
entry: {
bundle: './src/index.tsx',
fonts: [
...glob.sync('../web/public/static/fonts/Inter/*'),
...glob.sync('../web/public/static/fonts/SFMono/*')
],
bundle: './src/index.jsx',
},
module: {
rules: [
@ -21,40 +15,37 @@ const config: Configuration = {
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
loader: 'babel-loader',
options: {
presets: [
"@babel/preset-env",
["@babel/preset-react", {"runtime": "automatic"}],
"@babel/preset-typescript",
'@babel/preset-env',
['@babel/preset-react', { runtime: 'automatic' }],
'@babel/preset-typescript',
],
},
},
},
{
test: /\.css$/i,
use: ['style-loader', {
loader: 'css-loader',
options: { url: false }
}, {
// We want paths like `/static/fonts/Inter/Inter.woff2 to become
// `Inter.woff2` which is how they will be bundled on iOS.
loader: 'string-replace-loader',
options: {
search: '\(\'/static/fonts/.*/(.*)\'\)',
replace(_s: string, _p: string, group: string) {
return group
},
flags: 'g',
use: [
'style-loader',
{
loader: 'css-loader',
options: { url: false },
},
}],
},
{
test: /.(ttf|otf|woff(2)?)(\?[a-z0-9]+)?$/,
type: 'asset/resource',
generator: {
filename: '[path][name][ext]'
}
{
// We want paths like `/static/fonts/Inter/Inter.woff2 to become
// `Inter.woff2` which is how they will be bundled on iOS.
loader: 'string-replace-loader',
options: {
search: "('/static/fonts/.*/(.*)')",
replace(_s: string, _p: string, group: string) {
return group
},
flags: 'g',
},
},
],
},
],
},
@ -65,15 +56,15 @@ const config: Configuration = {
new BundleAnalyzerPlugin({
openAnalyzer: !!analyze,
analyzerMode: 'static',
})
}),
],
resolve: {
extensions: [".tsx", ".ts", ".js"],
extensions: ['.tsx', '.ts', '.js'],
},
output: {
path: path.resolve(__dirname, "build"),
path: path.resolve(__dirname, 'build'),
filename: '[name].js',
},
};
}
export default config;
export default config