Skip to content

Commit c5cfcaa

Browse files
committed
Merge branch 'main' into openapi-typescript-v7
2 parents 8dded42 + 7434079 commit c5cfcaa

File tree

5 files changed

+32
-31
lines changed

5 files changed

+32
-31
lines changed

scripts/build.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ async function run() {
3838
const tempSchema = { ...schema };
3939
tempSchema.components = {
4040
schemas: {},
41-
examples: {}
41+
examples: {},
4242
};
4343

4444
/**
4545
* Function to handle special cases:
46-
* Check all instances of `$ref` in the OpenAPI spec, and add them to the definitions
47-
* Remove all instances of `enterprise` in the OpenAPI spec for GitHub.com
46+
* Check all instances of `$ref` in the OpenAPI spec, and add them to the definitions
47+
* Remove all instances of `enterprise` in the OpenAPI spec for GitHub.com
4848
* @param {object} obj - The object to check for special cases
4949
* @returns {object} - The object with any special cases handled
50-
*/
50+
*/
5151
const specialHandling = (obj) => {
5252
if (typeof obj !== "object" || obj === null) return obj;
5353

@@ -90,14 +90,15 @@ async function run() {
9090
if (typeof examples !== "undefined") {
9191
for (let key of Object.keys(examples)) {
9292
const example$ref = examples[key].$ref.split("/").at(-1);
93-
tempSchema.components.examples[example$ref] = schema.components.examples[example$ref];
93+
tempSchema.components.examples[example$ref] =
94+
schema.components.examples[example$ref];
9495
}
9596
}
9697
}
9798

9899
writeFileSync(
99100
`packages/openapi-webhooks/generated/${file}`,
100-
await prettier.format(JSON.stringify(tempSchema), { parser: "json" })
101+
await prettier.format(JSON.stringify(tempSchema), { parser: "json" }),
101102
);
102103
console.log(`packages/openapi-webhooks/generated/${file} written`);
103104
}
@@ -107,7 +108,7 @@ async function run() {
107108
for (const name of schemaFileNames) {
108109
schemasCode += `["${name.replace(
109110
".json",
110-
""
111+
"",
111112
)}"]: require("./generated/${name}"),`;
112113
}
113114

@@ -117,8 +118,8 @@ async function run() {
117118
`# Please do not edit files in this folder
118119
119120
They are all generated, your changes would be overwritten with the next update. If you found a problem with GitHub's OpenAPI schema, file an issue at https://github.com/github/rest-api-description/. If you found a problem specific to the \`x-octokit\` extension or usage of the \`@octokit/openapi\` module, please file an issue at https://github.com/octokit/openapi.`,
120-
{ parser: "markdown" }
121-
)
121+
{ parser: "markdown" },
122+
),
122123
);
123124
writeFileSync(
124125
"packages/openapi-webhooks/index.js",
@@ -132,8 +133,8 @@ They are all generated, your changes would be overwritten with the next update.
132133
`,
133134
{
134135
parser: "babel",
135-
}
136-
)
136+
},
137+
),
137138
);
138139
writeFileSync(
139140
`packages/openapi-webhooks/package.json`,
@@ -158,15 +159,15 @@ They are all generated, your changes would be overwritten with the next update.
158159
access: "public",
159160
},
160161
}),
161-
{ parser: "json-stringify" }
162-
)
162+
{ parser: "json-stringify" },
163+
),
163164
);
164165

165166
writeFileSync(
166167
`packages/openapi-webhooks/README.md`,
167168
readFileSync("README.md", "utf8")
168169
.toString()
169-
.replace("(CONTRIBUTING.md)", "(../../CONTRIBUTING.md)")
170+
.replace("(CONTRIBUTING.md)", "(../../CONTRIBUTING.md)"),
170171
);
171172
copyFileSync("LICENSE", `packages/openapi-webhooks/LICENSE`);
172173
}

scripts/download.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,27 @@ async function run() {
4343
});
4444
getDescriptionsOptions.ref = ref;
4545
console.log(
46-
`Open pull requests found by @github-openapi-bot: ${mostRecentPr.html_url}.\nLoading descriptions from "${ref}" branch`
46+
`Open pull requests found by @github-openapi-bot: ${mostRecentPr.html_url}.\nLoading descriptions from "${ref}" branch`,
4747
);
4848
} else {
4949
console.log(
50-
"No open pull requests found by @github-openapi-bot. Loading descriptions from default branch"
50+
"No open pull requests found by @github-openapi-bot. Loading descriptions from default branch",
5151
);
5252
}
5353

5454
const { data } = await octokit.request(
5555
"GET /repos/{owner}/{repo}/contents/{path}",
56-
getDescriptionsOptions
56+
getDescriptionsOptions,
5757
);
5858

5959
if (!Array.isArray(data)) {
6060
throw new Error(
61-
"https://github.com/github/rest-api-description/tree/main/descriptions-next is not a directory"
61+
"https://github.com/github/rest-api-description/tree/main/descriptions-next is not a directory",
6262
);
6363
}
6464

6565
// temporarily hardcode versions until we unblock automated updates
66-
const currentGhesVersions = [...await getCurrentVersions()];
66+
const currentGhesVersions = [...(await getCurrentVersions())];
6767

6868
for (const folder of data) {
6969
const { name } = folder;
@@ -98,7 +98,7 @@ async function download(name, remotePath) {
9898
if (error) return reject(error);
9999
console.log("%s written", path);
100100
resolve();
101-
})
101+
}),
102102
)
103103
.on("error", (error) => reject(error.message));
104104
});
@@ -113,6 +113,6 @@ async function download(name, remotePath) {
113113
path,
114114
await prettier.format(JSON.stringify(jsonContent), {
115115
parser: "json",
116-
})
116+
}),
117117
);
118118
}

scripts/generate-types.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ async function run() {
5353
},
5454
...packageDefaults,
5555
}),
56-
{ parser: "json-stringify" }
57-
)
56+
{ parser: "json-stringify" },
57+
),
5858
);
5959
await writeFile(
6060
`packages/${packageName}/README.md`,
@@ -80,8 +80,8 @@ type Repository = components["schemas"]["full-repository"]
8080
8181
[MIT](LICENSE)
8282
`,
83-
{ parser: "markdown" }
84-
)
83+
{ parser: "markdown" },
84+
),
8585
);
8686

