@fern-api/fern-api-dev 5.33.0 → 5.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +398 -373
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -68243,8 +68243,8 @@ var require_graceful_fs = __commonJS({
|
|
|
68243
68243
|
}
|
|
68244
68244
|
}
|
|
68245
68245
|
var fs$writeFile = fs30.writeFile;
|
|
68246
|
-
fs30.writeFile =
|
|
68247
|
-
function
|
|
68246
|
+
fs30.writeFile = writeFile95;
|
|
68247
|
+
function writeFile95(path115, data2, options2, cb) {
|
|
68248
68248
|
if (typeof options2 === "function")
|
|
68249
68249
|
cb = options2, options2 = null;
|
|
68250
68250
|
return go$writeFile(path115, data2, options2, cb);
|
|
@@ -337233,8 +337233,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
337233
337233
|
}
|
|
337234
337234
|
}
|
|
337235
337235
|
var fs$writeFile = fs30.writeFile;
|
|
337236
|
-
fs30.writeFile =
|
|
337237
|
-
function
|
|
337236
|
+
fs30.writeFile = writeFile95;
|
|
337237
|
+
function writeFile95(path115, data2, options2, cb) {
|
|
337238
337238
|
if (typeof options2 === "function")
|
|
337239
337239
|
cb = options2, options2 = null;
|
|
337240
337240
|
return go$writeFile(path115, data2, options2, cb);
|
|
@@ -346143,10 +346143,10 @@ var require_make_dir = __commonJS({
|
|
|
346143
346143
|
module4.exports = (input3, opts) => Promise.resolve().then(() => {
|
|
346144
346144
|
checkPath(input3);
|
|
346145
346145
|
opts = Object.assign({}, defaults3, opts);
|
|
346146
|
-
const
|
|
346146
|
+
const mkdir44 = pify(opts.fs.mkdir);
|
|
346147
346147
|
const stat6 = pify(opts.fs.stat);
|
|
346148
346148
|
const make = (pth) => {
|
|
346149
|
-
return
|
|
346149
|
+
return mkdir44(pth, opts.mode).then(() => pth).catch((err) => {
|
|
346150
346150
|
if (err.code === "ENOENT") {
|
|
346151
346151
|
if (err.message.includes("null bytes") || path115.dirname(pth) === pth) {
|
|
346152
346152
|
throw err;
|
|
@@ -361950,7 +361950,7 @@ var require_dist14 = __commonJS({
|
|
|
361950
361950
|
return copy;
|
|
361951
361951
|
}
|
|
361952
361952
|
};
|
|
361953
|
-
var
|
|
361953
|
+
var import_promises199 = require("fs/promises");
|
|
361954
361954
|
var import_node_path310 = require("path");
|
|
361955
361955
|
async function resolveInputs(args) {
|
|
361956
361956
|
const {
|
|
@@ -362003,7 +362003,7 @@ var require_dist14 = __commonJS({
|
|
|
362003
362003
|
}
|
|
362004
362004
|
}
|
|
362005
362005
|
const oursPath = (0, import_node_path310.join)(outputDir, resolvedPath);
|
|
362006
|
-
const ours = await (0,
|
|
362006
|
+
const ours = await (0, import_promises199.readFile)(oursPath, "utf-8").catch(() => null);
|
|
362007
362007
|
let ghostTheirs = null;
|
|
362008
362008
|
if (!base4 && ours && !renameSourcePath) {
|
|
362009
362009
|
const treeReachable = await isTreeReachable(baseGen.tree_hash);
|
|
@@ -402952,7 +402952,7 @@ async function readFernYmlRaw(start2) {
|
|
|
402952
402952
|
for (let i9 = 0; i9 < 50; i9++) {
|
|
402953
402953
|
const candidate = (0, import_path97.resolve)(dir, "fern.yml");
|
|
402954
402954
|
try {
|
|
402955
|
-
const content5 = await (0,
|
|
402955
|
+
const content5 = await (0, import_promises124.readFile)(candidate, "utf-8");
|
|
402956
402956
|
const parsed = jsYaml.load(content5);
|
|
402957
402957
|
if (isRawFernYml(parsed)) {
|
|
402958
402958
|
return parsed;
|
|
@@ -403000,11 +403000,11 @@ function extractInstances(raw) {
|
|
|
403000
403000
|
}
|
|
403001
403001
|
return raw.docs.instances.flatMap((inst) => typeof inst?.url === "string" ? [inst.url] : []);
|
|
403002
403002
|
}
|
|
403003
|
-
var
|
|
403003
|
+
var import_promises124, import_path97;
|
|
403004
403004
|
var init_completion2 = __esm({
|
|
403005
403005
|
"../cli-v2/lib/completion.js"() {
|
|
403006
403006
|
"use strict";
|
|
403007
|
-
|
|
403007
|
+
import_promises124 = require("fs/promises");
|
|
403008
403008
|
init_js_yaml();
|
|
403009
403009
|
import_path97 = require("path");
|
|
403010
403010
|
}
|
|
@@ -403731,14 +403731,14 @@ var require_empty2 = __commonJS({
|
|
|
403731
403731
|
var u6 = require_universalify().fromPromise;
|
|
403732
403732
|
var fs29 = require_fs();
|
|
403733
403733
|
var path115 = require("path");
|
|
403734
|
-
var
|
|
403734
|
+
var mkdir44 = require_mkdirs();
|
|
403735
403735
|
var remove3 = require_remove3();
|
|
403736
403736
|
var emptyDir = u6(async function emptyDir2(dir) {
|
|
403737
403737
|
let items;
|
|
403738
403738
|
try {
|
|
403739
403739
|
items = await fs29.readdir(dir);
|
|
403740
403740
|
} catch {
|
|
403741
|
-
return
|
|
403741
|
+
return mkdir44.mkdirs(dir);
|
|
403742
403742
|
}
|
|
403743
403743
|
return Promise.all(items.map((item) => remove3.remove(path115.join(dir, item))));
|
|
403744
403744
|
});
|
|
@@ -403747,7 +403747,7 @@ var require_empty2 = __commonJS({
|
|
|
403747
403747
|
try {
|
|
403748
403748
|
items = fs29.readdirSync(dir);
|
|
403749
403749
|
} catch {
|
|
403750
|
-
return
|
|
403750
|
+
return mkdir44.mkdirsSync(dir);
|
|
403751
403751
|
}
|
|
403752
403752
|
items.forEach((item) => {
|
|
403753
403753
|
item = path115.join(dir, item);
|
|
@@ -403770,7 +403770,7 @@ var require_file = __commonJS({
|
|
|
403770
403770
|
var u6 = require_universalify().fromPromise;
|
|
403771
403771
|
var path115 = require("path");
|
|
403772
403772
|
var fs29 = require_fs();
|
|
403773
|
-
var
|
|
403773
|
+
var mkdir44 = require_mkdirs();
|
|
403774
403774
|
async function createFile(file4) {
|
|
403775
403775
|
let stats;
|
|
403776
403776
|
try {
|
|
@@ -403784,7 +403784,7 @@ var require_file = __commonJS({
|
|
|
403784
403784
|
dirStats = await fs29.stat(dir);
|
|
403785
403785
|
} catch (err) {
|
|
403786
403786
|
if (err.code === "ENOENT") {
|
|
403787
|
-
await
|
|
403787
|
+
await mkdir44.mkdirs(dir);
|
|
403788
403788
|
await fs29.writeFile(file4, "");
|
|
403789
403789
|
return;
|
|
403790
403790
|
} else {
|
|
@@ -403810,7 +403810,7 @@ var require_file = __commonJS({
|
|
|
403810
403810
|
fs29.readdirSync(dir);
|
|
403811
403811
|
}
|
|
403812
403812
|
} catch (err) {
|
|
403813
|
-
if (err && err.code === "ENOENT")
|
|
403813
|
+
if (err && err.code === "ENOENT") mkdir44.mkdirsSync(dir);
|
|
403814
403814
|
else throw err;
|
|
403815
403815
|
}
|
|
403816
403816
|
fs29.writeFileSync(file4, "");
|
|
@@ -403829,7 +403829,7 @@ var require_link = __commonJS({
|
|
|
403829
403829
|
var u6 = require_universalify().fromPromise;
|
|
403830
403830
|
var path115 = require("path");
|
|
403831
403831
|
var fs29 = require_fs();
|
|
403832
|
-
var
|
|
403832
|
+
var mkdir44 = require_mkdirs();
|
|
403833
403833
|
var { pathExists: pathExists2 } = require_path_exists();
|
|
403834
403834
|
var { areIdentical } = require_stat();
|
|
403835
403835
|
async function createLink(srcpath, dstpath) {
|
|
@@ -403849,7 +403849,7 @@ var require_link = __commonJS({
|
|
|
403849
403849
|
const dir = path115.dirname(dstpath);
|
|
403850
403850
|
const dirExists = await pathExists2(dir);
|
|
403851
403851
|
if (!dirExists) {
|
|
403852
|
-
await
|
|
403852
|
+
await mkdir44.mkdirs(dir);
|
|
403853
403853
|
}
|
|
403854
403854
|
await fs29.link(srcpath, dstpath);
|
|
403855
403855
|
}
|
|
@@ -403869,7 +403869,7 @@ var require_link = __commonJS({
|
|
|
403869
403869
|
const dir = path115.dirname(dstpath);
|
|
403870
403870
|
const dirExists = fs29.existsSync(dir);
|
|
403871
403871
|
if (dirExists) return fs29.linkSync(srcpath, dstpath);
|
|
403872
|
-
|
|
403872
|
+
mkdir44.mkdirsSync(dir);
|
|
403873
403873
|
return fs29.linkSync(srcpath, dstpath);
|
|
403874
403874
|
}
|
|
403875
403875
|
module4.exports = {
|
|
@@ -404168,7 +404168,7 @@ var require_jsonfile = __commonJS({
|
|
|
404168
404168
|
const str3 = stringify5(obj, options2);
|
|
404169
404169
|
await universalify.fromCallback(fs29.writeFile)(file4, str3, options2);
|
|
404170
404170
|
}
|
|
404171
|
-
var
|
|
404171
|
+
var writeFile95 = universalify.fromPromise(_writeFile);
|
|
404172
404172
|
function writeFileSync9(file4, obj, options2 = {}) {
|
|
404173
404173
|
const fs29 = options2.fs || _fs;
|
|
404174
404174
|
const str3 = stringify5(obj, options2);
|
|
@@ -404177,7 +404177,7 @@ var require_jsonfile = __commonJS({
|
|
|
404177
404177
|
module4.exports = {
|
|
404178
404178
|
readFile: readFile113,
|
|
404179
404179
|
readFileSync: readFileSync19,
|
|
404180
|
-
writeFile:
|
|
404180
|
+
writeFile: writeFile95,
|
|
404181
404181
|
writeFileSync: writeFileSync9
|
|
404182
404182
|
};
|
|
404183
404183
|
}
|
|
@@ -404205,19 +404205,19 @@ var require_output_file = __commonJS({
|
|
|
404205
404205
|
var u6 = require_universalify().fromPromise;
|
|
404206
404206
|
var fs29 = require_fs();
|
|
404207
404207
|
var path115 = require("path");
|
|
404208
|
-
var
|
|
404208
|
+
var mkdir44 = require_mkdirs();
|
|
404209
404209
|
var pathExists2 = require_path_exists().pathExists;
|
|
404210
404210
|
async function outputFile(file4, data2, encoding = "utf-8") {
|
|
404211
404211
|
const dir = path115.dirname(file4);
|
|
404212
404212
|
if (!await pathExists2(dir)) {
|
|
404213
|
-
await
|
|
404213
|
+
await mkdir44.mkdirs(dir);
|
|
404214
404214
|
}
|
|
404215
404215
|
return fs29.writeFile(file4, data2, encoding);
|
|
404216
404216
|
}
|
|
404217
404217
|
function outputFileSync(file4, ...args) {
|
|
404218
404218
|
const dir = path115.dirname(file4);
|
|
404219
404219
|
if (!fs29.existsSync(dir)) {
|
|
404220
|
-
|
|
404220
|
+
mkdir44.mkdirsSync(dir);
|
|
404221
404221
|
}
|
|
404222
404222
|
fs29.writeFileSync(file4, ...args);
|
|
404223
404223
|
}
|
|
@@ -467925,7 +467925,7 @@ async function unpackArchive(archivePath, folderPath) {
|
|
|
467925
467925
|
} else if (archivePath.endsWith(".tar.bz2")) {
|
|
467926
467926
|
await extractTar(archivePath, folderPath, "bzip2");
|
|
467927
467927
|
} else if (archivePath.endsWith(".dmg")) {
|
|
467928
|
-
await (0,
|
|
467928
|
+
await (0, import_promises134.mkdir)(folderPath);
|
|
467929
467929
|
await installDMG(archivePath, folderPath);
|
|
467930
467930
|
} else if (archivePath.endsWith(".exe")) {
|
|
467931
467931
|
const result = (0, import_node_child_process4.spawnSync)(archivePath, [`/ExtractDir=${folderPath}`], {
|
|
@@ -468014,7 +468014,7 @@ async function installDMG(dmgPath, folderPath) {
|
|
|
468014
468014
|
}
|
|
468015
468015
|
const mountPath = volumes[0];
|
|
468016
468016
|
try {
|
|
468017
|
-
const fileNames = await (0,
|
|
468017
|
+
const fileNames = await (0, import_promises134.readdir)(mountPath);
|
|
468018
468018
|
const appName = fileNames.find((item) => {
|
|
468019
468019
|
return typeof item === "string" && item.endsWith(".app");
|
|
468020
468020
|
});
|
|
@@ -468027,13 +468027,13 @@ async function installDMG(dmgPath, folderPath) {
|
|
|
468027
468027
|
(0, import_node_child_process4.spawnSync)("hdiutil", ["detach", mountPath, "-quiet"]);
|
|
468028
468028
|
}
|
|
468029
468029
|
}
|
|
468030
|
-
var import_node_child_process4, import_node_fs24,
|
|
468030
|
+
var import_node_child_process4, import_node_fs24, import_promises134, path96, import_node_stream6, import_debug8, debugFileUtil, internalConstantsForTesting;
|
|
468031
468031
|
var init_fileUtil = __esm({
|
|
468032
468032
|
"../../../node_modules/.pnpm/@puppeteer+browsers@2.13.0/node_modules/@puppeteer/browsers/lib/esm/fileUtil.js"() {
|
|
468033
468033
|
"use strict";
|
|
468034
468034
|
import_node_child_process4 = require("child_process");
|
|
468035
468035
|
import_node_fs24 = require("fs");
|
|
468036
|
-
|
|
468036
|
+
import_promises134 = require("fs/promises");
|
|
468037
468037
|
path96 = __toESM(require("path"), 1);
|
|
468038
468038
|
import_node_stream6 = require("stream");
|
|
468039
468039
|
import_debug8 = __toESM(require_src(), 1);
|
|
@@ -468096,7 +468096,7 @@ async function installWithProviders(options2) {
|
|
|
468096
468096
|
}
|
|
468097
468097
|
debugInstall(`Successfully got URL from ${provider.getName()}: ${url3}`);
|
|
468098
468098
|
if (!(0, import_node_fs25.existsSync)(browserRoot)) {
|
|
468099
|
-
await (0,
|
|
468099
|
+
await (0, import_promises135.mkdir)(browserRoot, { recursive: true });
|
|
468100
468100
|
}
|
|
468101
468101
|
return await installUrl(url3, options2, provider);
|
|
468102
468102
|
} catch (err) {
|
|
@@ -468169,7 +468169,7 @@ async function installUrl(url3, options2, provider) {
|
|
|
468169
468169
|
const browserRoot = cache2.browserRoot(options2.browser);
|
|
468170
468170
|
const archivePath = import_node_path34.default.join(browserRoot, `${options2.buildId}-${fileName}`);
|
|
468171
468171
|
if (!(0, import_node_fs25.existsSync)(browserRoot)) {
|
|
468172
|
-
await (0,
|
|
468172
|
+
await (0, import_promises135.mkdir)(browserRoot, { recursive: true });
|
|
468173
468173
|
}
|
|
468174
468174
|
if (!options2.unpack) {
|
|
468175
468175
|
if ((0, import_node_fs25.existsSync)(archivePath)) {
|
|
@@ -468233,7 +468233,7 @@ async function installUrl(url3, options2, provider) {
|
|
|
468233
468233
|
return installedBrowser;
|
|
468234
468234
|
} finally {
|
|
468235
468235
|
if ((0, import_node_fs25.existsSync)(archivePath)) {
|
|
468236
|
-
await (0,
|
|
468236
|
+
await (0, import_promises135.unlink)(archivePath);
|
|
468237
468237
|
}
|
|
468238
468238
|
}
|
|
468239
468239
|
}
|
|
@@ -468313,14 +468313,14 @@ function toMegabytes(bytes) {
|
|
|
468313
468313
|
const mb = bytes / 1e3 / 1e3;
|
|
468314
468314
|
return `${Math.round(mb * 10) / 10} MB`;
|
|
468315
468315
|
}
|
|
468316
|
-
var import_node_assert3, import_node_child_process5, import_node_fs25,
|
|
468316
|
+
var import_node_assert3, import_node_child_process5, import_node_fs25, import_promises135, import_node_os9, import_node_path34, import_progress, debugInstall, times;
|
|
468317
468317
|
var init_install = __esm({
|
|
468318
468318
|
"../../../node_modules/.pnpm/@puppeteer+browsers@2.13.0/node_modules/@puppeteer/browsers/lib/esm/install.js"() {
|
|
468319
468319
|
"use strict";
|
|
468320
468320
|
import_node_assert3 = __toESM(require("assert"), 1);
|
|
468321
468321
|
import_node_child_process5 = require("child_process");
|
|
468322
468322
|
import_node_fs25 = require("fs");
|
|
468323
|
-
|
|
468323
|
+
import_promises135 = require("fs/promises");
|
|
468324
468324
|
import_node_os9 = __toESM(require("os"), 1);
|
|
468325
468325
|
import_node_path34 = __toESM(require("path"), 1);
|
|
468326
468326
|
import_progress = __toESM(require_progress(), 1);
|
|
@@ -668443,7 +668443,7 @@ var AccessTokenPosthogManager = class {
|
|
|
668443
668443
|
properties: {
|
|
668444
668444
|
...event,
|
|
668445
668445
|
...event.properties,
|
|
668446
|
-
version: "5.33.
|
|
668446
|
+
version: "5.33.1",
|
|
668447
668447
|
usingAccessToken: true,
|
|
668448
668448
|
...getRunIdProperties()
|
|
668449
668449
|
}
|
|
@@ -668507,7 +668507,7 @@ var UserPosthogManager = class {
|
|
|
668507
668507
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
668508
668508
|
event: "CLI",
|
|
668509
668509
|
properties: {
|
|
668510
|
-
version: "5.33.
|
|
668510
|
+
version: "5.33.1",
|
|
668511
668511
|
...event,
|
|
668512
668512
|
...event.properties,
|
|
668513
668513
|
usingAccessToken: false,
|
|
@@ -820534,13 +820534,13 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context3 }) {
|
|
|
820534
820534
|
}
|
|
820535
820535
|
}
|
|
820536
820536
|
}
|
|
820537
|
-
const { writeFile:
|
|
820537
|
+
const { writeFile: writeFile95 } = await import("fs/promises");
|
|
820538
820538
|
const yamlContent = jsYaml.dump(parsed, {
|
|
820539
820539
|
indent: 2,
|
|
820540
820540
|
lineWidth: -1,
|
|
820541
820541
|
noRefs: true
|
|
820542
820542
|
});
|
|
820543
|
-
await
|
|
820543
|
+
await writeFile95(overrideFilePath, yamlContent, "utf-8");
|
|
820544
820544
|
context3.logger.info(`Removed ${validationResult.invalidCount} invalid AI examples from ai_examples_override.yml`);
|
|
820545
820545
|
return {
|
|
820546
820546
|
removedCount: validationResult.invalidCount,
|
|
@@ -860283,7 +860283,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
860283
860283
|
var LOGS_FOLDER_NAME = "logs";
|
|
860284
860284
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
860285
860285
|
function getCliSource() {
|
|
860286
|
-
const version7 = "5.33.
|
|
860286
|
+
const version7 = "5.33.1";
|
|
860287
860287
|
return `cli@${version7}`;
|
|
860288
860288
|
}
|
|
860289
860289
|
var DebugLogger = class {
|
|
@@ -879115,7 +879115,7 @@ var LegacyDocsPublisher = class {
|
|
|
879115
879115
|
previewId,
|
|
879116
879116
|
disableTemplates: void 0,
|
|
879117
879117
|
skipUpload,
|
|
879118
|
-
cliVersion: "5.33.
|
|
879118
|
+
cliVersion: "5.33.1",
|
|
879119
879119
|
loginCommand: "fern auth login"
|
|
879120
879120
|
});
|
|
879121
879121
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -882156,26 +882156,48 @@ function addReplayCommand(cli) {
|
|
|
882156
882156
|
}
|
|
882157
882157
|
|
|
882158
882158
|
// ../cli-v2/lib/commands/schema/command.js
|
|
882159
|
+
init_lib8();
|
|
882159
882160
|
init_lib6();
|
|
882161
|
+
var import_promises105 = require("fs/promises");
|
|
882160
882162
|
var SchemaCommand = class {
|
|
882161
882163
|
async handle(context3, args) {
|
|
882162
|
-
|
|
882163
|
-
|
|
882164
|
+
const schema2 = this.resolveSchema(args.name);
|
|
882165
|
+
if (args.output != null) {
|
|
882166
|
+
await this.writeToFile(context3, schema2, args.pretty, args.output);
|
|
882164
882167
|
return;
|
|
882165
882168
|
}
|
|
882166
|
-
|
|
882169
|
+
this.writeToStdout(context3, schema2, args.pretty);
|
|
882170
|
+
}
|
|
882171
|
+
resolveSchema(name2) {
|
|
882172
|
+
if (name2 == null) {
|
|
882173
|
+
return getFernYmlJsonSchema();
|
|
882174
|
+
}
|
|
882175
|
+
const schema2 = getJsonSchemaByName(name2);
|
|
882167
882176
|
if (schema2 == null) {
|
|
882168
882177
|
const available = getJsonSchemaNames().join(", ");
|
|
882169
882178
|
throw new CliError({
|
|
882170
|
-
message: `Unknown schema '${
|
|
882179
|
+
message: `Unknown schema '${name2}'. Available subsections: ${available}.`,
|
|
882171
882180
|
code: CliError.Code.ConfigError
|
|
882172
882181
|
});
|
|
882173
882182
|
}
|
|
882174
|
-
|
|
882183
|
+
return schema2;
|
|
882175
882184
|
}
|
|
882176
|
-
|
|
882185
|
+
formatJson(value2, pretty) {
|
|
882177
882186
|
const json3 = pretty ? JSON.stringify(value2, null, 2) : JSON.stringify(value2);
|
|
882178
|
-
|
|
882187
|
+
return `${json3}
|
|
882188
|
+
`;
|
|
882189
|
+
}
|
|
882190
|
+
writeToStdout(context3, value2, pretty) {
|
|
882191
|
+
context3.stdout.info(this.formatJson(value2, pretty).trimEnd());
|
|
882192
|
+
}
|
|
882193
|
+
async writeToFile(context3, value2, pretty, outputPath) {
|
|
882194
|
+
const absoluteOutputPath = resolve6(context3.cwd, outputPath);
|
|
882195
|
+
const outputDir = dirname6(absoluteOutputPath);
|
|
882196
|
+
if (!await doesPathExist(outputDir)) {
|
|
882197
|
+
await (0, import_promises105.mkdir)(outputDir, { recursive: true });
|
|
882198
|
+
}
|
|
882199
|
+
await (0, import_promises105.writeFile)(absoluteOutputPath, this.formatJson(value2, pretty));
|
|
882200
|
+
context3.stderr.info(source_default.green(`Wrote JSON Schema to ${absoluteOutputPath}`));
|
|
882179
882201
|
}
|
|
882180
882202
|
};
|
|
882181
882203
|
function addSchemaCommand(cli) {
|
|
@@ -882183,6 +882205,9 @@ function addSchemaCommand(cli) {
|
|
|
882183
882205
|
command2(cli, "schema [name]", "Print a JSON Schema for fern.yml (or a dot-delimited subsection like `sdks` or `sdks.targets`)", (context3, args) => cmd.handle(context3, args), (yargs) => yargs.positional("name", {
|
|
882184
882206
|
type: "string",
|
|
882185
882207
|
description: `Dot-delimited subsection of fern.yml. Omit to print the full schema. Available subsections: ${getJsonSchemaNames().join(", ")}.`
|
|
882208
|
+
}).option("output", {
|
|
882209
|
+
type: "string",
|
|
882210
|
+
description: "Write JSON Schema to this file instead of stdout"
|
|
882186
882211
|
}).option("pretty", {
|
|
882187
882212
|
type: "boolean",
|
|
882188
882213
|
default: true,
|
|
@@ -882451,13 +882476,13 @@ function addCheckCommand5(cli) {
|
|
|
882451
882476
|
init_lib4();
|
|
882452
882477
|
init_lib8();
|
|
882453
882478
|
init_lib6();
|
|
882454
|
-
var
|
|
882479
|
+
var import_promises122 = require("fs/promises");
|
|
882455
882480
|
init_js_yaml();
|
|
882456
882481
|
|
|
882457
882482
|
// ../cli-v2/lib/api/resolver/ApiSpecResolver.js
|
|
882458
882483
|
init_lib8();
|
|
882459
882484
|
init_lib6();
|
|
882460
|
-
var
|
|
882485
|
+
var import_promises106 = require("fs/promises");
|
|
882461
882486
|
var import_os11 = require("os");
|
|
882462
882487
|
var import_path81 = __toESM(require("path"), 1);
|
|
882463
882488
|
|
|
@@ -882534,9 +882559,9 @@ var ApiSpecResolver = class {
|
|
|
882534
882559
|
});
|
|
882535
882560
|
}
|
|
882536
882561
|
const extension4 = this.inferExtensionFromContent(content5);
|
|
882537
|
-
const tempDir2 = await (0,
|
|
882562
|
+
const tempDir2 = await (0, import_promises106.mkdtemp)(import_path81.default.join((0, import_os11.tmpdir)(), "fern-"));
|
|
882538
882563
|
const absoluteFilePath = AbsoluteFilePath2.of(import_path81.default.join(tempDir2, `spec${extension4}`));
|
|
882539
|
-
await (0,
|
|
882564
|
+
await (0, import_promises106.writeFile)(absoluteFilePath, content5, "utf-8");
|
|
882540
882565
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: "stdin" });
|
|
882541
882566
|
return {
|
|
882542
882567
|
absoluteFilePath,
|
|
@@ -882552,9 +882577,9 @@ var ApiSpecResolver = class {
|
|
|
882552
882577
|
async resolveUrl({ reference: reference4 }) {
|
|
882553
882578
|
const { content: content5, contentType } = await this.fetchContent({ url: reference4 });
|
|
882554
882579
|
const extension4 = this.inferExtension({ url: reference4, contentType });
|
|
882555
|
-
const tempDir2 = await (0,
|
|
882580
|
+
const tempDir2 = await (0, import_promises106.mkdtemp)(import_path81.default.join((0, import_os11.tmpdir)(), "fern-"));
|
|
882556
882581
|
const absoluteFilePath = AbsoluteFilePath2.of(import_path81.default.join(tempDir2, `spec${extension4}`));
|
|
882557
|
-
await (0,
|
|
882582
|
+
await (0, import_promises106.writeFile)(absoluteFilePath, content5, "utf-8");
|
|
882558
882583
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
882559
882584
|
return {
|
|
882560
882585
|
absoluteFilePath,
|
|
@@ -882570,7 +882595,7 @@ var ApiSpecResolver = class {
|
|
|
882570
882595
|
code: CliError.Code.ConfigError
|
|
882571
882596
|
});
|
|
882572
882597
|
}
|
|
882573
|
-
const content5 = await (0,
|
|
882598
|
+
const content5 = await (0, import_promises106.readFile)(absoluteFilePath, "utf-8");
|
|
882574
882599
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
882575
882600
|
return {
|
|
882576
882601
|
absoluteFilePath,
|
|
@@ -901269,7 +901294,7 @@ var DynamicSnippetsGenerator = class extends AbstractDynamicSnippetsGenerator {
|
|
|
901269
901294
|
|
|
901270
901295
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/csharp/DynamicSnippetsCsharpTestGenerator.js
|
|
901271
901296
|
init_lib8();
|
|
901272
|
-
var
|
|
901297
|
+
var import_promises107 = require("fs/promises");
|
|
901273
901298
|
var import_path83 = __toESM(require("path"), 1);
|
|
901274
901299
|
|
|
901275
901300
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/utils/convertEndpointSnippetRequest.js
|
|
@@ -901401,8 +901426,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
901401
901426
|
endpointId
|
|
901402
901427
|
});
|
|
901403
901428
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
901404
|
-
await (0,
|
|
901405
|
-
await (0,
|
|
901429
|
+
await (0, import_promises107.mkdir)(import_path83.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
901430
|
+
await (0, import_promises107.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
901406
901431
|
} catch (error50) {
|
|
901407
901432
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
901408
901433
|
}
|
|
@@ -901411,8 +901436,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
901411
901436
|
}
|
|
901412
901437
|
async initializeProject(outputDir) {
|
|
901413
901438
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
|
|
901414
|
-
await (0,
|
|
901415
|
-
await (0,
|
|
901439
|
+
await (0, import_promises107.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
901440
|
+
await (0, import_promises107.writeFile)(join8(absolutePathToOutputDir, RelativeFilePath2.of("Snippets.csproj")), PROJECT_FILE_CONTENT);
|
|
901416
901441
|
return absolutePathToOutputDir;
|
|
901417
901442
|
}
|
|
901418
901443
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -904864,7 +904889,7 @@ var DynamicSnippetsGenerator2 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
904864
904889
|
};
|
|
904865
904890
|
|
|
904866
904891
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/go/DynamicSnippetsGoTestGenerator.js
|
|
904867
|
-
var
|
|
904892
|
+
var import_promises108 = require("fs/promises");
|
|
904868
904893
|
var import_path85 = __toESM(require("path"), 1);
|
|
904869
904894
|
var DynamicSnippetsGoTestGenerator = class {
|
|
904870
904895
|
context;
|
|
@@ -904893,8 +904918,8 @@ var DynamicSnippetsGoTestGenerator = class {
|
|
|
904893
904918
|
endpointId
|
|
904894
904919
|
});
|
|
904895
904920
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
904896
|
-
await (0,
|
|
904897
|
-
await (0,
|
|
904921
|
+
await (0, import_promises108.mkdir)(import_path85.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
904922
|
+
await (0, import_promises108.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
904898
904923
|
} catch (error50) {
|
|
904899
904924
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
904900
904925
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -908291,7 +908316,7 @@ var DynamicSnippetsGenerator3 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
908291
908316
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/java/DynamicSnippetsJavaTestGenerator.js
|
|
908292
908317
|
init_lib12();
|
|
908293
908318
|
init_lib6();
|
|
908294
|
-
var
|
|
908319
|
+
var import_promises109 = require("fs/promises");
|
|
908295
908320
|
var import_path86 = __toESM(require("path"), 1);
|
|
908296
908321
|
var DynamicSnippetsJavaTestGenerator = class {
|
|
908297
908322
|
context;
|
|
@@ -908326,8 +908351,8 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
908326
908351
|
endpointId
|
|
908327
908352
|
});
|
|
908328
908353
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
908329
|
-
await (0,
|
|
908330
|
-
await (0,
|
|
908354
|
+
await (0, import_promises109.mkdir)(import_path86.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
908355
|
+
await (0, import_promises109.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
908331
908356
|
} catch (error50) {
|
|
908332
908357
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
908333
908358
|
}
|
|
@@ -908354,7 +908379,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
908354
908379
|
const reportsPath = join8(outputDir, RelativeFilePath2.of("reports"));
|
|
908355
908380
|
const buildReportsExists = await doesPathExist(buildReportsPath, "directory");
|
|
908356
908381
|
if (buildReportsExists) {
|
|
908357
|
-
await (0,
|
|
908382
|
+
await (0, import_promises109.cp)(buildReportsPath, reportsPath, { recursive: true });
|
|
908358
908383
|
this.context.logger.info("Gradle profiling report copied to reports/");
|
|
908359
908384
|
} else {
|
|
908360
908385
|
this.context.logger.info("No profiling report found in build/reports/");
|
|
@@ -908368,7 +908393,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
908368
908393
|
}
|
|
908369
908394
|
async initializeProject(outputDir) {
|
|
908370
908395
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("src/main/java/com/snippets"));
|
|
908371
|
-
await (0,
|
|
908396
|
+
await (0, import_promises109.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
908372
908397
|
return absolutePathToOutputDir;
|
|
908373
908398
|
}
|
|
908374
908399
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -911833,7 +911858,7 @@ var DynamicSnippetsGenerator4 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
911833
911858
|
};
|
|
911834
911859
|
|
|
911835
911860
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/php/DynamicSnippetsPhpTestGenerator.js
|
|
911836
|
-
var
|
|
911861
|
+
var import_promises110 = require("fs/promises");
|
|
911837
911862
|
var import_path87 = __toESM(require("path"), 1);
|
|
911838
911863
|
var DynamicSnippetsPhpTestGenerator = class {
|
|
911839
911864
|
context;
|
|
@@ -911862,8 +911887,8 @@ var DynamicSnippetsPhpTestGenerator = class {
|
|
|
911862
911887
|
endpointId
|
|
911863
911888
|
});
|
|
911864
911889
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
911865
|
-
await (0,
|
|
911866
|
-
await (0,
|
|
911890
|
+
await (0, import_promises110.mkdir)(import_path87.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
911891
|
+
await (0, import_promises110.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
911867
911892
|
} catch (error50) {
|
|
911868
911893
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
911869
911894
|
}
|
|
@@ -915120,7 +915145,7 @@ var DynamicSnippetsGenerator5 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
915120
915145
|
};
|
|
915121
915146
|
|
|
915122
915147
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/python/DynamicSnippetsPythonTestGenerator.js
|
|
915123
|
-
var
|
|
915148
|
+
var import_promises111 = require("fs/promises");
|
|
915124
915149
|
var import_path88 = __toESM(require("path"), 1);
|
|
915125
915150
|
var DynamicSnippetsPythonTestGenerator = class {
|
|
915126
915151
|
context;
|
|
@@ -915149,8 +915174,8 @@ var DynamicSnippetsPythonTestGenerator = class {
|
|
|
915149
915174
|
endpointId
|
|
915150
915175
|
});
|
|
915151
915176
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
915152
|
-
await (0,
|
|
915153
|
-
await (0,
|
|
915177
|
+
await (0, import_promises111.mkdir)(import_path88.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
915178
|
+
await (0, import_promises111.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
915154
915179
|
} catch (error50) {
|
|
915155
915180
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
915156
915181
|
}
|
|
@@ -918024,7 +918049,7 @@ var DynamicSnippetsGenerator6 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
918024
918049
|
};
|
|
918025
918050
|
|
|
918026
918051
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/ruby/DynamicSnippetsRubyTestGenerator.js
|
|
918027
|
-
var
|
|
918052
|
+
var import_promises112 = require("fs/promises");
|
|
918028
918053
|
var import_path89 = __toESM(require("path"), 1);
|
|
918029
918054
|
var DynamicSnippetsRubyTestGenerator = class {
|
|
918030
918055
|
context;
|
|
@@ -918053,8 +918078,8 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
918053
918078
|
endpointId
|
|
918054
918079
|
});
|
|
918055
918080
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
918056
|
-
await (0,
|
|
918057
|
-
await (0,
|
|
918081
|
+
await (0, import_promises112.mkdir)(import_path89.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
918082
|
+
await (0, import_promises112.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
918058
918083
|
} catch (error50) {
|
|
918059
918084
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
918060
918085
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -918070,7 +918095,7 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
918070
918095
|
};
|
|
918071
918096
|
|
|
918072
918097
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/rust/DynamicSnippetsRustTestGenerator.js
|
|
918073
|
-
var
|
|
918098
|
+
var import_promises113 = require("fs/promises");
|
|
918074
918099
|
var import_node_path25 = __toESM(require("path"), 1);
|
|
918075
918100
|
init_lib8();
|
|
918076
918101
|
|
|
@@ -923304,8 +923329,8 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
923304
923329
|
absolutePathToOutputDir,
|
|
923305
923330
|
idx
|
|
923306
923331
|
});
|
|
923307
|
-
await (0,
|
|
923308
|
-
await (0,
|
|
923332
|
+
await (0, import_promises113.mkdir)(import_node_path25.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
923333
|
+
await (0, import_promises113.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
923309
923334
|
} catch (error50) {
|
|
923310
923335
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
923311
923336
|
}
|
|
@@ -923314,7 +923339,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
923314
923339
|
}
|
|
923315
923340
|
async initializeProject(outputDir) {
|
|
923316
923341
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("dynamic-snippets"));
|
|
923317
|
-
await (0,
|
|
923342
|
+
await (0, import_promises113.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
923318
923343
|
return absolutePathToOutputDir;
|
|
923319
923344
|
}
|
|
923320
923345
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -923323,7 +923348,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
923323
923348
|
};
|
|
923324
923349
|
|
|
923325
923350
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/swift/DynamicSnippetsSwiftTestGenerator.js
|
|
923326
|
-
var
|
|
923351
|
+
var import_promises114 = require("fs/promises");
|
|
923327
923352
|
var import_node_path26 = __toESM(require("path"), 1);
|
|
923328
923353
|
init_lib8();
|
|
923329
923354
|
|
|
@@ -927902,8 +927927,8 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
927902
927927
|
absolutePathToOutputDir,
|
|
927903
927928
|
idx
|
|
927904
927929
|
});
|
|
927905
|
-
await (0,
|
|
927906
|
-
await (0,
|
|
927930
|
+
await (0, import_promises114.mkdir)(import_node_path26.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
927931
|
+
await (0, import_promises114.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
927907
927932
|
} catch (error50) {
|
|
927908
927933
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
927909
927934
|
}
|
|
@@ -927912,7 +927937,7 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
927912
927937
|
}
|
|
927913
927938
|
async initializeProject(outputDir) {
|
|
927914
927939
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
|
|
927915
|
-
await (0,
|
|
927940
|
+
await (0, import_promises114.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
927916
927941
|
return absolutePathToOutputDir;
|
|
927917
927942
|
}
|
|
927918
927943
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -930241,7 +930266,7 @@ var DynamicSnippetsGenerator9 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
930241
930266
|
};
|
|
930242
930267
|
|
|
930243
930268
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/typescript/DynamicSnippetsTypeScriptTestGenerator.js
|
|
930244
|
-
var
|
|
930269
|
+
var import_promises115 = require("fs/promises");
|
|
930245
930270
|
var import_path90 = __toESM(require("path"), 1);
|
|
930246
930271
|
var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
930247
930272
|
context;
|
|
@@ -930270,8 +930295,8 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
|
930270
930295
|
endpointId
|
|
930271
930296
|
});
|
|
930272
930297
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
930273
|
-
await (0,
|
|
930274
|
-
await (0,
|
|
930298
|
+
await (0, import_promises115.mkdir)(import_path90.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
930299
|
+
await (0, import_promises115.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
930275
930300
|
} catch (error50) {
|
|
930276
930301
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
930277
930302
|
}
|
|
@@ -930381,7 +930406,7 @@ async function generateDynamicSnippetTests({ context: context3, ir: ir11, config
|
|
|
930381
930406
|
init_lib8();
|
|
930382
930407
|
var import_autoversion3 = __toESM(require_autoversion(), 1);
|
|
930383
930408
|
var import_serialization = __toESM(require_serialization3(), 1);
|
|
930384
|
-
var
|
|
930409
|
+
var import_promises118 = require("fs/promises");
|
|
930385
930410
|
var path87 = __toESM(require("path"), 1);
|
|
930386
930411
|
var import_path93 = require("path");
|
|
930387
930412
|
var import_tmp_promise14 = __toESM(require_tmp_promise(), 1);
|
|
@@ -930869,7 +930894,7 @@ var import_autoversion2 = __toESM(require_autoversion(), 1);
|
|
|
930869
930894
|
init_lib12();
|
|
930870
930895
|
init_lib6();
|
|
930871
930896
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
930872
|
-
var
|
|
930897
|
+
var import_promises116 = require("fs/promises");
|
|
930873
930898
|
var import_os12 = require("os");
|
|
930874
930899
|
var import_path91 = require("path");
|
|
930875
930900
|
var import_semver12 = __toESM(require_semver2(), 1);
|
|
@@ -930976,7 +931001,7 @@ var LocalTaskHandler = class {
|
|
|
930976
931001
|
try {
|
|
930977
931002
|
this.context.logger.info("Analyzing SDK changes for automatic semantic versioning");
|
|
930978
931003
|
diffFile = await this.generateDiffFile();
|
|
930979
|
-
const diffContent = await (0,
|
|
931004
|
+
const diffContent = await (0, import_promises116.readFile)(diffFile, "utf-8");
|
|
930980
931005
|
if (diffContent.trim().length === 0) {
|
|
930981
931006
|
this.context.logger.info("No changes detected in generated SDK");
|
|
930982
931007
|
return null;
|
|
@@ -931181,7 +931206,7 @@ var LocalTaskHandler = class {
|
|
|
931181
931206
|
} finally {
|
|
931182
931207
|
if (diffFile) {
|
|
931183
931208
|
try {
|
|
931184
|
-
await (0,
|
|
931209
|
+
await (0, import_promises116.rm)(diffFile);
|
|
931185
931210
|
} catch (cleanupError) {
|
|
931186
931211
|
this.context.logger.warn(`Failed to delete temp diff file: ${diffFile}`, String(cleanupError));
|
|
931187
931212
|
}
|
|
@@ -931361,7 +931386,7 @@ var LocalTaskHandler = class {
|
|
|
931361
931386
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
931362
931387
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
931363
931388
|
const pathsToPreserve = await this.getPathsToPreserve(fernIgnorePaths);
|
|
931364
|
-
await (0,
|
|
931389
|
+
await (0, import_promises116.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
931365
931390
|
await this.runThrowawayGitCommand(["init"], tmpOutputResolutionDir);
|
|
931366
931391
|
await this.runThrowawayGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
931367
931392
|
await this.runThrowawayGitCommand([
|
|
@@ -931381,17 +931406,17 @@ var LocalTaskHandler = class {
|
|
|
931381
931406
|
await this.runThrowawayGitCommand(["reset", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
931382
931407
|
await this.runThrowawayGitCommand(["clean", "-fd", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
931383
931408
|
await this.runThrowawayGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
931384
|
-
await (0,
|
|
931385
|
-
await (0,
|
|
931386
|
-
await (0,
|
|
931409
|
+
await (0, import_promises116.rm)(join8(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), { recursive: true });
|
|
931410
|
+
await (0, import_promises116.rm)(this.absolutePathToLocalOutput, { recursive: true });
|
|
931411
|
+
await (0, import_promises116.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true });
|
|
931387
931412
|
}
|
|
931388
931413
|
async copyGeneratedFilesNoFernIgnorePreservingGit() {
|
|
931389
|
-
const contents = await (0,
|
|
931414
|
+
const contents = await (0, import_promises116.readdir)(this.absolutePathToLocalOutput);
|
|
931390
931415
|
const itemsToPreserve = [".git"];
|
|
931391
931416
|
if (await this.generatedOutputMissingReadme()) {
|
|
931392
931417
|
itemsToPreserve.push("README.md");
|
|
931393
931418
|
}
|
|
931394
|
-
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0,
|
|
931419
|
+
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0, import_promises116.rm)(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(item)), {
|
|
931395
931420
|
force: true,
|
|
931396
931421
|
recursive: true
|
|
931397
931422
|
})));
|
|
@@ -931399,11 +931424,11 @@ var LocalTaskHandler = class {
|
|
|
931399
931424
|
}
|
|
931400
931425
|
async copyGeneratedFilesNoFernIgnoreDeleteAll() {
|
|
931401
931426
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
931402
|
-
await (0,
|
|
931427
|
+
await (0, import_promises116.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
931403
931428
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
931404
931429
|
}
|
|
931405
931430
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
931406
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
931431
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises116.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
931407
931432
|
if (firstLocalOutputItem == null) {
|
|
931408
931433
|
return;
|
|
931409
931434
|
}
|
|
@@ -931411,15 +931436,15 @@ var LocalTaskHandler = class {
|
|
|
931411
931436
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
931412
931437
|
await (0, import_decompress2.default)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(firstLocalOutputItem)), outputPath);
|
|
931413
931438
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
931414
|
-
await (0,
|
|
931439
|
+
await (0, import_promises116.cp)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join8(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true });
|
|
931415
931440
|
}
|
|
931416
931441
|
} else {
|
|
931417
|
-
await (0,
|
|
931442
|
+
await (0, import_promises116.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true });
|
|
931418
931443
|
}
|
|
931419
931444
|
}
|
|
931420
931445
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
931421
931446
|
this.context.logger.debug(`Copying generated snippets to ${absolutePathToLocalSnippetJSON}`);
|
|
931422
|
-
await (0,
|
|
931447
|
+
await (0, import_promises116.cp)(absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON);
|
|
931423
931448
|
}
|
|
931424
931449
|
/**
|
|
931425
931450
|
* Checks whether the generated output is missing README.md.
|
|
@@ -931428,7 +931453,7 @@ var LocalTaskHandler = class {
|
|
|
931428
931453
|
*/
|
|
931429
931454
|
async generatedOutputMissingReadme() {
|
|
931430
931455
|
try {
|
|
931431
|
-
const contents = await (0,
|
|
931456
|
+
const contents = await (0, import_promises116.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
931432
931457
|
if (contents.length === 1 && contents[0] != null && contents[0].endsWith(".zip")) {
|
|
931433
931458
|
return false;
|
|
931434
931459
|
}
|
|
@@ -931478,13 +931503,13 @@ var LocalTaskHandler = class {
|
|
|
931478
931503
|
async readPriorChangelog(maxEntries) {
|
|
931479
931504
|
const MAX_CHANGELOG_SIZE = 2048;
|
|
931480
931505
|
try {
|
|
931481
|
-
const files = await (0,
|
|
931506
|
+
const files = await (0, import_promises116.readdir)(this.absolutePathToLocalOutput);
|
|
931482
931507
|
const changelogFile = files.find((f4) => f4.toLowerCase() === "changelog.md");
|
|
931483
931508
|
if (!changelogFile) {
|
|
931484
931509
|
return "";
|
|
931485
931510
|
}
|
|
931486
931511
|
const changelogPath = join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(changelogFile));
|
|
931487
|
-
const content5 = await (0,
|
|
931512
|
+
const content5 = await (0, import_promises116.readFile)(changelogPath, "utf-8");
|
|
931488
931513
|
if (content5.trim().length === 0) {
|
|
931489
931514
|
return "";
|
|
931490
931515
|
}
|
|
@@ -931562,7 +931587,7 @@ var LocalTaskHandler = class {
|
|
|
931562
931587
|
|
|
931563
931588
|
// ../generation/local-generation/local-workspace-runner/lib/rawSpecs.js
|
|
931564
931589
|
init_lib4();
|
|
931565
|
-
var
|
|
931590
|
+
var import_promises117 = require("fs/promises");
|
|
931566
931591
|
init_js_yaml();
|
|
931567
931592
|
var import_path92 = __toESM(require("path"), 1);
|
|
931568
931593
|
async function collectRawSpecs({ specs, hostOutputDir, containerBaseDir, context: context3, audiences }) {
|
|
@@ -931617,7 +931642,7 @@ async function resolveOpenAPIOrAsyncAPI({ spec, hostOutputDir, containerBaseDir,
|
|
|
931617
931642
|
});
|
|
931618
931643
|
}
|
|
931619
931644
|
resolved = filterSpec(resolved, audiences);
|
|
931620
|
-
await (0,
|
|
931645
|
+
await (0, import_promises117.writeFile)(import_path92.default.join(hostOutputDir, filename), JSON.stringify(resolved));
|
|
931621
931646
|
context3.logger.debug(`Resolved ${isAsync2 ? "AsyncAPI" : "OpenAPI"} spec ${spec.absoluteFilepath} -> ${filename}`);
|
|
931622
931647
|
return {
|
|
931623
931648
|
type: isAsync2 ? "asyncapi" : "openapi",
|
|
@@ -931626,7 +931651,7 @@ async function resolveOpenAPIOrAsyncAPI({ spec, hostOutputDir, containerBaseDir,
|
|
|
931626
931651
|
}
|
|
931627
931652
|
async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context: context3, index: index3 }) {
|
|
931628
931653
|
const filename = `spec-${index3}.json`;
|
|
931629
|
-
const rawContent = await (0,
|
|
931654
|
+
const rawContent = await (0, import_promises117.readFile)(spec.absoluteFilepath, "utf-8");
|
|
931630
931655
|
let parsed;
|
|
931631
931656
|
try {
|
|
931632
931657
|
parsed = JSON.parse(rawContent);
|
|
@@ -931636,7 +931661,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
931636
931661
|
let result = parsed;
|
|
931637
931662
|
const overrides = normalizeOverrides(spec.absoluteFilepathToOverrides);
|
|
931638
931663
|
for (const overridePath of overrides) {
|
|
931639
|
-
const overrideContent = await (0,
|
|
931664
|
+
const overrideContent = await (0, import_promises117.readFile)(overridePath, "utf-8");
|
|
931640
931665
|
let overrideParsed;
|
|
931641
931666
|
try {
|
|
931642
931667
|
overrideParsed = JSON.parse(overrideContent);
|
|
@@ -931648,7 +931673,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
931648
931673
|
overrides: overrideParsed
|
|
931649
931674
|
});
|
|
931650
931675
|
}
|
|
931651
|
-
await (0,
|
|
931676
|
+
await (0, import_promises117.writeFile)(import_path92.default.join(hostOutputDir, filename), JSON.stringify(result));
|
|
931652
931677
|
context3.logger.debug(`Resolved OpenRPC spec ${spec.absoluteFilepath} -> ${filename}`);
|
|
931653
931678
|
return {
|
|
931654
931679
|
type: "openrpc",
|
|
@@ -931658,7 +931683,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
931658
931683
|
async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: index3 }) {
|
|
931659
931684
|
const dirName = `proto-${index3}`;
|
|
931660
931685
|
const destDir = import_path92.default.join(hostOutputDir, dirName);
|
|
931661
|
-
await (0,
|
|
931686
|
+
await (0, import_promises117.cp)(spec.absoluteFilepathToProtobufRoot, destDir, { recursive: true });
|
|
931662
931687
|
const entry = {
|
|
931663
931688
|
type: "protobuf",
|
|
931664
931689
|
specPath: toContainerPath(dirName, containerBaseDir)
|
|
@@ -931668,7 +931693,7 @@ async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: inde
|
|
|
931668
931693
|
entry.overridePaths = [];
|
|
931669
931694
|
for (const [i9, override] of overrides.entries()) {
|
|
931670
931695
|
const overrideName = `proto-${index3}-override-${i9}${import_path92.default.extname(override)}`;
|
|
931671
|
-
await (0,
|
|
931696
|
+
await (0, import_promises117.copyFile)(override, import_path92.default.join(hostOutputDir, overrideName));
|
|
931672
931697
|
entry.overridePaths.push(toContainerPath(overrideName, containerBaseDir));
|
|
931673
931698
|
}
|
|
931674
931699
|
}
|
|
@@ -931677,7 +931702,7 @@ async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: inde
|
|
|
931677
931702
|
async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index3 }) {
|
|
931678
931703
|
const ext2 = import_path92.default.extname(spec.absoluteFilepath) || ".graphql";
|
|
931679
931704
|
const filename = `spec-${index3}${ext2}`;
|
|
931680
|
-
await (0,
|
|
931705
|
+
await (0, import_promises117.copyFile)(spec.absoluteFilepath, import_path92.default.join(hostOutputDir, filename));
|
|
931681
931706
|
const entry = {
|
|
931682
931707
|
type: "graphql",
|
|
931683
931708
|
specPath: toContainerPath(filename, containerBaseDir)
|
|
@@ -931687,7 +931712,7 @@ async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index
|
|
|
931687
931712
|
entry.overridePaths = [];
|
|
931688
931713
|
for (const [i9, override] of overrides.entries()) {
|
|
931689
931714
|
const overrideName = `graphql-${index3}-override-${i9}${import_path92.default.extname(override)}`;
|
|
931690
|
-
await (0,
|
|
931715
|
+
await (0, import_promises117.copyFile)(override, import_path92.default.join(hostOutputDir, overrideName));
|
|
931691
931716
|
entry.overridePaths.push(toContainerPath(overrideName, containerBaseDir));
|
|
931692
931717
|
}
|
|
931693
931718
|
}
|
|
@@ -931695,7 +931720,7 @@ async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index
|
|
|
931695
931720
|
}
|
|
931696
931721
|
async function isAsyncAPISpec(filepath) {
|
|
931697
931722
|
try {
|
|
931698
|
-
const content5 = await (0,
|
|
931723
|
+
const content5 = await (0, import_promises117.readFile)(filepath, "utf-8");
|
|
931699
931724
|
return content5.includes("asyncapi");
|
|
931700
931725
|
} catch {
|
|
931701
931726
|
return false;
|
|
@@ -931830,24 +931855,24 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
931830
931855
|
context3.logger.debug("Wrote IR to: " + absolutePathToIr);
|
|
931831
931856
|
const configJsonFile = (0, import_path93.join)(workspaceTempDir.path, GENERATOR_CONFIG_FILENAME);
|
|
931832
931857
|
const absolutePathToWriteConfigJson = AbsoluteFilePath2.of(configJsonFile);
|
|
931833
|
-
await (0,
|
|
931858
|
+
await (0, import_promises118.writeFile)(configJsonFile, "");
|
|
931834
931859
|
context3.logger.debug("Will write config.json to: " + absolutePathToWriteConfigJson);
|
|
931835
931860
|
const tmpOutputDirectory = (0, import_path93.join)(workspaceTempDir.path, CODEGEN_OUTPUT_DIRECTORY_NAME);
|
|
931836
931861
|
const absolutePathToTmpOutputDirectory = AbsoluteFilePath2.of(tmpOutputDirectory);
|
|
931837
|
-
await (0,
|
|
931862
|
+
await (0, import_promises118.mkdir)(tmpOutputDirectory, { recursive: true });
|
|
931838
931863
|
context3.logger.debug("Will write output to: " + absolutePathToTmpOutputDirectory);
|
|
931839
931864
|
let absolutePathToTmpSnippetJSON = void 0;
|
|
931840
931865
|
if (absolutePathToLocalSnippetJSON != null) {
|
|
931841
931866
|
const snippetJsonFile = (0, import_path93.join)(workspaceTempDir.path, "snippet.json");
|
|
931842
931867
|
absolutePathToTmpSnippetJSON = AbsoluteFilePath2.of(snippetJsonFile);
|
|
931843
|
-
await (0,
|
|
931868
|
+
await (0, import_promises118.writeFile)(snippetJsonFile, "");
|
|
931844
931869
|
context3.logger.debug("Will write snippet.json to: " + absolutePathToTmpSnippetJSON);
|
|
931845
931870
|
}
|
|
931846
931871
|
let absolutePathToTmpSnippetTemplatesJSON = void 0;
|
|
931847
931872
|
if (absolutePathToLocalSnippetTemplateJSON != null) {
|
|
931848
931873
|
const snippetTemplatesJsonFile = (0, import_path93.join)(workspaceTempDir.path, SNIPPET_TEMPLATES_JSON_FILENAME);
|
|
931849
931874
|
absolutePathToTmpSnippetTemplatesJSON = AbsoluteFilePath2.of(snippetTemplatesJsonFile);
|
|
931850
|
-
await (0,
|
|
931875
|
+
await (0, import_promises118.writeFile)(snippetTemplatesJsonFile, "");
|
|
931851
931876
|
context3.logger.debug("Will write snippet-templates.json to: " + absolutePathToTmpSnippetTemplatesJSON);
|
|
931852
931877
|
}
|
|
931853
931878
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
@@ -931887,7 +931912,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
931887
931912
|
publishToRegistry,
|
|
931888
931913
|
paths
|
|
931889
931914
|
});
|
|
931890
|
-
await (0,
|
|
931915
|
+
await (0, import_promises118.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config5), void 0, 4));
|
|
931891
931916
|
const absolutePathToLicenseFile = extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig);
|
|
931892
931917
|
const sourceMounts = workspace.getSources().filter((source2) => source2.type === "protobuf").map((source2) => ({
|
|
931893
931918
|
hostPath: source2.absoluteFilePath,
|
|
@@ -931895,7 +931920,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
931895
931920
|
}));
|
|
931896
931921
|
if (rawApiSpecs != null && rawApiSpecs.length > 0) {
|
|
931897
931922
|
const rawSpecsDir = (0, import_path93.join)(workspaceTempDir.path, SPECS_DIRECTORY_NAME);
|
|
931898
|
-
await (0,
|
|
931923
|
+
await (0, import_promises118.mkdir)(rawSpecsDir, { recursive: true });
|
|
931899
931924
|
const containerSpecsDir = CONTAINER_SPECS_DIRECTORY;
|
|
931900
931925
|
const manifest = await collectRawSpecs({
|
|
931901
931926
|
specs: rawApiSpecs,
|
|
@@ -931904,7 +931929,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
931904
931929
|
context: context3,
|
|
931905
931930
|
audiences
|
|
931906
931931
|
});
|
|
931907
|
-
await (0,
|
|
931932
|
+
await (0, import_promises118.writeFile)((0, import_path93.join)(rawSpecsDir, SPECS_MANIFEST_FILENAME), JSON.stringify(manifest, void 0, 4));
|
|
931908
931933
|
context3.logger.debug(`Wrote raw specs manifest with ${manifest.specs.length} spec(s) to ${rawSpecsDir}`);
|
|
931909
931934
|
sourceMounts.push({
|
|
931910
931935
|
hostPath: AbsoluteFilePath2.of(rawSpecsDir),
|
|
@@ -932648,14 +932673,14 @@ async function runVerifyPipeline({ outputDir, generatorName, generatorVersion, c
|
|
|
932648
932673
|
// ../cli-v2/lib/sdk/generator/LegacyLocalGenerationRunner.js
|
|
932649
932674
|
init_lib5();
|
|
932650
932675
|
init_lib6();
|
|
932651
|
-
var
|
|
932676
|
+
var import_promises120 = require("fs/promises");
|
|
932652
932677
|
|
|
932653
932678
|
// ../cli-v2/lib/sdk/adapter/LegacyGeneratorInvocationAdapter.js
|
|
932654
932679
|
init_lib4();
|
|
932655
932680
|
init_lib8();
|
|
932656
932681
|
init_lib9();
|
|
932657
932682
|
init_lib6();
|
|
932658
|
-
var
|
|
932683
|
+
var import_promises119 = require("fs/promises");
|
|
932659
932684
|
var LegacyGeneratorInvocationAdapter = class {
|
|
932660
932685
|
context;
|
|
932661
932686
|
constructor(config5) {
|
|
@@ -932909,7 +932934,7 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
932909
932934
|
code: CliError.Code.InternalError
|
|
932910
932935
|
});
|
|
932911
932936
|
}
|
|
932912
|
-
const contents = await (0,
|
|
932937
|
+
const contents = await (0, import_promises119.readFile)(absolutePath, "utf-8");
|
|
932913
932938
|
return api_exports4.GithubLicense.custom({ contents });
|
|
932914
932939
|
}
|
|
932915
932940
|
buildReadme(target) {
|
|
@@ -933135,7 +933160,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
933135
933160
|
});
|
|
933136
933161
|
if (args.target.output.path != null && generatorInvocation.absolutePathToLocalOutput != null) {
|
|
933137
933162
|
const snippetPath = join8(generatorInvocation.absolutePathToLocalOutput, RelativeFilePath2.of(SNIPPET_JSON_FILENAME));
|
|
933138
|
-
await (0,
|
|
933163
|
+
await (0, import_promises120.rm)(snippetPath, { force: true });
|
|
933139
933164
|
}
|
|
933140
933165
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
933141
933166
|
return {
|
|
@@ -933154,7 +933179,7 @@ init_lib4();
|
|
|
933154
933179
|
init_lib8();
|
|
933155
933180
|
init_lib5();
|
|
933156
933181
|
init_lib6();
|
|
933157
|
-
var
|
|
933182
|
+
var import_promises121 = require("fs/promises");
|
|
933158
933183
|
var import_os14 = require("os");
|
|
933159
933184
|
var LegacyRemoteGenerationRunner = class {
|
|
933160
933185
|
context;
|
|
@@ -933213,13 +933238,13 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
933213
933238
|
const previewOutputDirectory = join8(absolutePathToPreview, RelativeFilePath2.of(generatorName));
|
|
933214
933239
|
const targetOutputDirectory = generatorInvocation.absolutePathToLocalOutput;
|
|
933215
933240
|
if (targetOutputDirectory != null) {
|
|
933216
|
-
await (0,
|
|
933217
|
-
await (0,
|
|
933241
|
+
await (0, import_promises121.cp)(previewOutputDirectory, targetOutputDirectory, { recursive: true });
|
|
933242
|
+
await (0, import_promises121.rm)(join8(targetOutputDirectory, RelativeFilePath2.of(".git")), {
|
|
933218
933243
|
recursive: true,
|
|
933219
933244
|
force: true
|
|
933220
933245
|
});
|
|
933221
933246
|
}
|
|
933222
|
-
await (0,
|
|
933247
|
+
await (0, import_promises121.rm)(absolutePathToPreview, { recursive: true, force: true });
|
|
933223
933248
|
}
|
|
933224
933249
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
933225
933250
|
return {
|
|
@@ -933248,7 +933273,7 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
933248
933273
|
}
|
|
933249
933274
|
async getAbsolutePathToPreview(args) {
|
|
933250
933275
|
if (this.isLocalGitCombo(args)) {
|
|
933251
|
-
const tmpPreviewDirectory = await (0,
|
|
933276
|
+
const tmpPreviewDirectory = await (0, import_promises121.mkdtemp)(join8(AbsoluteFilePath2.of((0, import_os14.tmpdir)()), RelativeFilePath2.of("fern-preview-")));
|
|
933252
933277
|
return AbsoluteFilePath2.of(tmpPreviewDirectory);
|
|
933253
933278
|
}
|
|
933254
933279
|
if (!args.preview) {
|
|
@@ -933984,7 +934009,7 @@ Example:
|
|
|
933984
934009
|
if (!exists2) {
|
|
933985
934010
|
return { shouldProceed: true };
|
|
933986
934011
|
}
|
|
933987
|
-
const files = await (0,
|
|
934012
|
+
const files = await (0, import_promises122.readdir)(outputPath);
|
|
933988
934013
|
if (files.length === 0) {
|
|
933989
934014
|
return { shouldProceed: true };
|
|
933990
934015
|
}
|
|
@@ -934394,7 +934419,7 @@ init_lib4();
|
|
|
934394
934419
|
init_lib12();
|
|
934395
934420
|
init_lib6();
|
|
934396
934421
|
var import_fs35 = require("fs");
|
|
934397
|
-
var
|
|
934422
|
+
var import_promises123 = require("fs/promises");
|
|
934398
934423
|
var import_path96 = require("path");
|
|
934399
934424
|
var import_semver13 = __toESM(require_semver2(), 1);
|
|
934400
934425
|
var import_url8 = require("url");
|
|
@@ -934504,7 +934529,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
934504
934529
|
}
|
|
934505
934530
|
this.migrationsInstallPromise = (async () => {
|
|
934506
934531
|
const cacheDir = this.cachePath;
|
|
934507
|
-
await (0,
|
|
934532
|
+
await (0, import_promises123.mkdir)(cacheDir, { recursive: true });
|
|
934508
934533
|
const npmCacheDir = (0, import_path96.join)(cacheDir, ".npm-cache");
|
|
934509
934534
|
const packageDir = (0, import_path96.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
|
|
934510
934535
|
const packageJsonPath = (0, import_path96.join)(packageDir, "package.json");
|
|
@@ -934521,7 +934546,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
934521
934546
|
"--no-audit",
|
|
934522
934547
|
"--no-fund"
|
|
934523
934548
|
], { doNotPipeOutput: true });
|
|
934524
|
-
const packageJsonContent = await (0,
|
|
934549
|
+
const packageJsonContent = await (0, import_promises123.readFile)(packageJsonPath, "utf-8");
|
|
934525
934550
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
934526
934551
|
if (packageJson2.main == null) {
|
|
934527
934552
|
throw new CliError({
|
|
@@ -934566,7 +934591,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
934566
934591
|
const myPid = String(process.pid);
|
|
934567
934592
|
while (true) {
|
|
934568
934593
|
try {
|
|
934569
|
-
const fh = await (0,
|
|
934594
|
+
const fh = await (0, import_promises123.open)(lockPath, "wx");
|
|
934570
934595
|
await fh.writeFile(myPid);
|
|
934571
934596
|
await fh.close();
|
|
934572
934597
|
const exitHandler = () => {
|
|
@@ -934583,9 +934608,9 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
934583
934608
|
return async () => {
|
|
934584
934609
|
process.removeListener("exit", exitHandler);
|
|
934585
934610
|
try {
|
|
934586
|
-
const currentContent = await (0,
|
|
934611
|
+
const currentContent = await (0, import_promises123.readFile)(lockPath, "utf-8");
|
|
934587
934612
|
if (currentContent.trim() === myPid) {
|
|
934588
|
-
await (0,
|
|
934613
|
+
await (0, import_promises123.unlink)(lockPath);
|
|
934589
934614
|
} else {
|
|
934590
934615
|
logger4.debug(`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`);
|
|
934591
934616
|
}
|
|
@@ -934599,14 +934624,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
934599
934624
|
throw err;
|
|
934600
934625
|
}
|
|
934601
934626
|
try {
|
|
934602
|
-
const lockContent = await (0,
|
|
934627
|
+
const lockContent = await (0, import_promises123.readFile)(lockPath, "utf-8");
|
|
934603
934628
|
const lockPid = Number(lockContent.trim());
|
|
934604
|
-
const lockStat = await (0,
|
|
934629
|
+
const lockStat = await (0, import_promises123.stat)(lockPath);
|
|
934605
934630
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
934606
934631
|
if (lockAge > _GeneratorMigrator.LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !_GeneratorMigrator.isProcessAlive(lockPid)) {
|
|
934607
934632
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
934608
934633
|
try {
|
|
934609
|
-
await (0,
|
|
934634
|
+
await (0, import_promises123.unlink)(lockPath);
|
|
934610
934635
|
} catch (unlinkErr) {
|
|
934611
934636
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
934612
934637
|
}
|
|
@@ -935144,14 +935169,14 @@ var import_generator_cli5 = __toESM(require_api3(), 1);
|
|
|
935144
935169
|
|
|
935145
935170
|
// ../init/lib/initializeAPI.js
|
|
935146
935171
|
init_lib8();
|
|
935147
|
-
var
|
|
935172
|
+
var import_promises128 = require("fs/promises");
|
|
935148
935173
|
var import_fs_extra = __toESM(require_lib19(), 1);
|
|
935149
935174
|
var import_path99 = __toESM(require("path"), 1);
|
|
935150
935175
|
|
|
935151
935176
|
// ../init/lib/createFernDirectoryAndOrganization.js
|
|
935152
935177
|
init_lib8();
|
|
935153
935178
|
init_lib6();
|
|
935154
|
-
var
|
|
935179
|
+
var import_promises125 = require("fs/promises");
|
|
935155
935180
|
init_lodash();
|
|
935156
935181
|
var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
|
|
935157
935182
|
async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
|
|
@@ -935183,7 +935208,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
935183
935208
|
}
|
|
935184
935209
|
}
|
|
935185
935210
|
}
|
|
935186
|
-
await (0,
|
|
935211
|
+
await (0, import_promises125.mkdir)(FERN_DIRECTORY);
|
|
935187
935212
|
await writeProjectConfig({
|
|
935188
935213
|
filepath: join8(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
|
|
935189
935214
|
organization,
|
|
@@ -935207,11 +935232,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
|
|
|
935207
935232
|
organization,
|
|
935208
935233
|
version: versionOfCli
|
|
935209
935234
|
};
|
|
935210
|
-
await (0,
|
|
935235
|
+
await (0, import_promises125.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
|
|
935211
935236
|
}
|
|
935212
935237
|
async function writeGitignore({ absolutePathToFernDirectory }) {
|
|
935213
935238
|
const gitignorePath = join8(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
|
|
935214
|
-
await (0,
|
|
935239
|
+
await (0, import_promises125.writeFile)(gitignorePath, GITIGNORE_CONTENT);
|
|
935215
935240
|
}
|
|
935216
935241
|
|
|
935217
935242
|
// ../fern-definition/formatter/lib/FernDefinitionFileFormatter.js
|
|
@@ -935401,7 +935426,7 @@ async function formatDefinitionFile({ fileContents }) {
|
|
|
935401
935426
|
// ../fern-definition/formatter/lib/formatWorkspace.js
|
|
935402
935427
|
init_lib4();
|
|
935403
935428
|
init_lib6();
|
|
935404
|
-
var
|
|
935429
|
+
var import_promises126 = require("fs/promises");
|
|
935405
935430
|
async function formatFernWorkspace({ workspace, context: context3, shouldFix }) {
|
|
935406
935431
|
for (const [relativeFilepath, file4] of entries(workspace.definition.namedDefinitionFiles)) {
|
|
935407
935432
|
const formatted = await formatDefinitionFile({
|
|
@@ -935409,7 +935434,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
935409
935434
|
});
|
|
935410
935435
|
if (formatted !== file4.rawContents) {
|
|
935411
935436
|
if (shouldFix) {
|
|
935412
|
-
await (0,
|
|
935437
|
+
await (0, import_promises126.writeFile)(file4.absoluteFilePath, formatted);
|
|
935413
935438
|
context3.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
935414
935439
|
} else {
|
|
935415
935440
|
context3.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
@@ -935422,7 +935447,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
935422
935447
|
// ../init/lib/createWorkspace.js
|
|
935423
935448
|
init_lib8();
|
|
935424
935449
|
init_lib6();
|
|
935425
|
-
var
|
|
935450
|
+
var import_promises127 = require("fs/promises");
|
|
935426
935451
|
init_js_yaml();
|
|
935427
935452
|
|
|
935428
935453
|
// ../init/lib/sampleImdbApi.js
|
|
@@ -935623,7 +935648,7 @@ components:
|
|
|
935623
935648
|
// ../init/lib/createWorkspace.js
|
|
935624
935649
|
async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context3, apiName = "api" }) {
|
|
935625
935650
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
935626
|
-
await (0,
|
|
935651
|
+
await (0, import_promises127.mkdir)(directoryOfWorkspace);
|
|
935627
935652
|
}
|
|
935628
935653
|
await writeGeneratorsConfiguration({
|
|
935629
935654
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -935638,7 +935663,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
|
|
|
935638
935663
|
}
|
|
935639
935664
|
async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context3 }) {
|
|
935640
935665
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
935641
|
-
await (0,
|
|
935666
|
+
await (0, import_promises127.mkdir)(directoryOfWorkspace);
|
|
935642
935667
|
}
|
|
935643
935668
|
await writeGeneratorsConfiguration({
|
|
935644
935669
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -935651,10 +935676,10 @@ async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, c
|
|
|
935651
935676
|
}
|
|
935652
935677
|
async function createDefaultOpenAPIWorkspace({ directoryOfWorkspace, cliVersion, context: context3 }) {
|
|
935653
935678
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
935654
|
-
await (0,
|
|
935679
|
+
await (0, import_promises127.mkdir)(directoryOfWorkspace, { recursive: true });
|
|
935655
935680
|
}
|
|
935656
935681
|
const openApiFilePath = join8(directoryOfWorkspace, RelativeFilePath2.of("openapi.yml"));
|
|
935657
|
-
await (0,
|
|
935682
|
+
await (0, import_promises127.writeFile)(openApiFilePath, SAMPLE_OPENAPI);
|
|
935658
935683
|
await writeGeneratorsConfiguration({
|
|
935659
935684
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
935660
935685
|
cliVersion,
|
|
@@ -935699,7 +935724,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context3
|
|
|
935699
935724
|
return config5;
|
|
935700
935725
|
}
|
|
935701
935726
|
async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context3, apiConfiguration }) {
|
|
935702
|
-
await (0,
|
|
935727
|
+
await (0, import_promises127.writeFile)(filepath, "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context: context3, apiConfiguration }), {
|
|
935703
935728
|
sortKeys: (a3, b8) => {
|
|
935704
935729
|
if (a3 === "api") {
|
|
935705
935730
|
return -1;
|
|
@@ -935718,8 +935743,8 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
935718
935743
|
strategy: "status-code"
|
|
935719
935744
|
}
|
|
935720
935745
|
};
|
|
935721
|
-
await (0,
|
|
935722
|
-
await (0,
|
|
935746
|
+
await (0, import_promises127.mkdir)(directoryOfDefinition);
|
|
935747
|
+
await (0, import_promises127.writeFile)(join8(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), jsYaml.dump(rootApi));
|
|
935723
935748
|
const absoluteFilepathToImdbYaml = join8(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
935724
935749
|
let formattedContent;
|
|
935725
935750
|
try {
|
|
@@ -935735,7 +935760,7 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
935735
935760
|
code: CliError.Code.ParseError
|
|
935736
935761
|
});
|
|
935737
935762
|
}
|
|
935738
|
-
await (0,
|
|
935763
|
+
await (0, import_promises127.writeFile)(absoluteFilepathToImdbYaml, formattedContent);
|
|
935739
935764
|
}
|
|
935740
935765
|
|
|
935741
935766
|
// ../init/lib/initializeAPI.js
|
|
@@ -935786,7 +935811,7 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
|
|
|
935786
935811
|
if (inlinedApiDefinition || inlinedOpenApiWorkspace) {
|
|
935787
935812
|
taskContext.logger.info("Creating workspaces to support multiple API Definitions.");
|
|
935788
935813
|
const apiWorkspaceDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
|
|
935789
|
-
await (0,
|
|
935814
|
+
await (0, import_promises128.mkdir)(apiWorkspaceDirectory, { recursive: true });
|
|
935790
935815
|
if (inlinedApiDefinition) {
|
|
935791
935816
|
const inlinedDefinitionDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
935792
935817
|
const workspaceDefinitionDirectory = join8(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
@@ -935823,7 +935848,7 @@ async function hasInlinedOpenAPIWorkspace({ absolutePathToFernDirectory }) {
|
|
|
935823
935848
|
// ../init/lib/initializeDocs.js
|
|
935824
935849
|
init_lib4();
|
|
935825
935850
|
init_lib8();
|
|
935826
|
-
var
|
|
935851
|
+
var import_promises129 = require("fs/promises");
|
|
935827
935852
|
init_js_yaml();
|
|
935828
935853
|
async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
935829
935854
|
const createDirectoryResponse = await createFernDirectoryAndWorkspace({
|
|
@@ -935839,7 +935864,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
|
935839
935864
|
} else {
|
|
935840
935865
|
try {
|
|
935841
935866
|
const docsConfig = getDocsConfig(createDirectoryResponse.organization);
|
|
935842
|
-
await (0,
|
|
935867
|
+
await (0, import_promises129.writeFile)(docsYmlPath, jsYaml.dump(docsConfig));
|
|
935843
935868
|
taskContext.logger.info(source_default.green("Created docs configuration"));
|
|
935844
935869
|
return;
|
|
935845
935870
|
} catch (writeError) {
|
|
@@ -935895,7 +935920,7 @@ var FernDocsBuilder = class {
|
|
|
935895
935920
|
// ../docs-importers/commons/lib/FernDocsBuilderImpl.js
|
|
935896
935921
|
init_lib8();
|
|
935897
935922
|
init_lib6();
|
|
935898
|
-
var
|
|
935923
|
+
var import_promises130 = require("fs/promises");
|
|
935899
935924
|
init_js_yaml();
|
|
935900
935925
|
var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
935901
935926
|
openApiSpecs = {};
|
|
@@ -935955,7 +935980,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
935955
935980
|
}
|
|
935956
935981
|
async build({ outputDirectory }) {
|
|
935957
935982
|
const absolutePathToFernDirectory = join8(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
|
|
935958
|
-
await (0,
|
|
935983
|
+
await (0, import_promises130.mkdir)(absolutePathToFernDirectory, { recursive: true });
|
|
935959
935984
|
if (Object.keys(this.tabbedNavigation).length > 0) {
|
|
935960
935985
|
this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key2, value2]) => {
|
|
935961
935986
|
return [value2.tabId, value2.tabConfig];
|
|
@@ -935980,27 +936005,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
935980
936005
|
}))
|
|
935981
936006
|
};
|
|
935982
936007
|
}
|
|
935983
|
-
await (0,
|
|
936008
|
+
await (0, import_promises130.writeFile)(join8(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)), jsYaml.dump(generators_yml_exports.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml)));
|
|
935984
936009
|
await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
|
|
935985
936010
|
const absolutePathToOpenAPI = join8(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
|
|
935986
|
-
await (0,
|
|
935987
|
-
await (0,
|
|
936011
|
+
await (0, import_promises130.mkdir)(dirname6(absolutePathToOpenAPI), { recursive: true });
|
|
936012
|
+
await (0, import_promises130.cp)(absolutePath, absolutePathToOpenAPI);
|
|
935988
936013
|
}));
|
|
935989
936014
|
}
|
|
935990
|
-
await (0,
|
|
936015
|
+
await (0, import_promises130.writeFile)(join8(absolutePathToFernDirectory, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME)), jsYaml.dump(docs_yml_exports.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml, { omitUndefined: true })));
|
|
935991
936016
|
await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
|
|
935992
936017
|
const absoluteFilepathToMarkdownPage = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
935993
|
-
await (0,
|
|
936018
|
+
await (0, import_promises130.mkdir)(dirname6(absoluteFilepathToMarkdownPage), { recursive: true });
|
|
935994
936019
|
const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
|
|
935995
936020
|
${jsYaml.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
|
|
935996
936021
|
|
|
935997
936022
|
` : "";
|
|
935998
|
-
await (0,
|
|
936023
|
+
await (0, import_promises130.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
|
|
935999
936024
|
}));
|
|
936000
936025
|
await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
|
|
936001
936026
|
const absolutePathToAsset = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
936002
|
-
await (0,
|
|
936003
|
-
await (0,
|
|
936027
|
+
await (0, import_promises130.mkdir)(dirname6(absolutePathToAsset), { recursive: true });
|
|
936028
|
+
await (0, import_promises130.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
|
|
936004
936029
|
}));
|
|
936005
936030
|
}
|
|
936006
936031
|
setInstance({ companyName }) {
|
|
@@ -936034,7 +936059,7 @@ var NonTabbedNavigationBuilderImpl = class {
|
|
|
936034
936059
|
// ../docs-importers/mintlify/lib/MintlifyImporter.js
|
|
936035
936060
|
init_lib8();
|
|
936036
936061
|
init_lib6();
|
|
936037
|
-
var
|
|
936062
|
+
var import_promises132 = require("fs/promises");
|
|
936038
936063
|
|
|
936039
936064
|
// ../docs-importers/mintlify/lib/convertColors.js
|
|
936040
936065
|
function convertColors(colors19) {
|
|
@@ -936095,10 +936120,10 @@ init_lib8();
|
|
|
936095
936120
|
|
|
936096
936121
|
// ../docs-importers/mintlify/lib/convertMarkdown.js
|
|
936097
936122
|
init_lib8();
|
|
936098
|
-
var
|
|
936123
|
+
var import_promises131 = require("fs/promises");
|
|
936099
936124
|
var import_gray_matter10 = __toESM(require_gray_matter(), 1);
|
|
936100
936125
|
async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
|
|
936101
|
-
const text9 = await (0,
|
|
936126
|
+
const text9 = await (0, import_promises131.readFile)(absoluteFilepathToMarkdown, "utf-8");
|
|
936102
936127
|
const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
|
|
936103
936128
|
const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
|
|
936104
936129
|
const transformedContent = markReferencedAssets({
|
|
@@ -936261,7 +936286,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
936261
936286
|
documentationTab = void 0;
|
|
936262
936287
|
tabUrlToInfo = {};
|
|
936263
936288
|
async import({ args, builder }) {
|
|
936264
|
-
const mintJsonContent = await (0,
|
|
936289
|
+
const mintJsonContent = await (0, import_promises132.readFile)(args.absolutePathToMintJson, "utf-8");
|
|
936265
936290
|
const mint = JSON.parse(mintJsonContent);
|
|
936266
936291
|
builder.setTitle({ title: mint.name });
|
|
936267
936292
|
const relativePathToFavicon = RelativeFilePath2.of(mint.favicon.substring(1));
|
|
@@ -936387,7 +936412,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
936387
936412
|
|
|
936388
936413
|
// ../docs-importers/mintlify/lib/runMintlifyMigration.js
|
|
936389
936414
|
init_lib8();
|
|
936390
|
-
var
|
|
936415
|
+
var import_promises133 = require("fs/promises");
|
|
936391
936416
|
async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
|
|
936392
936417
|
const mintlifyImporter = new MintlifyImporter({
|
|
936393
936418
|
context: taskContext
|
|
@@ -936398,7 +936423,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
936398
936423
|
builder
|
|
936399
936424
|
});
|
|
936400
936425
|
await builder.build({ outputDirectory: outputPath });
|
|
936401
|
-
await (0,
|
|
936426
|
+
await (0, import_promises133.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
936402
936427
|
version: versionOfCli,
|
|
936403
936428
|
organization
|
|
936404
936429
|
}, void 0, 4));
|
|
@@ -936459,7 +936484,7 @@ function assertIsStringArray(val) {
|
|
|
936459
936484
|
// ../docs-importers/readme/lib/ReadmeImporter.js
|
|
936460
936485
|
init_lib4();
|
|
936461
936486
|
init_lib8();
|
|
936462
|
-
var
|
|
936487
|
+
var import_promises138 = require("fs/promises");
|
|
936463
936488
|
|
|
936464
936489
|
// ../docs-importers/readme/lib/extract/favicon.js
|
|
936465
936490
|
init_unist_util_visit();
|
|
@@ -947934,7 +947959,7 @@ init_disposable();
|
|
|
947934
947959
|
init_incremental_id_generator();
|
|
947935
947960
|
|
|
947936
947961
|
// ../../../node_modules/.pnpm/puppeteer-core@24.40.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js
|
|
947937
|
-
var
|
|
947962
|
+
var import_promises136 = require("fs/promises");
|
|
947938
947963
|
var import_node_os11 = __toESM(require("os"), 1);
|
|
947939
947964
|
var import_node_path36 = __toESM(require("path"), 1);
|
|
947940
947965
|
init_main();
|
|
@@ -948378,7 +948403,7 @@ var ChromeLauncher = class extends BrowserLauncher {
|
|
|
948378
948403
|
});
|
|
948379
948404
|
if (userDataDirIndex < 0) {
|
|
948380
948405
|
isTempUserDataDir = true;
|
|
948381
|
-
chromeArguments.push(`--user-data-dir=${await (0,
|
|
948406
|
+
chromeArguments.push(`--user-data-dir=${await (0, import_promises136.mkdtemp)(this.getProfilePath())}`);
|
|
948382
948407
|
userDataDirIndex = chromeArguments.length - 1;
|
|
948383
948408
|
}
|
|
948384
948409
|
const userDataDir = chromeArguments[userDataDirIndex].split("=", 2)[1];
|
|
@@ -948535,7 +948560,7 @@ function removeMatchingFlags(array3, flag) {
|
|
|
948535
948560
|
|
|
948536
948561
|
// ../../../node_modules/.pnpm/puppeteer-core@24.40.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/FirefoxLauncher.js
|
|
948537
948562
|
var import_node_fs28 = __toESM(require("fs"), 1);
|
|
948538
|
-
var
|
|
948563
|
+
var import_promises137 = require("fs/promises");
|
|
948539
948564
|
var import_node_os12 = __toESM(require("os"), 1);
|
|
948540
948565
|
var import_node_path37 = __toESM(require("path"), 1);
|
|
948541
948566
|
init_main();
|
|
@@ -948589,7 +948614,7 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
948589
948614
|
}
|
|
948590
948615
|
isTempUserDataDir = false;
|
|
948591
948616
|
} else {
|
|
948592
|
-
userDataDir = await (0,
|
|
948617
|
+
userDataDir = await (0, import_promises137.mkdtemp)(this.getProfilePath());
|
|
948593
948618
|
firefoxArguments.push("--profile");
|
|
948594
948619
|
firefoxArguments.push(userDataDir);
|
|
948595
948620
|
}
|
|
@@ -948630,8 +948655,8 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
948630
948655
|
const prefsBackupPath = import_node_path37.default.join(userDataDir, file4 + backupSuffix);
|
|
948631
948656
|
if (import_node_fs28.default.existsSync(prefsBackupPath)) {
|
|
948632
948657
|
const prefsPath = import_node_path37.default.join(userDataDir, file4);
|
|
948633
|
-
await (0,
|
|
948634
|
-
await (0,
|
|
948658
|
+
await (0, import_promises137.unlink)(prefsPath);
|
|
948659
|
+
await (0, import_promises137.rename)(prefsBackupPath, prefsPath);
|
|
948635
948660
|
}
|
|
948636
948661
|
}));
|
|
948637
948662
|
for (const result of results) {
|
|
@@ -949676,7 +949701,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
949676
949701
|
if (response.ok) {
|
|
949677
949702
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
949678
949703
|
const faviconPath = join8(assetsDirectory, RelativeFilePath2.of("favicon"));
|
|
949679
|
-
await (0,
|
|
949704
|
+
await (0, import_promises138.writeFile)(faviconPath, new Uint8Array(imageBuffer));
|
|
949680
949705
|
builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
|
|
949681
949706
|
}
|
|
949682
949707
|
}
|
|
@@ -949693,7 +949718,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
949693
949718
|
*/
|
|
949694
949719
|
async getAndCreateAssetsDirectory() {
|
|
949695
949720
|
const assetsDirectory = join8(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
|
|
949696
|
-
await (0,
|
|
949721
|
+
await (0, import_promises138.mkdir)(assetsDirectory, { recursive: true });
|
|
949697
949722
|
return assetsDirectory;
|
|
949698
949723
|
}
|
|
949699
949724
|
/**
|
|
@@ -949743,7 +949768,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
949743
949768
|
absolutePathToOutputDirectory,
|
|
949744
949769
|
section
|
|
949745
949770
|
});
|
|
949746
|
-
await (0,
|
|
949771
|
+
await (0, import_promises138.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
|
|
949747
949772
|
await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
|
|
949748
949773
|
const url3 = new URL(page.slug.toString(), this.url);
|
|
949749
949774
|
this.logger.debug(`Fetching page: ${url3.toString()}`);
|
|
@@ -949758,7 +949783,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
949758
949783
|
absolutePathToOutputDirectoryForSection,
|
|
949759
949784
|
page: page.slug
|
|
949760
949785
|
});
|
|
949761
|
-
await (0,
|
|
949786
|
+
await (0, import_promises138.writeFile)(absolutePathForPage, result.data.mdx);
|
|
949762
949787
|
if (result.data.images.imageURLs.length > 0) {
|
|
949763
949788
|
this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
|
|
949764
949789
|
await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
|
|
@@ -949771,8 +949796,8 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
949771
949796
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
949772
949797
|
const imagePath = join8(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
|
|
949773
949798
|
const imageDir = dirname6(imagePath);
|
|
949774
|
-
await (0,
|
|
949775
|
-
await (0,
|
|
949799
|
+
await (0, import_promises138.mkdir)(imageDir, { recursive: true });
|
|
949800
|
+
await (0, import_promises138.writeFile)(imagePath, new Uint8Array(imageBuffer));
|
|
949776
949801
|
this.logger.debug(`Saved image to ${imagePath}`);
|
|
949777
949802
|
} catch (error50) {
|
|
949778
949803
|
this.logger.warn(`Error downloading image ${imageUrl}: ${error50}`);
|
|
@@ -949855,7 +949880,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
949855
949880
|
|
|
949856
949881
|
// ../docs-importers/readme/lib/runReadmeMigration.js
|
|
949857
949882
|
init_lib8();
|
|
949858
|
-
var
|
|
949883
|
+
var import_promises139 = require("fs/promises");
|
|
949859
949884
|
async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
|
|
949860
949885
|
const builder = new FernDocsBuilderImpl();
|
|
949861
949886
|
builder.setInstance({ companyName: organization });
|
|
@@ -949870,7 +949895,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
949870
949895
|
builder
|
|
949871
949896
|
});
|
|
949872
949897
|
await builder.build({ outputDirectory: outputPath });
|
|
949873
|
-
await (0,
|
|
949898
|
+
await (0, import_promises139.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
949874
949899
|
version: versionOfCli,
|
|
949875
949900
|
organization
|
|
949876
949901
|
}, void 0, 4));
|
|
@@ -949896,7 +949921,7 @@ var initializeWithReadme = async ({ readmeUrl, organization, taskContext, versio
|
|
|
949896
949921
|
};
|
|
949897
949922
|
|
|
949898
949923
|
// ../init/lib/utils/loadOpenApiFromUrl.js
|
|
949899
|
-
var
|
|
949924
|
+
var import_promises140 = require("fs/promises");
|
|
949900
949925
|
init_js_yaml();
|
|
949901
949926
|
var import_path100 = require("path");
|
|
949902
949927
|
var import_tmp_promise16 = __toESM(require_tmp_promise(), 1);
|
|
@@ -949912,7 +949937,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger: logger4 }) {
|
|
|
949912
949937
|
const filePath = (0, import_path100.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
|
|
949913
949938
|
logger4.debug("tmpDir", tmpDir.path);
|
|
949914
949939
|
logger4.debug("filePath", filePath);
|
|
949915
|
-
await (0,
|
|
949940
|
+
await (0, import_promises140.writeFile)(filePath, data2);
|
|
949916
949941
|
return {
|
|
949917
949942
|
status: LoadOpenAPIStatus.Success,
|
|
949918
949943
|
filePath
|
|
@@ -953790,7 +953815,7 @@ function getAutomationContextFromEnv() {
|
|
|
953790
953815
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
953791
953816
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
953792
953817
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
953793
|
-
cli_version: "5.33.
|
|
953818
|
+
cli_version: "5.33.1"
|
|
953794
953819
|
};
|
|
953795
953820
|
}
|
|
953796
953821
|
function isAutomationMode() {
|
|
@@ -954616,7 +954641,7 @@ var CliContext = class _CliContext {
|
|
|
954616
954641
|
if (false) {
|
|
954617
954642
|
this.logger.error("CLI_VERSION is not defined");
|
|
954618
954643
|
}
|
|
954619
|
-
return "5.33.
|
|
954644
|
+
return "5.33.1";
|
|
954620
954645
|
}
|
|
954621
954646
|
getCliName() {
|
|
954622
954647
|
if (false) {
|
|
@@ -954924,7 +954949,7 @@ function wrapWorkspaceNameForPrefix(workspaceName) {
|
|
|
954924
954949
|
// ../project-loader/lib/loadProject.js
|
|
954925
954950
|
init_lib8();
|
|
954926
954951
|
init_lib6();
|
|
954927
|
-
var
|
|
954952
|
+
var import_promises141 = require("fs/promises");
|
|
954928
954953
|
|
|
954929
954954
|
// ../project-loader/lib/normalizeCommandLineApiWorkspace.js
|
|
954930
954955
|
function normalizeCommandLineApiWorkspace(input3) {
|
|
@@ -955006,7 +955031,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
955006
955031
|
const apisDirectory = join8(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
|
|
955007
955032
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
955008
955033
|
if (apisDirectoryExists) {
|
|
955009
|
-
const apiDirectoryContents = await (0,
|
|
955034
|
+
const apiDirectoryContents = await (0, import_promises141.readdir)(apisDirectory, { withFileTypes: true });
|
|
955010
955035
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
|
|
955011
955036
|
if (item.isDirectory()) {
|
|
955012
955037
|
all9.push(item.name);
|
|
@@ -955083,12 +955108,12 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
955083
955108
|
// src/cliV2.ts
|
|
955084
955109
|
init_lib6();
|
|
955085
955110
|
var import_generators_sdk6 = __toESM(require_generators_sdk(), 1);
|
|
955086
|
-
var
|
|
955111
|
+
var import_promises146 = require("fs/promises");
|
|
955087
955112
|
|
|
955088
955113
|
// src/commands/generator-list/getGeneratorList.ts
|
|
955089
955114
|
init_lib4();
|
|
955090
955115
|
init_lib6();
|
|
955091
|
-
var
|
|
955116
|
+
var import_promises142 = require("fs/promises");
|
|
955092
955117
|
init_js_yaml();
|
|
955093
955118
|
var GenerationModeFilter = {
|
|
955094
955119
|
GitHub: "github",
|
|
@@ -955149,7 +955174,7 @@ async function getGeneratorList({
|
|
|
955149
955174
|
return;
|
|
955150
955175
|
}
|
|
955151
955176
|
try {
|
|
955152
|
-
await (0,
|
|
955177
|
+
await (0, import_promises142.writeFile)(outputLocation, generatorsListYaml);
|
|
955153
955178
|
} catch (error50) {
|
|
955154
955179
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
955155
955180
|
code: CliError.Code.ConfigError
|
|
@@ -955218,7 +955243,7 @@ async function getGeneratorMetadata({
|
|
|
955218
955243
|
|
|
955219
955244
|
// src/commands/organization/getOrganization.ts
|
|
955220
955245
|
init_lib6();
|
|
955221
|
-
var
|
|
955246
|
+
var import_promises143 = require("fs/promises");
|
|
955222
955247
|
async function getOrganization({
|
|
955223
955248
|
project,
|
|
955224
955249
|
outputLocation,
|
|
@@ -955230,7 +955255,7 @@ async function getOrganization({
|
|
|
955230
955255
|
return;
|
|
955231
955256
|
}
|
|
955232
955257
|
try {
|
|
955233
|
-
await (0,
|
|
955258
|
+
await (0, import_promises143.writeFile)(outputLocation, org);
|
|
955234
955259
|
} catch (error50) {
|
|
955235
955260
|
context3.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
955236
955261
|
code: CliError.Code.ConfigError
|
|
@@ -955241,7 +955266,7 @@ async function getOrganization({
|
|
|
955241
955266
|
// src/commands/upgrade/upgradeGenerator.ts
|
|
955242
955267
|
init_lib8();
|
|
955243
955268
|
init_lib6();
|
|
955244
|
-
var
|
|
955269
|
+
var import_promises145 = require("fs/promises");
|
|
955245
955270
|
var import_path102 = __toESM(require("path"), 1);
|
|
955246
955271
|
var import_semver16 = __toESM(require_semver2(), 1);
|
|
955247
955272
|
var import_yaml6 = __toESM(require_dist11(), 1);
|
|
@@ -955251,7 +955276,7 @@ init_lib4();
|
|
|
955251
955276
|
init_lib12();
|
|
955252
955277
|
init_lib6();
|
|
955253
955278
|
var import_fs39 = require("fs");
|
|
955254
|
-
var
|
|
955279
|
+
var import_promises144 = require("fs/promises");
|
|
955255
955280
|
var import_os15 = require("os");
|
|
955256
955281
|
var import_path101 = require("path");
|
|
955257
955282
|
var import_semver15 = __toESM(require_semver2(), 1);
|
|
@@ -955279,7 +955304,7 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
955279
955304
|
const myPid = String(process.pid);
|
|
955280
955305
|
while (true) {
|
|
955281
955306
|
try {
|
|
955282
|
-
const fh = await (0,
|
|
955307
|
+
const fh = await (0, import_promises144.open)(lockPath, "wx");
|
|
955283
955308
|
await fh.writeFile(myPid);
|
|
955284
955309
|
await fh.close();
|
|
955285
955310
|
const exitHandler = () => {
|
|
@@ -955296,9 +955321,9 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
955296
955321
|
return async () => {
|
|
955297
955322
|
process.removeListener("exit", exitHandler);
|
|
955298
955323
|
try {
|
|
955299
|
-
const currentContent = await (0,
|
|
955324
|
+
const currentContent = await (0, import_promises144.readFile)(lockPath, "utf-8");
|
|
955300
955325
|
if (currentContent.trim() === myPid) {
|
|
955301
|
-
await (0,
|
|
955326
|
+
await (0, import_promises144.unlink)(lockPath);
|
|
955302
955327
|
} else {
|
|
955303
955328
|
logger4.debug(
|
|
955304
955329
|
`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`
|
|
@@ -955314,14 +955339,14 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
955314
955339
|
throw err;
|
|
955315
955340
|
}
|
|
955316
955341
|
try {
|
|
955317
|
-
const lockContent = await (0,
|
|
955342
|
+
const lockContent = await (0, import_promises144.readFile)(lockPath, "utf-8");
|
|
955318
955343
|
const lockPid = Number(lockContent.trim());
|
|
955319
|
-
const lockStat = await (0,
|
|
955344
|
+
const lockStat = await (0, import_promises144.stat)(lockPath);
|
|
955320
955345
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
955321
955346
|
if (lockAge > LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !isProcessAlive(lockPid)) {
|
|
955322
955347
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
955323
955348
|
try {
|
|
955324
|
-
await (0,
|
|
955349
|
+
await (0, import_promises144.unlink)(lockPath);
|
|
955325
955350
|
} catch (unlinkErr) {
|
|
955326
955351
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
955327
955352
|
}
|
|
@@ -955345,7 +955370,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
955345
955370
|
}
|
|
955346
955371
|
migrationsInstallPromise = (async () => {
|
|
955347
955372
|
const cacheDir = getMigrationCacheDir();
|
|
955348
|
-
await (0,
|
|
955373
|
+
await (0, import_promises144.mkdir)(cacheDir, { recursive: true });
|
|
955349
955374
|
const npmCacheDir = (0, import_path101.join)(cacheDir, ".npm-cache");
|
|
955350
955375
|
const packageDir = (0, import_path101.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME2);
|
|
955351
955376
|
const packageJsonPath = (0, import_path101.join)(packageDir, "package.json");
|
|
@@ -955362,7 +955387,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
955362
955387
|
"--no-audit",
|
|
955363
955388
|
"--no-fund"
|
|
955364
955389
|
]);
|
|
955365
|
-
const packageJsonContent = await (0,
|
|
955390
|
+
const packageJsonContent = await (0, import_promises144.readFile)(packageJsonPath, "utf-8");
|
|
955366
955391
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
955367
955392
|
if (packageJson2.main == null) {
|
|
955368
955393
|
throw new CliError({
|
|
@@ -955546,7 +955571,7 @@ async function loadAndUpdateGenerators({
|
|
|
955546
955571
|
skippedAutoreleaseDisabled: []
|
|
955547
955572
|
};
|
|
955548
955573
|
}
|
|
955549
|
-
const contents = await (0,
|
|
955574
|
+
const contents = await (0, import_promises145.readFile)(filepath);
|
|
955550
955575
|
context3.logger.debug(`Found generators: ${contents.toString()}`);
|
|
955551
955576
|
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
955552
955577
|
const generatorGroups = parsedDocument.get("groups");
|
|
@@ -955783,7 +955808,7 @@ async function upgradeGenerator({
|
|
|
955783
955808
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
955784
955809
|
});
|
|
955785
955810
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
955786
|
-
await (0,
|
|
955811
|
+
await (0, import_promises145.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
955787
955812
|
}
|
|
955788
955813
|
allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
|
|
955789
955814
|
if (result.appliedUpgrades.length > 0) {
|
|
@@ -956183,7 +956208,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
956183
956208
|
}
|
|
956184
956209
|
if (argv.output) {
|
|
956185
956210
|
try {
|
|
956186
|
-
await (0,
|
|
956211
|
+
await (0, import_promises146.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
|
|
956187
956212
|
} catch (error50) {
|
|
956188
956213
|
cliContext.failAndThrow(
|
|
956189
956214
|
`Could not write file to the specified location: ${argv.output}`,
|
|
@@ -956198,7 +956223,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
956198
956223
|
}
|
|
956199
956224
|
|
|
956200
956225
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
956201
|
-
var
|
|
956226
|
+
var import_promises147 = require("fs/promises");
|
|
956202
956227
|
init_js_yaml();
|
|
956203
956228
|
async function addGeneratorToWorkspaces({
|
|
956204
956229
|
project: { apiWorkspaces },
|
|
@@ -956226,7 +956251,7 @@ async function addGeneratorToWorkspaces({
|
|
|
956226
956251
|
if (absolutePathToGeneratorsConfiguration == null) {
|
|
956227
956252
|
return;
|
|
956228
956253
|
}
|
|
956229
|
-
await (0,
|
|
956254
|
+
await (0, import_promises147.writeFile)(
|
|
956230
956255
|
absolutePathToGeneratorsConfiguration,
|
|
956231
956256
|
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(newConfiguration)
|
|
956232
956257
|
);
|
|
@@ -956293,11 +956318,11 @@ var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
|
956293
956318
|
|
|
956294
956319
|
// src/commands/generate/checkOutputDirectory.ts
|
|
956295
956320
|
init_lib8();
|
|
956296
|
-
var
|
|
956321
|
+
var import_promises150 = require("fs/promises");
|
|
956297
956322
|
|
|
956298
956323
|
// src/persistence/output-directories/getOutputDirectories.ts
|
|
956299
956324
|
init_lib8();
|
|
956300
|
-
var
|
|
956325
|
+
var import_promises148 = require("fs/promises");
|
|
956301
956326
|
|
|
956302
956327
|
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
956303
956328
|
init_lib8();
|
|
@@ -956317,17 +956342,17 @@ async function getOutputDirectories() {
|
|
|
956317
956342
|
if (!doesOutputDirectoriesFileExist) {
|
|
956318
956343
|
return [];
|
|
956319
956344
|
}
|
|
956320
|
-
const outputDirectoriesFileContents = await (0,
|
|
956345
|
+
const outputDirectoriesFileContents = await (0, import_promises148.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
956321
956346
|
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
956322
956347
|
return outputDirectories;
|
|
956323
956348
|
}
|
|
956324
956349
|
|
|
956325
956350
|
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
956326
|
-
var
|
|
956351
|
+
var import_promises149 = require("fs/promises");
|
|
956327
956352
|
var import_path103 = __toESM(require("path"), 1);
|
|
956328
956353
|
async function storeOutputDirectories(outputDirectories) {
|
|
956329
|
-
await (0,
|
|
956330
|
-
await (0,
|
|
956354
|
+
await (0, import_promises149.mkdir)(import_path103.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
|
|
956355
|
+
await (0, import_promises149.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
|
|
956331
956356
|
}
|
|
956332
956357
|
|
|
956333
956358
|
// src/commands/generate/checkOutputDirectory.ts
|
|
@@ -956349,7 +956374,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
956349
956374
|
shouldProceed: true
|
|
956350
956375
|
};
|
|
956351
956376
|
}
|
|
956352
|
-
const files = await (0,
|
|
956377
|
+
const files = await (0, import_promises150.readdir)(outputPath);
|
|
956353
956378
|
if (files.length === 0) {
|
|
956354
956379
|
return {
|
|
956355
956380
|
shouldProceed: true
|
|
@@ -957315,7 +957340,7 @@ function renderOverflowWarning(failureCount) {
|
|
|
957315
957340
|
// src/commands/automations/generate/reportGenerateResults.ts
|
|
957316
957341
|
init_lib4();
|
|
957317
957342
|
var import_fs40 = require("fs");
|
|
957318
|
-
var
|
|
957343
|
+
var import_promises151 = require("fs/promises");
|
|
957319
957344
|
var JSON_SCHEMA_VERSION = 1;
|
|
957320
957345
|
function renderStdoutSummary(results) {
|
|
957321
957346
|
return formatCounts(countResults(results));
|
|
@@ -957505,12 +957530,12 @@ async function writeResults({
|
|
|
957505
957530
|
const stepSummaryPath = getGithubStepSummaryPath();
|
|
957506
957531
|
if (stepSummaryPath != null) {
|
|
957507
957532
|
try {
|
|
957508
|
-
await (0,
|
|
957533
|
+
await (0, import_promises151.appendFile)(stepSummaryPath, renderMarkdownSummary(results), "utf8");
|
|
957509
957534
|
} catch {
|
|
957510
957535
|
}
|
|
957511
957536
|
}
|
|
957512
957537
|
if (jsonOutputPath != null) {
|
|
957513
|
-
await (0,
|
|
957538
|
+
await (0, import_promises151.writeFile)(jsonOutputPath, JSON.stringify(renderJsonSummary(results), null, 2), "utf8");
|
|
957514
957539
|
}
|
|
957515
957540
|
}
|
|
957516
957541
|
function writeResultsSync({
|
|
@@ -957834,14 +957859,14 @@ function listPreviewGroups({
|
|
|
957834
957859
|
|
|
957835
957860
|
// src/commands/automations/upgrade/executeAutomationsUpgrade.ts
|
|
957836
957861
|
init_lib6();
|
|
957837
|
-
var
|
|
957862
|
+
var import_promises180 = require("fs/promises");
|
|
957838
957863
|
|
|
957839
957864
|
// ../cli-migrations/lib/runMigrations.js
|
|
957840
957865
|
init_lib4();
|
|
957841
957866
|
init_lib6();
|
|
957842
957867
|
|
|
957843
957868
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
957844
|
-
var
|
|
957869
|
+
var import_promises152 = require("fs/promises");
|
|
957845
957870
|
|
|
957846
957871
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
957847
957872
|
init_lib8();
|
|
@@ -957877,7 +957902,7 @@ var migration = {
|
|
|
957877
957902
|
try {
|
|
957878
957903
|
const fileContents = await getFileContents(yamlFilepath);
|
|
957879
957904
|
const newContents = addDiscriminantToFile(fileContents);
|
|
957880
|
-
await (0,
|
|
957905
|
+
await (0, import_promises152.writeFile)(yamlFilepath, newContents);
|
|
957881
957906
|
} catch (error50) {
|
|
957882
957907
|
context3.failAndThrow("Failed to migrate " + yamlFilepath, error50);
|
|
957883
957908
|
}
|
|
@@ -957885,7 +957910,7 @@ var migration = {
|
|
|
957885
957910
|
}
|
|
957886
957911
|
};
|
|
957887
957912
|
async function getFileContents(filepath) {
|
|
957888
|
-
const buffer = await (0,
|
|
957913
|
+
const buffer = await (0, import_promises152.readFile)(filepath);
|
|
957889
957914
|
return buffer.toString();
|
|
957890
957915
|
}
|
|
957891
957916
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -957914,7 +957939,7 @@ var versionMigrations = {
|
|
|
957914
957939
|
var __default = versionMigrations;
|
|
957915
957940
|
|
|
957916
957941
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
957917
|
-
var
|
|
957942
|
+
var import_promises153 = require("fs/promises");
|
|
957918
957943
|
var import_yaml7 = __toESM(require_dist11(), 1);
|
|
957919
957944
|
|
|
957920
957945
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -957957,7 +957982,7 @@ var migration2 = {
|
|
|
957957
957982
|
}
|
|
957958
957983
|
};
|
|
957959
957984
|
async function migrateFile(filepath, context3) {
|
|
957960
|
-
const contents = await (0,
|
|
957985
|
+
const contents = await (0, import_promises153.readFile)(filepath);
|
|
957961
957986
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
957962
957987
|
const types4 = parsedDocument.get("types");
|
|
957963
957988
|
if (types4 == null) {
|
|
@@ -957989,7 +958014,7 @@ async function migrateFile(filepath, context3) {
|
|
|
957989
958014
|
}
|
|
957990
958015
|
}
|
|
957991
958016
|
}
|
|
957992
|
-
await (0,
|
|
958017
|
+
await (0, import_promises153.writeFile)(filepath, parsedDocument.toString());
|
|
957993
958018
|
}
|
|
957994
958019
|
|
|
957995
958020
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -958000,7 +958025,7 @@ var versionMigrations2 = {
|
|
|
958000
958025
|
var __default2 = versionMigrations2;
|
|
958001
958026
|
|
|
958002
958027
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
958003
|
-
var
|
|
958028
|
+
var import_promises154 = require("fs/promises");
|
|
958004
958029
|
var import_yaml8 = __toESM(require_dist11(), 1);
|
|
958005
958030
|
|
|
958006
958031
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -958043,7 +958068,7 @@ var migration3 = {
|
|
|
958043
958068
|
}
|
|
958044
958069
|
};
|
|
958045
958070
|
async function migrateGeneratorsYml(filepath, context3) {
|
|
958046
|
-
const contents = await (0,
|
|
958071
|
+
const contents = await (0, import_promises154.readFile)(filepath);
|
|
958047
958072
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
958048
958073
|
const draftGenerators = parsedDocument.get("draft");
|
|
958049
958074
|
if (draftGenerators == null) {
|
|
@@ -958070,7 +958095,7 @@ async function migrateGeneratorsYml(filepath, context3) {
|
|
|
958070
958095
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
958071
958096
|
}
|
|
958072
958097
|
});
|
|
958073
|
-
await (0,
|
|
958098
|
+
await (0, import_promises154.writeFile)(filepath, parsedDocument.toString());
|
|
958074
958099
|
}
|
|
958075
958100
|
|
|
958076
958101
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -958081,7 +958106,7 @@ var versionMigrations3 = {
|
|
|
958081
958106
|
var __default3 = versionMigrations3;
|
|
958082
958107
|
|
|
958083
958108
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
958084
|
-
var
|
|
958109
|
+
var import_promises155 = require("fs/promises");
|
|
958085
958110
|
var import_yaml9 = __toESM(require_dist11(), 1);
|
|
958086
958111
|
|
|
958087
958112
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -958124,7 +958149,7 @@ var migration4 = {
|
|
|
958124
958149
|
}
|
|
958125
958150
|
};
|
|
958126
958151
|
async function migrateFile2(filepath, context3) {
|
|
958127
|
-
const contents = await (0,
|
|
958152
|
+
const contents = await (0, import_promises155.readFile)(filepath);
|
|
958128
958153
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
958129
958154
|
const addType = (typeName, typeDeclaration2) => {
|
|
958130
958155
|
const types4 = parsedDocument.get("types");
|
|
@@ -958168,7 +958193,7 @@ async function migrateFile2(filepath, context3) {
|
|
|
958168
958193
|
}
|
|
958169
958194
|
}
|
|
958170
958195
|
}
|
|
958171
|
-
await (0,
|
|
958196
|
+
await (0, import_promises155.writeFile)(filepath, parsedDocument.toString());
|
|
958172
958197
|
}
|
|
958173
958198
|
|
|
958174
958199
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -958179,7 +958204,7 @@ var versionMigrations4 = {
|
|
|
958179
958204
|
var __default4 = versionMigrations4;
|
|
958180
958205
|
|
|
958181
958206
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
958182
|
-
var
|
|
958207
|
+
var import_promises156 = require("fs/promises");
|
|
958183
958208
|
var import_yaml10 = __toESM(require_dist11(), 1);
|
|
958184
958209
|
|
|
958185
958210
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -958222,7 +958247,7 @@ var migration5 = {
|
|
|
958222
958247
|
}
|
|
958223
958248
|
};
|
|
958224
958249
|
async function migrateGeneratorsYml2(filepath, context3) {
|
|
958225
|
-
const contents = await (0,
|
|
958250
|
+
const contents = await (0, import_promises156.readFile)(filepath);
|
|
958226
958251
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
958227
958252
|
const releaseGenerators = parsedDocument.get("release");
|
|
958228
958253
|
if (releaseGenerators == null) {
|
|
@@ -958260,7 +958285,7 @@ async function migrateGeneratorsYml2(filepath, context3) {
|
|
|
958260
958285
|
}
|
|
958261
958286
|
releaseGenerator.delete("outputs");
|
|
958262
958287
|
});
|
|
958263
|
-
await (0,
|
|
958288
|
+
await (0, import_promises156.writeFile)(filepath, parsedDocument.toString());
|
|
958264
958289
|
}
|
|
958265
958290
|
|
|
958266
958291
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -958271,7 +958296,7 @@ var versionMigrations5 = {
|
|
|
958271
958296
|
var __default5 = versionMigrations5;
|
|
958272
958297
|
|
|
958273
958298
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
958274
|
-
var
|
|
958299
|
+
var import_promises157 = require("fs/promises");
|
|
958275
958300
|
|
|
958276
958301
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
958277
958302
|
init_lib8();
|
|
@@ -958304,9 +958329,9 @@ var migration6 = {
|
|
|
958304
958329
|
run: async ({ context: context3 }) => {
|
|
958305
958330
|
const yamlFiles = await getAllYamlFiles4(context3);
|
|
958306
958331
|
for (const filepath of yamlFiles) {
|
|
958307
|
-
const contents = await (0,
|
|
958332
|
+
const contents = await (0, import_promises157.readFile)(filepath);
|
|
958308
958333
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
958309
|
-
await (0,
|
|
958334
|
+
await (0, import_promises157.writeFile)(filepath, newContents);
|
|
958310
958335
|
}
|
|
958311
958336
|
}
|
|
958312
958337
|
};
|
|
@@ -958319,7 +958344,7 @@ var versionMigrations6 = {
|
|
|
958319
958344
|
var __default6 = versionMigrations6;
|
|
958320
958345
|
|
|
958321
958346
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
958322
|
-
var
|
|
958347
|
+
var import_promises158 = require("fs/promises");
|
|
958323
958348
|
|
|
958324
958349
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
958325
958350
|
init_lib8();
|
|
@@ -958352,9 +958377,9 @@ var migration7 = {
|
|
|
958352
958377
|
run: async ({ context: context3 }) => {
|
|
958353
958378
|
const yamlFiles = await getAllRootApiYamlFiles(context3);
|
|
958354
958379
|
for (const filepath of yamlFiles) {
|
|
958355
|
-
const contents = await (0,
|
|
958380
|
+
const contents = await (0, import_promises158.readFile)(filepath);
|
|
958356
958381
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
958357
|
-
await (0,
|
|
958382
|
+
await (0, import_promises158.writeFile)(filepath, newContents);
|
|
958358
958383
|
}
|
|
958359
958384
|
}
|
|
958360
958385
|
};
|
|
@@ -958368,7 +958393,7 @@ var __default7 = versionMigrations7;
|
|
|
958368
958393
|
|
|
958369
958394
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
958370
958395
|
init_lib4();
|
|
958371
|
-
var
|
|
958396
|
+
var import_promises159 = require("fs/promises");
|
|
958372
958397
|
init_js_yaml();
|
|
958373
958398
|
|
|
958374
958399
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
@@ -958501,7 +958526,7 @@ var migration8 = {
|
|
|
958501
958526
|
}
|
|
958502
958527
|
};
|
|
958503
958528
|
async function migrateGeneratorsYml3(filepath) {
|
|
958504
|
-
const contentsStr = await (0,
|
|
958529
|
+
const contentsStr = await (0, import_promises159.readFile)(filepath);
|
|
958505
958530
|
const contents = jsYaml.load(contentsStr.toString());
|
|
958506
958531
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
958507
958532
|
let newGeneratorsConfiguration = {};
|
|
@@ -958519,7 +958544,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
958519
958544
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
958520
958545
|
};
|
|
958521
958546
|
}
|
|
958522
|
-
await (0,
|
|
958547
|
+
await (0, import_promises159.writeFile)(filepath, jsYaml.dump(newGeneratorsConfiguration));
|
|
958523
958548
|
}
|
|
958524
958549
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
958525
958550
|
const newSchema = {
|
|
@@ -958594,7 +958619,7 @@ var versionMigrations8 = {
|
|
|
958594
958619
|
var __default8 = versionMigrations8;
|
|
958595
958620
|
|
|
958596
958621
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
958597
|
-
var
|
|
958622
|
+
var import_promises160 = require("fs/promises");
|
|
958598
958623
|
var import_yaml11 = __toESM(require_dist11(), 1);
|
|
958599
958624
|
|
|
958600
958625
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -958637,7 +958662,7 @@ var migration9 = {
|
|
|
958637
958662
|
}
|
|
958638
958663
|
};
|
|
958639
958664
|
async function migrateRootApiFile(filepath) {
|
|
958640
|
-
const contents = await (0,
|
|
958665
|
+
const contents = await (0, import_promises160.readFile)(filepath);
|
|
958641
958666
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
958642
958667
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
958643
958668
|
if (errorDiscriminant == null || !import_yaml11.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -958648,7 +958673,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
958648
958673
|
"property-name": errorDiscriminant.value
|
|
958649
958674
|
});
|
|
958650
958675
|
parsedDocument.delete("error-discriminant");
|
|
958651
|
-
await (0,
|
|
958676
|
+
await (0, import_promises160.writeFile)(filepath, parsedDocument.toString());
|
|
958652
958677
|
}
|
|
958653
958678
|
|
|
958654
958679
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -958659,7 +958684,7 @@ var versionMigrations9 = {
|
|
|
958659
958684
|
var __default9 = versionMigrations9;
|
|
958660
958685
|
|
|
958661
958686
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
958662
|
-
var
|
|
958687
|
+
var import_promises161 = require("fs/promises");
|
|
958663
958688
|
var import_yaml12 = __toESM(require_dist11(), 1);
|
|
958664
958689
|
|
|
958665
958690
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -958702,7 +958727,7 @@ var migration10 = {
|
|
|
958702
958727
|
}
|
|
958703
958728
|
};
|
|
958704
958729
|
async function migrateYamlFile(filepath, context3) {
|
|
958705
|
-
const contents = await (0,
|
|
958730
|
+
const contents = await (0, import_promises161.readFile)(filepath);
|
|
958706
958731
|
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
958707
958732
|
const services = parsedDocument.get("services");
|
|
958708
958733
|
if (services == null) {
|
|
@@ -958742,7 +958767,7 @@ async function migrateYamlFile(filepath, context3) {
|
|
|
958742
958767
|
context3.failWithoutThrowing("Failed to convert endpoint", e8);
|
|
958743
958768
|
}
|
|
958744
958769
|
}
|
|
958745
|
-
await (0,
|
|
958770
|
+
await (0, import_promises161.writeFile)(filepath, parsedDocument.toString());
|
|
958746
958771
|
}
|
|
958747
958772
|
}
|
|
958748
958773
|
function convertEndpoint4({ document: document4, endpoint: endpoint3 }) {
|
|
@@ -958821,7 +958846,7 @@ var versionMigrations10 = {
|
|
|
958821
958846
|
var __default10 = versionMigrations10;
|
|
958822
958847
|
|
|
958823
958848
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
958824
|
-
var
|
|
958849
|
+
var import_promises162 = require("fs/promises");
|
|
958825
958850
|
var import_yaml13 = __toESM(require_dist11(), 1);
|
|
958826
958851
|
|
|
958827
958852
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -958864,7 +958889,7 @@ var migration11 = {
|
|
|
958864
958889
|
}
|
|
958865
958890
|
};
|
|
958866
958891
|
async function migrateYamlFile2(filepath, context3) {
|
|
958867
|
-
const contents = await (0,
|
|
958892
|
+
const contents = await (0, import_promises162.readFile)(filepath);
|
|
958868
958893
|
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
958869
958894
|
const types4 = parsedDocument.get("types");
|
|
958870
958895
|
if (types4 == null) {
|
|
@@ -958890,7 +958915,7 @@ async function migrateYamlFile2(filepath, context3) {
|
|
|
958890
958915
|
examples.set(i9, { value: value2 });
|
|
958891
958916
|
}
|
|
958892
958917
|
}
|
|
958893
|
-
await (0,
|
|
958918
|
+
await (0, import_promises162.writeFile)(filepath, parsedDocument.toString());
|
|
958894
958919
|
}
|
|
958895
958920
|
|
|
958896
958921
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -958901,7 +958926,7 @@ var versionMigrations11 = {
|
|
|
958901
958926
|
var __default11 = versionMigrations11;
|
|
958902
958927
|
|
|
958903
958928
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
958904
|
-
var
|
|
958929
|
+
var import_promises163 = require("fs/promises");
|
|
958905
958930
|
var import_yaml14 = __toESM(require_dist11(), 1);
|
|
958906
958931
|
|
|
958907
958932
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -958944,7 +958969,7 @@ var migration12 = {
|
|
|
958944
958969
|
}
|
|
958945
958970
|
};
|
|
958946
958971
|
async function migrateYamlFile3(filepath, context3) {
|
|
958947
|
-
const contents = await (0,
|
|
958972
|
+
const contents = await (0, import_promises163.readFile)(filepath);
|
|
958948
958973
|
const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
|
|
958949
958974
|
if (!import_yaml14.default.isMap(parsedDocument.contents)) {
|
|
958950
958975
|
return context3.failAndThrow("File is not a map");
|
|
@@ -958974,7 +958999,7 @@ async function migrateYamlFile3(filepath, context3) {
|
|
|
958974
958999
|
pair.value = firstService.value;
|
|
958975
959000
|
}
|
|
958976
959001
|
}
|
|
958977
|
-
await (0,
|
|
959002
|
+
await (0, import_promises163.writeFile)(filepath, parsedDocument.toString());
|
|
958978
959003
|
}
|
|
958979
959004
|
|
|
958980
959005
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -958985,7 +959010,7 @@ var versionMigrations12 = {
|
|
|
958985
959010
|
var __default12 = versionMigrations12;
|
|
958986
959011
|
|
|
958987
959012
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
958988
|
-
var
|
|
959013
|
+
var import_promises164 = require("fs/promises");
|
|
958989
959014
|
var import_yaml15 = __toESM(require_dist11(), 1);
|
|
958990
959015
|
|
|
958991
959016
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -959028,7 +959053,7 @@ var migration13 = {
|
|
|
959028
959053
|
}
|
|
959029
959054
|
};
|
|
959030
959055
|
async function migrateYamlFile4(filepath, context3) {
|
|
959031
|
-
const contents = await (0,
|
|
959056
|
+
const contents = await (0, import_promises164.readFile)(filepath);
|
|
959032
959057
|
const parsedDocument = import_yaml15.default.parseDocument(contents.toString());
|
|
959033
959058
|
if (!import_yaml15.default.isMap(parsedDocument.contents)) {
|
|
959034
959059
|
return context3.failAndThrow("File is not a map");
|
|
@@ -959047,7 +959072,7 @@ async function migrateYamlFile4(filepath, context3) {
|
|
|
959047
959072
|
}
|
|
959048
959073
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
959049
959074
|
parsedDocument.contents.items.unshift(docsPair);
|
|
959050
|
-
await (0,
|
|
959075
|
+
await (0, import_promises164.writeFile)(filepath, parsedDocument.toString());
|
|
959051
959076
|
}
|
|
959052
959077
|
|
|
959053
959078
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -959058,7 +959083,7 @@ var versionMigrations13 = {
|
|
|
959058
959083
|
var __default13 = versionMigrations13;
|
|
959059
959084
|
|
|
959060
959085
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
959061
|
-
var
|
|
959086
|
+
var import_promises165 = require("fs/promises");
|
|
959062
959087
|
|
|
959063
959088
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
959064
959089
|
init_lib8();
|
|
@@ -959100,14 +959125,14 @@ var migration14 = {
|
|
|
959100
959125
|
}
|
|
959101
959126
|
};
|
|
959102
959127
|
async function migrateYamlFile5(filepath) {
|
|
959103
|
-
const contents = await (0,
|
|
959128
|
+
const contents = await (0, import_promises165.readFile)(filepath);
|
|
959104
959129
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
959105
959130
|
const regex5 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
959106
959131
|
const updatedSnapshot = contents.toString().replace(regex5, (_match, _prefix, domain3) => {
|
|
959107
959132
|
return `docs:
|
|
959108
959133
|
domain: "${domain3}.${domainSuffix}"`;
|
|
959109
959134
|
});
|
|
959110
|
-
await (0,
|
|
959135
|
+
await (0, import_promises165.writeFile)(filepath, updatedSnapshot.toString());
|
|
959111
959136
|
}
|
|
959112
959137
|
|
|
959113
959138
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -959127,11 +959152,11 @@ var LegacyDocsSerializers = __toESM(require_serialization4(), 1);
|
|
|
959127
959152
|
|
|
959128
959153
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
959129
959154
|
init_lib8();
|
|
959130
|
-
var
|
|
959155
|
+
var import_promises166 = require("fs/promises");
|
|
959131
959156
|
init_js_yaml();
|
|
959132
959157
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
959133
959158
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
959134
|
-
const contentsStr = await (0,
|
|
959159
|
+
const contentsStr = await (0, import_promises166.readFile)(filepath);
|
|
959135
959160
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
959136
959161
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
959137
959162
|
if (result.ok) {
|
|
@@ -959150,7 +959175,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
959150
959175
|
|
|
959151
959176
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
959152
959177
|
init_lib8();
|
|
959153
|
-
var
|
|
959178
|
+
var import_promises168 = require("fs/promises");
|
|
959154
959179
|
init_js_yaml();
|
|
959155
959180
|
|
|
959156
959181
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
@@ -959359,11 +959384,11 @@ __export(legacy_exports, {
|
|
|
959359
959384
|
|
|
959360
959385
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
959361
959386
|
init_lib8();
|
|
959362
|
-
var
|
|
959387
|
+
var import_promises167 = require("fs/promises");
|
|
959363
959388
|
init_js_yaml();
|
|
959364
959389
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
959365
959390
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
959366
|
-
const contentsStr = await (0,
|
|
959391
|
+
const contentsStr = await (0, import_promises167.readFile)(filepath);
|
|
959367
959392
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
959368
959393
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
959369
959394
|
if (result.success) {
|
|
@@ -959393,7 +959418,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
959393
959418
|
var APIS_DIRECTORY2 = "apis";
|
|
959394
959419
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
959395
959420
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
959396
|
-
await (0,
|
|
959421
|
+
await (0, import_promises168.mkdir)(absolutePathToApisDirectory);
|
|
959397
959422
|
for (const workspace of workspaces) {
|
|
959398
959423
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
959399
959424
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -959401,11 +959426,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
959401
959426
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
959402
959427
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
959403
959428
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
959404
|
-
await (0,
|
|
959429
|
+
await (0, import_promises168.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
959405
959430
|
}
|
|
959406
959431
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
959407
959432
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
959408
|
-
await (0,
|
|
959433
|
+
await (0, import_promises168.rm)(absolutePathToWorkspace, { recursive: true });
|
|
959409
959434
|
}
|
|
959410
959435
|
}
|
|
959411
959436
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -959418,7 +959443,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
959418
959443
|
generatorsConfiguration,
|
|
959419
959444
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
959420
959445
|
});
|
|
959421
|
-
await (0,
|
|
959446
|
+
await (0, import_promises168.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
959422
959447
|
return convertedResponse.docsURLs;
|
|
959423
959448
|
}
|
|
959424
959449
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -959432,12 +959457,12 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
959432
959457
|
apiName
|
|
959433
959458
|
});
|
|
959434
959459
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
959435
|
-
await (0,
|
|
959460
|
+
await (0, import_promises168.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
959436
959461
|
}
|
|
959437
959462
|
|
|
959438
959463
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
959439
959464
|
init_lib8();
|
|
959440
|
-
var
|
|
959465
|
+
var import_promises169 = require("fs/promises");
|
|
959441
959466
|
init_js_yaml();
|
|
959442
959467
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
959443
959468
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
@@ -959445,8 +959470,8 @@ async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePa
|
|
|
959445
959470
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
959446
959471
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
959447
959472
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
959448
|
-
await (0,
|
|
959449
|
-
await (0,
|
|
959473
|
+
await (0, import_promises169.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
959474
|
+
await (0, import_promises169.rm)(absolutePathToWorkspace, { recursive: true });
|
|
959450
959475
|
}
|
|
959451
959476
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
959452
959477
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -959459,7 +959484,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
959459
959484
|
apiName: void 0
|
|
959460
959485
|
});
|
|
959461
959486
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
959462
|
-
await (0,
|
|
959487
|
+
await (0, import_promises169.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
959463
959488
|
}
|
|
959464
959489
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
959465
959490
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -959471,24 +959496,24 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
959471
959496
|
generatorsConfiguration,
|
|
959472
959497
|
pathModificationStrategy: "MoveUp"
|
|
959473
959498
|
});
|
|
959474
|
-
await (0,
|
|
959499
|
+
await (0, import_promises169.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
959475
959500
|
return convertedResponse.docsURLs;
|
|
959476
959501
|
}
|
|
959477
959502
|
|
|
959478
959503
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
959479
959504
|
init_lib8();
|
|
959480
|
-
var
|
|
959505
|
+
var import_promises170 = require("fs/promises");
|
|
959481
959506
|
init_js_yaml();
|
|
959482
959507
|
var APIS_DIRECTORY3 = "apis";
|
|
959483
959508
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
959484
959509
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
959485
|
-
await (0,
|
|
959510
|
+
await (0, import_promises170.mkdir)(absolutePathToApisDirectory);
|
|
959486
959511
|
for (const workspace of workspaces) {
|
|
959487
959512
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
959488
959513
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
959489
959514
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
959490
959515
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
959491
|
-
await (0,
|
|
959516
|
+
await (0, import_promises170.rm)(absolutePathToWorkspace, { recursive: true });
|
|
959492
959517
|
}
|
|
959493
959518
|
}
|
|
959494
959519
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -959501,17 +959526,17 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
959501
959526
|
generatorsConfiguration,
|
|
959502
959527
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
959503
959528
|
});
|
|
959504
|
-
await (0,
|
|
959529
|
+
await (0, import_promises170.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
959505
959530
|
}
|
|
959506
959531
|
|
|
959507
959532
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
959508
959533
|
init_lib8();
|
|
959509
|
-
var
|
|
959534
|
+
var import_promises171 = require("fs/promises");
|
|
959510
959535
|
init_js_yaml();
|
|
959511
959536
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
959512
959537
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
959513
959538
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
959514
|
-
await (0,
|
|
959539
|
+
await (0, import_promises171.rm)(absolutePathToWorkspace, { recursive: true });
|
|
959515
959540
|
}
|
|
959516
959541
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
959517
959542
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -959523,7 +959548,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
959523
959548
|
generatorsConfiguration,
|
|
959524
959549
|
pathModificationStrategy: "MoveUp"
|
|
959525
959550
|
});
|
|
959526
|
-
await (0,
|
|
959551
|
+
await (0, import_promises171.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
959527
959552
|
}
|
|
959528
959553
|
|
|
959529
959554
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -959601,7 +959626,7 @@ var __default15 = versionMigrations15;
|
|
|
959601
959626
|
|
|
959602
959627
|
// ../cli-migrations/lib/migrations/0.41.0-rc0/require-generators-yml/migration.js
|
|
959603
959628
|
init_lib8();
|
|
959604
|
-
var
|
|
959629
|
+
var import_promises172 = require("fs/promises");
|
|
959605
959630
|
init_js_yaml();
|
|
959606
959631
|
var import_yaml16 = __toESM(require_dist11(), 1);
|
|
959607
959632
|
var migration16 = {
|
|
@@ -959645,7 +959670,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
959645
959670
|
if (existingGeneratorsYml == null) {
|
|
959646
959671
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
959647
959672
|
const absolutePathToGeneratorsYml = join8(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
959648
|
-
await (0,
|
|
959673
|
+
await (0, import_promises172.writeFile)(absolutePathToGeneratorsYml, jsYaml.dump({
|
|
959649
959674
|
api: {
|
|
959650
959675
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
959651
959676
|
}
|
|
@@ -959660,7 +959685,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
959660
959685
|
parsedDocument.set("api", {
|
|
959661
959686
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
959662
959687
|
});
|
|
959663
|
-
await (0,
|
|
959688
|
+
await (0, import_promises172.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
959664
959689
|
context3.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
959665
959690
|
}
|
|
959666
959691
|
}
|
|
@@ -959688,7 +959713,7 @@ var __default16 = versionMigrations16;
|
|
|
959688
959713
|
|
|
959689
959714
|
// ../cli-migrations/lib/migrations/0.54.0-rc0/use-generators-yml-specs/migration.js
|
|
959690
959715
|
init_lib8();
|
|
959691
|
-
var
|
|
959716
|
+
var import_promises173 = require("fs/promises");
|
|
959692
959717
|
init_js_yaml();
|
|
959693
959718
|
var import_yaml17 = __toESM(require_dist11(), 1);
|
|
959694
959719
|
var migration17 = {
|
|
@@ -959869,7 +959894,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
959869
959894
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
959870
959895
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
959871
959896
|
}
|
|
959872
|
-
await (0,
|
|
959897
|
+
await (0, import_promises173.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
959873
959898
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
959874
959899
|
}
|
|
959875
959900
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context3, namespace }) {
|
|
@@ -959916,7 +959941,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
959916
959941
|
}
|
|
959917
959942
|
let specContent;
|
|
959918
959943
|
try {
|
|
959919
|
-
const fileContents = await (0,
|
|
959944
|
+
const fileContents = await (0, import_promises173.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
959920
959945
|
specContent = jsYaml.load(fileContents);
|
|
959921
959946
|
} catch (e8) {
|
|
959922
959947
|
context3.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e8}. Skipping...`);
|
|
@@ -960020,7 +960045,7 @@ var __default17 = versionMigrations17;
|
|
|
960020
960045
|
|
|
960021
960046
|
// ../cli-migrations/lib/migrations/0.82.1/add-path-parameter-order-setting/migration.js
|
|
960022
960047
|
init_lib8();
|
|
960023
|
-
var
|
|
960048
|
+
var import_promises174 = require("fs/promises");
|
|
960024
960049
|
init_js_yaml();
|
|
960025
960050
|
var migration18 = {
|
|
960026
960051
|
name: "add-path-parameter-order-setting",
|
|
@@ -960109,7 +960134,7 @@ async function updateGeneratorsYml({ context: context3, files }) {
|
|
|
960109
960134
|
documentToWrite = `${schemaComment}
|
|
960110
960135
|
${documentToWrite}`;
|
|
960111
960136
|
}
|
|
960112
|
-
await (0,
|
|
960137
|
+
await (0, import_promises174.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
960113
960138
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
960114
960139
|
}
|
|
960115
960140
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -960146,7 +960171,7 @@ var __default18 = versionMigrations18;
|
|
|
960146
960171
|
|
|
960147
960172
|
// ../cli-migrations/lib/migrations/1.0.0/update-settings-defaults/migration.js
|
|
960148
960173
|
init_lib8();
|
|
960149
|
-
var
|
|
960174
|
+
var import_promises175 = require("fs/promises");
|
|
960150
960175
|
init_js_yaml();
|
|
960151
960176
|
var migration19 = {
|
|
960152
960177
|
name: "update-1_0_0-defaults",
|
|
@@ -960322,7 +960347,7 @@ async function updateGeneratorsYml2({ context: context3, files }) {
|
|
|
960322
960347
|
documentToWrite = `${schemaComment}
|
|
960323
960348
|
${documentToWrite}`;
|
|
960324
960349
|
}
|
|
960325
|
-
await (0,
|
|
960350
|
+
await (0, import_promises175.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
960326
960351
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
960327
960352
|
}
|
|
960328
960353
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -960392,7 +960417,7 @@ var __default19 = versionMigrations19;
|
|
|
960392
960417
|
|
|
960393
960418
|
// ../cli-migrations/lib/migrations/2.0.0-rc0/update-settings-defaults/migration.js
|
|
960394
960419
|
init_lib8();
|
|
960395
|
-
var
|
|
960420
|
+
var import_promises176 = require("fs/promises");
|
|
960396
960421
|
init_js_yaml();
|
|
960397
960422
|
var migration20 = {
|
|
960398
960423
|
name: "update-2_0_0-defaults",
|
|
@@ -960568,7 +960593,7 @@ async function updateGeneratorsYml3({ context: context3, files }) {
|
|
|
960568
960593
|
documentToWrite = `${schemaComment}
|
|
960569
960594
|
${documentToWrite}`;
|
|
960570
960595
|
}
|
|
960571
|
-
await (0,
|
|
960596
|
+
await (0, import_promises176.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
960572
960597
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
960573
960598
|
}
|
|
960574
960599
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -960615,7 +960640,7 @@ var __default20 = versionMigrations20;
|
|
|
960615
960640
|
|
|
960616
960641
|
// ../cli-migrations/lib/migrations/2.13.0/migrate-deprecated-generator-api-settings/migration.js
|
|
960617
960642
|
init_lib8();
|
|
960618
|
-
var
|
|
960643
|
+
var import_promises177 = require("fs/promises");
|
|
960619
960644
|
init_js_yaml();
|
|
960620
960645
|
var migration21 = {
|
|
960621
960646
|
name: "migrate-deprecated-generator-api-settings",
|
|
@@ -960707,7 +960732,7 @@ async function updateGeneratorsYml4({ context: context3, files }) {
|
|
|
960707
960732
|
documentToWrite = `${schemaComment}
|
|
960708
960733
|
${documentToWrite}`;
|
|
960709
960734
|
}
|
|
960710
|
-
await (0,
|
|
960735
|
+
await (0, import_promises177.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
960711
960736
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
960712
960737
|
}
|
|
960713
960738
|
function migrateDeprecatedSettings(settings, context3) {
|
|
@@ -960754,7 +960779,7 @@ var __default21 = versionMigrations21;
|
|
|
960754
960779
|
|
|
960755
960780
|
// ../cli-migrations/lib/migrations/3.0.0/enable-smart-casing/migration.js
|
|
960756
960781
|
init_lib8();
|
|
960757
|
-
var
|
|
960782
|
+
var import_promises178 = require("fs/promises");
|
|
960758
960783
|
init_js_yaml();
|
|
960759
960784
|
var migration22 = {
|
|
960760
960785
|
name: "enable-smart-casing",
|
|
@@ -960839,7 +960864,7 @@ async function updateGeneratorsYml5({ context: context3, files }) {
|
|
|
960839
960864
|
documentToWrite = `${schemaComment}
|
|
960840
960865
|
${documentToWrite}`;
|
|
960841
960866
|
}
|
|
960842
|
-
await (0,
|
|
960867
|
+
await (0, import_promises178.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
960843
960868
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
960844
960869
|
}
|
|
960845
960870
|
function setSmartCasingFalseIfNotConfigured(generator, context3) {
|
|
@@ -960982,7 +961007,7 @@ ${source_default.dim(migration23.summary)}`
|
|
|
960982
961007
|
// src/commands/upgrade/upgrade.ts
|
|
960983
961008
|
init_lib12();
|
|
960984
961009
|
init_lib6();
|
|
960985
|
-
var
|
|
961010
|
+
var import_promises179 = require("fs/promises");
|
|
960986
961011
|
|
|
960987
961012
|
// ../../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
|
|
960988
961013
|
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
@@ -962037,7 +962062,7 @@ async function upgrade({
|
|
|
962037
962062
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
962038
962063
|
draft.version = resolvedTargetVersion;
|
|
962039
962064
|
});
|
|
962040
|
-
await (0,
|
|
962065
|
+
await (0, import_promises179.writeFile)(
|
|
962041
962066
|
projectConfig2._absolutePath,
|
|
962042
962067
|
ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2))
|
|
962043
962068
|
);
|
|
@@ -962194,7 +962219,7 @@ async function upgradeGeneratorsForAllWorkspaces({
|
|
|
962194
962219
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
962195
962220
|
});
|
|
962196
962221
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
962197
|
-
await (0,
|
|
962222
|
+
await (0, import_promises180.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
962198
962223
|
}
|
|
962199
962224
|
for (const upgrade2 of result.appliedUpgrades) {
|
|
962200
962225
|
const normalizedName = addDefaultDockerOrgIfNotPresent(upgrade2.generatorName);
|
|
@@ -962669,7 +962694,7 @@ async function previewDocsWorkspace({
|
|
|
962669
962694
|
// src/commands/docs-diff/docsDiff.ts
|
|
962670
962695
|
init_lib8();
|
|
962671
962696
|
init_lib6();
|
|
962672
|
-
var
|
|
962697
|
+
var import_promises181 = require("fs/promises");
|
|
962673
962698
|
var import_pngjs = __toESM(require_png2(), 1);
|
|
962674
962699
|
async function getSlugForFiles({
|
|
962675
962700
|
previewUrl,
|
|
@@ -962892,8 +962917,8 @@ async function generateComparisons({
|
|
|
962892
962917
|
afterPath,
|
|
962893
962918
|
comparisonBasePath
|
|
962894
962919
|
}) {
|
|
962895
|
-
const beforePng = import_pngjs.PNG.sync.read(await (0,
|
|
962896
|
-
const afterPng = import_pngjs.PNG.sync.read(await (0,
|
|
962920
|
+
const beforePng = import_pngjs.PNG.sync.read(await (0, import_promises181.readFile)(beforePath));
|
|
962921
|
+
const afterPng = import_pngjs.PNG.sync.read(await (0, import_promises181.readFile)(afterPath));
|
|
962897
962922
|
const beforeOriginalHeight = beforePng.height;
|
|
962898
962923
|
const afterOriginalHeight = afterPng.height;
|
|
962899
962924
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
@@ -962931,7 +962956,7 @@ async function generateComparisons({
|
|
|
962931
962956
|
const sideBySide = createSideBySideComparison(croppedBefore, croppedAfter, 20, true);
|
|
962932
962957
|
const outPath = `${base4}-region-${i9 + 1}.png`;
|
|
962933
962958
|
const pngBuffer = import_pngjs.PNG.sync.write(sideBySide);
|
|
962934
|
-
await (0,
|
|
962959
|
+
await (0, import_promises181.writeFile)(outPath, new Uint8Array(pngBuffer));
|
|
962935
962960
|
results.push({ changePercent, boundingBox, comparisonPath: outPath });
|
|
962936
962961
|
}
|
|
962937
962962
|
return results;
|
|
@@ -963010,7 +963035,7 @@ async function docsDiff({
|
|
|
963010
963035
|
outputDir.startsWith("/") ? outputDir : join8(cwd(), RelativeFilePath2.of(outputDir))
|
|
963011
963036
|
);
|
|
963012
963037
|
if (!await doesPathExist(outputPath)) {
|
|
963013
|
-
await (0,
|
|
963038
|
+
await (0, import_promises181.mkdir)(outputPath, { recursive: true });
|
|
963014
963039
|
}
|
|
963015
963040
|
const results = [];
|
|
963016
963041
|
await cliContext.runTask(async (context3) => {
|
|
@@ -963328,7 +963353,7 @@ init_lib6();
|
|
|
963328
963353
|
|
|
963329
963354
|
// src/commands/docs-theme/ThemeExporter.ts
|
|
963330
963355
|
init_lib8();
|
|
963331
|
-
var
|
|
963356
|
+
var import_promises182 = require("fs/promises");
|
|
963332
963357
|
init_js_yaml();
|
|
963333
963358
|
var import_path104 = __toESM(require("path"), 1);
|
|
963334
963359
|
var THEME_ELIGIBLE_KEYS2 = /* @__PURE__ */ new Set([
|
|
@@ -963357,18 +963382,18 @@ var ThemeExporter = class {
|
|
|
963357
963382
|
const docsDir = import_path104.default.dirname(docsYmlPath);
|
|
963358
963383
|
const outDir = output2 != null ? import_path104.default.resolve(process.cwd(), output2) : import_path104.default.join(this.docsWorkspace.absoluteFilePath, "theme");
|
|
963359
963384
|
context3.logger.info(`Exporting theme-eligible fields from docs.yml \u2192 ${outDir}`);
|
|
963360
|
-
const raw = jsYaml.load(await (0,
|
|
963385
|
+
const raw = jsYaml.load(await (0, import_promises182.readFile)(docsYmlPath, "utf-8"));
|
|
963361
963386
|
const themeConfig = {};
|
|
963362
963387
|
for (const [k5, v9] of Object.entries(raw)) {
|
|
963363
963388
|
if (THEME_ELIGIBLE_KEYS2.has(k5)) {
|
|
963364
963389
|
themeConfig[k5] = v9;
|
|
963365
963390
|
}
|
|
963366
963391
|
}
|
|
963367
|
-
await (0,
|
|
963392
|
+
await (0, import_promises182.mkdir)(outDir, { recursive: true });
|
|
963368
963393
|
const assetsDir = import_path104.default.join(outDir, "assets");
|
|
963369
|
-
await (0,
|
|
963394
|
+
await (0, import_promises182.mkdir)(assetsDir, { recursive: true });
|
|
963370
963395
|
const exported = await copyLocalFiles(themeConfig, docsDir, assetsDir);
|
|
963371
|
-
await (0,
|
|
963396
|
+
await (0, import_promises182.writeFile)(import_path104.default.join(outDir, "theme.yml"), jsYaml.dump(exported), "utf-8");
|
|
963372
963397
|
context3.logger.info(`Theme exported to ${outDir}/theme.yml`);
|
|
963373
963398
|
}
|
|
963374
963399
|
};
|
|
@@ -963382,8 +963407,8 @@ async function copyLocalFiles(obj, sourceDir, assetsDir) {
|
|
|
963382
963407
|
const destRelative = relFromSource.startsWith("..") ? relFromProject.startsWith("..") ? import_path104.default.basename(abs) : relFromProject : relFromSource;
|
|
963383
963408
|
const dest = import_path104.default.join(assetsDir, destRelative);
|
|
963384
963409
|
try {
|
|
963385
|
-
await (0,
|
|
963386
|
-
await (0,
|
|
963410
|
+
await (0, import_promises182.mkdir)(import_path104.default.dirname(dest), { recursive: true });
|
|
963411
|
+
await (0, import_promises182.copyFile)(abs, dest);
|
|
963387
963412
|
return `./assets/${destRelative.split(import_path104.default.sep).join("/")}`;
|
|
963388
963413
|
} catch {
|
|
963389
963414
|
return obj;
|
|
@@ -963501,7 +963526,7 @@ async function listDocsThemes({
|
|
|
963501
963526
|
|
|
963502
963527
|
// src/commands/docs-theme/uploadDocsTheme.ts
|
|
963503
963528
|
init_lib6();
|
|
963504
|
-
var
|
|
963529
|
+
var import_promises184 = require("fs/promises");
|
|
963505
963530
|
init_js_yaml();
|
|
963506
963531
|
var import_path106 = __toESM(require("path"), 1);
|
|
963507
963532
|
|
|
@@ -963510,7 +963535,7 @@ init_lib8();
|
|
|
963510
963535
|
init_lib6();
|
|
963511
963536
|
var import_child_process12 = require("child_process");
|
|
963512
963537
|
var import_crypto9 = require("crypto");
|
|
963513
|
-
var
|
|
963538
|
+
var import_promises183 = require("fs/promises");
|
|
963514
963539
|
var import_mime_types2 = __toESM(require_mime_types(), 1);
|
|
963515
963540
|
var import_path105 = __toESM(require("path"), 1);
|
|
963516
963541
|
function getGitRoot() {
|
|
@@ -963554,7 +963579,7 @@ var ThemeConfigProcessor = class {
|
|
|
963554
963579
|
filePaths.map(async (filePath) => {
|
|
963555
963580
|
const abs = import_path105.default.resolve(this.themeDir, filePath);
|
|
963556
963581
|
try {
|
|
963557
|
-
await (0,
|
|
963582
|
+
await (0, import_promises183.access)(abs);
|
|
963558
963583
|
} catch {
|
|
963559
963584
|
errors4.push(`Referenced file not found: ${abs}`);
|
|
963560
963585
|
}
|
|
@@ -963719,7 +963744,7 @@ ${errors4.map((e8) => ` - ${e8}`).join("\n")}`,
|
|
|
963719
963744
|
return { config: cfg, filesUploaded };
|
|
963720
963745
|
}
|
|
963721
963746
|
async uploadFileToCas(absolutePath) {
|
|
963722
|
-
const content5 = await (0,
|
|
963747
|
+
const content5 = await (0, import_promises183.readFile)(absolutePath);
|
|
963723
963748
|
const contentType = import_mime_types2.default.lookup(absolutePath) || "application/octet-stream";
|
|
963724
963749
|
const bindPath = posixBindPath(this.gitRoot, absolutePath);
|
|
963725
963750
|
return this.uploadToCas(content5, contentType, bindPath, import_path105.default.basename(absolutePath));
|
|
@@ -963834,7 +963859,7 @@ async function uploadDocsTheme({
|
|
|
963834
963859
|
await cliContext.runTask(async (context3) => {
|
|
963835
963860
|
let rawYaml;
|
|
963836
963861
|
try {
|
|
963837
|
-
const content5 = await (0,
|
|
963862
|
+
const content5 = await (0, import_promises184.readFile)(themeYmlPath, "utf-8");
|
|
963838
963863
|
rawYaml = jsYaml.load(content5, { schema: jsYaml.JSON_SCHEMA });
|
|
963839
963864
|
} catch {
|
|
963840
963865
|
context3.failAndThrow(
|
|
@@ -963888,7 +963913,7 @@ async function uploadDocsTheme({
|
|
|
963888
963913
|
|
|
963889
963914
|
// src/commands/downgrade/downgrade.ts
|
|
963890
963915
|
init_lib6();
|
|
963891
|
-
var
|
|
963916
|
+
var import_promises185 = require("fs/promises");
|
|
963892
963917
|
function ensureFinalNewline2(content5) {
|
|
963893
963918
|
return content5.endsWith("\n") ? content5 : content5 + "\n";
|
|
963894
963919
|
}
|
|
@@ -963913,13 +963938,13 @@ async function downgrade({
|
|
|
963913
963938
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
963914
963939
|
draft.version = targetVersion;
|
|
963915
963940
|
});
|
|
963916
|
-
await (0,
|
|
963941
|
+
await (0, import_promises185.writeFile)(projectConfig._absolutePath, ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
963917
963942
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
963918
963943
|
}
|
|
963919
963944
|
|
|
963920
963945
|
// src/commands/export/generateOpenAPIForWorkspaces.ts
|
|
963921
963946
|
init_lib8();
|
|
963922
|
-
var
|
|
963947
|
+
var import_promises186 = require("fs/promises");
|
|
963923
963948
|
init_js_yaml();
|
|
963924
963949
|
|
|
963925
963950
|
// src/commands/export/converters/servicesConverter.ts
|
|
@@ -965306,8 +965331,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
965306
965331
|
ir: ir11,
|
|
965307
965332
|
mode: "openapi"
|
|
965308
965333
|
});
|
|
965309
|
-
await (0,
|
|
965310
|
-
await (0,
|
|
965334
|
+
await (0, import_promises186.mkdir)(dirname6(outputPath), { recursive: true });
|
|
965335
|
+
await (0, import_promises186.writeFile)(
|
|
965311
965336
|
outputPath,
|
|
965312
965337
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent4) : jsYaml.dump(openapi, { indent: indent4 })
|
|
965313
965338
|
);
|
|
@@ -965900,7 +965925,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
965900
965925
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
965901
965926
|
init_lib8();
|
|
965902
965927
|
init_lib6();
|
|
965903
|
-
var
|
|
965928
|
+
var import_promises187 = require("fs/promises");
|
|
965904
965929
|
init_js_yaml();
|
|
965905
965930
|
async function compareOpenAPISpecs({
|
|
965906
965931
|
originalPath,
|
|
@@ -965942,12 +965967,12 @@ async function compareOpenAPISpecs({
|
|
|
965942
965967
|
}
|
|
965943
965968
|
outputPath = join8(dirname6(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
965944
965969
|
}
|
|
965945
|
-
await (0,
|
|
965970
|
+
await (0, import_promises187.writeFile)(outputPath, jsYaml.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
965946
965971
|
context3.logger.info(`Overrides written to ${outputPath}`);
|
|
965947
965972
|
});
|
|
965948
965973
|
}
|
|
965949
965974
|
async function loadSpec2(filepath, context3) {
|
|
965950
|
-
const contents = await (0,
|
|
965975
|
+
const contents = await (0, import_promises187.readFile)(filepath, "utf8");
|
|
965951
965976
|
try {
|
|
965952
965977
|
return JSON.parse(contents);
|
|
965953
965978
|
} catch {
|
|
@@ -966052,7 +966077,7 @@ function deepEqual(a3, b8) {
|
|
|
966052
966077
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
966053
966078
|
init_lib8();
|
|
966054
966079
|
init_lib6();
|
|
966055
|
-
var
|
|
966080
|
+
var import_promises188 = require("fs/promises");
|
|
966056
966081
|
init_js_yaml();
|
|
966057
966082
|
async function writeOverridesForWorkspaces({
|
|
966058
966083
|
project,
|
|
@@ -966078,7 +966103,7 @@ async function writeOverridesForWorkspaces({
|
|
|
966078
966103
|
async function readExistingOverrides(overridesFilepath, context3) {
|
|
966079
966104
|
let parsedOverrides = null;
|
|
966080
966105
|
try {
|
|
966081
|
-
const contents = (await (0,
|
|
966106
|
+
const contents = (await (0, import_promises188.readFile)(overridesFilepath, "utf8")).toString();
|
|
966082
966107
|
try {
|
|
966083
966108
|
parsedOverrides = JSON.parse(contents);
|
|
966084
966109
|
} catch (err) {
|
|
@@ -966143,7 +966168,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
966143
966168
|
for (const overridesPath of overridesPaths) {
|
|
966144
966169
|
const existingOverrides = await readExistingOverrides(overridesPath, context3);
|
|
966145
966170
|
const content5 = generateOverridesContent({ ir: ir11, existingOverrides, includeModels, context: context3 });
|
|
966146
|
-
await (0,
|
|
966171
|
+
await (0, import_promises188.writeFile)(overridesPath, jsYaml.dump(content5));
|
|
966147
966172
|
}
|
|
966148
966173
|
} else {
|
|
966149
966174
|
const content5 = generateOverridesContent({ ir: ir11, existingOverrides: {}, includeModels, context: context3 });
|
|
@@ -966157,7 +966182,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
966157
966182
|
overridesFilename = `${nameWithoutExt}-overrides${extension4}`;
|
|
966158
966183
|
}
|
|
966159
966184
|
}
|
|
966160
|
-
await (0,
|
|
966185
|
+
await (0, import_promises188.writeFile)(
|
|
966161
966186
|
join8(dirname6(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
966162
966187
|
jsYaml.dump(content5)
|
|
966163
966188
|
);
|
|
@@ -966602,7 +966627,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
966602
966627
|
}
|
|
966603
966628
|
|
|
966604
966629
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
966605
|
-
var
|
|
966630
|
+
var import_promises189 = require("fs/promises");
|
|
966606
966631
|
async function generateJsonschemaForWorkspaces({
|
|
966607
966632
|
typeLocator,
|
|
966608
966633
|
project,
|
|
@@ -966650,9 +966675,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
966650
966675
|
context: context3
|
|
966651
966676
|
});
|
|
966652
966677
|
if (!await doesPathExist(dirname6(jsonschemaFilepath))) {
|
|
966653
|
-
await (0,
|
|
966678
|
+
await (0, import_promises189.mkdir)(dirname6(jsonschemaFilepath), { recursive: true });
|
|
966654
966679
|
}
|
|
966655
|
-
await (0,
|
|
966680
|
+
await (0, import_promises189.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
966656
966681
|
context3.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
966657
966682
|
});
|
|
966658
966683
|
})
|
|
@@ -966662,7 +966687,7 @@ async function generateJsonschemaForWorkspaces({
|
|
|
966662
966687
|
// src/commands/merge/mergeOpenAPIWithOverrides.ts
|
|
966663
966688
|
init_lib8();
|
|
966664
966689
|
init_lib6();
|
|
966665
|
-
var
|
|
966690
|
+
var import_promises190 = require("fs/promises");
|
|
966666
966691
|
init_js_yaml();
|
|
966667
966692
|
var HTTP_METHODS3 = /* @__PURE__ */ new Set(["get", "put", "post", "delete", "options", "head", "patch", "trace"]);
|
|
966668
966693
|
async function mergeOpenAPIWithOverrides({
|
|
@@ -966688,12 +966713,12 @@ async function mergeOpenAPIWithOverrides({
|
|
|
966688
966713
|
const merged = mergeExamplesIntoSpec(openapi, overrides, context3);
|
|
966689
966714
|
const isJson = outputPath.endsWith(".json");
|
|
966690
966715
|
const output2 = isJson ? JSON.stringify(merged, null, 2) : jsYaml.dump(merged, { lineWidth: -1, noRefs: true });
|
|
966691
|
-
await (0,
|
|
966716
|
+
await (0, import_promises190.writeFile)(outputPath, output2);
|
|
966692
966717
|
context3.logger.info(`Merged output written to ${outputPath}`);
|
|
966693
966718
|
});
|
|
966694
966719
|
}
|
|
966695
966720
|
async function loadYamlOrJson(filepath, context3) {
|
|
966696
|
-
const contents = await (0,
|
|
966721
|
+
const contents = await (0, import_promises190.readFile)(filepath, "utf8");
|
|
966697
966722
|
try {
|
|
966698
966723
|
return JSON.parse(contents);
|
|
966699
966724
|
} catch {
|
|
@@ -967329,7 +967354,7 @@ async function mockServer({
|
|
|
967329
967354
|
|
|
967330
967355
|
// src/commands/register/registerWorkspacesV1.ts
|
|
967331
967356
|
init_lib6();
|
|
967332
|
-
var
|
|
967357
|
+
var import_promises191 = require("fs/promises");
|
|
967333
967358
|
var import_path112 = __toESM(require("path"), 1);
|
|
967334
967359
|
var import_tmp_promise17 = __toESM(require_tmp_promise(), 1);
|
|
967335
967360
|
async function registerWorkspacesV1({
|
|
@@ -967382,7 +967407,7 @@ async function registerWorkspacesV1({
|
|
|
967382
967407
|
context3.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
967383
967408
|
await Zn8({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
967384
967409
|
context3.logger.info("Uploading definition...");
|
|
967385
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
967410
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises191.readFile)(tarPath));
|
|
967386
967411
|
context3.logger.info(
|
|
967387
967412
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
967388
967413
|
);
|
|
@@ -967435,7 +967460,7 @@ function getAIEnhancerConfig2() {
|
|
|
967435
967460
|
|
|
967436
967461
|
// src/commands/resolve-specs/resolveSpecsForWorkspaces.ts
|
|
967437
967462
|
init_lib8();
|
|
967438
|
-
var
|
|
967463
|
+
var import_promises192 = require("fs/promises");
|
|
967439
967464
|
var import_path113 = __toESM(require("path"), 1);
|
|
967440
967465
|
async function resolveSpecsForWorkspaces({
|
|
967441
967466
|
project,
|
|
@@ -967455,14 +967480,14 @@ async function resolveSpecsForWorkspaces({
|
|
|
967455
967480
|
return;
|
|
967456
967481
|
}
|
|
967457
967482
|
const workspaceOutputDir = project.apiWorkspaces.length > 1 ? AbsoluteFilePath2.of(import_path113.default.join(outputDir, workspace.workspaceName ?? "api")) : outputDir;
|
|
967458
|
-
await (0,
|
|
967483
|
+
await (0, import_promises192.mkdir)(workspaceOutputDir, { recursive: true });
|
|
967459
967484
|
const manifest = await collectRawSpecs({
|
|
967460
967485
|
specs,
|
|
967461
967486
|
hostOutputDir: workspaceOutputDir,
|
|
967462
967487
|
containerBaseDir: ".",
|
|
967463
967488
|
context: context3
|
|
967464
967489
|
});
|
|
967465
|
-
await (0,
|
|
967490
|
+
await (0, import_promises192.writeFile)(
|
|
967466
967491
|
import_path113.default.join(workspaceOutputDir, SPECS_MANIFEST_FILENAME),
|
|
967467
967492
|
JSON.stringify(manifest, void 0, 4)
|
|
967468
967493
|
);
|
|
@@ -967669,7 +967694,7 @@ async function generateDiff({
|
|
|
967669
967694
|
// src/commands/sdk-preview/sdkPreview.ts
|
|
967670
967695
|
init_lib8();
|
|
967671
967696
|
init_lib6();
|
|
967672
|
-
var
|
|
967697
|
+
var import_promises193 = __toESM(require("fs/promises"), 1);
|
|
967673
967698
|
|
|
967674
967699
|
// src/commands/sdk-preview/computePreviewVersion.ts
|
|
967675
967700
|
var BASE_VERSION = "0.0.1";
|
|
@@ -967789,7 +967814,7 @@ async function sdkPreview({
|
|
|
967789
967814
|
const firstPath = pathOutputs[0];
|
|
967790
967815
|
const absolutePathToOutput = firstPath != null ? AbsoluteFilePath2.of(resolve6(cwd(), firstPath)) : void 0;
|
|
967791
967816
|
if (absolutePathToOutput != null) {
|
|
967792
|
-
await
|
|
967817
|
+
await import_promises193.default.mkdir(absolutePathToOutput, { recursive: true });
|
|
967793
967818
|
}
|
|
967794
967819
|
for (const workspace of project.apiWorkspaces) {
|
|
967795
967820
|
if (workspace.generatorsConfiguration == null) {
|
|
@@ -967978,7 +968003,7 @@ async function sdkPreview({
|
|
|
967978
968003
|
// src/commands/self-update/selfUpdate.ts
|
|
967979
968004
|
init_lib12();
|
|
967980
968005
|
init_lib6();
|
|
967981
|
-
var
|
|
968006
|
+
var import_promises194 = require("fs/promises");
|
|
967982
968007
|
var import_path114 = require("path");
|
|
967983
968008
|
async function getPackageManagerBinDir(logger4, pm2) {
|
|
967984
968009
|
let command3;
|
|
@@ -968024,7 +968049,7 @@ async function detectInstallationMethod(logger4) {
|
|
|
968024
968049
|
logger4.debug(`Found fern at: ${fernPath}`);
|
|
968025
968050
|
let resolvedPath;
|
|
968026
968051
|
try {
|
|
968027
|
-
resolvedPath = await (0,
|
|
968052
|
+
resolvedPath = await (0, import_promises194.realpath)(fernPath);
|
|
968028
968053
|
logger4.debug(`Resolved to: ${resolvedPath}`);
|
|
968029
968054
|
} catch (error50) {
|
|
968030
968055
|
logger4.debug(`Failed to resolve symlink: ${error50}`);
|
|
@@ -968331,22 +968356,22 @@ async function generateToken({
|
|
|
968331
968356
|
init_lib8();
|
|
968332
968357
|
init_lib6();
|
|
968333
968358
|
var fs28 = __toESM(require("fs"), 1);
|
|
968334
|
-
var
|
|
968359
|
+
var import_promises195 = require("fs/promises");
|
|
968335
968360
|
init_graphql();
|
|
968336
968361
|
init_js_yaml();
|
|
968337
968362
|
var import_stream17 = require("stream");
|
|
968338
|
-
var
|
|
968363
|
+
var import_promises196 = require("stream/promises");
|
|
968339
968364
|
async function fetchAndWriteFile(url3, path115, logger4, indent4) {
|
|
968340
968365
|
const resp = await fetch(url3);
|
|
968341
968366
|
if (resp.ok && resp.body) {
|
|
968342
968367
|
logger4.debug("Origin successfully fetched, writing to file");
|
|
968343
968368
|
const fileStream = fs28.createWriteStream(path115);
|
|
968344
|
-
await (0,
|
|
968345
|
-
const fileContents = await (0,
|
|
968369
|
+
await (0, import_promises196.finished)(import_stream17.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
968370
|
+
const fileContents = await (0, import_promises195.readFile)(path115, "utf8");
|
|
968346
968371
|
try {
|
|
968347
|
-
await (0,
|
|
968372
|
+
await (0, import_promises195.writeFile)(path115, JSON.stringify(JSON.parse(fileContents), void 0, indent4), "utf8");
|
|
968348
968373
|
} catch (e8) {
|
|
968349
|
-
await (0,
|
|
968374
|
+
await (0, import_promises195.writeFile)(path115, jsYaml.dump(jsYaml.load(fileContents), { indent: indent4 }), "utf8");
|
|
968350
968375
|
}
|
|
968351
968376
|
logger4.debug("File written successfully");
|
|
968352
968377
|
}
|
|
@@ -968502,14 +968527,14 @@ async function tryDirectJSONFetch(url3, logger4) {
|
|
|
968502
968527
|
async function fetchGraphQLSchemaWithAutoDetection(url3, path115, logger4) {
|
|
968503
968528
|
const postResult = await tryGraphQLIntrospection(url3, logger4);
|
|
968504
968529
|
if (postResult.success) {
|
|
968505
|
-
await (0,
|
|
968530
|
+
await (0, import_promises195.writeFile)(path115, postResult.result, "utf8");
|
|
968506
968531
|
logger4.info("Successfully fetched GraphQL schema using POST introspection");
|
|
968507
968532
|
return;
|
|
968508
968533
|
}
|
|
968509
968534
|
logger4.debug(`POST introspection failed: ${postResult.error}`);
|
|
968510
968535
|
const getResult = await tryDirectJSONFetch(url3, logger4);
|
|
968511
968536
|
if (getResult.success) {
|
|
968512
|
-
await (0,
|
|
968537
|
+
await (0, import_promises195.writeFile)(path115, getResult.result, "utf8");
|
|
968513
968538
|
logger4.info("Successfully fetched GraphQL schema using direct JSON fetch");
|
|
968514
968539
|
return;
|
|
968515
968540
|
}
|
|
@@ -969179,7 +969204,7 @@ async function validateWorkspaces({
|
|
|
969179
969204
|
|
|
969180
969205
|
// src/commands/write-definition/writeDefinitionForWorkspaces.ts
|
|
969181
969206
|
init_lib8();
|
|
969182
|
-
var
|
|
969207
|
+
var import_promises197 = require("fs/promises");
|
|
969183
969208
|
init_js_yaml();
|
|
969184
969209
|
var import_path116 = __toESM(require("path"), 1);
|
|
969185
969210
|
async function writeDefinitionForWorkspaces({
|
|
@@ -969261,28 +969286,28 @@ async function writeFernDefinition({
|
|
|
969261
969286
|
return a3.localeCompare(b8);
|
|
969262
969287
|
};
|
|
969263
969288
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
969264
|
-
await (0,
|
|
969289
|
+
await (0, import_promises197.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
969265
969290
|
}
|
|
969266
|
-
await (0,
|
|
969267
|
-
await (0,
|
|
969291
|
+
await (0, import_promises197.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
969292
|
+
await (0, import_promises197.writeFile)(
|
|
969268
969293
|
join8(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
969269
969294
|
jsYaml.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
969270
969295
|
);
|
|
969271
969296
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
969272
969297
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
969273
|
-
await (0,
|
|
969274
|
-
await (0,
|
|
969298
|
+
await (0, import_promises197.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
969299
|
+
await (0, import_promises197.writeFile)(absoluteFilepath, jsYaml.dump(packageMarker.contents, { sortKeys }));
|
|
969275
969300
|
}
|
|
969276
969301
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
969277
969302
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
969278
|
-
await (0,
|
|
969279
|
-
await (0,
|
|
969303
|
+
await (0, import_promises197.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
969304
|
+
await (0, import_promises197.writeFile)(absoluteFilepath, jsYaml.dump(definitionFile.contents, { sortKeys }));
|
|
969280
969305
|
}
|
|
969281
969306
|
}
|
|
969282
969307
|
|
|
969283
969308
|
// src/commands/write-docs-definition/writeDocsDefinitionForProject.ts
|
|
969284
969309
|
init_lib8();
|
|
969285
|
-
var
|
|
969310
|
+
var import_promises198 = require("fs/promises");
|
|
969286
969311
|
async function writeDocsDefinitionForProject({
|
|
969287
969312
|
project,
|
|
969288
969313
|
outputPath,
|
|
@@ -969314,7 +969339,7 @@ async function writeDocsDefinitionForProject({
|
|
|
969314
969339
|
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
|
|
969315
969340
|
});
|
|
969316
969341
|
const docsDefinition = await docsResolver.resolve();
|
|
969317
|
-
await (0,
|
|
969342
|
+
await (0, import_promises198.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
969318
969343
|
context3.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
969319
969344
|
});
|
|
969320
969345
|
}
|