Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to astro2 #2

Merged
merged 4 commits into from
Jan 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ pnpm-debug.log*

# macOS-specific files
.DS_Store

# metadata for content collections
.astro
48 changes: 48 additions & 0 deletions .netlify/functions-internal/chunks/20230103_new_year.2fe4d5d2.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { j as createVNode, F as Fragment } from './astro.4c29b78c.mjs';
import { $ as $$MarkdownPostLayout } from './MarkdownPostLayout.660b7d0f.mjs';
import 'path-to-regexp';
import 'mime';
import 'cookie';
import 'kleur/colors';
import 'string-width';
import 'slash';
import 'html-escaper';
import './pages/all.3026cc68.mjs';
/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */
const html = "<p>2023 年上半期の目標を立ててみたので、その記録と実行。</p>\n<h2 id=\"目標\">目標</h2>\n<p>目標は以下の通り</p>\n<ul>\n<li>他者と積極的に関わる</li>\n<li>ブログサービスを作って適当に運用する</li>\n<li>70kg 以上になったら米食べるの禁止</li>\n</ul>\n<h2 id=\"ブログサービス\">ブログサービス</h2>\n<p>というわけで、早速ブログサービスを適当に作ってみた。\n1 時間くらいで作っちゃいたかったので、以前素振りしてた Astro でサクッと作ってみることに。</p>\n<p>リポジトリは <a href=\"https://github.com/t0yohei/blog-no-name\">こちら</a>。</p>\n<p>目標にある通り適当に運用していけたらと思う。</p>";

const frontmatter = {"layout":"../../layouts/MarkdownPostLayout.astro","title":"2023 New Year","pubDate":"2023-01-03"};
const file = "/Users/kyohei_toyoda/repos/src/github.com/t0yohei/blog-no-name/src/content/blog/20230103_new_year.md";
const url = undefined;
function rawContent() {
return "\n2023 年上半期の目標を立ててみたので、その記録と実行。\n\n## 目標\n\n目標は以下の通り\n\n- 他者と積極的に関わる\n- ブログサービスを作って適当に運用する\n- 70kg 以上になったら米食べるの禁止\n\n## ブログサービス\n\nというわけで、早速ブログサービスを適当に作ってみた。\n1 時間くらいで作っちゃいたかったので、以前素振りしてた Astro でサクッと作ってみることに。\n\nリポジトリは [こちら](https://github.com/t0yohei/blog-no-name)。\n\n目標にある通り適当に運用していけたらと思う。\n";
}
function compiledContent() {
return html;
}
function getHeadings() {
return [{"depth":2,"slug":"目標","text":"目標"},{"depth":2,"slug":"ブログサービス","text":"ブログサービス"}];
}
async function Content() {
const { layout, ...content } = frontmatter;
content.file = file;
content.url = url;
const contentFragment = createVNode(Fragment, { 'set:html': html });
return createVNode($$MarkdownPostLayout, {
file,
url,
content,
frontmatter: content,
headings: getHeadings(),
rawContent,
compiledContent,
'server:root': true,
children: contentFragment
});
}
Content[Symbol.for('astro.needsHeadRendering')] = false;

const collectedLinks = ["_astro/Header.astro_astro_type_style_index_0_lang.70dd3b15.css","_astro/MarkdownPostLayout.astro_astro_type_style_index_0_lang.1a87fd40.css","_astro/global.475eecb7.css"];
const collectedStyles = "@@ASTRO-STYLES@@";

