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

Commit 47aa7c1

Browse files
atinuxclarkdorenovate[bot]MartijnCuppensbenjamincanac
authored
feat: prepare for Nuxt 2.13 (#529)
* feat: prepare for Nuxt 2.13 * fix(jest): downgrate vue-jest to v3 pending by vuejs/vue-jest#241 * chore(deps): update all non-major dependencies (#509) * fix(prettier): add stylelint-config-prettier * chore(deps): update jest packages (major) (#513) * chore: add npm registry config * chore(deps): update all non-major dependencies * chore(deps): update devdependency @nuxt/typescript-build to v1 * fix(ava): expect vm truthy as vue instance assertion * chore(deps): update all non-major dependencies * chore(deps): update all non-major dependencies * feat(template): remove dotenv module (#544) * chore: optimize svg & animation (#547) * feat: add content module (#540) * chore(deps): update all non-major dependencies * chore(deps): lock file maintenance (#541) * v3.0.0 * chore: update snapshots * chore: update prompts and add TS runtime by default * chore: fix lint issue Co-authored-by: Clark Du <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Martijn Cuppens <[email protected]> Co-authored-by: Benjamin Canac <[email protected]> Co-authored-by: Pooya Parsa <[email protected]>
1 parent e29eebf commit 47aa7c1

File tree

11 files changed

+506
-106
lines changed

11 files changed

+506
-106
lines changed

README.md

+13-18
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ yarn create nuxt-app <my-project>
3333

3434
## Features :tada:
3535

36-
1. Choose the package manager
36+
1. Package manager
3737
- Yarn
3838
- Npm
39-
1. Choose programming language
39+
1. Programming language
4040
- JavaScript
4141
- TypeScript
42-
1. Choose your favorite UI framework:
42+
1. UI framework:
4343
- None (feel free to add one later)
4444
- [Ant Design Vue](https://github.com/vueComponent/ant-design-vue)
4545
- [Bootstrap](https://github.com/bootstrap-vue/bootstrap-vue)
@@ -52,32 +52,27 @@ yarn create nuxt-app <my-project>
5252
- [Tailwind CSS](https://github.com/tailwindcss/tailwindcss)
5353
- [Vuesax](https://github.com/lusaxweb/vuesax)
5454
- [Vuetify](https://github.com/vuetifyjs/vuetify)
55-
1. Choose the runtime for TypeScript (if you choose TypeScript)
56-
- Default
57-
- [@nuxt/typescript-runtime](https://github.com/nuxt/typescript)
58-
1. Choose Nuxt.js modules:
55+
1. Nuxt.js modules:
5956
- [Axios](https://github.com/nuxt-community/axios-module)
60-
- [Progressive Web App (PWA) Support](https://github.com/nuxt-community/pwa-module)
61-
1. Choose linting tools:
57+
- [Progressive Web App (PWA)](https://github.com/nuxt-community/pwa-module)
58+
- [Content](https://github.com/nuxt/content)
59+
1. Linting tools:
6260
- [ESLint](https://github.com/nuxt/eslint-config)
6361
- [Prettier](https://github.com/prettier/prettier)
6462
- [Lint staged files](https://github.com/okonet/lint-staged)
6563
- [StyleLint](https://github.com/stylelint/stylelint)
66-
1. Check the features needed for your project:
67-
- [PWA](https://pwa.nuxtjs.org/)
68-
- Linter / Formatter
69-
- [Prettier](https://prettier.io/)
70-
- [Axios](https://github.com/nuxt-community/axios-module)
71-
- [Tachyons](https://tachyons.io)
72-
1. Choose your favorite test framework:
64+
1. Testing framework:
7365
- None
7466
- [Jest](https://github.com/facebook/jest)
7567
- [AVA](https://github.com/avajs/ava)
7668
- [WebdriverIO](https://webdriver.io)
77-
1. Choose rendering mode
69+
1. Rendering mode
7870
- [Universal (SSR / Static)](https://nuxtjs.org/guide/#server-rendered-universal-ssr-)
7971
- [SPA](https://nuxtjs.org/guide/#single-page-applications-spa-)
80-
1. Choose development tools
72+
1. Deployment target
73+
- [Server (Node.js hosting)](https://nuxtjs.org/api/configuration-target)
74+
- [Static (Static/JAMStack hosting)](https://nuxtjs.org/api/configuration-target)
75+
1. Development tools
8176
- [jsconfig.json](https://code.visualstudio.com/docs/languages/jsconfig)
8277
- [Semantic PR](https://probot.github.io/apps/semantic-pull-requests/)
8378

packages/cna-template/template/nuxt/components/Logo.vue

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/>
1515
</svg>
1616
</template>
17+
1718
<style>
1819
.NuxtLogo {
1920
animation: 1s appear;

packages/cna-template/template/nuxt/layouts/default.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div>
3-
<nuxt />
3+
<Nuxt />
44
</div>
55
</template>
66

packages/cna-template/template/nuxt/nuxt.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ export default {
88
*/
99
mode: '<%= mode %>',
1010
/*
11+
** Nuxt target
12+
** See https://nuxtjs.org/api/configuration-target
13+
*/
14+
target: '<%= target %>',
15+
/*
1116
** Headers of the page
1217
** See https://nuxtjs.org/api/configuration-head
1318
*/
@@ -68,6 +73,11 @@ export default {
6873
<%_ } _%>
6974
],
7075
/*
76+
** Auto import components
77+
** See https://nuxtjs.org/api/configuration-components
78+
*/
79+
components: true,
80+
/*
7181
** Nuxt.js dev-modules
7282
*/
7383
buildModules: [

packages/cna-template/template/nuxt/package.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
}
1010

1111
const { scripts } = pkg
12-
const { features, language = [], linter = [], runtime = [] } = generator.answers
12+
const { features, language = [], linter = [] } = generator.answers
1313

1414
// Linter
1515
const eslint = linter.includes('eslint')
@@ -70,20 +70,18 @@ module.exports = {
7070

7171
// TS
7272
const typescript = language.includes('ts')
73-
const tsRuntime = runtime.includes('ts-runtime')
7473

7574
if (!typescript) {
7675
delete pkg.devDependencies['@nuxt/typescript-build']
76+
delete pkg.dependencies['@nuxt/typescript-runtime']
7777
}
7878
if (!typescript || !eslint) {
7979
delete pkg.devDependencies['@nuxtjs/eslint-config-typescript']
8080
}
81-
if (tsRuntime) {
81+
if (typescript) {
8282
for (const key of Object.keys(scripts)) {
8383
scripts[key] = scripts[key].replace(/^nuxt /, 'nuxt-ts ')
8484
}
85-
} else {
86-
delete pkg.dependencies['@nuxt/typescript-runtime']
8785
}
8886
return pkg
8987
}

packages/cna-template/template/nuxt/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"dev": "nuxt",
44
"build": "nuxt build",
55
"start": "nuxt start",
6-
"generate": "nuxt generate",
6+
"export": "nuxt export",
7+
"serve": "nuxt serve",
78
"lint:js": "eslint --ext .js,.vue --ignore-path .gitignore .",
89
"lint:style": "stylelint **/*.{vue,css} --ignore-path .gitignore"
910
},

packages/cna-template/template/nuxt/pages/index.vue

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="container">
33
<div>
4-
<logo />
4+
<Logo />
55
<h1 class="title">
66
<%= name %>
77
</h1>
@@ -30,23 +30,12 @@
3030
<%_ if (typescript) { _%>
3131
<script lang="ts">
3232
import Vue from 'vue'
33-
import Logo from '~/components/Logo.vue'
3433

35-
export default Vue.extend({
36-
components: {
37-
Logo
38-
}
39-
})
34+
export default Vue.extend({})
4035
</script>
4136
<%_ } else { _%>
4237
<script>
43-
import Logo from '~/components/Logo.vue'
44-
45-
export default {
46-
components: {
47-
Logo
48-
}
49-
}
38+
export default {}
5039
</script>
5140
<%_ } _%>
5241

packages/create-nuxt-app/lib/prompts.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module.exports = [
22
{
33
name: 'name',
4-
message: 'Project name',
4+
message: 'Project name:',
55
default: '{outFolder}'
66
},
77
{
88
name: 'language',
9-
message: 'Choose programming language',
9+
message: 'Programming language:',
1010
choices: [
1111
{ name: 'JavaScript', value: 'js' },
1212
{ name: 'TypeScript', value: 'ts' }
@@ -16,7 +16,7 @@ module.exports = [
1616
},
1717
{
1818
name: 'pm',
19-
message: 'Choose the package manager',
19+
message: 'Package manager:',
2020
choices: [
2121
{ name: 'Yarn', value: 'yarn' },
2222
{ name: 'Npm', value: 'npm' }
@@ -26,7 +26,7 @@ module.exports = [
2626
},
2727
{
2828
name: 'ui',
29-
message: 'Choose UI framework',
29+
message: 'UI framework:',
3030
type: 'list',
3131
pageSize: 15,
3232
choices: [
@@ -45,31 +45,21 @@ module.exports = [
4545
],
4646
default: 'none'
4747
},
48-
{
49-
name: 'runtime',
50-
message: 'Choose the runtime for TypeScript',
51-
type: 'list',
52-
choices: [
53-
{ name: 'Default', value: 'none' },
54-
{ name: '@nuxt/typescript-runtime', value: 'ts-runtime' }
55-
],
56-
when: answers => answers.language === 'ts'
57-
},
5848
{
5949
name: 'features',
60-
message: 'Choose Nuxt.js modules',
50+
message: 'Nuxt.js modules:',
6151
type: 'checkbox',
6252
pageSize: 10,
6353
choices: [
6454
{ name: 'Axios', value: 'axios' },
65-
{ name: 'Progressive Web App (PWA) Support', value: 'pwa' },
55+
{ name: 'Progressive Web App (PWA)', value: 'pwa' },
6656
{ name: 'Content', value: 'content' }
6757
],
6858
default: []
6959
},
7060
{
7161
name: 'linter',
72-
message: 'Choose linting tools',
62+
message: 'Linting tools:',
7363
type: 'checkbox',
7464
pageSize: 10,
7565
choices: [
@@ -82,7 +72,7 @@ module.exports = [
8272
},
8373
{
8474
name: 'test',
85-
message: 'Choose test framework',
75+
message: 'Testing framework:',
8676
type: 'list',
8777
choices: [
8878
{ name: 'None', value: 'none' },
@@ -94,17 +84,27 @@ module.exports = [
9484
},
9585
{
9686
name: 'mode',
97-
message: 'Choose rendering mode',
87+
message: 'Rendering mode:',
9888
type: 'list',
9989
choices: [
100-
{ name: 'Universal (SSR / Static)', value: 'universal' },
90+
{ name: 'Universal (SSR / SSG)', value: 'universal' },
10191
{ name: 'Single Page App', value: 'spa' }
10292
],
10393
default: 'universal'
10494
},
95+
{
96+
name: 'target',
97+
message: 'Deployment target:',
98+
type: 'list',
99+
choices: [
100+
{ name: 'Server (Node.js hosting)', value: 'server' },
101+
{ name: 'Static (Static/JAMStack hosting)', value: 'static' }
102+
],
103+
default: 'server'
104+
},
105105
{
106106
name: 'devTools',
107-
message: 'Choose development tools',
107+
message: 'Development tools:',
108108
type: 'checkbox',
109109
choices: [
110110
{ name: 'jsconfig.json (Recommended for VS Code)', value: 'jsconfig.json' },

packages/create-nuxt-app/lib/saofile.js

-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module.exports = {
1111
prompts: require('./prompts'),
1212
templateData () {
1313
const typescript = this.answers.language.includes('ts')
14-
const tsRuntime = this.answers.runtime && this.answers.runtime.includes('ts-runtime')
1514
const pwa = this.answers.features.includes('pwa')
1615
const eslint = this.answers.linter.includes('eslint')
1716
const prettier = this.answers.linter.includes('prettier')
@@ -27,7 +26,6 @@ module.exports = {
2726

2827
return {
2928
typescript,
30-
tsRuntime,
3129
pwa,
3230
eslint,
3331
prettier,

0 commit comments

Comments
 (0)