Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support mjs and ts config #26

Merged
merged 4 commits into from
Dec 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Bump version
pontusab committed Dec 27, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit f0a79690bd7b57718362557dc7167c4f19b3dc1d
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/expo/app.json
Original file line number Diff line number Diff line change
@@ -46,4 +46,4 @@
"es": "./locales/native/es.json"
}
}
}
}
4 changes: 2 additions & 2 deletions examples/expo/languine.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from "languine";

export default defineConfig({
version: "0.6.6",
version: "0.6.9",
locale: {
source: "en",
targets: ["es"],
@@ -15,4 +15,4 @@ export default defineConfig({
provider: "openai",
model: "gpt-4-turbo",
},
});
};)
1 change: 1 addition & 0 deletions examples/expo/package.json
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@
"expo-system-ui": "~4.0.6",
"expo-web-browser": "~14.0.1",
"i18n-js": "^4.5.1",
"languine": "^0.6.9",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-native": "0.76.5",
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "languine",
"version": "0.6.9",
"version": "7.0.0",
"type": "module",
"bin": "dist/index.js",
"main": "dist/config.js",
4 changes: 2 additions & 2 deletions packages/cli/src/presets/expo.ts
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ async function installDependencies() {

const shouldInstall = await confirm({
message:
"Would you like to install required dependencies (i18n-js, expo-localization)?",
"Would you like to install required dependencies (i18n-js, expo-localization, languine)?",
});

if (!shouldInstall) {
@@ -48,7 +48,7 @@ async function installDependencies() {
s.start("Installing dependencies...");
try {
const pm = await findPreferredPM();
await execAsync(`${pm?.name} install i18n-js`);
await execAsync(`${pm?.name} install i18n-js languine`);
await execAsync("npx expo install expo-localization");

s.stop("Dependencies installed successfully");
6 changes: 3 additions & 3 deletions packages/cli/src/utils.ts
Original file line number Diff line number Diff line change
@@ -94,13 +94,13 @@ export function generateConfig({
files: {
${formatKey}: {
include: [${filesPatterns.map((p) => `"${p}"`).join(", ")}],
}
},
},
llm: {
provider: "${provider}",
model: "${model}",
}
}`;
},
};`;

if (configType === "mjs") {
return `export default ${configBody}`;