Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

feat: prepare for Nuxt 2.13 #529

Merged
merged 21 commits into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ yarn create nuxt-app <my-project>

## Features :tada:

1. Choose the package manager
1. Package manager
- Yarn
- Npm
1. Choose programming language
1. Programming language
- JavaScript
- TypeScript
1. Choose your favorite UI framework:
1. UI framework:
- None (feel free to add one later)
- [Ant Design Vue](https://github.com/vueComponent/ant-design-vue)
- [Bootstrap](https://github.com/bootstrap-vue/bootstrap-vue)
Expand All @@ -52,32 +52,27 @@ yarn create nuxt-app <my-project>
- [Tailwind CSS](https://github.com/tailwindcss/tailwindcss)
- [Vuesax](https://github.com/lusaxweb/vuesax)
- [Vuetify](https://github.com/vuetifyjs/vuetify)
1. Choose the runtime for TypeScript (if you choose TypeScript)
- Default
- [@nuxt/typescript-runtime](https://github.com/nuxt/typescript)
1. Choose Nuxt.js modules:
1. Nuxt.js modules:
- [Axios](https://github.com/nuxt-community/axios-module)
- [Progressive Web App (PWA) Support](https://github.com/nuxt-community/pwa-module)
1. Choose linting tools:
- [Progressive Web App (PWA)](https://github.com/nuxt-community/pwa-module)
- [Content](https://github.com/nuxt/content)
1. Linting tools:
- [ESLint](https://github.com/nuxt/eslint-config)
- [Prettier](https://github.com/prettier/prettier)
- [Lint staged files](https://github.com/okonet/lint-staged)
- [StyleLint](https://github.com/stylelint/stylelint)
1. Check the features needed for your project:
- [PWA](https://pwa.nuxtjs.org/)
- Linter / Formatter
- [Prettier](https://prettier.io/)
- [Axios](https://github.com/nuxt-community/axios-module)
- [Tachyons](https://tachyons.io)
1. Choose your favorite test framework:
1. Testing framework:
- None
- [Jest](https://github.com/facebook/jest)
- [AVA](https://github.com/avajs/ava)
- [WebdriverIO](https://webdriver.io)
1. Choose rendering mode
1. Rendering mode
- [Universal (SSR / Static)](https://nuxtjs.org/guide/#server-rendered-universal-ssr-)
- [SPA](https://nuxtjs.org/guide/#single-page-applications-spa-)
1. Choose development tools
1. Deployment target
- [Server (Node.js hosting)](https://nuxtjs.org/api/configuration-target)
- [Static (Static/JAMStack hosting)](https://nuxtjs.org/api/configuration-target)
1. Development tools
- [jsconfig.json](https://code.visualstudio.com/docs/languages/jsconfig)
- [Semantic PR](https://probot.github.io/apps/semantic-pull-requests/)

Expand Down
1 change: 1 addition & 0 deletions packages/cna-template/template/nuxt/components/Logo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/>
</svg>
</template>

<style>
.NuxtLogo {
animation: 1s appear;
Expand Down
2 changes: 1 addition & 1 deletion packages/cna-template/template/nuxt/layouts/default.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<nuxt />
<Nuxt />
</div>
</template>

Expand Down
10 changes: 10 additions & 0 deletions packages/cna-template/template/nuxt/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export default {
*/
mode: '<%= mode %>',
/*
** Nuxt target
** See https://nuxtjs.org/api/configuration-target
*/
target: '<%= target %>',
/*
** Headers of the page
** See https://nuxtjs.org/api/configuration-head
*/
Expand Down Expand Up @@ -68,6 +73,11 @@ export default {
<%_ } _%>
],
/*
** Auto import components
** See https://nuxtjs.org/api/configuration-components
*/
components: true,
/*
** Nuxt.js dev-modules
*/
buildModules: [
Expand Down
8 changes: 3 additions & 5 deletions packages/cna-template/template/nuxt/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
}

const { scripts } = pkg
const { features, language = [], linter = [], runtime = [] } = generator.answers
const { features, language = [], linter = [] } = generator.answers

// Linter
const eslint = linter.includes('eslint')
Expand Down Expand Up @@ -70,20 +70,18 @@ module.exports = {

// TS
const typescript = language.includes('ts')
const tsRuntime = runtime.includes('ts-runtime')

if (!typescript) {
delete pkg.devDependencies['@nuxt/typescript-build']
delete pkg.dependencies['@nuxt/typescript-runtime']
}
if (!typescript || !eslint) {
delete pkg.devDependencies['@nuxtjs/eslint-config-typescript']
}
if (tsRuntime) {
if (typescript) {
for (const key of Object.keys(scripts)) {
scripts[key] = scripts[key].replace(/^nuxt /, 'nuxt-ts ')
}
} else {
delete pkg.dependencies['@nuxt/typescript-runtime']
}
return pkg
}
Expand Down
3 changes: 2 additions & 1 deletion packages/cna-template/template/nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"export": "nuxt export",
"serve": "nuxt serve",
"lint:js": "eslint --ext .js,.vue --ignore-path .gitignore .",
"lint:style": "stylelint **/*.{vue,css} --ignore-path .gitignore"
},
Expand Down
17 changes: 3 additions & 14 deletions packages/cna-template/template/nuxt/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="container">
<div>
<logo />
<Logo />
<h1 class="title">
<%= name %>
</h1>
Expand Down Expand Up @@ -30,23 +30,12 @@
<%_ if (typescript) { _%>
<script lang="ts">
import Vue from 'vue'
import Logo from '~/components/Logo.vue'

export default Vue.extend({
components: {
Logo
}
})
export default Vue.extend({})
</script>
<%_ } else { _%>
<script>
import Logo from '~/components/Logo.vue'

export default {
components: {
Logo
}
}
export default {}
</script>
<%_ } _%>

Expand Down
42 changes: 21 additions & 21 deletions packages/create-nuxt-app/lib/prompts.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module.exports = [
{
name: 'name',
message: 'Project name',
message: 'Project name:',
default: '{outFolder}'
},
{
name: 'language',
message: 'Choose programming language',
message: 'Programming language:',
choices: [
{ name: 'JavaScript', value: 'js' },
{ name: 'TypeScript', value: 'ts' }
Expand All @@ -16,7 +16,7 @@ module.exports = [
},
{
name: 'pm',
message: 'Choose the package manager',
message: 'Package manager:',
choices: [
{ name: 'Yarn', value: 'yarn' },
{ name: 'Npm', value: 'npm' }
Expand All @@ -26,7 +26,7 @@ module.exports = [
},
{
name: 'ui',
message: 'Choose UI framework',
message: 'UI framework:',
type: 'list',
pageSize: 15,
choices: [
Expand All @@ -45,31 +45,21 @@ module.exports = [
],
default: 'none'
},
{
name: 'runtime',
message: 'Choose the runtime for TypeScript',
type: 'list',
choices: [
{ name: 'Default', value: 'none' },
{ name: '@nuxt/typescript-runtime', value: 'ts-runtime' }
],
when: answers => answers.language === 'ts'
},
{
name: 'features',
message: 'Choose Nuxt.js modules',
message: 'Nuxt.js modules:',
type: 'checkbox',
pageSize: 10,
choices: [
{ name: 'Axios', value: 'axios' },
{ name: 'Progressive Web App (PWA) Support', value: 'pwa' },
{ name: 'Progressive Web App (PWA)', value: 'pwa' },
{ name: 'Content', value: 'content' }
],
default: []
},
{
name: 'linter',
message: 'Choose linting tools',
message: 'Linting tools:',
type: 'checkbox',
pageSize: 10,
choices: [
Expand All @@ -82,7 +72,7 @@ module.exports = [
},
{
name: 'test',
message: 'Choose test framework',
message: 'Testing framework:',
type: 'list',
choices: [
{ name: 'None', value: 'none' },
Expand All @@ -94,17 +84,27 @@ module.exports = [
},
{
name: 'mode',
message: 'Choose rendering mode',
message: 'Rendering mode:',
type: 'list',
choices: [
{ name: 'Universal (SSR / Static)', value: 'universal' },
{ name: 'Universal (SSR / SSG)', value: 'universal' },
{ name: 'Single Page App', value: 'spa' }
],
default: 'universal'
},
{
name: 'target',
message: 'Deployment target:',
type: 'list',
choices: [
{ name: 'Server (Node.js hosting)', value: 'server' },
{ name: 'Static (Static/JAMStack hosting)', value: 'static' }
],
default: 'server'
},
{
name: 'devTools',
message: 'Choose development tools',
message: 'Development tools:',
type: 'checkbox',
choices: [
{ name: 'jsconfig.json (Recommended for VS Code)', value: 'jsconfig.json' },
Expand Down
2 changes: 0 additions & 2 deletions packages/create-nuxt-app/lib/saofile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = {
prompts: require('./prompts'),
templateData () {
const typescript = this.answers.language.includes('ts')
const tsRuntime = this.answers.runtime && this.answers.runtime.includes('ts-runtime')
const pwa = this.answers.features.includes('pwa')
const eslint = this.answers.linter.includes('eslint')
const prettier = this.answers.linter.includes('prettier')
Expand All @@ -27,7 +26,6 @@ module.exports = {

return {
typescript,
tsRuntime,
pwa,
eslint,
prettier,
Expand Down
Loading