-
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.
Merge pull request #5 from form8ion/alpha
- Loading branch information
Showing
9 changed files
with
160 additions
and
9 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
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 @@ | ||
export {default as scaffold} from './scaffold'; |
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,39 @@ | ||
import {assert} from 'chai'; | ||
import sinon from 'sinon'; | ||
import any from '@travi/any'; | ||
import * as config from './config'; | ||
import scaffold from './scaffold'; | ||
|
||
suite('scaffold', () => { | ||
let sandbox; | ||
|
||
setup(() => { | ||
sandbox = sinon.createSandbox(); | ||
|
||
sandbox.stub(config, 'default'); | ||
}); | ||
|
||
teardown(() => sandbox.restore()); | ||
|
||
test('that nuxt dependencies are defined', async () => { | ||
const projectRoot = any.string(); | ||
|
||
const {dependencies, devDependencies, scripts, vcsIgnore, buildDirectory} = await scaffold({projectRoot}); | ||
|
||
assert.calledWith(config.default, {projectRoot}); | ||
assert.deepEqual(dependencies, ['nuxt']); | ||
assert.deepEqual(devDependencies, ['@vue/test-utils', '@nuxtjs/eslint-module']); | ||
assert.deepEqual(buildDirectory, 'dist/'); | ||
assert.deepEqual(vcsIgnore.directories, ['.nuxt/']); | ||
assert.deepEqual( | ||
scripts, | ||
{ | ||
dev: 'nuxt', | ||
build: 'nuxt build', | ||
start: 'nuxt start', | ||
export: 'nuxt export', | ||
serve: 'nuxt serve' | ||
} | ||
); | ||
}); | ||
}); |
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,19 @@ | ||
import scaffoldConfig from './config'; | ||
|
||
export default async function ({projectRoot}) { | ||
await scaffoldConfig({projectRoot}); | ||
|
||
return { | ||
scripts: { | ||
dev: 'nuxt', | ||
build: 'nuxt build', | ||
start: 'nuxt start', | ||
export: 'nuxt export', | ||
serve: 'nuxt serve' | ||
}, | ||
dependencies: ['nuxt'], | ||
devDependencies: ['@vue/test-utils', '@nuxtjs/eslint-module'], | ||
buildDirectory: 'dist/', | ||
vcsIgnore: {directories: ['.nuxt/']} | ||
}; | ||
} |
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: {} | ||
}; |