Skip to content

Commit

Permalink
[0400-react-todo] add deploy.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
version-1 committed Apr 30, 2024
1 parent 79ce217 commit b54d518
Show file tree
Hide file tree
Showing 42 changed files with 95 additions and 6 deletions.
13 changes: 13 additions & 0 deletions 0400-react-todo/deploy.sh
@@ -0,0 +1,13 @@
#!/bin/bash

set -e

PROJECT_DIR=0400-react-todo

echo '[Build] Build Next.js'
npm run build

echo '[Deploy] Copy exported files'
cp -pr out/* ../public/$PROJECT_DIR

echo 'Done'
5 changes: 4 additions & 1 deletion 0400-react-todo/next.config.mjs
@@ -1,6 +1,9 @@
/** @type {import('next').NextConfig} */
const isProd = process.env.NODE_ENV === 'production'

const nextConfig = {
output: 'export'
output: 'export',
assetPrefix: isProd ? 'https://version1-workspace.github.io/ws-01-0100-fe-materials/0300-js-dom-todo/' : undefined,
};

export default nextConfig;
8 changes: 6 additions & 2 deletions 0400-react-todo/src/app/page.js
Expand Up @@ -46,7 +46,7 @@ export default function Home() {
const error = validate(task);
if (error) {
alert(error);
return false
return false;
}

const _task = {
Expand Down Expand Up @@ -76,10 +76,14 @@ export default function Home() {

setData(tasks);

return tasks
return tasks;
};

const onDelete = (task) => {
if (!confirm("このタスクを削除しますか?")) {
return;
}

const tasks = data.filter((row) => task.id !== row.id);

setData(tasks);
Expand Down
1 change: 1 addition & 0 deletions public/0400-react-todo/404.html
@@ -0,0 +1 @@
<!DOCTYPE html><html lang="ja"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="https://version1-workspace.github.io/ws-01-0100-fe-materials/0300-js-dom-todo/_next/static/media/c9a5bc6a7c948fb0-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="https://version1-workspace.github.io/ws-01-0100-fe-materials/0300-js-dom-todo/_next/static/css/78a9ca6833826aa0.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="https://version1-workspace.github.io/ws-01-0100-fe-materials/0300-js-dom-todo/_next/static/chunks/webpack-7c270892085abf3d.js"/><script src="https://version1-workspace.github.io/ws-01-0100-fe-materials/0300-js-dom-todo/_next/static/chunks/fd9d1056-bff8144de764f4a0.js" async=""></script><script src="https://version1-workspace.github.io/ws-01-0100-fe-materials/0300-js-dom-todo/_next/static/chunks/23-a8175b033029a530.js" async=""></script><script src="https://version1-workspace.github.io/ws-01-0100-fe-materials/0300-js-dom-todo/_next/static/chunks/main-app-9b42bec5b5768c35.js" async=""></script><title>404: This page could not be found.</title><title>Todo</title><meta name="description" content="React Todo"/><meta name="next-size-adjust"/><script src="https://version1-workspace.github.io/ws-01-0100-fe-materials/0300-js-dom-todo/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js" noModule=""></script></head><body class="__className_ddd637"><header class="layout_header__g7cns"><h1 class="layout_logo__n_Zrq">Todo</h1></header><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><footer></footer><script src="https://version1-workspace.github.io/ws-01-0100-fe-materials/0300-js-dom-todo/_next/static/chunks/webpack-7c270892085abf3d.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"https://version1-workspace.github.io/ws-01-0100-fe-materials/0300-js-dom-todo/_next/static/media/c9a5bc6a7c948fb0-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"https://version1-workspace.github.io/ws-01-0100-fe-materials/0300-js-dom-todo/_next/static/css/78a9ca6833826aa0.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"3:I[5751,[],\"\"]\n5:I[9275,[],\"\"]\n6:I[1343,[],\"\"]\nc:I[6130,[],\"\"]\n7:{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"}\n8:{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"}\n9:{\"display\":\"inline-block\"}\na:{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0}\nd:[]\n"])</script><script>self.__next_f.push([1,"0:[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"https://version1-workspace.github.io/ws-01-0100-fe-materials/0300-js-dom-todo/_next/static/css/78a9ca6833826aa0.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"$L3\",null,{\"buildId\":\"A8LHLsEenePVEtStsQ0hd\",\"assetPrefix\":\"https://version1-workspace.github.io/ws-01-0100-fe-materials/0300-js-dom-todo\",\"initialCanonicalUrl\":\"/_not-found\",\"initialTree\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{},[[\"$L4\",[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]]],null],null]},[\"$\",\"$L5\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"/_not-found\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L6\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}],null]},[[\"$\",\"html\",null,{\"lang\":\"ja\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_ddd637\",\"children\":[[\"$\",\"header\",null,{\"className\":\"layout_header__g7cns\",\"children\":[\"$\",\"h1\",null,{\"className\":\"layout_logo__n_Zrq\",\"children\":\"Todo\"}]}],[\"$\",\"$L5\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L6\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$7\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$8\",\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":\"$9\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$a\",\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[],\"styles\":null}],[\"$\",\"footer\",null,{\"className\":\"$undefined\"}]]}]}],null],null],\"couldBeIntercepted\":false,\"initialHead\":[false,\"$Lb\"],\"globalErrorComponent\":\"$c\",\"missingSlots\":\"$Wd\"}]]\n"])</script><script>self.__next_f.push([1,"b:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"Todo\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"React Todo\"}],[\"$\",\"meta\",\"4\",{\"name\":\"next-size-adjust\"}]]\n4:null\n"])</script></body></html>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1 @@
self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1 @@
self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b54d518

Please sign in to comment.