-
Notifications
You must be signed in to change notification settings - Fork 837
feat: vNext migration #2035
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
feat: vNext migration #2035
Changes from all commits
c5e6be3
bad84aa
0a38c54
844b36d
0bd2cfc
fa9fa63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| "@lingo.dev/compiler": minor | ||
| "@lingo.dev/_compiler": minor | ||
| "@lingo.dev/_spec": minor | ||
| "lingo.dev": minor | ||
| "@lingo.dev/_sdk": minor | ||
| --- | ||
|
|
||
| Migrate SDK and CLI to unified API endpoints. All requests now use `api.lingo.dev` with `X-API-Key` auth. Added `engineId` config option (auto-migrated from `vNext`) |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -50,18 +50,18 @@ export default async function setup(input: CmdRunContext) { | |||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| title: "Selecting localization provider", | ||||||||||||||||||||||||
| task: async (ctx, task) => { | ||||||||||||||||||||||||
| const isPseudo = ctx.flags.pseudo || ctx.config?.dev?.usePseudotranslator; | ||||||||||||||||||||||||
| const isPseudo = | ||||||||||||||||||||||||
| ctx.flags.pseudo || ctx.config?.dev?.usePseudotranslator; | ||||||||||||||||||||||||
| const provider = isPseudo ? "pseudo" : ctx.config?.provider; | ||||||||||||||||||||||||
| const vNext = ctx.config?.vNext; | ||||||||||||||||||||||||
| ctx.localizer = createLocalizer(provider, ctx.flags.apiKey, vNext); | ||||||||||||||||||||||||
| const engineId = ctx.config?.engineId; | ||||||||||||||||||||||||
| ctx.localizer = createLocalizer(provider, engineId, ctx.flags.apiKey); | ||||||||||||||||||||||||
| if (!ctx.localizer) { | ||||||||||||||||||||||||
| throw new Error( | ||||||||||||||||||||||||
| "Could not create localization provider. Please check your i18n.json configuration.", | ||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| task.title = | ||||||||||||||||||||||||
| ctx.localizer.id === "Lingo.dev" || | ||||||||||||||||||||||||
| ctx.localizer.id === "Lingo.dev vNext" | ||||||||||||||||||||||||
| ctx.localizer.id === "Lingo.dev" | ||||||||||||||||||||||||
| ? `Using ${chalk.hex(colors.green)(ctx.localizer.id)} provider` | ||||||||||||||||||||||||
| : ctx.localizer.id === "pseudo" | ||||||||||||||||||||||||
| ? `Using ${chalk.hex(colors.blue)("pseudo")} mode for testing` | ||||||||||||||||||||||||
|
|
@@ -71,8 +71,7 @@ export default async function setup(input: CmdRunContext) { | |||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| title: "Checking authentication", | ||||||||||||||||||||||||
| enabled: (ctx) => | ||||||||||||||||||||||||
| (ctx.localizer?.id === "Lingo.dev" || | ||||||||||||||||||||||||
| ctx.localizer?.id === "Lingo.dev vNext") && | ||||||||||||||||||||||||
| ctx.localizer?.id === "Lingo.dev" && | ||||||||||||||||||||||||
| !ctx.flags.pseudo && | ||||||||||||||||||||||||
| !ctx.config?.dev?.usePseudotranslator, | ||||||||||||||||||||||||
| task: async (ctx, task) => { | ||||||||||||||||||||||||
|
|
@@ -87,9 +86,7 @@ export default async function setup(input: CmdRunContext) { | |||||||||||||||||||||||
| }, | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| title: "Validating configuration", | ||||||||||||||||||||||||
| enabled: (ctx) => | ||||||||||||||||||||||||
| ctx.localizer?.id !== "Lingo.dev" && | ||||||||||||||||||||||||
| ctx.localizer?.id !== "Lingo.dev vNext", | ||||||||||||||||||||||||
| enabled: (ctx) => ctx.localizer?.id !== "Lingo.dev", | ||||||||||||||||||||||||
| task: async (ctx, task) => { | ||||||||||||||||||||||||
| const validationStatus = await ctx.localizer!.validateSettings!(); | ||||||||||||||||||||||||
| if (!validationStatus.valid) { | ||||||||||||||||||||||||
|
Comment on lines
+89
to
92
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pseudo mode can crash in configuration validation. At Line 89, the task is enabled for 🧩 Proposed fix {
title: "Validating configuration",
- enabled: (ctx) => ctx.localizer?.id !== "Lingo.dev",
+ enabled: (ctx) =>
+ ctx.localizer?.id !== "Lingo.dev" &&
+ ctx.localizer?.id !== "pseudo" &&
+ !!ctx.localizer?.validateSettings,
task: async (ctx, task) => {
const validationStatus = await ctx.localizer!.validateSettings!();
if (!validationStatus.valid) {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
@@ -103,9 +100,7 @@ export default async function setup(input: CmdRunContext) { | |||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| title: "Initializing localization provider", | ||||||||||||||||||||||||
| async task(ctx, task) { | ||||||||||||||||||||||||
| const isLingoDotDev = | ||||||||||||||||||||||||
| ctx.localizer!.id === "Lingo.dev" || | ||||||||||||||||||||||||
| ctx.localizer!.id === "Lingo.dev vNext"; | ||||||||||||||||||||||||
| const isLingoDotDev = ctx.localizer!.id === "Lingo.dev"; | ||||||||||||||||||||||||
| const isPseudo = ctx.localizer!.id === "pseudo"; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| const subTasks = isLingoDotDev | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auth failures should fail CI with non-zero exit code.
At Line 93 and Line 104, early
returnexits successfully. CI can pass even when authentication is missing/invalid.🛠️ Proposed fix
if (!settings.auth.apiKey) { console.error( "No API key provided. Set LINGODOTDEV_API_KEY environment variable or use --api-key flag.", ); + process.exitCode = 1; return; } @@ const auth = await authenticator.whoami(); if (!auth) { console.error("Not authenticated"); + process.exitCode = 1; return; }Also applies to: 101-105
🤖 Prompt for AI Agents