lingo.dev 0.88.0 → 0.89.0
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/build/cli.cjs +186 -84
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +185 -83
- package/build/cli.mjs.map +1 -1
- package/package.json +4 -4
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,10 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
4811
4825
|
}).length > 0;
|
|
4812
4826
|
}
|
|
4813
4827
|
async runLingoDotDev() {
|
|
4814
|
-
_child_process.execSync.call(void 0,
|
|
4828
|
+
_child_process.execSync.call(void 0,
|
|
4829
|
+
`npx lingo.dev@latest i18n --api-key ${this.platformKit.config.replexicaApiKey}`,
|
|
4830
|
+
{ stdio: "inherit" }
|
|
4831
|
+
);
|
|
4815
4832
|
}
|
|
4816
4833
|
configureGit() {
|
|
4817
4834
|
const { processOwnCommits } = this.platformKit.config;
|
|
@@ -4827,7 +4844,9 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
4827
4844
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
4828
4845
|
if (!processOwnCommits) {
|
|
4829
4846
|
const currentAuthor = `${gitConfig.userName} <${gitConfig.userEmail}>`;
|
|
4830
|
-
const authorOfLastCommit = _child_process.execSync.call(void 0,
|
|
4847
|
+
const authorOfLastCommit = _child_process.execSync.call(void 0,
|
|
4848
|
+
`git log -1 --pretty=format:'%an <%ae>'`
|
|
4849
|
+
).toString();
|
|
4831
4850
|
if (authorOfLastCommit === currentAuthor) {
|
|
4832
4851
|
this.ora.warn(
|
|
4833
4852
|
`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 +4854,21 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
4835
4854
|
return false;
|
|
4836
4855
|
}
|
|
4837
4856
|
}
|
|
4838
|
-
const workingDir = path14.default.resolve(
|
|
4857
|
+
const workingDir = path14.default.resolve(
|
|
4858
|
+
process.cwd(),
|
|
4859
|
+
this.platformKit.config.workingDir
|
|
4860
|
+
);
|
|
4839
4861
|
if (workingDir !== process.cwd()) {
|
|
4840
|
-
this.ora.info(
|
|
4862
|
+
this.ora.info(
|
|
4863
|
+
`Changing to working directory: ${this.platformKit.config.workingDir}`
|
|
4864
|
+
);
|
|
4841
4865
|
process.chdir(workingDir);
|
|
4842
4866
|
}
|
|
4843
4867
|
return true;
|
|
4844
4868
|
}
|
|
4845
4869
|
};
|
|
4846
4870
|
|
|
4847
|
-
//
|
|
4871
|
+
// src/cli/cmd/ci/flows/pull-request.ts
|
|
4848
4872
|
var PullRequestFlow = class extends InBranchFlow {
|
|
4849
4873
|
async preRun() {
|
|
4850
4874
|
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _167 => _167()]);
|
|
@@ -4853,7 +4877,9 @@ var PullRequestFlow = class extends InBranchFlow {
|
|
|
4853
4877
|
}
|
|
4854
4878
|
this.ora.start("Calculating automated branch name");
|
|
4855
4879
|
this.i18nBranchName = this.calculatePrBranchName();
|
|
4856
|
-
this.ora.succeed(
|
|
4880
|
+
this.ora.succeed(
|
|
4881
|
+
`Automated branch name calculated: ${this.i18nBranchName}`
|
|
4882
|
+
);
|
|
4857
4883
|
this.ora.start("Checking if branch exists");
|
|
4858
4884
|
const branchExists = await this.checkBranchExistance(this.i18nBranchName);
|
|
4859
4885
|
this.ora.succeed(branchExists ? "Branch exists" : "Branch does not exist");
|
|
@@ -4861,7 +4887,9 @@ var PullRequestFlow = class extends InBranchFlow {
|
|
|
4861
4887
|
this.ora.start(`Checking out branch ${this.i18nBranchName}`);
|
|
4862
4888
|
this.checkoutI18nBranch(this.i18nBranchName);
|
|
4863
4889
|
this.ora.succeed(`Checked out branch ${this.i18nBranchName}`);
|
|
4864
|
-
this.ora.start(
|
|
4890
|
+
this.ora.start(
|
|
4891
|
+
`Syncing with ${this.platformKit.platformConfig.baseBranchName}`
|
|
4892
|
+
);
|
|
4865
4893
|
this.syncI18nBranch();
|
|
4866
4894
|
this.ora.succeed(`Checked out and synced branch ${this.i18nBranchName}`);
|
|
4867
4895
|
} else {
|
|
@@ -4876,11 +4904,15 @@ var PullRequestFlow = class extends InBranchFlow {
|
|
|
4876
4904
|
}
|
|
4877
4905
|
async postRun() {
|
|
4878
4906
|
if (!this.i18nBranchName) {
|
|
4879
|
-
throw new Error(
|
|
4907
|
+
throw new Error(
|
|
4908
|
+
"i18nBranchName is not set. Did you forget to call preRun?"
|
|
4909
|
+
);
|
|
4880
4910
|
}
|
|
4881
4911
|
this.ora.start("Checking if PR already exists");
|
|
4882
4912
|
const pullRequestNumber = await this.ensureFreshPr(this.i18nBranchName);
|
|
4883
|
-
this.ora.succeed(
|
|
4913
|
+
this.ora.succeed(
|
|
4914
|
+
`Pull request ready: ${this.platformKit.buildPullRequestUrl(pullRequestNumber)}`
|
|
4915
|
+
);
|
|
4884
4916
|
}
|
|
4885
4917
|
calculatePrBranchName() {
|
|
4886
4918
|
return `lingo.dev/${this.platformKit.platformConfig.baseBranchName}`;
|
|
@@ -4918,10 +4950,16 @@ var PullRequestFlow = class extends InBranchFlow {
|
|
|
4918
4950
|
}
|
|
4919
4951
|
createI18nBranch(i18nBranchName) {
|
|
4920
4952
|
try {
|
|
4921
|
-
_child_process.execSync.call(void 0,
|
|
4922
|
-
|
|
4923
|
-
stdio: "inherit"
|
|
4924
|
-
|
|
4953
|
+
_child_process.execSync.call(void 0,
|
|
4954
|
+
`git fetch origin ${this.platformKit.platformConfig.baseBranchName}`,
|
|
4955
|
+
{ stdio: "inherit" }
|
|
4956
|
+
);
|
|
4957
|
+
_child_process.execSync.call(void 0,
|
|
4958
|
+
`git checkout -b ${i18nBranchName} origin/${this.platformKit.platformConfig.baseBranchName}`,
|
|
4959
|
+
{
|
|
4960
|
+
stdio: "inherit"
|
|
4961
|
+
}
|
|
4962
|
+
);
|
|
4925
4963
|
} catch (error) {
|
|
4926
4964
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
4927
4965
|
this.ora.fail(`Failed to create branch: ${errorMessage}`);
|
|
@@ -4938,21 +4976,38 @@ var PullRequestFlow = class extends InBranchFlow {
|
|
|
4938
4976
|
if (!this.i18nBranchName) {
|
|
4939
4977
|
throw new Error("i18nBranchName is not set");
|
|
4940
4978
|
}
|
|
4941
|
-
this.ora.start(
|
|
4942
|
-
|
|
4943
|
-
|
|
4979
|
+
this.ora.start(
|
|
4980
|
+
`Fetching latest changes from ${this.platformKit.platformConfig.baseBranchName}`
|
|
4981
|
+
);
|
|
4982
|
+
_child_process.execSync.call(void 0,
|
|
4983
|
+
`git fetch origin ${this.platformKit.platformConfig.baseBranchName}`,
|
|
4984
|
+
{ stdio: "inherit" }
|
|
4985
|
+
);
|
|
4986
|
+
this.ora.succeed(
|
|
4987
|
+
`Fetched latest changes from ${this.platformKit.platformConfig.baseBranchName}`
|
|
4988
|
+
);
|
|
4944
4989
|
try {
|
|
4945
4990
|
this.ora.start("Attempting to rebase branch");
|
|
4946
|
-
_child_process.execSync.call(void 0,
|
|
4991
|
+
_child_process.execSync.call(void 0,
|
|
4992
|
+
`git rebase origin/${this.platformKit.platformConfig.baseBranchName}`,
|
|
4993
|
+
{ stdio: "inherit" }
|
|
4994
|
+
);
|
|
4947
4995
|
this.ora.succeed("Successfully rebased branch");
|
|
4948
4996
|
} catch (error) {
|
|
4949
4997
|
this.ora.warn("Rebase failed, falling back to alternative sync method");
|
|
4950
4998
|
this.ora.start("Aborting failed rebase");
|
|
4951
4999
|
_child_process.execSync.call(void 0, "git rebase --abort", { stdio: "inherit" });
|
|
4952
5000
|
this.ora.succeed("Aborted failed rebase");
|
|
4953
|
-
this.ora.start(
|
|
4954
|
-
|
|
4955
|
-
|
|
5001
|
+
this.ora.start(
|
|
5002
|
+
`Resetting to ${this.platformKit.platformConfig.baseBranchName}`
|
|
5003
|
+
);
|
|
5004
|
+
_child_process.execSync.call(void 0,
|
|
5005
|
+
`git reset --hard origin/${this.platformKit.platformConfig.baseBranchName}`,
|
|
5006
|
+
{ stdio: "inherit" }
|
|
5007
|
+
);
|
|
5008
|
+
this.ora.succeed(
|
|
5009
|
+
`Reset to ${this.platformKit.platformConfig.baseBranchName}`
|
|
5010
|
+
);
|
|
4956
5011
|
this.ora.start("Restoring target files");
|
|
4957
5012
|
const targetFiles = ["i18n.lock"];
|
|
4958
5013
|
const targetFileNames = _child_process.execSync.call(void 0,
|
|
@@ -4975,9 +5030,12 @@ var PullRequestFlow = class extends InBranchFlow {
|
|
|
4975
5030
|
const hasChanges = this.checkCommitableChanges();
|
|
4976
5031
|
if (hasChanges) {
|
|
4977
5032
|
_child_process.execSync.call(void 0, "git add .", { stdio: "inherit" });
|
|
4978
|
-
_child_process.execSync.call(void 0,
|
|
4979
|
-
|
|
4980
|
-
|
|
5033
|
+
_child_process.execSync.call(void 0,
|
|
5034
|
+
`git commit -m "chore: sync with ${this.platformKit.platformConfig.baseBranchName}"`,
|
|
5035
|
+
{
|
|
5036
|
+
stdio: "inherit"
|
|
5037
|
+
}
|
|
5038
|
+
);
|
|
4981
5039
|
this.ora.succeed("Committed additional changes");
|
|
4982
5040
|
} else {
|
|
4983
5041
|
this.ora.succeed("No changes to commit");
|
|
@@ -5003,12 +5061,12 @@ Hey team,
|
|
|
5003
5061
|
}
|
|
5004
5062
|
};
|
|
5005
5063
|
|
|
5006
|
-
//
|
|
5064
|
+
// src/cli/cmd/ci/platforms/bitbucket.ts
|
|
5007
5065
|
|
|
5008
5066
|
var _bitbucket = require('bitbucket'); var _bitbucket2 = _interopRequireDefault(_bitbucket);
|
|
5009
5067
|
|
|
5010
5068
|
|
|
5011
|
-
//
|
|
5069
|
+
// src/cli/cmd/ci/platforms/_base.ts
|
|
5012
5070
|
|
|
5013
5071
|
|
|
5014
5072
|
var defaultMessage = "feat: update translations via @lingodotdev";
|
|
@@ -5040,7 +5098,7 @@ var PlatformKit = class {
|
|
|
5040
5098
|
}
|
|
5041
5099
|
};
|
|
5042
5100
|
|
|
5043
|
-
//
|
|
5101
|
+
// src/cli/cmd/ci/platforms/bitbucket.ts
|
|
5044
5102
|
var { Bitbucket } = _bitbucket2.default;
|
|
5045
5103
|
var BitbucketPlatformKit = class extends PlatformKit {
|
|
5046
5104
|
|
|
@@ -5077,7 +5135,11 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
5077
5135
|
pull_request_id: pullRequestNumber
|
|
5078
5136
|
});
|
|
5079
5137
|
}
|
|
5080
|
-
async createPullRequest({
|
|
5138
|
+
async createPullRequest({
|
|
5139
|
+
title,
|
|
5140
|
+
body,
|
|
5141
|
+
head
|
|
5142
|
+
}) {
|
|
5081
5143
|
return await this.bb.repositories.createPullRequest({
|
|
5082
5144
|
workspace: this.platformConfig.repositoryOwner,
|
|
5083
5145
|
repo_slug: this.platformConfig.repositoryName,
|
|
@@ -5089,7 +5151,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
5089
5151
|
}
|
|
5090
5152
|
}).then(({ data }) => _nullishCoalesce(data.id, () => ( 0)));
|
|
5091
5153
|
}
|
|
5092
|
-
async commentOnPullRequest({
|
|
5154
|
+
async commentOnPullRequest({
|
|
5155
|
+
pullRequestNumber,
|
|
5156
|
+
body
|
|
5157
|
+
}) {
|
|
5093
5158
|
await this.bb.repositories.createPullRequestComment({
|
|
5094
5159
|
workspace: this.platformConfig.repositoryOwner,
|
|
5095
5160
|
repo_slug: this.platformConfig.repositoryName,
|
|
@@ -5105,9 +5170,12 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
5105
5170
|
_child_process.execSync.call(void 0, "git config --unset http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy", {
|
|
5106
5171
|
stdio: "inherit"
|
|
5107
5172
|
});
|
|
5108
|
-
_child_process.execSync.call(void 0,
|
|
5109
|
-
|
|
5110
|
-
|
|
5173
|
+
_child_process.execSync.call(void 0,
|
|
5174
|
+
"git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://host.docker.internal:29418/",
|
|
5175
|
+
{
|
|
5176
|
+
stdio: "inherit"
|
|
5177
|
+
}
|
|
5178
|
+
);
|
|
5111
5179
|
}
|
|
5112
5180
|
get platformConfig() {
|
|
5113
5181
|
const env = _zod2.default.object({
|
|
@@ -5129,7 +5197,7 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
5129
5197
|
}
|
|
5130
5198
|
};
|
|
5131
5199
|
|
|
5132
|
-
//
|
|
5200
|
+
// src/cli/cmd/ci/platforms/github.ts
|
|
5133
5201
|
var _octokit2 = require('octokit');
|
|
5134
5202
|
|
|
5135
5203
|
var GitHubPlatformKit = class extends PlatformKit {
|
|
@@ -5164,7 +5232,11 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
5164
5232
|
state: "closed"
|
|
5165
5233
|
});
|
|
5166
5234
|
}
|
|
5167
|
-
async createPullRequest({
|
|
5235
|
+
async createPullRequest({
|
|
5236
|
+
head,
|
|
5237
|
+
title,
|
|
5238
|
+
body
|
|
5239
|
+
}) {
|
|
5168
5240
|
return await this.octokit.rest.pulls.create({
|
|
5169
5241
|
head,
|
|
5170
5242
|
title,
|
|
@@ -5174,7 +5246,10 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
5174
5246
|
base: this.platformConfig.baseBranchName
|
|
5175
5247
|
}).then(({ data }) => data.number);
|
|
5176
5248
|
}
|
|
5177
|
-
async commentOnPullRequest({
|
|
5249
|
+
async commentOnPullRequest({
|
|
5250
|
+
pullRequestNumber,
|
|
5251
|
+
body
|
|
5252
|
+
}) {
|
|
5178
5253
|
await this.octokit.rest.issues.createComment({
|
|
5179
5254
|
issue_number: pullRequestNumber,
|
|
5180
5255
|
body,
|
|
@@ -5186,7 +5261,9 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
5186
5261
|
const { ghToken, repositoryOwner, repositoryName } = this.platformConfig;
|
|
5187
5262
|
const { processOwnCommits } = this.config;
|
|
5188
5263
|
if (ghToken && processOwnCommits) {
|
|
5189
|
-
console.log(
|
|
5264
|
+
console.log(
|
|
5265
|
+
"Using provided GH_TOKEN. This will trigger your CI/CD pipeline to run again."
|
|
5266
|
+
);
|
|
5190
5267
|
const url = `https://${ghToken}@github.com/${repositoryOwner}/${repositoryName}.git`;
|
|
5191
5268
|
super.gitConfig(ghToken, url);
|
|
5192
5269
|
}
|
|
@@ -5213,7 +5290,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
5213
5290
|
}
|
|
5214
5291
|
};
|
|
5215
5292
|
|
|
5216
|
-
//
|
|
5293
|
+
// src/cli/cmd/ci/platforms/gitlab.ts
|
|
5217
5294
|
var _rest = require('@gitbeaker/rest');
|
|
5218
5295
|
|
|
5219
5296
|
var gl = new (0, _rest.Gitlab)({ token: "" });
|
|
@@ -5255,13 +5332,18 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
5255
5332
|
}
|
|
5256
5333
|
async branchExists({ branch }) {
|
|
5257
5334
|
try {
|
|
5258
|
-
await this.gitlab.Branches.show(
|
|
5335
|
+
await this.gitlab.Branches.show(
|
|
5336
|
+
this.platformConfig.gitlabProjectId,
|
|
5337
|
+
branch
|
|
5338
|
+
);
|
|
5259
5339
|
return true;
|
|
5260
5340
|
} catch (e2) {
|
|
5261
5341
|
return false;
|
|
5262
5342
|
}
|
|
5263
5343
|
}
|
|
5264
|
-
async getOpenPullRequestNumber({
|
|
5344
|
+
async getOpenPullRequestNumber({
|
|
5345
|
+
branch
|
|
5346
|
+
}) {
|
|
5265
5347
|
const mergeRequests = await this.gitlab.MergeRequests.all({
|
|
5266
5348
|
projectId: this.platformConfig.gitlabProjectId,
|
|
5267
5349
|
sourceBranch: branch,
|
|
@@ -5269,12 +5351,22 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
5269
5351
|
});
|
|
5270
5352
|
return _optionalChain([mergeRequests, 'access', _176 => _176[0], 'optionalAccess', _177 => _177.iid]);
|
|
5271
5353
|
}
|
|
5272
|
-
async closePullRequest({
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5354
|
+
async closePullRequest({
|
|
5355
|
+
pullRequestNumber
|
|
5356
|
+
}) {
|
|
5357
|
+
await this.gitlab.MergeRequests.edit(
|
|
5358
|
+
this.platformConfig.gitlabProjectId,
|
|
5359
|
+
pullRequestNumber,
|
|
5360
|
+
{
|
|
5361
|
+
stateEvent: "close"
|
|
5362
|
+
}
|
|
5363
|
+
);
|
|
5276
5364
|
}
|
|
5277
|
-
async createPullRequest({
|
|
5365
|
+
async createPullRequest({
|
|
5366
|
+
head,
|
|
5367
|
+
title,
|
|
5368
|
+
body
|
|
5369
|
+
}) {
|
|
5278
5370
|
const mr = await this.gitlab.MergeRequests.create(
|
|
5279
5371
|
this.platformConfig.gitlabProjectId,
|
|
5280
5372
|
head,
|
|
@@ -5286,8 +5378,15 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
5286
5378
|
);
|
|
5287
5379
|
return mr.iid;
|
|
5288
5380
|
}
|
|
5289
|
-
async commentOnPullRequest({
|
|
5290
|
-
|
|
5381
|
+
async commentOnPullRequest({
|
|
5382
|
+
pullRequestNumber,
|
|
5383
|
+
body
|
|
5384
|
+
}) {
|
|
5385
|
+
await this.gitlab.MergeRequestNotes.create(
|
|
5386
|
+
this.platformConfig.gitlabProjectId,
|
|
5387
|
+
pullRequestNumber,
|
|
5388
|
+
body
|
|
5389
|
+
);
|
|
5291
5390
|
}
|
|
5292
5391
|
gitConfig() {
|
|
5293
5392
|
const glToken = this.platformConfig.glToken;
|
|
@@ -5299,7 +5398,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
5299
5398
|
}
|
|
5300
5399
|
};
|
|
5301
5400
|
|
|
5302
|
-
//
|
|
5401
|
+
// src/cli/cmd/ci/platforms/index.ts
|
|
5303
5402
|
var getPlatformKit = () => {
|
|
5304
5403
|
if (process.env.BITBUCKET_PIPELINE_UUID) {
|
|
5305
5404
|
return new BitbucketPlatformKit();
|
|
@@ -5313,25 +5412,7 @@ var getPlatformKit = () => {
|
|
|
5313
5412
|
throw new Error("This platform is not supported");
|
|
5314
5413
|
};
|
|
5315
5414
|
|
|
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
|
|
5415
|
+
// src/cli/cmd/ci/index.ts
|
|
5335
5416
|
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
5417
|
const apiKey = program.args[0];
|
|
5337
5418
|
const settings = getSettings(apiKey);
|
|
@@ -5350,14 +5431,35 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
5350
5431
|
}
|
|
5351
5432
|
const env = {
|
|
5352
5433
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
5353
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
5354
|
-
...options.commitMessage && {
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
...options.
|
|
5434
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _178 => _178.pullRequest, 'optionalAccess', _179 => _179.toString, 'call', _180 => _180()]) || "false",
|
|
5435
|
+
...options.commitMessage && {
|
|
5436
|
+
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
5437
|
+
},
|
|
5438
|
+
...options.pullRequestTitle && {
|
|
5439
|
+
LINGODOTDEV_PULL_REQUEST_TITLE: options.pullRequestTitle
|
|
5440
|
+
},
|
|
5441
|
+
...options.workingDirectory && {
|
|
5442
|
+
LINGODOTDEV_WORKING_DIRECTORY: options.workingDirectory
|
|
5443
|
+
},
|
|
5444
|
+
...options.processOwnCommits && {
|
|
5445
|
+
LINGODOTDEV_PROCESS_OWN_COMMITS: options.processOwnCommits.toString()
|
|
5446
|
+
}
|
|
5358
5447
|
};
|
|
5359
5448
|
process.env = { ...process.env, ...env };
|
|
5360
|
-
|
|
5449
|
+
const ora = _ora2.default.call(void 0, );
|
|
5450
|
+
const platformKit = getPlatformKit();
|
|
5451
|
+
const { isPullRequestMode } = platformKit.config;
|
|
5452
|
+
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
5453
|
+
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
5454
|
+
const canRun = await _optionalChain([flow, 'access', _181 => _181.preRun, 'optionalCall', _182 => _182()]);
|
|
5455
|
+
if (canRun === false) {
|
|
5456
|
+
return;
|
|
5457
|
+
}
|
|
5458
|
+
const hasChanges = await flow.run();
|
|
5459
|
+
if (!hasChanges) {
|
|
5460
|
+
return;
|
|
5461
|
+
}
|
|
5462
|
+
await _optionalChain([flow, 'access', _183 => _183.postRun, 'optionalCall', _184 => _184()]);
|
|
5361
5463
|
});
|
|
5362
5464
|
|
|
5363
5465
|
// src/cli/cmd/status.ts
|
|
@@ -5780,7 +5882,7 @@ function validateParams2(i18nConfig, flags) {
|
|
|
5780
5882
|
// package.json
|
|
5781
5883
|
var package_default = {
|
|
5782
5884
|
name: "lingo.dev",
|
|
5783
|
-
version: "0.
|
|
5885
|
+
version: "0.89.0",
|
|
5784
5886
|
description: "Lingo.dev CLI",
|
|
5785
5887
|
private: false,
|
|
5786
5888
|
publishConfig: {
|
|
@@ -5866,7 +5968,7 @@ var package_default = {
|
|
|
5866
5968
|
"gradient-string": "^3.0.0",
|
|
5867
5969
|
"gray-matter": "^4.0.3",
|
|
5868
5970
|
ini: "^5.0.0",
|
|
5869
|
-
inquirer: "^12.
|
|
5971
|
+
inquirer: "^12.6.0",
|
|
5870
5972
|
"interactive-commander": "^0.5.194",
|
|
5871
5973
|
"is-url": "^1.2.4",
|
|
5872
5974
|
jsdom: "^25.0.1",
|