Skip to content

Commit

Permalink
chore: use top level await
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Oct 27, 2023
1 parent 5785de9 commit 1ba3ae0
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 50 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "appcenter",
"version": "0.1.0",
"type": "module",
"repository": "git@github.com:rx-ts/appcenter.git",
"repository": "git+https://github.com/un-ts/appcenter.git",
"author": "JounQin (https://www.1stG.me) <[email protected]>",
"license": "MIT",
"scripts": {
Expand Down
91 changes: 43 additions & 48 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,49 @@ import fs from 'node:fs/promises'

import { request } from '@octokit/request'

const main = async () => {
/**
* @link https://github.com/sindresorhus/github-markdown-css
*/
const { data } = await request('POST /markdown', {
text: await fs.readFile('README.md', 'utf8'),
token: process.env.GITHUB_TOKEN,
})
/**
* @link https://github.com/sindresorhus/github-markdown-css
*/
const { data } = await request('POST /markdown', {
text: await fs.readFile('README.md', 'utf8'),
token: process.env.GITHUB_TOKEN,
})

await fs.writeFile(
'public/index.html',
/* HTML */ `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>App Center</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/4.0.0/github-markdown.min.css"
/>
<style>
.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}
await fs.writeFile(
'public/index.html',
/* HTML */ `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>App Center</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/4.0.0/github-markdown.min.css"
/>
<style>
.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}
@media (max-width: 767px) {
.markdown-body {
padding: 15px;
}
@media (max-width: 767px) {
.markdown-body {
padding: 15px;
}
</style>
</head>
<body>
<article class="markdown-body">${data}</article>
</body>
</html>
`,
)
}

// eslint-disable-next-line unicorn/prefer-top-level-await
main().catch(console.error)
}
</style>
</head>
<body>
<article class="markdown-body">${data}</article>
</body>
</html>
`,
)
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "@1stg/tsconfig"
"extends": "@1stg/tsconfig/node16"
}

0 comments on commit 1ba3ae0

Please sign in to comment.