export { Content, collectedLinks, collectedStyles, getHeadings };
11 changes: 11 additions & 0 deletions .netlify/functions-internal/chunks/20230103_new_year.755dd5f4.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const id = "20230103_new_year.md";
const collection = "blog";
const slug = "20230103_new_year";
const body = "\n2023 年上半期の目標を立ててみたので、その記録と実行。\n\n## 目標\n\n目標は以下の通り\n\n- 他者と積極的に関わる\n- ブログサービスを作って適当に運用する\n- 70kg 以上になったら米食べるの禁止\n\n## ブログサービス\n\nというわけで、早速ブログサービスを適当に作ってみた。\n1 時間くらいで作っちゃいたかったので、以前素振りしてた Astro でサクッと作ってみることに。\n\nリポジトリは [こちら](https://github.com/t0yohei/blog-no-name)。\n\n目標にある通り適当に運用していけたらと思う。\n";
const data = {layout:"..\u002F..\u002Flayouts\u002FMarkdownPostLayout.astro",title:"2023 New Year",pubDate:"2023-01-03"};
const _internal = {
filePath: "/Users/kyohei_toyoda/repos/src/github.com/t0yohei/blog-no-name/src/content/blog/20230103_new_year.md",
rawData: "\nlayout: ../../layouts/MarkdownPostLayout.astro\ntitle: '2023 New Year'\npubDate: '2023-01-03'",
};

export { _internal, body, collection, data, id, slug };
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { j as createVNode, F as Fragment } from './astro.4c29b78c.mjs';
import { $ as $$MarkdownPostLayout } from './MarkdownPostLayout.660b7d0f.mjs';
import 'path-to-regexp';
import 'mime';
import 'cookie';
import 'kleur/colors';
import 'string-width';
import 'slash';
import 'html-escaper';
import './pages/all.3026cc68.mjs';
/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */
const html = "<p>テスト用に複数の記事が欲しかったので連続投稿。</p>\n<p>仕事始めの日だった。のんびり過ごすつもりだったけど思いの外ハードな一日だった。</p>\n<h2 id=\"開発について\">開発について</h2>\n<p>プロフィール機能作るかーとか、OGP 作るかーとか、記事の保存先を DB にして消したり編集したり色々できるようにしたいとは思うが、まだ選定に迷ってる。</p>\n<p>自分しか使わないし、RDB じゃなくて Key-Value Store とかでもよくね?とも思ったり、認証の実装面倒くさいから Google 認証で自分だけ認証できるようにしたらいいかとか諸々。</p>\n<p>ひとまず今日は <a href=\"https://docs.astro.build/en/tutorial/0-introduction/\">Astro のチュートリアル</a> にある内容で、取り入れそうなものを取り入れてみることに。</p>";

const frontmatter = {"layout":"../../layouts/MarkdownPostLayout.astro","title":"2023 仕事始め","pubDate":"2023-01-04"};
const file = "/Users/kyohei_toyoda/repos/src/github.com/t0yohei/blog-no-name/src/content/blog/20230104_start_working.md";
const url = undefined;
function rawContent() {
return "\nテスト用に複数の記事が欲しかったので連続投稿。\n\n仕事始めの日だった。のんびり過ごすつもりだったけど思いの外ハードな一日だった。\n\n## 開発について\n\nプロフィール機能作るかーとか、OGP 作るかーとか、記事の保存先を DB にして消したり編集したり色々できるようにしたいとは思うが、まだ選定に迷ってる。\n\n自分しか使わないし、RDB じゃなくて Key-Value Store とかでもよくね?とも思ったり、認証の実装面倒くさいから Google 認証で自分だけ認証できるようにしたらいいかとか諸々。\n\nひとまず今日は [Astro のチュートリアル](https://docs.astro.build/en/tutorial/0-introduction/) にある内容で、取り入れそうなものを取り入れてみることに。\n";
}
function compiledContent() {
return html;
}
function getHeadings() {
return [{"depth":2,"slug":"開発について","text":"開発について"}];
}
async function Content() {
const { layout, ...content } = frontmatter;
content.file = file;
content.url = url;
const contentFragment = createVNode(Fragment, { 'set:html': html });
return createVNode($$MarkdownPostLayout, {
file,
url,
content,
frontmatter: content,
headings: getHeadings(),
rawContent,
compiledContent,
'server:root': true,
children: contentFragment
});
}
Content[Symbol.for('astro.needsHeadRendering')] = false;

const collectedLinks = ["_astro/Header.astro_astro_type_style_index_0_lang.70dd3b15.css","_astro/MarkdownPostLayout.astro_astro_type_style_index_0_lang.1a87fd40.css","_astro/global.475eecb7.css"];
const collectedStyles = "@@ASTRO-STYLES@@";

