Skip to content

Commit

Permalink
feat: publish OpenAPI specs as well as types
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy1339 committed May 19, 2023
1 parent c4f85dd commit 764b193
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 28 deletions.
20 changes: 0 additions & 20 deletions index.js

This file was deleted.

26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,37 @@
"pkgRoot": "packages/openapi-webhooks-types-ghes-3.8"
}
],
[
"@semantic-release/npm",
{
"pkgRoot": "packages/openapi-webhooks-types-ghes-3.9"
}
],
[
"@semantic-release/npm",
{
"pkgRoot": "packages/openapi-webhooks-types-github.ae"
}
],
[
"semantic-release-plugin-update-version-in-files",
{
"files": [
"packages/openapi-webhooks/generated/*"
]
}
],
[
"@semantic-release/github",
{
"assets": "packages/openapi-webhooks/generated/*.json"
}
],
[
"@semantic-release/npm",
{
"pkgRoot": "packages/openapi-webhooks"
}
]
]
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions packages/openapi-webhooks/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
schemas: {
["api.github.com"]: require("./generated/api.github.com.json"),
["ghec"]: require("./generated/ghec.json"),
["ghes-3.5"]: require("./generated/ghes-3.5.json"),
["ghes-3.6"]: require("./generated/ghes-3.6.json"),
["ghes-3.7"]: require("./generated/ghes-3.7.json"),
["ghes-3.8"]: require("./generated/ghes-3.8.json"),
["ghes-3.9"]: require("./generated/ghes-3.9.json"),
["github.ae"]: require("./generated/github.ae.json"),
},
};
21 changes: 21 additions & 0 deletions packages/openapi-webhooks/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "@wolfy1339/openapi-webhooks",
"private": true,
"version": "0.0.0-development",
"description": "GitHub's official Webhooks OpenAPI spec with Octokit extensions",
"main": "index.js",
"files": [],
"type": "commonjs",
"repository": {
"type": "git",
"url": "https://github.com/wolfy1330/openapi-webhooks.git",
"directory": "packages/openapi-webhooks"
},
"keywords": [
"github",
"openapi",
"octokit"
],
"author": "Wolfy1339 <webmaster@wolfy1339.com>",
"license": "MIT"
}
12 changes: 7 additions & 5 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,23 @@ async function run() {


writeFileSync(
`generated/${file}`,
`packages/openapi-webhooks/generated/${file}`,
prettier.format(JSON.stringify(tempSchema), { parser: "json" })
);
console.log(`generated/${file} written`);
console.log(`packages/openapi-webhooks/generated/${file} written`);
}

/* for (const name of schemaFileNames) {
let schemasCode = "";

for (const name of schemaFileNames) {
schemasCode += `["${name.replace(
".json",
""
)}"]: require("./generated/${name}"),`;
}

writeFileSync(
"index.js",
"packages/openapi-webhooks/index.js",
prettier.format(
`
module.exports = {
Expand All @@ -97,5 +99,5 @@ async function run() {
parser: "babel",
}
)
); */
);
}
22 changes: 19 additions & 3 deletions scripts/update-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ updatePackage();
async function updatePackage() {
// set semantic-release configuration of npm packages
const items = await readdir("packages");
const packages = items.filter((item) =>
const typePackages = items.filter((item) =>
item.startsWith("openapi-webhooks-types")
);

Expand All @@ -21,15 +21,31 @@ async function updatePackage() {
"@semantic-release/release-notes-generator",
"@semantic-release/github",
].concat(
packages.map((packageName) => {
typePackages.map((packageName) => {
return [
"@semantic-release/npm",
{
pkgRoot: `packages/${packageName}`,
},
];
})
);
).concat([
[
"semantic-release-plugin-update-version-in-files",
{
"files": [
"generated/*"
]
}
],
[
"@semantic-release/github",
{
"assets": "generated/*.json"
}
],
["@semantic-release/npm", { pkgRoot: "packages/openapi-webhooks" }]
]);

await writeFile(
"package.json",
Expand Down

0 comments on commit 764b193

Please sign in to comment.