This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
generated from nekohack-oss/vite-vue3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from jiyuujin/chore/monorepo
chore: monorepo
- Loading branch information
Showing
281 changed files
with
8,584 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module.exports = { | ||
env: { node: true, es2022: true, browser: true }, | ||
extends: ['plugin:astro/recommended'], | ||
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, | ||
overrides: [ | ||
{ | ||
files: ['*.astro'], | ||
parser: 'astro-eslint-parser', | ||
parserOptions: { | ||
parser: '@typescript-eslint/parser', | ||
extraFileExtensions: ['.astro'], | ||
}, | ||
}, | ||
{ | ||
files: ['*.ts'], | ||
parser: '@typescript-eslint/parser', | ||
extends: ['plugin:@typescript-eslint/recommended'], | ||
}, | ||
{ | ||
files: ['**/*.astro/*.js', '*.astro/*.js'], | ||
parser: '@typescript-eslint/parser', | ||
}, | ||
], | ||
rules: { | ||
'@typescript-eslint/triple-slash-reference': 0, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
semi: false, | ||
trailingComma: 'all', | ||
singleQuote: true, | ||
printWidth: 100, | ||
tabWidth: 2, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"filters": {}, | ||
"rules": { | ||
"preset-nekohack-inc": true, | ||
"preset-ja-technical-writing": { | ||
"sentence-length": { | ||
"max": 180 | ||
}, | ||
"max-comma": { | ||
"max": 8 | ||
} | ||
}, | ||
"ja-technical-writing/max-kanji-continuous-len": { | ||
max: 8 | ||
}, | ||
"ja-technical-writing/no-exclamation-question-mark": false, | ||
"ja-technical-writing/ja-no-weak-phrase": false, | ||
"spellcheck-tech-word": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { defineConfig } from 'astro/config' | ||
import remarkToc from 'remark-toc' | ||
import rehypeToc from 'rehype-toc' | ||
import image from '@astrojs/image' | ||
import react from '@astrojs/react' | ||
import svelte from '@astrojs/svelte' | ||
import vue from '@astrojs/vue' | ||
import vanillaExtract from 'astro-vanilla-extract' | ||
|
||
// https://astro.build/config | ||
export default defineConfig({ | ||
remarkPlugins: [ | ||
[ | ||
remarkToc, | ||
{ | ||
tight: true, | ||
ordered: true, | ||
}, | ||
], | ||
], | ||
rehypePlugins: [ | ||
[ | ||
rehypeToc, | ||
{ | ||
headings: ['h1', 'h2', 'h3'], | ||
cssClasses: { | ||
toc: 'toc-post', | ||
link: 'toc-link', | ||
}, | ||
}, | ||
], | ||
], | ||
integrations: [ | ||
react(), | ||
svelte(), | ||
vue(), | ||
vanillaExtract(), | ||
image({ | ||
serviceEntryPoint: '@astrojs/image/sharp', | ||
}), | ||
], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"name": "@nekohack/ai-app", | ||
"description": "", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "astro dev", | ||
"build": "npm run build:feeds && npm run build:front", | ||
"build:front": "astro build", | ||
"build:feeds": "node --loader ts-node/esm scripts/feeds.mjs", | ||
"build:og-gen": "node --loader ts-node/esm scripts/generate.mjs", | ||
"format": "prettier --write \"**/*.{js,jsx,json,ts,tsx,md,mdx,css,html,yml,yaml,scss,sass}\" --ignore-path .gitignore", | ||
"lint": "npm run eslint && npm run textlint", | ||
"lint:fix": "npm run eslint:fix && npm run textlint:fix", | ||
"eslint": "eslint . --ext js,jsx,ts,tsx,astro", | ||
"eslint:fix": "eslint . --ext js,jsx,ts,tsx,astro --fix", | ||
"textlint": "textlint ./src/pages/posts/**", | ||
"textlint:fix": "textlint ./src/pages/posts/** --fix" | ||
}, | ||
"dependencies": { | ||
"svelte": "3.56.0", | ||
"vue": "3.2.47" | ||
}, | ||
"devDependencies": { | ||
"@astrojs/image": "0.16.6", | ||
"@astrojs/react": "2.1.1", | ||
"@astrojs/svelte": "2.1.0", | ||
"@astrojs/vue": "2.1.1", | ||
"astro-vanilla-extract": "2.0.0", | ||
"astro": "2.3.0", | ||
"feed": "4.2.2", | ||
"front-matter": "4.0.2", | ||
"fs-extra": "11.1.1", | ||
"puppeteer": "19.10.1", | ||
"rehype-toc": "3.0.2", | ||
"remark-frontmatter": "4.0.1", | ||
"remark-parse": "10.0.1", | ||
"remark-stringify": "10.0.2", | ||
"remark-toc": "8.0.1", | ||
"sass": "1.62.0", | ||
"sharp": "0.31.3", | ||
"to-vfile": "7.2.4", | ||
"ts-node": "10.9.1", | ||
"unified": "10.1.2" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<browserconfig> | ||
<msapplication> | ||
<tile> | ||
<square150x150logo src="/mstile-150x150.png"/> | ||
<TileColor>#da532c</TileColor> | ||
</tile> | ||
</msapplication> | ||
</browserconfig> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<rss version="2.0"> | ||
<channel> | ||
<title>AIer.info</title> | ||
<link>undefined</link> | ||
<description>週刊でAI界隈の最新情報を記録しています</description> | ||
<lastBuildDate>Sat, 29 Apr 2023 10:33:07 GMT</lastBuildDate> | ||
<docs>https://validator.w3.org/feed/docs/rss2.html</docs> | ||
<generator>https://github.com/jpmonette/feed</generator> | ||
<language>ja</language> | ||
<copyright>nekohack</copyright> | ||
</channel> | ||
</rss> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
User-agent: * | ||
Disallow: / |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "", | ||
"short_name": "", | ||
"icons": [ | ||
{ | ||
"src": "/android-chrome-192x192.png", | ||
"sizes": "192x192", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "/android-chrome-512x512.png", | ||
"sizes": "512x512", | ||
"type": "image/png" | ||
} | ||
], | ||
"theme_color": "#ffffff", | ||
"background_color": "#ffffff", | ||
"display": "standalone" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict' | ||
|
||
import { read } from 'to-vfile' | ||
import { unified } from 'unified' | ||
import remarkStringify from 'remark-stringify' | ||
import remarkParse from 'remark-parse' | ||
import remarkFrontmatter from 'remark-frontmatter' | ||
|
||
import { Feed } from 'feed' | ||
import { promisify } from 'util' | ||
|
||
import fs from 'fs' | ||
import path from 'path' | ||
|
||
const currentDir = './src/pages/posts' | ||
|
||
let feed = new Feed({ | ||
title: 'AIer.info', | ||
description: '週刊でAI界隈の最新情報を記録しています', | ||
feed_url: 'https://ohayo-ai.nekohack.me/feeds.xml', | ||
site_url: 'https://ohayo-ai.nekohack.me/', | ||
copyright: 'nekohack', | ||
language: 'ja', | ||
}) | ||
|
||
fs.readdir(currentDir, function (err, files) { | ||
if (err) throw err | ||
files.forEach(async (file) => { | ||
await unified() | ||
.use(remarkParse) | ||
.use(remarkStringify) | ||
.use(remarkFrontmatter, ['yaml']) | ||
.use(() => async (tree) => { | ||
tree.children.forEach((yaml) => { | ||
if (yaml.type === 'yaml') { | ||
if (/title: .*\n/.test(yaml.value)) { | ||
const title = /title: .*\n/g | ||
.exec(yaml.value)[0] | ||
.replace('title: ', '') | ||
.replace('\n', '') | ||
feed.items.push({ | ||
title: title, | ||
id: `https://ohayo-ai.nekohack.me/posts/${file.replace('.md', '')}`, | ||
link: `https://ohayo-ai.nekohack.me/posts/${file.replace('.md', '')}`, | ||
author: [ | ||
{ | ||
name: 'jiyuujin', | ||
}, | ||
], | ||
description: `${title}について書かせていただきました。`, | ||
body: '', | ||
date: new Date(file.slice(0, 10)), | ||
}) | ||
} | ||
} | ||
}) | ||
await promisify(fs.writeFile)('./public/feeds.xml', feed.rss2()) | ||
}) | ||
.process(await read(path.join(currentDir, file))) | ||
}) | ||
}) | ||
|
||
export default function () {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import path from 'path' | ||
import fs from 'fs' | ||
import puppeteer from 'puppeteer' | ||
import frontMatter from 'front-matter' | ||
|
||
const postsDirectory = path.join(process.cwd(), 'src/content/posts') | ||
|
||
async function getPostReaction(filename) { | ||
let result = '' | ||
|
||
const res = await fs.readFileSync(path.join(postsDirectory, `${filename}`), 'utf8') | ||
const _data = frontMatter(res) | ||
const data = _data.attributes | ||
result = data.reaction | ||
return result | ||
} | ||
|
||
async function main() { | ||
const postFiles = fs.readdirSync(postsDirectory) | ||
|
||
for (const mdFilename of postFiles) { | ||
const title = await getPostReaction(mdFilename) | ||
const browser = await puppeteer.launch({ | ||
headless: true, | ||
args: ['--no-sandbox', '--disable-setuid-sandbox'], | ||
}) | ||
const page = await browser.newPage() | ||
await page.setExtraHTTPHeaders({ | ||
'Accept-Language': 'ja-JP', | ||
}) | ||
|
||
try { | ||
await page.evaluate(() => { | ||
const style = document.createElement('style') | ||
style.textContent = ` | ||
@import url('//fonts.googleapis.com/css?family=M+PLUS+Rounded+1c|Roboto:300,400,500,700|Material+Icons'); | ||
div, input, a, p{ font-family: "M PLUS Rounded 1c", sans-serif; };` | ||
document.head.appendChild(style) | ||
document.body.style.fontFamily = '\'M PLUS Rounded 1c\', sans-serif' | ||
}) | ||
|
||
await page.goto('file:///' + path.join(process.cwd(), 'scripts/reaction-preview.html'), { | ||
waitUntil: 'networkidle0', | ||
}) | ||
|
||
await page.$eval( | ||
'h1', | ||
(el, title) => { | ||
el.innerHTML = title | ||
}, | ||
title, | ||
) | ||
|
||
await page.screenshot({ | ||
path: `public/og/${mdFilename.replace('.md', '')}.png`, | ||
clip: { x: 0, y: 0, width: 840, height: 840 }, | ||
}) | ||
} catch (e) { | ||
console.error(e) | ||
} | ||
|
||
await browser.close() | ||
} | ||
} | ||
|
||
main() |
Oops, something went wrong.
aa5eaa2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ohayo-website – ./
ohayo-website-jiyuujin.vercel.app
ohayo-website.vercel.app
ohayo-website-git-main-jiyuujin.vercel.app
ohayo.nekohack.me