8787
await copyFile("LICENSE", `packages/${packageName}/LICENSE`);
@@ -103,8 +103,8 @@ type Repository = components["schemas"]["full-repository"]
103103
outputFile,
104104
{
105105
parser: "typescript",
106-
}
107-
)
106+
},
107+
),
108108
);
109109
console.log(`packages/${packageName}/types.d.ts written`);
110110
}

scripts/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ console.log("Verifying folders: %j", VERIFY_FOLDERS);
66
const files = VERIFY_FOLDERS.map((folder) =>
77
readdirSync(folder)
88
.filter((file) => file.endsWith(".json"))
9-
.map((file) => `${folder}/${file}`)
9+
.map((file) => `${folder}/${file}`),
1010
).flat();
1111

1212
const errors = [];

scripts/update-package.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ async function updatePackage() {
1313
// set semantic-release configuration of npm packages
1414
const items = await readdir("packages");
1515
const typePackages = items.filter((item) =>
16-
item.startsWith("openapi-webhooks-types")
16+
item.startsWith("openapi-webhooks-types"),
1717
);
1818

1919
pkg.release.plugins = [
@@ -40,11 +40,11 @@ async function updatePackage() {
4040
pkgRoot: `packages/${packageName}`,
4141
},
4242
];
43-
})
43+
}),
4444
);
4545

4646
await writeFile(
4747
"package.json",
48-
await prettier.format(JSON.stringify(pkg), { parser: "json-stringify" })
48+
await prettier.format(JSON.stringify(pkg), { parser: "json-stringify" }),
4949
);
5050
}

0 commit comments

Comments
 (0)