Skip to content

Commit

Permalink
Merge branch 'main' of github.com:opral/monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
NilsJacobsen committed Oct 28, 2024
2 parents a81f40a + 3b600ea commit b855a9d
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 20 deletions.
16 changes: 16 additions & 0 deletions cla-signatures.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,22 @@
"created_at": "2024-10-21T15:18:34Z",
"repoId": 394757291,
"pullRequestNo": 3183
},
{
"name": "alikia2x",
"id": 87868889,
"comment_id": 2438671259,
"created_at": "2024-10-25T19:45:33Z",
"repoId": 394757291,
"pullRequestNo": 3187
},
{
"name": "tconroy",
"id": 1609336,
"comment_id": 2439717856,
"created_at": "2024-10-26T19:50:43Z",
"repoId": 394757291,
"pullRequestNo": 3188
}
]
}
8 changes: 8 additions & 0 deletions inlang/source-code/paraglide/paraglide-sveltekit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @inlang/paraglide-sveltekit

## 0.11.5

### Patch Changes

- bc1e49e: Fixes a silent runtime bug for load functions that depent on paraglide. See https://github.com/opral/monorepo/pull/3184 and https://discord.com/channels/897438559458430986/1297558489182375978/1297645584210985021.

It's a regression bug of `0.11.2` and `0.11.3`.

## 0.11.4

### Patch Changes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @inlang/paraglide-sveltekit-example

## 0.1.76

### Patch Changes

- Updated dependencies [bc1e49e]
- @inlang/paraglide-sveltekit@0.11.5

## 0.1.75

### Patch Changes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inlang/paraglide-sveltekit-example",
"version": "0.1.75",
"version": "0.1.76",
"private": true,
"scripts": {
"_dev": "vite dev",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inlang/paraglide-sveltekit",
"version": "0.11.4",
"version": "0.11.5",
"type": "module",
"main": "./dist/runtime/index.js",
"types": "./dist/runtime/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
export const NO_TRANSLATE_ATTRIBUTE = "data-no-translate"

/** The key with which `invalidate` is called when the language changes */
export const LANGUAGE_CHANGE_INVALIDATION_KEY = "paraglide_lang"
export const LANGUAGE_CHANGE_INVALIDATION_KEY = "paraglide:lang"

/** The name of the cookie in which the language is stored */
export const LANG_COOKIE_NAME = "paraglide_lang"
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { URL } from "node:url"
import { describe, expect, it } from "vitest"
import * as constants from "./constants"

const DEPENDS_TYPE_REGEX = /^.*:.*$/
// eslint-disable-next-line no-control-regex
const COOKIE_NAME_REGEX = /^((?![()<>@,;:"\\/[\]?={} \x09])[\x20-\x7E])+$/

describe("LANGUAGE_CHANGE_INVALIDATION_KEY", () => {
it("is a valid URL", () => {
expect(() => new URL(constants.LANGUAGE_CHANGE_INVALIDATION_KEY)).not.toThrowError()
})
it("conforms to the type of LoadEvent#depends", () => {
expect(constants.LANGUAGE_CHANGE_INVALIDATION_KEY).toMatch(DEPENDS_TYPE_REGEX)
})
})

describe("LANG_COOKIE_NAME", () => {
it("is a valid cookie name", () => {
expect(constants.LANG_COOKIE_NAME).toMatch(COOKIE_NAME_REGEX)
})
})
53 changes: 38 additions & 15 deletions lix/website/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from "@remix-run/react"
import { Links, Meta, Outlet, Scripts, ScrollRestoration, useLoaderData } from "@remix-run/react"
import type { LinksFunction } from "@remix-run/node"

import { useEffect } from "react"
import { posthog } from "posthog-js"
import "./tailwind.css"

export async function loader() {
return { PUBLIC_POSTHOG_TOKEN: process.env.PUBLIC_POSTHOG_TOKEN }
}

export const links: LinksFunction = () => [
{ rel: "preconnect", href: "https://fonts.googleapis.com" },
{
Expand All @@ -22,20 +27,38 @@ export const links: LinksFunction = () => [
]

export function Layout({ children }: { children: React.ReactNode }) {
const env = useLoaderData<typeof loader>()

useEffect(() => {
if (typeof window !== "undefined" && env.PUBLIC_POSTHOG_TOKEN) {
posthog.init(env.PUBLIC_POSTHOG_TOKEN ?? "", {
api_host: import.meta.env.PROD ? "https://tm.inlang.com" : "http://localhost:4005",
capture_performance: false,
autocapture: {
capture_copied_text: true,
},
})
posthog.capture("$pageview")
}
return () => posthog.reset()
}, [])

return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
{children}
<ScrollRestoration />
<Scripts />
</body>
</html>
<>
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
{children}
<ScrollRestoration />
<Scripts />
</body>
</html>
</>
)
}

Expand Down
4 changes: 2 additions & 2 deletions lix/website/app/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ export default function Index() {
Public preview launching, Dec 16
<a
className="group text-cyan-600 hover:text-black border border-slate-200 mx-6 flex gap-2 items-center py-1 px-3 rounded-md bg-white"
href="https://forms.gle/FyWRB2nHRbYV3NVV7"
target="_blank"
href="https://forms.gle/cR3iDsUB7DEygJaZ8"
>
Get notified
<IconArrowExternal />
Expand All @@ -184,7 +184,7 @@ export default function Index() {
<div className="flex flex-wrap-reverse items-center gap-2">
<a
href="https://opral.substack.com/"
target="_blanc"
target="_blank"
className="w-full sm:w-fit px-4 py-2 text-white bg-cyan-600 hover:bg-cyan-700 rounded-md font-medium flex justify-center items-center gap-2 transition-all"
>
Get updates
Expand Down
1 change: 1 addition & 0 deletions lix/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@remix-run/react": "^2.12.1",
"@remix-run/serve": "^2.12.1",
"isbot": "^4.1.0",
"posthog-js": "^1.91.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"remix-utils": "^7.7.0"
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions render.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ services:
buildCommand: pnpm --filter lix-website i && pnpm --filter lix-website build
startCommand: NX_REJECT_UNKNOWN_LOCAL_CACHE=0 pnpm --filter lix-website start
autoDeploy: true
envVars:
- fromGroup: production
- key: PORT
value: 3002
buildFilter:
paths:
- lix/website/**
Expand Down

0 comments on commit b855a9d

Please sign in to comment.