-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): generated the config file for nuxt
- Loading branch information
Showing
5 changed files
with
102 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {promises as fs} from 'fs'; | ||
import {resolve} from 'path'; | ||
import sinon from 'sinon'; | ||
import {assert} from 'chai'; | ||
import any from '@travi/any'; | ||
import scaffoldConfig from './config'; | ||
|
||
suite('config', () => { | ||
let sandbox; | ||
|
||
setup(() => { | ||
sandbox = sinon.createSandbox(); | ||
|
||
sandbox.stub(fs, 'copyFile'); | ||
}); | ||
|
||
teardown(() => sandbox.restore()); | ||
|
||
test('that the config file is created', async () => { | ||
const projectRoot = any.string(); | ||
|
||
await scaffoldConfig({projectRoot}); | ||
|
||
assert.calledWith( | ||
fs.copyFile, | ||
resolve(__dirname, '..', 'templates', 'nuxt.config.js'), | ||
`${projectRoot}/nuxt.config.js` | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
export default function () { | ||
import {promises as fs} from 'fs'; | ||
import {resolve} from 'path'; | ||
|
||
export default async function ({projectRoot}) { | ||
await fs.copyFile(resolve(__dirname, '..', 'templates', 'nuxt.config.js'), `${projectRoot}/nuxt.config.js`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
export default { | ||
/* | ||
** Nuxt rendering mode | ||
** See https://nuxtjs.org/api/configuration-mode | ||
*/ | ||
mode: 'spa', | ||
/* | ||
** Nuxt target | ||
** See https://nuxtjs.org/api/configuration-target | ||
*/ | ||
target: 'static', | ||
/* | ||
** 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: [], | ||
/* | ||
** Auto import components | ||
** See https://nuxtjs.org/api/configuration-components | ||
*/ | ||
components: true, | ||
/* | ||
** Nuxt.js dev-modules | ||
*/ | ||
buildModules: [ | ||
// Doc: https://github.com/nuxt-community/eslint-module | ||
'@nuxtjs/eslint-module', | ||
], | ||
/* | ||
** Nuxt.js modules | ||
*/ | ||
modules: [], | ||
/* | ||
** Build configuration | ||
** See https://nuxtjs.org/api/configuration-build/ | ||
*/ | ||
build: {}, | ||
} |