Skip to content

Commit 7d66816

Browse files
committed
lint and remove generateVersionTable from test covereage
1 parent 1ee96cf commit 7d66816

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

.nycrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"src/updateApis.ts",
77
"src/lib/config.ts",
88
"src/generate-oas.ts",
9+
"src/generateVersionTable.ts",
910
"src/removeInternalOas.ts",
1011
"src/static/helpers/index.ts",
1112
"src/lib/utils.ts"

src/generateVersionTable.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* Copyright (c) 2025, Salesforce, Inc.
2+
* Copyright (c) 2025, salesforce.com, inc.
33
* All rights reserved.
44
* SPDX-License-Identifier: BSD-3-Clause
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import * as fs from 'fs';
8-
import * as path from 'path';
7+
import * as fs from "fs";
8+
import * as path from "path";
99

1010
interface ApiVersion {
1111
name: string;
@@ -16,9 +16,9 @@ function extractApiVersionsFromDirectory(apisDir: string): ApiVersion[] {
1616
const apiVersions: ApiVersion[] = [];
1717

1818
try {
19-
const entries = fs.readdirSync(apisDir, {withFileTypes: true});
19+
const entries = fs.readdirSync(apisDir, { withFileTypes: true });
2020

21-
entries.forEach(entry => {
21+
entries.forEach((entry) => {
2222
if (entry.isDirectory()) {
2323
const dirName = entry.name;
2424

@@ -37,19 +37,19 @@ function extractApiVersionsFromDirectory(apisDir: string): ApiVersion[] {
3737
}
3838
});
3939
} catch (error) {
40-
console.error('Error reading APIs directory:', error);
40+
console.error("Error reading APIs directory:", error);
4141
process.exit(1);
4242
}
4343

4444
return apiVersions;
4545
}
4646

4747
function generateVersionTable(apiVersions: ApiVersion[]): string {
48-
let table = '### API Versions\n\n';
49-
table += '| API Name | API Version |\n';
50-
table += '|----------|-------------|\n';
48+
let table = "### API Versions\n\n";
49+
table += "| API Name | API Version |\n";
50+
table += "|----------|-------------|\n";
5151

52-
apiVersions.forEach(api => {
52+
apiVersions.forEach((api) => {
5353
table += `| ${api.name} | ${api.version} |\n`;
5454
});
5555

@@ -58,7 +58,7 @@ function generateVersionTable(apiVersions: ApiVersion[]): string {
5858

5959
function updateChangelog(changelogPath: string, versionTable: string) {
6060
try {
61-
let changelogContent = fs.readFileSync(changelogPath, 'utf8');
61+
let changelogContent = fs.readFileSync(changelogPath, "utf8");
6262

6363
// Find the most recent version section (first ## heading)
6464
const versionSectionMatch = /(## .+?\n\n)/.exec(changelogContent);
@@ -108,22 +108,22 @@ function updateChangelog(changelogPath: string, versionTable: string) {
108108
changelogContent += `\n\n${versionTable}`;
109109
}
110110

111-
fs.writeFileSync(changelogPath, changelogContent, 'utf8');
112-
console.log('✅ Successfully updated CHANGELOG.md with API version table');
111+
fs.writeFileSync(changelogPath, changelogContent, "utf8");
112+
console.log("✅ Successfully updated CHANGELOG.md with API version table");
113113
} catch (error) {
114-
console.error('Error updating CHANGELOG.md:', error);
114+
console.error("Error updating CHANGELOG.md:", error);
115115
process.exit(1);
116116
}
117117
}
118118

119119
function main() {
120120
const apiVersions = extractApiVersionsFromDirectory(
121-
path.join(__dirname, '../apis')
121+
path.join(__dirname, "../apis")
122122
);
123123
const versionTable = generateVersionTable(apiVersions);
124-
console.log('Generated version table:');
124+
console.log("Generated version table:");
125125
console.log(versionTable);
126-
updateChangelog(path.join(__dirname, '../CHANGELOG.md'), versionTable);
126+
updateChangelog(path.join(__dirname, "../CHANGELOG.md"), versionTable);
127127
}
128128

129129
if (require.main === module) {

0 commit comments

Comments
 (0)