@fern-api/fern-api-dev 4.80.4 → 4.81.0-3-gaa0d9a2b5d2
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/cli.cjs +1463 -812
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -68378,8 +68378,8 @@ var require_graceful_fs = __commonJS({
|
|
|
68378
68378
|
}
|
|
68379
68379
|
}
|
|
68380
68380
|
var fs$writeFile = fs28.writeFile;
|
|
68381
|
-
fs28.writeFile =
|
|
68382
|
-
function
|
|
68381
|
+
fs28.writeFile = writeFile91;
|
|
68382
|
+
function writeFile91(path99, data2, options2, cb) {
|
|
68383
68383
|
if (typeof options2 === "function")
|
|
68384
68384
|
cb = options2, options2 = null;
|
|
68385
68385
|
return go$writeFile(path99, data2, options2, cb);
|
|
@@ -68396,8 +68396,8 @@ var require_graceful_fs = __commonJS({
|
|
|
68396
68396
|
}
|
|
68397
68397
|
var fs$appendFile = fs28.appendFile;
|
|
68398
68398
|
if (fs$appendFile)
|
|
68399
|
-
fs28.appendFile =
|
|
68400
|
-
function
|
|
68399
|
+
fs28.appendFile = appendFile3;
|
|
68400
|
+
function appendFile3(path99, data2, options2, cb) {
|
|
68401
68401
|
if (typeof options2 === "function")
|
|
68402
68402
|
cb = options2, options2 = null;
|
|
68403
68403
|
return go$appendFile(path99, data2, options2, cb);
|
|
@@ -290012,8 +290012,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
290012
290012
|
}
|
|
290013
290013
|
}
|
|
290014
290014
|
var fs$writeFile = fs28.writeFile;
|
|
290015
|
-
fs28.writeFile =
|
|
290016
|
-
function
|
|
290015
|
+
fs28.writeFile = writeFile91;
|
|
290016
|
+
function writeFile91(path99, data2, options2, cb) {
|
|
290017
290017
|
if (typeof options2 === "function")
|
|
290018
290018
|
cb = options2, options2 = null;
|
|
290019
290019
|
return go$writeFile(path99, data2, options2, cb);
|
|
@@ -290030,8 +290030,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
290030
290030
|
}
|
|
290031
290031
|
var fs$appendFile = fs28.appendFile;
|
|
290032
290032
|
if (fs$appendFile)
|
|
290033
|
-
fs28.appendFile =
|
|
290034
|
-
function
|
|
290033
|
+
fs28.appendFile = appendFile3;
|
|
290034
|
+
function appendFile3(path99, data2, options2, cb) {
|
|
290035
290035
|
if (typeof options2 === "function")
|
|
290036
290036
|
cb = options2, options2 = null;
|
|
290037
290037
|
return go$appendFile(path99, data2, options2, cb);
|
|
@@ -330613,6 +330613,50 @@ var require_constants3 = __commonJS({
|
|
|
330613
330613
|
}
|
|
330614
330614
|
});
|
|
330615
330615
|
|
|
330616
|
+
// ../../generator-cli/lib/pipeline/steps/BaseStep.js
|
|
330617
|
+
var require_BaseStep = __commonJS({
|
|
330618
|
+
"../../generator-cli/lib/pipeline/steps/BaseStep.js"(exports2) {
|
|
330619
|
+
"use strict";
|
|
330620
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
330621
|
+
exports2.BaseStep = void 0;
|
|
330622
|
+
var BaseStep = class {
|
|
330623
|
+
outputDir;
|
|
330624
|
+
logger;
|
|
330625
|
+
constructor(outputDir, logger4) {
|
|
330626
|
+
this.outputDir = outputDir;
|
|
330627
|
+
this.logger = logger4;
|
|
330628
|
+
}
|
|
330629
|
+
};
|
|
330630
|
+
exports2.BaseStep = BaseStep;
|
|
330631
|
+
}
|
|
330632
|
+
});
|
|
330633
|
+
|
|
330634
|
+
// ../../generator-cli/lib/pipeline/steps/AutoVersionStep.js
|
|
330635
|
+
var require_AutoVersionStep = __commonJS({
|
|
330636
|
+
"../../generator-cli/lib/pipeline/steps/AutoVersionStep.js"(exports2) {
|
|
330637
|
+
"use strict";
|
|
330638
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
330639
|
+
exports2.AutoVersionStep = void 0;
|
|
330640
|
+
var BaseStep_1 = require_BaseStep();
|
|
330641
|
+
var AutoVersionStep = class extends BaseStep_1.BaseStep {
|
|
330642
|
+
config;
|
|
330643
|
+
name = "autoVersion";
|
|
330644
|
+
constructor(outputDir, logger4, config5) {
|
|
330645
|
+
super(outputDir, logger4);
|
|
330646
|
+
this.config = config5;
|
|
330647
|
+
}
|
|
330648
|
+
async execute(_context) {
|
|
330649
|
+
this.logger.info(`AutoVersionStep: no-op scaffold for language=${this.config.language} (logic lands in FER-9980)`);
|
|
330650
|
+
return {
|
|
330651
|
+
executed: true,
|
|
330652
|
+
success: true
|
|
330653
|
+
};
|
|
330654
|
+
}
|
|
330655
|
+
};
|
|
330656
|
+
exports2.AutoVersionStep = AutoVersionStep;
|
|
330657
|
+
}
|
|
330658
|
+
});
|
|
330659
|
+
|
|
330616
330660
|
// ../../generator-cli/lib/pipeline/github/createReplayBranch.js
|
|
330617
330661
|
var require_createReplayBranch = __commonJS({
|
|
330618
330662
|
"../../generator-cli/lib/pipeline/github/createReplayBranch.js"(exports2) {
|
|
@@ -330879,24 +330923,6 @@ var require_replay_summary = __commonJS({
|
|
|
330879
330923
|
}
|
|
330880
330924
|
});
|
|
330881
330925
|
|
|
330882
|
-
// ../../generator-cli/lib/pipeline/steps/BaseStep.js
|
|
330883
|
-
var require_BaseStep = __commonJS({
|
|
330884
|
-
"../../generator-cli/lib/pipeline/steps/BaseStep.js"(exports2) {
|
|
330885
|
-
"use strict";
|
|
330886
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
330887
|
-
exports2.BaseStep = void 0;
|
|
330888
|
-
var BaseStep = class {
|
|
330889
|
-
outputDir;
|
|
330890
|
-
logger;
|
|
330891
|
-
constructor(outputDir, logger4) {
|
|
330892
|
-
this.outputDir = outputDir;
|
|
330893
|
-
this.logger = logger4;
|
|
330894
|
-
}
|
|
330895
|
-
};
|
|
330896
|
-
exports2.BaseStep = BaseStep;
|
|
330897
|
-
}
|
|
330898
|
-
});
|
|
330899
|
-
|
|
330900
330926
|
// ../../generator-cli/lib/pipeline/steps/GithubStep.js
|
|
330901
330927
|
var require_GithubStep = __commonJS({
|
|
330902
330928
|
"../../generator-cli/lib/pipeline/steps/GithubStep.js"(exports2) {
|
|
@@ -337970,7 +337996,7 @@ var require_dist14 = __commonJS({
|
|
|
337970
337996
|
}
|
|
337971
337997
|
return result;
|
|
337972
337998
|
}
|
|
337973
|
-
var
|
|
337999
|
+
var import_promises185 = require("fs/promises");
|
|
337974
338000
|
var import_node_os15 = require("os");
|
|
337975
338001
|
var import_node_path210 = require("path");
|
|
337976
338002
|
var import_minimatch8 = require_commonjs3();
|
|
@@ -338183,9 +338209,9 @@ var require_dist14 = __commonJS({
|
|
|
338183
338209
|
if (laterFiles.has(fileResult.file) || laterFiles.has(originalPath)) {
|
|
338184
338210
|
const filePath = (0, import_node_path210.join)(this.outputDir, fileResult.file);
|
|
338185
338211
|
try {
|
|
338186
|
-
const content5 = await (0,
|
|
338212
|
+
const content5 = await (0, import_promises185.readFile)(filePath, "utf-8");
|
|
338187
338213
|
const stripped = stripConflictMarkers(content5);
|
|
338188
|
-
await (0,
|
|
338214
|
+
await (0, import_promises185.writeFile)(filePath, stripped);
|
|
338189
338215
|
} catch {
|
|
338190
338216
|
}
|
|
338191
338217
|
}
|
|
@@ -338197,7 +338223,7 @@ var require_dist14 = __commonJS({
|
|
|
338197
338223
|
/** Populate accumulator after git apply succeeds. */
|
|
338198
338224
|
async populateAccumulatorForPatch(patch5, baseGen, currentTreeHash) {
|
|
338199
338225
|
if (!baseGen) return;
|
|
338200
|
-
const tempDir2 = await (0,
|
|
338226
|
+
const tempDir2 = await (0, import_promises185.mkdtemp)((0, import_node_path210.join)((0, import_node_os15.tmpdir)(), "replay-acc-"));
|
|
338201
338227
|
const { GitClient: GitClient2 } = await Promise.resolve().then(() => (init_GitClient(), GitClient_exports));
|
|
338202
338228
|
const tempGit = new GitClient2(tempDir2);
|
|
338203
338229
|
await tempGit.exec(["init"]);
|
|
@@ -338209,7 +338235,7 @@ var require_dist14 = __commonJS({
|
|
|
338209
338235
|
const resolvedPath = await this.resolveFilePath(filePath, baseGen.tree_hash, currentTreeHash);
|
|
338210
338236
|
const base4 = await this.git.showFile(baseGen.tree_hash, filePath);
|
|
338211
338237
|
const theirs = await this.applyPatchToContent(base4, patch5.patch_content, filePath, tempGit, tempDir2);
|
|
338212
|
-
const effectiveTheirs = theirs ?? await (0,
|
|
338238
|
+
const effectiveTheirs = theirs ?? await (0, import_promises185.readFile)((0, import_node_path210.join)(this.outputDir, resolvedPath), "utf-8").catch(() => null);
|
|
338213
338239
|
if (effectiveTheirs != null) {
|
|
338214
338240
|
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
338215
338241
|
content: effectiveTheirs,
|
|
@@ -338218,7 +338244,7 @@ var require_dist14 = __commonJS({
|
|
|
338218
338244
|
}
|
|
338219
338245
|
}
|
|
338220
338246
|
} finally {
|
|
338221
|
-
await (0,
|
|
338247
|
+
await (0, import_promises185.rm)(tempDir2, { recursive: true }).catch(() => {
|
|
338222
338248
|
});
|
|
338223
338249
|
}
|
|
338224
338250
|
}
|
|
@@ -338247,7 +338273,7 @@ var require_dist14 = __commonJS({
|
|
|
338247
338273
|
const snapshots = /* @__PURE__ */ new Map();
|
|
338248
338274
|
for (const filePath of patch5.files) {
|
|
338249
338275
|
const fullPath = (0, import_node_path210.join)(this.outputDir, filePath);
|
|
338250
|
-
snapshots.set(filePath, await (0,
|
|
338276
|
+
snapshots.set(filePath, await (0, import_promises185.readFile)(fullPath, "utf-8").catch(() => null));
|
|
338251
338277
|
}
|
|
338252
338278
|
try {
|
|
338253
338279
|
await this.git.execWithInput(["apply", "--3way"], patch5.patch_content);
|
|
@@ -338262,9 +338288,9 @@ var require_dist14 = __commonJS({
|
|
|
338262
338288
|
for (const [filePath, content5] of snapshots) {
|
|
338263
338289
|
const fullPath = (0, import_node_path210.join)(this.outputDir, filePath);
|
|
338264
338290
|
if (content5 != null) {
|
|
338265
|
-
await (0,
|
|
338291
|
+
await (0, import_promises185.writeFile)(fullPath, content5);
|
|
338266
338292
|
} else {
|
|
338267
|
-
await (0,
|
|
338293
|
+
await (0, import_promises185.unlink)(fullPath).catch(() => {
|
|
338268
338294
|
});
|
|
338269
338295
|
}
|
|
338270
338296
|
}
|
|
@@ -338275,7 +338301,7 @@ var require_dist14 = __commonJS({
|
|
|
338275
338301
|
async applyWithThreeWayMerge(patch5) {
|
|
338276
338302
|
const fileResults = [];
|
|
338277
338303
|
const resolvedFiles = {};
|
|
338278
|
-
const tempDir2 = await (0,
|
|
338304
|
+
const tempDir2 = await (0, import_promises185.mkdtemp)((0, import_node_path210.join)((0, import_node_os15.tmpdir)(), "replay-"));
|
|
338279
338305
|
const { GitClient: GitClient2 } = await Promise.resolve().then(() => (init_GitClient(), GitClient_exports));
|
|
338280
338306
|
const tempGit = new GitClient2(tempDir2);
|
|
338281
338307
|
await tempGit.exec(["init"]);
|
|
@@ -338298,7 +338324,7 @@ var require_dist14 = __commonJS({
|
|
|
338298
338324
|
fileResults.push(result);
|
|
338299
338325
|
}
|
|
338300
338326
|
} finally {
|
|
338301
|
-
await (0,
|
|
338327
|
+
await (0, import_promises185.rm)(tempDir2, { recursive: true }).catch(() => {
|
|
338302
338328
|
});
|
|
338303
338329
|
}
|
|
338304
338330
|
const conflictFiles = fileResults.filter((r5) => r5.status === "conflict");
|
|
@@ -338339,7 +338365,7 @@ var require_dist14 = __commonJS({
|
|
|
338339
338365
|
}
|
|
338340
338366
|
}
|
|
338341
338367
|
const oursPath = (0, import_node_path210.join)(this.outputDir, resolvedPath);
|
|
338342
|
-
const ours = await (0,
|
|
338368
|
+
const ours = await (0, import_promises185.readFile)(oursPath, "utf-8").catch(() => null);
|
|
338343
338369
|
let ghostReconstructed = false;
|
|
338344
338370
|
let theirs = null;
|
|
338345
338371
|
if (!base4 && ours && !renameSourcePath) {
|
|
@@ -338436,15 +338462,15 @@ var require_dist14 = __commonJS({
|
|
|
338436
338462
|
baseGeneration: patch5.base_generation
|
|
338437
338463
|
});
|
|
338438
338464
|
const outDir2 = (0, import_node_path210.dirname)(oursPath);
|
|
338439
|
-
await (0,
|
|
338440
|
-
await (0,
|
|
338465
|
+
await (0, import_promises185.mkdir)(outDir2, { recursive: true });
|
|
338466
|
+
await (0, import_promises185.writeFile)(oursPath, effective_theirs);
|
|
338441
338467
|
return { file: resolvedPath, status: "merged", reason: "new-file" };
|
|
338442
338468
|
}
|
|
338443
338469
|
if (base4 == null && ours != null && effective_theirs != null && !useAccumulatorAsMergeBase) {
|
|
338444
338470
|
const merged2 = threeWayMerge("", ours, effective_theirs);
|
|
338445
338471
|
const outDir2 = (0, import_node_path210.dirname)(oursPath);
|
|
338446
|
-
await (0,
|
|
338447
|
-
await (0,
|
|
338472
|
+
await (0, import_promises185.mkdir)(outDir2, { recursive: true });
|
|
338473
|
+
await (0, import_promises185.writeFile)(oursPath, merged2.content);
|
|
338448
338474
|
if (merged2.hasConflicts) {
|
|
338449
338475
|
return {
|
|
338450
338476
|
file: resolvedPath,
|
|
@@ -338484,8 +338510,8 @@ var require_dist14 = __commonJS({
|
|
|
338484
338510
|
}
|
|
338485
338511
|
const merged = threeWayMerge(mergeBase, ours, effective_theirs);
|
|
338486
338512
|
const outDir = (0, import_node_path210.dirname)(oursPath);
|
|
338487
|
-
await (0,
|
|
338488
|
-
await (0,
|
|
338513
|
+
await (0, import_promises185.mkdir)(outDir, { recursive: true });
|
|
338514
|
+
await (0, import_promises185.writeFile)(oursPath, merged.content);
|
|
338489
338515
|
if (effective_theirs != null && !merged.hasConflicts) {
|
|
338490
338516
|
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
338491
338517
|
content: effective_theirs,
|
|
@@ -338560,8 +338586,8 @@ var require_dist14 = __commonJS({
|
|
|
338560
338586
|
try {
|
|
338561
338587
|
if (sourceFilePath) {
|
|
338562
338588
|
const tempSourcePath = (0, import_node_path210.join)(tempDir2, sourceFilePath);
|
|
338563
|
-
await (0,
|
|
338564
|
-
await (0,
|
|
338589
|
+
await (0, import_promises185.mkdir)((0, import_node_path210.dirname)(tempSourcePath), { recursive: true });
|
|
338590
|
+
await (0, import_promises185.writeFile)(tempSourcePath, base4);
|
|
338565
338591
|
await tempGit.exec(["add", sourceFilePath]);
|
|
338566
338592
|
await tempGit.exec([
|
|
338567
338593
|
"commit",
|
|
@@ -338571,15 +338597,15 @@ var require_dist14 = __commonJS({
|
|
|
338571
338597
|
]);
|
|
338572
338598
|
await tempGit.execWithInput(["apply", "--allow-empty"], fileDiff);
|
|
338573
338599
|
const tempTargetPath = (0, import_node_path210.join)(tempDir2, filePath);
|
|
338574
|
-
return await (0,
|
|
338600
|
+
return await (0, import_promises185.readFile)(tempTargetPath, "utf-8");
|
|
338575
338601
|
}
|
|
338576
338602
|
const tempFilePath = (0, import_node_path210.join)(tempDir2, filePath);
|
|
338577
|
-
await (0,
|
|
338578
|
-
await (0,
|
|
338603
|
+
await (0, import_promises185.mkdir)((0, import_node_path210.dirname)(tempFilePath), { recursive: true });
|
|
338604
|
+
await (0, import_promises185.writeFile)(tempFilePath, base4);
|
|
338579
338605
|
await tempGit.exec(["add", filePath]);
|
|
338580
338606
|
await tempGit.exec(["commit", "-m", `base for ${filePath}`, "--allow-empty"]);
|
|
338581
338607
|
await tempGit.execWithInput(["apply", "--allow-empty"], fileDiff);
|
|
338582
|
-
return await (0,
|
|
338608
|
+
return await (0, import_promises185.readFile)(tempFilePath, "utf-8");
|
|
338583
338609
|
} catch {
|
|
338584
338610
|
return null;
|
|
338585
338611
|
}
|
|
@@ -338596,8 +338622,8 @@ var require_dist14 = __commonJS({
|
|
|
338596
338622
|
if (!fileDiff) return false;
|
|
338597
338623
|
try {
|
|
338598
338624
|
const tempFilePath = (0, import_node_path210.join)(tempDir2, filePath);
|
|
338599
|
-
await (0,
|
|
338600
|
-
await (0,
|
|
338625
|
+
await (0, import_promises185.mkdir)((0, import_node_path210.dirname)(tempFilePath), { recursive: true });
|
|
338626
|
+
await (0, import_promises185.writeFile)(tempFilePath, content5);
|
|
338601
338627
|
await tempGit.exec(["add", filePath]);
|
|
338602
338628
|
await tempGit.exec(["commit", "-m", `check already-applied ${filePath}`, "--allow-empty"]);
|
|
338603
338629
|
await tempGit.execWithInput(["apply", "--reverse", "--check", "--allow-empty"], fileDiff);
|
|
@@ -340634,6 +340660,7 @@ var require_PostGenerationPipeline = __commonJS({
|
|
|
340634
340660
|
var child_process_1 = require("child_process");
|
|
340635
340661
|
var constants_1 = require_constants3();
|
|
340636
340662
|
var PipelineLogger_1 = require_PipelineLogger();
|
|
340663
|
+
var AutoVersionStep_1 = require_AutoVersionStep();
|
|
340637
340664
|
var GithubStep_1 = require_GithubStep();
|
|
340638
340665
|
var ReplayStep_1 = require_ReplayStep();
|
|
340639
340666
|
var PostGenerationPipeline2 = class {
|
|
@@ -340647,6 +340674,9 @@ var require_PostGenerationPipeline = __commonJS({
|
|
|
340647
340674
|
this.logger.warn("Replay is not supported with GitHub push mode. Disabling replay to prevent force push to base branch.");
|
|
340648
340675
|
config5.replay.enabled = false;
|
|
340649
340676
|
}
|
|
340677
|
+
if (config5.autoVersion?.enabled) {
|
|
340678
|
+
this.steps.push(new AutoVersionStep_1.AutoVersionStep(config5.outputDir, this.logger, config5.autoVersion));
|
|
340679
|
+
}
|
|
340650
340680
|
if (config5.replay?.enabled) {
|
|
340651
340681
|
this.steps.push(new ReplayStep_1.ReplayStep(config5.outputDir, this.logger, config5.replay, config5.cliVersion, config5.generatorVersions, config5.generatorName));
|
|
340652
340682
|
}
|
|
@@ -340675,6 +340705,9 @@ var require_PostGenerationPipeline = __commonJS({
|
|
|
340675
340705
|
if (step.name === "replay") {
|
|
340676
340706
|
result.steps.replay = stepResult;
|
|
340677
340707
|
pipelineContext.previousStepResults.replay = stepResult;
|
|
340708
|
+
} else if (step.name === "autoVersion") {
|
|
340709
|
+
result.steps.autoVersion = stepResult;
|
|
340710
|
+
pipelineContext.previousStepResults.autoVersion = stepResult;
|
|
340678
340711
|
} else if (step.name === "fernignore") {
|
|
340679
340712
|
result.steps.fernignore = stepResult;
|
|
340680
340713
|
} else if (step.name === "github") {
|
|
@@ -352409,8 +352442,8 @@ var require_jsonfile = __commonJS({
|
|
|
352409
352442
|
const str3 = stringify5(obj, options2);
|
|
352410
352443
|
await universalify.fromCallback(fs27.writeFile)(file4, str3, options2);
|
|
352411
352444
|
}
|
|
352412
|
-
var
|
|
352413
|
-
function
|
|
352445
|
+
var writeFile91 = universalify.fromPromise(_writeFile);
|
|
352446
|
+
function writeFileSync9(file4, obj, options2 = {}) {
|
|
352414
352447
|
const fs27 = options2.fs || _fs;
|
|
352415
352448
|
const str3 = stringify5(obj, options2);
|
|
352416
352449
|
return fs27.writeFileSync(file4, str3, options2);
|
|
@@ -352418,8 +352451,8 @@ var require_jsonfile = __commonJS({
|
|
|
352418
352451
|
module4.exports = {
|
|
352419
352452
|
readFile: readFile104,
|
|
352420
352453
|
readFileSync: readFileSync19,
|
|
352421
|
-
writeFile:
|
|
352422
|
-
writeFileSync:
|
|
352454
|
+
writeFile: writeFile91,
|
|
352455
|
+
writeFileSync: writeFileSync9
|
|
352423
352456
|
};
|
|
352424
352457
|
}
|
|
352425
352458
|
});
|
|
@@ -476739,6 +476772,15 @@ var PublishTarget = {
|
|
|
476739
476772
|
}
|
|
476740
476773
|
};
|
|
476741
476774
|
},
|
|
476775
|
+
go: (value2) => {
|
|
476776
|
+
return {
|
|
476777
|
+
...value2,
|
|
476778
|
+
type: "go",
|
|
476779
|
+
_visit: function(visitor) {
|
|
476780
|
+
return PublishTarget._visit(this, visitor);
|
|
476781
|
+
}
|
|
476782
|
+
};
|
|
476783
|
+
},
|
|
476742
476784
|
_visit: (value2, visitor) => {
|
|
476743
476785
|
switch (value2.type) {
|
|
476744
476786
|
case "postman":
|
|
@@ -476751,6 +476793,8 @@ var PublishTarget = {
|
|
|
476751
476793
|
return visitor.pypi(value2);
|
|
476752
476794
|
case "crates":
|
|
476753
476795
|
return visitor.crates(value2);
|
|
476796
|
+
case "go":
|
|
476797
|
+
return visitor.go(value2);
|
|
476754
476798
|
default:
|
|
476755
476799
|
return visitor._other(value2);
|
|
476756
476800
|
}
|
|
@@ -478337,6 +478381,7 @@ __export(serialization_exports2, {
|
|
|
478337
478381
|
FloatValidationRules: () => FloatValidationRules,
|
|
478338
478382
|
GenerationMetadata: () => GenerationMetadata,
|
|
478339
478383
|
GithubPublish: () => GithubPublish,
|
|
478384
|
+
GoPublishTarget: () => GoPublishTarget,
|
|
478340
478385
|
GrpcTransport: () => GrpcTransport2,
|
|
478341
478386
|
HeaderApiVersionScheme: () => HeaderApiVersionScheme,
|
|
478342
478387
|
HeaderAuthScheme: () => HeaderAuthScheme,
|
|
@@ -483263,6 +483308,12 @@ var CratesPublishTarget = schemas_exports3.objectWithoutOptionalProperties({
|
|
|
483263
483308
|
packageName: schemas_exports3.string().optional()
|
|
483264
483309
|
});
|
|
483265
483310
|
|
|
483311
|
+
// ../../ir-sdk/lib/sdk/serialization/resources/publish/types/GoPublishTarget.js
|
|
483312
|
+
var GoPublishTarget = schemas_exports3.objectWithoutOptionalProperties({
|
|
483313
|
+
version: schemas_exports3.string().optional(),
|
|
483314
|
+
modulePath: schemas_exports3.string().optional()
|
|
483315
|
+
});
|
|
483316
|
+
|
|
483266
483317
|
// ../../ir-sdk/lib/sdk/serialization/resources/publish/types/MavenPublishTarget.js
|
|
483267
483318
|
var MavenPublishTarget = schemas_exports3.objectWithoutOptionalProperties({
|
|
483268
483319
|
coordinate: schemas_exports3.string().optional(),
|
|
@@ -483298,7 +483349,8 @@ var PublishTarget2 = schemas_exports3.union("type", {
|
|
|
483298
483349
|
npm: NpmPublishTarget,
|
|
483299
483350
|
maven: MavenPublishTarget,
|
|
483300
483351
|
pypi: PypiPublishTarget,
|
|
483301
|
-
crates: CratesPublishTarget
|
|
483352
|
+
crates: CratesPublishTarget,
|
|
483353
|
+
go: GoPublishTarget
|
|
483302
483354
|
}).transform({
|
|
483303
483355
|
transform: (value2) => {
|
|
483304
483356
|
switch (value2.type) {
|
|
@@ -483312,6 +483364,8 @@ var PublishTarget2 = schemas_exports3.union("type", {
|
|
|
483312
483364
|
return PublishTarget.pypi(value2);
|
|
483313
483365
|
case "crates":
|
|
483314
483366
|
return PublishTarget.crates(value2);
|
|
483367
|
+
case "go":
|
|
483368
|
+
return PublishTarget.go(value2);
|
|
483315
483369
|
default:
|
|
483316
483370
|
return value2;
|
|
483317
483371
|
}
|
|
@@ -484286,6 +484340,7 @@ __export(publish_exports2, {
|
|
|
484286
484340
|
DirectPublish: () => DirectPublish,
|
|
484287
484341
|
Filesystem: () => Filesystem,
|
|
484288
484342
|
GithubPublish: () => GithubPublish,
|
|
484343
|
+
GoPublishTarget: () => GoPublishTarget,
|
|
484289
484344
|
MavenPublishTarget: () => MavenPublishTarget,
|
|
484290
484345
|
NpmPublishTarget: () => NpmPublishTarget,
|
|
484291
484346
|
PostmanPublishTarget: () => PostmanPublishTarget,
|
|
@@ -567233,25 +567288,28 @@ var TtyAwareLogger = class {
|
|
|
567233
567288
|
}
|
|
567234
567289
|
paint() {
|
|
567235
567290
|
const spinnerFrame = this.spinner.frame();
|
|
567236
|
-
const
|
|
567291
|
+
const frames = [];
|
|
567237
567292
|
for (const task of this.tasks) {
|
|
567238
|
-
const
|
|
567239
|
-
if (
|
|
567240
|
-
|
|
567293
|
+
const body = task.printInteractiveTasks({ spinner: spinnerFrame });
|
|
567294
|
+
if (body.length > 0) {
|
|
567295
|
+
frames.push({ title: task.title, body });
|
|
567241
567296
|
}
|
|
567242
567297
|
}
|
|
567243
|
-
if (
|
|
567298
|
+
if (frames.length === 0) {
|
|
567244
567299
|
return "";
|
|
567245
567300
|
}
|
|
567246
567301
|
const spinnerStatus = process.env.FERN_SPINNER_STATUS;
|
|
567247
|
-
if (spinnerStatus
|
|
567248
|
-
|
|
567302
|
+
if (spinnerStatus) {
|
|
567303
|
+
const first3 = frames[0];
|
|
567304
|
+
if (first3 != null) {
|
|
567305
|
+
first3.body = `${first3.body} - ${spinnerStatus}`;
|
|
567306
|
+
}
|
|
567249
567307
|
}
|
|
567250
|
-
const paint = [
|
|
567251
|
-
"\u250C\u2500",
|
|
567252
|
-
|
|
567308
|
+
const paint = frames.map(({ title: title3, body }) => [
|
|
567309
|
+
title3 != null ? `\u250C\u2500 ${title3} \u2500` : "\u250C\u2500",
|
|
567310
|
+
addPrefixToString({ content: body, prefix: "\u2502 ", includePrefixOnAllLines: true }),
|
|
567253
567311
|
"\u2514\u2500"
|
|
567254
|
-
].join("\n") + "\n";
|
|
567312
|
+
].join("\n")).join("\n") + "\n";
|
|
567255
567313
|
this.lastPaint = paint;
|
|
567256
567314
|
return paint;
|
|
567257
567315
|
}
|
|
@@ -614298,7 +614356,7 @@ var AccessTokenPosthogManager = class {
|
|
|
614298
614356
|
properties: {
|
|
614299
614357
|
...event,
|
|
614300
614358
|
...event.properties,
|
|
614301
|
-
version: "4.
|
|
614359
|
+
version: "4.81.0-3-gaa0d9a2b5d2",
|
|
614302
614360
|
usingAccessToken: true
|
|
614303
614361
|
}
|
|
614304
614362
|
});
|
|
@@ -614352,7 +614410,7 @@ var UserPosthogManager = class {
|
|
|
614352
614410
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
614353
614411
|
event: "CLI",
|
|
614354
614412
|
properties: {
|
|
614355
|
-
version: "4.
|
|
614413
|
+
version: "4.81.0-3-gaa0d9a2b5d2",
|
|
614356
614414
|
...event,
|
|
614357
614415
|
...event.properties,
|
|
614358
614416
|
usingAccessToken: false,
|
|
@@ -746287,7 +746345,7 @@ function inflateIr(ir10, casingsGenerator) {
|
|
|
746287
746345
|
serviceTypeReferenceInfo: ir10.serviceTypeReferenceInfo,
|
|
746288
746346
|
readmeConfig: ir10.readmeConfig,
|
|
746289
746347
|
sourceConfig: ir10.sourceConfig,
|
|
746290
|
-
publishConfig: ir10.publishConfig,
|
|
746348
|
+
publishConfig: ir10.publishConfig != null ? convertPublishConfig2(ir10.publishConfig) : void 0,
|
|
746291
746349
|
dynamic: ir10.dynamic != null ? inflateDynamicIr(ir10.dynamic) : void 0,
|
|
746292
746350
|
selfHosted: ir10.selfHosted,
|
|
746293
746351
|
audiences: ir10.audiences,
|
|
@@ -746304,6 +746362,43 @@ function inflateIr(ir10, casingsGenerator) {
|
|
|
746304
746362
|
apiPlayground: ir10.apiPlayground
|
|
746305
746363
|
};
|
|
746306
746364
|
}
|
|
746365
|
+
function convertPublishConfig2(publishConfig) {
|
|
746366
|
+
return IrVersions_exports.V66.PublishingConfig._visit(publishConfig, {
|
|
746367
|
+
github: (github) => {
|
|
746368
|
+
const convertedTarget = convertPublishTarget3(github.target);
|
|
746369
|
+
return convertedTarget != null ? IrVersions_exports.V65.PublishingConfig.github({
|
|
746370
|
+
...github,
|
|
746371
|
+
target: convertedTarget
|
|
746372
|
+
}) : void 0;
|
|
746373
|
+
},
|
|
746374
|
+
direct: (direct) => {
|
|
746375
|
+
const convertedTarget = convertPublishTarget3(direct.target);
|
|
746376
|
+
return convertedTarget != null ? IrVersions_exports.V65.PublishingConfig.direct({
|
|
746377
|
+
target: convertedTarget
|
|
746378
|
+
}) : void 0;
|
|
746379
|
+
},
|
|
746380
|
+
filesystem: (filesystem) => {
|
|
746381
|
+
const convertedTarget = filesystem.publishTarget != null ? convertPublishTarget3(filesystem.publishTarget) : void 0;
|
|
746382
|
+
return IrVersions_exports.V65.PublishingConfig.filesystem({
|
|
746383
|
+
generateFullProject: filesystem.generateFullProject,
|
|
746384
|
+
publishTarget: convertedTarget
|
|
746385
|
+
});
|
|
746386
|
+
},
|
|
746387
|
+
_other: () => void 0
|
|
746388
|
+
});
|
|
746389
|
+
}
|
|
746390
|
+
function convertPublishTarget3(target) {
|
|
746391
|
+
return IrVersions_exports.V66.PublishTarget._visit(target, {
|
|
746392
|
+
postman: IrVersions_exports.V65.PublishTarget.postman,
|
|
746393
|
+
npm: IrVersions_exports.V65.PublishTarget.npm,
|
|
746394
|
+
maven: IrVersions_exports.V65.PublishTarget.maven,
|
|
746395
|
+
pypi: IrVersions_exports.V65.PublishTarget.pypi,
|
|
746396
|
+
crates: IrVersions_exports.V65.PublishTarget.crates,
|
|
746397
|
+
// go publish target is not supported in v65, return undefined
|
|
746398
|
+
go: () => void 0,
|
|
746399
|
+
_other: () => void 0
|
|
746400
|
+
});
|
|
746401
|
+
}
|
|
746307
746402
|
|
|
746308
746403
|
// ../generation/ir-migrations/lib/IntermediateRepresentationMigrator.js
|
|
746309
746404
|
function getIntermediateRepresentationMigrator() {
|
|
@@ -788468,13 +788563,13 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context3 }) {
|
|
|
788468
788563
|
}
|
|
788469
788564
|
}
|
|
788470
788565
|
}
|
|
788471
|
-
const { writeFile:
|
|
788566
|
+
const { writeFile: writeFile91 } = await import("fs/promises");
|
|
788472
788567
|
const yamlContent = jsYaml.dump(parsed, {
|
|
788473
788568
|
indent: 2,
|
|
788474
788569
|
lineWidth: -1,
|
|
788475
788570
|
noRefs: true
|
|
788476
788571
|
});
|
|
788477
|
-
await
|
|
788572
|
+
await writeFile91(overrideFilePath, yamlContent, "utf-8");
|
|
788478
788573
|
context3.logger.info(`Removed ${validationResult.invalidCount} invalid AI examples from ai_examples_override.yml`);
|
|
788479
788574
|
return {
|
|
788480
788575
|
removedCount: validationResult.invalidCount,
|
|
@@ -831633,7 +831728,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
831633
831728
|
var LOGS_FOLDER_NAME = "logs";
|
|
831634
831729
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
831635
831730
|
function getCliSource() {
|
|
831636
|
-
const version7 = "4.
|
|
831731
|
+
const version7 = "4.81.0-3-gaa0d9a2b5d2";
|
|
831637
831732
|
return `cli@${version7}`;
|
|
831638
831733
|
}
|
|
831639
831734
|
var DebugLogger = class {
|
|
@@ -834508,6 +834603,9 @@ async function validateAPIWorkspaceAndLogIssues({ workspace, context: context3,
|
|
|
834508
834603
|
}
|
|
834509
834604
|
}
|
|
834510
834605
|
|
|
834606
|
+
// ../generation/remote-generation/remote-workspace-runner/lib/runRemoteGenerationForAPIWorkspace.js
|
|
834607
|
+
init_lib4();
|
|
834608
|
+
|
|
834511
834609
|
// ../workspace/loader/lib/handleFailedWorkspaceParserResult.js
|
|
834512
834610
|
init_lib4();
|
|
834513
834611
|
init_zod();
|
|
@@ -841997,14 +842095,51 @@ async function uploadDynamicIRForSdkGeneration({ fdr, organization, version: ver
|
|
|
841997
842095
|
}
|
|
841998
842096
|
|
|
841999
842097
|
// ../generation/remote-generation/remote-workspace-runner/lib/runRemoteGenerationForAPIWorkspace.js
|
|
842000
|
-
async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization, workspace, context: context3, generatorGroup, version: version7, shouldLogS3Url, token, whitelabel, absolutePathToPreview, isPreview, fiddlePreview, pushPreviewBranch, mode, fernignorePath, skipFernignore, dynamicIrOnly, validateWorkspace, retryRateLimited, requireEnvVars, automationMode, autoMerge }) {
|
|
842098
|
+
async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization, workspace, context: context3, generatorGroup, version: version7, shouldLogS3Url, token, whitelabel, absolutePathToPreview, isPreview, fiddlePreview, pushPreviewBranch, mode, fernignorePath, skipFernignore, dynamicIrOnly, validateWorkspace, retryRateLimited, requireEnvVars, automationMode, autoMerge, automation }) {
|
|
842001
842099
|
if (generatorGroup.generators.length === 0) {
|
|
842002
842100
|
context3.logger.warn("No generators specified.");
|
|
842003
842101
|
return null;
|
|
842004
842102
|
}
|
|
842005
|
-
const interactiveTasks = [];
|
|
842006
842103
|
const snippetsProducedBy = [];
|
|
842007
|
-
|
|
842104
|
+
const results = await Promise.all(generatorGroup.generators.map((generatorInvocation) => context3.runInteractiveTask({ name: generatorInvocation.name }, (interactiveTaskContext) => generateOne({
|
|
842105
|
+
generatorInvocation,
|
|
842106
|
+
interactiveTaskContext,
|
|
842107
|
+
// Closed-over state + params passed through to the per-generator worker.
|
|
842108
|
+
projectConfig,
|
|
842109
|
+
organization,
|
|
842110
|
+
workspace,
|
|
842111
|
+
context: context3,
|
|
842112
|
+
generatorGroup,
|
|
842113
|
+
version: version7,
|
|
842114
|
+
shouldLogS3Url,
|
|
842115
|
+
token,
|
|
842116
|
+
whitelabel,
|
|
842117
|
+
absolutePathToPreview,
|
|
842118
|
+
isPreview,
|
|
842119
|
+
fiddlePreview,
|
|
842120
|
+
pushPreviewBranch,
|
|
842121
|
+
mode,
|
|
842122
|
+
fernignorePath,
|
|
842123
|
+
skipFernignore,
|
|
842124
|
+
dynamicIrOnly,
|
|
842125
|
+
validateWorkspace,
|
|
842126
|
+
retryRateLimited,
|
|
842127
|
+
requireEnvVars,
|
|
842128
|
+
automationMode,
|
|
842129
|
+
autoMerge,
|
|
842130
|
+
automation,
|
|
842131
|
+
onSnippetsProduced: (invocation) => snippetsProducedBy.push(invocation)
|
|
842132
|
+
}))));
|
|
842133
|
+
if (automation == null && results.some((didSucceed) => !didSucceed)) {
|
|
842134
|
+
context3.failAndThrow();
|
|
842135
|
+
}
|
|
842136
|
+
return {
|
|
842137
|
+
snippetsProducedBy
|
|
842138
|
+
};
|
|
842139
|
+
}
|
|
842140
|
+
async function generateOne({ generatorInvocation, interactiveTaskContext, projectConfig, organization, workspace, context: context3, generatorGroup, version: version7, shouldLogS3Url, token, whitelabel, absolutePathToPreview, isPreview, fiddlePreview, pushPreviewBranch, mode, fernignorePath, skipFernignore, dynamicIrOnly, validateWorkspace, retryRateLimited, requireEnvVars, automationMode, autoMerge, automation, onSnippetsProduced }) {
|
|
842141
|
+
const startedAt = Date.now();
|
|
842142
|
+
try {
|
|
842008
842143
|
const settings = getBaseOpenAPIWorkspaceSettingsFromGeneratorInvocation(generatorInvocation);
|
|
842009
842144
|
const fernWorkspace = await workspace.toFernWorkspace({ context: context3 }, settings, generatorInvocation.apiOverride?.specs);
|
|
842010
842145
|
if (validateWorkspace) {
|
|
@@ -842064,8 +842199,8 @@ async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization,
|
|
|
842064
842199
|
automationMode,
|
|
842065
842200
|
autoMerge
|
|
842066
842201
|
});
|
|
842067
|
-
if (remoteTaskHandlerResponse
|
|
842068
|
-
|
|
842202
|
+
if (remoteTaskHandlerResponse?.createdSnippets) {
|
|
842203
|
+
onSnippetsProduced(generatorInvocation);
|
|
842069
842204
|
if (generatorInvocation.absolutePathToLocalSnippets != null && remoteTaskHandlerResponse.snippetsS3PreSignedReadUrl != null) {
|
|
842070
842205
|
await downloadSnippetsForTask({
|
|
842071
842206
|
snippetsS3PreSignedReadUrl: remoteTaskHandlerResponse.snippetsS3PreSignedReadUrl,
|
|
@@ -842074,14 +842209,27 @@ async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization,
|
|
|
842074
842209
|
});
|
|
842075
842210
|
}
|
|
842076
842211
|
}
|
|
842077
|
-
|
|
842078
|
-
|
|
842079
|
-
|
|
842080
|
-
|
|
842212
|
+
automation?.recorder.recordSuccess({
|
|
842213
|
+
apiName: workspace.workspaceName,
|
|
842214
|
+
groupName: generatorGroup.groupName,
|
|
842215
|
+
generatorName: generatorInvocation.name,
|
|
842216
|
+
version: remoteTaskHandlerResponse?.actualVersion ?? null,
|
|
842217
|
+
durationMs: Date.now() - startedAt
|
|
842218
|
+
});
|
|
842219
|
+
} catch (error50) {
|
|
842220
|
+
if (automation == null) {
|
|
842221
|
+
throw error50;
|
|
842222
|
+
}
|
|
842223
|
+
const message = extractErrorMessage(error50);
|
|
842224
|
+
automation.recorder.recordFailure({
|
|
842225
|
+
apiName: workspace.workspaceName,
|
|
842226
|
+
groupName: generatorGroup.groupName,
|
|
842227
|
+
generatorName: generatorInvocation.name,
|
|
842228
|
+
errorMessage: message,
|
|
842229
|
+
durationMs: Date.now() - startedAt
|
|
842230
|
+
});
|
|
842231
|
+
interactiveTaskContext.failWithoutThrowing(message);
|
|
842081
842232
|
}
|
|
842082
|
-
return {
|
|
842083
|
-
snippetsProducedBy
|
|
842084
|
-
};
|
|
842085
842233
|
}
|
|
842086
842234
|
|
|
842087
842235
|
// ../generation/remote-generation/remote-workspace-runner/lib/runRemoteGenerationForDocsWorkspace.js
|
|
@@ -843147,7 +843295,7 @@ var LegacyDocsPublisher = class {
|
|
|
843147
843295
|
previewId,
|
|
843148
843296
|
disableTemplates: void 0,
|
|
843149
843297
|
skipUpload,
|
|
843150
|
-
cliVersion: "4.
|
|
843298
|
+
cliVersion: "4.81.0-3-gaa0d9a2b5d2"
|
|
843151
843299
|
});
|
|
843152
843300
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
843153
843301
|
return { success: false };
|
|
@@ -896823,6 +896971,25 @@ function getPublishConfig2({ generatorInvocation, org, version: version7, userPr
|
|
|
896823
896971
|
packageName
|
|
896824
896972
|
});
|
|
896825
896973
|
context3.logger.debug(`Created CratesPublishTarget: version ${version7} package name: ${packageName}`);
|
|
896974
|
+
} else if (generatorInvocation.language === "go") {
|
|
896975
|
+
if (userProvidedVersion != null) {
|
|
896976
|
+
const goModulePath = (() => {
|
|
896977
|
+
const config5 = generatorInvocation.raw?.config;
|
|
896978
|
+
if (typeof config5 !== "object" || config5 === null) {
|
|
896979
|
+
return void 0;
|
|
896980
|
+
}
|
|
896981
|
+
const module4 = config5.module;
|
|
896982
|
+
if (module4 == null || typeof module4.path !== "string") {
|
|
896983
|
+
return void 0;
|
|
896984
|
+
}
|
|
896985
|
+
return module4.path;
|
|
896986
|
+
})();
|
|
896987
|
+
publishTarget = PublishTarget.go({
|
|
896988
|
+
version: userProvidedVersion,
|
|
896989
|
+
modulePath: goModulePath
|
|
896990
|
+
});
|
|
896991
|
+
context3.logger.debug(`Created GoPublishTarget: version ${userProvidedVersion} module path: ${goModulePath}`);
|
|
896992
|
+
}
|
|
896826
896993
|
} else if (generatorInvocation.language === "java") {
|
|
896827
896994
|
const config5 = generatorInvocation.raw?.config;
|
|
896828
896995
|
const mavenCoordinate = (() => {
|
|
@@ -917724,6 +917891,7 @@ var TaskContextImpl = class {
|
|
|
917724
917891
|
result = TaskResult.Success;
|
|
917725
917892
|
logImmediately;
|
|
917726
917893
|
logPrefix;
|
|
917894
|
+
title;
|
|
917727
917895
|
subtasks = [];
|
|
917728
917896
|
shouldBufferLogs;
|
|
917729
917897
|
bufferedLogs = [];
|
|
@@ -917734,6 +917902,7 @@ var TaskContextImpl = class {
|
|
|
917734
917902
|
constructor({
|
|
917735
917903
|
logImmediately,
|
|
917736
917904
|
logPrefix,
|
|
917905
|
+
title: title3,
|
|
917737
917906
|
takeOverTerminal,
|
|
917738
917907
|
onResult,
|
|
917739
917908
|
shouldBufferLogs,
|
|
@@ -917742,6 +917911,7 @@ var TaskContextImpl = class {
|
|
|
917742
917911
|
}) {
|
|
917743
917912
|
this.logImmediately = logImmediately;
|
|
917744
917913
|
this.logPrefix = logPrefix ?? "";
|
|
917914
|
+
this.title = title3;
|
|
917745
917915
|
this.takeOverTerminal = takeOverTerminal;
|
|
917746
917916
|
this.onResult = onResult;
|
|
917747
917917
|
this.shouldBufferLogs = shouldBufferLogs;
|
|
@@ -917882,25 +918052,34 @@ var InteractiveTaskContextImpl = class extends TaskContextImpl {
|
|
|
917882
918052
|
}
|
|
917883
918053
|
lines.push(...this.subtasks.map((subtask) => subtask.print({ spinner })));
|
|
917884
918054
|
return addPrefixToString({
|
|
917885
|
-
prefix:
|
|
918055
|
+
prefix: this.getIcon({ spinner }),
|
|
917886
918056
|
content: lines.join("\n")
|
|
917887
918057
|
});
|
|
917888
918058
|
}
|
|
917889
918059
|
printInteractiveTasks({ spinner }) {
|
|
917890
918060
|
return this.print({ spinner });
|
|
917891
918061
|
}
|
|
918062
|
+
/**
|
|
918063
|
+
* Tasks with subtasks (e.g. a generator group whose children are individual generators)
|
|
918064
|
+
* render with a disclosure-triangle glyph instead of the leaf check/x/spinner, so the
|
|
918065
|
+
* tree shape is legible at a glance. Leaves keep the existing per-status glyphs.
|
|
918066
|
+
*
|
|
918067
|
+
* Every branch returns a string ending in a trailing space so the caller doesn't need
|
|
918068
|
+
* to pad — `spinner` from ora already includes one, and static glyphs add one explicitly.
|
|
918069
|
+
*/
|
|
917892
918070
|
getIcon({ spinner }) {
|
|
918071
|
+
const hasChildren2 = this.subtasks.length > 0;
|
|
917893
918072
|
switch (this.status) {
|
|
917894
918073
|
case "notStarted":
|
|
917895
|
-
return source_default.dim("\u25E6");
|
|
918074
|
+
return hasChildren2 ? source_default.dim("\u25B8 ") : source_default.dim("\u25E6 ");
|
|
917896
918075
|
case "running":
|
|
917897
|
-
return spinner;
|
|
918076
|
+
return hasChildren2 ? source_default.cyan("\u25BE ") : spinner;
|
|
917898
918077
|
case "finished":
|
|
917899
918078
|
switch (this.getResult()) {
|
|
917900
918079
|
case TaskResult.Success:
|
|
917901
|
-
return source_default.green("\u2713");
|
|
918080
|
+
return hasChildren2 ? source_default.green("\u25BE ") : source_default.green("\u2713 ");
|
|
917902
918081
|
case TaskResult.Failure:
|
|
917903
|
-
return source_default.red("x");
|
|
918082
|
+
return hasChildren2 ? source_default.red("\u25BE ") : source_default.red("x ");
|
|
917904
918083
|
}
|
|
917905
918084
|
}
|
|
917906
918085
|
}
|
|
@@ -918236,7 +918415,7 @@ var CliContext = class _CliContext {
|
|
|
918236
918415
|
if (false) {
|
|
918237
918416
|
this.logger.error("CLI_VERSION is not defined");
|
|
918238
918417
|
}
|
|
918239
|
-
return "4.
|
|
918418
|
+
return "4.81.0-3-gaa0d9a2b5d2";
|
|
918240
918419
|
}
|
|
918241
918420
|
getCliName() {
|
|
918242
918421
|
if (false) {
|
|
@@ -918383,16 +918562,16 @@ var CliContext = class _CliContext {
|
|
|
918383
918562
|
logger = createLogger((level, ...args) => this.log(level, ...args));
|
|
918384
918563
|
stderr = createLogger((level, ...args) => this.logStderr(level, ...args));
|
|
918385
918564
|
constructTaskInitForWorkspace(workspace) {
|
|
918386
|
-
const
|
|
918387
|
-
|
|
918388
|
-
);
|
|
918565
|
+
const workspaceName = workspace.type === "docs" ? "docs" : workspace.workspaceName ?? "api";
|
|
918566
|
+
const prefixWithoutPadding = wrapWorkspaceNameForPrefix(workspaceName);
|
|
918389
918567
|
const minLengthForPrefix = 1 + (this.longestWorkspaceName != null ? wrapWorkspaceNameForPrefix(this.longestWorkspaceName) : prefixWithoutPadding).length;
|
|
918390
918568
|
const prefix2 = prefixWithoutPadding.padEnd(minLengthForPrefix);
|
|
918391
918569
|
const colorForWorkspace = WORKSPACE_NAME_COLORS[this.numTasks++ % WORKSPACE_NAME_COLORS.length];
|
|
918392
918570
|
const prefixWithColor = source_default.hex(colorForWorkspace)(prefix2);
|
|
918393
918571
|
return {
|
|
918394
918572
|
...this.constructTaskInit(),
|
|
918395
|
-
logPrefix: prefixWithColor
|
|
918573
|
+
logPrefix: prefixWithColor,
|
|
918574
|
+
title: source_default.hex(colorForWorkspace).bold(workspaceName)
|
|
918396
918575
|
};
|
|
918397
918576
|
}
|
|
918398
918577
|
constructTaskInit() {
|
|
@@ -919822,6 +920001,1007 @@ async function addGeneratorToWorkspaces({
|
|
|
919822
920001
|
);
|
|
919823
920002
|
}
|
|
919824
920003
|
|
|
920004
|
+
// src/commands/generate/filterGenerators.ts
|
|
920005
|
+
function parseGeneratorArg(generatorArg) {
|
|
920006
|
+
if (generatorArg == null) {
|
|
920007
|
+
return { generatorName: void 0, generatorIndex: void 0 };
|
|
920008
|
+
}
|
|
920009
|
+
const parsed = generatorArg.length > 0 ? Number(generatorArg) : Number.NaN;
|
|
920010
|
+
if (!Number.isNaN(parsed) && Number.isInteger(parsed) && parsed >= 0) {
|
|
920011
|
+
return { generatorName: void 0, generatorIndex: parsed };
|
|
920012
|
+
}
|
|
920013
|
+
return { generatorName: generatorArg, generatorIndex: void 0 };
|
|
920014
|
+
}
|
|
920015
|
+
function filterGenerators({
|
|
920016
|
+
generators,
|
|
920017
|
+
generatorIndex,
|
|
920018
|
+
generatorName,
|
|
920019
|
+
groupName
|
|
920020
|
+
}) {
|
|
920021
|
+
if (generatorIndex != null) {
|
|
920022
|
+
const generator = generators[generatorIndex];
|
|
920023
|
+
if (generator == null) {
|
|
920024
|
+
return {
|
|
920025
|
+
ok: false,
|
|
920026
|
+
error: `Generator index ${generatorIndex} is out of bounds in group '${groupName}' (${generators.length} generators available)`
|
|
920027
|
+
};
|
|
920028
|
+
}
|
|
920029
|
+
return { ok: true, generators: [generator] };
|
|
920030
|
+
}
|
|
920031
|
+
if (generatorName != null) {
|
|
920032
|
+
const filtered = generators.filter((gen) => gen.name === generatorName);
|
|
920033
|
+
if (filtered.length === 0) {
|
|
920034
|
+
const available = generators.map((gen) => gen.name);
|
|
920035
|
+
return {
|
|
920036
|
+
ok: false,
|
|
920037
|
+
error: `Generator '${generatorName}' not found in group '${groupName}'. Available generators: ${available.join(", ")}`
|
|
920038
|
+
};
|
|
920039
|
+
}
|
|
920040
|
+
return { ok: true, generators: filtered };
|
|
920041
|
+
}
|
|
920042
|
+
return { ok: true, generators };
|
|
920043
|
+
}
|
|
920044
|
+
|
|
920045
|
+
// src/commands/generate/generateAPIWorkspaces.ts
|
|
920046
|
+
init_lib6();
|
|
920047
|
+
|
|
920048
|
+
// src/constants.ts
|
|
920049
|
+
var API_CLI_OPTION = "api";
|
|
920050
|
+
var GROUP_CLI_OPTION = "group";
|
|
920051
|
+
var PREVIEW_DIRECTORY = ".preview";
|
|
920052
|
+
var APPROVED_DIRECTORIES_FILENAME = "approved-output-directories";
|
|
920053
|
+
var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
920054
|
+
|
|
920055
|
+
// src/commands/generate/checkOutputDirectory.ts
|
|
920056
|
+
init_lib6();
|
|
920057
|
+
var import_promises136 = require("fs/promises");
|
|
920058
|
+
|
|
920059
|
+
// src/persistence/output-directories/getOutputDirectories.ts
|
|
920060
|
+
init_lib6();
|
|
920061
|
+
var import_promises134 = require("fs/promises");
|
|
920062
|
+
|
|
920063
|
+
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
920064
|
+
init_lib6();
|
|
920065
|
+
var import_os16 = require("os");
|
|
920066
|
+
function getPathToOutputDirectoriesFile() {
|
|
920067
|
+
return join8(
|
|
920068
|
+
AbsoluteFilePath2.of((0, import_os16.homedir)()),
|
|
920069
|
+
RelativeFilePath2.of(LOCAL_STORAGE_FOLDER6),
|
|
920070
|
+
RelativeFilePath2.of(APPROVED_DIRECTORIES_FILENAME)
|
|
920071
|
+
);
|
|
920072
|
+
}
|
|
920073
|
+
|
|
920074
|
+
// src/persistence/output-directories/getOutputDirectories.ts
|
|
920075
|
+
async function getOutputDirectories() {
|
|
920076
|
+
const pathToOutputDirectoriesFile = getPathToOutputDirectoriesFile();
|
|
920077
|
+
const doesOutputDirectoriesFileExist = await doesPathExist(pathToOutputDirectoriesFile);
|
|
920078
|
+
if (!doesOutputDirectoriesFileExist) {
|
|
920079
|
+
return [];
|
|
920080
|
+
}
|
|
920081
|
+
const outputDirectoriesFileContents = await (0, import_promises134.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
920082
|
+
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
920083
|
+
return outputDirectories;
|
|
920084
|
+
}
|
|
920085
|
+
|
|
920086
|
+
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
920087
|
+
var import_promises135 = require("fs/promises");
|
|
920088
|
+
var import_path85 = __toESM(require("path"), 1);
|
|
920089
|
+
async function storeOutputDirectories(outputDirectories) {
|
|
920090
|
+
await (0, import_promises135.mkdir)(import_path85.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
|
|
920091
|
+
await (0, import_promises135.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
|
|
920092
|
+
}
|
|
920093
|
+
|
|
920094
|
+
// src/commands/generate/checkOutputDirectory.ts
|
|
920095
|
+
async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
920096
|
+
if (!outputPath || isCI() || force) {
|
|
920097
|
+
return {
|
|
920098
|
+
shouldProceed: true
|
|
920099
|
+
};
|
|
920100
|
+
}
|
|
920101
|
+
const savedDirectories = await getOutputDirectories();
|
|
920102
|
+
if (savedDirectories?.includes(outputPath)) {
|
|
920103
|
+
return {
|
|
920104
|
+
shouldProceed: true
|
|
920105
|
+
};
|
|
920106
|
+
}
|
|
920107
|
+
const doesExist = await doesPathExist(outputPath);
|
|
920108
|
+
if (!doesExist) {
|
|
920109
|
+
return {
|
|
920110
|
+
shouldProceed: true
|
|
920111
|
+
};
|
|
920112
|
+
}
|
|
920113
|
+
const files = await (0, import_promises136.readdir)(outputPath);
|
|
920114
|
+
if (files.length === 0) {
|
|
920115
|
+
return {
|
|
920116
|
+
shouldProceed: true
|
|
920117
|
+
};
|
|
920118
|
+
}
|
|
920119
|
+
const shouldOverwrite = await cliContext.confirmPrompt(
|
|
920120
|
+
`Directory ${outputPath} contains existing files that may be overwritten. Continue?`,
|
|
920121
|
+
false
|
|
920122
|
+
);
|
|
920123
|
+
if (!shouldOverwrite) {
|
|
920124
|
+
return {
|
|
920125
|
+
shouldProceed: false
|
|
920126
|
+
};
|
|
920127
|
+
}
|
|
920128
|
+
await storeOutputDirectories([...savedDirectories ?? [], outputPath]);
|
|
920129
|
+
return {
|
|
920130
|
+
shouldProceed: true
|
|
920131
|
+
};
|
|
920132
|
+
}
|
|
920133
|
+
|
|
920134
|
+
// src/commands/generate/generateAPIWorkspace.ts
|
|
920135
|
+
init_lib6();
|
|
920136
|
+
|
|
920137
|
+
// src/commands/generate/resolveGroupAlias.ts
|
|
920138
|
+
function resolveGroupAlias({
|
|
920139
|
+
name: name2,
|
|
920140
|
+
groupAliases,
|
|
920141
|
+
availableGroupNames
|
|
920142
|
+
}) {
|
|
920143
|
+
const aliasTargets = groupAliases[name2];
|
|
920144
|
+
if (aliasTargets != null) {
|
|
920145
|
+
for (const target of aliasTargets) {
|
|
920146
|
+
if (!availableGroupNames.includes(target)) {
|
|
920147
|
+
return {
|
|
920148
|
+
type: "alias-references-missing-group",
|
|
920149
|
+
alias: name2,
|
|
920150
|
+
missingGroupName: target,
|
|
920151
|
+
availableGroupNames
|
|
920152
|
+
};
|
|
920153
|
+
}
|
|
920154
|
+
}
|
|
920155
|
+
return { type: "resolved", groupNames: aliasTargets };
|
|
920156
|
+
}
|
|
920157
|
+
if (availableGroupNames.includes(name2)) {
|
|
920158
|
+
return { type: "resolved", groupNames: [name2] };
|
|
920159
|
+
}
|
|
920160
|
+
return {
|
|
920161
|
+
type: "unknown",
|
|
920162
|
+
name: name2,
|
|
920163
|
+
availableGroupNames,
|
|
920164
|
+
availableAliasNames: Object.keys(groupAliases)
|
|
920165
|
+
};
|
|
920166
|
+
}
|
|
920167
|
+
|
|
920168
|
+
// src/commands/generate/resolveGroupNamesForGeneration.ts
|
|
920169
|
+
function resolveGroupNamesForGeneration({
|
|
920170
|
+
groupName,
|
|
920171
|
+
generatorsConfiguration,
|
|
920172
|
+
isAutomation
|
|
920173
|
+
}) {
|
|
920174
|
+
if (isAutomation && groupName == null) {
|
|
920175
|
+
return {
|
|
920176
|
+
type: "fan-out",
|
|
920177
|
+
groupNames: generatorsConfiguration.groups.map((g8) => g8.groupName)
|
|
920178
|
+
};
|
|
920179
|
+
}
|
|
920180
|
+
const effective = groupName ?? generatorsConfiguration.defaultGroup;
|
|
920181
|
+
if (effective == null) {
|
|
920182
|
+
return {
|
|
920183
|
+
type: "missing-group",
|
|
920184
|
+
availableGroupNames: generatorsConfiguration.groups.map((g8) => g8.groupName)
|
|
920185
|
+
};
|
|
920186
|
+
}
|
|
920187
|
+
return {
|
|
920188
|
+
type: "targeted",
|
|
920189
|
+
groupName: effective,
|
|
920190
|
+
fromDefaultGroup: groupName == null
|
|
920191
|
+
};
|
|
920192
|
+
}
|
|
920193
|
+
|
|
920194
|
+
// src/commands/generate/describeSkipReason.ts
|
|
920195
|
+
function describeSkipReason(generator, rootAutorelease) {
|
|
920196
|
+
if (!generator.automation.generate) {
|
|
920197
|
+
return "automations.generate is false";
|
|
920198
|
+
}
|
|
920199
|
+
if (generator.absolutePathToLocalOutput != null) {
|
|
920200
|
+
return "output is configured for local-file-system (cannot run remotely)";
|
|
920201
|
+
}
|
|
920202
|
+
if (generator.raw?.autorelease === false) {
|
|
920203
|
+
return "autorelease is false";
|
|
920204
|
+
}
|
|
920205
|
+
if (generator.raw?.autorelease == null && rootAutorelease === false) {
|
|
920206
|
+
return "autorelease is false at the root of generators.yml";
|
|
920207
|
+
}
|
|
920208
|
+
return null;
|
|
920209
|
+
}
|
|
920210
|
+
|
|
920211
|
+
// src/commands/generate/shouldSkipGenerator.ts
|
|
920212
|
+
function shouldSkipGenerator({
|
|
920213
|
+
generator,
|
|
920214
|
+
rootAutorelease
|
|
920215
|
+
}) {
|
|
920216
|
+
return describeSkipReason(generator, rootAutorelease) != null;
|
|
920217
|
+
}
|
|
920218
|
+
|
|
920219
|
+
// src/commands/generate/selectGeneratorsForAutomation.ts
|
|
920220
|
+
function buildAutomationTargeting({
|
|
920221
|
+
generatorIndex,
|
|
920222
|
+
generatorName
|
|
920223
|
+
}) {
|
|
920224
|
+
if (generatorIndex != null) {
|
|
920225
|
+
return { type: "index", index: generatorIndex };
|
|
920226
|
+
}
|
|
920227
|
+
if (generatorName != null) {
|
|
920228
|
+
return { type: "name", name: generatorName };
|
|
920229
|
+
}
|
|
920230
|
+
return { type: "none" };
|
|
920231
|
+
}
|
|
920232
|
+
function selectGeneratorsForAutomation({
|
|
920233
|
+
generators,
|
|
920234
|
+
rootAutorelease,
|
|
920235
|
+
targeting
|
|
920236
|
+
}) {
|
|
920237
|
+
if (targeting.type === "index") {
|
|
920238
|
+
for (const g8 of generators) {
|
|
920239
|
+
const reason = describeSkipReason(g8, rootAutorelease);
|
|
920240
|
+
if (reason != null) {
|
|
920241
|
+
return { type: "reject-opted-out", generatorName: g8.name, index: targeting.index, reason };
|
|
920242
|
+
}
|
|
920243
|
+
}
|
|
920244
|
+
return { type: "run", generators };
|
|
920245
|
+
}
|
|
920246
|
+
const eligible = generators.filter((g8) => !shouldSkipGenerator({ generator: g8, rootAutorelease }));
|
|
920247
|
+
if (eligible.length === 0) {
|
|
920248
|
+
return { type: "empty-after-skip" };
|
|
920249
|
+
}
|
|
920250
|
+
return { type: "run", generators: eligible };
|
|
920251
|
+
}
|
|
920252
|
+
|
|
920253
|
+
// src/commands/generate/shouldSkipMissingGenerator.ts
|
|
920254
|
+
function shouldSkipMissingGenerator({
|
|
920255
|
+
automation,
|
|
920256
|
+
generatorName,
|
|
920257
|
+
generatorIndex
|
|
920258
|
+
}) {
|
|
920259
|
+
return automation != null && generatorName != null && generatorIndex == null;
|
|
920260
|
+
}
|
|
920261
|
+
|
|
920262
|
+
// src/commands/generate/generateAPIWorkspace.ts
|
|
920263
|
+
async function generateWorkspace({
|
|
920264
|
+
organization,
|
|
920265
|
+
workspace,
|
|
920266
|
+
projectConfig,
|
|
920267
|
+
context: context3,
|
|
920268
|
+
groupName,
|
|
920269
|
+
generatorName,
|
|
920270
|
+
generatorIndex,
|
|
920271
|
+
version: version7,
|
|
920272
|
+
shouldLogS3Url,
|
|
920273
|
+
token,
|
|
920274
|
+
useLocalDocker,
|
|
920275
|
+
keepDocker,
|
|
920276
|
+
absolutePathToPreview,
|
|
920277
|
+
mode,
|
|
920278
|
+
runner,
|
|
920279
|
+
inspect: inspect6,
|
|
920280
|
+
lfsOverride,
|
|
920281
|
+
fernignorePath,
|
|
920282
|
+
skipFernignore,
|
|
920283
|
+
dynamicIrOnly,
|
|
920284
|
+
noReplay,
|
|
920285
|
+
retryRateLimited,
|
|
920286
|
+
requireEnvVars,
|
|
920287
|
+
automationMode,
|
|
920288
|
+
autoMerge,
|
|
920289
|
+
automation
|
|
920290
|
+
}) {
|
|
920291
|
+
if (workspace.generatorsConfiguration == null) {
|
|
920292
|
+
context3.logger.warn("This workspaces has no generators.yml");
|
|
920293
|
+
return;
|
|
920294
|
+
}
|
|
920295
|
+
if (workspace.generatorsConfiguration.groups.length === 0) {
|
|
920296
|
+
context3.logger.warn(`This workspace has no groups specified in ${GENERATORS_CONFIGURATION_FILENAME}`);
|
|
920297
|
+
return;
|
|
920298
|
+
}
|
|
920299
|
+
const resolvedGroupNames = resolveGroupsOrFail({
|
|
920300
|
+
groupName,
|
|
920301
|
+
generatorsConfiguration: workspace.generatorsConfiguration,
|
|
920302
|
+
isAutomation: automation != null,
|
|
920303
|
+
context: context3
|
|
920304
|
+
});
|
|
920305
|
+
const { ai: ai10, replay } = workspace.generatorsConfiguration;
|
|
920306
|
+
if (!useLocalDocker && !token) {
|
|
920307
|
+
return context3.failAndThrow("Please run fern login", void 0, { code: CliError.Code.AuthError });
|
|
920308
|
+
}
|
|
920309
|
+
const runnableGroups = resolvedGroupNames.flatMap((resolvedGroupName) => {
|
|
920310
|
+
const runnable = resolveRunnableGroup({
|
|
920311
|
+
resolvedGroupName,
|
|
920312
|
+
workspace,
|
|
920313
|
+
generatorIndex,
|
|
920314
|
+
generatorName,
|
|
920315
|
+
automation,
|
|
920316
|
+
lfsOverride,
|
|
920317
|
+
context: context3,
|
|
920318
|
+
useLocalDocker,
|
|
920319
|
+
token
|
|
920320
|
+
});
|
|
920321
|
+
return runnable != null ? [{ resolvedGroupName, group: runnable }] : [];
|
|
920322
|
+
});
|
|
920323
|
+
await Promise.all(
|
|
920324
|
+
runnableGroups.map(
|
|
920325
|
+
({ resolvedGroupName, group }) => context3.runInteractiveTask({ name: resolvedGroupName }, async (groupContext) => {
|
|
920326
|
+
if (useLocalDocker) {
|
|
920327
|
+
await runLocalGenerationForWorkspace({
|
|
920328
|
+
token,
|
|
920329
|
+
projectConfig,
|
|
920330
|
+
workspace,
|
|
920331
|
+
generatorGroup: group,
|
|
920332
|
+
version: version7,
|
|
920333
|
+
keepDocker,
|
|
920334
|
+
context: groupContext,
|
|
920335
|
+
runner,
|
|
920336
|
+
absolutePathToPreview,
|
|
920337
|
+
inspect: inspect6,
|
|
920338
|
+
ai: ai10,
|
|
920339
|
+
replay,
|
|
920340
|
+
noReplay,
|
|
920341
|
+
validateWorkspace: true,
|
|
920342
|
+
requireEnvVars,
|
|
920343
|
+
skipFernignore,
|
|
920344
|
+
automationMode,
|
|
920345
|
+
autoMerge
|
|
920346
|
+
});
|
|
920347
|
+
} else if (token != null) {
|
|
920348
|
+
await runRemoteGenerationForAPIWorkspace({
|
|
920349
|
+
projectConfig,
|
|
920350
|
+
organization,
|
|
920351
|
+
workspace,
|
|
920352
|
+
context: groupContext,
|
|
920353
|
+
generatorGroup: group,
|
|
920354
|
+
version: version7,
|
|
920355
|
+
shouldLogS3Url,
|
|
920356
|
+
token,
|
|
920357
|
+
whitelabel: workspace.generatorsConfiguration?.whitelabel,
|
|
920358
|
+
absolutePathToPreview,
|
|
920359
|
+
mode,
|
|
920360
|
+
fernignorePath,
|
|
920361
|
+
skipFernignore,
|
|
920362
|
+
dynamicIrOnly,
|
|
920363
|
+
validateWorkspace: true,
|
|
920364
|
+
retryRateLimited,
|
|
920365
|
+
requireEnvVars,
|
|
920366
|
+
automationMode,
|
|
920367
|
+
autoMerge,
|
|
920368
|
+
automation
|
|
920369
|
+
});
|
|
920370
|
+
}
|
|
920371
|
+
})
|
|
920372
|
+
)
|
|
920373
|
+
);
|
|
920374
|
+
}
|
|
920375
|
+
function resolveRunnableGroup({
|
|
920376
|
+
resolvedGroupName,
|
|
920377
|
+
workspace,
|
|
920378
|
+
generatorIndex,
|
|
920379
|
+
generatorName,
|
|
920380
|
+
automation,
|
|
920381
|
+
lfsOverride,
|
|
920382
|
+
context: context3,
|
|
920383
|
+
useLocalDocker,
|
|
920384
|
+
token
|
|
920385
|
+
}) {
|
|
920386
|
+
let group = workspace.generatorsConfiguration?.groups.find(
|
|
920387
|
+
(otherGroup) => otherGroup.groupName === resolvedGroupName
|
|
920388
|
+
);
|
|
920389
|
+
if (group == null) {
|
|
920390
|
+
return context3.failAndThrow(`Group '${resolvedGroupName}' does not exist.`, void 0, {
|
|
920391
|
+
code: CliError.Code.ConfigError
|
|
920392
|
+
});
|
|
920393
|
+
}
|
|
920394
|
+
const filterResult = filterGenerators({
|
|
920395
|
+
generators: group.generators,
|
|
920396
|
+
generatorIndex,
|
|
920397
|
+
generatorName,
|
|
920398
|
+
groupName: resolvedGroupName
|
|
920399
|
+
});
|
|
920400
|
+
if (!filterResult.ok) {
|
|
920401
|
+
if (shouldSkipMissingGenerator({ automation, generatorName, generatorIndex })) {
|
|
920402
|
+
return null;
|
|
920403
|
+
}
|
|
920404
|
+
return context3.failAndThrow(filterResult.error, void 0, { code: CliError.Code.ConfigError });
|
|
920405
|
+
}
|
|
920406
|
+
let filteredGenerators = filterResult.generators;
|
|
920407
|
+
if (automation != null) {
|
|
920408
|
+
const selection = selectGeneratorsForAutomation({
|
|
920409
|
+
generators: filteredGenerators,
|
|
920410
|
+
rootAutorelease: workspace.generatorsConfiguration?.rawConfiguration.autorelease,
|
|
920411
|
+
targeting: buildAutomationTargeting({ generatorIndex, generatorName })
|
|
920412
|
+
});
|
|
920413
|
+
if (selection.type === "reject-opted-out") {
|
|
920414
|
+
return context3.failAndThrow(
|
|
920415
|
+
`Generator '${selection.generatorName}' at index ${selection.index} in group '${resolvedGroupName}' is excluded from automation: ${selection.reason}. Target by name instead to have opt-outs filtered silently, drop the --generator flag to fan out across eligible generators, or re-enable automation for this generator in generators.yml.`,
|
|
920416
|
+
void 0,
|
|
920417
|
+
{ code: CliError.Code.ConfigError }
|
|
920418
|
+
);
|
|
920419
|
+
}
|
|
920420
|
+
if (selection.type === "empty-after-skip") {
|
|
920421
|
+
return null;
|
|
920422
|
+
}
|
|
920423
|
+
filteredGenerators = selection.generators;
|
|
920424
|
+
}
|
|
920425
|
+
group = { ...group, generators: filteredGenerators };
|
|
920426
|
+
if (lfsOverride != null) {
|
|
920427
|
+
group = applyLfsOverride(group, lfsOverride, context3);
|
|
920428
|
+
}
|
|
920429
|
+
if (!useLocalDocker && token != null) {
|
|
920430
|
+
const customImageGenerators = group.generators.filter((g8) => g8.containerImage != null);
|
|
920431
|
+
if (customImageGenerators.length > 0) {
|
|
920432
|
+
const names2 = customImageGenerators.map((g8) => g8.name).join(", ");
|
|
920433
|
+
return context3.failAndThrow(
|
|
920434
|
+
`Custom image configurations are only supported with local generation (--local). The following generators use custom images: ${names2}`
|
|
920435
|
+
);
|
|
920436
|
+
}
|
|
920437
|
+
}
|
|
920438
|
+
return group;
|
|
920439
|
+
}
|
|
920440
|
+
function resolveGroupsOrFail({
|
|
920441
|
+
groupName,
|
|
920442
|
+
generatorsConfiguration,
|
|
920443
|
+
isAutomation,
|
|
920444
|
+
context: context3
|
|
920445
|
+
}) {
|
|
920446
|
+
const resolution = resolveGroupNamesForGeneration({ groupName, generatorsConfiguration, isAutomation });
|
|
920447
|
+
if (resolution.type === "fan-out") {
|
|
920448
|
+
return resolution.groupNames;
|
|
920449
|
+
}
|
|
920450
|
+
if (resolution.type === "missing-group") {
|
|
920451
|
+
const longestGroupName = Math.max(...resolution.availableGroupNames.map((name2) => name2.length));
|
|
920452
|
+
const currentArgs = process.argv.slice(2).join(" ");
|
|
920453
|
+
const suggestions = resolution.availableGroupNames.map((name2) => {
|
|
920454
|
+
const suggestedCommand = `fern ${currentArgs} --${GROUP_CLI_OPTION} ${name2}`;
|
|
920455
|
+
return ` \u203A ${source_default.bold(name2.padEnd(longestGroupName))} ${source_default.dim(suggestedCommand)}`;
|
|
920456
|
+
}).join("\n");
|
|
920457
|
+
context3.failAndThrow(
|
|
920458
|
+
`No group specified. Use the --${GROUP_CLI_OPTION} option, or set "${DEFAULT_GROUP_GENERATORS_CONFIG_KEY}" in ${GENERATORS_CONFIGURATION_FILENAME}:
|
|
920459
|
+
${suggestions}`,
|
|
920460
|
+
void 0,
|
|
920461
|
+
{ code: CliError.Code.NetworkError }
|
|
920462
|
+
);
|
|
920463
|
+
return [];
|
|
920464
|
+
}
|
|
920465
|
+
if (resolution.fromDefaultGroup) {
|
|
920466
|
+
context3.logger.info(
|
|
920467
|
+
source_default.dim(`Using default group '${resolution.groupName}' from ${GENERATORS_CONFIGURATION_FILENAME}`)
|
|
920468
|
+
);
|
|
920469
|
+
}
|
|
920470
|
+
const aliasResult = resolveGroupAlias({
|
|
920471
|
+
name: resolution.groupName,
|
|
920472
|
+
groupAliases: generatorsConfiguration.groupAliases,
|
|
920473
|
+
availableGroupNames: generatorsConfiguration.groups.map((g8) => g8.groupName)
|
|
920474
|
+
});
|
|
920475
|
+
if (aliasResult.type === "alias-references-missing-group") {
|
|
920476
|
+
context3.failAndThrow(
|
|
920477
|
+
`Group alias '${aliasResult.alias}' references non-existent group '${aliasResult.missingGroupName}'. Available groups: ${aliasResult.availableGroupNames.join(", ")}`,
|
|
920478
|
+
void 0,
|
|
920479
|
+
{ code: CliError.Code.NetworkError }
|
|
920480
|
+
);
|
|
920481
|
+
return [];
|
|
920482
|
+
}
|
|
920483
|
+
if (aliasResult.type === "unknown") {
|
|
920484
|
+
const aliasesSuffix = aliasResult.availableAliasNames.length > 0 ? `. Available aliases: ${aliasResult.availableAliasNames.join(", ")}` : "";
|
|
920485
|
+
context3.failAndThrow(
|
|
920486
|
+
`'${aliasResult.name}' is not a valid group or alias. Available groups: ${aliasResult.availableGroupNames.join(", ")}${aliasesSuffix}`,
|
|
920487
|
+
void 0,
|
|
920488
|
+
{ code: CliError.Code.NetworkError }
|
|
920489
|
+
);
|
|
920490
|
+
return [];
|
|
920491
|
+
}
|
|
920492
|
+
return aliasResult.groupNames;
|
|
920493
|
+
}
|
|
920494
|
+
function applyLfsOverride(group, lfsOverridePath, context3) {
|
|
920495
|
+
const baseAbsolutePath = AbsoluteFilePath2.of(resolve6(cwd(), lfsOverridePath));
|
|
920496
|
+
const languageCount = {};
|
|
920497
|
+
const modifiedGenerators = [];
|
|
920498
|
+
for (const generator of group.generators) {
|
|
920499
|
+
const language = generator.language ?? getLanguageFromGeneratorName3(generator.name);
|
|
920500
|
+
let outputPath;
|
|
920501
|
+
if (group.generators.length === 1) {
|
|
920502
|
+
outputPath = baseAbsolutePath;
|
|
920503
|
+
} else {
|
|
920504
|
+
const languageDir = language || "unknown";
|
|
920505
|
+
if (languageCount[languageDir] == null) {
|
|
920506
|
+
languageCount[languageDir] = 0;
|
|
920507
|
+
}
|
|
920508
|
+
languageCount[languageDir]++;
|
|
920509
|
+
const dirName = languageCount[languageDir] === 1 ? languageDir : `${languageDir}-${languageCount[languageDir]}`;
|
|
920510
|
+
outputPath = join8(baseAbsolutePath, RelativeFilePath2.of(dirName));
|
|
920511
|
+
}
|
|
920512
|
+
const modifiedGenerator = {
|
|
920513
|
+
...generator,
|
|
920514
|
+
outputMode: api_exports4.remoteGen.OutputMode.downloadFiles({}),
|
|
920515
|
+
absolutePathToLocalOutput: outputPath
|
|
920516
|
+
};
|
|
920517
|
+
modifiedGenerators.push(modifiedGenerator);
|
|
920518
|
+
context3.logger.info(
|
|
920519
|
+
`Overriding output for generator '${generator.name}' to local-file-system at: ${outputPath}`
|
|
920520
|
+
);
|
|
920521
|
+
}
|
|
920522
|
+
return {
|
|
920523
|
+
...group,
|
|
920524
|
+
generators: modifiedGenerators
|
|
920525
|
+
};
|
|
920526
|
+
}
|
|
920527
|
+
function getLanguageFromGeneratorName3(generatorName) {
|
|
920528
|
+
if (generatorName.includes("typescript") || generatorName.includes("ts")) {
|
|
920529
|
+
return "typescript";
|
|
920530
|
+
}
|
|
920531
|
+
if (generatorName.includes("python") || generatorName.includes("py")) {
|
|
920532
|
+
return "python";
|
|
920533
|
+
}
|
|
920534
|
+
if (generatorName.includes("java")) {
|
|
920535
|
+
return "java";
|
|
920536
|
+
}
|
|
920537
|
+
if (generatorName.includes("go")) {
|
|
920538
|
+
return "go";
|
|
920539
|
+
}
|
|
920540
|
+
if (generatorName.includes("ruby")) {
|
|
920541
|
+
return "ruby";
|
|
920542
|
+
}
|
|
920543
|
+
if (generatorName.includes("csharp") || generatorName.includes("c#")) {
|
|
920544
|
+
return "csharp";
|
|
920545
|
+
}
|
|
920546
|
+
if (generatorName.includes("swift")) {
|
|
920547
|
+
return "swift";
|
|
920548
|
+
}
|
|
920549
|
+
if (generatorName.includes("php")) {
|
|
920550
|
+
return "php";
|
|
920551
|
+
}
|
|
920552
|
+
if (generatorName.includes("rust")) {
|
|
920553
|
+
return "rust";
|
|
920554
|
+
}
|
|
920555
|
+
return generatorName.replace(/[^a-zA-Z0-9]/g, "-").toLowerCase();
|
|
920556
|
+
}
|
|
920557
|
+
|
|
920558
|
+
// src/commands/generate/resolvePosthogCommandLabel.ts
|
|
920559
|
+
function resolvePosthogCommandLabel(automation) {
|
|
920560
|
+
return automation != null ? "fern automations generate" : "fern generate";
|
|
920561
|
+
}
|
|
920562
|
+
|
|
920563
|
+
// src/commands/generate/shouldPreflightGenerator.ts
|
|
920564
|
+
function shouldPreflightGenerator({
|
|
920565
|
+
generator,
|
|
920566
|
+
rootAutorelease,
|
|
920567
|
+
automation
|
|
920568
|
+
}) {
|
|
920569
|
+
if (automation == null) {
|
|
920570
|
+
return true;
|
|
920571
|
+
}
|
|
920572
|
+
return !shouldSkipGenerator({ generator, rootAutorelease });
|
|
920573
|
+
}
|
|
920574
|
+
|
|
920575
|
+
// src/commands/generate/generateAPIWorkspaces.ts
|
|
920576
|
+
var GenerationMode = {
|
|
920577
|
+
PullRequest: "pull-request"
|
|
920578
|
+
};
|
|
920579
|
+
async function generateAPIWorkspaces({
|
|
920580
|
+
project,
|
|
920581
|
+
cliContext,
|
|
920582
|
+
version: version7,
|
|
920583
|
+
groupName,
|
|
920584
|
+
generatorName,
|
|
920585
|
+
generatorIndex,
|
|
920586
|
+
shouldLogS3Url,
|
|
920587
|
+
keepDocker,
|
|
920588
|
+
useLocalDocker,
|
|
920589
|
+
preview,
|
|
920590
|
+
mode,
|
|
920591
|
+
force,
|
|
920592
|
+
runner,
|
|
920593
|
+
inspect: inspect6,
|
|
920594
|
+
lfsOverride,
|
|
920595
|
+
fernignorePath,
|
|
920596
|
+
skipFernignore,
|
|
920597
|
+
dynamicIrOnly,
|
|
920598
|
+
outputDir,
|
|
920599
|
+
noReplay,
|
|
920600
|
+
retryRateLimited,
|
|
920601
|
+
requireEnvVars,
|
|
920602
|
+
automationMode,
|
|
920603
|
+
autoMerge,
|
|
920604
|
+
automation
|
|
920605
|
+
}) {
|
|
920606
|
+
let token = void 0;
|
|
920607
|
+
if (!useLocalDocker) {
|
|
920608
|
+
const currentToken = await cliContext.runTask(async (context3) => {
|
|
920609
|
+
return askToLogin(context3);
|
|
920610
|
+
});
|
|
920611
|
+
if (currentToken.type === "user") {
|
|
920612
|
+
await cliContext.runTask(async (context3) => {
|
|
920613
|
+
await createOrganizationIfDoesNotExist({
|
|
920614
|
+
organization: project.config.organization,
|
|
920615
|
+
token: currentToken,
|
|
920616
|
+
context: context3
|
|
920617
|
+
});
|
|
920618
|
+
});
|
|
920619
|
+
}
|
|
920620
|
+
token = currentToken;
|
|
920621
|
+
}
|
|
920622
|
+
await confirmOutputDirectoriesForEligibleGenerators({
|
|
920623
|
+
project,
|
|
920624
|
+
groupName,
|
|
920625
|
+
generatorName,
|
|
920626
|
+
generatorIndex,
|
|
920627
|
+
automation,
|
|
920628
|
+
cliContext,
|
|
920629
|
+
force
|
|
920630
|
+
});
|
|
920631
|
+
cliContext.instrumentPostHogEvent({
|
|
920632
|
+
orgId: project.config.organization,
|
|
920633
|
+
command: resolvePosthogCommandLabel(automation),
|
|
920634
|
+
properties: {
|
|
920635
|
+
workspaces: buildPosthogWorkspaces({ project, groupName, generatorName })
|
|
920636
|
+
}
|
|
920637
|
+
});
|
|
920638
|
+
await Promise.all(
|
|
920639
|
+
project.apiWorkspaces.map(async (workspace) => {
|
|
920640
|
+
await cliContext.runTaskForWorkspace(workspace, async (context3) => {
|
|
920641
|
+
const absolutePathToPreview = preview ? outputDir != null ? AbsoluteFilePath2.of(resolve6(cwd(), outputDir)) : join8(workspace.absoluteFilePath, RelativeFilePath2.of(PREVIEW_DIRECTORY)) : void 0;
|
|
920642
|
+
if (absolutePathToPreview != null) {
|
|
920643
|
+
context3.logger.info(`Writing preview to ${absolutePathToPreview}`);
|
|
920644
|
+
}
|
|
920645
|
+
await generateWorkspace({
|
|
920646
|
+
organization: project.config.organization,
|
|
920647
|
+
workspace,
|
|
920648
|
+
projectConfig: project.config,
|
|
920649
|
+
context: context3,
|
|
920650
|
+
version: version7,
|
|
920651
|
+
groupName,
|
|
920652
|
+
generatorName,
|
|
920653
|
+
generatorIndex,
|
|
920654
|
+
shouldLogS3Url,
|
|
920655
|
+
token,
|
|
920656
|
+
useLocalDocker,
|
|
920657
|
+
keepDocker,
|
|
920658
|
+
absolutePathToPreview,
|
|
920659
|
+
mode,
|
|
920660
|
+
runner,
|
|
920661
|
+
inspect: inspect6,
|
|
920662
|
+
lfsOverride,
|
|
920663
|
+
fernignorePath,
|
|
920664
|
+
skipFernignore,
|
|
920665
|
+
dynamicIrOnly,
|
|
920666
|
+
noReplay,
|
|
920667
|
+
retryRateLimited,
|
|
920668
|
+
requireEnvVars,
|
|
920669
|
+
automationMode,
|
|
920670
|
+
autoMerge,
|
|
920671
|
+
automation
|
|
920672
|
+
});
|
|
920673
|
+
});
|
|
920674
|
+
})
|
|
920675
|
+
);
|
|
920676
|
+
}
|
|
920677
|
+
async function confirmOutputDirectoriesForEligibleGenerators({
|
|
920678
|
+
project,
|
|
920679
|
+
groupName,
|
|
920680
|
+
generatorName,
|
|
920681
|
+
generatorIndex,
|
|
920682
|
+
automation,
|
|
920683
|
+
cliContext,
|
|
920684
|
+
force
|
|
920685
|
+
}) {
|
|
920686
|
+
for (const workspace of project.apiWorkspaces) {
|
|
920687
|
+
const resolvedGroupNames = expandGroupFilter(groupName, workspace.generatorsConfiguration);
|
|
920688
|
+
const rootAutorelease = workspace.generatorsConfiguration?.rawConfiguration.autorelease;
|
|
920689
|
+
const groupsInScope = workspace.generatorsConfiguration?.groups.filter(
|
|
920690
|
+
(group) => resolvedGroupNames == null || resolvedGroupNames.includes(group.groupName)
|
|
920691
|
+
) ?? [];
|
|
920692
|
+
for (const group of groupsInScope) {
|
|
920693
|
+
const filterResult = filterGenerators({
|
|
920694
|
+
generators: group.generators,
|
|
920695
|
+
generatorIndex,
|
|
920696
|
+
generatorName,
|
|
920697
|
+
groupName: group.groupName
|
|
920698
|
+
});
|
|
920699
|
+
if (!filterResult.ok) {
|
|
920700
|
+
continue;
|
|
920701
|
+
}
|
|
920702
|
+
for (const generator of filterResult.generators) {
|
|
920703
|
+
if (!shouldPreflightGenerator({ generator, rootAutorelease, automation })) {
|
|
920704
|
+
continue;
|
|
920705
|
+
}
|
|
920706
|
+
const { shouldProceed } = await checkOutputDirectory(
|
|
920707
|
+
generator.absolutePathToLocalOutput,
|
|
920708
|
+
cliContext,
|
|
920709
|
+
force
|
|
920710
|
+
);
|
|
920711
|
+
if (!shouldProceed) {
|
|
920712
|
+
cliContext.failAndThrow("Generation cancelled", void 0, { code: CliError.Code.ConfigError });
|
|
920713
|
+
}
|
|
920714
|
+
}
|
|
920715
|
+
}
|
|
920716
|
+
}
|
|
920717
|
+
}
|
|
920718
|
+
function buildPosthogWorkspaces({
|
|
920719
|
+
project,
|
|
920720
|
+
groupName,
|
|
920721
|
+
generatorName
|
|
920722
|
+
}) {
|
|
920723
|
+
return project.apiWorkspaces.map((workspace) => {
|
|
920724
|
+
const resolvedGroupNames = expandGroupFilter(groupName, workspace.generatorsConfiguration);
|
|
920725
|
+
return {
|
|
920726
|
+
name: workspace.workspaceName,
|
|
920727
|
+
group: groupName,
|
|
920728
|
+
generators: workspace.generatorsConfiguration?.groups.filter((group) => resolvedGroupNames == null || resolvedGroupNames.includes(group.groupName)).map(
|
|
920729
|
+
(group) => group.generators.filter((generator) => generatorName == null || generator.name === generatorName).map((generator) => ({
|
|
920730
|
+
name: generator.name,
|
|
920731
|
+
version: generator.version,
|
|
920732
|
+
outputMode: generator.outputMode.type,
|
|
920733
|
+
config: generator.config
|
|
920734
|
+
}))
|
|
920735
|
+
)
|
|
920736
|
+
};
|
|
920737
|
+
});
|
|
920738
|
+
}
|
|
920739
|
+
function expandGroupFilter(groupName, generatorsConfiguration) {
|
|
920740
|
+
if (groupName == null) {
|
|
920741
|
+
return null;
|
|
920742
|
+
}
|
|
920743
|
+
if (generatorsConfiguration == null) {
|
|
920744
|
+
return [groupName];
|
|
920745
|
+
}
|
|
920746
|
+
const aliasGroups = generatorsConfiguration.groupAliases[groupName];
|
|
920747
|
+
if (aliasGroups != null) {
|
|
920748
|
+
return aliasGroups;
|
|
920749
|
+
}
|
|
920750
|
+
return [groupName];
|
|
920751
|
+
}
|
|
920752
|
+
|
|
920753
|
+
// src/commands/automations/generate/GeneratorRunResult.ts
|
|
920754
|
+
function countResults(results) {
|
|
920755
|
+
let succeeded = 0;
|
|
920756
|
+
let failed = 0;
|
|
920757
|
+
let skipped = 0;
|
|
920758
|
+
for (const r5 of results) {
|
|
920759
|
+
switch (r5.status) {
|
|
920760
|
+
case "success":
|
|
920761
|
+
succeeded++;
|
|
920762
|
+
break;
|
|
920763
|
+
case "failed":
|
|
920764
|
+
failed++;
|
|
920765
|
+
break;
|
|
920766
|
+
case "skipped_no_diff":
|
|
920767
|
+
skipped++;
|
|
920768
|
+
break;
|
|
920769
|
+
}
|
|
920770
|
+
}
|
|
920771
|
+
return { succeeded, failed, skipped };
|
|
920772
|
+
}
|
|
920773
|
+
var GeneratorRunCollector = class {
|
|
920774
|
+
#results = [];
|
|
920775
|
+
recordSuccess(args) {
|
|
920776
|
+
this.#results.push({
|
|
920777
|
+
apiName: args.apiName,
|
|
920778
|
+
groupName: args.groupName,
|
|
920779
|
+
generatorName: args.generatorName,
|
|
920780
|
+
status: "success",
|
|
920781
|
+
version: args.version,
|
|
920782
|
+
pullRequestUrl: null,
|
|
920783
|
+
errorMessage: null,
|
|
920784
|
+
durationMs: args.durationMs
|
|
920785
|
+
});
|
|
920786
|
+
}
|
|
920787
|
+
recordFailure(args) {
|
|
920788
|
+
this.#results.push({
|
|
920789
|
+
apiName: args.apiName,
|
|
920790
|
+
groupName: args.groupName,
|
|
920791
|
+
generatorName: args.generatorName,
|
|
920792
|
+
status: "failed",
|
|
920793
|
+
version: null,
|
|
920794
|
+
pullRequestUrl: null,
|
|
920795
|
+
errorMessage: args.errorMessage,
|
|
920796
|
+
durationMs: args.durationMs
|
|
920797
|
+
});
|
|
920798
|
+
}
|
|
920799
|
+
results() {
|
|
920800
|
+
return this.#results;
|
|
920801
|
+
}
|
|
920802
|
+
hasFailures() {
|
|
920803
|
+
return this.#results.some((r5) => r5.status === "failed");
|
|
920804
|
+
}
|
|
920805
|
+
counts() {
|
|
920806
|
+
return countResults(this.#results);
|
|
920807
|
+
}
|
|
920808
|
+
};
|
|
920809
|
+
|
|
920810
|
+
// src/commands/automations/generate/reportGenerateResults.ts
|
|
920811
|
+
var import_fs35 = require("fs");
|
|
920812
|
+
var import_promises137 = require("fs/promises");
|
|
920813
|
+
var JSON_SCHEMA_VERSION = 1;
|
|
920814
|
+
function renderStdoutSummary(results) {
|
|
920815
|
+
return formatCounts(countResults(results));
|
|
920816
|
+
}
|
|
920817
|
+
function renderMarkdownSummary(results) {
|
|
920818
|
+
const lines = [];
|
|
920819
|
+
lines.push("## Fern Automations \xB7 Generate");
|
|
920820
|
+
lines.push("");
|
|
920821
|
+
lines.push("| API | Group | Generator | Status | Version | PR |");
|
|
920822
|
+
lines.push("|-----|-------|-----------|--------|---------|----|");
|
|
920823
|
+
for (const result of results) {
|
|
920824
|
+
lines.push(
|
|
920825
|
+
`| ${mdCell(result.apiName)} | ${mdCell(result.groupName)} | ${mdCell(result.generatorName)} | ${statusCell(result)} | ${mdCell(result.version)} | ${prCell(result.pullRequestUrl)} |`
|
|
920826
|
+
);
|
|
920827
|
+
}
|
|
920828
|
+
lines.push("");
|
|
920829
|
+
lines.push(`**Summary:** ${formatCounts(countResults(results))}`);
|
|
920830
|
+
lines.push("");
|
|
920831
|
+
return lines.join("\n");
|
|
920832
|
+
}
|
|
920833
|
+
function renderJsonSummary(results) {
|
|
920834
|
+
return {
|
|
920835
|
+
version: JSON_SCHEMA_VERSION,
|
|
920836
|
+
generators: results.map((r5) => ({
|
|
920837
|
+
api: r5.apiName ?? null,
|
|
920838
|
+
group: r5.groupName,
|
|
920839
|
+
generatorName: r5.generatorName,
|
|
920840
|
+
status: r5.status,
|
|
920841
|
+
pullRequestUrl: r5.pullRequestUrl,
|
|
920842
|
+
version: r5.version,
|
|
920843
|
+
error: r5.errorMessage,
|
|
920844
|
+
durationMs: r5.durationMs
|
|
920845
|
+
})),
|
|
920846
|
+
summary: countResults(results)
|
|
920847
|
+
};
|
|
920848
|
+
}
|
|
920849
|
+
function formatCounts(counts) {
|
|
920850
|
+
return `${counts.succeeded} succeeded \xB7 ${counts.skipped} skipped \xB7 ${counts.failed} failed`;
|
|
920851
|
+
}
|
|
920852
|
+
async function writeResults({
|
|
920853
|
+
results,
|
|
920854
|
+
jsonOutputPath
|
|
920855
|
+
}) {
|
|
920856
|
+
const stepSummaryPath = getGithubStepSummaryPath();
|
|
920857
|
+
if (stepSummaryPath != null) {
|
|
920858
|
+
try {
|
|
920859
|
+
await (0, import_promises137.appendFile)(stepSummaryPath, renderMarkdownSummary(results), "utf8");
|
|
920860
|
+
} catch {
|
|
920861
|
+
}
|
|
920862
|
+
}
|
|
920863
|
+
if (jsonOutputPath != null) {
|
|
920864
|
+
await (0, import_promises137.writeFile)(jsonOutputPath, JSON.stringify(renderJsonSummary(results), null, 2), "utf8");
|
|
920865
|
+
}
|
|
920866
|
+
}
|
|
920867
|
+
function writeResultsSync({
|
|
920868
|
+
results,
|
|
920869
|
+
jsonOutputPath
|
|
920870
|
+
}) {
|
|
920871
|
+
const stepSummaryPath = getGithubStepSummaryPath();
|
|
920872
|
+
if (stepSummaryPath != null) {
|
|
920873
|
+
try {
|
|
920874
|
+
(0, import_fs35.appendFileSync)(stepSummaryPath, renderMarkdownSummary(results), "utf8");
|
|
920875
|
+
} catch {
|
|
920876
|
+
}
|
|
920877
|
+
}
|
|
920878
|
+
if (jsonOutputPath != null) {
|
|
920879
|
+
try {
|
|
920880
|
+
(0, import_fs35.writeFileSync)(jsonOutputPath, JSON.stringify(renderJsonSummary(results), null, 2), "utf8");
|
|
920881
|
+
} catch {
|
|
920882
|
+
}
|
|
920883
|
+
}
|
|
920884
|
+
}
|
|
920885
|
+
function getGithubStepSummaryPath() {
|
|
920886
|
+
const path99 = process.env.GITHUB_STEP_SUMMARY;
|
|
920887
|
+
return path99 != null && path99.length > 0 ? path99 : void 0;
|
|
920888
|
+
}
|
|
920889
|
+
function mdCell(value2) {
|
|
920890
|
+
if (value2 == null || value2.length === 0) {
|
|
920891
|
+
return "\u2014";
|
|
920892
|
+
}
|
|
920893
|
+
return value2.replace(/\|/g, "\\|");
|
|
920894
|
+
}
|
|
920895
|
+
function statusCell(result) {
|
|
920896
|
+
switch (result.status) {
|
|
920897
|
+
case "success":
|
|
920898
|
+
return "\u2705 success";
|
|
920899
|
+
case "failed":
|
|
920900
|
+
return "\u274C failed";
|
|
920901
|
+
case "skipped_no_diff":
|
|
920902
|
+
return "\u23ED\uFE0F skipped (no diff)";
|
|
920903
|
+
}
|
|
920904
|
+
}
|
|
920905
|
+
function prCell(url3) {
|
|
920906
|
+
if (url3 == null) {
|
|
920907
|
+
return "\u2014";
|
|
920908
|
+
}
|
|
920909
|
+
const match3 = url3.match(/\/pull\/(\d+)/);
|
|
920910
|
+
if (match3 != null) {
|
|
920911
|
+
return `[#${match3[1]}](${url3})`;
|
|
920912
|
+
}
|
|
920913
|
+
return `[link](${url3})`;
|
|
920914
|
+
}
|
|
920915
|
+
|
|
920916
|
+
// src/commands/automations/generate/executeAutomationsGenerate.ts
|
|
920917
|
+
async function executeAutomationsGenerate({
|
|
920918
|
+
cliContext,
|
|
920919
|
+
options: options2
|
|
920920
|
+
}) {
|
|
920921
|
+
const { generatorName, generatorIndex } = parseGeneratorArg(options2.generator);
|
|
920922
|
+
const collector = new GeneratorRunCollector();
|
|
920923
|
+
const { jsonOutputPath } = options2;
|
|
920924
|
+
let outputsFlushed = false;
|
|
920925
|
+
let taskAborted = false;
|
|
920926
|
+
const flushOnSignal = () => {
|
|
920927
|
+
if (outputsFlushed) {
|
|
920928
|
+
return;
|
|
920929
|
+
}
|
|
920930
|
+
outputsFlushed = true;
|
|
920931
|
+
writeResultsSync({ results: collector.results(), jsonOutputPath });
|
|
920932
|
+
};
|
|
920933
|
+
process.once("SIGINT", flushOnSignal);
|
|
920934
|
+
process.once("SIGTERM", flushOnSignal);
|
|
920935
|
+
try {
|
|
920936
|
+
await cliContext.runTask(async () => {
|
|
920937
|
+
await generateAPIWorkspaces({
|
|
920938
|
+
project: await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
|
|
920939
|
+
commandLineApiWorkspace: options2.api,
|
|
920940
|
+
defaultToAllApiWorkspaces: true
|
|
920941
|
+
}),
|
|
920942
|
+
cliContext,
|
|
920943
|
+
version: options2.version,
|
|
920944
|
+
groupName: options2.group,
|
|
920945
|
+
generatorName,
|
|
920946
|
+
generatorIndex,
|
|
920947
|
+
shouldLogS3Url: false,
|
|
920948
|
+
keepDocker: false,
|
|
920949
|
+
useLocalDocker: false,
|
|
920950
|
+
preview: false,
|
|
920951
|
+
mode: void 0,
|
|
920952
|
+
force: true,
|
|
920953
|
+
runner: void 0,
|
|
920954
|
+
inspect: false,
|
|
920955
|
+
lfsOverride: void 0,
|
|
920956
|
+
fernignorePath: void 0,
|
|
920957
|
+
skipFernignore: false,
|
|
920958
|
+
dynamicIrOnly: false,
|
|
920959
|
+
outputDir: void 0,
|
|
920960
|
+
noReplay: false,
|
|
920961
|
+
retryRateLimited: false,
|
|
920962
|
+
requireEnvVars: false,
|
|
920963
|
+
automationMode: true,
|
|
920964
|
+
autoMerge: options2.autoMerge,
|
|
920965
|
+
automation: { recorder: collector }
|
|
920966
|
+
});
|
|
920967
|
+
});
|
|
920968
|
+
} catch (error50) {
|
|
920969
|
+
if (!(error50 instanceof TaskAbortSignal)) {
|
|
920970
|
+
throw error50;
|
|
920971
|
+
}
|
|
920972
|
+
taskAborted = true;
|
|
920973
|
+
} finally {
|
|
920974
|
+
process.off("SIGINT", flushOnSignal);
|
|
920975
|
+
process.off("SIGTERM", flushOnSignal);
|
|
920976
|
+
if (!outputsFlushed) {
|
|
920977
|
+
outputsFlushed = true;
|
|
920978
|
+
await reportFinalOutputs({ collector, jsonOutputPath, taskAborted });
|
|
920979
|
+
}
|
|
920980
|
+
if (collector.hasFailures()) {
|
|
920981
|
+
process.exitCode = 1;
|
|
920982
|
+
}
|
|
920983
|
+
}
|
|
920984
|
+
}
|
|
920985
|
+
async function reportFinalOutputs({
|
|
920986
|
+
collector,
|
|
920987
|
+
jsonOutputPath,
|
|
920988
|
+
taskAborted
|
|
920989
|
+
}) {
|
|
920990
|
+
const results = collector.results();
|
|
920991
|
+
if (results.length === 0) {
|
|
920992
|
+
if (taskAborted) {
|
|
920993
|
+
return;
|
|
920994
|
+
}
|
|
920995
|
+
process.stdout.write(
|
|
920996
|
+
"No eligible generators ran in the selected APIs and groups \u2014 every candidate either opts out via automations.generate / autorelease, uses local-file-system output, or did not match an explicit --group / --api filter.\n"
|
|
920997
|
+
);
|
|
920998
|
+
return;
|
|
920999
|
+
}
|
|
921000
|
+
await writeResults({ results, jsonOutputPath });
|
|
921001
|
+
process.stdout.write(`${renderStdoutSummary(results)}
|
|
921002
|
+
`);
|
|
921003
|
+
}
|
|
921004
|
+
|
|
919825
921005
|
// src/commands/sdk-preview/overrideOutputForPreview.ts
|
|
919826
921006
|
var PREVIEW_REGISTRY_URL = process.env.FERN_PREVIEW_REGISTRY_URL ?? "https://npm.buildwithfern.com";
|
|
919827
921007
|
var SUPPORTED_TYPESCRIPT_GENERATORS = /* @__PURE__ */ new Set([
|
|
@@ -920368,7 +921548,7 @@ async function previewDocsWorkspace({
|
|
|
920368
921548
|
|
|
920369
921549
|
// src/commands/docs-diff/docsDiff.ts
|
|
920370
921550
|
init_lib6();
|
|
920371
|
-
var
|
|
921551
|
+
var import_promises138 = require("fs/promises");
|
|
920372
921552
|
var import_pngjs = __toESM(require_png2(), 1);
|
|
920373
921553
|
async function getSlugForFiles({
|
|
920374
921554
|
previewUrl,
|
|
@@ -920591,8 +921771,8 @@ async function generateComparisons({
|
|
|
920591
921771
|
afterPath,
|
|
920592
921772
|
comparisonBasePath
|
|
920593
921773
|
}) {
|
|
920594
|
-
const beforePng = import_pngjs.PNG.sync.read(await (0,
|
|
920595
|
-
const afterPng = import_pngjs.PNG.sync.read(await (0,
|
|
921774
|
+
const beforePng = import_pngjs.PNG.sync.read(await (0, import_promises138.readFile)(beforePath));
|
|
921775
|
+
const afterPng = import_pngjs.PNG.sync.read(await (0, import_promises138.readFile)(afterPath));
|
|
920596
921776
|
const beforeOriginalHeight = beforePng.height;
|
|
920597
921777
|
const afterOriginalHeight = afterPng.height;
|
|
920598
921778
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
@@ -920630,7 +921810,7 @@ async function generateComparisons({
|
|
|
920630
921810
|
const sideBySide = createSideBySideComparison(croppedBefore, croppedAfter, 20, true);
|
|
920631
921811
|
const outPath = `${base4}-region-${i9 + 1}.png`;
|
|
920632
921812
|
const pngBuffer = import_pngjs.PNG.sync.write(sideBySide);
|
|
920633
|
-
await (0,
|
|
921813
|
+
await (0, import_promises138.writeFile)(outPath, new Uint8Array(pngBuffer));
|
|
920634
921814
|
results.push({ changePercent, boundingBox, comparisonPath: outPath });
|
|
920635
921815
|
}
|
|
920636
921816
|
return results;
|
|
@@ -920709,7 +921889,7 @@ async function docsDiff({
|
|
|
920709
921889
|
outputDir.startsWith("/") ? outputDir : join8(cwd(), RelativeFilePath2.of(outputDir))
|
|
920710
921890
|
);
|
|
920711
921891
|
if (!await doesPathExist(outputPath)) {
|
|
920712
|
-
await (0,
|
|
921892
|
+
await (0, import_promises138.mkdir)(outputPath, { recursive: true });
|
|
920713
921893
|
}
|
|
920714
921894
|
const results = [];
|
|
920715
921895
|
await cliContext.runTask(async (context3) => {
|
|
@@ -924021,8 +925201,8 @@ function renderNamespacesIndexPage(nsPath, childEntries, nsTitle) {
|
|
|
924021
925201
|
}
|
|
924022
925202
|
|
|
924023
925203
|
// ../library-docs-generator/lib/src/writers/MdxFileWriter.js
|
|
924024
|
-
var
|
|
924025
|
-
var
|
|
925204
|
+
var import_fs36 = require("fs");
|
|
925205
|
+
var import_path86 = require("path");
|
|
924026
925206
|
var MdxFileWriter = class {
|
|
924027
925207
|
outputDir;
|
|
924028
925208
|
writtenFiles = [];
|
|
@@ -924038,9 +925218,9 @@ var MdxFileWriter = class {
|
|
|
924038
925218
|
* @returns Absolute path of the written file
|
|
924039
925219
|
*/
|
|
924040
925220
|
writePage(pageKey, content5) {
|
|
924041
|
-
const filePath = (0,
|
|
924042
|
-
(0,
|
|
924043
|
-
(0,
|
|
925221
|
+
const filePath = (0, import_path86.join)(this.outputDir, pageKey);
|
|
925222
|
+
(0, import_fs36.mkdirSync)((0, import_path86.dirname)(filePath), { recursive: true });
|
|
925223
|
+
(0, import_fs36.writeFileSync)(filePath, content5);
|
|
924044
925224
|
this.writtenFiles.push(filePath);
|
|
924045
925225
|
return filePath;
|
|
924046
925226
|
}
|
|
@@ -925047,8 +926227,8 @@ function renderModulePage(module4, ctx, parentPath = "") {
|
|
|
925047
926227
|
}
|
|
925048
926228
|
|
|
925049
926229
|
// ../library-docs-generator/lib/src/writers/NavigationBuilder.js
|
|
925050
|
-
var
|
|
925051
|
-
var
|
|
926230
|
+
var import_fs37 = require("fs");
|
|
926231
|
+
var import_path87 = require("path");
|
|
925052
926232
|
function buildNavigation(rootModule, baseSlug) {
|
|
925053
926233
|
return generateModuleNav(rootModule, "", baseSlug);
|
|
925054
926234
|
}
|
|
@@ -925082,9 +926262,9 @@ var NAVIGATION_FILENAME = "_navigation.yml";
|
|
|
925082
926262
|
function writeNavigation(outputDir, navigation2) {
|
|
925083
926263
|
const header = "# AUTO-GENERATED by `fern docs md generate` \u2014 DO NOT EDIT\n";
|
|
925084
926264
|
const yaml3 = jsYaml.dump(navigation2, { lineWidth: 120, noRefs: true });
|
|
925085
|
-
const filePath = (0,
|
|
925086
|
-
(0,
|
|
925087
|
-
(0,
|
|
926265
|
+
const filePath = (0, import_path87.join)(outputDir, NAVIGATION_FILENAME);
|
|
926266
|
+
(0, import_fs37.mkdirSync)((0, import_path87.dirname)(filePath), { recursive: true });
|
|
926267
|
+
(0, import_fs37.writeFileSync)(filePath, header + yaml3);
|
|
925088
926268
|
return filePath;
|
|
925089
926269
|
}
|
|
925090
926270
|
|
|
@@ -925122,7 +926302,7 @@ function renderModuleTree(module4, ctx, writer2, parentPath) {
|
|
|
925122
926302
|
}
|
|
925123
926303
|
|
|
925124
926304
|
// src/commands/docs-md-generate/generateLibraryDocs.ts
|
|
925125
|
-
var
|
|
926305
|
+
var import_promises139 = require("fs/promises");
|
|
925126
926306
|
function createLibraryDocsClient2({ token }) {
|
|
925127
926307
|
const defaultOrigin = "https://registry-dev2.buildwithfern.com";
|
|
925128
926308
|
const baseUrl = process.env.FERN_FDR_ORIGIN ?? process.env.OVERRIDE_FDR_ORIGIN ?? defaultOrigin;
|
|
@@ -925248,7 +926428,7 @@ async function generateSingleLibrary({
|
|
|
925248
926428
|
if (config5.lang === "cpp" && config5.config?.doxyfile != null) {
|
|
925249
926429
|
const doxyfilePath = resolve6(docsWorkspace.absoluteFilePath, config5.config.doxyfile);
|
|
925250
926430
|
try {
|
|
925251
|
-
doxyfileContent = await (0,
|
|
926431
|
+
doxyfileContent = await (0, import_promises139.readFile)(doxyfilePath, "utf-8");
|
|
925252
926432
|
} catch {
|
|
925253
926433
|
return interactiveTaskContext.failAndThrow(
|
|
925254
926434
|
`Library '${name2}': Could not read Doxyfile at '${config5.config.doxyfile}' (resolved to ${doxyfilePath})`,
|
|
@@ -925594,7 +926774,7 @@ Found ${previewDeployments.length} preview deployment(s):
|
|
|
925594
926774
|
}
|
|
925595
926775
|
|
|
925596
926776
|
// src/commands/downgrade/downgrade.ts
|
|
925597
|
-
var
|
|
926777
|
+
var import_promises140 = require("fs/promises");
|
|
925598
926778
|
|
|
925599
926779
|
// ../../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
|
|
925600
926780
|
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
@@ -926345,13 +927525,13 @@ async function downgrade({
|
|
|
926345
927525
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
926346
927526
|
draft.version = targetVersion;
|
|
926347
927527
|
});
|
|
926348
|
-
await (0,
|
|
927528
|
+
await (0, import_promises140.writeFile)(projectConfig._absolutePath, ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
926349
927529
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
926350
927530
|
}
|
|
926351
927531
|
|
|
926352
927532
|
// src/commands/export/generateOpenAPIForWorkspaces.ts
|
|
926353
927533
|
init_lib6();
|
|
926354
|
-
var
|
|
927534
|
+
var import_promises141 = require("fs/promises");
|
|
926355
927535
|
|
|
926356
927536
|
// src/commands/export/converters/servicesConverter.ts
|
|
926357
927537
|
init_lib4();
|
|
@@ -927734,8 +928914,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
927734
928914
|
ir: ir10,
|
|
927735
928915
|
mode: "openapi"
|
|
927736
928916
|
});
|
|
927737
|
-
await (0,
|
|
927738
|
-
await (0,
|
|
928917
|
+
await (0, import_promises141.mkdir)(dirname6(outputPath), { recursive: true });
|
|
928918
|
+
await (0, import_promises141.writeFile)(
|
|
927739
928919
|
outputPath,
|
|
927740
928920
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent4) : jsYaml.dump(openapi, { indent: indent4 })
|
|
927741
928921
|
);
|
|
@@ -927766,517 +928946,6 @@ async function formatWorkspaces({
|
|
|
927766
928946
|
);
|
|
927767
928947
|
}
|
|
927768
928948
|
|
|
927769
|
-
// src/commands/generate/filterGenerators.ts
|
|
927770
|
-
function parseGeneratorArg(generatorArg) {
|
|
927771
|
-
if (generatorArg == null) {
|
|
927772
|
-
return { generatorName: void 0, generatorIndex: void 0 };
|
|
927773
|
-
}
|
|
927774
|
-
const parsed = generatorArg.length > 0 ? Number(generatorArg) : Number.NaN;
|
|
927775
|
-
if (!Number.isNaN(parsed) && Number.isInteger(parsed) && parsed >= 0) {
|
|
927776
|
-
return { generatorName: void 0, generatorIndex: parsed };
|
|
927777
|
-
}
|
|
927778
|
-
return { generatorName: generatorArg, generatorIndex: void 0 };
|
|
927779
|
-
}
|
|
927780
|
-
function filterGenerators({
|
|
927781
|
-
generators,
|
|
927782
|
-
generatorIndex,
|
|
927783
|
-
generatorName,
|
|
927784
|
-
groupName
|
|
927785
|
-
}) {
|
|
927786
|
-
if (generatorIndex != null) {
|
|
927787
|
-
const generator = generators[generatorIndex];
|
|
927788
|
-
if (generator == null) {
|
|
927789
|
-
return {
|
|
927790
|
-
ok: false,
|
|
927791
|
-
error: `Generator index ${generatorIndex} is out of bounds in group '${groupName}' (${generators.length} generators available)`
|
|
927792
|
-
};
|
|
927793
|
-
}
|
|
927794
|
-
return { ok: true, generators: [generator] };
|
|
927795
|
-
}
|
|
927796
|
-
if (generatorName != null) {
|
|
927797
|
-
const filtered = generators.filter((gen) => gen.name === generatorName);
|
|
927798
|
-
if (filtered.length === 0) {
|
|
927799
|
-
const available = generators.map((gen) => gen.name);
|
|
927800
|
-
return {
|
|
927801
|
-
ok: false,
|
|
927802
|
-
error: `Generator '${generatorName}' not found in group '${groupName}'. Available generators: ${available.join(", ")}`
|
|
927803
|
-
};
|
|
927804
|
-
}
|
|
927805
|
-
return { ok: true, generators: filtered };
|
|
927806
|
-
}
|
|
927807
|
-
return { ok: true, generators };
|
|
927808
|
-
}
|
|
927809
|
-
|
|
927810
|
-
// src/commands/generate/generateAPIWorkspaces.ts
|
|
927811
|
-
init_lib6();
|
|
927812
|
-
|
|
927813
|
-
// src/constants.ts
|
|
927814
|
-
var API_CLI_OPTION = "api";
|
|
927815
|
-
var GROUP_CLI_OPTION = "group";
|
|
927816
|
-
var PREVIEW_DIRECTORY = ".preview";
|
|
927817
|
-
var APPROVED_DIRECTORIES_FILENAME = "approved-output-directories";
|
|
927818
|
-
var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
927819
|
-
|
|
927820
|
-
// src/commands/generate/checkOutputDirectory.ts
|
|
927821
|
-
init_lib6();
|
|
927822
|
-
var import_promises140 = require("fs/promises");
|
|
927823
|
-
|
|
927824
|
-
// src/persistence/output-directories/getOutputDirectories.ts
|
|
927825
|
-
init_lib6();
|
|
927826
|
-
var import_promises138 = require("fs/promises");
|
|
927827
|
-
|
|
927828
|
-
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
927829
|
-
init_lib6();
|
|
927830
|
-
var import_os16 = require("os");
|
|
927831
|
-
function getPathToOutputDirectoriesFile() {
|
|
927832
|
-
return join8(
|
|
927833
|
-
AbsoluteFilePath2.of((0, import_os16.homedir)()),
|
|
927834
|
-
RelativeFilePath2.of(LOCAL_STORAGE_FOLDER6),
|
|
927835
|
-
RelativeFilePath2.of(APPROVED_DIRECTORIES_FILENAME)
|
|
927836
|
-
);
|
|
927837
|
-
}
|
|
927838
|
-
|
|
927839
|
-
// src/persistence/output-directories/getOutputDirectories.ts
|
|
927840
|
-
async function getOutputDirectories() {
|
|
927841
|
-
const pathToOutputDirectoriesFile = getPathToOutputDirectoriesFile();
|
|
927842
|
-
const doesOutputDirectoriesFileExist = await doesPathExist(pathToOutputDirectoriesFile);
|
|
927843
|
-
if (!doesOutputDirectoriesFileExist) {
|
|
927844
|
-
return [];
|
|
927845
|
-
}
|
|
927846
|
-
const outputDirectoriesFileContents = await (0, import_promises138.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
927847
|
-
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
927848
|
-
return outputDirectories;
|
|
927849
|
-
}
|
|
927850
|
-
|
|
927851
|
-
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
927852
|
-
var import_promises139 = require("fs/promises");
|
|
927853
|
-
var import_path87 = __toESM(require("path"), 1);
|
|
927854
|
-
async function storeOutputDirectories(outputDirectories) {
|
|
927855
|
-
await (0, import_promises139.mkdir)(import_path87.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
|
|
927856
|
-
await (0, import_promises139.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
|
|
927857
|
-
}
|
|
927858
|
-
|
|
927859
|
-
// src/commands/generate/checkOutputDirectory.ts
|
|
927860
|
-
async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
927861
|
-
if (!outputPath || isCI() || force) {
|
|
927862
|
-
return {
|
|
927863
|
-
shouldProceed: true
|
|
927864
|
-
};
|
|
927865
|
-
}
|
|
927866
|
-
const savedDirectories = await getOutputDirectories();
|
|
927867
|
-
if (savedDirectories?.includes(outputPath)) {
|
|
927868
|
-
return {
|
|
927869
|
-
shouldProceed: true
|
|
927870
|
-
};
|
|
927871
|
-
}
|
|
927872
|
-
const doesExist = await doesPathExist(outputPath);
|
|
927873
|
-
if (!doesExist) {
|
|
927874
|
-
return {
|
|
927875
|
-
shouldProceed: true
|
|
927876
|
-
};
|
|
927877
|
-
}
|
|
927878
|
-
const files = await (0, import_promises140.readdir)(outputPath);
|
|
927879
|
-
if (files.length === 0) {
|
|
927880
|
-
return {
|
|
927881
|
-
shouldProceed: true
|
|
927882
|
-
};
|
|
927883
|
-
}
|
|
927884
|
-
const shouldOverwrite = await cliContext.confirmPrompt(
|
|
927885
|
-
`Directory ${outputPath} contains existing files that may be overwritten. Continue?`,
|
|
927886
|
-
false
|
|
927887
|
-
);
|
|
927888
|
-
if (!shouldOverwrite) {
|
|
927889
|
-
return {
|
|
927890
|
-
shouldProceed: false
|
|
927891
|
-
};
|
|
927892
|
-
}
|
|
927893
|
-
await storeOutputDirectories([...savedDirectories ?? [], outputPath]);
|
|
927894
|
-
return {
|
|
927895
|
-
shouldProceed: true
|
|
927896
|
-
};
|
|
927897
|
-
}
|
|
927898
|
-
|
|
927899
|
-
// src/commands/generate/generateAPIWorkspace.ts
|
|
927900
|
-
init_lib6();
|
|
927901
|
-
async function generateWorkspace({
|
|
927902
|
-
organization,
|
|
927903
|
-
workspace,
|
|
927904
|
-
projectConfig,
|
|
927905
|
-
context: context3,
|
|
927906
|
-
groupName,
|
|
927907
|
-
generatorName,
|
|
927908
|
-
generatorIndex,
|
|
927909
|
-
version: version7,
|
|
927910
|
-
shouldLogS3Url,
|
|
927911
|
-
token,
|
|
927912
|
-
useLocalDocker,
|
|
927913
|
-
keepDocker,
|
|
927914
|
-
absolutePathToPreview,
|
|
927915
|
-
mode,
|
|
927916
|
-
runner,
|
|
927917
|
-
inspect: inspect6,
|
|
927918
|
-
lfsOverride,
|
|
927919
|
-
fernignorePath,
|
|
927920
|
-
skipFernignore,
|
|
927921
|
-
dynamicIrOnly,
|
|
927922
|
-
noReplay,
|
|
927923
|
-
retryRateLimited,
|
|
927924
|
-
requireEnvVars,
|
|
927925
|
-
automationMode,
|
|
927926
|
-
autoMerge
|
|
927927
|
-
}) {
|
|
927928
|
-
if (workspace.generatorsConfiguration == null) {
|
|
927929
|
-
context3.logger.warn("This workspaces has no generators.yml");
|
|
927930
|
-
return;
|
|
927931
|
-
}
|
|
927932
|
-
if (workspace.generatorsConfiguration.groups.length === 0) {
|
|
927933
|
-
context3.logger.warn(`This workspace has no groups specified in ${GENERATORS_CONFIGURATION_FILENAME}`);
|
|
927934
|
-
return;
|
|
927935
|
-
}
|
|
927936
|
-
const groupNameOrDefault = groupName ?? workspace.generatorsConfiguration.defaultGroup;
|
|
927937
|
-
if (groupName == null && groupNameOrDefault != null) {
|
|
927938
|
-
context3.logger.info(
|
|
927939
|
-
source_default.dim(`Using default group '${groupNameOrDefault}' from ${GENERATORS_CONFIGURATION_FILENAME}`)
|
|
927940
|
-
);
|
|
927941
|
-
}
|
|
927942
|
-
if (groupNameOrDefault == null) {
|
|
927943
|
-
const groupNames = workspace.generatorsConfiguration.groups.map((g8) => g8.groupName);
|
|
927944
|
-
const longestGroupName = Math.max(...groupNames.map((name2) => name2.length));
|
|
927945
|
-
const currentArgs = process.argv.slice(2).join(" ");
|
|
927946
|
-
const message = `No group specified. Use the --${GROUP_CLI_OPTION} option, or set "${DEFAULT_GROUP_GENERATORS_CONFIG_KEY}" in ${GENERATORS_CONFIGURATION_FILENAME}:
|
|
927947
|
-
` + groupNames.map((name2) => {
|
|
927948
|
-
const suggestedCommand = `fern ${currentArgs} --${GROUP_CLI_OPTION} ${name2}`;
|
|
927949
|
-
return ` \u203A ${source_default.bold(name2.padEnd(longestGroupName))} ${source_default.dim(suggestedCommand)}`;
|
|
927950
|
-
}).join("\n");
|
|
927951
|
-
return context3.failAndThrow(message, void 0, { code: CliError.Code.NetworkError });
|
|
927952
|
-
}
|
|
927953
|
-
const resolvedGroupNames = resolveGroupAlias(
|
|
927954
|
-
groupNameOrDefault,
|
|
927955
|
-
workspace.generatorsConfiguration.groupAliases,
|
|
927956
|
-
workspace.generatorsConfiguration.groups.map((g8) => g8.groupName),
|
|
927957
|
-
context3
|
|
927958
|
-
);
|
|
927959
|
-
const { ai: ai10, replay } = workspace.generatorsConfiguration;
|
|
927960
|
-
if (!useLocalDocker && !token) {
|
|
927961
|
-
return context3.failAndThrow("Please run fern login", void 0, { code: CliError.Code.AuthError });
|
|
927962
|
-
}
|
|
927963
|
-
await Promise.all(
|
|
927964
|
-
resolvedGroupNames.map(async (resolvedGroupName) => {
|
|
927965
|
-
let group = workspace.generatorsConfiguration?.groups.find(
|
|
927966
|
-
(otherGroup) => otherGroup.groupName === resolvedGroupName
|
|
927967
|
-
);
|
|
927968
|
-
if (group == null) {
|
|
927969
|
-
return context3.failAndThrow(`Group '${resolvedGroupName}' does not exist.`, void 0, {
|
|
927970
|
-
code: CliError.Code.ConfigError
|
|
927971
|
-
});
|
|
927972
|
-
}
|
|
927973
|
-
const filterResult = filterGenerators({
|
|
927974
|
-
generators: group.generators,
|
|
927975
|
-
generatorIndex,
|
|
927976
|
-
generatorName,
|
|
927977
|
-
groupName: resolvedGroupName
|
|
927978
|
-
});
|
|
927979
|
-
if (!filterResult.ok) {
|
|
927980
|
-
return context3.failAndThrow(filterResult.error, void 0, { code: CliError.Code.ConfigError });
|
|
927981
|
-
}
|
|
927982
|
-
group = { ...group, generators: filterResult.generators };
|
|
927983
|
-
if (lfsOverride != null) {
|
|
927984
|
-
group = applyLfsOverride(group, lfsOverride, context3);
|
|
927985
|
-
}
|
|
927986
|
-
if (resolvedGroupNames.length > 1) {
|
|
927987
|
-
context3.logger.info(`Running generation for group '${resolvedGroupName}'...`);
|
|
927988
|
-
}
|
|
927989
|
-
if (useLocalDocker) {
|
|
927990
|
-
await runLocalGenerationForWorkspace({
|
|
927991
|
-
token,
|
|
927992
|
-
projectConfig,
|
|
927993
|
-
workspace,
|
|
927994
|
-
generatorGroup: group,
|
|
927995
|
-
version: version7,
|
|
927996
|
-
keepDocker,
|
|
927997
|
-
context: context3,
|
|
927998
|
-
runner,
|
|
927999
|
-
absolutePathToPreview,
|
|
928000
|
-
inspect: inspect6,
|
|
928001
|
-
ai: ai10,
|
|
928002
|
-
replay,
|
|
928003
|
-
noReplay,
|
|
928004
|
-
validateWorkspace: true,
|
|
928005
|
-
requireEnvVars,
|
|
928006
|
-
skipFernignore,
|
|
928007
|
-
automationMode,
|
|
928008
|
-
autoMerge
|
|
928009
|
-
});
|
|
928010
|
-
} else if (token != null) {
|
|
928011
|
-
const customImageGenerators = group.generators.filter((g8) => g8.containerImage != null);
|
|
928012
|
-
if (customImageGenerators.length > 0) {
|
|
928013
|
-
const names2 = customImageGenerators.map((g8) => g8.name).join(", ");
|
|
928014
|
-
return context3.failAndThrow(
|
|
928015
|
-
`Custom image configurations are only supported with local generation (--local). The following generators use custom images: ${names2}`
|
|
928016
|
-
);
|
|
928017
|
-
}
|
|
928018
|
-
await runRemoteGenerationForAPIWorkspace({
|
|
928019
|
-
projectConfig,
|
|
928020
|
-
organization,
|
|
928021
|
-
workspace,
|
|
928022
|
-
context: context3,
|
|
928023
|
-
generatorGroup: group,
|
|
928024
|
-
version: version7,
|
|
928025
|
-
shouldLogS3Url,
|
|
928026
|
-
token,
|
|
928027
|
-
whitelabel: workspace.generatorsConfiguration?.whitelabel,
|
|
928028
|
-
absolutePathToPreview,
|
|
928029
|
-
mode,
|
|
928030
|
-
fernignorePath,
|
|
928031
|
-
skipFernignore,
|
|
928032
|
-
dynamicIrOnly,
|
|
928033
|
-
validateWorkspace: true,
|
|
928034
|
-
retryRateLimited,
|
|
928035
|
-
requireEnvVars,
|
|
928036
|
-
automationMode,
|
|
928037
|
-
autoMerge
|
|
928038
|
-
});
|
|
928039
|
-
}
|
|
928040
|
-
})
|
|
928041
|
-
);
|
|
928042
|
-
}
|
|
928043
|
-
function resolveGroupAlias(groupNameOrAlias, groupAliases, availableGroups, context3) {
|
|
928044
|
-
const aliasGroups = groupAliases[groupNameOrAlias];
|
|
928045
|
-
if (aliasGroups != null) {
|
|
928046
|
-
for (const groupName of aliasGroups) {
|
|
928047
|
-
if (!availableGroups.includes(groupName)) {
|
|
928048
|
-
context3.failAndThrow(
|
|
928049
|
-
`Group alias '${groupNameOrAlias}' references non-existent group '${groupName}'. Available groups: ${availableGroups.join(", ")}`,
|
|
928050
|
-
void 0,
|
|
928051
|
-
{ code: CliError.Code.NetworkError }
|
|
928052
|
-
);
|
|
928053
|
-
}
|
|
928054
|
-
}
|
|
928055
|
-
return aliasGroups;
|
|
928056
|
-
}
|
|
928057
|
-
if (availableGroups.includes(groupNameOrAlias)) {
|
|
928058
|
-
return [groupNameOrAlias];
|
|
928059
|
-
}
|
|
928060
|
-
const availableAliases = Object.keys(groupAliases);
|
|
928061
|
-
const suggestions = [...availableGroups, ...availableAliases];
|
|
928062
|
-
context3.failAndThrow(
|
|
928063
|
-
`'${groupNameOrAlias}' is not a valid group or alias. Available groups: ${availableGroups.join(", ")}` + (availableAliases.length > 0 ? `. Available aliases: ${availableAliases.join(", ")}` : ""),
|
|
928064
|
-
void 0,
|
|
928065
|
-
{ code: CliError.Code.NetworkError }
|
|
928066
|
-
);
|
|
928067
|
-
return [];
|
|
928068
|
-
}
|
|
928069
|
-
function applyLfsOverride(group, lfsOverridePath, context3) {
|
|
928070
|
-
const baseAbsolutePath = AbsoluteFilePath2.of(resolve6(cwd(), lfsOverridePath));
|
|
928071
|
-
const languageCount = {};
|
|
928072
|
-
const modifiedGenerators = [];
|
|
928073
|
-
for (const generator of group.generators) {
|
|
928074
|
-
const language = generator.language ?? getLanguageFromGeneratorName3(generator.name);
|
|
928075
|
-
let outputPath;
|
|
928076
|
-
if (group.generators.length === 1) {
|
|
928077
|
-
outputPath = baseAbsolutePath;
|
|
928078
|
-
} else {
|
|
928079
|
-
const languageDir = language || "unknown";
|
|
928080
|
-
if (languageCount[languageDir] == null) {
|
|
928081
|
-
languageCount[languageDir] = 0;
|
|
928082
|
-
}
|
|
928083
|
-
languageCount[languageDir]++;
|
|
928084
|
-
const dirName = languageCount[languageDir] === 1 ? languageDir : `${languageDir}-${languageCount[languageDir]}`;
|
|
928085
|
-
outputPath = join8(baseAbsolutePath, RelativeFilePath2.of(dirName));
|
|
928086
|
-
}
|
|
928087
|
-
const modifiedGenerator = {
|
|
928088
|
-
...generator,
|
|
928089
|
-
outputMode: api_exports4.remoteGen.OutputMode.downloadFiles({}),
|
|
928090
|
-
absolutePathToLocalOutput: outputPath
|
|
928091
|
-
};
|
|
928092
|
-
modifiedGenerators.push(modifiedGenerator);
|
|
928093
|
-
context3.logger.info(
|
|
928094
|
-
`Overriding output for generator '${generator.name}' to local-file-system at: ${outputPath}`
|
|
928095
|
-
);
|
|
928096
|
-
}
|
|
928097
|
-
return {
|
|
928098
|
-
...group,
|
|
928099
|
-
generators: modifiedGenerators
|
|
928100
|
-
};
|
|
928101
|
-
}
|
|
928102
|
-
function getLanguageFromGeneratorName3(generatorName) {
|
|
928103
|
-
if (generatorName.includes("typescript") || generatorName.includes("ts")) {
|
|
928104
|
-
return "typescript";
|
|
928105
|
-
}
|
|
928106
|
-
if (generatorName.includes("python") || generatorName.includes("py")) {
|
|
928107
|
-
return "python";
|
|
928108
|
-
}
|
|
928109
|
-
if (generatorName.includes("java")) {
|
|
928110
|
-
return "java";
|
|
928111
|
-
}
|
|
928112
|
-
if (generatorName.includes("go")) {
|
|
928113
|
-
return "go";
|
|
928114
|
-
}
|
|
928115
|
-
if (generatorName.includes("ruby")) {
|
|
928116
|
-
return "ruby";
|
|
928117
|
-
}
|
|
928118
|
-
if (generatorName.includes("csharp") || generatorName.includes("c#")) {
|
|
928119
|
-
return "csharp";
|
|
928120
|
-
}
|
|
928121
|
-
if (generatorName.includes("swift")) {
|
|
928122
|
-
return "swift";
|
|
928123
|
-
}
|
|
928124
|
-
if (generatorName.includes("php")) {
|
|
928125
|
-
return "php";
|
|
928126
|
-
}
|
|
928127
|
-
if (generatorName.includes("rust")) {
|
|
928128
|
-
return "rust";
|
|
928129
|
-
}
|
|
928130
|
-
return generatorName.replace(/[^a-zA-Z0-9]/g, "-").toLowerCase();
|
|
928131
|
-
}
|
|
928132
|
-
|
|
928133
|
-
// src/commands/generate/generateAPIWorkspaces.ts
|
|
928134
|
-
var GenerationMode = {
|
|
928135
|
-
PullRequest: "pull-request"
|
|
928136
|
-
};
|
|
928137
|
-
async function generateAPIWorkspaces({
|
|
928138
|
-
project,
|
|
928139
|
-
cliContext,
|
|
928140
|
-
version: version7,
|
|
928141
|
-
groupName,
|
|
928142
|
-
generatorName,
|
|
928143
|
-
generatorIndex,
|
|
928144
|
-
shouldLogS3Url,
|
|
928145
|
-
keepDocker,
|
|
928146
|
-
useLocalDocker,
|
|
928147
|
-
preview,
|
|
928148
|
-
mode,
|
|
928149
|
-
force,
|
|
928150
|
-
runner,
|
|
928151
|
-
inspect: inspect6,
|
|
928152
|
-
lfsOverride,
|
|
928153
|
-
fernignorePath,
|
|
928154
|
-
skipFernignore,
|
|
928155
|
-
dynamicIrOnly,
|
|
928156
|
-
outputDir,
|
|
928157
|
-
noReplay,
|
|
928158
|
-
retryRateLimited,
|
|
928159
|
-
requireEnvVars,
|
|
928160
|
-
automationMode,
|
|
928161
|
-
autoMerge
|
|
928162
|
-
}) {
|
|
928163
|
-
let token = void 0;
|
|
928164
|
-
if (!useLocalDocker) {
|
|
928165
|
-
const currentToken = await cliContext.runTask(async (context3) => {
|
|
928166
|
-
return askToLogin(context3);
|
|
928167
|
-
});
|
|
928168
|
-
if (currentToken.type === "user") {
|
|
928169
|
-
await cliContext.runTask(async (context3) => {
|
|
928170
|
-
await createOrganizationIfDoesNotExist({
|
|
928171
|
-
organization: project.config.organization,
|
|
928172
|
-
token: currentToken,
|
|
928173
|
-
context: context3
|
|
928174
|
-
});
|
|
928175
|
-
});
|
|
928176
|
-
}
|
|
928177
|
-
token = currentToken;
|
|
928178
|
-
}
|
|
928179
|
-
for (const workspace of project.apiWorkspaces) {
|
|
928180
|
-
const resolvedGroupNames = resolveGroupNamesForWorkspace(groupName, workspace.generatorsConfiguration);
|
|
928181
|
-
for (const group of workspace.generatorsConfiguration?.groups.filter(
|
|
928182
|
-
(group2) => resolvedGroupNames == null || resolvedGroupNames.includes(group2.groupName)
|
|
928183
|
-
) ?? []) {
|
|
928184
|
-
const filterResult = filterGenerators({
|
|
928185
|
-
generators: group.generators,
|
|
928186
|
-
generatorIndex,
|
|
928187
|
-
generatorName,
|
|
928188
|
-
groupName: group.groupName
|
|
928189
|
-
});
|
|
928190
|
-
if (!filterResult.ok) {
|
|
928191
|
-
continue;
|
|
928192
|
-
}
|
|
928193
|
-
for (const generator of filterResult.generators) {
|
|
928194
|
-
const { shouldProceed } = await checkOutputDirectory(
|
|
928195
|
-
generator.absolutePathToLocalOutput,
|
|
928196
|
-
cliContext,
|
|
928197
|
-
force
|
|
928198
|
-
);
|
|
928199
|
-
if (!shouldProceed) {
|
|
928200
|
-
cliContext.failAndThrow("Generation cancelled", void 0, { code: CliError.Code.ConfigError });
|
|
928201
|
-
}
|
|
928202
|
-
}
|
|
928203
|
-
}
|
|
928204
|
-
}
|
|
928205
|
-
cliContext.instrumentPostHogEvent({
|
|
928206
|
-
orgId: project.config.organization,
|
|
928207
|
-
command: "fern generate",
|
|
928208
|
-
properties: {
|
|
928209
|
-
workspaces: project.apiWorkspaces.map((workspace) => {
|
|
928210
|
-
const resolvedGroupNames = resolveGroupNamesForWorkspace(groupName, workspace.generatorsConfiguration);
|
|
928211
|
-
return {
|
|
928212
|
-
name: workspace.workspaceName,
|
|
928213
|
-
group: groupName,
|
|
928214
|
-
generators: workspace.generatorsConfiguration?.groups.filter((group) => resolvedGroupNames == null || resolvedGroupNames.includes(group.groupName)).map((group) => {
|
|
928215
|
-
return group.generators.filter((generator) => generatorName == null || generator.name === generatorName).map((generator) => {
|
|
928216
|
-
return {
|
|
928217
|
-
name: generator.name,
|
|
928218
|
-
version: generator.version,
|
|
928219
|
-
outputMode: generator.outputMode.type,
|
|
928220
|
-
config: generator.config
|
|
928221
|
-
};
|
|
928222
|
-
});
|
|
928223
|
-
})
|
|
928224
|
-
};
|
|
928225
|
-
})
|
|
928226
|
-
}
|
|
928227
|
-
});
|
|
928228
|
-
await Promise.all(
|
|
928229
|
-
project.apiWorkspaces.map(async (workspace) => {
|
|
928230
|
-
await cliContext.runTaskForWorkspace(workspace, async (context3) => {
|
|
928231
|
-
const absolutePathToPreview = preview ? outputDir != null ? AbsoluteFilePath2.of(resolve6(cwd(), outputDir)) : join8(workspace.absoluteFilePath, RelativeFilePath2.of(PREVIEW_DIRECTORY)) : void 0;
|
|
928232
|
-
if (absolutePathToPreview != null) {
|
|
928233
|
-
context3.logger.info(`Writing preview to ${absolutePathToPreview}`);
|
|
928234
|
-
}
|
|
928235
|
-
await generateWorkspace({
|
|
928236
|
-
organization: project.config.organization,
|
|
928237
|
-
workspace,
|
|
928238
|
-
projectConfig: project.config,
|
|
928239
|
-
context: context3,
|
|
928240
|
-
version: version7,
|
|
928241
|
-
groupName,
|
|
928242
|
-
generatorName,
|
|
928243
|
-
generatorIndex,
|
|
928244
|
-
shouldLogS3Url,
|
|
928245
|
-
token,
|
|
928246
|
-
useLocalDocker,
|
|
928247
|
-
keepDocker,
|
|
928248
|
-
absolutePathToPreview,
|
|
928249
|
-
mode,
|
|
928250
|
-
runner,
|
|
928251
|
-
inspect: inspect6,
|
|
928252
|
-
lfsOverride,
|
|
928253
|
-
fernignorePath,
|
|
928254
|
-
skipFernignore,
|
|
928255
|
-
dynamicIrOnly,
|
|
928256
|
-
noReplay,
|
|
928257
|
-
retryRateLimited,
|
|
928258
|
-
requireEnvVars,
|
|
928259
|
-
automationMode,
|
|
928260
|
-
autoMerge
|
|
928261
|
-
});
|
|
928262
|
-
});
|
|
928263
|
-
})
|
|
928264
|
-
);
|
|
928265
|
-
}
|
|
928266
|
-
function resolveGroupNamesForWorkspace(groupName, generatorsConfiguration) {
|
|
928267
|
-
if (groupName == null) {
|
|
928268
|
-
return null;
|
|
928269
|
-
}
|
|
928270
|
-
if (generatorsConfiguration == null) {
|
|
928271
|
-
return [groupName];
|
|
928272
|
-
}
|
|
928273
|
-
const aliasGroups = generatorsConfiguration.groupAliases[groupName];
|
|
928274
|
-
if (aliasGroups != null) {
|
|
928275
|
-
return aliasGroups;
|
|
928276
|
-
}
|
|
928277
|
-
return [groupName];
|
|
928278
|
-
}
|
|
928279
|
-
|
|
928280
928949
|
// src/commands/generate/generateDocsWorkspace.ts
|
|
928281
928950
|
init_js();
|
|
928282
928951
|
|
|
@@ -928797,7 +929466,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
928797
929466
|
|
|
928798
929467
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
928799
929468
|
init_lib6();
|
|
928800
|
-
var
|
|
929469
|
+
var import_promises142 = require("fs/promises");
|
|
928801
929470
|
async function compareOpenAPISpecs({
|
|
928802
929471
|
originalPath,
|
|
928803
929472
|
modifiedPath,
|
|
@@ -928838,12 +929507,12 @@ async function compareOpenAPISpecs({
|
|
|
928838
929507
|
}
|
|
928839
929508
|
outputPath = join8(dirname6(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
928840
929509
|
}
|
|
928841
|
-
await (0,
|
|
929510
|
+
await (0, import_promises142.writeFile)(outputPath, jsYaml.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
928842
929511
|
context3.logger.info(`Overrides written to ${outputPath}`);
|
|
928843
929512
|
});
|
|
928844
929513
|
}
|
|
928845
929514
|
async function loadSpec2(filepath, context3) {
|
|
928846
|
-
const contents = await (0,
|
|
929515
|
+
const contents = await (0, import_promises142.readFile)(filepath, "utf8");
|
|
928847
929516
|
try {
|
|
928848
929517
|
return JSON.parse(contents);
|
|
928849
929518
|
} catch {
|
|
@@ -928947,7 +929616,7 @@ function deepEqual(a4, b7) {
|
|
|
928947
929616
|
|
|
928948
929617
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
928949
929618
|
init_lib6();
|
|
928950
|
-
var
|
|
929619
|
+
var import_promises143 = require("fs/promises");
|
|
928951
929620
|
async function writeOverridesForWorkspaces({
|
|
928952
929621
|
project,
|
|
928953
929622
|
includeModels,
|
|
@@ -928972,7 +929641,7 @@ async function writeOverridesForWorkspaces({
|
|
|
928972
929641
|
async function readExistingOverrides(overridesFilepath, context3) {
|
|
928973
929642
|
let parsedOverrides = null;
|
|
928974
929643
|
try {
|
|
928975
|
-
const contents = (await (0,
|
|
929644
|
+
const contents = (await (0, import_promises143.readFile)(overridesFilepath, "utf8")).toString();
|
|
928976
929645
|
try {
|
|
928977
929646
|
parsedOverrides = JSON.parse(contents);
|
|
928978
929647
|
} catch (err) {
|
|
@@ -929037,7 +929706,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
929037
929706
|
for (const overridesPath of overridesPaths) {
|
|
929038
929707
|
const existingOverrides = await readExistingOverrides(overridesPath, context3);
|
|
929039
929708
|
const content5 = generateOverridesContent({ ir: ir10, existingOverrides, includeModels, context: context3 });
|
|
929040
|
-
await (0,
|
|
929709
|
+
await (0, import_promises143.writeFile)(overridesPath, jsYaml.dump(content5));
|
|
929041
929710
|
}
|
|
929042
929711
|
} else {
|
|
929043
929712
|
const content5 = generateOverridesContent({ ir: ir10, existingOverrides: {}, includeModels, context: context3 });
|
|
@@ -929051,7 +929720,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
929051
929720
|
overridesFilename = `${nameWithoutExt}-overrides${extension4}`;
|
|
929052
929721
|
}
|
|
929053
929722
|
}
|
|
929054
|
-
await (0,
|
|
929723
|
+
await (0, import_promises143.writeFile)(
|
|
929055
929724
|
join8(dirname6(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
929056
929725
|
jsYaml.dump(content5)
|
|
929057
929726
|
);
|
|
@@ -929467,7 +930136,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
929467
930136
|
}
|
|
929468
930137
|
|
|
929469
930138
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
929470
|
-
var
|
|
930139
|
+
var import_promises144 = require("fs/promises");
|
|
929471
930140
|
async function generateJsonschemaForWorkspaces({
|
|
929472
930141
|
typeLocator,
|
|
929473
930142
|
project,
|
|
@@ -929515,9 +930184,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
929515
930184
|
context: context3
|
|
929516
930185
|
});
|
|
929517
930186
|
if (!await doesPathExist(dirname6(jsonschemaFilepath))) {
|
|
929518
|
-
await (0,
|
|
930187
|
+
await (0, import_promises144.mkdir)(dirname6(jsonschemaFilepath), { recursive: true });
|
|
929519
930188
|
}
|
|
929520
|
-
await (0,
|
|
930189
|
+
await (0, import_promises144.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
929521
930190
|
context3.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
929522
930191
|
});
|
|
929523
930192
|
})
|
|
@@ -929526,7 +930195,7 @@ async function generateJsonschemaForWorkspaces({
|
|
|
929526
930195
|
|
|
929527
930196
|
// src/commands/merge/mergeOpenAPIWithOverrides.ts
|
|
929528
930197
|
init_lib6();
|
|
929529
|
-
var
|
|
930198
|
+
var import_promises145 = require("fs/promises");
|
|
929530
930199
|
var HTTP_METHODS2 = /* @__PURE__ */ new Set(["get", "put", "post", "delete", "options", "head", "patch", "trace"]);
|
|
929531
930200
|
async function mergeOpenAPIWithOverrides({
|
|
929532
930201
|
openapiPath,
|
|
@@ -929551,12 +930220,12 @@ async function mergeOpenAPIWithOverrides({
|
|
|
929551
930220
|
const merged = mergeExamplesIntoSpec(openapi, overrides, context3);
|
|
929552
930221
|
const isJson = outputPath.endsWith(".json");
|
|
929553
930222
|
const output2 = isJson ? JSON.stringify(merged, null, 2) : jsYaml.dump(merged, { lineWidth: -1, noRefs: true });
|
|
929554
|
-
await (0,
|
|
930223
|
+
await (0, import_promises145.writeFile)(outputPath, output2);
|
|
929555
930224
|
context3.logger.info(`Merged output written to ${outputPath}`);
|
|
929556
930225
|
});
|
|
929557
930226
|
}
|
|
929558
930227
|
async function loadYamlOrJson(filepath, context3) {
|
|
929559
|
-
const contents = await (0,
|
|
930228
|
+
const contents = await (0, import_promises145.readFile)(filepath, "utf8");
|
|
929560
930229
|
try {
|
|
929561
930230
|
return JSON.parse(contents);
|
|
929562
930231
|
} catch {
|
|
@@ -930190,7 +930859,7 @@ async function mockServer({
|
|
|
930190
930859
|
}
|
|
930191
930860
|
|
|
930192
930861
|
// src/commands/register/registerWorkspacesV1.ts
|
|
930193
|
-
var
|
|
930862
|
+
var import_promises146 = require("fs/promises");
|
|
930194
930863
|
var import_path93 = __toESM(require("path"), 1);
|
|
930195
930864
|
var import_tmp_promise16 = __toESM(require_tmp_promise(), 1);
|
|
930196
930865
|
async function registerWorkspacesV1({
|
|
@@ -930243,7 +930912,7 @@ async function registerWorkspacesV1({
|
|
|
930243
930912
|
context3.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
930244
930913
|
await Zn8({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
930245
930914
|
context3.logger.info("Uploading definition...");
|
|
930246
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
930915
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises146.readFile)(tarPath));
|
|
930247
930916
|
context3.logger.info(
|
|
930248
930917
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
930249
930918
|
);
|
|
@@ -930485,7 +931154,7 @@ async function generateDiff({
|
|
|
930485
931154
|
|
|
930486
931155
|
// src/commands/sdk-preview/sdkPreview.ts
|
|
930487
931156
|
init_lib6();
|
|
930488
|
-
var
|
|
931157
|
+
var import_promises147 = __toESM(require("fs/promises"), 1);
|
|
930489
931158
|
|
|
930490
931159
|
// src/commands/sdk-preview/computePreviewVersion.ts
|
|
930491
931160
|
var BASE_VERSION = "0.0.1";
|
|
@@ -930605,7 +931274,7 @@ async function sdkPreview({
|
|
|
930605
931274
|
const firstPath = pathOutputs[0];
|
|
930606
931275
|
const absolutePathToOutput = firstPath != null ? AbsoluteFilePath2.of(resolve6(cwd(), firstPath)) : void 0;
|
|
930607
931276
|
if (absolutePathToOutput != null) {
|
|
930608
|
-
await
|
|
931277
|
+
await import_promises147.default.mkdir(absolutePathToOutput, { recursive: true });
|
|
930609
931278
|
}
|
|
930610
931279
|
for (const workspace of project.apiWorkspaces) {
|
|
930611
931280
|
if (workspace.generatorsConfiguration == null) {
|
|
@@ -930789,7 +931458,7 @@ async function sdkPreview({
|
|
|
930789
931458
|
}
|
|
930790
931459
|
|
|
930791
931460
|
// src/commands/self-update/selfUpdate.ts
|
|
930792
|
-
var
|
|
931461
|
+
var import_promises148 = require("fs/promises");
|
|
930793
931462
|
var import_path94 = require("path");
|
|
930794
931463
|
async function getPackageManagerBinDir(logger4, pm) {
|
|
930795
931464
|
let command3;
|
|
@@ -930835,7 +931504,7 @@ async function detectInstallationMethod(logger4) {
|
|
|
930835
931504
|
logger4.debug(`Found fern at: ${fernPath}`);
|
|
930836
931505
|
let resolvedPath;
|
|
930837
931506
|
try {
|
|
930838
|
-
resolvedPath = await (0,
|
|
931507
|
+
resolvedPath = await (0, import_promises148.realpath)(fernPath);
|
|
930839
931508
|
logger4.debug(`Resolved to: ${resolvedPath}`);
|
|
930840
931509
|
} catch (error50) {
|
|
930841
931510
|
logger4.debug(`Failed to resolve symlink: ${error50}`);
|
|
@@ -931138,21 +931807,21 @@ async function generateToken({
|
|
|
931138
931807
|
// src/commands/upgrade/updateApiSpec.ts
|
|
931139
931808
|
init_lib6();
|
|
931140
931809
|
var fs26 = __toESM(require("fs"), 1);
|
|
931141
|
-
var
|
|
931810
|
+
var import_promises149 = require("fs/promises");
|
|
931142
931811
|
init_graphql();
|
|
931143
931812
|
var import_stream16 = require("stream");
|
|
931144
|
-
var
|
|
931813
|
+
var import_promises150 = require("stream/promises");
|
|
931145
931814
|
async function fetchAndWriteFile(url3, path99, logger4, indent4) {
|
|
931146
931815
|
const resp = await fetch(url3);
|
|
931147
931816
|
if (resp.ok && resp.body) {
|
|
931148
931817
|
logger4.debug("Origin successfully fetched, writing to file");
|
|
931149
931818
|
const fileStream = fs26.createWriteStream(path99);
|
|
931150
|
-
await (0,
|
|
931151
|
-
const fileContents = await (0,
|
|
931819
|
+
await (0, import_promises150.finished)(import_stream16.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
931820
|
+
const fileContents = await (0, import_promises149.readFile)(path99, "utf8");
|
|
931152
931821
|
try {
|
|
931153
|
-
await (0,
|
|
931822
|
+
await (0, import_promises149.writeFile)(path99, JSON.stringify(JSON.parse(fileContents), void 0, indent4), "utf8");
|
|
931154
931823
|
} catch (e5) {
|
|
931155
|
-
await (0,
|
|
931824
|
+
await (0, import_promises149.writeFile)(path99, jsYaml.dump(jsYaml.load(fileContents), { indent: indent4 }), "utf8");
|
|
931156
931825
|
}
|
|
931157
931826
|
logger4.debug("File written successfully");
|
|
931158
931827
|
}
|
|
@@ -931308,14 +931977,14 @@ async function tryDirectJSONFetch(url3, logger4) {
|
|
|
931308
931977
|
async function fetchGraphQLSchemaWithAutoDetection(url3, path99, logger4) {
|
|
931309
931978
|
const postResult = await tryGraphQLIntrospection(url3, logger4);
|
|
931310
931979
|
if (postResult.success) {
|
|
931311
|
-
await (0,
|
|
931980
|
+
await (0, import_promises149.writeFile)(path99, postResult.result, "utf8");
|
|
931312
931981
|
logger4.info("Successfully fetched GraphQL schema using POST introspection");
|
|
931313
931982
|
return;
|
|
931314
931983
|
}
|
|
931315
931984
|
logger4.debug(`POST introspection failed: ${postResult.error}`);
|
|
931316
931985
|
const getResult = await tryDirectJSONFetch(url3, logger4);
|
|
931317
931986
|
if (getResult.success) {
|
|
931318
|
-
await (0,
|
|
931987
|
+
await (0, import_promises149.writeFile)(path99, getResult.result, "utf8");
|
|
931319
931988
|
logger4.info("Successfully fetched GraphQL schema using direct JSON fetch");
|
|
931320
931989
|
return;
|
|
931321
931990
|
}
|
|
@@ -931424,7 +932093,7 @@ async function processDefinitions({
|
|
|
931424
932093
|
init_lib4();
|
|
931425
932094
|
|
|
931426
932095
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
931427
|
-
var
|
|
932096
|
+
var import_promises151 = require("fs/promises");
|
|
931428
932097
|
|
|
931429
932098
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
931430
932099
|
init_lib6();
|
|
@@ -931460,7 +932129,7 @@ var migration = {
|
|
|
931460
932129
|
try {
|
|
931461
932130
|
const fileContents = await getFileContents(yamlFilepath);
|
|
931462
932131
|
const newContents = addDiscriminantToFile(fileContents);
|
|
931463
|
-
await (0,
|
|
932132
|
+
await (0, import_promises151.writeFile)(yamlFilepath, newContents);
|
|
931464
932133
|
} catch (error50) {
|
|
931465
932134
|
context3.failAndThrow("Failed to migrate " + yamlFilepath, error50);
|
|
931466
932135
|
}
|
|
@@ -931468,7 +932137,7 @@ var migration = {
|
|
|
931468
932137
|
}
|
|
931469
932138
|
};
|
|
931470
932139
|
async function getFileContents(filepath) {
|
|
931471
|
-
const buffer = await (0,
|
|
932140
|
+
const buffer = await (0, import_promises151.readFile)(filepath);
|
|
931472
932141
|
return buffer.toString();
|
|
931473
932142
|
}
|
|
931474
932143
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -931497,7 +932166,7 @@ var versionMigrations = {
|
|
|
931497
932166
|
var __default = versionMigrations;
|
|
931498
932167
|
|
|
931499
932168
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
931500
|
-
var
|
|
932169
|
+
var import_promises152 = require("fs/promises");
|
|
931501
932170
|
var import_yaml7 = __toESM(require_dist9(), 1);
|
|
931502
932171
|
|
|
931503
932172
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -931540,7 +932209,7 @@ var migration2 = {
|
|
|
931540
932209
|
}
|
|
931541
932210
|
};
|
|
931542
932211
|
async function migrateFile(filepath, context3) {
|
|
931543
|
-
const contents = await (0,
|
|
932212
|
+
const contents = await (0, import_promises152.readFile)(filepath);
|
|
931544
932213
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
931545
932214
|
const types4 = parsedDocument.get("types");
|
|
931546
932215
|
if (types4 == null) {
|
|
@@ -931572,7 +932241,7 @@ async function migrateFile(filepath, context3) {
|
|
|
931572
932241
|
}
|
|
931573
932242
|
}
|
|
931574
932243
|
}
|
|
931575
|
-
await (0,
|
|
932244
|
+
await (0, import_promises152.writeFile)(filepath, parsedDocument.toString());
|
|
931576
932245
|
}
|
|
931577
932246
|
|
|
931578
932247
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -931583,7 +932252,7 @@ var versionMigrations2 = {
|
|
|
931583
932252
|
var __default2 = versionMigrations2;
|
|
931584
932253
|
|
|
931585
932254
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
931586
|
-
var
|
|
932255
|
+
var import_promises153 = require("fs/promises");
|
|
931587
932256
|
var import_yaml8 = __toESM(require_dist9(), 1);
|
|
931588
932257
|
|
|
931589
932258
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -931626,7 +932295,7 @@ var migration3 = {
|
|
|
931626
932295
|
}
|
|
931627
932296
|
};
|
|
931628
932297
|
async function migrateGeneratorsYml(filepath, context3) {
|
|
931629
|
-
const contents = await (0,
|
|
932298
|
+
const contents = await (0, import_promises153.readFile)(filepath);
|
|
931630
932299
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
931631
932300
|
const draftGenerators = parsedDocument.get("draft");
|
|
931632
932301
|
if (draftGenerators == null) {
|
|
@@ -931653,7 +932322,7 @@ async function migrateGeneratorsYml(filepath, context3) {
|
|
|
931653
932322
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
931654
932323
|
}
|
|
931655
932324
|
});
|
|
931656
|
-
await (0,
|
|
932325
|
+
await (0, import_promises153.writeFile)(filepath, parsedDocument.toString());
|
|
931657
932326
|
}
|
|
931658
932327
|
|
|
931659
932328
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -931664,7 +932333,7 @@ var versionMigrations3 = {
|
|
|
931664
932333
|
var __default3 = versionMigrations3;
|
|
931665
932334
|
|
|
931666
932335
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
931667
|
-
var
|
|
932336
|
+
var import_promises154 = require("fs/promises");
|
|
931668
932337
|
var import_yaml9 = __toESM(require_dist9(), 1);
|
|
931669
932338
|
|
|
931670
932339
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -931707,7 +932376,7 @@ var migration4 = {
|
|
|
931707
932376
|
}
|
|
931708
932377
|
};
|
|
931709
932378
|
async function migrateFile2(filepath, context3) {
|
|
931710
|
-
const contents = await (0,
|
|
932379
|
+
const contents = await (0, import_promises154.readFile)(filepath);
|
|
931711
932380
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
931712
932381
|
const addType = (typeName, typeDeclaration2) => {
|
|
931713
932382
|
const types4 = parsedDocument.get("types");
|
|
@@ -931751,7 +932420,7 @@ async function migrateFile2(filepath, context3) {
|
|
|
931751
932420
|
}
|
|
931752
932421
|
}
|
|
931753
932422
|
}
|
|
931754
|
-
await (0,
|
|
932423
|
+
await (0, import_promises154.writeFile)(filepath, parsedDocument.toString());
|
|
931755
932424
|
}
|
|
931756
932425
|
|
|
931757
932426
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -931762,7 +932431,7 @@ var versionMigrations4 = {
|
|
|
931762
932431
|
var __default4 = versionMigrations4;
|
|
931763
932432
|
|
|
931764
932433
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
931765
|
-
var
|
|
932434
|
+
var import_promises155 = require("fs/promises");
|
|
931766
932435
|
var import_yaml10 = __toESM(require_dist9(), 1);
|
|
931767
932436
|
|
|
931768
932437
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -931805,7 +932474,7 @@ var migration5 = {
|
|
|
931805
932474
|
}
|
|
931806
932475
|
};
|
|
931807
932476
|
async function migrateGeneratorsYml2(filepath, context3) {
|
|
931808
|
-
const contents = await (0,
|
|
932477
|
+
const contents = await (0, import_promises155.readFile)(filepath);
|
|
931809
932478
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
931810
932479
|
const releaseGenerators = parsedDocument.get("release");
|
|
931811
932480
|
if (releaseGenerators == null) {
|
|
@@ -931843,7 +932512,7 @@ async function migrateGeneratorsYml2(filepath, context3) {
|
|
|
931843
932512
|
}
|
|
931844
932513
|
releaseGenerator.delete("outputs");
|
|
931845
932514
|
});
|
|
931846
|
-
await (0,
|
|
932515
|
+
await (0, import_promises155.writeFile)(filepath, parsedDocument.toString());
|
|
931847
932516
|
}
|
|
931848
932517
|
|
|
931849
932518
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -931854,7 +932523,7 @@ var versionMigrations5 = {
|
|
|
931854
932523
|
var __default5 = versionMigrations5;
|
|
931855
932524
|
|
|
931856
932525
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
931857
|
-
var
|
|
932526
|
+
var import_promises156 = require("fs/promises");
|
|
931858
932527
|
|
|
931859
932528
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
931860
932529
|
init_lib6();
|
|
@@ -931887,9 +932556,9 @@ var migration6 = {
|
|
|
931887
932556
|
run: async ({ context: context3 }) => {
|
|
931888
932557
|
const yamlFiles = await getAllYamlFiles4(context3);
|
|
931889
932558
|
for (const filepath of yamlFiles) {
|
|
931890
|
-
const contents = await (0,
|
|
932559
|
+
const contents = await (0, import_promises156.readFile)(filepath);
|
|
931891
932560
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
931892
|
-
await (0,
|
|
932561
|
+
await (0, import_promises156.writeFile)(filepath, newContents);
|
|
931893
932562
|
}
|
|
931894
932563
|
}
|
|
931895
932564
|
};
|
|
@@ -931902,7 +932571,7 @@ var versionMigrations6 = {
|
|
|
931902
932571
|
var __default6 = versionMigrations6;
|
|
931903
932572
|
|
|
931904
932573
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
931905
|
-
var
|
|
932574
|
+
var import_promises157 = require("fs/promises");
|
|
931906
932575
|
|
|
931907
932576
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
931908
932577
|
init_lib6();
|
|
@@ -931935,9 +932604,9 @@ var migration7 = {
|
|
|
931935
932604
|
run: async ({ context: context3 }) => {
|
|
931936
932605
|
const yamlFiles = await getAllRootApiYamlFiles(context3);
|
|
931937
932606
|
for (const filepath of yamlFiles) {
|
|
931938
|
-
const contents = await (0,
|
|
932607
|
+
const contents = await (0, import_promises157.readFile)(filepath);
|
|
931939
932608
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
931940
|
-
await (0,
|
|
932609
|
+
await (0, import_promises157.writeFile)(filepath, newContents);
|
|
931941
932610
|
}
|
|
931942
932611
|
}
|
|
931943
932612
|
};
|
|
@@ -931951,7 +932620,7 @@ var __default7 = versionMigrations7;
|
|
|
931951
932620
|
|
|
931952
932621
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
931953
932622
|
init_lib4();
|
|
931954
|
-
var
|
|
932623
|
+
var import_promises158 = require("fs/promises");
|
|
931955
932624
|
|
|
931956
932625
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
931957
932626
|
init_lib6();
|
|
@@ -932083,7 +932752,7 @@ var migration8 = {
|
|
|
932083
932752
|
}
|
|
932084
932753
|
};
|
|
932085
932754
|
async function migrateGeneratorsYml3(filepath) {
|
|
932086
|
-
const contentsStr = await (0,
|
|
932755
|
+
const contentsStr = await (0, import_promises158.readFile)(filepath);
|
|
932087
932756
|
const contents = jsYaml.load(contentsStr.toString());
|
|
932088
932757
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
932089
932758
|
let newGeneratorsConfiguration = {};
|
|
@@ -932101,7 +932770,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
932101
932770
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
932102
932771
|
};
|
|
932103
932772
|
}
|
|
932104
|
-
await (0,
|
|
932773
|
+
await (0, import_promises158.writeFile)(filepath, jsYaml.dump(newGeneratorsConfiguration));
|
|
932105
932774
|
}
|
|
932106
932775
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
932107
932776
|
const newSchema = {
|
|
@@ -932176,7 +932845,7 @@ var versionMigrations8 = {
|
|
|
932176
932845
|
var __default8 = versionMigrations8;
|
|
932177
932846
|
|
|
932178
932847
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
932179
|
-
var
|
|
932848
|
+
var import_promises159 = require("fs/promises");
|
|
932180
932849
|
var import_yaml11 = __toESM(require_dist9(), 1);
|
|
932181
932850
|
|
|
932182
932851
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -932219,7 +932888,7 @@ var migration9 = {
|
|
|
932219
932888
|
}
|
|
932220
932889
|
};
|
|
932221
932890
|
async function migrateRootApiFile(filepath) {
|
|
932222
|
-
const contents = await (0,
|
|
932891
|
+
const contents = await (0, import_promises159.readFile)(filepath);
|
|
932223
932892
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
932224
932893
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
932225
932894
|
if (errorDiscriminant == null || !import_yaml11.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -932230,7 +932899,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
932230
932899
|
"property-name": errorDiscriminant.value
|
|
932231
932900
|
});
|
|
932232
932901
|
parsedDocument.delete("error-discriminant");
|
|
932233
|
-
await (0,
|
|
932902
|
+
await (0, import_promises159.writeFile)(filepath, parsedDocument.toString());
|
|
932234
932903
|
}
|
|
932235
932904
|
|
|
932236
932905
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -932241,7 +932910,7 @@ var versionMigrations9 = {
|
|
|
932241
932910
|
var __default9 = versionMigrations9;
|
|
932242
932911
|
|
|
932243
932912
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
932244
|
-
var
|
|
932913
|
+
var import_promises160 = require("fs/promises");
|
|
932245
932914
|
var import_yaml12 = __toESM(require_dist9(), 1);
|
|
932246
932915
|
|
|
932247
932916
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -932284,7 +932953,7 @@ var migration10 = {
|
|
|
932284
932953
|
}
|
|
932285
932954
|
};
|
|
932286
932955
|
async function migrateYamlFile(filepath, context3) {
|
|
932287
|
-
const contents = await (0,
|
|
932956
|
+
const contents = await (0, import_promises160.readFile)(filepath);
|
|
932288
932957
|
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
932289
932958
|
const services = parsedDocument.get("services");
|
|
932290
932959
|
if (services == null) {
|
|
@@ -932324,7 +932993,7 @@ async function migrateYamlFile(filepath, context3) {
|
|
|
932324
932993
|
context3.failWithoutThrowing("Failed to convert endpoint", e5);
|
|
932325
932994
|
}
|
|
932326
932995
|
}
|
|
932327
|
-
await (0,
|
|
932996
|
+
await (0, import_promises160.writeFile)(filepath, parsedDocument.toString());
|
|
932328
932997
|
}
|
|
932329
932998
|
}
|
|
932330
932999
|
function convertEndpoint4({ document: document4, endpoint: endpoint3 }) {
|
|
@@ -932403,7 +933072,7 @@ var versionMigrations10 = {
|
|
|
932403
933072
|
var __default10 = versionMigrations10;
|
|
932404
933073
|
|
|
932405
933074
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
932406
|
-
var
|
|
933075
|
+
var import_promises161 = require("fs/promises");
|
|
932407
933076
|
var import_yaml13 = __toESM(require_dist9(), 1);
|
|
932408
933077
|
|
|
932409
933078
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -932446,7 +933115,7 @@ var migration11 = {
|
|
|
932446
933115
|
}
|
|
932447
933116
|
};
|
|
932448
933117
|
async function migrateYamlFile2(filepath, context3) {
|
|
932449
|
-
const contents = await (0,
|
|
933118
|
+
const contents = await (0, import_promises161.readFile)(filepath);
|
|
932450
933119
|
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
932451
933120
|
const types4 = parsedDocument.get("types");
|
|
932452
933121
|
if (types4 == null) {
|
|
@@ -932472,7 +933141,7 @@ async function migrateYamlFile2(filepath, context3) {
|
|
|
932472
933141
|
examples.set(i9, { value: value2 });
|
|
932473
933142
|
}
|
|
932474
933143
|
}
|
|
932475
|
-
await (0,
|
|
933144
|
+
await (0, import_promises161.writeFile)(filepath, parsedDocument.toString());
|
|
932476
933145
|
}
|
|
932477
933146
|
|
|
932478
933147
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -932483,7 +933152,7 @@ var versionMigrations11 = {
|
|
|
932483
933152
|
var __default11 = versionMigrations11;
|
|
932484
933153
|
|
|
932485
933154
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
932486
|
-
var
|
|
933155
|
+
var import_promises162 = require("fs/promises");
|
|
932487
933156
|
var import_yaml14 = __toESM(require_dist9(), 1);
|
|
932488
933157
|
|
|
932489
933158
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -932526,7 +933195,7 @@ var migration12 = {
|
|
|
932526
933195
|
}
|
|
932527
933196
|
};
|
|
932528
933197
|
async function migrateYamlFile3(filepath, context3) {
|
|
932529
|
-
const contents = await (0,
|
|
933198
|
+
const contents = await (0, import_promises162.readFile)(filepath);
|
|
932530
933199
|
const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
|
|
932531
933200
|
if (!import_yaml14.default.isMap(parsedDocument.contents)) {
|
|
932532
933201
|
return context3.failAndThrow("File is not a map");
|
|
@@ -932556,7 +933225,7 @@ async function migrateYamlFile3(filepath, context3) {
|
|
|
932556
933225
|
pair.value = firstService.value;
|
|
932557
933226
|
}
|
|
932558
933227
|
}
|
|
932559
|
-
await (0,
|
|
933228
|
+
await (0, import_promises162.writeFile)(filepath, parsedDocument.toString());
|
|
932560
933229
|
}
|
|
932561
933230
|
|
|
932562
933231
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -932567,7 +933236,7 @@ var versionMigrations12 = {
|
|
|
932567
933236
|
var __default12 = versionMigrations12;
|
|
932568
933237
|
|
|
932569
933238
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
932570
|
-
var
|
|
933239
|
+
var import_promises163 = require("fs/promises");
|
|
932571
933240
|
var import_yaml15 = __toESM(require_dist9(), 1);
|
|
932572
933241
|
|
|
932573
933242
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -932610,7 +933279,7 @@ var migration13 = {
|
|
|
932610
933279
|
}
|
|
932611
933280
|
};
|
|
932612
933281
|
async function migrateYamlFile4(filepath, context3) {
|
|
932613
|
-
const contents = await (0,
|
|
933282
|
+
const contents = await (0, import_promises163.readFile)(filepath);
|
|
932614
933283
|
const parsedDocument = import_yaml15.default.parseDocument(contents.toString());
|
|
932615
933284
|
if (!import_yaml15.default.isMap(parsedDocument.contents)) {
|
|
932616
933285
|
return context3.failAndThrow("File is not a map");
|
|
@@ -932629,7 +933298,7 @@ async function migrateYamlFile4(filepath, context3) {
|
|
|
932629
933298
|
}
|
|
932630
933299
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
932631
933300
|
parsedDocument.contents.items.unshift(docsPair);
|
|
932632
|
-
await (0,
|
|
933301
|
+
await (0, import_promises163.writeFile)(filepath, parsedDocument.toString());
|
|
932633
933302
|
}
|
|
932634
933303
|
|
|
932635
933304
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -932640,7 +933309,7 @@ var versionMigrations13 = {
|
|
|
932640
933309
|
var __default13 = versionMigrations13;
|
|
932641
933310
|
|
|
932642
933311
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
932643
|
-
var
|
|
933312
|
+
var import_promises164 = require("fs/promises");
|
|
932644
933313
|
|
|
932645
933314
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
932646
933315
|
init_lib6();
|
|
@@ -932682,14 +933351,14 @@ var migration14 = {
|
|
|
932682
933351
|
}
|
|
932683
933352
|
};
|
|
932684
933353
|
async function migrateYamlFile5(filepath) {
|
|
932685
|
-
const contents = await (0,
|
|
933354
|
+
const contents = await (0, import_promises164.readFile)(filepath);
|
|
932686
933355
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
932687
933356
|
const regex5 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
932688
933357
|
const updatedSnapshot = contents.toString().replace(regex5, (_match, _prefix, domain3) => {
|
|
932689
933358
|
return `docs:
|
|
932690
933359
|
domain: "${domain3}.${domainSuffix}"`;
|
|
932691
933360
|
});
|
|
932692
|
-
await (0,
|
|
933361
|
+
await (0, import_promises164.writeFile)(filepath, updatedSnapshot.toString());
|
|
932693
933362
|
}
|
|
932694
933363
|
|
|
932695
933364
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -932709,10 +933378,10 @@ var LegacyDocsSerializers = __toESM(require_serialization4(), 1);
|
|
|
932709
933378
|
|
|
932710
933379
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
932711
933380
|
init_lib6();
|
|
932712
|
-
var
|
|
933381
|
+
var import_promises165 = require("fs/promises");
|
|
932713
933382
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
932714
933383
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
932715
|
-
const contentsStr = await (0,
|
|
933384
|
+
const contentsStr = await (0, import_promises165.readFile)(filepath);
|
|
932716
933385
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
932717
933386
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
932718
933387
|
if (result.ok) {
|
|
@@ -932731,7 +933400,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
932731
933400
|
|
|
932732
933401
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
932733
933402
|
init_lib6();
|
|
932734
|
-
var
|
|
933403
|
+
var import_promises167 = require("fs/promises");
|
|
932735
933404
|
|
|
932736
933405
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
932737
933406
|
function convertLegacyDocsConfig({ docsConfiguration, docsURLs, apiName }) {
|
|
@@ -932939,10 +933608,10 @@ __export(legacy_exports, {
|
|
|
932939
933608
|
|
|
932940
933609
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
932941
933610
|
init_lib6();
|
|
932942
|
-
var
|
|
933611
|
+
var import_promises166 = require("fs/promises");
|
|
932943
933612
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
932944
933613
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
932945
|
-
const contentsStr = await (0,
|
|
933614
|
+
const contentsStr = await (0, import_promises166.readFile)(filepath);
|
|
932946
933615
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
932947
933616
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
932948
933617
|
if (result.success) {
|
|
@@ -932972,7 +933641,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
932972
933641
|
var APIS_DIRECTORY2 = "apis";
|
|
932973
933642
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
932974
933643
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
932975
|
-
await (0,
|
|
933644
|
+
await (0, import_promises167.mkdir)(absolutePathToApisDirectory);
|
|
932976
933645
|
for (const workspace of workspaces) {
|
|
932977
933646
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
932978
933647
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -932980,11 +933649,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
932980
933649
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
932981
933650
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
932982
933651
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
932983
|
-
await (0,
|
|
933652
|
+
await (0, import_promises167.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
932984
933653
|
}
|
|
932985
933654
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
932986
933655
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
932987
|
-
await (0,
|
|
933656
|
+
await (0, import_promises167.rm)(absolutePathToWorkspace, { recursive: true });
|
|
932988
933657
|
}
|
|
932989
933658
|
}
|
|
932990
933659
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -932997,7 +933666,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
932997
933666
|
generatorsConfiguration,
|
|
932998
933667
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
932999
933668
|
});
|
|
933000
|
-
await (0,
|
|
933669
|
+
await (0, import_promises167.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
933001
933670
|
return convertedResponse.docsURLs;
|
|
933002
933671
|
}
|
|
933003
933672
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -933011,20 +933680,20 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
933011
933680
|
apiName
|
|
933012
933681
|
});
|
|
933013
933682
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
933014
|
-
await (0,
|
|
933683
|
+
await (0, import_promises167.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
933015
933684
|
}
|
|
933016
933685
|
|
|
933017
933686
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
933018
933687
|
init_lib6();
|
|
933019
|
-
var
|
|
933688
|
+
var import_promises168 = require("fs/promises");
|
|
933020
933689
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
933021
933690
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
933022
933691
|
await migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs });
|
|
933023
933692
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
933024
933693
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
933025
933694
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
933026
|
-
await (0,
|
|
933027
|
-
await (0,
|
|
933695
|
+
await (0, import_promises168.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
933696
|
+
await (0, import_promises168.rm)(absolutePathToWorkspace, { recursive: true });
|
|
933028
933697
|
}
|
|
933029
933698
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
933030
933699
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -933037,7 +933706,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
933037
933706
|
apiName: void 0
|
|
933038
933707
|
});
|
|
933039
933708
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
933040
|
-
await (0,
|
|
933709
|
+
await (0, import_promises168.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
933041
933710
|
}
|
|
933042
933711
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
933043
933712
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -933049,23 +933718,23 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
933049
933718
|
generatorsConfiguration,
|
|
933050
933719
|
pathModificationStrategy: "MoveUp"
|
|
933051
933720
|
});
|
|
933052
|
-
await (0,
|
|
933721
|
+
await (0, import_promises168.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
933053
933722
|
return convertedResponse.docsURLs;
|
|
933054
933723
|
}
|
|
933055
933724
|
|
|
933056
933725
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
933057
933726
|
init_lib6();
|
|
933058
|
-
var
|
|
933727
|
+
var import_promises169 = require("fs/promises");
|
|
933059
933728
|
var APIS_DIRECTORY3 = "apis";
|
|
933060
933729
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
933061
933730
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
933062
|
-
await (0,
|
|
933731
|
+
await (0, import_promises169.mkdir)(absolutePathToApisDirectory);
|
|
933063
933732
|
for (const workspace of workspaces) {
|
|
933064
933733
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
933065
933734
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
933066
933735
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
933067
933736
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
933068
|
-
await (0,
|
|
933737
|
+
await (0, import_promises169.rm)(absolutePathToWorkspace, { recursive: true });
|
|
933069
933738
|
}
|
|
933070
933739
|
}
|
|
933071
933740
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -933078,16 +933747,16 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
933078
933747
|
generatorsConfiguration,
|
|
933079
933748
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
933080
933749
|
});
|
|
933081
|
-
await (0,
|
|
933750
|
+
await (0, import_promises169.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
933082
933751
|
}
|
|
933083
933752
|
|
|
933084
933753
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
933085
933754
|
init_lib6();
|
|
933086
|
-
var
|
|
933755
|
+
var import_promises170 = require("fs/promises");
|
|
933087
933756
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
933088
933757
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
933089
933758
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
933090
|
-
await (0,
|
|
933759
|
+
await (0, import_promises170.rm)(absolutePathToWorkspace, { recursive: true });
|
|
933091
933760
|
}
|
|
933092
933761
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
933093
933762
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -933099,7 +933768,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
933099
933768
|
generatorsConfiguration,
|
|
933100
933769
|
pathModificationStrategy: "MoveUp"
|
|
933101
933770
|
});
|
|
933102
|
-
await (0,
|
|
933771
|
+
await (0, import_promises170.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
933103
933772
|
}
|
|
933104
933773
|
|
|
933105
933774
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -933177,7 +933846,7 @@ var __default15 = versionMigrations15;
|
|
|
933177
933846
|
|
|
933178
933847
|
// ../cli-migrations/lib/migrations/0.41.0-rc0/require-generators-yml/migration.js
|
|
933179
933848
|
init_lib6();
|
|
933180
|
-
var
|
|
933849
|
+
var import_promises171 = require("fs/promises");
|
|
933181
933850
|
var import_yaml16 = __toESM(require_dist9(), 1);
|
|
933182
933851
|
var migration16 = {
|
|
933183
933852
|
name: "require-generators-yml",
|
|
@@ -933220,7 +933889,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
933220
933889
|
if (existingGeneratorsYml == null) {
|
|
933221
933890
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
933222
933891
|
const absolutePathToGeneratorsYml = join8(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
933223
|
-
await (0,
|
|
933892
|
+
await (0, import_promises171.writeFile)(absolutePathToGeneratorsYml, jsYaml.dump({
|
|
933224
933893
|
api: {
|
|
933225
933894
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
933226
933895
|
}
|
|
@@ -933235,7 +933904,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
933235
933904
|
parsedDocument.set("api", {
|
|
933236
933905
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
933237
933906
|
});
|
|
933238
|
-
await (0,
|
|
933907
|
+
await (0, import_promises171.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
933239
933908
|
context3.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
933240
933909
|
}
|
|
933241
933910
|
}
|
|
@@ -933263,7 +933932,7 @@ var __default16 = versionMigrations16;
|
|
|
933263
933932
|
|
|
933264
933933
|
// ../cli-migrations/lib/migrations/0.54.0-rc0/use-generators-yml-specs/migration.js
|
|
933265
933934
|
init_lib6();
|
|
933266
|
-
var
|
|
933935
|
+
var import_promises172 = require("fs/promises");
|
|
933267
933936
|
var import_yaml17 = __toESM(require_dist9(), 1);
|
|
933268
933937
|
var migration17 = {
|
|
933269
933938
|
name: "generators-yml-use-api-specs",
|
|
@@ -933443,7 +934112,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
933443
934112
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
933444
934113
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
933445
934114
|
}
|
|
933446
|
-
await (0,
|
|
934115
|
+
await (0, import_promises172.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
933447
934116
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
933448
934117
|
}
|
|
933449
934118
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context3, namespace }) {
|
|
@@ -933490,7 +934159,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
933490
934159
|
}
|
|
933491
934160
|
let specContent;
|
|
933492
934161
|
try {
|
|
933493
|
-
const fileContents = await (0,
|
|
934162
|
+
const fileContents = await (0, import_promises172.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
933494
934163
|
specContent = jsYaml.load(fileContents);
|
|
933495
934164
|
} catch (e5) {
|
|
933496
934165
|
context3.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e5}. Skipping...`);
|
|
@@ -933594,7 +934263,7 @@ var __default17 = versionMigrations17;
|
|
|
933594
934263
|
|
|
933595
934264
|
// ../cli-migrations/lib/migrations/0.82.1/add-path-parameter-order-setting/migration.js
|
|
933596
934265
|
init_lib6();
|
|
933597
|
-
var
|
|
934266
|
+
var import_promises173 = require("fs/promises");
|
|
933598
934267
|
var migration18 = {
|
|
933599
934268
|
name: "add-path-parameter-order-setting",
|
|
933600
934269
|
summary: `Adds the 'path-parameter-order' setting to existing API configurations to maintain backwards compatibility.
|
|
@@ -933682,7 +934351,7 @@ async function updateGeneratorsYml({ context: context3, files }) {
|
|
|
933682
934351
|
documentToWrite = `${schemaComment}
|
|
933683
934352
|
${documentToWrite}`;
|
|
933684
934353
|
}
|
|
933685
|
-
await (0,
|
|
934354
|
+
await (0, import_promises173.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
933686
934355
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
933687
934356
|
}
|
|
933688
934357
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -933719,7 +934388,7 @@ var __default18 = versionMigrations18;
|
|
|
933719
934388
|
|
|
933720
934389
|
// ../cli-migrations/lib/migrations/1.0.0/update-settings-defaults/migration.js
|
|
933721
934390
|
init_lib6();
|
|
933722
|
-
var
|
|
934391
|
+
var import_promises174 = require("fs/promises");
|
|
933723
934392
|
var migration19 = {
|
|
933724
934393
|
name: "update-1_0_0-defaults",
|
|
933725
934394
|
summary: `The defaults of the API spec settings have changed.
|
|
@@ -933894,7 +934563,7 @@ async function updateGeneratorsYml2({ context: context3, files }) {
|
|
|
933894
934563
|
documentToWrite = `${schemaComment}
|
|
933895
934564
|
${documentToWrite}`;
|
|
933896
934565
|
}
|
|
933897
|
-
await (0,
|
|
934566
|
+
await (0, import_promises174.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
933898
934567
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
933899
934568
|
}
|
|
933900
934569
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -933964,7 +934633,7 @@ var __default19 = versionMigrations19;
|
|
|
933964
934633
|
|
|
933965
934634
|
// ../cli-migrations/lib/migrations/2.0.0-rc0/update-settings-defaults/migration.js
|
|
933966
934635
|
init_lib6();
|
|
933967
|
-
var
|
|
934636
|
+
var import_promises175 = require("fs/promises");
|
|
933968
934637
|
var migration20 = {
|
|
933969
934638
|
name: "update-2_0_0-defaults",
|
|
933970
934639
|
summary: `The default of 'coerce-enums-to-literals' has changed from true to false.
|
|
@@ -934139,7 +934808,7 @@ async function updateGeneratorsYml3({ context: context3, files }) {
|
|
|
934139
934808
|
documentToWrite = `${schemaComment}
|
|
934140
934809
|
${documentToWrite}`;
|
|
934141
934810
|
}
|
|
934142
|
-
await (0,
|
|
934811
|
+
await (0, import_promises175.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
934143
934812
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
934144
934813
|
}
|
|
934145
934814
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -934186,7 +934855,7 @@ var __default20 = versionMigrations20;
|
|
|
934186
934855
|
|
|
934187
934856
|
// ../cli-migrations/lib/migrations/2.13.0/migrate-deprecated-generator-api-settings/migration.js
|
|
934188
934857
|
init_lib6();
|
|
934189
|
-
var
|
|
934858
|
+
var import_promises176 = require("fs/promises");
|
|
934190
934859
|
var migration21 = {
|
|
934191
934860
|
name: "migrate-deprecated-generator-api-settings",
|
|
934192
934861
|
summary: `Migrates deprecated generator-level API settings keys to their new equivalents:
|
|
@@ -934277,7 +934946,7 @@ async function updateGeneratorsYml4({ context: context3, files }) {
|
|
|
934277
934946
|
documentToWrite = `${schemaComment}
|
|
934278
934947
|
${documentToWrite}`;
|
|
934279
934948
|
}
|
|
934280
|
-
await (0,
|
|
934949
|
+
await (0, import_promises176.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
934281
934950
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
934282
934951
|
}
|
|
934283
934952
|
function migrateDeprecatedSettings(settings, context3) {
|
|
@@ -934324,7 +934993,7 @@ var __default21 = versionMigrations21;
|
|
|
934324
934993
|
|
|
934325
934994
|
// ../cli-migrations/lib/migrations/3.0.0/enable-smart-casing/migration.js
|
|
934326
934995
|
init_lib6();
|
|
934327
|
-
var
|
|
934996
|
+
var import_promises177 = require("fs/promises");
|
|
934328
934997
|
var migration22 = {
|
|
934329
934998
|
name: "enable-smart-casing",
|
|
934330
934999
|
summary: `Sets 'smart-casing: false' for existing generators to preserve backwards compatibility.
|
|
@@ -934408,7 +935077,7 @@ async function updateGeneratorsYml5({ context: context3, files }) {
|
|
|
934408
935077
|
documentToWrite = `${schemaComment}
|
|
934409
935078
|
${documentToWrite}`;
|
|
934410
935079
|
}
|
|
934411
|
-
await (0,
|
|
935080
|
+
await (0, import_promises177.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
934412
935081
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
934413
935082
|
}
|
|
934414
935083
|
function setSmartCasingFalseIfNotConfigured(generator, context3) {
|
|
@@ -934549,7 +935218,7 @@ ${source_default.dim(migration23.summary)}`
|
|
|
934549
935218
|
}
|
|
934550
935219
|
|
|
934551
935220
|
// src/commands/upgrade/upgrade.ts
|
|
934552
|
-
var
|
|
935221
|
+
var import_promises178 = require("fs/promises");
|
|
934553
935222
|
|
|
934554
935223
|
// src/cwd.ts
|
|
934555
935224
|
var FERN_CWD_ENV_VAR = "FERN_CWD";
|
|
@@ -934876,7 +935545,7 @@ async function upgrade({
|
|
|
934876
935545
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
934877
935546
|
draft.version = resolvedTargetVersion;
|
|
934878
935547
|
});
|
|
934879
|
-
await (0,
|
|
935548
|
+
await (0, import_promises178.writeFile)(
|
|
934880
935549
|
projectConfig2._absolutePath,
|
|
934881
935550
|
ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2))
|
|
934882
935551
|
);
|
|
@@ -934978,7 +935647,7 @@ async function validateDocsBrokenLinks({
|
|
|
934978
935647
|
}
|
|
934979
935648
|
|
|
934980
935649
|
// src/commands/validate/validateMdx.ts
|
|
934981
|
-
var
|
|
935650
|
+
var import_fs38 = require("fs");
|
|
934982
935651
|
var import_gray_matter10 = __toESM(require_gray_matter(), 1);
|
|
934983
935652
|
var import_path95 = __toESM(require("path"), 1);
|
|
934984
935653
|
function calculateVisualColumn(text9, charIndex, tabWidth = 4) {
|
|
@@ -935054,7 +935723,7 @@ async function validateMdxFiles({
|
|
|
935054
935723
|
});
|
|
935055
935724
|
const filesToCheck = Array.from(new Set(allPages));
|
|
935056
935725
|
for (const filepath of filesToCheck) {
|
|
935057
|
-
const content5 = (0,
|
|
935726
|
+
const content5 = (0, import_fs38.readFileSync)(filepath, "utf-8");
|
|
935058
935727
|
try {
|
|
935059
935728
|
parseMarkdownToTree(content5);
|
|
935060
935729
|
} catch (error50) {
|
|
@@ -935501,7 +936170,7 @@ async function validateWorkspaces({
|
|
|
935501
936170
|
|
|
935502
936171
|
// src/commands/write-definition/writeDefinitionForWorkspaces.ts
|
|
935503
936172
|
init_lib6();
|
|
935504
|
-
var
|
|
936173
|
+
var import_promises179 = require("fs/promises");
|
|
935505
936174
|
var import_path96 = __toESM(require("path"), 1);
|
|
935506
936175
|
async function writeDefinitionForWorkspaces({
|
|
935507
936176
|
project,
|
|
@@ -935582,28 +936251,28 @@ async function writeFernDefinition({
|
|
|
935582
936251
|
return a4.localeCompare(b7);
|
|
935583
936252
|
};
|
|
935584
936253
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
935585
|
-
await (0,
|
|
936254
|
+
await (0, import_promises179.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
935586
936255
|
}
|
|
935587
|
-
await (0,
|
|
935588
|
-
await (0,
|
|
936256
|
+
await (0, import_promises179.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
936257
|
+
await (0, import_promises179.writeFile)(
|
|
935589
936258
|
join8(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
935590
936259
|
jsYaml.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
935591
936260
|
);
|
|
935592
936261
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
935593
936262
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
935594
|
-
await (0,
|
|
935595
|
-
await (0,
|
|
936263
|
+
await (0, import_promises179.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
936264
|
+
await (0, import_promises179.writeFile)(absoluteFilepath, jsYaml.dump(packageMarker.contents, { sortKeys }));
|
|
935596
936265
|
}
|
|
935597
936266
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
935598
936267
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
935599
|
-
await (0,
|
|
935600
|
-
await (0,
|
|
936268
|
+
await (0, import_promises179.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
936269
|
+
await (0, import_promises179.writeFile)(absoluteFilepath, jsYaml.dump(definitionFile.contents, { sortKeys }));
|
|
935601
936270
|
}
|
|
935602
936271
|
}
|
|
935603
936272
|
|
|
935604
936273
|
// src/commands/write-docs-definition/writeDocsDefinitionForProject.ts
|
|
935605
936274
|
init_lib6();
|
|
935606
|
-
var
|
|
936275
|
+
var import_promises180 = require("fs/promises");
|
|
935607
936276
|
async function writeDocsDefinitionForProject({
|
|
935608
936277
|
project,
|
|
935609
936278
|
outputPath,
|
|
@@ -935635,7 +936304,7 @@ async function writeDocsDefinitionForProject({
|
|
|
935635
936304
|
targetAudiences: docsWorkspace.config.instances[0]?.audiences ? Array.isArray(docsWorkspace.config.instances[0].audiences) ? docsWorkspace.config.instances[0].audiences : [docsWorkspace.config.instances[0].audiences] : void 0
|
|
935636
936305
|
});
|
|
935637
936306
|
const docsDefinition = await docsResolver.resolve();
|
|
935638
|
-
await (0,
|
|
936307
|
+
await (0, import_promises180.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
935639
936308
|
context3.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
935640
936309
|
});
|
|
935641
936310
|
}
|
|
@@ -935643,8 +936312,8 @@ async function writeDocsDefinitionForProject({
|
|
|
935643
936312
|
// src/commands/write-translation/writeTranslationForProject.ts
|
|
935644
936313
|
init_lib6();
|
|
935645
936314
|
var import_cli_progress2 = __toESM(require_cli_progress(), 1);
|
|
935646
|
-
var
|
|
935647
|
-
var
|
|
936315
|
+
var import_fs41 = require("fs");
|
|
936316
|
+
var import_promises184 = require("fs/promises");
|
|
935648
936317
|
var import_is_ci3 = __toESM(require_is_ci(), 1);
|
|
935649
936318
|
var import_path99 = __toESM(require("path"), 1);
|
|
935650
936319
|
|
|
@@ -936137,7 +936806,7 @@ function shouldProcessFile(filePath, stub) {
|
|
|
936137
936806
|
|
|
936138
936807
|
// src/commands/write-translation/docs-config-utils.ts
|
|
936139
936808
|
init_lib6();
|
|
936140
|
-
var
|
|
936809
|
+
var import_promises181 = require("fs/promises");
|
|
936141
936810
|
|
|
936142
936811
|
// src/commands/write-translation/url-utils.ts
|
|
936143
936812
|
function addLanguageSuffixToUrl(url3, language) {
|
|
@@ -936294,7 +936963,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
936294
936963
|
stub = false
|
|
936295
936964
|
}) {
|
|
936296
936965
|
try {
|
|
936297
|
-
const originalConfigContent = await (0,
|
|
936966
|
+
const originalConfigContent = await (0, import_promises181.readFile)(originalDocsConfigPath, "utf-8");
|
|
936298
936967
|
const transformation = {
|
|
936299
936968
|
filePath: DOCS_CONFIGURATION_FILENAME,
|
|
936300
936969
|
language,
|
|
@@ -936308,7 +936977,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
936308
936977
|
const modifiedConfigContent = jsYaml.dump(modifiedConfig, {
|
|
936309
936978
|
sortKeys: false
|
|
936310
936979
|
});
|
|
936311
|
-
await (0,
|
|
936980
|
+
await (0, import_promises181.writeFile)(modifiedConfigPath, modifiedConfigContent, "utf-8");
|
|
936312
936981
|
context3.logger.debug(`Created language-specific docs config: ${modifiedConfigPath}`);
|
|
936313
936982
|
} catch (error50) {
|
|
936314
936983
|
if (error50 instanceof Error && error50.message.includes("403")) {
|
|
@@ -936320,19 +936989,19 @@ async function createLanguageSpecificDocsConfig({
|
|
|
936320
936989
|
|
|
936321
936990
|
// src/commands/write-translation/file-collection-utils.ts
|
|
936322
936991
|
init_lib6();
|
|
936323
|
-
var
|
|
936324
|
-
var
|
|
936992
|
+
var import_fs39 = require("fs");
|
|
936993
|
+
var import_promises182 = require("fs/promises");
|
|
936325
936994
|
var import_path97 = __toESM(require("path"), 1);
|
|
936326
936995
|
async function collectFiles(baseDirectory, relativeBase) {
|
|
936327
936996
|
const discoveredFiles = {};
|
|
936328
|
-
const entries23 = await (0,
|
|
936997
|
+
const entries23 = await (0, import_promises182.readdir)(baseDirectory);
|
|
936329
936998
|
for (const entry of entries23) {
|
|
936330
936999
|
if (entry === "translations") {
|
|
936331
937000
|
continue;
|
|
936332
937001
|
}
|
|
936333
937002
|
const fullPath = import_path97.default.join(baseDirectory, entry);
|
|
936334
937003
|
const relativePath = relativeBase ? join8(relativeBase, RelativeFilePath2.of(entry)) : RelativeFilePath2.of(entry);
|
|
936335
|
-
const stat7 = (0,
|
|
937004
|
+
const stat7 = (0, import_fs39.statSync)(fullPath);
|
|
936336
937005
|
if (stat7.isDirectory()) {
|
|
936337
937006
|
const subdirectoryFiles = await collectFiles(fullPath, relativePath);
|
|
936338
937007
|
for (const [subPath, subRelativePath] of Object.entries(subdirectoryFiles)) {
|
|
@@ -936347,19 +937016,19 @@ async function collectFiles(baseDirectory, relativeBase) {
|
|
|
936347
937016
|
|
|
936348
937017
|
// src/commands/write-translation/hash-utils.ts
|
|
936349
937018
|
var import_crypto13 = require("crypto");
|
|
936350
|
-
var
|
|
936351
|
-
var
|
|
937019
|
+
var import_fs40 = require("fs");
|
|
937020
|
+
var import_promises183 = require("fs/promises");
|
|
936352
937021
|
var import_path98 = __toESM(require("path"), 1);
|
|
936353
937022
|
function calculateContentHash(content5) {
|
|
936354
937023
|
return (0, import_crypto13.createHash)("sha256").update(content5, "utf-8").digest("hex");
|
|
936355
937024
|
}
|
|
936356
937025
|
async function loadHashMappings(translationsDirectory) {
|
|
936357
937026
|
const hashesFilePath = import_path98.default.join(translationsDirectory, "hashes");
|
|
936358
|
-
if (!(0,
|
|
937027
|
+
if (!(0, import_fs40.existsSync)(hashesFilePath)) {
|
|
936359
937028
|
return {};
|
|
936360
937029
|
}
|
|
936361
937030
|
try {
|
|
936362
|
-
const hashesContent = await (0,
|
|
937031
|
+
const hashesContent = await (0, import_promises183.readFile)(hashesFilePath, "utf-8");
|
|
936363
937032
|
const parsed = JSON.parse(hashesContent);
|
|
936364
937033
|
const { _comment, ...hashMappings } = parsed;
|
|
936365
937034
|
return hashMappings;
|
|
@@ -936380,11 +937049,11 @@ async function saveHashMappings(translationsDirectory, hashMappings) {
|
|
|
936380
937049
|
_comment: "This file is auto-generated by Fern to track source file changes for translation purposes. Do not edit manually - it will be overwritten on the next translation update.",
|
|
936381
937050
|
...sortedMappings
|
|
936382
937051
|
};
|
|
936383
|
-
await (0,
|
|
937052
|
+
await (0, import_promises183.writeFile)(hashesFilePath, JSON.stringify(fileContent, null, 2), "utf-8");
|
|
936384
937053
|
}
|
|
936385
937054
|
async function hasFileChanged(filePath, relativePath, previousHashes) {
|
|
936386
937055
|
try {
|
|
936387
|
-
const content5 = await (0,
|
|
937056
|
+
const content5 = await (0, import_promises183.readFile)(filePath, "utf-8");
|
|
936388
937057
|
const currentHash = calculateContentHash(content5);
|
|
936389
937058
|
const previousHash = previousHashes[relativePath];
|
|
936390
937059
|
return currentHash !== previousHash;
|
|
@@ -936438,22 +937107,22 @@ async function writeTranslationForProject({
|
|
|
936438
937107
|
code: CliError.Code.InternalError
|
|
936439
937108
|
});
|
|
936440
937109
|
}
|
|
936441
|
-
if (!(0,
|
|
937110
|
+
if (!(0, import_fs41.existsSync)(translationsDirectory)) {
|
|
936442
937111
|
context3.logger.debug(`Creating translations directory at: ${translationsDirectory}`);
|
|
936443
|
-
await (0,
|
|
937112
|
+
await (0, import_promises184.mkdir)(translationsDirectory, { recursive: true });
|
|
936444
937113
|
}
|
|
936445
937114
|
const languageStats = {};
|
|
936446
937115
|
const targetLanguages = languages.filter((lang) => lang !== sourceLanguage);
|
|
936447
937116
|
const originalDocsConfigPath = join8(fernDirectory, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME));
|
|
936448
|
-
const hasDocsConfig = (0,
|
|
937117
|
+
const hasDocsConfig = (0, import_fs41.existsSync)(originalDocsConfigPath);
|
|
936449
937118
|
for (const language of targetLanguages) {
|
|
936450
937119
|
const languageDirectory = join8(
|
|
936451
937120
|
translationsDirectory,
|
|
936452
937121
|
RelativeFilePath2.of(language),
|
|
936453
937122
|
RelativeFilePath2.of("fern")
|
|
936454
937123
|
);
|
|
936455
|
-
if (!(0,
|
|
936456
|
-
await (0,
|
|
937124
|
+
if (!(0, import_fs41.existsSync)(languageDirectory)) {
|
|
937125
|
+
await (0, import_promises184.mkdir)(languageDirectory, { recursive: true });
|
|
936457
937126
|
}
|
|
936458
937127
|
languageStats[language] = {
|
|
936459
937128
|
filesProcessed: 0,
|
|
@@ -936555,7 +937224,7 @@ async function writeTranslationForProject({
|
|
|
936555
937224
|
`[COMPLETED] ${DOCS_CONFIGURATION_FILENAME} -> ${language}/${DOCS_CONFIGURATION_FILENAME}`
|
|
936556
937225
|
);
|
|
936557
937226
|
}
|
|
936558
|
-
const originalConfigContent = await (0,
|
|
937227
|
+
const originalConfigContent = await (0, import_promises184.readFile)(originalDocsConfigPath, "utf-8");
|
|
936559
937228
|
await updateAndSaveHashForFile(
|
|
936560
937229
|
translationsDirectory,
|
|
936561
937230
|
hashMappings,
|
|
@@ -936600,7 +937269,7 @@ async function writeTranslationForProject({
|
|
|
936600
937269
|
continue;
|
|
936601
937270
|
}
|
|
936602
937271
|
cliContext.logger.debug(`[PROCESSING] ${relativePath} (detected changes)`);
|
|
936603
|
-
const originalContent = await (0,
|
|
937272
|
+
const originalContent = await (0, import_promises184.readFile)(filePath, "utf-8");
|
|
936604
937273
|
await updateAndSaveHashForFile(translationsDirectory, hashMappings, relativePath, originalContent);
|
|
936605
937274
|
const sourceStats = languageStats[sourceLanguage];
|
|
936606
937275
|
if (sourceStats) {
|
|
@@ -936624,8 +937293,8 @@ async function writeTranslationForProject({
|
|
|
936624
937293
|
);
|
|
936625
937294
|
const destPath = join8(languageDirectory, relativePath);
|
|
936626
937295
|
const destDir = import_path99.default.dirname(destPath);
|
|
936627
|
-
if (!(0,
|
|
936628
|
-
await (0,
|
|
937296
|
+
if (!(0, import_fs41.existsSync)(destDir)) {
|
|
937297
|
+
await (0, import_promises184.mkdir)(destDir, { recursive: true });
|
|
936629
937298
|
}
|
|
936630
937299
|
const transformation = {
|
|
936631
937300
|
filePath: relativePath,
|
|
@@ -936638,7 +937307,7 @@ async function writeTranslationForProject({
|
|
|
936638
937307
|
cliContext,
|
|
936639
937308
|
stub
|
|
936640
937309
|
});
|
|
936641
|
-
await (0,
|
|
937310
|
+
await (0, import_promises184.writeFile)(destPath, transformedContent, "utf-8");
|
|
936642
937311
|
const languageStatsForLang = languageStats[language];
|
|
936643
937312
|
if (languageStatsForLang) {
|
|
936644
937313
|
languageStatsForLang.filesProcessed++;
|
|
@@ -936668,10 +937337,10 @@ async function writeTranslationForProject({
|
|
|
936668
937337
|
);
|
|
936669
937338
|
const destPath = join8(languageDirectory, relativePath);
|
|
936670
937339
|
const destDir = import_path99.default.dirname(destPath);
|
|
936671
|
-
if (!(0,
|
|
936672
|
-
await (0,
|
|
937340
|
+
if (!(0, import_fs41.existsSync)(destDir)) {
|
|
937341
|
+
await (0, import_promises184.mkdir)(destDir, { recursive: true });
|
|
936673
937342
|
}
|
|
936674
|
-
await (0,
|
|
937343
|
+
await (0, import_promises184.copyFile)(filePath, destPath);
|
|
936675
937344
|
assetsCopied++;
|
|
936676
937345
|
cliContext.logger.debug(`[ASSET COPIED] ${relativePath} -> ${language}/${relativePath}`);
|
|
936677
937346
|
}
|
|
@@ -938812,13 +939481,13 @@ function addAutomationsGenerateCommand(cli, cliContext) {
|
|
|
938812
939481
|
// hidden
|
|
938813
939482
|
(yargs) => yargs.option("api", {
|
|
938814
939483
|
type: "string",
|
|
938815
|
-
description: "
|
|
939484
|
+
description: "Filter to a specific API in a multi-API repo (e.g. 'foo' for fern/apis/foo/). Omit to fan out across every API in the project."
|
|
938816
939485
|
}).option("group", {
|
|
938817
939486
|
type: "string",
|
|
938818
|
-
description: "
|
|
939487
|
+
description: "Filter to a specific generator group (e.g. 'sdk'). Omit to fan out across every group. The default-group field in generators.yml is intentionally ignored."
|
|
938819
939488
|
}).option("generator", {
|
|
938820
939489
|
type: "string",
|
|
938821
|
-
description: "Target a specific generator by 0-based index (e.g. '0', '1') or by name.
|
|
939490
|
+
description: "Target a specific generator by 0-based index (e.g. '0', '1') or by name. When targeting an opted-out generator by index, the command rejects with an error rather than silently skipping. Omit to fan out across every eligible generator in the selected APIs and groups."
|
|
938822
939491
|
}).option("version", {
|
|
938823
939492
|
type: "string",
|
|
938824
939493
|
description: "Version for generated packages. Use 'AUTO' for AI-based semantic versioning that analyzes the diff and determines MAJOR/MINOR/PATCH automatically."
|
|
@@ -938826,39 +939495,21 @@ function addAutomationsGenerateCommand(cli, cliContext) {
|
|
|
938826
939495
|
boolean: true,
|
|
938827
939496
|
default: false,
|
|
938828
939497
|
description: "Enable GitHub automerge on generated PRs. Automerge is skipped when breaking changes (MAJOR bump) are detected, regardless of this flag."
|
|
939498
|
+
}).option("json-file-output", {
|
|
939499
|
+
type: "string",
|
|
939500
|
+
description: "Write a JSON summary of per-generator results to the given path. CI-neutral companion to the markdown summary auto-written to $GITHUB_STEP_SUMMARY."
|
|
938829
939501
|
}),
|
|
938830
939502
|
async (argv) => {
|
|
938831
|
-
|
|
938832
|
-
|
|
938833
|
-
|
|
938834
|
-
|
|
938835
|
-
|
|
938836
|
-
|
|
938837
|
-
}),
|
|
938838
|
-
cliContext,
|
|
939503
|
+
await executeAutomationsGenerate({
|
|
939504
|
+
cliContext,
|
|
939505
|
+
options: {
|
|
939506
|
+
api: argv.api,
|
|
939507
|
+
group: argv.group,
|
|
939508
|
+
generator: argv.generator,
|
|
938839
939509
|
version: argv.version,
|
|
938840
|
-
|
|
938841
|
-
|
|
938842
|
-
|
|
938843
|
-
shouldLogS3Url: false,
|
|
938844
|
-
keepDocker: false,
|
|
938845
|
-
useLocalDocker: false,
|
|
938846
|
-
preview: false,
|
|
938847
|
-
mode: void 0,
|
|
938848
|
-
force: true,
|
|
938849
|
-
runner: void 0,
|
|
938850
|
-
inspect: false,
|
|
938851
|
-
lfsOverride: void 0,
|
|
938852
|
-
fernignorePath: void 0,
|
|
938853
|
-
skipFernignore: false,
|
|
938854
|
-
dynamicIrOnly: false,
|
|
938855
|
-
outputDir: void 0,
|
|
938856
|
-
noReplay: false,
|
|
938857
|
-
retryRateLimited: false,
|
|
938858
|
-
requireEnvVars: false,
|
|
938859
|
-
automationMode: true,
|
|
938860
|
-
autoMerge: argv["auto-merge"]
|
|
938861
|
-
});
|
|
939510
|
+
autoMerge: argv["auto-merge"],
|
|
939511
|
+
jsonOutputPath: argv["json-file-output"]
|
|
939512
|
+
}
|
|
938862
939513
|
});
|
|
938863
939514
|
}
|
|
938864
939515
|
);
|