Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: release build not completing #1712

Merged
merged 5 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions e2e/community-feed.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test("load community posts", async ({ page }) => {

await expect(page).toHaveTitle("Voyager for Lemmy");

await expect(page.getByText(posts[0].post.name)).toBeVisible();
await expect(page.getByText(posts[0]!.post.name)).toBeVisible();
});

test("navigate to post on click", async ({ page }) => {
Expand All @@ -22,7 +22,7 @@ test("navigate to post on click", async ({ page }) => {

await page.goto("/");

await page.getByText(posts[0].post.name).click();
await page.getByText(posts[0]!.post.name).click();

await expect(page).toHaveURL(
"/posts/lemmy.world/c/[email protected]/comments/999",
Expand Down
5 changes: 4 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import vitestPlugin from "eslint-plugin-vitest";
import tseslint from "typescript-eslint";

import compilerOptions from "./compilerOptions.js";
import packageJson from "./package.json" with { type: "json" };

export default tseslint.config(
eslint.configs.recommended,
Expand Down Expand Up @@ -119,7 +120,9 @@ export default tseslint.config(
newlinesBetween: "always",
ignoreCase: false,
type: "natural",
internalPattern: ["#/**"],
internalPattern: Object.keys(packageJson.imports).map((i) =>
i.endsWith("*") ? `${i}*` : i,
),
sortSideEffects: true,
groups: [
"builtin",
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"upgrade:react": "pnpm i --save react@experimental react-dom@experimental babel-plugin-react-compiler@experimental eslint-plugin-react-compiler@experimental eslint-plugin-react-hooks@experimental",
"release": "./scripts/release.sh"
},
"imports": {
"#/*": "./src/*"
},
"pnpm": {
"overrides": {
"@ionic/core": "npm:[email protected]"
Expand Down
11 changes: 7 additions & 4 deletions src/features/media/gallery/GalleryProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { StatusBar } from "@capacitor/status-bar";
import { compact, noop } from "es-toolkit";
import { PostView } from "lemmy-js-client";
import type { PreparedPhotoSwipeOptions } from "photoswipe";
import type ZoomLevel from "photoswipe/dist/types/slide/zoom-level";
import type { PreparedPhotoSwipeOptions, ZoomLevelOption } from "photoswipe";
import PhotoSwipeLightbox from "photoswipe/lightbox";
import "photoswipe/style.css";
import React, {
Expand Down Expand Up @@ -40,7 +39,7 @@ interface IGalleryContext {
}

export const GalleryContext = createContext<IGalleryContext>({
// eslint-disable-next-line no-empty-function -- https://github.com/toss/es-toolkit/issues/636
// eslint-disable-next-line no-empty-function
open: async () => {},
close: noop,
});
Expand Down Expand Up @@ -159,7 +158,11 @@ export default function GalleryProvider({ children }: React.PropsWithChildren) {
},
});

let zoomLevel: ZoomLevel;
// ZoomLevel is not directly exported from photoswipe
let zoomLevel: Parameters<
Extract<ZoomLevelOption, (...args: never) => unknown>
>[0];

let currZoomLevel = 0;

instance.on("zoomLevelsUpdate", (e) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PayloadAction, createSlice } from "@reduxjs/toolkit";
import type { Element } from "react-markdown/lib";
import type { ExtraProps } from "react-markdown";

interface NetworkState {
byId: Record<string, boolean>;
Expand Down Expand Up @@ -33,7 +33,7 @@ export default spoilerSlice.reducer;

export function getSpoilerId(
markdownItemId: string,
node: Element | undefined,
node: NonNullable<ExtraProps["node"]> | undefined,
) {
return `${markdownItemId}__${node?.position?.start.offset ?? 0}`;
}
6 changes: 3 additions & 3 deletions src/services/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
PostSortType,
} from "lemmy-js-client";

import { COMMENT_SORTS } from "#/features/comment/CommentSort";
import { ALL_POST_SORTS } from "#/features/feed/PostSort";
import { arrayOfAll } from "#/helpers/array";
import { COMMENT_SORTS } from "#/features/comment/CommentSort.js";
import { ALL_POST_SORTS } from "#/features/feed/PostSort.js";
import { arrayOfAll } from "#/helpers/array.js";

export interface IPostMetadata {
post_id: number;
Expand Down
1 change: 1 addition & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="vite/client" />
/// <reference types="vite-plugin-pwa/react" />
/// <reference types="vite-plugin-svgr/client" />

/**
* Version from package.json
Expand Down
35 changes: 19 additions & 16 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"target": "esnext",

"module": "esnext",
"moduleResolution": "bundler",

"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"types": ["vite-plugin-svgr/client"],
"skipLibCheck": true,
"isolatedModules": true,
"allowJs": false,

"forceConsistentCasingInFileNames": true,
"useDefineForClassFields": true,
"noUncheckedIndexedAccess": true,

"jsx": "react-jsx",

"paths": {
// duplicate of package.json[imports]
// typescript doesn't support this same syntax in package.json with
// module resolution set to bundler, despite it working fine in esbuild/vite...
// https://github.com/microsoft/TypeScript/issues/55337 (╯°□°)╯︵ ┻━┻
"#/*": ["./src/*"]
}
},
"include": ["src"]
}
}
23 changes: 14 additions & 9 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import legacy from "@vitejs/plugin-legacy";
import react from "@vitejs/plugin-react";
import wyw from "@wyw-in-js/vite";
import { omitBy } from "es-toolkit";
import { ManifestOptions, VitePWA } from "vite-plugin-pwa";
import svgr from "vite-plugin-svgr";
import tsconfigPaths from "vite-tsconfig-paths";
import { defineConfig } from "vitest/config";

import compilerOptions from "./compilerOptions";
// @ts-expect-error -- Waiting for stable typescript eslint config
// https://eslint.org/docs/latest/use/configure/configuration-files#typescript-configuration-files
import compilerOptions from "./compilerOptions.js";
import manifest from "./manifest.json";

const IGNORED_ROLLUP_WARNINGS = [
Expand All @@ -21,7 +23,6 @@ const IGNORED_ROLLUP_WARNINGS = [
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
tsconfigPaths(),
react({
babel: {
plugins: [["babel-plugin-react-compiler", compilerOptions]],
Expand Down Expand Up @@ -87,12 +88,16 @@ export default defineConfig({
},
},
},
define: {
APP_VERSION: JSON.stringify(process.env.npm_package_version),
APP_BUILD: process.env.APP_BUILD && JSON.stringify(process.env.APP_BUILD),
APP_GIT_REF: JSON.stringify(process.env.APP_GIT_REF),
BUILD_FOSS_ONLY: !!process.env.BUILD_FOSS_ONLY,
},
// vite panics on empty strings
define: omitBy(
{
APP_VERSION: JSON.stringify(process.env.npm_package_version),
APP_BUILD: process.env.APP_BUILD && JSON.stringify(process.env.APP_BUILD),
APP_GIT_REF: JSON.stringify(process.env.APP_GIT_REF),
BUILD_FOSS_ONLY: !!process.env.BUILD_FOSS_ONLY,
},
(v) => !v,
),
test: {
exclude: ["**/e2e/**", "**/node_modules/**"],
globals: true,
Expand Down