Skip to content

Commit

Permalink
Merge pull request #9 from fuma-nama/main
Browse files Browse the repository at this point in the history
Add Markdown Support & Translator Model
  • Loading branch information
pontusab authored Dec 25, 2024
2 parents c0ef5d2 + 37c7369 commit b06b375
Show file tree
Hide file tree
Showing 46 changed files with 1,153 additions and 195 deletions.
2 changes: 1 addition & 1 deletion apps/web/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
"hooks": "@/hooks"
},
"iconLibrary": "lucide"
}
}
6 changes: 3 additions & 3 deletions apps/web/src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
return twMerge(clsx(inputs));
}
47 changes: 24 additions & 23 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"ignore": ["node_modules"],
"enabled": true,
"rules": {
"recommended": true,
"a11y": {
"noSvgWithoutTitle": "off",
"useKeyWithClickEvents": "off"
},
"style": {
"noNonNullAssertion": "off"
},
"correctness": {
"useExhaustiveDependencies": "off"
}
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"ignore": ["node_modules"],
"enabled": true,
"rules": {
"recommended": true,
"a11y": {
"noSvgWithoutTitle": "off",
"useKeyWithClickEvents": "off"
},
"style": {
"noNonNullAssertion": "off"
},
"correctness": {
"useExhaustiveDependencies": "off"
}
},
"formatter": {
"indentStyle": "space"
}
}
},
"formatter": {
"indentStyle": "space",
"ignore": ["test/resources", "test/snapshots"]
}
}
Binary file modified bun.lockb
Binary file not shown.
12 changes: 6 additions & 6 deletions examples/i18next/languine.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ export default {
version: "1.0.0",
locale: {
source: "en",
targets: ["sv"]
targets: ["sv"],
},
files: {
json: {
include: ["locales/[locale].json"]
}
include: ["locales/[locale].json"],
},
},
openai: {
model: "gpt-4-turbo"
}
}
model: "gpt-4-turbo",
},
};
2 changes: 1 addition & 1 deletion examples/i18next/locales/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"interpolated": "Ha en trevlig dag, {{name}}!",
"pluralKey_one": "Det här är ett fint exempel.",
"pluralKey_other": "Det här är fina exempel."
}
}
12 changes: 6 additions & 6 deletions examples/next-intl/languine.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ export default {
version: "1.0.0",
locale: {
source: "en",
targets: ["de"]
targets: ["de"],
},
files: {
json: {
include: ["messages/[locale].json"]
}
include: ["messages/[locale].json"],
},
},
openai: {
model: "gpt-4-turbo"
}
}
model: "gpt-4-turbo",
},
};
2 changes: 1 addition & 1 deletion examples/next-intl/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"number": "Verfügbar ab {price, number, currency}",
"date": "Bestellt am {orderDate, date, medium}"
}
}
}
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
"clean": "git clean -xdf node_modules",
"clean:workspaces": "turbo clean",
"dev": "turbo dev --parallel",
"test": "turbo test --parallel",
"test": "vitest",
"format": "biome format --write .",
"lint": "turbo lint && manypkg check",
"typecheck": "turbo typecheck"
},
"dependencies": {
"packageManager": "[email protected]",
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@types/bun": "^1.1.14",
"@types/node": "^22.10.2",
"turbo": "2.3.3",
"typescript": "^5.7.2"
},
"packageManager": "[email protected]"
"typescript": "^5.7.2",
"vitest": "^2.1.8"
}
}
4 changes: 3 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"lint": "biome check .",
"format": "biome format --write .",
"typecheck": "tsc --noEmit",
"test": "bun test src",
"build": "tsup src/index.ts --format esm --dts --clean",
"dev": "tsup src/index.ts --format esm --watch --clean",
"start": "node dist/index.js"
Expand All @@ -21,10 +20,13 @@
"ai": "^4.0.22",
"chalk": "^5.4.1",
"dedent": "^1.5.3",
"diff": "^7.0.0",
"dotenv": "^16.4.7",
"simple-git": "^3.27.0",
"zod": "^3.24.1"
},
"devDependencies": {
"@types/diff": "^6.0.0",
"tsup": "^8.3.5",
"typescript": "^5.7.2"
}
Expand Down
18 changes: 12 additions & 6 deletions packages/cli/src/commands/diff.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { execSync } from "node:child_process";
import { intro, outro } from "@clack/prompts";
import chalk from "chalk";
import { extractChangedKeys, getConfig } from "../utils.js";
import { getConfig } from "../utils.js";

export async function diff() {
intro("Checking for changes in source locale file...");
Expand All @@ -25,25 +25,31 @@ export async function diff() {
process.exit(0);
}

const { addedKeys, removedKeys } = extractChangedKeys(diff);
let added = 0,
removed = 0;

if (addedKeys.length === 0 && removedKeys.length === 0) {
for (const line of diff.split("\n")) {
if (line.startsWith("+") && !line.startsWith("+++")) added++;
else if (line.startsWith("-") && !line.startsWith("---")) removed++;
}

if (added === 0 && removed === 0) {
outro(
chalk.yellow("No translation keys were added, modified or removed."),
);
process.exit(0);
}

const totalChanges = addedKeys.length + removedKeys.length;
const totalChanges = added + removed;
outro(
chalk.blue(
`Found ${totalChanges} translation key${totalChanges === 1 ? "" : "s"} changed`,
),
);

return {
addedKeys,
removedKeys,
addedKeys: [],
removedKeys: [],
};
} catch (error) {
outro(chalk.red("Failed to check for changes"));
Expand Down
Loading

0 comments on commit b06b375

Please sign in to comment.