minor-configs

This commit is contained in:
Untone 2024-07-13 19:29:17 +03:00
parent 35c5a0ebcf
commit 03787196a9
7 changed files with 25 additions and 101 deletions

View File

@ -1,67 +0,0 @@
name: "e2e tests"
on:
deployment_status:
types: [success]
jobs:
e2e:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Wait for deployment to be live
run: |
echo "Waiting for Vercel deployment to be live..."
until curl -sSf https://testing3.discours.io > /dev/null; do
printf '.'
sleep 10
done
- name: Install Playwright and dependencies
run: npm run e2e:install
- name: Run Playwright tests
run: npm run e2e:tests:ci
env:
BASE_URL: https://testing3.discours.io
name: "deploy"
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Install dependencies
run: npm i
- name: Install CI checks
run: npm ci
- name: Check types
run: npm run typecheck
- name: Lint with Biome
run: npx @biomejs/biome check src/.
- name: Lint styles
run: npx stylelint **/*.{scss,css}
- name: Test production build
run: npm run build

View File

@ -1,19 +1,31 @@
import { SolidStartInlineConfig, defineConfig } from '@solidjs/start/config' import { SolidStartInlineConfig, defineConfig } from '@solidjs/start/config'
import { CSSOptions } from 'vite'
// import { visualizer } from 'rollup-plugin-visualizer' // import { visualizer } from 'rollup-plugin-visualizer'
import mkcert from 'vite-plugin-mkcert' import mkcert from 'vite-plugin-mkcert'
import { nodePolyfills } from 'vite-plugin-node-polyfills' import { PolyfillOptions, nodePolyfills } from 'vite-plugin-node-polyfills'
import sassDts from 'vite-plugin-sass-dts' import sassDts from 'vite-plugin-sass-dts'
const isVercel = Boolean(process?.env.VERCEL) const isVercel = Boolean(process?.env.VERCEL)
const isBun = Boolean(process.env.BUN) const isBun = Boolean(process.env.BUN)
const isE2E = Boolean(process.env.E2E)
const polyfillOptions = {
include: ['path', 'stream', 'util'],
exclude: ['http'],
globals: {
Buffer: true
},
overrides: {
fs: 'memfs'
},
protocolImports: true
} as PolyfillOptions
export default defineConfig({ export default defineConfig({
ssr: true, ssr: true,
server: { server: {
preset: isVercel ? 'vercel_edge' : isBun ? 'bun' : 'node', preset: isVercel ? 'vercel_edge' : isBun ? 'bun' : 'node',
port: 3000, port: 3000,
https: isE2E https: isBun
}, },
devOverlay: true, devOverlay: true,
build: { build: {
@ -24,17 +36,7 @@ export default defineConfig({
envPrefix: 'PUBLIC_', envPrefix: 'PUBLIC_',
plugins: [ plugins: [
!isVercel && mkcert(), !isVercel && mkcert(),
nodePolyfills({ nodePolyfills(polyfillOptions),
include: ['path', 'stream', 'util'],
exclude: ['http'],
globals: {
Buffer: true
},
overrides: {
fs: 'memfs'
},
protocolImports: true
}),
sassDts() sassDts()
], ],
css: { css: {
@ -43,17 +45,7 @@ export default defineConfig({
additionalData: '@import "src/styles/imports";\n', additionalData: '@import "src/styles/imports";\n',
includePaths: ['./public', './src/styles'] includePaths: ['./public', './src/styles']
} }
} } as CSSOptions["preprocessorOptions"]
},
build: {
chunkSizeWarningLimit: 1024,
target: 'esnext',
rollupOptions: {
// plugins: [visualizer()]
}
},
server: {
https: true
} }
} }
} as SolidStartInlineConfig) } as SolidStartInlineConfig)

View File

@ -2,7 +2,6 @@
"name": "discoursio-webapp", "name": "discoursio-webapp",
"private": true, "private": true,
"version": "0.9.5", "version": "0.9.5",
"contributors": [],
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vinxi dev", "dev": "vinxi dev",
@ -122,8 +121,5 @@
"form-data": "^4.0.0", "form-data": "^4.0.0",
"idb": "^8.0.0", "idb": "^8.0.0",
"mailgun.js": "^10.2.1" "mailgun.js": "^10.2.1"
},
"engines": {
"node": "20.x"
} }
} }

View File

@ -1,12 +1,14 @@
import { A, redirect, useSearchParams } from '@solidjs/router' import { A, redirect, useSearchParams } from '@solidjs/router'
import { clsx } from 'clsx' import { clsx } from 'clsx'
import { For, Show, createEffect, createSignal, onCleanup, onMount } from 'solid-js' import { For, Show, createEffect, createSignal, onCleanup, onMount } from 'solid-js'
import type { Topic } from '~/graphql/schema/core.gen'
import { getRandomTopicsFromArray } from '~/lib/getRandomTopicsFromArray'
import { useLocalize } from '~/context/localize' import { useLocalize } from '~/context/localize'
import { useSession } from '~/context/session' import { useSession } from '~/context/session'
import { useTopics } from '~/context/topics' import { useTopics } from '~/context/topics'
import { useUI } from '~/context/ui' import { useUI } from '~/context/ui'
import type { Topic } from '../../../graphql/schema/core.gen'
import { getRandomTopicsFromArray } from '../../../lib/getRandomTopicsFromArray'
import { SharePopup, getShareUrl } from '../../Article/SharePopup' import { SharePopup, getShareUrl } from '../../Article/SharePopup'
import { Icon } from '../../_shared/Icon' import { Icon } from '../../_shared/Icon'
import { Newsletter } from '../../_shared/Newsletter' import { Newsletter } from '../../_shared/Newsletter'

View File

@ -44,7 +44,7 @@ export const TopicsNav = () => {
<A href="/topic/poetry">#{t('Poetry')}</A> <A href="/topic/poetry">#{t('Poetry')}</A>
</li> </li>
<li class={clsx(styles.item, styles.right)}> <li class={clsx(styles.item, styles.right)}>
<A href={'topics'}> <A href={'/topic'}>
<span> <span>
{t('All topics')} {t('All topics')}
<Icon name="arrow-right-black" class={'icon'} /> <Icon name="arrow-right-black" class={'icon'} />

View File

@ -31,7 +31,8 @@ const TopicsContext = createContext<TopicsContextType>({
topTopics: () => [] as Topic[], topTopics: () => [] as Topic[],
setTopicsSort: (_s: string) => undefined, setTopicsSort: (_s: string) => undefined,
addTopics: (_ttt: Topic[]) => undefined, addTopics: (_ttt: Topic[]) => undefined,
loadTopics: async () => [] as Topic[] loadTopics: async () => [] as Topic[],
randomTopic: () => undefined
} as TopicsContextType) } as TopicsContextType)
export function useTopics() { export function useTopics() {

View File

@ -29,7 +29,7 @@ export const route: RouteDefinition = {
type ArticlePageProps = { article?: Shout; comments?: Reaction[]; votes?: Reaction[]; author?: Author } type ArticlePageProps = { article?: Shout; comments?: Reaction[]; votes?: Reaction[]; author?: Author }
export const ArticlePage = (props: RouteSectionProps<ArticlePageProps>) => { export function ArticlePage(props: RouteSectionProps<ArticlePageProps>) {
const loc = useLocation() const loc = useLocation()
const { t } = useLocalize() const { t } = useLocalize()
const [scrollToComments, setScrollToComments] = createSignal<boolean>(false) const [scrollToComments, setScrollToComments] = createSignal<boolean>(false)