export { Content, collectedLinks, collectedStyles, getHeadings };
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const id = "20230104_start_working.md";
const collection = "blog";
const slug = "20230104_start_working";
const body = "\nテスト用に複数の記事が欲しかったので連続投稿。\n\n仕事始めの日だった。のんびり過ごすつもりだったけど思いの外ハードな一日だった。\n\n## 開発について\n\nプロフィール機能作るかーとか、OGP 作るかーとか、記事の保存先を DB にして消したり編集したり色々できるようにしたいとは思うが、まだ選定に迷ってる。\n\n自分しか使わないし、RDB じゃなくて Key-Value Store とかでもよくね?とも思ったり、認証の実装面倒くさいから Google 認証で自分だけ認証できるようにしたらいいかとか諸々。\n\nひとまず今日は [Astro のチュートリアル](https://docs.astro.build/en/tutorial/0-introduction/) にある内容で、取り入れそうなものを取り入れてみることに。\n";
const data = {layout:"..\u002F..\u002Flayouts\u002FMarkdownPostLayout.astro",title:"2023 仕事始め",pubDate:"2023-01-04"};
const _internal = {
filePath: "/Users/kyohei_toyoda/repos/src/github.com/t0yohei/blog-no-name/src/content/blog/20230104_start_working.md",
rawData: "\nlayout: ../../layouts/MarkdownPostLayout.astro\ntitle: '2023 仕事始め'\npubDate: '2023-01-04'",
};

export { _internal, body, collection, data, id, slug };
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const id = "20230108_add_webcomponents.md";
const collection = "blog";
const slug = "20230108_add_webcomponents";
const body = "\n基本的には公式サイトに書いてある通り。\n\nhttps://docs.astro.build/en/guides/client-side-scripts/#web-components-with-custom-elements\n\nastro ファイル内に書く場合は、 `<script>` タグ内にカスタム要素を実装して使うだけ(↓ は公式サイトからの引用)。\n\n`src/components/AstroHeart.astro`\n\n```html\n<!-- Wrap the component elements in our custom element “astro-heart”. -->\n<!-- prettier-ignore -->\n<astro-heart>\n <button aria-label=\"Heart\">💜</button> × <span>0</span>\n</astro-heart>\n\n<script>\n // Define the behaviour for our new type of HTML element.\n class AstroHeart extends HTMLElement {\n constructor() {\n super();\n let count = 0;\n\n const heartButton = this.querySelector('button');\n const countSpan = this.querySelector('span');\n\n // Each time the button is clicked, update the count.\n heartButton.addEventListener('click', () => {\n count++;\n countSpan.textContent = count;\n });\n }\n }\n\n // Tell the browser to use our AstroHeart class for <astro-heart> elements.\n customElements.define('astro-heart', AstroHeart);\n</script>\n```\n\n外部ファイルに切り出す場合は、 `<script>` タグの src 属性に指定するか、\n\n```html\n<script src=\"../components/aboutme.js\"></script>\n\n<about-me></about-me>\n```\n\nimport で読み込むだけ。\n\n```html\n<script>\n import '../components/aboutme.js';\n</script>\n\n<about-me></about-me>\n```\n\nそうすると、ページの `head` 要素に `type=\"module\"` で挿入されてカスタム要素が使えるようになる。\n\n昔は resolve API とかを使う必要があったらしいけど: https://navillus.dev/blog/web-components-in-astro\n\nresolve API が廃止されて今の形になったらしい: https://docs.astro.build/en/migrate/#deprecated-astroresolve\n\n実装サンプル: https://github.com/t0yohei/blog-no-name/pull/1/files\n";
const data = {layout:"..\u002F..\u002Flayouts\u002FMarkdownPostLayout.astro",title:"Astro 内で Web components を使用する方法",pubDate:"2023-01-08"};
const _internal = {
filePath: "/Users/kyohei_toyoda/repos/src/github.com/t0yohei/blog-no-name/src/content/blog/20230108_add_webcomponents.md",
rawData: "\nlayout: ../../layouts/MarkdownPostLayout.astro\ntitle: 'Astro 内で Web components を使用する方法'\npubDate: '2023-01-08'",
};

export { _internal, body, collection, data, id, slug };