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

View File

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

View File

@ -1,12 +1,14 @@
import { A, redirect, useSearchParams } from '@solidjs/router'
import { clsx } from 'clsx'
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 { useSession } from '~/context/session'
import { useTopics } from '~/context/topics'
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 { Icon } from '../../_shared/Icon'
import { Newsletter } from '../../_shared/Newsletter'

View File

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

View File

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

View File

@ -29,7 +29,7 @@ export const route: RouteDefinition = {
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 { t } = useLocalize()
const [scrollToComments, setScrollToComments] = createSignal<boolean>(false)