From b4390f1639cf440b306dc09ca5f32425e812a658 Mon Sep 17 00:00:00 2001
From: Martin Lysk
Date: Wed, 10 Apr 2024 17:55:15 +0200
Subject: [PATCH 01/12] WIP moves browser-auth from lix server to client and
removes dependencies
---
lix/packages/client/src/browser-auth.ts | 157 +++++++++++++++++++
lix/packages/server/src/auth/browser-auth.ts | 138 ----------------
2 files changed, 157 insertions(+), 138 deletions(-)
create mode 100644 lix/packages/client/src/browser-auth.ts
delete mode 100644 lix/packages/server/src/auth/browser-auth.ts
diff --git a/lix/packages/client/src/browser-auth.ts b/lix/packages/client/src/browser-auth.ts
new file mode 100644
index 0000000000..5f3500b9b7
--- /dev/null
+++ b/lix/packages/client/src/browser-auth.ts
@@ -0,0 +1,157 @@
+// Promise<{
+// username: string
+// email: string
+// avatarUrl?: string
+// }>
+// // export type LixAuthModule = {
+// // login: () => Promise
+// // logout: () => Promise
+// // getUser: () => Promise<{
+// // username: string
+// // email: string
+// // avatarUrl?: string
+// // }>
+// // addPermissions: () => Promise
+// // }
+
+type getAuthClientArgs = {
+ gitHubProxyBaseUrl: string
+ githubAppName: string
+ githubAppClientId: string
+}
+
+export function getAuthClient({
+ gitHubProxyBaseUrl,
+ githubAppName,
+ githubAppClientId,
+}: getAuthClientArgs) {
+ const gitHubProxyUrl = gitHubProxyBaseUrl + "/github-proxy/"
+ return {
+ /**
+ * Login user in new window.
+ *
+ * Read https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps#1-request-a-users-github-identity
+ * works only in browsers for now, but other methods should be supported in future
+ */
+ async login() {
+ const loginWindow = window.open(
+ `https://github.com/login/oauth/authorize?client_id=${githubAppClientId}`, // &redirect_uri=${
+ "_blank"
+ )
+
+ await new Promise((resolve) => {
+ const timer = setInterval(() => {
+ if (loginWindow?.closed) {
+ clearInterval(timer)
+ resolve(true)
+ }
+ }, 700)
+ })
+ },
+
+ async addPermissions() {
+ const permissionWindow = window.open(
+ `https://github.com/apps/${githubAppName}/installations/select_target`,
+ "_blank"
+ )
+ await new Promise((resolve) => {
+ const timer = setInterval(() => {
+ if (permissionWindow?.closed) {
+ clearInterval(timer)
+ resolve(true)
+ }
+ }, 700)
+ })
+ },
+
+ async logout() {
+ await fetch(`${gitHubProxyBaseUrl}/services/auth/sign-out`, {
+ method: "POST",
+ credentials: "include",
+ })
+ },
+
+ /**
+ * Get the user info from the GitHub API.
+ *
+ * Read https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user
+ *
+ * @throws
+ */
+ async getUser(): Promise<{
+ username: string
+ email: string
+ avatarUrl?: string
+ }> {
+ const getGithubNoReplyEmail = (emails: Email[]): string | undefined => {
+ const githubNoReplyEmail = emails.find((email) =>
+ email.email.endsWith("@users.noreply.github.com")
+ )
+ return githubNoReplyEmail?.email
+ }
+
+ const getGithubPublicEmail = (emails: Email[]): string | undefined => {
+ const githubPublicEmail = emails.find((email) => email.visibility === "public")
+ return githubPublicEmail?.email
+ }
+
+ const getGithubPrimaryEmail = (emails: Email[]): string => {
+ const githubPrimaryEmail = emails.find((email) => email.primary)
+ if (githubPrimaryEmail === undefined) {
+ throw Error("No public email found")
+ }
+ return githubPrimaryEmail.email
+ }
+
+ const email = await fetch(`${gitHubProxyUrl}https://api.github.com/user/emails`, {
+ credentials: "include",
+ headers: {
+ Accept: "application/vnd.github+json",
+ "X-GitHub-Api-Version": "2022-11-28",
+ },
+ })
+ if (email.ok === false) {
+ const maybeTokenInvalid = await email.text()
+ if (maybeTokenInvalid === "token_invalid") {
+ throw Error("token_invalid")
+ } else {
+ throw Error(email.statusText)
+ }
+ }
+ const emailBody = await email.json()
+
+ const userEmail =
+ getGithubNoReplyEmail(emailBody) ||
+ getGithubPublicEmail(emailBody) ||
+ getGithubPrimaryEmail(emailBody)
+
+ const request = await fetch(`${gitHubProxyUrl}https://api.github.com/user`, {
+ credentials: "include",
+ headers: {
+ Accept: "application/vnd.github+json",
+ "X-GitHub-Api-Version": "2022-11-28",
+ },
+ })
+ if (request.ok === false) {
+ throw Error("Failed to get user info " + request.statusText)
+ }
+ const requestBody = await request.json()
+
+ return {
+ username: requestBody.login,
+ email: userEmail,
+ avatarUrl: requestBody.avatar_url,
+ }
+ },
+ }
+}
+
+// Type declaration for github api
+type Email = {
+ email: string
+ primary: boolean
+ verified: boolean
+ visibility: string | undefined
+}
+
+// export const browserAuth: LixAuthModule = { login, logout, getUser, addPermissions }
diff --git a/lix/packages/server/src/auth/browser-auth.ts b/lix/packages/server/src/auth/browser-auth.ts
deleted file mode 100644
index 84ac8ee4b4..0000000000
--- a/lix/packages/server/src/auth/browser-auth.ts
+++ /dev/null
@@ -1,138 +0,0 @@
-import { publicEnv } from "@inlang/env-variables/dist/runtime/publicEnv.js"
-
-export type LixAuthModule = {
- login: () => Promise
- logout: () => Promise
- getUser: () => Promise<{
- username: string
- email: string
- avatarUrl?: string
- }>
- addPermissions: () => Promise
-}
-
-const gitHubProxyUrl = publicEnv.PUBLIC_GIT_PROXY_BASE_URL + "/github-proxy/"
-const githubAppClientId = publicEnv.PUBLIC_LIX_GITHUB_APP_CLIENT_ID
-
-/**
- * Login user in new window.
- *
- * Read https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps#1-request-a-users-github-identity
- * works only in browsers for now, but other methods should be supported in future
- */
-// TODO: later use url with default instead of env var: args: { url?: string }
-export async function login() {
- const loginWindow = window.open(
- `https://github.com/login/oauth/authorize?client_id=${githubAppClientId}`, // &redirect_uri=${
- "_blank"
- )
-
- await new Promise((resolve) => {
- const timer = setInterval(() => {
- if (loginWindow?.closed) {
- clearInterval(timer)
- resolve(true)
- }
- }, 700)
- })
-}
-
-export async function addPermissions() {
- const permissionWindow = window.open(
- `https://github.com/apps/${publicEnv.PUBLIC_LIX_GITHUB_APP_NAME}/installations/select_target`,
- "_blank"
- )
- await new Promise((resolve) => {
- const timer = setInterval(() => {
- if (permissionWindow?.closed) {
- clearInterval(timer)
- resolve(true)
- }
- }, 700)
- })
-}
-
-export async function logout() {
- await fetch(`${publicEnv.PUBLIC_GIT_PROXY_BASE_URL}/services/auth/sign-out`, {
- method: "POST",
- credentials: "include",
- })
-}
-
-type Email = {
- email: string
- primary: boolean
- verified: boolean
- visibility: string | undefined
-}
-
-/**
- * Get the user info from the GitHub API.
- *
- * Read https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user
- *
- * @throws
- */
-export async function getUser() {
- const getGithubNoReplyEmail = (emails: Email[]): string | undefined => {
- const githubNoReplyEmail = emails.find((email) =>
- email.email.endsWith("@users.noreply.github.com")
- )
- return githubNoReplyEmail?.email
- }
-
- const getGithubPublicEmail = (emails: Email[]): string | undefined => {
- const githubPublicEmail = emails.find((email) => email.visibility === "public")
- return githubPublicEmail?.email
- }
-
- const getGithubPrimaryEmail = (emails: Email[]): string => {
- const githubPrimaryEmail = emails.find((email) => email.primary)
- if (githubPrimaryEmail === undefined) {
- throw Error("No public email found")
- }
- return githubPrimaryEmail.email
- }
-
- const email = await fetch(`${gitHubProxyUrl}https://api.github.com/user/emails`, {
- credentials: "include",
- headers: {
- Accept: "application/vnd.github+json",
- "X-GitHub-Api-Version": "2022-11-28",
- },
- })
- if (email.ok === false) {
- const maybeTokenInvalid = await email.text()
- if (maybeTokenInvalid === "token_invalid") {
- throw Error("token_invalid")
- } else {
- throw Error(email.statusText)
- }
- }
- const emailBody = await email.json()
-
- const userEmail =
- getGithubNoReplyEmail(emailBody) ||
- getGithubPublicEmail(emailBody) ||
- getGithubPrimaryEmail(emailBody)
-
- const request = await fetch(`${gitHubProxyUrl}https://api.github.com/user`, {
- credentials: "include",
- headers: {
- Accept: "application/vnd.github+json",
- "X-GitHub-Api-Version": "2022-11-28",
- },
- })
- if (request.ok === false) {
- throw Error("Failed to get user info " + request.statusText)
- }
- const requestBody = await request.json()
-
- return {
- username: requestBody.login,
- email: userEmail,
- avatarUrl: requestBody.avatar_url,
- }
-}
-
-export const browserAuth: LixAuthModule = { login, logout, getUser, addPermissions }
From 53c5683185af82f3de7e9e196e5d3211a790552c Mon Sep 17 00:00:00 2001
From: Martin Lysk
Date: Wed, 10 Apr 2024 20:01:09 +0200
Subject: [PATCH 02/12] inject env vars into lix client
---
inlang/source-code/editor/package.json | 1 -
.../src/pages/@host/@owner/@repository/+Page.tsx | 9 ++++++++-
.../src/pages/@host/@owner/@repository/State.tsx | 14 ++++++++++++--
.../@owner/@repository/components/Gitfloat.tsx | 9 ++++++++-
.../editor/src/services/auth/src/onSignOut.ts | 8 +++++++-
.../auth/src/pages/auth-callback/+Page.tsx | 9 ++++++++-
.../local-storage/src/LocalStorageProvider.tsx | 8 +++++++-
inlang/source-code/manage/package.json | 1 -
.../manage/src/components/InlangInstall.ts | 11 ++++++++---
.../manage/src/components/InlangManage.ts | 12 +++++++++---
.../manage/src/components/InlangUninstall.ts | 8 +++++++-
inlang/source-code/website/package.json | 1 -
.../website/src/services/auth/src/onSignOut.ts | 9 ++++++++-
.../auth/src/pages/auth-callback/+Page.tsx | 8 +++++++-
.../local-storage/src/LocalStorageProvider.tsx | 8 +++++++-
lix/packages/client/src/index.ts | 1 +
lix/packages/exp/src/lix.svelte.ts | 1 -
lix/packages/server/package.json | 3 ---
lix/packages/server/src/index.ts | 1 -
pnpm-lock.yaml | 9 ---------
20 files changed, 97 insertions(+), 34 deletions(-)
delete mode 100644 lix/packages/server/src/index.ts
diff --git a/inlang/source-code/editor/package.json b/inlang/source-code/editor/package.json
index 49077aece2..1cf09816cb 100644
--- a/inlang/source-code/editor/package.json
+++ b/inlang/source-code/editor/package.json
@@ -18,7 +18,6 @@
"dependencies": {
"@lix-js/client": "workspace:*",
"@lix-js/fs": "workspace:*",
- "@lix-js/server": "workspace:*",
"@sentry/browser": "^7.27.0",
"@sentry/node": "^7.47.0",
"@sentry/tracing": "^7.47.0",
diff --git a/inlang/source-code/editor/src/pages/@host/@owner/@repository/+Page.tsx b/inlang/source-code/editor/src/pages/@host/@owner/@repository/+Page.tsx
index 25b068527a..65799e2022 100644
--- a/inlang/source-code/editor/src/pages/@host/@owner/@repository/+Page.tsx
+++ b/inlang/source-code/editor/src/pages/@host/@owner/@repository/+Page.tsx
@@ -11,9 +11,16 @@ import { Message } from "./Message.jsx"
import { Errors } from "./components/Errors.jsx"
import { Layout } from "./Layout.jsx"
import Link from "#src/renderer/Link.jsx"
-import { browserAuth } from "@lix-js/server"
+import { getAuthClient } from "@lix-js/client"
import { currentPageContext } from "#src/renderer/state.js"
import { replaceMetaInfo } from "./helper/ReplaceMetaInfo.js"
+import { publicEnv } from "@inlang/env-variables"
+
+const browserAuth = getAuthClient({
+ gitHubProxyBaseUrl: publicEnv.PUBLIC_GIT_PROXY_BASE_URL,
+ githubAppName: publicEnv.PUBLIC_LIX_GITHUB_APP_NAME,
+ githubAppClientId: publicEnv.PUBLIC_LIX_GITHUB_APP_CLIENT_ID,
+})
export const [messageCount, setMessageCount] = createSignal(0)
diff --git a/inlang/source-code/editor/src/pages/@host/@owner/@repository/State.tsx b/inlang/source-code/editor/src/pages/@host/@owner/@repository/State.tsx
index 9ca817b1fa..b566ae4d4b 100644
--- a/inlang/source-code/editor/src/pages/@host/@owner/@repository/State.tsx
+++ b/inlang/source-code/editor/src/pages/@host/@owner/@repository/State.tsx
@@ -18,8 +18,12 @@ import type { LocalStorageSchema } from "#src/services/local-storage/index.js"
import { useLocalStorage } from "#src/services/local-storage/index.js"
import type { TourStepId } from "./components/Notification/TourHintWrapper.jsx"
import { setSearchParams } from "./helper/setSearchParams.js"
-import { openRepository, createNodeishMemoryFs, type Repository } from "@lix-js/client"
-import { browserAuth } from "@lix-js/server"
+import {
+ getAuthClient,
+ openRepository,
+ createNodeishMemoryFs,
+ type Repository,
+} from "@lix-js/client"
import { publicEnv } from "@inlang/env-variables"
import {
LanguageTag,
@@ -33,6 +37,12 @@ import { posthog as telemetryBrowser } from "posthog-js"
import type { Result } from "@inlang/result"
import { id } from "../../../../../marketplace-manifest.json"
+const browserAuth = getAuthClient({
+ gitHubProxyBaseUrl: publicEnv.PUBLIC_GIT_PROXY_BASE_URL,
+ githubAppName: publicEnv.PUBLIC_LIX_GITHUB_APP_NAME,
+ githubAppClientId: publicEnv.PUBLIC_LIX_GITHUB_APP_CLIENT_ID,
+})
+
type EditorStateSchema = {
/**
* Returns a repository object
diff --git a/inlang/source-code/editor/src/pages/@host/@owner/@repository/components/Gitfloat.tsx b/inlang/source-code/editor/src/pages/@host/@owner/@repository/components/Gitfloat.tsx
index 83067494d4..cc8924702d 100644
--- a/inlang/source-code/editor/src/pages/@host/@owner/@repository/components/Gitfloat.tsx
+++ b/inlang/source-code/editor/src/pages/@host/@owner/@repository/components/Gitfloat.tsx
@@ -14,7 +14,7 @@ import {
} from "#src/services/auth/index.js"
import { posthog as telemetryBrowser } from "posthog-js"
import { TourHintWrapper, type TourStepId } from "./Notification/TourHintWrapper.jsx"
-import { browserAuth } from "@lix-js/server"
+import { getAuthClient } from "@lix-js/client"
import {
setSignInModalOpen,
signInModalOpen,
@@ -22,6 +22,13 @@ import {
import { WarningIcon } from "./Notification/NotificationHint.jsx"
import IconArrowDownward from "~icons/material-symbols/arrow-downward-alt"
import { debounce } from "throttle-debounce"
+import { publicEnv } from "@inlang/env-variables"
+
+const browserAuth = getAuthClient({
+ gitHubProxyBaseUrl: publicEnv.PUBLIC_GIT_PROXY_BASE_URL,
+ githubAppName: publicEnv.PUBLIC_LIX_GITHUB_APP_NAME,
+ githubAppClientId: publicEnv.PUBLIC_LIX_GITHUB_APP_CLIENT_ID,
+})
export const Gitfloat = () => {
const {
diff --git a/inlang/source-code/editor/src/services/auth/src/onSignOut.ts b/inlang/source-code/editor/src/services/auth/src/onSignOut.ts
index 4bc41cf10c..4dd1c3b4bf 100644
--- a/inlang/source-code/editor/src/services/auth/src/onSignOut.ts
+++ b/inlang/source-code/editor/src/services/auth/src/onSignOut.ts
@@ -2,7 +2,13 @@ import type { SetStoreFunction } from "solid-js/store"
import type { LocalStorageSchema } from "../../../services/local-storage/index.js"
import { publicEnv } from "@inlang/env-variables"
import { posthog as telemetryBrowser } from "posthog-js"
-import { browserAuth } from "@lix-js/server"
+import { getAuthClient } from "@lix-js/client"
+
+const browserAuth = getAuthClient({
+ gitHubProxyBaseUrl: publicEnv.PUBLIC_GIT_PROXY_BASE_URL,
+ githubAppName: publicEnv.PUBLIC_LIX_GITHUB_APP_NAME,
+ githubAppClientId: publicEnv.PUBLIC_LIX_GITHUB_APP_CLIENT_ID,
+})
/**
* This function is called when the user clicks the "Sign Out" button.
diff --git a/inlang/source-code/editor/src/services/auth/src/pages/auth-callback/+Page.tsx b/inlang/source-code/editor/src/services/auth/src/pages/auth-callback/+Page.tsx
index ba1a32b866..b7a1155f4d 100644
--- a/inlang/source-code/editor/src/services/auth/src/pages/auth-callback/+Page.tsx
+++ b/inlang/source-code/editor/src/services/auth/src/pages/auth-callback/+Page.tsx
@@ -1,9 +1,16 @@
import { createEffect, createResource, Match, Switch } from "solid-js"
+import { getAuthClient } from "@lix-js/client"
import MaterialSymbolsCheckCircleRounded from "~icons/material-symbols/check-circle-rounded"
import MaterialSymbolsArrowBackRounded from "~icons/material-symbols/arrow-back-rounded"
-import { browserAuth } from "@lix-js/server"
+import { publicEnv } from "@inlang/env-variables"
import { useLocalStorage } from "#src/services/local-storage/index.js"
+const browserAuth = getAuthClient({
+ gitHubProxyBaseUrl: publicEnv.PUBLIC_GIT_PROXY_BASE_URL,
+ githubAppName: publicEnv.PUBLIC_LIX_GITHUB_APP_NAME,
+ githubAppClientId: publicEnv.PUBLIC_LIX_GITHUB_APP_CLIENT_ID,
+})
+
/**
* The GitHub web application flow redirects to this page.
*
diff --git a/inlang/source-code/editor/src/services/local-storage/src/LocalStorageProvider.tsx b/inlang/source-code/editor/src/services/local-storage/src/LocalStorageProvider.tsx
index 9bf3d5853a..0f823f483c 100644
--- a/inlang/source-code/editor/src/services/local-storage/src/LocalStorageProvider.tsx
+++ b/inlang/source-code/editor/src/services/local-storage/src/LocalStorageProvider.tsx
@@ -2,10 +2,16 @@ import { createContext, type JSXElement, onCleanup, onMount, useContext } from "
import { createStore, reconcile, type SetStoreFunction } from "solid-js/store"
import { defaultLocalStorage, type LocalStorageSchema } from "./schema.js"
import { posthog as telemetryBrowser } from "posthog-js"
-import { browserAuth } from "@lix-js/server"
+import { getAuthClient } from "@lix-js/client"
import { onSignOut } from "#src/services/auth/index.js"
import { publicEnv } from "@inlang/env-variables"
+const browserAuth = getAuthClient({
+ gitHubProxyBaseUrl: publicEnv.PUBLIC_GIT_PROXY_BASE_URL,
+ githubAppName: publicEnv.PUBLIC_LIX_GITHUB_APP_NAME,
+ githubAppClientId: publicEnv.PUBLIC_LIX_GITHUB_APP_CLIENT_ID,
+})
+
const LocalStorageContext = createContext()
const LOCAL_STORAGE_KEY = "inlang-local-storage"
diff --git a/inlang/source-code/manage/package.json b/inlang/source-code/manage/package.json
index 38a3dbd280..4bcd2a16e7 100644
--- a/inlang/source-code/manage/package.json
+++ b/inlang/source-code/manage/package.json
@@ -13,7 +13,6 @@
"clean": "rm -rf ./dist ./node_modules"
},
"devDependencies": {
- "@lix-js/server": "workspace:*",
"@inlang/detect-json-formatting": "workspace:*",
"@inlang/env-variables": "workspace:*",
"@inlang/markdown": "workspace:*",
diff --git a/inlang/source-code/manage/src/components/InlangInstall.ts b/inlang/source-code/manage/src/components/InlangInstall.ts
index 576f356ea6..a2f7b967a4 100644
--- a/inlang/source-code/manage/src/components/InlangInstall.ts
+++ b/inlang/source-code/manage/src/components/InlangInstall.ts
@@ -1,9 +1,8 @@
import type { TemplateResult } from "lit"
import { html } from "lit"
-import { openRepository, createNodeishMemoryFs } from "@lix-js/client"
+import { getAuthClient, openRepository, createNodeishMemoryFs } from "@lix-js/client"
import { customElement, property } from "lit/decorators.js"
import { TwLitElement } from "../common/TwLitElement.js"
-import { browserAuth, getUser } from "@lix-js/server"
import { registry } from "@inlang/marketplace-registry"
import { ProjectSettings, loadProject, listProjects } from "@inlang/sdk"
import { detectJsonFormatting } from "@inlang/detect-json-formatting"
@@ -11,6 +10,12 @@ import { tryCatch } from "@inlang/result"
import { publicEnv } from "@inlang/env-variables"
import { z } from "zod"
+const browserAuth = getAuthClient({
+ gitHubProxyBaseUrl: publicEnv.PUBLIC_GIT_PROXY_BASE_URL,
+ githubAppName: publicEnv.PUBLIC_LIX_GITHUB_APP_NAME,
+ githubAppClientId: publicEnv.PUBLIC_LIX_GITHUB_APP_CLIENT_ID,
+})
+
@customElement("inlang-install")
export class InlangInstall extends TwLitElement {
@property({ type: Boolean })
@@ -228,7 +233,7 @@ export class InlangInstall extends TwLitElement {
// @ts-ignore
if (this.url.module) this.module = registry.find((x) => x.id === this.url.module)?.module
- const auth = await getUser().catch(() => {
+ const auth = await browserAuth.getUser().catch(() => {
this.authorized = false
})
if (auth) {
diff --git a/inlang/source-code/manage/src/components/InlangManage.ts b/inlang/source-code/manage/src/components/InlangManage.ts
index dee783dd54..61f74c584d 100644
--- a/inlang/source-code/manage/src/components/InlangManage.ts
+++ b/inlang/source-code/manage/src/components/InlangManage.ts
@@ -5,16 +5,22 @@ import { TwLitElement } from "../common/TwLitElement.js"
import { z } from "zod"
import "./InlangUninstall"
import "./InlangInstall"
-import { createNodeishMemoryFs, openRepository } from "@lix-js/client"
+import { getAuthClient, createNodeishMemoryFs, openRepository } from "@lix-js/client"
import { listProjects, isValidLanguageTag } from "@inlang/sdk"
import { publicEnv } from "@inlang/env-variables"
-import { browserAuth, getUser } from "@lix-js/server"
+
import { tryCatch } from "@inlang/result"
import { registry } from "@inlang/marketplace-registry"
import type { MarketplaceManifest } from "../../../versioned-interfaces/marketplace-manifest/dist/interface.js"
import { posthog } from "posthog-js"
import { detectJsonFormatting } from "@inlang/detect-json-formatting"
+const browserAuth = getAuthClient({
+ gitHubProxyBaseUrl: publicEnv.PUBLIC_GIT_PROXY_BASE_URL,
+ githubAppName: publicEnv.PUBLIC_LIX_GITHUB_APP_NAME,
+ githubAppClientId: publicEnv.PUBLIC_LIX_GITHUB_APP_CLIENT_ID,
+})
+
type ManifestWithVersion = MarketplaceManifest & { version: string }
@customElement("inlang-manage")
@@ -230,7 +236,7 @@ export class InlangManage extends TwLitElement {
this.url.repo && this.projectHandler()
- const user = await getUser().catch(() => {
+ const user = await browserAuth.getUser().catch(() => {
this.user = undefined
})
if (user) {
diff --git a/inlang/source-code/manage/src/components/InlangUninstall.ts b/inlang/source-code/manage/src/components/InlangUninstall.ts
index 3e951ee8b8..e7b903ef45 100644
--- a/inlang/source-code/manage/src/components/InlangUninstall.ts
+++ b/inlang/source-code/manage/src/components/InlangUninstall.ts
@@ -3,13 +3,19 @@ import { html } from "lit"
import { openRepository, createNodeishMemoryFs } from "@lix-js/client"
import { customElement, property } from "lit/decorators.js"
import { TwLitElement } from "../common/TwLitElement.js"
-import { browserAuth, getUser } from "@lix-js/server"
+import { getAuthClient } from "@lix-js/client"
import { registry } from "@inlang/marketplace-registry"
import { ProjectSettings } from "@inlang/sdk"
import { detectJsonFormatting } from "@inlang/detect-json-formatting"
import { tryCatch } from "@inlang/result"
import { publicEnv } from "@inlang/env-variables"
+const browserAuth = getAuthClient({
+ gitHubProxyBaseUrl: publicEnv.PUBLIC_GIT_PROXY_BASE_URL,
+ githubAppName: publicEnv.PUBLIC_LIX_GITHUB_APP_NAME,
+ githubAppClientId: publicEnv.PUBLIC_LIX_GITHUB_APP_CLIENT_ID,
+})
+
@customElement("inlang-uninstall")
export class InlangInstall extends TwLitElement {
@property({ type: Boolean })
diff --git a/inlang/source-code/website/package.json b/inlang/source-code/website/package.json
index 16cd413cd9..a8e7006cc1 100644
--- a/inlang/source-code/website/package.json
+++ b/inlang/source-code/website/package.json
@@ -18,7 +18,6 @@
"dependencies": {
"@lix-js/client": "workspace:*",
"@lix-js/fs": "workspace:*",
- "@lix-js/server": "workspace:*",
"@sentry/browser": "^7.27.0",
"@sentry/node": "^7.47.0",
"@sentry/tracing": "^7.47.0",
diff --git a/inlang/source-code/website/src/services/auth/src/onSignOut.ts b/inlang/source-code/website/src/services/auth/src/onSignOut.ts
index a8a2464576..2f3d43252c 100644
--- a/inlang/source-code/website/src/services/auth/src/onSignOut.ts
+++ b/inlang/source-code/website/src/services/auth/src/onSignOut.ts
@@ -1,7 +1,14 @@
import type { SetStoreFunction } from "solid-js/store"
import type { LocalStorageSchema } from "../../../services/local-storage/index.js"
import { telemetryBrowser } from "@inlang/telemetry"
-import { browserAuth } from "@lix-js/server"
+import { getAuthClient } from "@lix-js/client"
+import { publicEnv } from "@inlang/env-variables"
+
+const browserAuth = getAuthClient({
+ gitHubProxyBaseUrl: publicEnv.PUBLIC_GIT_PROXY_BASE_URL,
+ githubAppName: publicEnv.PUBLIC_LIX_GITHUB_APP_NAME,
+ githubAppClientId: publicEnv.PUBLIC_LIX_GITHUB_APP_CLIENT_ID,
+})
/**
* This function is called when the user clicks the "Sign Out" button.
diff --git a/inlang/source-code/website/src/services/auth/src/pages/auth-callback/+Page.tsx b/inlang/source-code/website/src/services/auth/src/pages/auth-callback/+Page.tsx
index 1e9c7502a3..0850687ea0 100644
--- a/inlang/source-code/website/src/services/auth/src/pages/auth-callback/+Page.tsx
+++ b/inlang/source-code/website/src/services/auth/src/pages/auth-callback/+Page.tsx
@@ -1,9 +1,15 @@
import { createEffect, createResource, Match, Switch } from "solid-js"
import MaterialSymbolsCheckCircleRounded from "~icons/material-symbols/check-circle-rounded"
import MaterialSymbolsArrowBackRounded from "~icons/material-symbols/arrow-back-rounded"
-import { browserAuth } from "@lix-js/server"
+import { getAuthClient } from "@lix-js/client"
import { useLocalStorage } from "#src/services/local-storage/index.js"
+import { publicEnv } from "@inlang/env-variables"
+const browserAuth = getAuthClient({
+ gitHubProxyBaseUrl: publicEnv.PUBLIC_GIT_PROXY_BASE_URL,
+ githubAppName: publicEnv.PUBLIC_LIX_GITHUB_APP_NAME,
+ githubAppClientId: publicEnv.PUBLIC_LIX_GITHUB_APP_CLIENT_ID,
+})
/**
* The GitHub web application flow redirects to this page.
*
diff --git a/inlang/source-code/website/src/services/local-storage/src/LocalStorageProvider.tsx b/inlang/source-code/website/src/services/local-storage/src/LocalStorageProvider.tsx
index de08562d2c..f91f72e3c8 100644
--- a/inlang/source-code/website/src/services/local-storage/src/LocalStorageProvider.tsx
+++ b/inlang/source-code/website/src/services/local-storage/src/LocalStorageProvider.tsx
@@ -2,10 +2,16 @@ import { createContext, type JSXElement, onCleanup, onMount, useContext } from "
import { createStore, reconcile, type SetStoreFunction } from "solid-js/store"
import { defaultLocalStorage, type LocalStorageSchema } from "./schema.js"
import { telemetryBrowser } from "@inlang/telemetry"
-import { browserAuth } from "@lix-js/server"
+import { getAuthClient } from "@lix-js/client"
import { onSignOut } from "#src/services/auth/index.js"
import { publicEnv } from "@inlang/env-variables"
+const browserAuth = getAuthClient({
+ gitHubProxyBaseUrl: publicEnv.PUBLIC_GIT_PROXY_BASE_URL,
+ githubAppName: publicEnv.PUBLIC_LIX_GITHUB_APP_NAME,
+ githubAppClientId: publicEnv.PUBLIC_LIX_GITHUB_APP_CLIENT_ID,
+})
+
const LocalStorageContext = createContext()
const LOCAL_STORAGE_KEY = "inlang-local-storage"
diff --git a/lix/packages/client/src/index.ts b/lix/packages/client/src/index.ts
index 48ac08ea18..3305a7bad5 100644
--- a/lix/packages/client/src/index.ts
+++ b/lix/packages/client/src/index.ts
@@ -4,3 +4,4 @@ export { createNodeishMemoryFs } from "@lix-js/fs"
export { hash } from "./hash.js"
export { mockRepo } from "./mockRepo.js"
export { listRemotes as _listRemotes } from "../vendored/isomorphic-git/index.js"
+export { getAuthClient } from "./browser-auth.js"
diff --git a/lix/packages/exp/src/lix.svelte.ts b/lix/packages/exp/src/lix.svelte.ts
index fa083048fa..33704fa8f0 100644
--- a/lix/packages/exp/src/lix.svelte.ts
+++ b/lix/packages/exp/src/lix.svelte.ts
@@ -1,5 +1,4 @@
import { openRepository } from '@lix-js/client' // '/Users/jan/Dev/inlang/inlang/lix/source-code/client/src/index.ts'
-// import { browserAuth } from '@lix-js/server' // auth client should be part of lix client
// rememeber: what if the changes come from the filesystme form other process, only reacting in here does not help there
const files = new Map()
diff --git a/lix/packages/server/package.json b/lix/packages/server/package.json
index 10ec4570e5..022e074d13 100644
--- a/lix/packages/server/package.json
+++ b/lix/packages/server/package.json
@@ -3,9 +3,6 @@
"type": "module",
"version": "1.1.3",
"private": true,
- "exports": {
- ".": "./dist/index.js"
- },
"files": [
"./dist",
"./src"
diff --git a/lix/packages/server/src/index.ts b/lix/packages/server/src/index.ts
deleted file mode 100644
index b009a36fc4..0000000000
--- a/lix/packages/server/src/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { browserAuth, getUser } from "./auth/browser-auth.js"
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 35be14a898..f30ea2a0a2 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -399,9 +399,6 @@ importers:
'@lix-js/fs':
specifier: workspace:*
version: link:../../../lix/packages/fs
- '@lix-js/server':
- specifier: workspace:*
- version: link:../../../lix/packages/server
'@sentry/browser':
specifier: ^7.27.0
version: 7.109.0
@@ -934,9 +931,6 @@ importers:
'@lix-js/fs':
specifier: workspace:*
version: link:../../../lix/packages/fs
- '@lix-js/server':
- specifier: workspace:*
- version: link:../../../lix/packages/server
'@types/express':
specifier: ^4.17.21
version: 4.17.21
@@ -2598,9 +2592,6 @@ importers:
'@lix-js/fs':
specifier: workspace:*
version: link:../../../lix/packages/fs
- '@lix-js/server':
- specifier: workspace:*
- version: link:../../../lix/packages/server
'@sentry/browser':
specifier: ^7.27.0
version: 7.109.0
From 1bcf46de48a39ca660e88dc2213239e751586ad4 Mon Sep 17 00:00:00 2001
From: Martin Lysk
Date: Mon, 15 Apr 2024 12:50:57 +0200
Subject: [PATCH 03/12] ads tsc to all package.json files that didn't do type
checking yet
---
inlang/source-code/editor/package.json | 2 +-
inlang/source-code/github-lint-action/package.json | 2 +-
inlang/source-code/ide-extension/package.json | 2 +-
inlang/source-code/manage/package.json | 4 ++--
inlang/source-code/manage/tsconfig.json | 4 ++++
.../paraglide/paraglide-js-adapter-astro/example/package.json | 2 +-
.../paraglide-js-adapter-rollup/example/package.json | 2 +-
.../paraglide-js-adapter-sveltekit/example/package.json | 2 +-
.../paraglide/paraglide-js-adapter-sveltekit/package.json | 2 +-
.../paraglide/paraglide-js-adapter-vite/example/package.json | 2 +-
.../paraglide-js-adapter-webpack/example/package.json | 2 +-
inlang/source-code/paraglide/paraglide-js/package.json | 2 +-
inlang/source-code/settings-component/package.json | 2 +-
inlang/source-code/website/package.json | 2 +-
lix/packages/exp/package.json | 2 +-
15 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/inlang/source-code/editor/package.json b/inlang/source-code/editor/package.json
index 1cf09816cb..6b543fe135 100644
--- a/inlang/source-code/editor/package.json
+++ b/inlang/source-code/editor/package.json
@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "vite",
- "build": "paraglide-js compile --project ../../../project.inlang && vite build -- --max_old_space_size=1200000",
+ "build": "paraglide-js compile --project ../../../project.inlang && tsc && vite build -- --max_old_space_size=1200000",
"production": "NODE_ENV=production tsx ./src/server/main.ts",
"---- TEST ----------------------------------------------------------": "",
"test": "paraglide-js compile --project ../../../project.inlang && tsc --noEmit",
diff --git a/inlang/source-code/github-lint-action/package.json b/inlang/source-code/github-lint-action/package.json
index 2f3daa8cde..bc797927d2 100644
--- a/inlang/source-code/github-lint-action/package.json
+++ b/inlang/source-code/github-lint-action/package.json
@@ -25,7 +25,7 @@
},
"scripts": {
"dev": "node ./build.js",
- "build": "pnpm run format && esbuild src/index.ts --bundle --platform=node --target=node20 --outfile=dist/index.cjs",
+ "build": "pnpm run format && tsc && esbuild src/index.ts --bundle --platform=node --target=node20 --outfile=dist/index.cjs",
"test": "tsc --noEmit && vitest run --passWithNoTests --coverage --test-timeout=10000",
"lint": "eslint ./src --fix",
"format": "prettier --write **/*.ts",
diff --git a/inlang/source-code/ide-extension/package.json b/inlang/source-code/ide-extension/package.json
index 610e5284c8..3fa7a50471 100644
--- a/inlang/source-code/ide-extension/package.json
+++ b/inlang/source-code/ide-extension/package.json
@@ -143,7 +143,7 @@
},
"scripts": {
"check": "tsc --noEmit",
- "build": "node ./build.js",
+ "build": "tsc && node ./build.js",
"dev": "DEV=true node ./build.js",
"package": "pnpm vsce package --no-dependencies",
"publish": "pnpm vsce publish --no-dependencies",
diff --git a/inlang/source-code/manage/package.json b/inlang/source-code/manage/package.json
index 4bcd2a16e7..4f1c8323d7 100644
--- a/inlang/source-code/manage/package.json
+++ b/inlang/source-code/manage/package.json
@@ -5,10 +5,10 @@
"private": true,
"scripts": {
"dev": "vite",
- "build": "vite build",
+ "build": "tsc && vite build",
"production": "NODE_ENV=production tsx ./src/server/main.ts",
"---- TEST ----------------------------------------------------------": "",
- "lint": "eslint src --fix",
+ "lint": "tsc && eslint src --fix",
"format": "prettier ./src --write",
"clean": "rm -rf ./dist ./node_modules"
},
diff --git a/inlang/source-code/manage/tsconfig.json b/inlang/source-code/manage/tsconfig.json
index 33a51e4c04..76cf3195f1 100644
--- a/inlang/source-code/manage/tsconfig.json
+++ b/inlang/source-code/manage/tsconfig.json
@@ -11,5 +11,9 @@
"outDir": "./dist",
"rootDir": "./src",
"resolveJsonModule": true
+ // Don't check imported libraries for type errors.
+ // The imported libraries might have different settings/whatever.
+ // "skipLibCheck": false,
+ // "skipDefaultLibCheck": false
}
}
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-astro/example/package.json b/inlang/source-code/paraglide/paraglide-js-adapter-astro/example/package.json
index 51461cf155..c835c26c28 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-astro/example/package.json
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-astro/example/package.json
@@ -6,7 +6,7 @@
"scripts": {
"_dev": "astro dev",
"start": "astro dev",
- "build": "paraglide-js compile --project ./project.inlang && astro check && astro build",
+ "build": "paraglide-js compile --project ./project.inlang && tsc && astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-rollup/example/package.json b/inlang/source-code/paraglide/paraglide-js-adapter-rollup/example/package.json
index c1c8710aa2..ed278c9842 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-rollup/example/package.json
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-rollup/example/package.json
@@ -4,7 +4,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
- "build": "rollup src/main.js --config rollup.config.js",
+ "build": "tsc && rollup src/main.js --config rollup.config.js",
"clean": "rm -rf ./dist ./node_modules ./src/paraglide"
},
"devDependencies": {
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/package.json b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/package.json
index 58eabf61c9..2af67cd02d 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/package.json
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/package.json
@@ -5,7 +5,7 @@
"scripts": {
"_dev": "vite dev",
"start": "vite dev",
- "build": "vite build",
+ "build": "tsc && vite build",
"test": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/package.json b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/package.json
index bac0e8c49c..815fc075e4 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/package.json
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/package.json
@@ -15,7 +15,7 @@
"test:with-base": "BASE_PATH=/base vitest run --test-timeout 30000 --dir src",
"test:without-base": "BASE_PATH=\"\" vitest run --test-timeout 30000 --dir src",
"test": "npm run test:with-base && npm run test:without-base",
- "build": "svelte-package -i src -o dist",
+ "build": "tsc && svelte-package -i src -o dist",
"dev": "svelte-package -w -i src -o dist",
"lint": "eslint ./src --fix",
"format": "prettier ./src --write",
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-vite/example/package.json b/inlang/source-code/paraglide/paraglide-js-adapter-vite/example/package.json
index af3364f68a..bb1efe6dfc 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-vite/example/package.json
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-vite/example/package.json
@@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"_dev": "vite dev",
- "build": "vite build",
+ "build": "tsc && vite build",
"clean": "rm -rf ./dist ./node_modules ./src/paraglide"
},
"devDependencies": {
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-webpack/example/package.json b/inlang/source-code/paraglide/paraglide-js-adapter-webpack/example/package.json
index 1198b9bf9c..b46ce5c2aa 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-webpack/example/package.json
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-webpack/example/package.json
@@ -4,7 +4,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
- "build": "webpack --config webpack.config.js",
+ "build": "tsc && webpack --config webpack.config.js",
"clean": "rm -rf ./dist ./node_modules ./src/paraglide"
},
"devDependencies": {
diff --git a/inlang/source-code/paraglide/paraglide-js/package.json b/inlang/source-code/paraglide/paraglide-js/package.json
index d245e81f0a..01168a84cd 100644
--- a/inlang/source-code/paraglide/paraglide-js/package.json
+++ b/inlang/source-code/paraglide/paraglide-js/package.json
@@ -42,7 +42,7 @@
],
"scripts": {
"dev": "vite build --mode development --watch",
- "build": "vite build --mode production",
+ "build": "tsc && vite build --mode production",
"test": "tsc --noEmit --emitDeclarationOnly false && vitest run --coverage ./src/**/*",
"lint": "eslint ./src --fix",
"format": "prettier ./src --write",
diff --git a/inlang/source-code/settings-component/package.json b/inlang/source-code/settings-component/package.json
index bc539c45a0..20ff73561f 100644
--- a/inlang/source-code/settings-component/package.json
+++ b/inlang/source-code/settings-component/package.json
@@ -13,7 +13,7 @@
}
},
"scripts": {
- "build": "pnpm run format && esbuild src/index.ts --bundle --external:node:crypto --format=esm --platform=browser --outfile=dist/index.mjs && tsc --emitDeclarationOnly --declaration --outDir dist",
+ "build": "pnpm run format && tsc && esbuild src/index.ts --bundle --external:node:crypto --format=esm --platform=browser --outfile=dist/index.mjs && tsc --emitDeclarationOnly --declaration --outDir dist",
"format": "prettier --write **/*.ts",
"storybook": "storybook dev -p 6006"
},
diff --git a/inlang/source-code/website/package.json b/inlang/source-code/website/package.json
index a8e7006cc1..df660de367 100644
--- a/inlang/source-code/website/package.json
+++ b/inlang/source-code/website/package.json
@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "vite",
- "build": "node ./scripts/generateSitemap.js && npx @inlang/cli machine translate -f --project ../../../project.inlang --targetLanguageTags fr,it,pt-BR,sk,zh && vite build",
+ "build": "node ./scripts/generateSitemap.js && npx @inlang/cli machine translate -f --project ../../../project.inlang --targetLanguageTags fr,it,pt-BR,sk,zh && tsc && vite build",
"production": "NODE_ENV=production tsx ./src/server/main.ts ",
"---- TEST ----------------------------------------------------------": "",
"test": "paraglide-js compile --project ../../../project.inlang && npx @inlang/cli lint --project ../../../project.inlang --languageTags de,en && tsc --noEmit ",
diff --git a/lix/packages/exp/package.json b/lix/packages/exp/package.json
index a8cbfa8f62..490aa41a94 100644
--- a/lix/packages/exp/package.json
+++ b/lix/packages/exp/package.json
@@ -4,7 +4,7 @@
"type": "module",
"scripts": {
"dev": "vite",
- "build": "vite build",
+ "build": "tsc && vite build",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json"
},
From c9c6a40e508a77951324ddb7e8ad73d428a64969 Mon Sep 17 00:00:00 2001
From: Martin Lysk
Date: Mon, 15 Apr 2024 13:01:00 +0200
Subject: [PATCH 04/12] fixes getUser call
---
inlang/source-code/manage/src/components/InlangUninstall.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/inlang/source-code/manage/src/components/InlangUninstall.ts b/inlang/source-code/manage/src/components/InlangUninstall.ts
index 773158ca59..75b8566b76 100644
--- a/inlang/source-code/manage/src/components/InlangUninstall.ts
+++ b/inlang/source-code/manage/src/components/InlangUninstall.ts
@@ -170,7 +170,7 @@ export class InlangInstall extends TwLitElement {
super.connectedCallback()
this.url = JSON.parse(this.jsonURL)
- const auth = await getUser().catch(() => {
+ const auth = await browserAuth.getUser().catch(() => {
this.authorized = false
})
if (auth) {
From d51d08fdb063cfd96da4c440170935ac90685324 Mon Sep 17 00:00:00 2001
From: Martin Lysk
Date: Mon, 15 Apr 2024 14:08:34 +0200
Subject: [PATCH 05/12] WIP - not compiling - fixing type errors in various
projects
---
.../manage/src/components/InlangManage.ts | 12 +++++-------
inlang/source-code/manage/src/util/TailwindMixin.ts | 6 +++++-
.../src/runtime/hooks/handleRedirects.ts | 6 +++---
.../src/runtime/path-translations/translatePath.ts | 8 ++++----
.../website/src/pages/g/@uid/@id/+onBeforeRender.tsx | 3 ++-
5 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/inlang/source-code/manage/src/components/InlangManage.ts b/inlang/source-code/manage/src/components/InlangManage.ts
index 60572cab7e..fffad28d2d 100644
--- a/inlang/source-code/manage/src/components/InlangManage.ts
+++ b/inlang/source-code/manage/src/components/InlangManage.ts
@@ -267,7 +267,7 @@ export class InlangManage extends TwLitElement {
}
async removeLanguageTag(languageTag: string) {
- if (typeof this.user === "undefined") return
+ if (typeof this.user === "undefined" || this.user === "load") return
this.languageTags = this.languageTags?.map((tag) => {
if (tag.name === languageTag) {
@@ -335,8 +335,8 @@ export class InlangManage extends TwLitElement {
async addLanguageTag() {
if (this.newLanguageTag === "") return
- if (typeof this.user === "undefined") return
-
+ if (typeof this.user === "undefined" || this.user === "load") return
+
this.newLanguageTagLoading = true
const repo = await openRepository(
@@ -707,7 +707,7 @@ export class InlangManage extends TwLitElement {
To access your projects, please enter the URL of your GitHub repository.
`
- : this.projects !== "load" &&
- this.projects !== "no-access" &&
+ : this.projects !== "no-access" &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.projects!.length === 0
? html`
@@ -876,7 +875,6 @@ export class InlangManage extends TwLitElement {
`
: !this.url.project &&
- this.projects !== "load" &&
this.projects !== "no-access" &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.projects!.length > 0
diff --git a/inlang/source-code/manage/src/util/TailwindMixin.ts b/inlang/source-code/manage/src/util/TailwindMixin.ts
index 0f7d9344bc..e93ec192dc 100644
--- a/inlang/source-code/manage/src/util/TailwindMixin.ts
+++ b/inlang/source-code/manage/src/util/TailwindMixin.ts
@@ -1,5 +1,6 @@
import { adoptStyles, LitElement, unsafeCSS } from "lit"
+// @ts-ignore this did fail on tsc - if we decide to further include tailwind this might get some more investigation
import style from "../styles/tailwind.global.css"
declare global {
@@ -11,7 +12,10 @@ const stylesheet = unsafeCSS(style)
export const TW = (superClass: T): T =>
class extends superClass {
- connectedCallback() {
+ override connectedCallback() {
+ if (!this.shadowRoot) {
+ throw new Error('We expect this.shadowRoot to be defined at that state - if this raises investigate further.')
+ }
super.connectedCallback()
adoptStyles(this.shadowRoot, [stylesheet])
}
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/hooks/handleRedirects.ts b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/hooks/handleRedirects.ts
index 6dc2f675cc..f78537af3e 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/hooks/handleRedirects.ts
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/hooks/handleRedirects.ts
@@ -4,15 +4,15 @@ import { getPathInfo } from "../utils/get-path-info.js"
import { base } from "$app/paths"
import type { Handle, ParamMatcher } from "@sveltejs/kit"
import type { Paraglide } from "../runtime.js"
-import type { PathTranslations } from "../config/pathTranslations.js"
+import { type PathDefinitionTranslations } from "@inlang/paraglide-js/internal/adapter-utils"
/**
* This is a SvelteKit Server hook that rewrites redirects to internal pages to use the correct language.s
*/
export const handleRedirects: (
runtime: Paraglide,
- translations: PathTranslations,
- matchers: Record,
+ translations: PathDefinitionTranslations,
+ matchers: Record
) => Handle =
(runtime, translations, matchers) =>
async ({ event, resolve }) => {
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/path-translations/translatePath.ts b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/path-translations/translatePath.ts
index 559500d523..c5c8e2cdf5 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/path-translations/translatePath.ts
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/path-translations/translatePath.ts
@@ -2,7 +2,7 @@ import { getPathInfo } from "../utils/get-path-info.js"
import { serializeRoute } from "../utils/serialize-path.js"
import { getCanonicalPath } from "./getCanonicalPath.js"
import { getTranslatedPath } from "./getTranslatedPath.js"
-import type { PathTranslations } from "../config/pathTranslations.js"
+import { type PathDefinitionTranslations } from "@inlang/paraglide-js/internal/adapter-utils"
import type { ParamMatcher } from "@sveltejs/kit"
/**
@@ -11,14 +11,14 @@ import type { ParamMatcher } from "@sveltejs/kit"
export function translatePath(
path: string,
targetLanguage: string,
- translations: PathTranslations,
+ translations: PathDefinitionTranslations,
matchers: Record,
opts: {
base: string
availableLanguageTags: readonly string[]
defaultLanguageTag: string
prefixDefaultLanguage: "always" | "never"
- },
+ }
) {
const {
path: targetedPathSource,
@@ -36,7 +36,7 @@ export function translatePath(
canonicalPath,
targetLanguage,
translations,
- matchers,
+ matchers
)
return serializeRoute({
diff --git a/inlang/source-code/website/src/pages/g/@uid/@id/+onBeforeRender.tsx b/inlang/source-code/website/src/pages/g/@uid/@id/+onBeforeRender.tsx
index a11710245f..73641d2315 100644
--- a/inlang/source-code/website/src/pages/g/@uid/@id/+onBeforeRender.tsx
+++ b/inlang/source-code/website/src/pages/g/@uid/@id/+onBeforeRender.tsx
@@ -8,7 +8,8 @@ import { redirect } from "vike/abort"
const repositoryRoot = import.meta.url.slice(0, import.meta.url.lastIndexOf("inlang/source-code"))
-export default async function onBeforeRender(pageContext: PageContext) {
+// We don't need the return type so we dont define the return type further - this function is only used by vite internaly
+export default async function onBeforeRender(pageContext: PageContext): Promise {
const item = registry.find(
(item: any) => item.uniqueID === pageContext.routeParams.uid
) as MarketplaceManifest & { uniqueID: string }
From 3b4a7ef2ae56ffad5cfbbc8190a675b13c4a16b6 Mon Sep 17 00:00:00 2001
From: LorisSigrist
Date: Mon, 15 Apr 2024 14:20:47 +0200
Subject: [PATCH 06/12] Fix SvelteKit Adapter build
---
.../paraglide-js-adapter-sveltekit/example/package.json | 2 +-
.../paraglide-js-adapter-sveltekit/example/src/params/int.js | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/package.json b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/package.json
index 2af67cd02d..63cf5b67d3 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/package.json
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/package.json
@@ -5,7 +5,7 @@
"scripts": {
"_dev": "vite dev",
"start": "vite dev",
- "build": "tsc && vite build",
+ "build": "paraglide-js compile --project ./project.inlang && tsc && vite build",
"test": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/src/params/int.js b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/src/params/int.js
index cc0961e0a6..9c7849edd9 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/src/params/int.js
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/src/params/int.js
@@ -1,4 +1,5 @@
/**
+ * @param {string} param
* @returns {param is number}
*/
export function match(param) {
From eb82e9a804e12b12a776956c666d721215c945ff Mon Sep 17 00:00:00 2001
From: Martin Lysk
Date: Mon, 15 Apr 2024 14:51:16 +0200
Subject: [PATCH 07/12] adds changeset
---
.changeset/six-hotels-yawn.md | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
create mode 100644 .changeset/six-hotels-yawn.md
diff --git a/.changeset/six-hotels-yawn.md b/.changeset/six-hotels-yawn.md
new file mode 100644
index 0000000000..0a60a120fb
--- /dev/null
+++ b/.changeset/six-hotels-yawn.md
@@ -0,0 +1,17 @@
+---
+"@inlang/paraglide-js-adapter-sveltekit-example": patch
+"@inlang/paraglide-js-adapter-webpack-example": patch
+"@inlang/paraglide-js-adapter-rollup-example": patch
+"@inlang/paraglide-js-adapter-astro-example": patch
+"@inlang/paraglide-js-adapter-vite-example": patch
+"@inlang/paraglide-js-adapter-sveltekit": patch
+"@inlang/paraglide-js": patch
+"@inlang/github-lint-action": patch
+"@inlang/settings-component": patch
+"vs-code-extension": patch
+"@inlang/manage": patch
+"@lix-js/client": patch
+"@lix-js/server": patch
+---
+
+- adds typecheck for all packages using non typechecking builds, removes some depenencies from @lix-js/server in favour of @lix-js/client
From 7ded0346407cfb72b2c752e1dfcd56624e428adc Mon Sep 17 00:00:00 2001
From: Martin Lysk
Date: Mon, 15 Apr 2024 14:54:08 +0200
Subject: [PATCH 08/12] removes obsolete comments
---
lix/packages/client/src/browser-auth.ts | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/lix/packages/client/src/browser-auth.ts b/lix/packages/client/src/browser-auth.ts
index 5f3500b9b7..e787dbabd5 100644
--- a/lix/packages/client/src/browser-auth.ts
+++ b/lix/packages/client/src/browser-auth.ts
@@ -1,19 +1,3 @@
-// Promise<{
-// username: string
-// email: string
-// avatarUrl?: string
-// }>
-// // export type LixAuthModule = {
-// // login: () => Promise
-// // logout: () => Promise
-// // getUser: () => Promise<{
-// // username: string
-// // email: string
-// // avatarUrl?: string
-// // }>
-// // addPermissions: () => Promise
-// // }
-
type getAuthClientArgs = {
gitHubProxyBaseUrl: string
githubAppName: string
@@ -153,5 +137,3 @@ type Email = {
verified: boolean
visibility: string | undefined
}
-
-// export const browserAuth: LixAuthModule = { login, logout, getUser, addPermissions }
From cf703953ffee6fec9a8b618cca68a6973da3c3cc Mon Sep 17 00:00:00 2001
From: Martin Lysk
Date: Tue, 16 Apr 2024 11:30:12 +0200
Subject: [PATCH 09/12] reverts build changes in this pr
---
inlang/source-code/editor/package.json | 2 +-
inlang/source-code/github-lint-action/package.json | 2 +-
inlang/source-code/ide-extension/package.json | 2 +-
inlang/source-code/manage/package.json | 4 ++--
inlang/source-code/manage/tsconfig.json | 4 ----
.../paraglide/paraglide-js-adapter-astro/example/package.json | 2 +-
.../paraglide-js-adapter-rollup/example/package.json | 2 +-
.../paraglide-js-adapter-sveltekit/example/package.json | 2 +-
.../paraglide/paraglide-js-adapter-sveltekit/package.json | 2 +-
.../paraglide/paraglide-js-adapter-vite/example/package.json | 2 +-
.../paraglide-js-adapter-webpack/example/package.json | 2 +-
inlang/source-code/paraglide/paraglide-js/package.json | 2 +-
inlang/source-code/settings-component/package.json | 2 +-
inlang/source-code/website/package.json | 2 +-
lix/packages/exp/package.json | 2 +-
15 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/inlang/source-code/editor/package.json b/inlang/source-code/editor/package.json
index 6b543fe135..1cf09816cb 100644
--- a/inlang/source-code/editor/package.json
+++ b/inlang/source-code/editor/package.json
@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "vite",
- "build": "paraglide-js compile --project ../../../project.inlang && tsc && vite build -- --max_old_space_size=1200000",
+ "build": "paraglide-js compile --project ../../../project.inlang && vite build -- --max_old_space_size=1200000",
"production": "NODE_ENV=production tsx ./src/server/main.ts",
"---- TEST ----------------------------------------------------------": "",
"test": "paraglide-js compile --project ../../../project.inlang && tsc --noEmit",
diff --git a/inlang/source-code/github-lint-action/package.json b/inlang/source-code/github-lint-action/package.json
index bc797927d2..2f3daa8cde 100644
--- a/inlang/source-code/github-lint-action/package.json
+++ b/inlang/source-code/github-lint-action/package.json
@@ -25,7 +25,7 @@
},
"scripts": {
"dev": "node ./build.js",
- "build": "pnpm run format && tsc && esbuild src/index.ts --bundle --platform=node --target=node20 --outfile=dist/index.cjs",
+ "build": "pnpm run format && esbuild src/index.ts --bundle --platform=node --target=node20 --outfile=dist/index.cjs",
"test": "tsc --noEmit && vitest run --passWithNoTests --coverage --test-timeout=10000",
"lint": "eslint ./src --fix",
"format": "prettier --write **/*.ts",
diff --git a/inlang/source-code/ide-extension/package.json b/inlang/source-code/ide-extension/package.json
index 3fa7a50471..610e5284c8 100644
--- a/inlang/source-code/ide-extension/package.json
+++ b/inlang/source-code/ide-extension/package.json
@@ -143,7 +143,7 @@
},
"scripts": {
"check": "tsc --noEmit",
- "build": "tsc && node ./build.js",
+ "build": "node ./build.js",
"dev": "DEV=true node ./build.js",
"package": "pnpm vsce package --no-dependencies",
"publish": "pnpm vsce publish --no-dependencies",
diff --git a/inlang/source-code/manage/package.json b/inlang/source-code/manage/package.json
index 4f1c8323d7..4bcd2a16e7 100644
--- a/inlang/source-code/manage/package.json
+++ b/inlang/source-code/manage/package.json
@@ -5,10 +5,10 @@
"private": true,
"scripts": {
"dev": "vite",
- "build": "tsc && vite build",
+ "build": "vite build",
"production": "NODE_ENV=production tsx ./src/server/main.ts",
"---- TEST ----------------------------------------------------------": "",
- "lint": "tsc && eslint src --fix",
+ "lint": "eslint src --fix",
"format": "prettier ./src --write",
"clean": "rm -rf ./dist ./node_modules"
},
diff --git a/inlang/source-code/manage/tsconfig.json b/inlang/source-code/manage/tsconfig.json
index 76cf3195f1..33a51e4c04 100644
--- a/inlang/source-code/manage/tsconfig.json
+++ b/inlang/source-code/manage/tsconfig.json
@@ -11,9 +11,5 @@
"outDir": "./dist",
"rootDir": "./src",
"resolveJsonModule": true
- // Don't check imported libraries for type errors.
- // The imported libraries might have different settings/whatever.
- // "skipLibCheck": false,
- // "skipDefaultLibCheck": false
}
}
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-astro/example/package.json b/inlang/source-code/paraglide/paraglide-js-adapter-astro/example/package.json
index c835c26c28..51461cf155 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-astro/example/package.json
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-astro/example/package.json
@@ -6,7 +6,7 @@
"scripts": {
"_dev": "astro dev",
"start": "astro dev",
- "build": "paraglide-js compile --project ./project.inlang && tsc && astro check && astro build",
+ "build": "paraglide-js compile --project ./project.inlang && astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-rollup/example/package.json b/inlang/source-code/paraglide/paraglide-js-adapter-rollup/example/package.json
index ed278c9842..c1c8710aa2 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-rollup/example/package.json
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-rollup/example/package.json
@@ -4,7 +4,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
- "build": "tsc && rollup src/main.js --config rollup.config.js",
+ "build": "rollup src/main.js --config rollup.config.js",
"clean": "rm -rf ./dist ./node_modules ./src/paraglide"
},
"devDependencies": {
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/package.json b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/package.json
index 63cf5b67d3..58eabf61c9 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/package.json
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/example/package.json
@@ -5,7 +5,7 @@
"scripts": {
"_dev": "vite dev",
"start": "vite dev",
- "build": "paraglide-js compile --project ./project.inlang && tsc && vite build",
+ "build": "vite build",
"test": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/package.json b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/package.json
index 815fc075e4..bac0e8c49c 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/package.json
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/package.json
@@ -15,7 +15,7 @@
"test:with-base": "BASE_PATH=/base vitest run --test-timeout 30000 --dir src",
"test:without-base": "BASE_PATH=\"\" vitest run --test-timeout 30000 --dir src",
"test": "npm run test:with-base && npm run test:without-base",
- "build": "tsc && svelte-package -i src -o dist",
+ "build": "svelte-package -i src -o dist",
"dev": "svelte-package -w -i src -o dist",
"lint": "eslint ./src --fix",
"format": "prettier ./src --write",
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-vite/example/package.json b/inlang/source-code/paraglide/paraglide-js-adapter-vite/example/package.json
index bb1efe6dfc..af3364f68a 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-vite/example/package.json
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-vite/example/package.json
@@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"_dev": "vite dev",
- "build": "tsc && vite build",
+ "build": "vite build",
"clean": "rm -rf ./dist ./node_modules ./src/paraglide"
},
"devDependencies": {
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-webpack/example/package.json b/inlang/source-code/paraglide/paraglide-js-adapter-webpack/example/package.json
index b46ce5c2aa..1198b9bf9c 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-webpack/example/package.json
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-webpack/example/package.json
@@ -4,7 +4,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
- "build": "tsc && webpack --config webpack.config.js",
+ "build": "webpack --config webpack.config.js",
"clean": "rm -rf ./dist ./node_modules ./src/paraglide"
},
"devDependencies": {
diff --git a/inlang/source-code/paraglide/paraglide-js/package.json b/inlang/source-code/paraglide/paraglide-js/package.json
index 01168a84cd..d245e81f0a 100644
--- a/inlang/source-code/paraglide/paraglide-js/package.json
+++ b/inlang/source-code/paraglide/paraglide-js/package.json
@@ -42,7 +42,7 @@
],
"scripts": {
"dev": "vite build --mode development --watch",
- "build": "tsc && vite build --mode production",
+ "build": "vite build --mode production",
"test": "tsc --noEmit --emitDeclarationOnly false && vitest run --coverage ./src/**/*",
"lint": "eslint ./src --fix",
"format": "prettier ./src --write",
diff --git a/inlang/source-code/settings-component/package.json b/inlang/source-code/settings-component/package.json
index 20ff73561f..bc539c45a0 100644
--- a/inlang/source-code/settings-component/package.json
+++ b/inlang/source-code/settings-component/package.json
@@ -13,7 +13,7 @@
}
},
"scripts": {
- "build": "pnpm run format && tsc && esbuild src/index.ts --bundle --external:node:crypto --format=esm --platform=browser --outfile=dist/index.mjs && tsc --emitDeclarationOnly --declaration --outDir dist",
+ "build": "pnpm run format && esbuild src/index.ts --bundle --external:node:crypto --format=esm --platform=browser --outfile=dist/index.mjs && tsc --emitDeclarationOnly --declaration --outDir dist",
"format": "prettier --write **/*.ts",
"storybook": "storybook dev -p 6006"
},
diff --git a/inlang/source-code/website/package.json b/inlang/source-code/website/package.json
index df660de367..a8e7006cc1 100644
--- a/inlang/source-code/website/package.json
+++ b/inlang/source-code/website/package.json
@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "vite",
- "build": "node ./scripts/generateSitemap.js && npx @inlang/cli machine translate -f --project ../../../project.inlang --targetLanguageTags fr,it,pt-BR,sk,zh && tsc && vite build",
+ "build": "node ./scripts/generateSitemap.js && npx @inlang/cli machine translate -f --project ../../../project.inlang --targetLanguageTags fr,it,pt-BR,sk,zh && vite build",
"production": "NODE_ENV=production tsx ./src/server/main.ts ",
"---- TEST ----------------------------------------------------------": "",
"test": "paraglide-js compile --project ../../../project.inlang && npx @inlang/cli lint --project ../../../project.inlang --languageTags de,en && tsc --noEmit ",
diff --git a/lix/packages/exp/package.json b/lix/packages/exp/package.json
index 490aa41a94..a8cbfa8f62 100644
--- a/lix/packages/exp/package.json
+++ b/lix/packages/exp/package.json
@@ -4,7 +4,7 @@
"type": "module",
"scripts": {
"dev": "vite",
- "build": "tsc && vite build",
+ "build": "vite build",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json"
},
From fe2b49a8f68fbfeb8dfc9cae3797d1bf0cc0e934 Mon Sep 17 00:00:00 2001
From: Martin Lysk
Date: Tue, 16 Apr 2024 11:46:53 +0200
Subject: [PATCH 10/12] removes changelogs again for now
---
.changeset/six-hotels-yawn.md | 17 -----------------
1 file changed, 17 deletions(-)
delete mode 100644 .changeset/six-hotels-yawn.md
diff --git a/.changeset/six-hotels-yawn.md b/.changeset/six-hotels-yawn.md
deleted file mode 100644
index 0a60a120fb..0000000000
--- a/.changeset/six-hotels-yawn.md
+++ /dev/null
@@ -1,17 +0,0 @@
----
-"@inlang/paraglide-js-adapter-sveltekit-example": patch
-"@inlang/paraglide-js-adapter-webpack-example": patch
-"@inlang/paraglide-js-adapter-rollup-example": patch
-"@inlang/paraglide-js-adapter-astro-example": patch
-"@inlang/paraglide-js-adapter-vite-example": patch
-"@inlang/paraglide-js-adapter-sveltekit": patch
-"@inlang/paraglide-js": patch
-"@inlang/github-lint-action": patch
-"@inlang/settings-component": patch
-"vs-code-extension": patch
-"@inlang/manage": patch
-"@lix-js/client": patch
-"@lix-js/server": patch
----
-
-- adds typecheck for all packages using non typechecking builds, removes some depenencies from @lix-js/server in favour of @lix-js/client
From 6ac628e779e6d047118572d6d8c88bb5f1d5a3d3 Mon Sep 17 00:00:00 2001
From: Martin Lysk
Date: Tue, 16 Apr 2024 12:02:36 +0200
Subject: [PATCH 11/12] Revert "WIP - not compiling - fixing type errors in
various projects"
This reverts commit d51d08fdb063cfd96da4c440170935ac90685324.
---
.../manage/src/components/InlangManage.ts | 12 +++++++-----
inlang/source-code/manage/src/util/TailwindMixin.ts | 6 +-----
.../src/runtime/hooks/handleRedirects.ts | 6 +++---
.../src/runtime/path-translations/translatePath.ts | 8 ++++----
.../website/src/pages/g/@uid/@id/+onBeforeRender.tsx | 3 +--
5 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/inlang/source-code/manage/src/components/InlangManage.ts b/inlang/source-code/manage/src/components/InlangManage.ts
index fffad28d2d..60572cab7e 100644
--- a/inlang/source-code/manage/src/components/InlangManage.ts
+++ b/inlang/source-code/manage/src/components/InlangManage.ts
@@ -267,7 +267,7 @@ export class InlangManage extends TwLitElement {
}
async removeLanguageTag(languageTag: string) {
- if (typeof this.user === "undefined" || this.user === "load") return
+ if (typeof this.user === "undefined") return
this.languageTags = this.languageTags?.map((tag) => {
if (tag.name === languageTag) {
@@ -335,8 +335,8 @@ export class InlangManage extends TwLitElement {
async addLanguageTag() {
if (this.newLanguageTag === "") return
- if (typeof this.user === "undefined" || this.user === "load") return
-
+ if (typeof this.user === "undefined") return
+
this.newLanguageTagLoading = true
const repo = await openRepository(
@@ -707,7 +707,7 @@ export class InlangManage extends TwLitElement {
To access your projects, please enter the URL of your GitHub repository.
`
- : this.projects !== "no-access" &&
+ : this.projects !== "load" &&
+ this.projects !== "no-access" &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.projects!.length === 0
? html`
@@ -875,6 +876,7 @@ export class InlangManage extends TwLitElement {
`
: !this.url.project &&
+ this.projects !== "load" &&
this.projects !== "no-access" &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.projects!.length > 0
diff --git a/inlang/source-code/manage/src/util/TailwindMixin.ts b/inlang/source-code/manage/src/util/TailwindMixin.ts
index e93ec192dc..0f7d9344bc 100644
--- a/inlang/source-code/manage/src/util/TailwindMixin.ts
+++ b/inlang/source-code/manage/src/util/TailwindMixin.ts
@@ -1,6 +1,5 @@
import { adoptStyles, LitElement, unsafeCSS } from "lit"
-// @ts-ignore this did fail on tsc - if we decide to further include tailwind this might get some more investigation
import style from "../styles/tailwind.global.css"
declare global {
@@ -12,10 +11,7 @@ const stylesheet = unsafeCSS(style)
export const TW = (superClass: T): T =>
class extends superClass {
- override connectedCallback() {
- if (!this.shadowRoot) {
- throw new Error('We expect this.shadowRoot to be defined at that state - if this raises investigate further.')
- }
+ connectedCallback() {
super.connectedCallback()
adoptStyles(this.shadowRoot, [stylesheet])
}
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/hooks/handleRedirects.ts b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/hooks/handleRedirects.ts
index f78537af3e..6dc2f675cc 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/hooks/handleRedirects.ts
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/hooks/handleRedirects.ts
@@ -4,15 +4,15 @@ import { getPathInfo } from "../utils/get-path-info.js"
import { base } from "$app/paths"
import type { Handle, ParamMatcher } from "@sveltejs/kit"
import type { Paraglide } from "../runtime.js"
-import { type PathDefinitionTranslations } from "@inlang/paraglide-js/internal/adapter-utils"
+import type { PathTranslations } from "../config/pathTranslations.js"
/**
* This is a SvelteKit Server hook that rewrites redirects to internal pages to use the correct language.s
*/
export const handleRedirects: (
runtime: Paraglide,
- translations: PathDefinitionTranslations,
- matchers: Record
+ translations: PathTranslations,
+ matchers: Record,
) => Handle =
(runtime, translations, matchers) =>
async ({ event, resolve }) => {
diff --git a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/path-translations/translatePath.ts b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/path-translations/translatePath.ts
index c5c8e2cdf5..559500d523 100644
--- a/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/path-translations/translatePath.ts
+++ b/inlang/source-code/paraglide/paraglide-js-adapter-sveltekit/src/runtime/path-translations/translatePath.ts
@@ -2,7 +2,7 @@ import { getPathInfo } from "../utils/get-path-info.js"
import { serializeRoute } from "../utils/serialize-path.js"
import { getCanonicalPath } from "./getCanonicalPath.js"
import { getTranslatedPath } from "./getTranslatedPath.js"
-import { type PathDefinitionTranslations } from "@inlang/paraglide-js/internal/adapter-utils"
+import type { PathTranslations } from "../config/pathTranslations.js"
import type { ParamMatcher } from "@sveltejs/kit"
/**
@@ -11,14 +11,14 @@ import type { ParamMatcher } from "@sveltejs/kit"
export function translatePath(
path: string,
targetLanguage: string,
- translations: PathDefinitionTranslations,
+ translations: PathTranslations,
matchers: Record,
opts: {
base: string
availableLanguageTags: readonly string[]
defaultLanguageTag: string
prefixDefaultLanguage: "always" | "never"
- }
+ },
) {
const {
path: targetedPathSource,
@@ -36,7 +36,7 @@ export function translatePath(
canonicalPath,
targetLanguage,
translations,
- matchers
+ matchers,
)
return serializeRoute({
diff --git a/inlang/source-code/website/src/pages/g/@uid/@id/+onBeforeRender.tsx b/inlang/source-code/website/src/pages/g/@uid/@id/+onBeforeRender.tsx
index 73641d2315..a11710245f 100644
--- a/inlang/source-code/website/src/pages/g/@uid/@id/+onBeforeRender.tsx
+++ b/inlang/source-code/website/src/pages/g/@uid/@id/+onBeforeRender.tsx
@@ -8,8 +8,7 @@ import { redirect } from "vike/abort"
const repositoryRoot = import.meta.url.slice(0, import.meta.url.lastIndexOf("inlang/source-code"))
-// We don't need the return type so we dont define the return type further - this function is only used by vite internaly
-export default async function onBeforeRender(pageContext: PageContext): Promise {
+export default async function onBeforeRender(pageContext: PageContext) {
const item = registry.find(
(item: any) => item.uniqueID === pageContext.routeParams.uid
) as MarketplaceManifest & { uniqueID: string }
From 4941ca4d4b13cd0069e51622222615e7e1718595 Mon Sep 17 00:00:00 2001
From: Martin Lysk
Date: Tue, 16 Apr 2024 12:14:40 +0200
Subject: [PATCH 12/12] adds change log
---
.changeset/ten-suns-allow.md | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 .changeset/ten-suns-allow.md
diff --git a/.changeset/ten-suns-allow.md b/.changeset/ten-suns-allow.md
new file mode 100644
index 0000000000..d9124014f3
--- /dev/null
+++ b/.changeset/ten-suns-allow.md
@@ -0,0 +1,7 @@
+---
+"@inlang/manage": patch
+"@lix-js/client": patch
+"@lix-js/server": patch
+---
+
+Moves getAuthClient from @lix-js/server to @lix-js/client and allows to inject ENV vars to make the pagacke independent from the env it runs in