0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

setup nuxt

Last updated at Posted at 2021-08-07
$ cd ~/github
$ npm -v
7.19.1
$ npm init nuxt-app myproject

create-nuxt-app v3.7.1
✨  Generating Nuxt.js project in myproject
? Project name: myproject
? Programming language: JavaScript
? Package manager: Npm
? UI framework: Vuetify.js
? Nuxt.js modules: Axios - Promise based HTTP client, Progressive Web App (PWA),
 Content - Git-based headless CMS
? Linting tools: ESLint, Prettier, Lint staged files, StyleLint
? Testing framework: Jest
? Rendering mode: Single Page App
? Deployment target: Server (Node.js hosting)
? Development tools: jsconfig.json (Recommended for VS Code if you're not using
typescript)
? Continuous integration: None
? Version control system: Git
$ cd myproject
$ npm install --save-dev eslint-plugin-vue
$ npm audit
$ npm audit fix
$ npm audit fix --force
$ cat package.json
...
  "scripts": {
...
    "lint:pr": "prettier -c .",
    "lint:pr:fix": "prettier -c . --write",
    "lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .",
    "lint:js:fix": "eslint --ext \".js,.vue\" --ignore-path .gitignore . --fix",
    "lint:style": "stylelint \"**/*.{vue,css}\" --ignore-path .gitignore",
    "lint:style:fix": "stylelint \"**/*.{vue,css}\" --ignore-path .gitignore --fix",
    "prepare": "husky install",
    "lint": "npm run lint:pr && npm run lint:js && npm run lint:style",
    "lint:fix": "npm run lint:pr:fix && npm run lint:js:fix && npm run lint:style:fix",
    "test": "jest"
  },
...
$ cat .eslintrc.js
module.exports = {
  ...
  extends: [
    '@nuxtjs',
    'prettier',
    'plugin:nuxt/recommended',
    'plugin:vue/essential',
  ],
  plugins: [],
  // add your custom rules here
  rules: {},
}
$ npm run lint:pr
$ npm run lint:pr:fix
$ npm run lint
$ npm run lint:fix
$ cat nuxt.config.js
build: {
    babel: {
      babelrc: true,
    },
  },
...
$ npm run test
$ npm run dev
$ npm run build
$ npm run start
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?