@fern-api/generator-cli 0.3.0 → 0.3.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/dist/cli.cjs +7 -41
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -5846,7 +5846,7 @@ function resolve(...paths) {
|
|
|
5846
5846
|
|
|
5847
5847
|
// src/cli.ts
|
|
5848
5848
|
var import_fs6 = __toESM(require("fs"), 1);
|
|
5849
|
-
var
|
|
5849
|
+
var import_promises6 = require("fs/promises");
|
|
5850
5850
|
var import_path7 = __toESM(require("path"), 1);
|
|
5851
5851
|
|
|
5852
5852
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/yerror.js
|
|
@@ -13628,30 +13628,21 @@ async function loadGitHubConfig({
|
|
|
13628
13628
|
return JSON.parse(rawContents);
|
|
13629
13629
|
}
|
|
13630
13630
|
|
|
13631
|
-
// src/configuration/loadMetadataConfig.ts
|
|
13632
|
-
var import_promises4 = require("fs/promises");
|
|
13633
|
-
async function loadMetadataConfig({
|
|
13634
|
-
absolutePathToConfig
|
|
13635
|
-
}) {
|
|
13636
|
-
const rawContents = await (0, import_promises4.readFile)(absolutePathToConfig, "utf8");
|
|
13637
|
-
return JSON.parse(rawContents);
|
|
13638
|
-
}
|
|
13639
|
-
|
|
13640
13631
|
// src/configuration/loadReadmeConfig.ts
|
|
13641
|
-
var
|
|
13632
|
+
var import_promises4 = require("fs/promises");
|
|
13642
13633
|
async function loadReadmeConfig({
|
|
13643
13634
|
absolutePathToConfig
|
|
13644
13635
|
}) {
|
|
13645
|
-
const rawContents = await (0,
|
|
13636
|
+
const rawContents = await (0, import_promises4.readFile)(absolutePathToConfig, "utf8");
|
|
13646
13637
|
return JSON.parse(rawContents);
|
|
13647
13638
|
}
|
|
13648
13639
|
|
|
13649
13640
|
// src/configuration/loadReferenceConfig.ts
|
|
13650
|
-
var
|
|
13641
|
+
var import_promises5 = require("fs/promises");
|
|
13651
13642
|
async function loadReferenceConfig({
|
|
13652
13643
|
absolutePathToConfig
|
|
13653
13644
|
}) {
|
|
13654
|
-
const rawContents = await (0,
|
|
13645
|
+
const rawContents = await (0, import_promises5.readFile)(absolutePathToConfig, "utf8");
|
|
13655
13646
|
return JSON.parse(rawContents);
|
|
13656
13647
|
}
|
|
13657
13648
|
|
|
@@ -13678,7 +13669,7 @@ void yargs_default(hideBin(process.argv)).scriptName(process.env.CLI_NAME ?? "ge
|
|
|
13678
13669
|
const readmeConfig = await loadReadmeConfig({
|
|
13679
13670
|
absolutePathToConfig: resolve(wd, argv.config)
|
|
13680
13671
|
});
|
|
13681
|
-
const originalReadmeContent = argv.originalReadme != null ? await (0,
|
|
13672
|
+
const originalReadmeContent = argv.originalReadme != null ? await (0, import_promises6.readFile)(argv.originalReadme, "utf8") : void 0;
|
|
13682
13673
|
await generateReadmeToStream({
|
|
13683
13674
|
originalReadmeContent,
|
|
13684
13675
|
readmeConfig,
|
|
@@ -13711,31 +13702,6 @@ void yargs_default(hideBin(process.argv)).scriptName(process.env.CLI_NAME ?? "ge
|
|
|
13711
13702
|
});
|
|
13712
13703
|
process.exit(0);
|
|
13713
13704
|
}
|
|
13714
|
-
).command(
|
|
13715
|
-
"write-metadata",
|
|
13716
|
-
"Write metadata to the output directory using the provided configuration file.",
|
|
13717
|
-
(argv) => argv.option("config", {
|
|
13718
|
-
string: true,
|
|
13719
|
-
required: true
|
|
13720
|
-
}).option("output", {
|
|
13721
|
-
string: true,
|
|
13722
|
-
required: false
|
|
13723
|
-
}),
|
|
13724
|
-
async (argv) => {
|
|
13725
|
-
if (argv.config == null) {
|
|
13726
|
-
process.stderr.write("missing required arguments; please specify the --config flag\n");
|
|
13727
|
-
process.exit(1);
|
|
13728
|
-
}
|
|
13729
|
-
const wd = cwd();
|
|
13730
|
-
const metadata = await loadMetadataConfig({
|
|
13731
|
-
absolutePathToConfig: resolve(wd, argv.config)
|
|
13732
|
-
});
|
|
13733
|
-
const outputPath = argv.output != null ? resolve(wd, argv.output) : resolve(wd, ".fern/metadata.json");
|
|
13734
|
-
const formattedMetadata = JSON.stringify(metadata, null, 2);
|
|
13735
|
-
await (0, import_promises7.mkdir)(import_path7.default.dirname(outputPath), { recursive: true });
|
|
13736
|
-
await (0, import_promises7.writeFile)(outputPath, formattedMetadata, "utf8");
|
|
13737
|
-
process.exit(0);
|
|
13738
|
-
}
|
|
13739
13705
|
).command("github", "GitHub operations", (yargs) => {
|
|
13740
13706
|
return yargs.command(
|
|
13741
13707
|
"push",
|
|
@@ -13815,7 +13781,7 @@ async function createWriteStream(outputPath) {
|
|
|
13815
13781
|
}
|
|
13816
13782
|
async function createWriteStreamFromFile(filepath) {
|
|
13817
13783
|
if (!await doesPathExist(filepath)) {
|
|
13818
|
-
await (0,
|
|
13784
|
+
await (0, import_promises6.mkdir)(import_path7.default.dirname(filepath), { recursive: true });
|
|
13819
13785
|
}
|
|
13820
13786
|
return import_fs6.default.createWriteStream(filepath);
|
|
13821
13787
|
}
|