@fern-api/generator-cli 0.9.41 → 0.9.43
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/dist/cli.js +208 -192
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3817,10 +3817,10 @@ var init_esm3 = __esm({
|
|
|
3817
3817
|
}
|
|
3818
3818
|
return filtered.join("/");
|
|
3819
3819
|
}).join("|");
|
|
3820
|
-
const [
|
|
3821
|
-
re = "^" +
|
|
3820
|
+
const [open2, close] = set2.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
3821
|
+
re = "^" + open2 + re + close + "$";
|
|
3822
3822
|
if (this.partial) {
|
|
3823
|
-
re = "^(?:\\/|" +
|
|
3823
|
+
re = "^(?:\\/|" + open2 + re.slice(1, -1) + close + ")$";
|
|
3824
3824
|
}
|
|
3825
3825
|
if (this.negate)
|
|
3826
3826
|
re = "^(?!" + re + ").+$";
|
|
@@ -9605,12 +9605,12 @@ var require_src2 = __commonJS({
|
|
|
9605
9605
|
function check(path5, isFile, isDirectory) {
|
|
9606
9606
|
log(`checking %s`, path5);
|
|
9607
9607
|
try {
|
|
9608
|
-
const
|
|
9609
|
-
if (
|
|
9608
|
+
const stat = fs_1.statSync(path5);
|
|
9609
|
+
if (stat.isFile() && isFile) {
|
|
9610
9610
|
log(`[OK] path represents a file`);
|
|
9611
9611
|
return true;
|
|
9612
9612
|
}
|
|
9613
|
-
if (
|
|
9613
|
+
if (stat.isDirectory() && isDirectory) {
|
|
9614
9614
|
log(`[OK] path represents a directory`);
|
|
9615
9615
|
return true;
|
|
9616
9616
|
}
|
|
@@ -27684,8 +27684,8 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
|
|
|
27684
27684
|
return null;
|
|
27685
27685
|
}
|
|
27686
27686
|
try {
|
|
27687
|
-
const
|
|
27688
|
-
if (
|
|
27687
|
+
const stat = (0, import_fs9.statSync)(fullPath);
|
|
27688
|
+
if (stat.isDirectory()) {
|
|
27689
27689
|
return null;
|
|
27690
27690
|
}
|
|
27691
27691
|
return (0, import_fs9.readFileSync)(fullPath, "utf-8");
|
|
@@ -27801,15 +27801,15 @@ var require_windows = __commonJS({
|
|
|
27801
27801
|
}
|
|
27802
27802
|
return false;
|
|
27803
27803
|
}
|
|
27804
|
-
function checkStat(
|
|
27805
|
-
if (!
|
|
27804
|
+
function checkStat(stat, path5, options) {
|
|
27805
|
+
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
27806
27806
|
return false;
|
|
27807
27807
|
}
|
|
27808
27808
|
return checkPathExt(path5, options);
|
|
27809
27809
|
}
|
|
27810
27810
|
function isexe(path5, options, cb) {
|
|
27811
|
-
fs3.stat(path5, function(er,
|
|
27812
|
-
cb(er, er ? false : checkStat(
|
|
27811
|
+
fs3.stat(path5, function(er, stat) {
|
|
27812
|
+
cb(er, er ? false : checkStat(stat, path5, options));
|
|
27813
27813
|
});
|
|
27814
27814
|
}
|
|
27815
27815
|
function sync(path5, options) {
|
|
@@ -27826,20 +27826,20 @@ var require_mode = __commonJS({
|
|
|
27826
27826
|
isexe.sync = sync;
|
|
27827
27827
|
var fs3 = require("fs");
|
|
27828
27828
|
function isexe(path5, options, cb) {
|
|
27829
|
-
fs3.stat(path5, function(er,
|
|
27830
|
-
cb(er, er ? false : checkStat(
|
|
27829
|
+
fs3.stat(path5, function(er, stat) {
|
|
27830
|
+
cb(er, er ? false : checkStat(stat, options));
|
|
27831
27831
|
});
|
|
27832
27832
|
}
|
|
27833
27833
|
function sync(path5, options) {
|
|
27834
27834
|
return checkStat(fs3.statSync(path5), options);
|
|
27835
27835
|
}
|
|
27836
|
-
function checkStat(
|
|
27837
|
-
return
|
|
27836
|
+
function checkStat(stat, options) {
|
|
27837
|
+
return stat.isFile() && checkMode(stat, options);
|
|
27838
27838
|
}
|
|
27839
|
-
function checkMode(
|
|
27840
|
-
var mod =
|
|
27841
|
-
var uid =
|
|
27842
|
-
var gid =
|
|
27839
|
+
function checkMode(stat, options) {
|
|
27840
|
+
var mod = stat.mode;
|
|
27841
|
+
var uid = stat.uid;
|
|
27842
|
+
var gid = stat.gid;
|
|
27843
27843
|
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
27844
27844
|
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
27845
27845
|
var u = parseInt("100", 8);
|
|
@@ -30339,11 +30339,11 @@ function cwd() {
|
|
|
30339
30339
|
var import_promises = require("fs/promises");
|
|
30340
30340
|
async function doesPathExist(filepath, mode) {
|
|
30341
30341
|
try {
|
|
30342
|
-
const
|
|
30343
|
-
if (mode === "file" && !
|
|
30342
|
+
const stat = await (0, import_promises.lstat)(filepath);
|
|
30343
|
+
if (mode === "file" && !stat.isFile()) {
|
|
30344
30344
|
return false;
|
|
30345
30345
|
}
|
|
30346
|
-
if (mode === "directory" && !
|
|
30346
|
+
if (mode === "directory" && !stat.isDirectory()) {
|
|
30347
30347
|
return false;
|
|
30348
30348
|
}
|
|
30349
30349
|
return true;
|
|
@@ -40448,7 +40448,7 @@ var consolePipelineLogger = {
|
|
|
40448
40448
|
};
|
|
40449
40449
|
|
|
40450
40450
|
// src/pipeline/PostGenerationPipeline.ts
|
|
40451
|
-
var
|
|
40451
|
+
var import_child_process7 = require("child_process");
|
|
40452
40452
|
|
|
40453
40453
|
// src/pipeline/github/constants.ts
|
|
40454
40454
|
var FERN_BOT_NAME2 = "fern-api";
|
|
@@ -40516,132 +40516,6 @@ async function loggingExeca(logger, executable, args = [], { doNotPipeOutput = f
|
|
|
40516
40516
|
return result;
|
|
40517
40517
|
}
|
|
40518
40518
|
|
|
40519
|
-
// ../cli/task-context/lib/CliError.js
|
|
40520
|
-
var CliError = class _CliError extends Error {
|
|
40521
|
-
code;
|
|
40522
|
-
docsLink;
|
|
40523
|
-
constructor({ message, code, docsLink }) {
|
|
40524
|
-
super(message);
|
|
40525
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
40526
|
-
if (Error.captureStackTrace) {
|
|
40527
|
-
Error.captureStackTrace(this, this.constructor);
|
|
40528
|
-
}
|
|
40529
|
-
this.name = "CliError";
|
|
40530
|
-
this.code = code;
|
|
40531
|
-
this.docsLink = docsLink;
|
|
40532
|
-
}
|
|
40533
|
-
static authRequired(message) {
|
|
40534
|
-
return new _CliError({
|
|
40535
|
-
message: message ?? "Authentication required. Please run 'fern login' or set the FERN_TOKEN environment variable.",
|
|
40536
|
-
code: _CliError.Code.AuthError
|
|
40537
|
-
});
|
|
40538
|
-
}
|
|
40539
|
-
static unauthorized(message) {
|
|
40540
|
-
return new _CliError({
|
|
40541
|
-
message: message ?? "Unauthorized. Please run 'fern auth login' or set the FERN_TOKEN environment variable.",
|
|
40542
|
-
code: _CliError.Code.AuthError
|
|
40543
|
-
});
|
|
40544
|
-
}
|
|
40545
|
-
static notFound(message) {
|
|
40546
|
-
return new _CliError({ message, code: _CliError.Code.ConfigError });
|
|
40547
|
-
}
|
|
40548
|
-
static badRequest(message) {
|
|
40549
|
-
return new _CliError({ message, code: _CliError.Code.NetworkError });
|
|
40550
|
-
}
|
|
40551
|
-
static validationError(message) {
|
|
40552
|
-
return new _CliError({ message, code: _CliError.Code.ValidationError });
|
|
40553
|
-
}
|
|
40554
|
-
static internalError(message) {
|
|
40555
|
-
return new _CliError({ message, code: _CliError.Code.InternalError });
|
|
40556
|
-
}
|
|
40557
|
-
};
|
|
40558
|
-
(function(CliError2) {
|
|
40559
|
-
CliError2.Code = {
|
|
40560
|
-
InternalError: "INTERNAL_ERROR",
|
|
40561
|
-
ResolutionError: "RESOLUTION_ERROR",
|
|
40562
|
-
IrConversionError: "IR_CONVERSION_ERROR",
|
|
40563
|
-
ContainerError: "CONTAINER_ERROR",
|
|
40564
|
-
VersionError: "VERSION_ERROR",
|
|
40565
|
-
ParseError: "PARSE_ERROR",
|
|
40566
|
-
EnvironmentError: "ENVIRONMENT_ERROR",
|
|
40567
|
-
ReferenceError: "REFERENCE_ERROR",
|
|
40568
|
-
ValidationError: "VALIDATION_ERROR",
|
|
40569
|
-
NetworkError: "NETWORK_ERROR",
|
|
40570
|
-
AuthError: "AUTH_ERROR",
|
|
40571
|
-
ConfigError: "CONFIG_ERROR",
|
|
40572
|
-
UserError: "USER_ERROR"
|
|
40573
|
-
};
|
|
40574
|
-
})(CliError || (CliError = {}));
|
|
40575
|
-
var SENTRY_REPORTABLE = {
|
|
40576
|
-
[CliError.Code.InternalError]: true,
|
|
40577
|
-
[CliError.Code.ResolutionError]: true,
|
|
40578
|
-
[CliError.Code.IrConversionError]: true,
|
|
40579
|
-
[CliError.Code.ContainerError]: false,
|
|
40580
|
-
[CliError.Code.VersionError]: false,
|
|
40581
|
-
[CliError.Code.ParseError]: false,
|
|
40582
|
-
[CliError.Code.EnvironmentError]: false,
|
|
40583
|
-
[CliError.Code.ReferenceError]: false,
|
|
40584
|
-
[CliError.Code.ValidationError]: false,
|
|
40585
|
-
[CliError.Code.NetworkError]: false,
|
|
40586
|
-
[CliError.Code.AuthError]: false,
|
|
40587
|
-
[CliError.Code.ConfigError]: false,
|
|
40588
|
-
[CliError.Code.UserError]: false
|
|
40589
|
-
};
|
|
40590
|
-
|
|
40591
|
-
// ../cli/logger/lib/LogLevel.js
|
|
40592
|
-
var LogLevel2 = {
|
|
40593
|
-
Trace: "trace",
|
|
40594
|
-
Debug: "debug",
|
|
40595
|
-
Info: "info",
|
|
40596
|
-
Warn: "warn",
|
|
40597
|
-
Error: "error"
|
|
40598
|
-
};
|
|
40599
|
-
var LOG_LEVELS = Object.values(LogLevel2);
|
|
40600
|
-
|
|
40601
|
-
// ../cli/logger/lib/createLogger.js
|
|
40602
|
-
var LoggerImpl = class {
|
|
40603
|
-
log;
|
|
40604
|
-
enabled;
|
|
40605
|
-
constructor(log, enabled = true) {
|
|
40606
|
-
this.log = log;
|
|
40607
|
-
this.enabled = enabled;
|
|
40608
|
-
}
|
|
40609
|
-
disable() {
|
|
40610
|
-
this.enabled = false;
|
|
40611
|
-
}
|
|
40612
|
-
enable() {
|
|
40613
|
-
this.enabled = true;
|
|
40614
|
-
}
|
|
40615
|
-
debug(...args) {
|
|
40616
|
-
if (this.enabled) {
|
|
40617
|
-
this.log(LogLevel2.Debug, ...args);
|
|
40618
|
-
}
|
|
40619
|
-
}
|
|
40620
|
-
info(...args) {
|
|
40621
|
-
if (this.enabled) {
|
|
40622
|
-
this.log(LogLevel2.Info, ...args);
|
|
40623
|
-
}
|
|
40624
|
-
}
|
|
40625
|
-
warn(...args) {
|
|
40626
|
-
if (this.enabled) {
|
|
40627
|
-
this.log(LogLevel2.Warn, ...args);
|
|
40628
|
-
}
|
|
40629
|
-
}
|
|
40630
|
-
error(...args) {
|
|
40631
|
-
if (this.enabled) {
|
|
40632
|
-
this.log(LogLevel2.Error, ...args);
|
|
40633
|
-
}
|
|
40634
|
-
}
|
|
40635
|
-
trace(...args) {
|
|
40636
|
-
if (this.enabled) {
|
|
40637
|
-
this.log(LogLevel2.Trace, ...args);
|
|
40638
|
-
}
|
|
40639
|
-
}
|
|
40640
|
-
};
|
|
40641
|
-
function createLogger4(log) {
|
|
40642
|
-
return new LoggerImpl(log);
|
|
40643
|
-
}
|
|
40644
|
-
|
|
40645
40519
|
// src/autoversion/AutoVersioningService.ts
|
|
40646
40520
|
var import_fs14 = require("fs");
|
|
40647
40521
|
var import_promises14 = require("fs/promises");
|
|
@@ -40683,6 +40557,43 @@ function countFilesInDiff(diffContent) {
|
|
|
40683
40557
|
function formatSizeKB(charLength) {
|
|
40684
40558
|
return (charLength / 1024).toFixed(1);
|
|
40685
40559
|
}
|
|
40560
|
+
var EXCLUDED_DIRECTORIES = /* @__PURE__ */ new Set([
|
|
40561
|
+
// Version control
|
|
40562
|
+
".git",
|
|
40563
|
+
// Dependency directories
|
|
40564
|
+
"vendor",
|
|
40565
|
+
"node_modules",
|
|
40566
|
+
"Pods",
|
|
40567
|
+
// Python environments and caches
|
|
40568
|
+
".venv",
|
|
40569
|
+
"venv",
|
|
40570
|
+
"__pycache__",
|
|
40571
|
+
".tox",
|
|
40572
|
+
".mypy_cache",
|
|
40573
|
+
".pytest_cache",
|
|
40574
|
+
".ruff_cache",
|
|
40575
|
+
// Build output directories
|
|
40576
|
+
"build",
|
|
40577
|
+
"dist",
|
|
40578
|
+
"out",
|
|
40579
|
+
"target",
|
|
40580
|
+
"bin",
|
|
40581
|
+
"obj",
|
|
40582
|
+
// Build tool caches
|
|
40583
|
+
".gradle",
|
|
40584
|
+
".mvn",
|
|
40585
|
+
// Framework build caches
|
|
40586
|
+
".next",
|
|
40587
|
+
".nuxt",
|
|
40588
|
+
".cache",
|
|
40589
|
+
// IDE directories
|
|
40590
|
+
".idea",
|
|
40591
|
+
".vscode",
|
|
40592
|
+
".eclipse",
|
|
40593
|
+
// Language-specific tool caches
|
|
40594
|
+
".dart_tool",
|
|
40595
|
+
".swiftpm"
|
|
40596
|
+
]);
|
|
40686
40597
|
var EXCLUDED_FILE_PATTERNS = [
|
|
40687
40598
|
// Documentation / generated reference
|
|
40688
40599
|
/(?:^|\/)reference\.md$/i,
|
|
@@ -41292,34 +41203,37 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
41292
41203
|
*/
|
|
41293
41204
|
async replaceMagicVersion(workingDirectory, mappedMagicVersion, finalVersion) {
|
|
41294
41205
|
this.logger.debug(`Replacing placeholder version ${mappedMagicVersion} with final version: ${finalVersion}`);
|
|
41295
|
-
const
|
|
41296
|
-
|
|
41297
|
-
|
|
41298
|
-
|
|
41299
|
-
|
|
41300
|
-
|
|
41301
|
-
|
|
41302
|
-
|
|
41303
|
-
|
|
41304
|
-
|
|
41305
|
-
|
|
41306
|
-
|
|
41307
|
-
|
|
41308
|
-
|
|
41309
|
-
|
|
41310
|
-
}
|
|
41206
|
+
const files = await this.walkDirectory(workingDirectory, () => true);
|
|
41207
|
+
const replaceInFile = async (filePath) => {
|
|
41208
|
+
if (await this.isBinaryFile(filePath)) {
|
|
41209
|
+
return false;
|
|
41210
|
+
}
|
|
41211
|
+
const content = await (0, import_promises14.readFile)(filePath, "utf-8");
|
|
41212
|
+
if (!content.includes(mappedMagicVersion)) {
|
|
41213
|
+
return false;
|
|
41214
|
+
}
|
|
41215
|
+
const updated = content.split(mappedMagicVersion).join(finalVersion);
|
|
41216
|
+
await (0, import_promises14.writeFile)(filePath, updated, "utf-8");
|
|
41217
|
+
return true;
|
|
41218
|
+
};
|
|
41219
|
+
const results = await this.processInParallel(files, replaceInFile);
|
|
41220
|
+
const replacedCount = results.filter(Boolean).length;
|
|
41221
|
+
this.logger.debug(`Placeholder version replaced successfully in ${replacedCount} file(s)`);
|
|
41222
|
+
}
|
|
41223
|
+
async isBinaryFile(filePath) {
|
|
41224
|
+
const fileHandle = await (0, import_promises14.open)(filePath, "r");
|
|
41311
41225
|
try {
|
|
41312
|
-
|
|
41313
|
-
|
|
41314
|
-
|
|
41315
|
-
|
|
41316
|
-
|
|
41317
|
-
|
|
41318
|
-
|
|
41319
|
-
|
|
41320
|
-
|
|
41226
|
+
const header = Buffer.alloc(8192);
|
|
41227
|
+
const { bytesRead } = await fileHandle.read(header, 0, 8192, 0);
|
|
41228
|
+
for (let i2 = 0; i2 < bytesRead; i2++) {
|
|
41229
|
+
if (header[i2] === 0) {
|
|
41230
|
+
return true;
|
|
41231
|
+
}
|
|
41232
|
+
}
|
|
41233
|
+
return false;
|
|
41234
|
+
} finally {
|
|
41235
|
+
await fileHandle.close();
|
|
41321
41236
|
}
|
|
41322
|
-
this.logger.debug("Placeholder version replaced successfully");
|
|
41323
41237
|
}
|
|
41324
41238
|
/**
|
|
41325
41239
|
* Adds /vN suffix to Go module paths and import statements when the computed
|
|
@@ -41410,9 +41324,12 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
41410
41324
|
const entries2 = await (0, import_promises14.readdir)(dir);
|
|
41411
41325
|
for (const entry of entries2) {
|
|
41412
41326
|
const fullPath = (0, import_path22.join)(dir, entry);
|
|
41413
|
-
const entryStat = await (0, import_promises14.
|
|
41327
|
+
const entryStat = await (0, import_promises14.lstat)(fullPath);
|
|
41328
|
+
if (entryStat.isSymbolicLink()) {
|
|
41329
|
+
continue;
|
|
41330
|
+
}
|
|
41414
41331
|
if (entryStat.isDirectory()) {
|
|
41415
|
-
if (
|
|
41332
|
+
if (EXCLUDED_DIRECTORIES.has(entry)) {
|
|
41416
41333
|
continue;
|
|
41417
41334
|
}
|
|
41418
41335
|
const subResults = await this.walkDirectory(fullPath, filter2);
|
|
@@ -41423,14 +41340,22 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
41423
41340
|
}
|
|
41424
41341
|
return results;
|
|
41425
41342
|
}
|
|
41343
|
+
static CONCURRENCY_LIMIT = 32;
|
|
41344
|
+
async processInParallel(items, fn) {
|
|
41345
|
+
const results = [];
|
|
41346
|
+
for (let i2 = 0; i2 < items.length; i2 += _AutoVersioningService.CONCURRENCY_LIMIT) {
|
|
41347
|
+
const batch = items.slice(i2, i2 + _AutoVersioningService.CONCURRENCY_LIMIT);
|
|
41348
|
+
const batchResults = await Promise.all(batch.map(fn));
|
|
41349
|
+
results.push(...batchResults);
|
|
41350
|
+
}
|
|
41351
|
+
return results;
|
|
41352
|
+
}
|
|
41426
41353
|
/**
|
|
41427
41354
|
* Adds a version suffix to import paths in all .go files in the repository.
|
|
41428
41355
|
*/
|
|
41429
41356
|
async addSuffixToGoFiles(repoRoot, modulePath, suffix) {
|
|
41430
41357
|
const goFiles = await this.walkDirectory(repoRoot, (filePath) => (0, import_path22.extname)(filePath) === ".go");
|
|
41431
|
-
|
|
41432
|
-
await this.addSuffixToGoFile(filePath, modulePath, suffix);
|
|
41433
|
-
}
|
|
41358
|
+
await this.processInParallel(goFiles, (filePath) => this.addSuffixToGoFile(filePath, modulePath, suffix));
|
|
41434
41359
|
}
|
|
41435
41360
|
/**
|
|
41436
41361
|
* Adds a version suffix to import paths in a single .go file.
|
|
@@ -41470,12 +41395,6 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
41470
41395
|
this.logger.debug(`Updated Go imports in ${filePath}`);
|
|
41471
41396
|
}
|
|
41472
41397
|
}
|
|
41473
|
-
/**
|
|
41474
|
-
* Escapes special characters for use in sed command.
|
|
41475
|
-
*/
|
|
41476
|
-
escapeForSed(str) {
|
|
41477
|
-
return str.replace(/[/&]/g, "\\$&");
|
|
41478
|
-
}
|
|
41479
41398
|
/**
|
|
41480
41399
|
* Extracts the file path from a diff file section.
|
|
41481
41400
|
* Parses the "diff --git a/path b/path" header line.
|
|
@@ -41627,7 +41546,7 @@ var AutoVersionStep = class extends BaseStep {
|
|
|
41627
41546
|
const { service, language, mappedMagicVersion, commit } = params;
|
|
41628
41547
|
const initialVersion = this.config.baseVersion ?? (mappedMagicVersion.startsWith("v") ? "v0.0.1" : "0.0.1");
|
|
41629
41548
|
if (!isValidSemver(initialVersion)) {
|
|
41630
|
-
const errorMessage = `AutoVersionStep: baseVersion ${JSON.stringify(initialVersion)} is not a valid semver string (expected e.g. "1.2.3" or "v1.2.3"). Refusing to run
|
|
41549
|
+
const errorMessage = `AutoVersionStep: baseVersion ${JSON.stringify(initialVersion)} is not a valid semver string (expected e.g. "1.2.3" or "v1.2.3"). Refusing to run.`;
|
|
41631
41550
|
this.logger.error(errorMessage);
|
|
41632
41551
|
return {
|
|
41633
41552
|
executed: true,
|
|
@@ -43200,6 +43119,7 @@ function resolveBranchAction({
|
|
|
43200
43119
|
}
|
|
43201
43120
|
|
|
43202
43121
|
// src/pipeline/steps/ReplayStep.ts
|
|
43122
|
+
var import_child_process6 = require("child_process");
|
|
43203
43123
|
var ReplayStep = class extends BaseStep {
|
|
43204
43124
|
constructor(outputDir, logger, config, cliVersion, generatorVersions) {
|
|
43205
43125
|
super(outputDir, logger);
|
|
@@ -43240,17 +43160,21 @@ var ReplayStep = class extends BaseStep {
|
|
|
43240
43160
|
patchesWithConflicts: 0
|
|
43241
43161
|
};
|
|
43242
43162
|
}
|
|
43163
|
+
const stageOnly = this.config.stageOnly ?? false;
|
|
43243
43164
|
const result = prepared != null ? await replayApply(prepared, {
|
|
43244
|
-
stageOnly
|
|
43165
|
+
stageOnly,
|
|
43245
43166
|
logger: this.logger
|
|
43246
43167
|
}) : await replayRun({
|
|
43247
43168
|
outputDir: this.outputDir,
|
|
43248
43169
|
cliVersion: this.cliVersion,
|
|
43249
43170
|
generatorVersions: this.generatorVersions,
|
|
43250
|
-
stageOnly
|
|
43171
|
+
stageOnly,
|
|
43251
43172
|
skipApplication: this.config.skipApplication,
|
|
43252
43173
|
logger: this.logger
|
|
43253
43174
|
});
|
|
43175
|
+
if (!stageOnly) {
|
|
43176
|
+
this.commitLockfileIfUncommitted();
|
|
43177
|
+
}
|
|
43254
43178
|
if (result.failureReason != null) {
|
|
43255
43179
|
return {
|
|
43256
43180
|
executed: true,
|
|
@@ -43314,6 +43238,44 @@ var ReplayStep = class extends BaseStep {
|
|
|
43314
43238
|
warnings: report.warnings
|
|
43315
43239
|
};
|
|
43316
43240
|
}
|
|
43241
|
+
/**
|
|
43242
|
+
* Commits `.fern/replay.lock` when replay saved the lockfile to disk but
|
|
43243
|
+
* didn't create a `[fern-replay]` commit (e.g. no-patches flow with zero
|
|
43244
|
+
* new patches). Without this, `skipCommit = true` in GithubStep drops the
|
|
43245
|
+
* lockfile advance, freezing `previousGenerationSha` across runs.
|
|
43246
|
+
*/
|
|
43247
|
+
commitLockfileIfUncommitted() {
|
|
43248
|
+
try {
|
|
43249
|
+
const status2 = (0, import_child_process6.execFileSync)("git", ["status", "--porcelain", "--", ".fern/replay.lock"], {
|
|
43250
|
+
cwd: this.outputDir,
|
|
43251
|
+
encoding: "utf-8",
|
|
43252
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
43253
|
+
}).trim();
|
|
43254
|
+
if (status2.length === 0) {
|
|
43255
|
+
return;
|
|
43256
|
+
}
|
|
43257
|
+
(0, import_child_process6.execFileSync)("git", ["add", "--", ".fern/replay.lock"], {
|
|
43258
|
+
cwd: this.outputDir,
|
|
43259
|
+
stdio: "pipe"
|
|
43260
|
+
});
|
|
43261
|
+
(0, import_child_process6.execFileSync)(
|
|
43262
|
+
"git",
|
|
43263
|
+
[
|
|
43264
|
+
"-c",
|
|
43265
|
+
`user.name=${FERN_BOT_NAME2}`,
|
|
43266
|
+
"-c",
|
|
43267
|
+
`user.email=${FERN_BOT_EMAIL2}`,
|
|
43268
|
+
"commit",
|
|
43269
|
+
"-m",
|
|
43270
|
+
"[fern-replay] advance lockfile"
|
|
43271
|
+
],
|
|
43272
|
+
{ cwd: this.outputDir, stdio: "pipe" }
|
|
43273
|
+
);
|
|
43274
|
+
this.logger.debug("ReplayStep: committed uncommitted lockfile advance.");
|
|
43275
|
+
} catch (error) {
|
|
43276
|
+
this.logger.debug("ReplayStep: failed to commit lockfile advance: " + String(error));
|
|
43277
|
+
}
|
|
43278
|
+
}
|
|
43317
43279
|
};
|
|
43318
43280
|
|
|
43319
43281
|
// ../cli/generation/local-generation/docker-utils/lib/runDocker.js
|
|
@@ -43396,6 +43358,60 @@ async function stopContainer({ logger, containerId, runner }) {
|
|
|
43396
43358
|
});
|
|
43397
43359
|
}
|
|
43398
43360
|
|
|
43361
|
+
// ../cli/logger/lib/LogLevel.js
|
|
43362
|
+
var LogLevel2 = {
|
|
43363
|
+
Trace: "trace",
|
|
43364
|
+
Debug: "debug",
|
|
43365
|
+
Info: "info",
|
|
43366
|
+
Warn: "warn",
|
|
43367
|
+
Error: "error"
|
|
43368
|
+
};
|
|
43369
|
+
var LOG_LEVELS = Object.values(LogLevel2);
|
|
43370
|
+
|
|
43371
|
+
// ../cli/logger/lib/createLogger.js
|
|
43372
|
+
var LoggerImpl = class {
|
|
43373
|
+
log;
|
|
43374
|
+
enabled;
|
|
43375
|
+
constructor(log, enabled = true) {
|
|
43376
|
+
this.log = log;
|
|
43377
|
+
this.enabled = enabled;
|
|
43378
|
+
}
|
|
43379
|
+
disable() {
|
|
43380
|
+
this.enabled = false;
|
|
43381
|
+
}
|
|
43382
|
+
enable() {
|
|
43383
|
+
this.enabled = true;
|
|
43384
|
+
}
|
|
43385
|
+
debug(...args) {
|
|
43386
|
+
if (this.enabled) {
|
|
43387
|
+
this.log(LogLevel2.Debug, ...args);
|
|
43388
|
+
}
|
|
43389
|
+
}
|
|
43390
|
+
info(...args) {
|
|
43391
|
+
if (this.enabled) {
|
|
43392
|
+
this.log(LogLevel2.Info, ...args);
|
|
43393
|
+
}
|
|
43394
|
+
}
|
|
43395
|
+
warn(...args) {
|
|
43396
|
+
if (this.enabled) {
|
|
43397
|
+
this.log(LogLevel2.Warn, ...args);
|
|
43398
|
+
}
|
|
43399
|
+
}
|
|
43400
|
+
error(...args) {
|
|
43401
|
+
if (this.enabled) {
|
|
43402
|
+
this.log(LogLevel2.Error, ...args);
|
|
43403
|
+
}
|
|
43404
|
+
}
|
|
43405
|
+
trace(...args) {
|
|
43406
|
+
if (this.enabled) {
|
|
43407
|
+
this.log(LogLevel2.Trace, ...args);
|
|
43408
|
+
}
|
|
43409
|
+
}
|
|
43410
|
+
};
|
|
43411
|
+
function createLogger4(log) {
|
|
43412
|
+
return new LoggerImpl(log);
|
|
43413
|
+
}
|
|
43414
|
+
|
|
43399
43415
|
// src/pipeline/steps/VerificationStep.ts
|
|
43400
43416
|
var import_fs16 = require("fs");
|
|
43401
43417
|
var import_path25 = require("path");
|
|
@@ -43594,8 +43610,8 @@ var PostGenerationPipeline = class {
|
|
|
43594
43610
|
async run() {
|
|
43595
43611
|
if (this.config.github?.enabled) {
|
|
43596
43612
|
try {
|
|
43597
|
-
(0,
|
|
43598
|
-
(0,
|
|
43613
|
+
(0, import_child_process7.execFileSync)("git", ["config", "user.name", FERN_BOT_NAME2], { cwd: this.config.outputDir });
|
|
43614
|
+
(0, import_child_process7.execFileSync)("git", ["config", "user.email", FERN_BOT_EMAIL2], { cwd: this.config.outputDir });
|
|
43599
43615
|
} catch {
|
|
43600
43616
|
}
|
|
43601
43617
|
}
|