diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..f1412b68 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,7 @@ +{ + "extends": "@nuxtjs/eslint-config-typescript", + "rules": { + "vue/no-v-html": "off", + "vue/no-multiple-template-root": "off" + } +} diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index dfbfb8fb..00000000 --- a/.eslintrc.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - extends: [ - '@nuxtjs' - ] -} diff --git a/.gitignore b/.gitignore index 6f4df0dd..41b75f1c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,8 @@ package-lock.json *.iml .nuxt .vscode +.output -static/manifest*.json -static/sw.js -static/workbox-sw*.js* +public/manifest*.json +public/sw.js +public/workbox-sw*.js* diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..bf2e7648 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +shamefully-hoist=true diff --git a/.vercelignore b/.vercelignore deleted file mode 100644 index 5ef3e001..00000000 --- a/.vercelignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -.nuxt -dist diff --git a/README.md b/README.md index 419e57bc..7d3d70d2 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,42 @@ -# Nuxt.js Hacker News +# Nuxt3 Hacker News -HackerNews clone built with [Nuxt.js](https://nuxtjs.org). +Hacker News clone built with [Nuxt3](https://v3.nuxtjs.org).
-## Modes +## Deploy - Universal: https://hn.nuxtjs.org -> Hosted on [Now 2](https://zeit.co): `npm run build` + `now.json` +> Hosted on [Vercel](https://vercel.com/): `npm run build` - Single Page: https://hn-spa.nuxtjs.org -> Hosted on [Netlify](https://www.netlify.com): `npm run build-spa` + `dist/` directory +> Hosted on [Netlify](https://www.netlify.com): `npm run build-spa` ## Performance -- Lighthouse [100/100](https://cdn.rawgit.com/Atinux/e2f424e6794babc00d2158406b0ab37d/raw/4de834145881697ea83292b381df5f591f1ed2f5/lighthouse-result-nuxt.html) - [Webpagetest](https://www.webpagetest.org/lighthouse.php?test=170620_PG_a2a9feaf4ace07a61b2c6c2a171b1c79&run=1) -- Interactive (Faster 3G) [3.5s](https://www.webpagetest.org/result/170620_PG_a2a9feaf4ace07a61b2c6c2a171b1c79) -- Interactive (Emerging Markets) [3.8s](https://www.webpagetest.org/result/170620_B1_0b83d61272c77c16c3f3f1f16fb72d2e) +- Lighthouse [100/100](https://pagespeed.web.dev/report?url=https%3A%2F%2Fhackernews-git-nuxt3-nuxt-js.vercel.app%2Fnews%2F1) (Slow 4G / Mobile Moto G4) + - Interactive: 1.4s + - Total Blocking Time: 30ms ## Features - Server Side Rendering +- Vite-based hot module replacement (HMR) dev environment +- Deploys anywhere with zero config (Vercel, Netlify, Cloudflare, etc.) powered by [Nitro](https://github.com/unjs/nitro) - Code Splitting -- Single-file Vue Components - Prefetch/Preload JS + DNS + Data -- Critical Path CSS -- PWA experience using [PWA Module](https://pwa.nuxtjs.org) with almost _zero config_ -- PRPL -- Hot reloading dev environment integrated with [ESLint](https://eslint.org/) and [Prettier](https://prettier.io/) -- Hosted on [Vercel](https://vercel.com) ## Build Setup -**Requires Node.js 8+** +**Requires Node.js 14+** ``` bash # install dependencies @@ -59,7 +55,7 @@ npm start npm run build-spa # serve in production mode (spa) -npm run start-spa # or upload dist/ directory +npm run start-spa # or upload .output/public/ directory # validate code with ESLint (with Prettier) npm run lint @@ -70,7 +66,7 @@ npm run lintfix ## Links -For the communiy typescript fork please see [nuxt-community/hackernews-nuxt-ts](https://github.com/nuxt-community/hackernews-nuxt-ts) +For the Nuxt 2 version, check out the [`nuxt2` branch](https://github.com/nuxt/hackernews/tree/nuxt2) ## License diff --git a/app.vue b/app.vue new file mode 100644 index 00000000..740b7f7b --- /dev/null +++ b/app.vue @@ -0,0 +1,22 @@ + + + +- {{ item.comments ? item.comments.length + ' comments' : 'No comments yet.' }} -
-
+ {{ comments ? comments.length + ' comments' : 'No comments yet.' }} +
++
+
+