@fern-api/fern-api-dev 5.89.4 → 5.89.6
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 +277 -44
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -100959,8 +100959,8 @@ var require_graceful_fs = __commonJS({
|
|
|
100959
100959
|
}
|
|
100960
100960
|
}
|
|
100961
100961
|
var fs$writeFile = fs35.writeFile;
|
|
100962
|
-
fs35.writeFile =
|
|
100963
|
-
function
|
|
100962
|
+
fs35.writeFile = writeFile103;
|
|
100963
|
+
function writeFile103(path120, data2, options2, cb) {
|
|
100964
100964
|
if (typeof options2 === "function")
|
|
100965
100965
|
cb = options2, options2 = null;
|
|
100966
100966
|
return go$writeFile(path120, data2, options2, cb);
|
|
@@ -460369,13 +460369,13 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context3 }) {
|
|
|
460369
460369
|
}
|
|
460370
460370
|
}
|
|
460371
460371
|
}
|
|
460372
|
-
const { writeFile:
|
|
460372
|
+
const { writeFile: writeFile103 } = await import("fs/promises");
|
|
460373
460373
|
const yamlContent = index_vite_proxy_tmp_default.dump(parsed, {
|
|
460374
460374
|
indent: 2,
|
|
460375
460375
|
lineWidth: -1,
|
|
460376
460376
|
noRefs: true
|
|
460377
460377
|
});
|
|
460378
|
-
await
|
|
460378
|
+
await writeFile103(overrideFilePath, yamlContent, "utf-8");
|
|
460379
460379
|
context3.logger.info(`Removed ${validationResult.invalidCount} invalid AI examples from ai_examples_override.yml`);
|
|
460380
460380
|
return {
|
|
460381
460381
|
removedCount: validationResult.invalidCount,
|
|
@@ -483704,8 +483704,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
483704
483704
|
}
|
|
483705
483705
|
}
|
|
483706
483706
|
var fs$writeFile = fs35.writeFile;
|
|
483707
|
-
fs35.writeFile =
|
|
483708
|
-
function
|
|
483707
|
+
fs35.writeFile = writeFile103;
|
|
483708
|
+
function writeFile103(path120, data2, options2, cb) {
|
|
483709
483709
|
if (typeof options2 === "function")
|
|
483710
483710
|
cb = options2, options2 = null;
|
|
483711
483711
|
return go$writeFile(path120, data2, options2, cb);
|
|
@@ -568242,6 +568242,7 @@ var require_VersionUtils = __commonJS({
|
|
|
568242
568242
|
exports2.maxVersionBump = maxVersionBump3;
|
|
568243
568243
|
exports2.isAutoVersion = isAutoVersion5;
|
|
568244
568244
|
exports2.isValidSemver = isValidSemver;
|
|
568245
|
+
exports2.isPlaceholderVersion = isPlaceholderVersion2;
|
|
568245
568246
|
exports2.incrementVersion = incrementVersion;
|
|
568246
568247
|
exports2.extractPreviousVersionFromDiffLine = extractPreviousVersionFromDiffLine;
|
|
568247
568248
|
var semver_1 = __importDefault2(require_semver2());
|
|
@@ -568321,11 +568322,18 @@ var require_VersionUtils = __commonJS({
|
|
|
568321
568322
|
function isValidSemver(version7) {
|
|
568322
568323
|
return SEMVER_PATTERN.test(version7);
|
|
568323
568324
|
}
|
|
568325
|
+
function isPlaceholderVersion2(version7) {
|
|
568326
|
+
const withoutPrefix = version7.startsWith("v") ? version7.slice(1) : version7;
|
|
568327
|
+
return withoutPrefix === exports2.MAGIC_VERSION || withoutPrefix.startsWith(`${exports2.MAGIC_VERSION}.`) || withoutPrefix === exports2.MAGIC_VERSION_PYTHON || withoutPrefix.startsWith(`${exports2.MAGIC_VERSION_PYTHON}.`);
|
|
568328
|
+
}
|
|
568324
568329
|
function incrementVersion(currentVersion, versionBump) {
|
|
568325
568330
|
const matcher = currentVersion.match(SEMVER_PATTERN);
|
|
568326
568331
|
if (!matcher) {
|
|
568327
568332
|
throw new AutoVersioningService_js_1.AutoVersioningException("Invalid semantic version format: " + currentVersion);
|
|
568328
568333
|
}
|
|
568334
|
+
if (isPlaceholderVersion2(currentVersion)) {
|
|
568335
|
+
throw new AutoVersioningService_js_1.AutoVersioningException("Refusing to increment the magic placeholder version: " + currentVersion + ". A real previous version must be resolved first.");
|
|
568336
|
+
}
|
|
568329
568337
|
const prefix2 = matcher[1] ?? "";
|
|
568330
568338
|
const versionWithoutPrefix = currentVersion.slice(prefix2.length);
|
|
568331
568339
|
const preRelease = matcher[5];
|
|
@@ -568366,7 +568374,7 @@ var require_autoversion = __commonJS({
|
|
|
568366
568374
|
"../../generator-cli/lib/autoversion/index.js"(exports2) {
|
|
568367
568375
|
"use strict";
|
|
568368
568376
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
568369
|
-
exports2.VersionBump = exports2.maxVersionBump = exports2.mapMagicVersionForLanguage = exports2.MAX_RAW_DIFF_BYTES = exports2.MAX_CHUNKS = exports2.MAX_AI_DIFF_BYTES = exports2.MAGIC_VERSION_PYTHON = exports2.MAGIC_VERSION = exports2.isValidSemver = exports2.isAutoVersion = exports2.incrementVersion = exports2.extractPreviousVersionFromDiffLine = exports2.extractLanguageFromGeneratorName = exports2.AUTO_VERSION = exports2.prependChangelogBlock = exports2.changelogContainsVersion = exports2.formatSizeKB = exports2.countFilesInDiff = exports2.AutoVersioningService = exports2.AutoVersioningException = exports2.AutoVersioningCache = void 0;
|
|
568377
|
+
exports2.VersionBump = exports2.maxVersionBump = exports2.mapMagicVersionForLanguage = exports2.MAX_RAW_DIFF_BYTES = exports2.MAX_CHUNKS = exports2.MAX_AI_DIFF_BYTES = exports2.MAGIC_VERSION_PYTHON = exports2.MAGIC_VERSION = exports2.isValidSemver = exports2.isPlaceholderVersion = exports2.isAutoVersion = exports2.incrementVersion = exports2.extractPreviousVersionFromDiffLine = exports2.extractLanguageFromGeneratorName = exports2.AUTO_VERSION = exports2.prependChangelogBlock = exports2.changelogContainsVersion = exports2.formatSizeKB = exports2.countFilesInDiff = exports2.AutoVersioningService = exports2.AutoVersioningException = exports2.AutoVersioningCache = void 0;
|
|
568370
568378
|
var AutoVersioningCache_js_1 = require_AutoVersioningCache();
|
|
568371
568379
|
Object.defineProperty(exports2, "AutoVersioningCache", { enumerable: true, get: function() {
|
|
568372
568380
|
return AutoVersioningCache_js_1.AutoVersioningCache;
|
|
@@ -568407,6 +568415,9 @@ var require_autoversion = __commonJS({
|
|
|
568407
568415
|
Object.defineProperty(exports2, "isAutoVersion", { enumerable: true, get: function() {
|
|
568408
568416
|
return VersionUtils_js_1.isAutoVersion;
|
|
568409
568417
|
} });
|
|
568418
|
+
Object.defineProperty(exports2, "isPlaceholderVersion", { enumerable: true, get: function() {
|
|
568419
|
+
return VersionUtils_js_1.isPlaceholderVersion;
|
|
568420
|
+
} });
|
|
568410
568421
|
Object.defineProperty(exports2, "isValidSemver", { enumerable: true, get: function() {
|
|
568411
568422
|
return VersionUtils_js_1.isValidSemver;
|
|
568412
568423
|
} });
|
|
@@ -569237,7 +569248,8 @@ var require_AutoVersionStep = __commonJS({
|
|
|
569237
569248
|
}
|
|
569238
569249
|
async handleFirstGeneration(params2) {
|
|
569239
569250
|
const { service, language, mappedMagicVersion, commit } = params2;
|
|
569240
|
-
const
|
|
569251
|
+
const configuredBaseVersion = this.usableVersion(this.config.baseVersion, "baseVersion");
|
|
569252
|
+
const initialVersion = configuredBaseVersion ?? (mappedMagicVersion.startsWith("v") ? "v0.0.1" : "0.0.1");
|
|
569241
569253
|
if (!(0, index_1.isValidSemver)(initialVersion)) {
|
|
569242
569254
|
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.`;
|
|
569243
569255
|
this.logger.error(errorMessage);
|
|
@@ -569547,12 +569559,13 @@ var require_AutoVersionStep = __commonJS({
|
|
|
569547
569559
|
*/
|
|
569548
569560
|
async resolvePreviousVersionNonReplay(params2) {
|
|
569549
569561
|
const { service, rawDiff, mappedMagicVersion, baseVersion } = params2;
|
|
569550
|
-
|
|
569551
|
-
|
|
569552
|
-
|
|
569562
|
+
const usableBaseVersion = this.usableVersion(baseVersion, "baseVersion");
|
|
569563
|
+
if (usableBaseVersion != null && (0, index_1.isValidSemver)(usableBaseVersion)) {
|
|
569564
|
+
this.logger.debug(`AutoVersionStep (non-replay): previous version from pipeline baseVersion: ${usableBaseVersion}`);
|
|
569565
|
+
return this.normalizeVersionPrefix(usableBaseVersion, mappedMagicVersion);
|
|
569553
569566
|
}
|
|
569554
569567
|
try {
|
|
569555
|
-
const extracted = service.extractPreviousVersion(rawDiff, mappedMagicVersion);
|
|
569568
|
+
const extracted = this.usableVersion(service.extractPreviousVersion(rawDiff, mappedMagicVersion) ?? void 0, "diff");
|
|
569556
569569
|
if (extracted != null) {
|
|
569557
569570
|
this.logger.debug(`AutoVersionStep (non-replay): previous version from diff: ${extracted}`);
|
|
569558
569571
|
return extracted;
|
|
@@ -569563,12 +569576,12 @@ var require_AutoVersionStep = __commonJS({
|
|
|
569563
569576
|
}
|
|
569564
569577
|
this.logger.info("AutoVersionStep (non-replay): magic version not in diff; trying metadata + git tags.");
|
|
569565
569578
|
}
|
|
569566
|
-
const metadataVersion = this.readVersionFromMetadataAtHead();
|
|
569579
|
+
const metadataVersion = this.usableVersion(this.readVersionFromMetadataAtHead(), "metadata.json");
|
|
569567
569580
|
if (metadataVersion != null) {
|
|
569568
569581
|
return this.normalizeVersionPrefix(metadataVersion, mappedMagicVersion);
|
|
569569
569582
|
}
|
|
569570
569583
|
try {
|
|
569571
|
-
const tagVersion = await service.getLatestVersionFromGitTags(this.outputDir);
|
|
569584
|
+
const tagVersion = this.usableVersion(await service.getLatestVersionFromGitTags(this.outputDir) ?? void 0, "git tags");
|
|
569572
569585
|
if (tagVersion != null) {
|
|
569573
569586
|
return this.normalizeVersionPrefix(tagVersion, mappedMagicVersion);
|
|
569574
569587
|
}
|
|
@@ -569579,12 +569592,13 @@ var require_AutoVersionStep = __commonJS({
|
|
|
569579
569592
|
}
|
|
569580
569593
|
async resolvePreviousVersion(params2) {
|
|
569581
569594
|
const { service, rawDiff, mappedMagicVersion, baseVersion } = params2;
|
|
569582
|
-
|
|
569583
|
-
|
|
569584
|
-
|
|
569595
|
+
const usableBaseVersion = this.usableVersion(baseVersion, "baseVersion");
|
|
569596
|
+
if (usableBaseVersion != null && (0, index_1.isValidSemver)(usableBaseVersion)) {
|
|
569597
|
+
this.logger.debug(`AutoVersionStep: previous version from pipeline baseVersion: ${usableBaseVersion}`);
|
|
569598
|
+
return this.normalizeVersionPrefix(usableBaseVersion, mappedMagicVersion);
|
|
569585
569599
|
}
|
|
569586
569600
|
try {
|
|
569587
|
-
const extracted = service.extractPreviousVersion(rawDiff, mappedMagicVersion);
|
|
569601
|
+
const extracted = this.usableVersion(service.extractPreviousVersion(rawDiff, mappedMagicVersion) ?? void 0, "diff");
|
|
569588
569602
|
if (extracted != null) {
|
|
569589
569603
|
this.logger.debug(`AutoVersionStep: previous version from diff: ${extracted}`);
|
|
569590
569604
|
return extracted;
|
|
@@ -569595,12 +569609,12 @@ var require_AutoVersionStep = __commonJS({
|
|
|
569595
569609
|
}
|
|
569596
569610
|
this.logger.info("AutoVersionStep: magic version not found in diff; falling back to metadata + git tags.");
|
|
569597
569611
|
}
|
|
569598
|
-
const metadataVersion = await this.readVersionFromMetadata();
|
|
569612
|
+
const metadataVersion = this.usableVersion(await this.readVersionFromMetadata(), "metadata.json");
|
|
569599
569613
|
if (metadataVersion != null) {
|
|
569600
569614
|
return this.normalizeVersionPrefix(metadataVersion, mappedMagicVersion);
|
|
569601
569615
|
}
|
|
569602
569616
|
try {
|
|
569603
|
-
const tagVersion = await service.getLatestVersionFromGitTags(this.outputDir);
|
|
569617
|
+
const tagVersion = this.usableVersion(await service.getLatestVersionFromGitTags(this.outputDir) ?? void 0, "git tags");
|
|
569604
569618
|
if (tagVersion != null) {
|
|
569605
569619
|
return this.normalizeVersionPrefix(tagVersion, mappedMagicVersion);
|
|
569606
569620
|
}
|
|
@@ -569622,6 +569636,25 @@ var require_AutoVersionStep = __commonJS({
|
|
|
569622
569636
|
return void 0;
|
|
569623
569637
|
}
|
|
569624
569638
|
}
|
|
569639
|
+
/**
|
|
569640
|
+
* Drops candidate previous versions that are the magic placeholder. SDK repos
|
|
569641
|
+
* that derive their published version at release time keep the placeholder
|
|
569642
|
+
* committed, so every resolution source (baseVersion, diff extraction,
|
|
569643
|
+
* metadata.json, git tags) can hand back the sentinel; incrementing it would
|
|
569644
|
+
* emit a mutated placeholder such as `0.0.0-fern-placeholder.0` instead of a
|
|
569645
|
+
* real version. Returning undefined lets the caller fall through to the next
|
|
569646
|
+
* source, and ultimately to the first-generation path.
|
|
569647
|
+
*/
|
|
569648
|
+
usableVersion(version7, source2) {
|
|
569649
|
+
if (version7 == null) {
|
|
569650
|
+
return void 0;
|
|
569651
|
+
}
|
|
569652
|
+
if ((0, index_1.isPlaceholderVersion)(version7)) {
|
|
569653
|
+
this.logger.info(`AutoVersionStep: ignoring placeholder version ${version7} from ${source2}; trying the next previous-version source.`);
|
|
569654
|
+
return void 0;
|
|
569655
|
+
}
|
|
569656
|
+
return version7;
|
|
569657
|
+
}
|
|
569625
569658
|
normalizeVersionPrefix(version7, mappedMagicVersion) {
|
|
569626
569659
|
const stripped = version7.startsWith("v") ? version7.slice(1) : version7;
|
|
569627
569660
|
return mappedMagicVersion.startsWith("v") ? `v${stripped}` : stripped;
|
|
@@ -626889,7 +626922,7 @@ var require_jsonfile = __commonJS({
|
|
|
626889
626922
|
const str2 = stringify5(obj, options2);
|
|
626890
626923
|
await universalify.fromCallback(fs34.writeFile)(file4, str2, options2);
|
|
626891
626924
|
}
|
|
626892
|
-
var
|
|
626925
|
+
var writeFile103 = universalify.fromPromise(_writeFile);
|
|
626893
626926
|
function writeFileSync9(file4, obj, options2 = {}) {
|
|
626894
626927
|
const fs34 = options2.fs || _fs;
|
|
626895
626928
|
const str2 = stringify5(obj, options2);
|
|
@@ -626898,7 +626931,7 @@ var require_jsonfile = __commonJS({
|
|
|
626898
626931
|
module4.exports = {
|
|
626899
626932
|
readFile: readFile121,
|
|
626900
626933
|
readFileSync: readFileSync19,
|
|
626901
|
-
writeFile:
|
|
626934
|
+
writeFile: writeFile103,
|
|
626902
626935
|
writeFileSync: writeFileSync9
|
|
626903
626936
|
};
|
|
626904
626937
|
}
|
|
@@ -694418,7 +694451,7 @@ var AccessTokenPosthogManager = class {
|
|
|
694418
694451
|
properties: {
|
|
694419
694452
|
...event,
|
|
694420
694453
|
...event.properties,
|
|
694421
|
-
version: "5.89.
|
|
694454
|
+
version: "5.89.6",
|
|
694422
694455
|
usingAccessToken: true,
|
|
694423
694456
|
...getRunIdProperties()
|
|
694424
694457
|
}
|
|
@@ -694484,7 +694517,7 @@ var UserPosthogManager = class {
|
|
|
694484
694517
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
694485
694518
|
event: "CLI",
|
|
694486
694519
|
properties: {
|
|
694487
|
-
version: "5.89.
|
|
694520
|
+
version: "5.89.6",
|
|
694488
694521
|
...event,
|
|
694489
694522
|
...event.properties,
|
|
694490
694523
|
usingAccessToken: false,
|
|
@@ -875614,7 +875647,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
875614
875647
|
var LOGS_FOLDER_NAME = "logs";
|
|
875615
875648
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
875616
875649
|
function getCliSource() {
|
|
875617
|
-
const version7 = "5.89.
|
|
875650
|
+
const version7 = "5.89.6";
|
|
875618
875651
|
return `cli@${version7}`;
|
|
875619
875652
|
}
|
|
875620
875653
|
var DebugLogger = class {
|
|
@@ -908324,7 +908357,7 @@ var LegacyDocsPublisher = class {
|
|
|
908324
908357
|
previewId,
|
|
908325
908358
|
disableTemplates: void 0,
|
|
908326
908359
|
skipUpload,
|
|
908327
|
-
cliVersion: "5.89.
|
|
908360
|
+
cliVersion: "5.89.6",
|
|
908328
908361
|
loginCommand: "fern auth login"
|
|
908329
908362
|
});
|
|
908330
908363
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -928060,6 +928093,8 @@ var Generation = class {
|
|
|
928060
928093
|
omitFernHeaders: () => this.customConfig["omit-fern-headers"] ?? false,
|
|
928061
928094
|
/** When true, emits the platform observability headers (X-Fern-Runtime, X-Fern-Runtime-Version, X-Fern-Platform). Default: false. Still subject to omitFernHeaders. */
|
|
928062
928095
|
includePlatformHeaders: () => this.customConfig["include-platform-headers"] ?? false,
|
|
928096
|
+
/** When true, exposes an `AppInfo` client option whose sanitized product token is appended to the `User-Agent` header (RFC 9110). Default: false. Independent of includePlatformHeaders; still subject to omitFernHeaders. */
|
|
928097
|
+
allowUserAgentAppInfo: () => this.customConfig["allow-user-agent-app-info"] ?? false,
|
|
928063
928098
|
/** When true, falls back to `<NuGetPackageId>/<version>` for the `User-Agent` header when the IR doesn't supply one. Default: false. */
|
|
928064
928099
|
userAgentNameFromPackage: () => this.customConfig["user-agent-name-from-package"] ?? false,
|
|
928065
928100
|
/** When true, moves auth params and IR headers into ClientOptions so the constructor takes only named arguments. Default: false. */
|
|
@@ -928348,6 +928383,14 @@ var Generation = class {
|
|
|
928348
928383
|
origin: this.model.staticExplicit("ClientOptions"),
|
|
928349
928384
|
namespace: this.namespaces.publicCoreClasses
|
|
928350
928385
|
}),
|
|
928386
|
+
/**
|
|
928387
|
+
* Optional application-info product token appended to the `User-Agent`
|
|
928388
|
+
* header. Only generated when the `allow-user-agent-app-info` config is on.
|
|
928389
|
+
*/
|
|
928390
|
+
AppInfo: () => this.csharp.classReference({
|
|
928391
|
+
origin: this.model.staticExplicit("AppInfo"),
|
|
928392
|
+
namespace: this.namespaces.publicCoreClasses
|
|
928393
|
+
}),
|
|
928351
928394
|
/** Low-level HTTP client wrapper for making raw API calls */
|
|
928352
928395
|
RawClient: () => this.csharp.classReference({
|
|
928353
928396
|
namespace: this.namespaces.core,
|
|
@@ -958858,6 +958901,10 @@ var TypescriptCustomConfigSchema = external_exports2.strictObject({
|
|
|
958858
958901
|
serdeLayer: external_exports2.optional(external_exports2.boolean()),
|
|
958859
958902
|
private: external_exports2.optional(external_exports2.boolean()),
|
|
958860
958903
|
requireDefaultEnvironment: external_exports2.optional(external_exports2.boolean()),
|
|
958904
|
+
// When true, the client's `baseUrl` option becomes required and the `environment`
|
|
958905
|
+
// option becomes optional. Intended for APIs whose consumers always supply a URL
|
|
958906
|
+
// explicitly and have no concept of named environments.
|
|
958907
|
+
requireBaseUrl: external_exports2.optional(external_exports2.boolean()),
|
|
958861
958908
|
retainOriginalCasing: external_exports2.optional(external_exports2.boolean()),
|
|
958862
958909
|
useBigInt: external_exports2.optional(external_exports2.boolean()),
|
|
958863
958910
|
useBrandedStringAliases: external_exports2.optional(external_exports2.boolean()),
|
|
@@ -961928,16 +961975,16 @@ var LocalTaskHandler = class {
|
|
|
961928
961975
|
}
|
|
961929
961976
|
let previousVersion;
|
|
961930
961977
|
try {
|
|
961931
|
-
previousVersion = autoVersioningService.extractPreviousVersion(diffContent, mappedMagicVersion);
|
|
961978
|
+
previousVersion = this.usableVersion(autoVersioningService.extractPreviousVersion(diffContent, mappedMagicVersion) ?? void 0, "diff");
|
|
961932
961979
|
} catch (e2) {
|
|
961933
961980
|
if (!(e2 instanceof import_autoversion2.AutoVersioningException) || !e2.magicVersionAbsent) {
|
|
961934
961981
|
throw e2;
|
|
961935
961982
|
}
|
|
961936
961983
|
this.context.logger.info(`Magic version not found in diff, trying fallbacks: ${e2}`);
|
|
961937
|
-
previousVersion = await this.getVersionFromLocalMetadata();
|
|
961984
|
+
previousVersion = this.usableVersion(await this.getVersionFromLocalMetadata(), "metadata.json");
|
|
961938
961985
|
if (previousVersion == null) {
|
|
961939
961986
|
const tagVersion = await autoVersioningService.getLatestVersionFromGitTags(this.absolutePathToLocalOutput);
|
|
961940
|
-
previousVersion = this.normalizeVersionPrefix(tagVersion);
|
|
961987
|
+
previousVersion = this.usableVersion(this.normalizeVersionPrefix(tagVersion), "git tags");
|
|
961941
961988
|
}
|
|
961942
961989
|
if (previousVersion == null) {
|
|
961943
961990
|
this.context.logger.info("No git tags found \u2014 treating as new SDK repository");
|
|
@@ -961957,10 +962004,10 @@ var LocalTaskHandler = class {
|
|
|
961957
962004
|
const cleanedFileCount = (0, import_autoversion2.countFilesInDiff)(cleanedDiff);
|
|
961958
962005
|
this.context.logger.debug(`Generated diff size: ${rawDiffSizeKB}KB (${diffContent.length} chars), ${rawFileCount} files changed. Cleaned diff size: ${cleanedDiffSizeKB}KB (${cleanedDiff.length} chars), ${cleanedFileCount} files remaining`);
|
|
961959
962006
|
if (previousVersion == null) {
|
|
961960
|
-
previousVersion = await this.getVersionFromLocalMetadata();
|
|
962007
|
+
previousVersion = this.usableVersion(await this.getVersionFromLocalMetadata(), "metadata.json");
|
|
961961
962008
|
if (previousVersion == null) {
|
|
961962
962009
|
const rawTagVersion = await autoVersioningService.getLatestVersionFromGitTags(this.absolutePathToLocalOutput);
|
|
961963
|
-
const normalizedTag = this.normalizeVersionPrefix(rawTagVersion);
|
|
962010
|
+
const normalizedTag = this.usableVersion(this.normalizeVersionPrefix(rawTagVersion), "git tags");
|
|
961964
962011
|
if (normalizedTag != null) {
|
|
961965
962012
|
this.context.logger.info(`No previous version from diff; using git tag: ${normalizedTag}`);
|
|
961966
962013
|
previousVersion = normalizedTag;
|
|
@@ -962230,6 +962277,24 @@ var LocalTaskHandler = class {
|
|
|
962230
962277
|
return void 0;
|
|
962231
962278
|
}
|
|
962232
962279
|
}
|
|
962280
|
+
/**
|
|
962281
|
+
* Drops candidate previous versions that are the magic placeholder. SDK repos
|
|
962282
|
+
* that derive their published version at release time keep the placeholder
|
|
962283
|
+
* committed, so any resolution source can hand back the sentinel; bumping it
|
|
962284
|
+
* would publish a mutated placeholder rather than a real version. Returning
|
|
962285
|
+
* undefined lets the caller fall through to the next source, and ultimately to
|
|
962286
|
+
* the initial-version path.
|
|
962287
|
+
*/
|
|
962288
|
+
usableVersion(version7, source2) {
|
|
962289
|
+
if (version7 == null) {
|
|
962290
|
+
return void 0;
|
|
962291
|
+
}
|
|
962292
|
+
if ((0, import_autoversion2.isPlaceholderVersion)(version7)) {
|
|
962293
|
+
this.context.logger.info(`Ignoring placeholder version ${version7} from ${source2}; trying the next previous-version source.`);
|
|
962294
|
+
return void 0;
|
|
962295
|
+
}
|
|
962296
|
+
return version7;
|
|
962297
|
+
}
|
|
962233
962298
|
/**
|
|
962234
962299
|
* Normalizes a version string's `v` prefix to match the convention used by
|
|
962235
962300
|
* the magic version for this generator's language. Git tags may use `v1.2.3`
|
|
@@ -975200,7 +975265,7 @@ function getAutomationContextFromEnv() {
|
|
|
975200
975265
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
975201
975266
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
975202
975267
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
975203
|
-
cli_version: "5.89.
|
|
975268
|
+
cli_version: "5.89.6"
|
|
975204
975269
|
};
|
|
975205
975270
|
}
|
|
975206
975271
|
function isAutomationMode() {
|
|
@@ -976032,7 +976097,7 @@ var CliContext = class _CliContext {
|
|
|
976032
976097
|
if (false) {
|
|
976033
976098
|
this.logger.error("CLI_VERSION is not defined");
|
|
976034
976099
|
}
|
|
976035
|
-
return "5.89.
|
|
976100
|
+
return "5.89.6";
|
|
976036
976101
|
}
|
|
976037
976102
|
getCliName() {
|
|
976038
976103
|
if (false) {
|
|
@@ -977844,7 +977909,8 @@ async function packLocalOutputForGroup({
|
|
|
977844
977909
|
context: context3,
|
|
977845
977910
|
mode = "host",
|
|
977846
977911
|
runner,
|
|
977847
|
-
packOnly = false
|
|
977912
|
+
packOnly = false,
|
|
977913
|
+
version: version7
|
|
977848
977914
|
}) {
|
|
977849
977915
|
const failures = [];
|
|
977850
977916
|
for (const generator of group.generators) {
|
|
@@ -977866,7 +977932,8 @@ async function packLocalOutputForGroup({
|
|
|
977866
977932
|
outputPath,
|
|
977867
977933
|
context: context3,
|
|
977868
977934
|
mode,
|
|
977869
|
-
runner: runner ?? "docker"
|
|
977935
|
+
runner: runner ?? "docker",
|
|
977936
|
+
version: version7
|
|
977870
977937
|
});
|
|
977871
977938
|
if (packOnly) {
|
|
977872
977939
|
if (artifactProduced) {
|
|
@@ -977893,7 +977960,8 @@ async function packOutputForLanguage({
|
|
|
977893
977960
|
outputPath,
|
|
977894
977961
|
context: context3,
|
|
977895
977962
|
mode,
|
|
977896
|
-
runner
|
|
977963
|
+
runner,
|
|
977964
|
+
version: version7
|
|
977897
977965
|
}) {
|
|
977898
977966
|
const distDir = join8(outputPath, RelativeFilePath2.of(PACK_OUTPUT_DIRECTORY));
|
|
977899
977967
|
const run = async (commands) => {
|
|
@@ -977902,26 +977970,103 @@ async function packOutputForLanguage({
|
|
|
977902
977970
|
switch (language) {
|
|
977903
977971
|
case "typescript": {
|
|
977904
977972
|
await (0, import_promises168.mkdir)(distDir, { recursive: true });
|
|
977905
|
-
|
|
977973
|
+
await run([["npm", "install"]]);
|
|
977906
977974
|
if (await hasNpmScript({ outputPath, script: "build" })) {
|
|
977907
|
-
|
|
977975
|
+
await run([["npx", "--yes", "pnpm", "run", "build"]]);
|
|
977976
|
+
} else {
|
|
977977
|
+
const tsconfig = await findTsconfig(outputPath);
|
|
977978
|
+
if (tsconfig != null) {
|
|
977979
|
+
try {
|
|
977980
|
+
await run([["npx", "--yes", "--package", "typescript", "tsc", "--project", tsconfig]]);
|
|
977981
|
+
} catch (error50) {
|
|
977982
|
+
if (!await hasEmittedCompilerOutput({ outputPath, tsconfig })) {
|
|
977983
|
+
throw error50;
|
|
977984
|
+
}
|
|
977985
|
+
context3.logger.warn(
|
|
977986
|
+
`tsc reported errors while compiling ${tsconfig}; packing the emitted output anyway.`
|
|
977987
|
+
);
|
|
977988
|
+
}
|
|
977989
|
+
}
|
|
977990
|
+
}
|
|
977991
|
+
const npmignorePath = join8(outputPath, RelativeFilePath2.of(".npmignore"));
|
|
977992
|
+
const shouldWriteNpmignore = !await doesPathExist(npmignorePath) && !await hasPackageJsonFilesField(outputPath) && await doesPathExist(join8(outputPath, RelativeFilePath2.of(".gitignore")));
|
|
977993
|
+
if (shouldWriteNpmignore) {
|
|
977994
|
+
await (0, import_promises168.writeFile)(npmignorePath, `${PACK_OUTPUT_DIRECTORY}/
|
|
977995
|
+
`);
|
|
977996
|
+
}
|
|
977997
|
+
try {
|
|
977998
|
+
await run([["npm", "pack", "--pack-destination", PACK_OUTPUT_DIRECTORY]]);
|
|
977999
|
+
} finally {
|
|
978000
|
+
if (shouldWriteNpmignore) {
|
|
978001
|
+
await (0, import_promises168.rm)(npmignorePath, { force: true });
|
|
978002
|
+
}
|
|
977908
978003
|
}
|
|
977909
|
-
commands.push(["npm", "pack", "--pack-destination", PACK_OUTPUT_DIRECTORY]);
|
|
977910
|
-
await run(commands);
|
|
977911
978004
|
logArtifacts({ distDir, context: context3 });
|
|
977912
978005
|
return true;
|
|
977913
978006
|
}
|
|
977914
978007
|
case "python": {
|
|
977915
978008
|
await (0, import_promises168.mkdir)(distDir, { recursive: true });
|
|
977916
|
-
|
|
978009
|
+
const pipWheelCommand = [
|
|
978010
|
+
"python3",
|
|
978011
|
+
"-m",
|
|
978012
|
+
"pip",
|
|
978013
|
+
"wheel",
|
|
978014
|
+
".",
|
|
978015
|
+
"--no-deps",
|
|
978016
|
+
"--wheel-dir",
|
|
978017
|
+
PACK_OUTPUT_DIRECTORY
|
|
978018
|
+
];
|
|
978019
|
+
if (mode === "host") {
|
|
978020
|
+
try {
|
|
978021
|
+
await run([pipWheelCommand]);
|
|
978022
|
+
} catch {
|
|
978023
|
+
context3.logger.warn(
|
|
978024
|
+
"pip wheel failed on the host toolchain; retrying in an isolated build environment (python -m venv + python -m build)."
|
|
978025
|
+
);
|
|
978026
|
+
const venvDirectory = ".fern-pack-venv";
|
|
978027
|
+
const venvPython = process.platform === "win32" ? `${venvDirectory}/Scripts/python` : `${venvDirectory}/bin/python`;
|
|
978028
|
+
try {
|
|
978029
|
+
await run([
|
|
978030
|
+
["python3", "-m", "venv", venvDirectory],
|
|
978031
|
+
[venvPython, "-m", "pip", "install", "--quiet", "build"],
|
|
978032
|
+
[venvPython, "-m", "build", "--wheel", "--outdir", PACK_OUTPUT_DIRECTORY]
|
|
978033
|
+
]);
|
|
978034
|
+
} finally {
|
|
978035
|
+
await (0, import_promises168.rm)(join8(outputPath, RelativeFilePath2.of(venvDirectory)), {
|
|
978036
|
+
recursive: true,
|
|
978037
|
+
force: true
|
|
978038
|
+
});
|
|
978039
|
+
}
|
|
978040
|
+
}
|
|
978041
|
+
} else {
|
|
978042
|
+
await run([pipWheelCommand]);
|
|
978043
|
+
}
|
|
977917
978044
|
logArtifacts({ distDir, context: context3 });
|
|
977918
978045
|
return true;
|
|
977919
978046
|
}
|
|
977920
978047
|
case "java": {
|
|
977921
978048
|
await (0, import_promises168.mkdir)(distDir, { recursive: true });
|
|
977922
|
-
|
|
978049
|
+
const initScriptName = ".fern-pack-pom-init.gradle";
|
|
978050
|
+
const initScriptPath = join8(outputPath, RelativeFilePath2.of(initScriptName));
|
|
978051
|
+
await (0, import_promises168.writeFile)(initScriptPath, getJavaPomInitScript({ fallbackVersion: version7 ?? "0.0.0" }));
|
|
978052
|
+
try {
|
|
978053
|
+
await run([
|
|
978054
|
+
[
|
|
978055
|
+
"gradle",
|
|
978056
|
+
"--init-script",
|
|
978057
|
+
initScriptName,
|
|
978058
|
+
"jar",
|
|
978059
|
+
`generatePomFileFor${JAVA_POM_PUBLICATION_NAME_CAPITALIZED}Publication`,
|
|
978060
|
+
"-x",
|
|
978061
|
+
"test"
|
|
978062
|
+
]
|
|
978063
|
+
]);
|
|
978064
|
+
} finally {
|
|
978065
|
+
await (0, import_promises168.rm)(initScriptPath, { force: true });
|
|
978066
|
+
}
|
|
977923
978067
|
const libsDir = join8(outputPath, RelativeFilePath2.of("build/libs"));
|
|
977924
978068
|
await copyMatchingFiles({ fromDir: libsDir, toDir: distDir, extension: ".jar" });
|
|
978069
|
+
await copyGeneratedPom({ outputPath, distDir, context: context3 });
|
|
977925
978070
|
logArtifacts({ distDir, context: context3 });
|
|
977926
978071
|
return true;
|
|
977927
978072
|
}
|
|
@@ -978003,7 +978148,8 @@ async function runPackCommands({
|
|
|
978003
978148
|
if (image3 == null) {
|
|
978004
978149
|
throw new Error(`No Docker toolchain image is configured for ${language}.`);
|
|
978005
978150
|
}
|
|
978006
|
-
const
|
|
978151
|
+
const workdir = `/workspace/${(0, import_path110.basename)(outputPath)}`;
|
|
978152
|
+
const containerArgs = ["run", "--rm", "-v", `${outputPath}:${workdir}`, "-w", workdir, "-e", "HOME=/tmp"];
|
|
978007
978153
|
if (process.getuid != null && process.getgid != null) {
|
|
978008
978154
|
containerArgs.push("--user", `${process.getuid()}:${process.getgid()}`);
|
|
978009
978155
|
}
|
|
@@ -978069,6 +978215,86 @@ async function removeDistDirIfEmpty(outputPath) {
|
|
|
978069
978215
|
} catch {
|
|
978070
978216
|
}
|
|
978071
978217
|
}
|
|
978218
|
+
var JAVA_POM_PUBLICATION_NAME = "fernLocalPack";
|
|
978219
|
+
var JAVA_POM_PUBLICATION_NAME_CAPITALIZED = "FernLocalPack";
|
|
978220
|
+
function getJavaPomInitScript({ fallbackVersion }) {
|
|
978221
|
+
return `allprojects { project ->
|
|
978222
|
+
project.plugins.withId("java") {
|
|
978223
|
+
project.apply plugin: "maven-publish"
|
|
978224
|
+
project.afterEvaluate {
|
|
978225
|
+
if (project.group == null || project.group.toString().isEmpty()) {
|
|
978226
|
+
project.group = project.name
|
|
978227
|
+
}
|
|
978228
|
+
if (project.version == null || project.version.toString() == "unspecified") {
|
|
978229
|
+
project.version = "${fallbackVersion}"
|
|
978230
|
+
}
|
|
978231
|
+
if (project.publishing.publications.findByName("${JAVA_POM_PUBLICATION_NAME}") == null) {
|
|
978232
|
+
project.publishing.publications.create("${JAVA_POM_PUBLICATION_NAME}", MavenPublication) {
|
|
978233
|
+
from project.components.java
|
|
978234
|
+
}
|
|
978235
|
+
}
|
|
978236
|
+
}
|
|
978237
|
+
}
|
|
978238
|
+
}
|
|
978239
|
+
`;
|
|
978240
|
+
}
|
|
978241
|
+
async function copyGeneratedPom({
|
|
978242
|
+
outputPath,
|
|
978243
|
+
distDir,
|
|
978244
|
+
context: context3
|
|
978245
|
+
}) {
|
|
978246
|
+
const pomPath = join8(
|
|
978247
|
+
outputPath,
|
|
978248
|
+
RelativeFilePath2.of(`build/publications/${JAVA_POM_PUBLICATION_NAME}/pom-default.xml`)
|
|
978249
|
+
);
|
|
978250
|
+
if (!await doesPathExist(pomPath)) {
|
|
978251
|
+
context3.logger.warn(
|
|
978252
|
+
"No POM was generated for the Java package; the JAR is packaged without dependency metadata."
|
|
978253
|
+
);
|
|
978254
|
+
return;
|
|
978255
|
+
}
|
|
978256
|
+
const jarNames = (await (0, import_promises168.readdir)(distDir)).filter((file4) => file4.endsWith(".jar"));
|
|
978257
|
+
const jarName = jarNames.find((file4) => !file4.endsWith("-sources.jar") && !file4.endsWith("-javadoc.jar")) ?? jarNames[0];
|
|
978258
|
+
const pomName = jarName != null ? `${jarName.slice(0, -".jar".length)}.pom` : "pom.xml";
|
|
978259
|
+
await (0, import_promises168.copyFile)(pomPath, join8(distDir, RelativeFilePath2.of(pomName)));
|
|
978260
|
+
}
|
|
978261
|
+
async function hasEmittedCompilerOutput({
|
|
978262
|
+
outputPath,
|
|
978263
|
+
tsconfig
|
|
978264
|
+
}) {
|
|
978265
|
+
let outDir = "dist";
|
|
978266
|
+
try {
|
|
978267
|
+
const parsed = JSON.parse(await (0, import_promises168.readFile)(join8(outputPath, RelativeFilePath2.of(tsconfig)), "utf-8"));
|
|
978268
|
+
if (typeof parsed === "object" && parsed != null && "compilerOptions" in parsed) {
|
|
978269
|
+
const compilerOptions = parsed.compilerOptions;
|
|
978270
|
+
if (typeof compilerOptions === "object" && compilerOptions != null && "outDir" in compilerOptions && typeof compilerOptions.outDir === "string") {
|
|
978271
|
+
outDir = compilerOptions.outDir;
|
|
978272
|
+
}
|
|
978273
|
+
}
|
|
978274
|
+
} catch {
|
|
978275
|
+
}
|
|
978276
|
+
const outDirPath = join8(outputPath, RelativeFilePath2.of(outDir));
|
|
978277
|
+
if (!await doesPathExist(outDirPath)) {
|
|
978278
|
+
return false;
|
|
978279
|
+
}
|
|
978280
|
+
return (await (0, import_promises168.readdir)(outDirPath)).length > 0;
|
|
978281
|
+
}
|
|
978282
|
+
async function findTsconfig(outputPath) {
|
|
978283
|
+
for (const candidate of ["tsconfig.cjs.json", "tsconfig.json"]) {
|
|
978284
|
+
if (await doesPathExist(join8(outputPath, RelativeFilePath2.of(candidate)))) {
|
|
978285
|
+
return candidate;
|
|
978286
|
+
}
|
|
978287
|
+
}
|
|
978288
|
+
return void 0;
|
|
978289
|
+
}
|
|
978290
|
+
async function hasPackageJsonFilesField(outputPath) {
|
|
978291
|
+
const packageJsonPath = join8(outputPath, RelativeFilePath2.of("package.json"));
|
|
978292
|
+
if (!await doesPathExist(packageJsonPath)) {
|
|
978293
|
+
return false;
|
|
978294
|
+
}
|
|
978295
|
+
const parsed = JSON.parse(await (0, import_promises168.readFile)(packageJsonPath, "utf-8"));
|
|
978296
|
+
return typeof parsed === "object" && parsed != null && "files" in parsed;
|
|
978297
|
+
}
|
|
978072
978298
|
async function hasNpmScript({
|
|
978073
978299
|
outputPath,
|
|
978074
978300
|
script
|
|
@@ -978362,7 +978588,14 @@ async function generateWorkspace({
|
|
|
978362
978588
|
});
|
|
978363
978589
|
}
|
|
978364
978590
|
if (pack) {
|
|
978365
|
-
await packLocalOutputForGroup({
|
|
978591
|
+
await packLocalOutputForGroup({
|
|
978592
|
+
group,
|
|
978593
|
+
context: groupContext,
|
|
978594
|
+
mode: packMode,
|
|
978595
|
+
runner,
|
|
978596
|
+
packOnly,
|
|
978597
|
+
version: version7
|
|
978598
|
+
});
|
|
978366
978599
|
}
|
|
978367
978600
|
})
|
|
978368
978601
|
)
|
package/package.json
CHANGED