Skip to content

Commit 1ccb356

Browse files
committed
fix octokit import
1 parent f838f1a commit 1ccb356

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

lib/fork-me/touchup.js

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,35 @@ const fs = require("fs");
55
const path = require("path");
66
const packageJson = require(path.resolve(__dirname, "package.json"));
77
if (process.env.TOKEN) {
8-
const { Octokit } = require("octokit");
9-
// Octokit.js
10-
// https://github.com/octokit/core.js#readme
11-
const octokit = new Octokit({
12-
auth: process.env.TOKEN,
13-
});
8+
import("octokit").then(({ Octokit }) => {
9+
// Octokit.js
10+
// https://github.com/octokit/core.js#readme
11+
const octokit = new Octokit({
12+
auth: process.env.TOKEN,
13+
});
1414

15-
const octoOptions = {
16-
owner: process.env.OWNER,
17-
repo: process.env.REPO,
18-
headers: {
19-
"X-GitHub-Api-Version": "2022-11-28",
20-
},
21-
};
22-
const tag_name = `v${packageJson.version}`;
23-
const name = `Release ${tag_name}`;
24-
/** Create a release */
25-
octokit.request("POST /repos/{owner}/{repo}/releases", {
26-
...octoOptions,
27-
tag_name,
28-
target_commitish: "main",
29-
name,
30-
draft: false,
31-
prerelease: false,
32-
generate_release_notes: true,
33-
headers: {
34-
"X-GitHub-Api-Version": "2022-11-28",
35-
},
15+
const octoOptions = {
16+
owner: process.env.OWNER,
17+
repo: process.env.REPO,
18+
headers: {
19+
"X-GitHub-Api-Version": "2022-11-28",
20+
},
21+
};
22+
const tag_name = `v${packageJson.version}`;
23+
const name = `Release ${tag_name}`;
24+
/** Create a release */
25+
octokit.request("POST /repos/{owner}/{repo}/releases", {
26+
...octoOptions,
27+
tag_name,
28+
target_commitish: "main",
29+
name,
30+
draft: false,
31+
prerelease: false,
32+
generate_release_notes: true,
33+
headers: {
34+
"X-GitHub-Api-Version": "2022-11-28",
35+
},
36+
});
3637
});
3738
}
3839

@@ -57,7 +58,7 @@ while (dirs.length) {
5758
const dir = dirs.shift();
5859
fs.readdirSync(dir).forEach(f => {
5960
const f1 = path.resolve(dir, f);
60-
if (f.includes(".test.")) fs.unlink(f1, () => {});
61+
if (f.includes(".test.")) fs.unlink(f1, () => { });
6162
else if (fs.lstatSync(f1).isDirectory()) {
6263
dirs.push(f1);
6364
}

0 commit comments

Comments
 (0)