lingo.dev 0.88.0 → 0.89.1
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 -0
- package/build/cli.cjs +190 -84
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +189 -83
- package/build/cli.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -172,5 +172,6 @@ Want to contribute? Create a pull request!
|
|
|
172
172
|
- [Italian](/readme/it.md)
|
|
173
173
|
- [Arabic](/readme/ar.md)
|
|
174
174
|
- [Hindi](/readme/hi.md)
|
|
175
|
+
- [Bengali](/readme/bn.md)
|
|
175
176
|
|
|
176
177
|
Don't see your language? Just add a new language code to the [`i18n.json`](./i18n.json) file and open a PR.
|
package/build/cli.cjs
CHANGED
|
@@ -3733,6 +3733,19 @@ async function trackEvent(distinctId, event, properties) {
|
|
|
3733
3733
|
return;
|
|
3734
3734
|
}
|
|
3735
3735
|
try {
|
|
3736
|
+
const safeProperties = properties ? JSON.parse(JSON.stringify(
|
|
3737
|
+
properties,
|
|
3738
|
+
(key, value) => {
|
|
3739
|
+
if (value instanceof Error) {
|
|
3740
|
+
return {
|
|
3741
|
+
name: value.name,
|
|
3742
|
+
message: value.message,
|
|
3743
|
+
stack: value.stack
|
|
3744
|
+
};
|
|
3745
|
+
}
|
|
3746
|
+
return value;
|
|
3747
|
+
}
|
|
3748
|
+
)) : {};
|
|
3736
3749
|
const posthog = new PostHog("phc_eR0iSoQufBxNY36k0f0T15UvHJdTfHlh8rJcxsfhfXk", {
|
|
3737
3750
|
host: "https://eu.i.posthog.com",
|
|
3738
3751
|
flushAt: 1,
|
|
@@ -3742,7 +3755,7 @@ async function trackEvent(distinctId, event, properties) {
|
|
|
3742
3755
|
distinctId,
|
|
3743
3756
|
event,
|
|
3744
3757
|
properties: {
|
|
3745
|
-
...
|
|
3758
|
+
...safeProperties,
|
|
3746
3759
|
meta: {
|
|
3747
3760
|
version: process.env.npm_package_version,
|
|
3748
3761
|
isCi: process.env.CI === "true"
|
|
@@ -4746,20 +4759,18 @@ var mcp_default = new (0, _interactivecommander.Command)().command("mcp").descri
|
|
|
4746
4759
|
console.log("Lingo.dev MCP Server running on stdio");
|
|
4747
4760
|
});
|
|
4748
4761
|
|
|
4749
|
-
// src/cli/cmd/ci.ts
|
|
4750
|
-
|
|
4762
|
+
// src/cli/cmd/ci/index.ts
|
|
4751
4763
|
|
|
4752
|
-
// ../../action/src/main.ts
|
|
4753
4764
|
|
|
4754
4765
|
|
|
4755
|
-
//
|
|
4766
|
+
// src/cli/cmd/ci/flows/pull-request.ts
|
|
4756
4767
|
var _child_process = require('child_process');
|
|
4757
4768
|
|
|
4758
|
-
//
|
|
4769
|
+
// src/cli/cmd/ci/flows/in-branch.ts
|
|
4759
4770
|
|
|
4760
4771
|
|
|
4761
4772
|
|
|
4762
|
-
//
|
|
4773
|
+
// src/cli/cmd/ci/flows/_base.ts
|
|
4763
4774
|
var IntegrationFlow = class {
|
|
4764
4775
|
constructor(ora, platformKit) {
|
|
4765
4776
|
this.ora = ora;
|
|
@@ -4772,7 +4783,7 @@ var gitConfig = {
|
|
|
4772
4783
|
userEmail: "support@lingo.dev"
|
|
4773
4784
|
};
|
|
4774
4785
|
|
|
4775
|
-
//
|
|
4786
|
+
// src/cli/cmd/ci/flows/in-branch.ts
|
|
4776
4787
|
var InBranchFlow = class extends IntegrationFlow {
|
|
4777
4788
|
async preRun() {
|
|
4778
4789
|
this.ora.start("Configuring git");
|
|
@@ -4798,9 +4809,12 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
4798
4809
|
this.ora.succeed("Changes committed");
|
|
4799
4810
|
this.ora.start("Pushing changes to remote");
|
|
4800
4811
|
const currentBranch = _nullishCoalesce(this.i18nBranchName, () => ( this.platformKit.platformConfig.baseBranchName));
|
|
4801
|
-
_child_process.execSync.call(void 0,
|
|
4802
|
-
|
|
4803
|
-
|
|
4812
|
+
_child_process.execSync.call(void 0,
|
|
4813
|
+
`git push origin ${currentBranch} ${forcePush ? "--force" : ""}`,
|
|
4814
|
+
{
|
|
4815
|
+
stdio: "inherit"
|
|
4816
|
+
}
|
|
4817
|
+
);
|
|
4804
4818
|
this.ora.succeed("Changes pushed to remote");
|
|
4805
4819
|
}
|
|
4806
4820
|
return hasChanges;
|
|
@@ -4811,7 +4825,14 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
4811
4825
|
}).length > 0;
|
|
4812
4826
|
}
|
|
4813
4827
|
async runLingoDotDev() {
|
|
4814
|
-
|
|
4828
|
+
try {
|
|
4829
|
+
await i18n_default.exitOverride().parseAsync(["--api-key", this.platformKit.config.replexicaApiKey], {
|
|
4830
|
+
from: "user"
|
|
4831
|
+
});
|
|
4832
|
+
} catch (err) {
|
|
4833
|
+
if (err.code === "commander.helpDisplayed") return;
|
|
4834
|
+
throw err;
|
|
4835
|
+
}
|
|
4815
4836
|
}
|
|
4816
4837
|
configureGit() {
|
|
4817
4838
|
const { processOwnCommits } = this.platformKit.config;
|
|
@@ -4827,7 +4848,9 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
4827
4848
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
4828
4849
|
if (!processOwnCommits) {
|
|
4829
4850
|
const currentAuthor = `${gitConfig.userName} <${gitConfig.userEmail}>`;
|
|
4830
|
-
const authorOfLastCommit = _child_process.execSync.call(void 0,
|
|
4851
|
+
const authorOfLastCommit = _child_process.execSync.call(void 0,
|
|
4852
|
+
`git log -1 --pretty=format:'%an <%ae>'`
|
|
4853
|
+
).toString();
|
|
4831
4854
|
if (authorOfLastCommit === currentAuthor) {
|
|
4832
4855
|
this.ora.warn(
|
|
4833
4856
|
`The last commit was already made by ${currentAuthor}, so this run will be skipped, as running again would have no effect. See docs: https://docs.lingo.dev/ci-action/overview`
|
|
@@ -4835,16 +4858,21 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
4835
4858
|
return false;
|
|
4836
4859
|
}
|
|
4837
4860
|
}
|
|
4838
|
-
const workingDir = path14.default.resolve(
|
|
4861
|
+
const workingDir = path14.default.resolve(
|
|
4862
|
+
process.cwd(),
|
|
4863
|
+
this.platformKit.config.workingDir
|
|
4864
|
+
);
|
|
4839
4865
|
if (workingDir !== process.cwd()) {
|
|
4840
|
-
this.ora.info(
|
|
4866
|
+
this.ora.info(
|
|
4867
|
+
`Changing to working directory: ${this.platformKit.config.workingDir}`
|
|
4868
|
+
);
|
|
4841
4869
|
process.chdir(workingDir);
|
|
4842
4870
|
}
|
|
4843
4871
|
return true;
|
|
4844
4872
|
}
|
|
4845
4873
|
};
|
|
4846
4874
|
|
|
4847
|
-
//
|
|
4875
|
+
// src/cli/cmd/ci/flows/pull-request.ts
|
|
4848
4876
|
var PullRequestFlow = class extends InBranchFlow {
|
|
4849
4877
|
async preRun() {
|
|
4850
4878
|
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _167 => _167()]);
|
|
@@ -4853,7 +4881,9 @@ var PullRequestFlow = class extends InBranchFlow {
|
|
|
4853
4881
|
}
|
|
4854
4882
|
this.ora.start("Calculating automated branch name");
|
|
4855
4883
|
this.i18nBranchName = this.calculatePrBranchName();
|
|
4856
|
-
this.ora.succeed(
|
|
4884
|
+
this.ora.succeed(
|
|
4885
|
+
`Automated branch name calculated: ${this.i18nBranchName}`
|
|
4886
|
+
);
|
|
4857
4887
|
this.ora.start("Checking if branch exists");
|
|
4858
4888
|
const branchExists = await this.checkBranchExistance(this.i18nBranchName);
|
|
4859
4889
|
this.ora.succeed(branchExists ? "Branch exists" : "Branch does not exist");
|
|
@@ -4861,7 +4891,9 @@ var PullRequestFlow = class extends InBranchFlow {
|
|
|
4861
4891
|
this.ora.start(`Checking out branch ${this.i18nBranchName}`);
|
|
4862
4892
|
this.checkoutI18nBranch(this.i18nBranchName);
|
|
4863
4893
|
this.ora.succeed(`Checked out branch ${this.i18nBranchName}`);
|
|
4864
|
-
this.ora.start(
|
|
4894
|
+
this.ora.start(
|
|
4895
|
+
`Syncing with ${this.platformKit.platformConfig.baseBranchName}`
|
|
4896
|
+
);
|
|
4865
4897
|
this.syncI18nBranch();
|
|
4866
4898
|
this.ora.succeed(`Checked out and synced branch ${this.i18nBranchName}`);
|
|
4867
4899
|
} else {
|
|
@@ -4876,11 +4908,15 @@ var PullRequestFlow = class extends InBranchFlow {
|
|
|
4876
4908
|
}
|
|
4877
4909
|
async postRun() {
|
|
4878
4910
|
if (!this.i18nBranchName) {
|
|
4879
|
-
throw new Error(
|
|
4911
|
+
throw new Error(
|
|
4912
|
+
"i18nBranchName is not set. Did you forget to call preRun?"
|
|
4913
|
+
);
|
|
4880
4914
|
}
|
|
4881
4915
|
this.ora.start("Checking if PR already exists");
|
|
4882
4916
|
const pullRequestNumber = await this.ensureFreshPr(this.i18nBranchName);
|
|
4883
|
-
this.ora.succeed(
|
|
4917
|
+
this.ora.succeed(
|
|
4918
|
+
`Pull request ready: ${this.platformKit.buildPullRequestUrl(pullRequestNumber)}`
|
|
4919
|
+
);
|
|
4884
4920
|
}
|
|
4885
4921
|
calculatePrBranchName() {
|
|
4886
4922
|
return `lingo.dev/${this.platformKit.platformConfig.baseBranchName}`;
|
|
@@ -4918,10 +4954,16 @@ var PullRequestFlow = class extends InBranchFlow {
|
|
|
4918
4954
|
}
|
|
4919
4955
|
createI18nBranch(i18nBranchName) {
|
|
4920
4956
|
try {
|
|
4921
|
-
_child_process.execSync.call(void 0,
|
|
4922
|
-
|
|
4923
|
-
stdio: "inherit"
|
|
4924
|
-
|
|
4957
|
+
_child_process.execSync.call(void 0,
|
|
4958
|
+
`git fetch origin ${this.platformKit.platformConfig.baseBranchName}`,
|
|
4959
|
+
{ stdio: "inherit" }
|
|
4960
|
+
);
|
|
4961
|
+
_child_process.execSync.call(void 0,
|
|
4962
|
+
`git checkout -b ${i18nBranchName} origin/${this.platformKit.platformConfig.baseBranchName}`,
|
|
4963
|
+
{
|
|
4964
|
+
stdio: "inherit"
|
|
4965
|
+
}
|
|
4966
|
+
);
|
|
4925
4967
|
} catch (error) {
|
|
4926
4968
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
4927
4969
|
this.ora.fail(`Failed to create branch: ${errorMessage}`);
|
|
@@ -4938,21 +4980,38 @@ var PullRequestFlow = class extends InBranchFlow {
|
|
|
4938
4980
|
if (!this.i18nBranchName) {
|
|
4939
4981
|
throw new Error("i18nBranchName is not set");
|
|
4940
4982
|
}
|
|
4941
|
-
this.ora.start(
|
|
4942
|
-
|
|
4943
|
-
|
|
4983
|
+
this.ora.start(
|
|
4984
|
+
`Fetching latest changes from ${this.platformKit.platformConfig.baseBranchName}`
|
|
4985
|
+
);
|
|
4986
|
+
_child_process.execSync.call(void 0,
|
|
4987
|
+
`git fetch origin ${this.platformKit.platformConfig.baseBranchName}`,
|
|
4988
|
+
{ stdio: "inherit" }
|
|
4989
|
+
);
|
|
4990
|
+
this.ora.succeed(
|
|
4991
|
+
`Fetched latest changes from ${this.platformKit.platformConfig.baseBranchName}`
|
|
4992
|
+
);
|
|
4944
4993
|
try {
|
|
4945
4994
|
this.ora.start("Attempting to rebase branch");
|
|
4946
|
-
_child_process.execSync.call(void 0,
|
|
4995
|
+
_child_process.execSync.call(void 0,
|
|
4996
|
+
`git rebase origin/${this.platformKit.platformConfig.baseBranchName}`,
|
|
4997
|
+
{ stdio: "inherit" }
|
|
4998
|
+
);
|
|
4947
4999
|
this.ora.succeed("Successfully rebased branch");
|
|
4948
5000
|
} catch (error) {
|
|
4949
5001
|
this.ora.warn("Rebase failed, falling back to alternative sync method");
|
|
4950
5002
|
this.ora.start("Aborting failed rebase");
|
|
4951
5003
|
_child_process.execSync.call(void 0, "git rebase --abort", { stdio: "inherit" });
|
|
4952
5004
|
this.ora.succeed("Aborted failed rebase");
|
|
4953
|
-
this.ora.start(
|
|
4954
|
-
|
|
4955
|
-
|
|
5005
|
+
this.ora.start(
|
|
5006
|
+
`Resetting to ${this.platformKit.platformConfig.baseBranchName}`
|
|
5007
|
+
);
|
|
5008
|
+
_child_process.execSync.call(void 0,
|
|
5009
|
+
`git reset --hard origin/${this.platformKit.platformConfig.baseBranchName}`,
|
|
5010
|
+
{ stdio: "inherit" }
|
|
5011
|
+
);
|
|
5012
|
+
this.ora.succeed(
|
|
5013
|
+
`Reset to ${this.platformKit.platformConfig.baseBranchName}`
|
|
5014
|
+
);
|
|
4956
5015
|
this.ora.start("Restoring target files");
|
|
4957
5016
|
const targetFiles = ["i18n.lock"];
|
|
4958
5017
|
const targetFileNames = _child_process.execSync.call(void 0,
|
|
@@ -4975,9 +5034,12 @@ var PullRequestFlow = class extends InBranchFlow {
|
|
|
4975
5034
|
const hasChanges = this.checkCommitableChanges();
|
|
4976
5035
|
if (hasChanges) {
|
|
4977
5036
|
_child_process.execSync.call(void 0, "git add .", { stdio: "inherit" });
|
|
4978
|
-
_child_process.execSync.call(void 0,
|
|
4979
|
-
|
|
4980
|
-
|
|
5037
|
+
_child_process.execSync.call(void 0,
|
|
5038
|
+
`git commit -m "chore: sync with ${this.platformKit.platformConfig.baseBranchName}"`,
|
|
5039
|
+
{
|
|
5040
|
+
stdio: "inherit"
|
|
5041
|
+
}
|
|
5042
|
+
);
|
|
4981
5043
|
this.ora.succeed("Committed additional changes");
|
|
4982
5044
|
} else {
|
|
4983
5045
|
this.ora.succeed("No changes to commit");
|
|
@@ -5003,12 +5065,12 @@ Hey team,
|
|
|
5003
5065
|
}
|
|
5004
5066
|
};
|
|
5005
5067
|
|
|
5006
|
-
//
|
|
5068
|
+
// src/cli/cmd/ci/platforms/bitbucket.ts
|
|
5007
5069
|
|
|
5008
5070
|
var _bitbucket = require('bitbucket'); var _bitbucket2 = _interopRequireDefault(_bitbucket);
|
|
5009
5071
|
|
|
5010
5072
|
|
|
5011
|
-
//
|
|
5073
|
+
// src/cli/cmd/ci/platforms/_base.ts
|
|
5012
5074
|
|
|
5013
5075
|
|
|
5014
5076
|
var defaultMessage = "feat: update translations via @lingodotdev";
|
|
@@ -5040,7 +5102,7 @@ var PlatformKit = class {
|
|
|
5040
5102
|
}
|
|
5041
5103
|
};
|
|
5042
5104
|
|
|
5043
|
-
//
|
|
5105
|
+
// src/cli/cmd/ci/platforms/bitbucket.ts
|
|
5044
5106
|
var { Bitbucket } = _bitbucket2.default;
|
|
5045
5107
|
var BitbucketPlatformKit = class extends PlatformKit {
|
|
5046
5108
|
|
|
@@ -5077,7 +5139,11 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
5077
5139
|
pull_request_id: pullRequestNumber
|
|
5078
5140
|
});
|
|
5079
5141
|
}
|
|
5080
|
-
async createPullRequest({
|
|
5142
|
+
async createPullRequest({
|
|
5143
|
+
title,
|
|
5144
|
+
body,
|
|
5145
|
+
head
|
|
5146
|
+
}) {
|
|
5081
5147
|
return await this.bb.repositories.createPullRequest({
|
|
5082
5148
|
workspace: this.platformConfig.repositoryOwner,
|
|
5083
5149
|
repo_slug: this.platformConfig.repositoryName,
|
|
@@ -5089,7 +5155,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
5089
5155
|
}
|
|
5090
5156
|
}).then(({ data }) => _nullishCoalesce(data.id, () => ( 0)));
|
|
5091
5157
|
}
|
|
5092
|
-
async commentOnPullRequest({
|
|
5158
|
+
async commentOnPullRequest({
|
|
5159
|
+
pullRequestNumber,
|
|
5160
|
+
body
|
|
5161
|
+
}) {
|
|
5093
5162
|
await this.bb.repositories.createPullRequestComment({
|
|
5094
5163
|
workspace: this.platformConfig.repositoryOwner,
|
|
5095
5164
|
repo_slug: this.platformConfig.repositoryName,
|
|
@@ -5105,9 +5174,12 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
5105
5174
|
_child_process.execSync.call(void 0, "git config --unset http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy", {
|
|
5106
5175
|
stdio: "inherit"
|
|
5107
5176
|
});
|
|
5108
|
-
_child_process.execSync.call(void 0,
|
|
5109
|
-
|
|
5110
|
-
|
|
5177
|
+
_child_process.execSync.call(void 0,
|
|
5178
|
+
"git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://host.docker.internal:29418/",
|
|
5179
|
+
{
|
|
5180
|
+
stdio: "inherit"
|
|
5181
|
+
}
|
|
5182
|
+
);
|
|
5111
5183
|
}
|
|
5112
5184
|
get platformConfig() {
|
|
5113
5185
|
const env = _zod2.default.object({
|
|
@@ -5129,7 +5201,7 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
5129
5201
|
}
|
|
5130
5202
|
};
|
|
5131
5203
|
|
|
5132
|
-
//
|
|
5204
|
+
// src/cli/cmd/ci/platforms/github.ts
|
|
5133
5205
|
var _octokit2 = require('octokit');
|
|
5134
5206
|
|
|
5135
5207
|
var GitHubPlatformKit = class extends PlatformKit {
|
|
@@ -5164,7 +5236,11 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
5164
5236
|
state: "closed"
|
|
5165
5237
|
});
|
|
5166
5238
|
}
|
|
5167
|
-
async createPullRequest({
|
|
5239
|
+
async createPullRequest({
|
|
5240
|
+
head,
|
|
5241
|
+
title,
|
|
5242
|
+
body
|
|
5243
|
+
}) {
|
|
5168
5244
|
return await this.octokit.rest.pulls.create({
|
|
5169
5245
|
head,
|
|
5170
5246
|
title,
|
|
@@ -5174,7 +5250,10 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
5174
5250
|
base: this.platformConfig.baseBranchName
|
|
5175
5251
|
}).then(({ data }) => data.number);
|
|
5176
5252
|
}
|
|
5177
|
-
async commentOnPullRequest({
|
|
5253
|
+
async commentOnPullRequest({
|
|
5254
|
+
pullRequestNumber,
|
|
5255
|
+
body
|
|
5256
|
+
}) {
|
|
5178
5257
|
await this.octokit.rest.issues.createComment({
|
|
5179
5258
|
issue_number: pullRequestNumber,
|
|
5180
5259
|
body,
|
|
@@ -5186,7 +5265,9 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
5186
5265
|
const { ghToken, repositoryOwner, repositoryName } = this.platformConfig;
|
|
5187
5266
|
const { processOwnCommits } = this.config;
|
|
5188
5267
|
if (ghToken && processOwnCommits) {
|
|
5189
|
-
console.log(
|
|
5268
|
+
console.log(
|
|
5269
|
+
"Using provided GH_TOKEN. This will trigger your CI/CD pipeline to run again."
|
|
5270
|
+
);
|
|
5190
5271
|
const url = `https://${ghToken}@github.com/${repositoryOwner}/${repositoryName}.git`;
|
|
5191
5272
|
super.gitConfig(ghToken, url);
|
|
5192
5273
|
}
|
|
@@ -5213,7 +5294,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
5213
5294
|
}
|
|
5214
5295
|
};
|
|
5215
5296
|
|
|
5216
|
-
//
|
|
5297
|
+
// src/cli/cmd/ci/platforms/gitlab.ts
|
|
5217
5298
|
var _rest = require('@gitbeaker/rest');
|
|
5218
5299
|
|
|
5219
5300
|
var gl = new (0, _rest.Gitlab)({ token: "" });
|
|
@@ -5255,13 +5336,18 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
5255
5336
|
}
|
|
5256
5337
|
async branchExists({ branch }) {
|
|
5257
5338
|
try {
|
|
5258
|
-
await this.gitlab.Branches.show(
|
|
5339
|
+
await this.gitlab.Branches.show(
|
|
5340
|
+
this.platformConfig.gitlabProjectId,
|
|
5341
|
+
branch
|
|
5342
|
+
);
|
|
5259
5343
|
return true;
|
|
5260
5344
|
} catch (e2) {
|
|
5261
5345
|
return false;
|
|
5262
5346
|
}
|
|
5263
5347
|
}
|
|
5264
|
-
async getOpenPullRequestNumber({
|
|
5348
|
+
async getOpenPullRequestNumber({
|
|
5349
|
+
branch
|
|
5350
|
+
}) {
|
|
5265
5351
|
const mergeRequests = await this.gitlab.MergeRequests.all({
|
|
5266
5352
|
projectId: this.platformConfig.gitlabProjectId,
|
|
5267
5353
|
sourceBranch: branch,
|
|
@@ -5269,12 +5355,22 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
5269
5355
|
});
|
|
5270
5356
|
return _optionalChain([mergeRequests, 'access', _176 => _176[0], 'optionalAccess', _177 => _177.iid]);
|
|
5271
5357
|
}
|
|
5272
|
-
async closePullRequest({
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5358
|
+
async closePullRequest({
|
|
5359
|
+
pullRequestNumber
|
|
5360
|
+
}) {
|
|
5361
|
+
await this.gitlab.MergeRequests.edit(
|
|
5362
|
+
this.platformConfig.gitlabProjectId,
|
|
5363
|
+
pullRequestNumber,
|
|
5364
|
+
{
|
|
5365
|
+
stateEvent: "close"
|
|
5366
|
+
}
|
|
5367
|
+
);
|
|
5276
5368
|
}
|
|
5277
|
-
async createPullRequest({
|
|
5369
|
+
async createPullRequest({
|
|
5370
|
+
head,
|
|
5371
|
+
title,
|
|
5372
|
+
body
|
|
5373
|
+
}) {
|
|
5278
5374
|
const mr = await this.gitlab.MergeRequests.create(
|
|
5279
5375
|
this.platformConfig.gitlabProjectId,
|
|
5280
5376
|
head,
|
|
@@ -5286,8 +5382,15 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
5286
5382
|
);
|
|
5287
5383
|
return mr.iid;
|
|
5288
5384
|
}
|
|
5289
|
-
async commentOnPullRequest({
|
|
5290
|
-
|
|
5385
|
+
async commentOnPullRequest({
|
|
5386
|
+
pullRequestNumber,
|
|
5387
|
+
body
|
|
5388
|
+
}) {
|
|
5389
|
+
await this.gitlab.MergeRequestNotes.create(
|
|
5390
|
+
this.platformConfig.gitlabProjectId,
|
|
5391
|
+
pullRequestNumber,
|
|
5392
|
+
body
|
|
5393
|
+
);
|
|
5291
5394
|
}
|
|
5292
5395
|
gitConfig() {
|
|
5293
5396
|
const glToken = this.platformConfig.glToken;
|
|
@@ -5299,7 +5402,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
5299
5402
|
}
|
|
5300
5403
|
};
|
|
5301
5404
|
|
|
5302
|
-
//
|
|
5405
|
+
// src/cli/cmd/ci/platforms/index.ts
|
|
5303
5406
|
var getPlatformKit = () => {
|
|
5304
5407
|
if (process.env.BITBUCKET_PIPELINE_UUID) {
|
|
5305
5408
|
return new BitbucketPlatformKit();
|
|
@@ -5313,25 +5416,7 @@ var getPlatformKit = () => {
|
|
|
5313
5416
|
throw new Error("This platform is not supported");
|
|
5314
5417
|
};
|
|
5315
5418
|
|
|
5316
|
-
//
|
|
5317
|
-
async function main() {
|
|
5318
|
-
const ora = _ora2.default.call(void 0, );
|
|
5319
|
-
const platformKit = getPlatformKit();
|
|
5320
|
-
const { isPullRequestMode } = platformKit.config;
|
|
5321
|
-
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
5322
|
-
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
5323
|
-
const canRun = await _optionalChain([flow, 'access', _178 => _178.preRun, 'optionalCall', _179 => _179()]);
|
|
5324
|
-
if (canRun === false) {
|
|
5325
|
-
return;
|
|
5326
|
-
}
|
|
5327
|
-
const hasChanges = await flow.run();
|
|
5328
|
-
if (!hasChanges) {
|
|
5329
|
-
return;
|
|
5330
|
-
}
|
|
5331
|
-
await _optionalChain([flow, 'access', _180 => _180.postRun, 'optionalCall', _181 => _181()]);
|
|
5332
|
-
}
|
|
5333
|
-
|
|
5334
|
-
// src/cli/cmd/ci.ts
|
|
5419
|
+
// src/cli/cmd/ci/index.ts
|
|
5335
5420
|
var ci_default = new (0, _interactivecommander.Command)().command("ci").description("Run Lingo.dev CI/CD action").helpOption("-h, --help", "Show help").option("--pull-request", "Create a pull request with the changes", false).option("--commit-message <message>", "Commit message").option("--pull-request-title <title>", "Pull request title").option("--working-directory <dir>", "Working directory").option("--process-own-commits", "Process commits made by this action", false).action(async (options, program) => {
|
|
5336
5421
|
const apiKey = program.args[0];
|
|
5337
5422
|
const settings = getSettings(apiKey);
|
|
@@ -5350,14 +5435,35 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
5350
5435
|
}
|
|
5351
5436
|
const env = {
|
|
5352
5437
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
5353
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
5354
|
-
...options.commitMessage && {
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
...options.
|
|
5438
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _178 => _178.pullRequest, 'optionalAccess', _179 => _179.toString, 'call', _180 => _180()]) || "false",
|
|
5439
|
+
...options.commitMessage && {
|
|
5440
|
+
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
5441
|
+
},
|
|
5442
|
+
...options.pullRequestTitle && {
|
|
5443
|
+
LINGODOTDEV_PULL_REQUEST_TITLE: options.pullRequestTitle
|
|
5444
|
+
},
|
|
5445
|
+
...options.workingDirectory && {
|
|
5446
|
+
LINGODOTDEV_WORKING_DIRECTORY: options.workingDirectory
|
|
5447
|
+
},
|
|
5448
|
+
...options.processOwnCommits && {
|
|
5449
|
+
LINGODOTDEV_PROCESS_OWN_COMMITS: options.processOwnCommits.toString()
|
|
5450
|
+
}
|
|
5358
5451
|
};
|
|
5359
5452
|
process.env = { ...process.env, ...env };
|
|
5360
|
-
|
|
5453
|
+
const ora = _ora2.default.call(void 0, );
|
|
5454
|
+
const platformKit = getPlatformKit();
|
|
5455
|
+
const { isPullRequestMode } = platformKit.config;
|
|
5456
|
+
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
5457
|
+
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
5458
|
+
const canRun = await _optionalChain([flow, 'access', _181 => _181.preRun, 'optionalCall', _182 => _182()]);
|
|
5459
|
+
if (canRun === false) {
|
|
5460
|
+
return;
|
|
5461
|
+
}
|
|
5462
|
+
const hasChanges = await flow.run();
|
|
5463
|
+
if (!hasChanges) {
|
|
5464
|
+
return;
|
|
5465
|
+
}
|
|
5466
|
+
await _optionalChain([flow, 'access', _183 => _183.postRun, 'optionalCall', _184 => _184()]);
|
|
5361
5467
|
});
|
|
5362
5468
|
|
|
5363
5469
|
// src/cli/cmd/status.ts
|
|
@@ -5780,7 +5886,7 @@ function validateParams2(i18nConfig, flags) {
|
|
|
5780
5886
|
// package.json
|
|
5781
5887
|
var package_default = {
|
|
5782
5888
|
name: "lingo.dev",
|
|
5783
|
-
version: "0.
|
|
5889
|
+
version: "0.89.1",
|
|
5784
5890
|
description: "Lingo.dev CLI",
|
|
5785
5891
|
private: false,
|
|
5786
5892
|
publishConfig: {
|
|
@@ -5866,7 +5972,7 @@ var package_default = {
|
|
|
5866
5972
|
"gradient-string": "^3.0.0",
|
|
5867
5973
|
"gray-matter": "^4.0.3",
|
|
5868
5974
|
ini: "^5.0.0",
|
|
5869
|
-
inquirer: "^12.
|
|
5975
|
+
inquirer: "^12.6.0",
|
|
5870
5976
|
"interactive-commander": "^0.5.194",
|
|
5871
5977
|
"is-url": "^1.2.4",
|
|
5872
5978
|
jsdom: "^25.0.1",
|