Repository: nuxt/create-nuxt-app
Pull request #544 (2020-06-08 18:44:21)

feat(template): remove dotenv module
As @Atinux has mentioned in discord, we should remove dotenv module from create-nuxt-app now.


Patch:
diff --git a/README.md b/README.md
index 831758b..65a7531 100644
--- a/README.md
+++ b/README.md
@@ -58,7 +58,6 @@ yarn create nuxt-app <my-project>
 1. Choose Nuxt.js modules:
     - [Axios](https://github.com/nuxt-community/axios-module)
     - [Progressive Web App (PWA) Support](https://github.com/nuxt-community/pwa-module)
-    - [DotEnv](https://github.com/nuxt-community/dotenv-module)
 1. Choose linting tools:
     - [ESLint](https://github.com/nuxt/eslint-config)
     - [Prettier](https://github.com/prettier/prettier)
diff --git a/packages/cna-template/template/.env b/packages/cna-template/template/.env
deleted file mode 100644
index 108b00b..0000000
--- a/packages/cna-template/template/.env
+++ /dev/null
@@ -1,1 +0,0 @@
-BASE_URL=http://localhost:3000
diff --git a/packages/cna-template/template/nuxt/nuxt.config.js b/packages/cna-template/template/nuxt/nuxt.config.js
index 1c4d6ff..ab69ebb 100644
--- a/packages/cna-template/template/nuxt/nuxt.config.js
+++ b/packages/cna-template/template/nuxt/nuxt.config.js
@@ -110,10 +110,6 @@ export default {
     <%_ if (pwa) { _%>
     '@nuxtjs/pwa',
     <%_ } _%>
-    <%_ if (dotenv) { _%>
-    // Doc: https://github.com/nuxt-community/dotenv-module
-    '@nuxtjs/dotenv',
-    <%_ } _%>
   ],
   <%_ if (axios) { _%>
   /*
diff --git a/packages/cna-template/template/nuxt/package.js b/packages/cna-template/template/nuxt/package.js
index 27ebeac..0891fc9 100644
--- a/packages/cna-template/template/nuxt/package.js
+++ b/packages/cna-template/template/nuxt/package.js
@@ -64,9 +64,6 @@ module.exports = {
     if (!features.includes('pwa')) {
       delete pkg.dependencies['@nuxtjs/pwa']
     }
-    if (!features.includes('dotenv')) {
-      delete pkg.dependencies['@nuxtjs/dotenv']
-    }
 
     // TS
     const typescript = language.includes('ts')
diff --git a/packages/cna-template/template/nuxt/package.json b/packages/cna-template/template/nuxt/package.json
index 6d2730e..5868a1a 100644
--- a/packages/cna-template/template/nuxt/package.json
+++ b/packages/cna-template/template/nuxt/package.json
@@ -20,7 +20,6 @@
     "@nuxt/typescript-runtime": "^0.4.9",
     "@nuxtjs/axios": "^5.11.0",
     "@nuxtjs/pwa": "^3.0.0-beta.20",
-    "@nuxtjs/dotenv": "^1.4.1",
     "nuxt": "^2.12.2"
   },
   "devDependencies": {
diff --git a/packages/create-nuxt-app/lib/prompts.js b/packages/create-nuxt-app/lib/prompts.js
index 7352fc8..739d9a9 100644
--- a/packages/create-nuxt-app/lib/prompts.js
+++ b/packages/create-nuxt-app/lib/prompts.js
@@ -62,8 +62,7 @@ module.exports = [
     pageSize: 10,
     choices: [
       { name: 'Axios', value: 'axios' },
-      { name: 'Progressive Web App (PWA) Support', value: 'pwa' },
-      { name: 'DotEnv', value: 'dotenv' }
+      { name: 'Progressive Web App (PWA) Support', value: 'pwa' }
     ],
     default: []
   },
diff --git a/packages/create-nuxt-app/lib/saofile.js b/packages/create-nuxt-app/lib/saofile.js
index 7bb8d50..4c19b24 100644
--- a/packages/create-nuxt-app/lib/saofile.js
+++ b/packages/create-nuxt-app/lib/saofile.js
@@ -18,7 +18,6 @@ module.exports = {
     const lintStaged = eslint && this.answers.linter.includes('lintStaged')
     const stylelint = this.answers.linter.includes('stylelint')
     const axios = this.answers.features.includes('axios')
-    const dotenv = this.answers.features.includes('dotenv')
     const pm = this.answers.pm === 'yarn' ? 'yarn' : 'npm'
     const pmRun = this.answers.pm === 'yarn' ? 'yarn' : 'npm run'
 
@@ -36,8 +35,7 @@ module.exports = {
       axios,
       edge,
       pm,
-      pmRun,
-      dotenv
+      pmRun
     }
   },
   actions () {
@@ -84,7 +82,6 @@ module.exports = {
         '_jsconfig.json': 'devTools.includes("jsconfig.json")',
         'tsconfig.json': 'language.includes("ts")',
         'semantic.yml': 'devTools.includes("semantic-pull-requests")',
-        '.env': 'features.includes("dotenv")',
         '_stylelint.config.js': 'linter.includes("stylelint")'
       },
       templateDir


Test patch:
diff --git a/packages/create-nuxt-app/test/snapshots/index.test.js.md b/packages/create-nuxt-app/test/snapshots/index.test.js.md
index 6c29ec2..4981388 100644
--- a/packages/create-nuxt-app/test/snapshots/index.test.js.md
+++ b/packages/create-nuxt-app/test/snapshots/index.test.js.md
@@ -486,13 +486,12 @@ Generated by [AVA](https://avajs.dev).
     }␊
     `
 
-## verify features: Axios, Progressive Web App (PWA) Support, DotEnv
+## verify features: Axios, Progressive Web App (PWA) Support
 
 > Generated files
 
     [
       '.editorconfig',
-      '.env',
       '.gitignore',
       'README.md',
       'assets/README.md',
@@ -517,7 +516,6 @@ Generated by [AVA](https://avajs.dev).
     {
       dependencies: {
         '@nuxtjs/axios': '^5.11.0',
-        '@nuxtjs/dotenv': '^1.4.1',
         '@nuxtjs/pwa': '^3.0.0-beta.20',
         nuxt: '^2.12.2',
       },
@@ -578,8 +576,6 @@ Generated by [AVA](https://avajs.dev).
         // Doc: https://axios.nuxtjs.org/usage␊
         '@nuxtjs/axios',␊
         '@nuxtjs/pwa',␊
-        // Doc: https://github.com/nuxt-community/dotenv-module␊
-        '@nuxtjs/dotenv',␊
       ],␊
       /*␊
       ** Axios module configuration␊
@@ -595,104 +591,6 @@ Generated by [AVA](https://avajs.dev).
     }␊
     `
 
-## verify features: DotEnv
-
-> Generated files
-
-    [
-      '.editorconfig',
-      '.env',
-      '.gitignore',
-      'README.md',
-      'assets/README.md',
-      'components/Logo.vue',
-      'components/README.md',
-      'layouts/README.md',
-      'layouts/default.vue',
-      'middleware/README.md',
-      'nuxt.config.js',
-      'package.json',
-      'pages/README.md',
-      'pages/index.vue',
-      'plugins/README.md',
-      'static/README.md',
-      'static/favicon.ico',
-      'store/README.md',
-    ]
-
-> package.json
-
-    {
-      dependencies: {
-        '@nuxtjs/dotenv': '^1.4.1',
-        nuxt: '^2.12.2',
-      },
-      devDependencies: {},
-      private: true,
-      scripts: {
-        build: 'nuxt build',
-        dev: 'nuxt',
-        generate: 'nuxt generate',
-        start: 'nuxt start',
-      },
-    }
-
-> Generated nuxt.config.js
-
-    `␊
-    export default {␊
-      /*␊
-      ** Nuxt rendering mode␊
-      ** See https://nuxtjs.org/api/configuration-mode␊
-      */␊
-      mode: 'universal',␊
-      /*␊
-      ** Headers of the page␊
-      ** See https://nuxtjs.org/api/configuration-head␊
-      */␊
-      head: {␊
-        title: process.env.npm_package_name || '',␊
-        meta: [␊
-          { charset: 'utf-8' },␊
-          { name: 'viewport', content: 'width=device-width, initial-scale=1' },␊
-          { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }␊
-        ],␊
-        link: [␊
-          { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }␊
-        ]␊
-      },␊
-      /*␊
-      ** Global CSS␊
-      */␊
-      css: [␊
-      ],␊
-      /*␊
-      ** Plugins to load before mounting the App␊
-      ** https://nuxtjs.org/guide/plugins␊
-      */␊
-      plugins: [␊
-      ],␊
-      /*␊
-      ** Nuxt.js dev-modules␊
-      */␊
-      buildModules: [␊
-      ],␊
-      /*␊
-      ** Nuxt.js modules␊
-      */␊
-      modules: [␊
-        // Doc: https://github.com/nuxt-community/dotenv-module␊
-        '@nuxtjs/dotenv',␊
-      ],␊
-      /*␊
-      ** Build configuration␊
-      ** See https://nuxtjs.org/api/configuration-build/␊
-      */␊
-      build: {␊
-      }␊
-    }␊
-    `
-
 ## verify features: Progressive Web App (PWA) Support
 
 > Generated files