All Projects → Al-un → Learn Nuxt Ts

Al-un / Learn Nuxt Ts

Testing TypeScript for Nuxt

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Learn Nuxt Ts

N2ex
🌈 V2ex built with Nuxt.js (vue&ssr)
Stars: ✭ 260 (+400%)
Mutual labels:  nuxt, jest
Nuxt Jest Puppeteer
🚀 Nuxt.js zero configuration tests, run with Jest and Puppetter
Stars: ✭ 57 (+9.62%)
Mutual labels:  nuxt, jest
Wemake Vue Template
Bleeding edge vue template focused on code quality and developer happiness.
Stars: ✭ 645 (+1140.38%)
Mutual labels:  nuxt, jest
Buefy Shop
A sample shop built with Nuxt, Stripe, Firebase and Serverless Functions
Stars: ✭ 207 (+298.08%)
Mutual labels:  nuxt, jest
Nuxt Starter
Personnal nuxt starter
Stars: ✭ 30 (-42.31%)
Mutual labels:  nuxt, jest
Virapro.ru
[E-commerce] Plumbing Store
Stars: ✭ 45 (-13.46%)
Mutual labels:  nuxt
Emotion Module
💖 Emotion module for Nuxt.js
Stars: ✭ 47 (-9.62%)
Mutual labels:  nuxt
K2
Koa2 API template with passport, GraphQL, flowtype, knex and more.
Stars: ✭ 44 (-15.38%)
Mutual labels:  jest
Tsdx
Zero-config CLI for TypeScript package development
Stars: ✭ 9,010 (+17226.92%)
Mutual labels:  jest
Vue Pomo
A progressive web app for the Pomodoro Technique, built with Vue 2.0, Vuex and Firebase.
Stars: ✭ 51 (-1.92%)
Mutual labels:  jest
Typescript Node Rest Starter
Simple starter template for building NODE REST API's using TypeScript
Stars: ✭ 50 (-3.85%)
Mutual labels:  jest
Todoist Js
!! OBSOLETE !! The (un)official Todoist javascript API library
Stars: ✭ 46 (-11.54%)
Mutual labels:  jest
Realworld Nuxt
Nuxt.js implementation of RealWorld Frontend
Stars: ✭ 45 (-13.46%)
Mutual labels:  nuxt
Eslint Module
ESLint module for Nuxt.js
Stars: ✭ 49 (-5.77%)
Mutual labels:  nuxt
Minfront
Stars: ✭ 45 (-13.46%)
Mutual labels:  jest
Portal Ui
GDC Data Portal UI
Stars: ✭ 50 (-3.85%)
Mutual labels:  jest
Push Starter
React Redux Starter with SSR 🤖
Stars: ✭ 43 (-17.31%)
Mutual labels:  jest
Express Bookshelf Realworld Example App
🐳 An Express and Bookshelf based backend implementation of the RealWorld API Spec.
Stars: ✭ 45 (-13.46%)
Mutual labels:  jest
Parcel Vue Ts
📦 Boilerplate for Vue.js & Typescript, base on Parcel bundler.
Stars: ✭ 49 (-5.77%)
Mutual labels:  jest
Pwa Module
Zero config PWA solution for Nuxt.js
Stars: ✭ 1,033 (+1886.54%)
Mutual labels:  nuxt

Nuxt-TS: Nuxt application powered by TypeScript

Half tutorial, half exploration, I want to check out how far I can get with Nuxt+TypeScript in a full application from scratch.

Table of contents

