Skip to content

Commit

Permalink
fix: don't use shady custom builder, just run a script that fixes the…
Browse files Browse the repository at this point in the history
… package.json
  • Loading branch information
tefkah committed Sep 1, 2023
1 parent b2096d0 commit def3c18
Show file tree
Hide file tree
Showing 293 changed files with 2,939 additions and 2,508 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {}
"rules": {
"@typescript-eslint/no-explicit-any": "off"
}
},
{
"files": ["*.js", "*.jsx"],
Expand Down
2 changes: 1 addition & 1 deletion apps/convert/src/app/components/SelectFormat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Fragment, useState } from 'react'
import { Listbox, Transition } from '@headlessui/react'
import { CheckIcon, ChevronUpDownIcon } from '@heroicons/react/20/solid'
import { GenericIcon } from './ExtIcon'
import { GenericIcon } from './ExtIcon.js'

// const options = [
// { id: 1, name: 'Wade Cooper', online: true },
Expand Down
4 changes: 2 additions & 2 deletions apps/convert/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type { Metadata } from 'next'
import '../styles/globals.css'
import Script from 'next/script'
import { env } from '../env/server.mjs'
import { AnalyticsWrapper } from './Analytics'
import { Shell } from './components/Shell'
import { AnalyticsWrapper } from './Analytics.js'
import { Shell } from './components/Shell.js'
// If loading a variable font, you don't need to specify the font weight
const overpass = Overpass({
//weight: ['600', '900'],
Expand Down
6 changes: 3 additions & 3 deletions apps/convert/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use client'
import { z } from 'zod'
import { useState } from 'react'
import { SelectFormat } from './components/SelectFormat'
import { SelectFormat } from './components/SelectFormat.js'
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { Form } from './components/Form'
import { SelectFormatNative } from './components/SelectFormatNative'
import { Form } from './components/Form.js'
import { SelectFormatNative } from './components/SelectFormatNative.js'

function onSubmit() {}

Expand Down
2 changes: 1 addition & 1 deletion apps/converter-frontend-e2e/src/integration/app.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getGreeting } from '../support/app.po'
import { getGreeting } from '../support/app.po.js'

describe('converter-frontend', () => {
beforeEach(() => cy.visit('/'))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react'

import AddLatexPreamble from './add-latex-preamble'
import AddLatexPreamble from './add-latex-preamble.js'

describe('AddLatexPreamble', () => {
it('should render successfully', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react'

import AppShellLayout from './app-shell-layout'
import AppShellLayout from './app-shell-layout.js'

describe('AppShellLayout', () => {
it('should render successfully', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
useMantineTheme,
} from '@mantine/core'
import React, { useState } from 'react'
import { HStack, VStack } from '../stack/stack'
import { HStack, VStack } from '../stack/stack.js'
import Image from 'next/image'
import Link from 'next/link'

Expand All @@ -32,9 +32,7 @@ export function AppShellLayout(props: AppShellLayoutProps) {
header={
<Header height={70}>
{/* Handle other responsive styles with MediaQuery component or createStyles function */}
<div
style={{ display: 'flex', alignItems: 'center', height: '100%' }}
>
<div style={{ display: 'flex', alignItems: 'center', height: '100%' }}>
<MediaQuery largerThan="sm" styles={{ display: 'none' }}>
<Burger
opened={opened}
Expand All @@ -45,12 +43,7 @@ export function AppShellLayout(props: AppShellLayoutProps) {
/>
</MediaQuery>
<HStack spacing={10}>
<Image
src="/favicon.png"
alt="Journal of Trial and Error"
width={40}
height={40}
/>
<Image src="/favicon.png" alt="Journal of Trial and Error" width={40} height={40} />

<Text>Convert</Text>
</HStack>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react'

import Conversion from './conversion'
import Conversion from './conversion.js'

describe('Conversion', () => {
it('should render successfully', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react'

import ConvertedBlockLocal from './converted-block-local'
import ConvertedBlockLocal from './converted-block-local.js'

describe('ConvertedBlockLocal', () => {
it('should render successfully', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react'

import ConvertedBlock from './converted-block'
import ConvertedBlock from './converted-block.js'

describe('ConvertedBlock', () => {
it('should render successfully', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react'

import ExtIcon from './ext-icon'
import ExtIcon from './ext-icon.js'

describe('ExtIcon', () => {
it('should render successfully', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const Citations = ({
: process.env.NEXT_PUBLIC_STYLE_DEV_URL || 'http://localhost:8000/api/style'
const splitextra = extra
?.replace(/\\r/g, '')
?.replace(/\n([A-Z])/gm, '\n\n\n$1')
?.replace(/\n([A-Z])/g, '\n\n\n$1')
?.replace(/\n([^A-Z])/g, '$1')
//console.log(splitextra)
const { data, error } = useSWR(url, (resource: string, init: any) =>
Expand Down
40 changes: 18 additions & 22 deletions apps/converter-frontend/components/publications-list/file-reel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Loader, Tabs, Text } from '@mantine/core'
import { paths, definitions } from 'ojs-client'
import React from 'react'
import useSWR from 'swr'
import { FileStage } from './file-stage'
import { FileStage } from './file-stage.js'

export const FileReel = (props: {
data: Exclude<
Expand All @@ -17,8 +17,8 @@ export const FileReel = (props: {

const { data, error } = useSWR(
`/api/ojs/files?apiToken=${apiToken}&submissionId=${id}&stageId=${stageId}&endpoint=${encodeURIComponent(
endpoint
)}`
endpoint,
)}`,
)
if (!data) {
return <Loader />
Expand Down Expand Up @@ -59,21 +59,20 @@ export const FileReel = (props: {
'Production',
]

const sortedFiles: { [key: number]: definitions['SubmissionFile'][] } =
data.items.reduce(
(
acc: { [key: number]: definitions['SubmissionFile'][] },
curr: definitions['SubmissionFile']
) => {
const id = getStageId(curr)
if (!id) {
return
}
acc[id] = [...(acc?.[id] || []), curr]
return acc
},
{} as { [key: number]: definitions['SubmissionFile'][] }
)
const sortedFiles: { [key: number]: definitions['SubmissionFile'][] } = data.items.reduce(
(
acc: { [key: number]: definitions['SubmissionFile'][] },
curr: definitions['SubmissionFile'],
) => {
const id = getStageId(curr)
if (!id) {
return
}
acc[id] = [...(acc?.[id] || []), curr]
return acc
},
{} as { [key: number]: definitions['SubmissionFile'][] },
)

return (
<Tabs defaultValue={'production'}>
Expand All @@ -82,10 +81,7 @@ export const FileReel = (props: {
//console.log(stageInt)
//console.log(data)
return (
<Tabs.Tab
value={stagesss[stageInt] ?? 'production'}
key={stagesss[stageInt]}
>
<Tabs.Tab value={stagesss[stageInt] ?? 'production'} key={stagesss[stageInt]}>
<FileStage
{...{
submissionId: id!,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import React from 'react'
import { FaDownload, FaFileDownload } from 'react-icons/fa'
import { ImShuffle } from 'react-icons/im'
import { shallow } from 'zustand/shallow'
import { GenericIcon } from '../ext-icon/ext-icon'
import { GenericIcon } from '../ext-icon/ext-icon.js'
import qs from 'querystring'
import { HStack } from '../stack/stack'
import { HStack } from '../stack/stack.js'

export const FileStage = (props: {
submissionId: number
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { definitions } from 'ojs-client'
import React from 'react'
import { Text } from '@mantine/core'
import { VStack } from '../stack/stack'
import { RenderPubMeta } from './render-pub-meta'
import { VStack } from '../stack/stack.js'
import { RenderPubMeta } from './render-pub-meta.js'

export const MetaItem = ({
datakey,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react'

import PublicationsList from './publications-list'
import PublicationsList from './publications-list.js'

describe('PublicationsList', () => {
it('should render successfully', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Link from 'next/link'
import { definitions } from 'ojs-client'
import React from 'react'
import { FaOrcid } from 'react-icons/fa'
import { HStack } from '../stack/stack'
import { Citations } from './citations'
import { HStack } from '../stack/stack.js'
import { Citations } from './citations.js'

export type PublicationKeys = keyof definitions['Publication']
export type PublicationTypes = definitions['Publication'][PublicationKeys]
Expand Down Expand Up @@ -39,25 +39,23 @@ export const RenderPubMeta = ({
return (
<HStack>
{/*@ts-expect-error booo*/}
{(value as definitions['Publication']['keywords'])?.en_US?.map(
(keyw: string) => (
<Box
sx={{
borderRadius: 10,
borderWidth: 1,
padding: 4,
paddingLeft: 8,
paddingRight: 8,
backgroundColor: 'darkblue',
color: 'white',
fontWeight: 'bold',
}}
key={keyw}
>
<Text size="sm">{keyw}</Text>
</Box>
)
)}
{(value as definitions['Publication']['keywords'])?.en_US?.map((keyw: string) => (
<Box
sx={{
borderRadius: 10,
borderWidth: 1,
padding: 4,
paddingLeft: 8,
paddingRight: 8,
backgroundColor: 'darkblue',
color: 'white',
fontWeight: 'bold',
}}
key={keyw}
>
<Text size="sm">{keyw}</Text>
</Box>
))}
</HStack>
)
case 'title':
Expand All @@ -75,9 +73,7 @@ export const RenderPubMeta = ({
}
}

export const AuthorsContainer = (props: {
authors: definitions['Publication']['authors']
}) => {
export const AuthorsContainer = (props: { authors: definitions['Publication']['authors'] }) => {
const { authors } = props
return (
<Container
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react'

import SelectItem from './select-item'
import SelectItem from './select-item.js'

describe('SelectItem', () => {
it('should render successfully', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react'

import Settings from './settings'
import Settings from './settings.js'

describe('Settings', () => {
it('should render successfully', () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/converter-frontend/components/stack/stack.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react'

import Stack from './stack'
import Stack from './stack.js'

describe('Stack', () => {
it('should render successfully', () => {
Expand Down
4 changes: 2 additions & 2 deletions apps/converter-frontend/pages/api/ojs/file.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { replaceCookieRes, getSID } from '../../../utils/forgeCookie'
import { replaceCookieRes, getSID } from '../../../utils/forgeCookie.js'

import { setCookie } from '../../../utils/cookies'
import { setCookie } from '../../../utils/cookies.js'
import axios from 'axios'
import { NextApiRequest, NextApiResponse } from 'next'
import { getSession } from 'next-auth/react'
Expand Down
4 changes: 2 additions & 2 deletions apps/converter-frontend/pages/api/ojs/files.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import axios from 'axios'
import { NextApiRequest, NextApiResponse } from 'next'
import qs from 'querystring'
import { replaceCookieRes, getSID } from '../../../utils/forgeCookie'
import { replaceCookieRes, getSID } from '../../../utils/forgeCookie.js'

import { setCookie } from '../../../utils/cookies'
import { setCookie } from '../../../utils/cookies.js'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const { endpoint, apiToken, submissionId, stageId } = req.query
Expand Down
4 changes: 2 additions & 2 deletions apps/converter-frontend/pages/api/ojs/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { getSID, replaceCookieRes } from '../../../utils/forgeCookie'
import { getSID, replaceCookieRes } from '../../../utils/forgeCookie.js'
import axios from 'axios'
import { NextApiRequest, NextApiResponse } from 'next'
import { getSession } from 'next-auth/react'
import qs from 'querystring'
import { setCookie } from '../../../utils/cookies'
import { setCookie } from '../../../utils/cookies.js'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const { apiToken: token, searchPhrase, endpoint, ...rest } = req.query
Expand Down
4 changes: 2 additions & 2 deletions apps/converter-frontend/pages/api/ojs/publication.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getSID, replaceCookieRes } from '../../../utils/forgeCookie'
import { getSID, replaceCookieRes } from '../../../utils/forgeCookie.js'
import axios from 'axios'
import { NextApiRequest, NextApiResponse } from 'next'
import { getSession } from 'next-auth/react'
import { setCookie } from '../../../utils/cookies'
import { setCookie } from '../../../utils/cookies.js'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const { url, apiToken: token } = req.query
Expand Down
4 changes: 2 additions & 2 deletions apps/converter-frontend/pages/api/tex-to-pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import tar from 'tar-stream'
import { Writable } from 'stream'
import axios from 'axios'
import FormData from 'form-data'
import { cls } from '../../public/jote-article'
import { cls } from '../../public/jote-article.js'

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
req.statusCode = 200
Expand Down Expand Up @@ -49,7 +49,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
...formdata.getHeaders(),
Accept: 'application/pdf',
},
}
},
)
.then(async (result) => {
console.log('PDF Received!')
Expand Down
Loading

0 comments on commit def3c18

Please sign in to comment.