Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 71f47f9037 |
@@ -2,13 +2,8 @@ name: Monorepo Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { isValidLang } from "../src/index";
|
||||
import { isValidLang } from "./lang";
|
||||
|
||||
describe("next-utils", () => {
|
||||
it("should validate languages correctly", () => {
|
||||
|
||||
@@ -30,12 +30,7 @@ export async function rateLimit(
|
||||
submissions[identifier] = now;
|
||||
}
|
||||
|
||||
export const languages = ["en", "de"] as const;
|
||||
export type Lang = (typeof languages)[number];
|
||||
|
||||
export function isValidLang(lang: string): lang is Lang {
|
||||
return (languages as readonly string[]).includes(lang);
|
||||
}
|
||||
export * from "./lang";
|
||||
|
||||
export * from "./i18n";
|
||||
export * from "./env";
|
||||
|
||||
6
packages/next-utils/src/lang.ts
Normal file
6
packages/next-utils/src/lang.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export const languages = ["en", "de"] as const;
|
||||
export type Lang = (typeof languages)[number];
|
||||
|
||||
export function isValidLang(lang: string): lang is Lang {
|
||||
return (languages as readonly string[]).includes(lang);
|
||||
}
|
||||
Reference in New Issue
Block a user