Nuxt

  • 13-Apr-2020: switch Nuxt official TypeScript support: https://typescript.nuxtjs.org/. Migration method is described here: https://typescript.nuxtjs.org/migration.html.

    Update steps

    Update dependencies

    # Bump node-sass
    rm -Rf node_modules
    rm package-lock.json
    npm uninstall node-sass
    npm install node-sass
    
    # Remove nuxt dependencies
    npm uninstall @nuxt/typescript nuxt nuxt-property-decorator
    # Ensure that we have at least nuxt 2.9.x
    npm install nuxt
    # Bump property decorator
    npm install nuxt-property-decorator
    # Upgrade
    npm install --save-dev @nuxt/typescript-build
    # Add TypeScript runtime configuration for nuxt-property-decorator
    # https://github.com/nuxt-community/nuxt-property-decorator/issues/62#issuecomment-577601678
    npm install @nuxt/typescript-runtime
    
    # Update linting
    npm uninstall @typescript-eslint/eslint-plugin
    npm install --save-dev @nuxtjs/eslint-module
    npm install --save-dev @nuxtjs/eslint-config-typescript
    npm uninstall eslint-plugin-vue
    npm install --save-dev eslint-plugin-nuxt eslint-plugin-prettier
    

    Update nuxt.config.js:

    - import pkg from './package.json';
    
    - module.exports = {
    + export default {
    
    -     title: pkg.name,
    +     titleTemplate: '%s - ' + process.env.npm_package_name,
    +     title: process.env.npm_package_name || '',
    
    -      { hid: 'description', name: 'description', content: pkg.description }
    +      {
    +        hid: 'description',
    +        name: 'description',
    +        content: process.env.npm_package_description || ''
    +      }
    
    +  /*
    +   ** Nuxt.js dev-modules
    +   */
    +  buildModules: [
    +    // Doc: https://github.com/nuxt-community/eslint-module
    +    '@nuxtjs/eslint-module',
    +    '@nuxt/typescript-build'
    +  ],
    

    Update tsconfig.json

    -      "@nuxt/vue-app",
    +      "@nuxt/types",
    

    Update .eslintrc.js:

    -  // https://eslint.org/docs/user-guide/configuring#specifying-parser
    -  parser: 'vue-eslint-parser',
    -  // https://vuejs.github.io/eslint-plugin-vue/user-guide/#faq
    -  parserOptions: {
    -    parser: '@typescript-eslint/parser',
    -    ecmaVersion: 2017,
    -    sourceType: 'module',
    -    project: './tsconfig.json'
    -  },
    -
    -  // https://eslint.org/docs/user-guide/configuring#extending-configuration-files
    -  // order matters: from least important to most important in terms of overriding
    -  // Prettier + Vue: https://medium.com/@gogl.alex/how-to-properly-set-up-eslint-with-prettier-for-vue-or-nuxt-in-vscode-e42532099a9c
      extends: [
    -    'eslint:recommended',
    -    'plugin:@typescript-eslint/recommended',
    -    'plugin:vue/recommended',
    -    'prettier',
    -    'prettier/vue',
    -    'prettier/@typescript-eslint'
    +    '@nuxtjs',
    +    '@nuxtjs/eslint-config-typescript',
    +    'prettier',
    +    'prettier/vue',
    +    'plugin:prettier/recommended',
    +    'plugin:nuxt/recommended'
      ],
    -  
    -  // https://eslint.org/docs/user-guide/configuring#configuring-plugins
    -  plugins: ['vue', '@typescript-eslint'],
    
    +  plugins: ['prettier'],
    

    Update package.json for runtime

      "scripts": {
    -    "dev": "nuxt",
    +    "dev": "nuxt-ts",
    -    "build": "nuxt build",
    +    "build": "nuxt-ts build",
    -    "heroku-postbuild": "nuxt build",
    +    "heroku-postbuild": "nuxt-ts build",
        "test": "jest",
        "lint": "eslint . --ext .vue,.ts,.js",
    -    "start": "nuxt start",
    +    "start": "nuxt-ts start",
    -    "generate": "nuxt generate"
    +    "generate": "nuxt-ts generate"
      },
    
  • 22-Mar-2019: Nuxt 2.5.0

    nuxt-ts is not needed anymore. Nuxt Typescript support is done by adding @nuxt/typescript

    Update from Nuxt 2.4.0 is done with:
    yarn remove nuxt-ts
    yarn add nuxt @nuxt/typescript
    rm -Rf node_modules/
    rm yarn.lock
    yarn
    

    As-of 24-Mar-2019, Nuxt version is 2.5.1.

    Side-effect is that as-of Nuxt 2.5.1, Nuxt does not support "extends": "@nuxt/typescript" and tsconfig.json is initialized by Nuxt:

    • "resolveJsonModule": true has to be added
    • "types": ["@types/node", "@nuxt/vue-app", "@types/jest"] has @types/jest added back
  • 28-Jan-2019: Nuxt 2.4.0

    Nuxt 2.4.0 release (Jan-2019) has pushed one step forward TypeScript integration into Nuxt thanks to nuxt-ts

    Kudos to Nuxt team.

This tutorial has undergone a complete refactoring on March 2019. Old version is archived at the archive/2019-03-09_refactoring branch

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].