Skip to content

Commit

Permalink
ci: release build not completing
Browse files Browse the repository at this point in the history
refactor to use pJson imports
  • Loading branch information
aeharding committed Nov 13, 2024
1 parent 61dfae1 commit 24b6397
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 25 deletions.
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
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
34 changes: 21 additions & 13 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,

"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,

"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"moduleResolution": "bundler",
"resolvePackageJsonImports": true,

"strict": true,
"noEmit": true,
"skipLibCheck": true,
"isolatedModules": true,
"allowJs": false,
"resolveJsonModule": true,

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

"jsx": "react-jsx",
"types": ["vite-plugin-svgr/client"],
"noUncheckedIndexedAccess": true,

"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"]
}
}
19 changes: 11 additions & 8 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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";

Check failure on line 9 in vite.config.ts

View workflow job for this annotation

GitHub Actions / ci

Could not find a declaration file for module './compilerOptions'. '/home/runner/work/voyager/voyager/compilerOptions.js' implicitly has an 'any' type.
Expand All @@ -21,7 +21,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 +86,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

0 comments on commit 24b6397

Please sign in to comment.