lingo.dev 0.90.1 → 0.90.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/cli.cjs +113 -48
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +110 -45
- package/build/cli.mjs.map +1 -1
- package/package.json +3 -3
package/build/cli.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/cli/index.ts
|
|
2
2
|
import dotenv from "dotenv";
|
|
3
3
|
import { InteractiveCommand as InteractiveCommand2 } from "interactive-commander";
|
|
4
|
-
import
|
|
5
|
-
import { vice } from "gradient-string";
|
|
4
|
+
import figlet2 from "figlet";
|
|
5
|
+
import { vice as vice2 } from "gradient-string";
|
|
6
6
|
|
|
7
7
|
// src/cli/cmd/auth.ts
|
|
8
8
|
import { Command } from "interactive-commander";
|
|
@@ -1357,12 +1357,7 @@ function createAndroidLoader() {
|
|
|
1357
1357
|
}
|
|
1358
1358
|
const cdataRegex = /<!\[CDATA\[([\s\S]*?)\]\]>/g;
|
|
1359
1359
|
value = value.replace(cdataRegex, (match, content) => content);
|
|
1360
|
-
value = value.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'");
|
|
1361
|
-
if (value.startsWith('"') && value.endsWith('"') && value.length >= 2) {
|
|
1362
|
-
value = value.substring(1, value.length - 1);
|
|
1363
|
-
} else {
|
|
1364
|
-
value = value === "" || /^\s+$/.test(value) ? value : value.trim();
|
|
1365
|
-
}
|
|
1360
|
+
value = value.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'").replace(/\\'/g, "'");
|
|
1366
1361
|
result[name] = value;
|
|
1367
1362
|
}
|
|
1368
1363
|
const parsed = await parseStringPromise(input2, {
|
|
@@ -1394,7 +1389,9 @@ function createAndroidLoader() {
|
|
|
1394
1389
|
} else if (item._ === "") {
|
|
1395
1390
|
itemValue = "";
|
|
1396
1391
|
}
|
|
1397
|
-
items.push(
|
|
1392
|
+
items.push(
|
|
1393
|
+
itemValue === "" || /^\s+$/.test(itemValue) ? itemValue : itemValue.trim()
|
|
1394
|
+
);
|
|
1398
1395
|
});
|
|
1399
1396
|
}
|
|
1400
1397
|
result[name] = items;
|
|
@@ -1463,9 +1460,8 @@ function createAndroidLoader() {
|
|
|
1463
1460
|
};
|
|
1464
1461
|
const processHtmlContent = (str) => {
|
|
1465
1462
|
if (typeof str !== "string") return { _: String(str) };
|
|
1466
|
-
const
|
|
1467
|
-
|
|
1468
|
-
return { _: str };
|
|
1463
|
+
const processedStr = str.replace(/'/g, "\\'");
|
|
1464
|
+
return { _: processedStr };
|
|
1469
1465
|
};
|
|
1470
1466
|
for (const [key, value] of Object.entries(payload)) {
|
|
1471
1467
|
if (typeof value === "string") {
|
|
@@ -4966,22 +4962,6 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
4966
4962
|
}
|
|
4967
4963
|
return true;
|
|
4968
4964
|
}
|
|
4969
|
-
async returnToOriginalBranch() {
|
|
4970
|
-
const originalBranch = this.platformKit.platformConfig.baseBranchName;
|
|
4971
|
-
if (originalBranch) {
|
|
4972
|
-
this.ora.start(`Returning to original branch: ${originalBranch}`);
|
|
4973
|
-
try {
|
|
4974
|
-
execSync(`git checkout ${originalBranch}`, {
|
|
4975
|
-
stdio: "inherit",
|
|
4976
|
-
encoding: "utf8"
|
|
4977
|
-
});
|
|
4978
|
-
this.ora.succeed(`Returned to original branch: ${originalBranch}`);
|
|
4979
|
-
} catch (error) {
|
|
4980
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
4981
|
-
this.ora.fail(`Failed to return to original branch: ${errorMessage}`);
|
|
4982
|
-
}
|
|
4983
|
-
}
|
|
4984
|
-
}
|
|
4985
4965
|
};
|
|
4986
4966
|
|
|
4987
4967
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
@@ -5529,7 +5509,24 @@ var getPlatformKit = () => {
|
|
|
5529
5509
|
};
|
|
5530
5510
|
|
|
5531
5511
|
// src/cli/cmd/ci/index.ts
|
|
5532
|
-
|
|
5512
|
+
import inquirer3 from "inquirer";
|
|
5513
|
+
var ci_default = new Command10().command("ci").description("Run Lingo.dev CI/CD action").helpOption("-h, --help", "Show help").option("--api-key <key>", "API key").option("--pull-request [boolean]", "Create a pull request with the changes").option("--commit-message <message>", "Commit message").option("--pull-request-title <title>", "Pull request title").option("--working-directory <dir>", "Working directory").option(
|
|
5514
|
+
"--process-own-commits [boolean]",
|
|
5515
|
+
"Process commits made by this action"
|
|
5516
|
+
).option(
|
|
5517
|
+
"--debug",
|
|
5518
|
+
"Debug mode. Wait for user input before continuing.",
|
|
5519
|
+
false
|
|
5520
|
+
).action(async (options) => {
|
|
5521
|
+
if (options.debug) {
|
|
5522
|
+
const { debug } = await inquirer3.prompt([
|
|
5523
|
+
{
|
|
5524
|
+
type: "confirm",
|
|
5525
|
+
name: "debug",
|
|
5526
|
+
message: "Debug mode. Wait for user input before continuing."
|
|
5527
|
+
}
|
|
5528
|
+
]);
|
|
5529
|
+
}
|
|
5533
5530
|
const settings = getSettings(options.apiKey);
|
|
5534
5531
|
if (!settings.auth.apiKey) {
|
|
5535
5532
|
console.error("No API key provided");
|
|
@@ -5566,19 +5563,15 @@ var ci_default = new Command10().command("ci").description("Run Lingo.dev CI/CD
|
|
|
5566
5563
|
const { isPullRequestMode } = platformKit.config;
|
|
5567
5564
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
5568
5565
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
return;
|
|
5573
|
-
}
|
|
5574
|
-
const hasChanges = await flow.run();
|
|
5575
|
-
if (!hasChanges) {
|
|
5576
|
-
return;
|
|
5577
|
-
}
|
|
5578
|
-
await flow.postRun?.();
|
|
5579
|
-
} finally {
|
|
5580
|
-
await flow.returnToOriginalBranch?.();
|
|
5566
|
+
const canRun = await flow.preRun?.();
|
|
5567
|
+
if (canRun === false) {
|
|
5568
|
+
return;
|
|
5581
5569
|
}
|
|
5570
|
+
const hasChanges = await flow.run();
|
|
5571
|
+
if (!hasChanges) {
|
|
5572
|
+
return;
|
|
5573
|
+
}
|
|
5574
|
+
await flow.postRun?.();
|
|
5582
5575
|
});
|
|
5583
5576
|
|
|
5584
5577
|
// src/cli/cmd/status.ts
|
|
@@ -5998,10 +5991,82 @@ function validateParams2(i18nConfig, flags) {
|
|
|
5998
5991
|
}
|
|
5999
5992
|
}
|
|
6000
5993
|
|
|
5994
|
+
// src/cli/cmd/may-the-fourth.ts
|
|
5995
|
+
import { Command as Command12 } from "interactive-commander";
|
|
5996
|
+
import * as cp from "node:child_process";
|
|
5997
|
+
import figlet from "figlet";
|
|
5998
|
+
import chalk3 from "chalk";
|
|
5999
|
+
import { vice } from "gradient-string";
|
|
6000
|
+
var colors = {
|
|
6001
|
+
orange: "#ff6600",
|
|
6002
|
+
green: "#6ae300",
|
|
6003
|
+
blue: "#0090ff",
|
|
6004
|
+
yellow: "#ffcc00",
|
|
6005
|
+
grey: "#808080",
|
|
6006
|
+
red: "#ff0000"
|
|
6007
|
+
};
|
|
6008
|
+
var may_the_fourth_default = new Command12().command("may-the-fourth").description("May the Fourth be with you").helpOption("-h, --help", "Show help").action(async () => {
|
|
6009
|
+
await renderClear();
|
|
6010
|
+
await renderBanner();
|
|
6011
|
+
await renderSpacer();
|
|
6012
|
+
console.log(chalk3.hex(colors.yellow)("Loading the Star Wars movie..."));
|
|
6013
|
+
await renderSpacer();
|
|
6014
|
+
await new Promise((resolve, reject) => {
|
|
6015
|
+
const ssh = cp.spawn("ssh", ["starwarstel.net"], {
|
|
6016
|
+
stdio: "inherit"
|
|
6017
|
+
});
|
|
6018
|
+
ssh.on("close", (code) => {
|
|
6019
|
+
if (code !== 0) {
|
|
6020
|
+
console.error(`SSH process exited with code ${code}`);
|
|
6021
|
+
}
|
|
6022
|
+
resolve();
|
|
6023
|
+
});
|
|
6024
|
+
ssh.on("error", (err) => {
|
|
6025
|
+
console.error("Failed to start SSH process:", err);
|
|
6026
|
+
reject(err);
|
|
6027
|
+
});
|
|
6028
|
+
});
|
|
6029
|
+
await renderSpacer();
|
|
6030
|
+
console.log(
|
|
6031
|
+
`${chalk3.hex(colors.green)("We hope you enjoyed it! :)")} ${chalk3.hex(colors.blue)("May the Fourth be with you! \u{1F680}")}`
|
|
6032
|
+
);
|
|
6033
|
+
await renderSpacer();
|
|
6034
|
+
console.log(chalk3.dim(`---`));
|
|
6035
|
+
await renderSpacer();
|
|
6036
|
+
await renderHero();
|
|
6037
|
+
});
|
|
6038
|
+
async function renderClear() {
|
|
6039
|
+
console.log("\x1Bc");
|
|
6040
|
+
}
|
|
6041
|
+
async function renderSpacer() {
|
|
6042
|
+
console.log(" ");
|
|
6043
|
+
}
|
|
6044
|
+
async function renderBanner() {
|
|
6045
|
+
console.log(
|
|
6046
|
+
vice(
|
|
6047
|
+
figlet.textSync("LINGO.DEV", {
|
|
6048
|
+
font: "ANSI Shadow",
|
|
6049
|
+
horizontalLayout: "default",
|
|
6050
|
+
verticalLayout: "default"
|
|
6051
|
+
})
|
|
6052
|
+
)
|
|
6053
|
+
);
|
|
6054
|
+
}
|
|
6055
|
+
async function renderHero() {
|
|
6056
|
+
console.log(
|
|
6057
|
+
`\u26A1\uFE0F ${chalk3.hex(colors.green)("Lingo.dev")} - open-source, AI-powered i18n CLI for web & mobile localization.`
|
|
6058
|
+
);
|
|
6059
|
+
console.log(" ");
|
|
6060
|
+
console.log(
|
|
6061
|
+
chalk3.hex(colors.blue)("\u2B50 GitHub Repo: https://lingo.dev/go/gh")
|
|
6062
|
+
);
|
|
6063
|
+
console.log(chalk3.hex(colors.blue)("\u{1F4AC} 24/7 Support: hi@lingo.dev"));
|
|
6064
|
+
}
|
|
6065
|
+
|
|
6001
6066
|
// package.json
|
|
6002
6067
|
var package_default = {
|
|
6003
6068
|
name: "lingo.dev",
|
|
6004
|
-
version: "0.90.
|
|
6069
|
+
version: "0.90.3",
|
|
6005
6070
|
description: "Lingo.dev CLI",
|
|
6006
6071
|
private: false,
|
|
6007
6072
|
publishConfig: {
|
|
@@ -6158,8 +6223,8 @@ dotenv.config();
|
|
|
6158
6223
|
var cli_default = new InteractiveCommand2().name("lingo.dev").description("Lingo.dev CLI").helpOption("-h, --help", "Show help").addHelpText(
|
|
6159
6224
|
"beforeAll",
|
|
6160
6225
|
`
|
|
6161
|
-
${
|
|
6162
|
-
|
|
6226
|
+
${vice2(
|
|
6227
|
+
figlet2.textSync("LINGO.DEV", {
|
|
6163
6228
|
font: "ANSI Shadow",
|
|
6164
6229
|
horizontalLayout: "default",
|
|
6165
6230
|
verticalLayout: "default"
|
|
@@ -6170,7 +6235,7 @@ ${vice(
|
|
|
6170
6235
|
|
|
6171
6236
|
Star the the repo :) https://github.com/LingoDotDev/lingo.dev
|
|
6172
6237
|
`
|
|
6173
|
-
).version(`v${package_default.version}`, "-v, --version", "Show version").addCommand(init_default).interactive("-y, --no-interactive", "Disable interactive mode").addCommand(i18n_default).addCommand(auth_default).addCommand(show_default).addCommand(lockfile_default).addCommand(cleanup_default).addCommand(mcp_default).addCommand(ci_default).addCommand(status_default).exitOverride((err) => {
|
|
6238
|
+
).version(`v${package_default.version}`, "-v, --version", "Show version").addCommand(init_default).interactive("-y, --no-interactive", "Disable interactive mode").addCommand(i18n_default).addCommand(auth_default).addCommand(show_default).addCommand(lockfile_default).addCommand(cleanup_default).addCommand(mcp_default).addCommand(ci_default).addCommand(status_default).addCommand(may_the_fourth_default, { hidden: true }).exitOverride((err) => {
|
|
6174
6239
|
if (err.code === "commander.helpDisplayed" || err.code === "commander.version" || err.code === "commander.help") {
|
|
6175
6240
|
process.exit(0);
|
|
6176
6241
|
}
|