mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
Merge branch 'dev' into refacto-app
This commit is contained in:
commit
d1ed762c1b
@ -2,6 +2,10 @@ language: node_js
|
||||
node_js:
|
||||
- "8"
|
||||
- "6"
|
||||
cache:
|
||||
yarn: true
|
||||
directories:
|
||||
- node_modules
|
||||
install:
|
||||
- yarn install
|
||||
- yarn run build
|
||||
|
46
CODE_OF_CONDUCT.md
Normal file
46
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,46 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at team@nuxtjs.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
10
CONTRIBUTING.md
Normal file
10
CONTRIBUTING.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Contributing to Nuxt.js
|
||||
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device.
|
||||
2. Install the dependencies: `npm install`.
|
||||
3. Run `npm link` to link the local repo to NPM.
|
||||
4. Run `npm run build` to build or `npm run watch` to build and watch for code changes.
|
||||
5. Then npm link this repo inside any example app with `npm link nuxt`.
|
||||
6. Then you can run your example app with the local version of Nuxt.js (You may need to re-run the example app as you change server side code in the Nuxt.js repository).
|
||||
|
||||
Make sure to add tests into `test/` directory and try them with `npm test` before making a pull request.
|
@ -164,7 +164,7 @@ You can start by using one of our starter templates:
|
||||
- [koa](https://github.com/nuxt-community/koa-template): Nuxt.js + Koa
|
||||
- [adonuxt](https://github.com/nuxt-community/adonuxt-template): Nuxt.js + AdonisJS
|
||||
- [micro](https://github.com/nuxt-community/micro-template): Nuxt.js + Micro
|
||||
- [nuxtent](https://github.com/nuxt-community/nuxtent-template): Nuxt.js + Nuxtent module for content heavy sites
|
||||
- [nuxtent](https://github.com/nuxt-community/nuxtent-template): Nuxt.js + Nuxtent module for content heavy sites
|
||||
|
||||
## Using nuxt.js programmatically
|
||||
|
||||
@ -252,3 +252,6 @@ Note: we recommend putting `.nuxt` in `.npmignore` or `.gitignore`.
|
||||
## Roadmap
|
||||
|
||||
https://github.com/nuxt/nuxt.js/projects/1
|
||||
|
||||
## Contributing
|
||||
Please see our [contributing.md](./contributing.md)
|
@ -4,6 +4,10 @@ environment:
|
||||
- nodejs_version: "6"
|
||||
- nodejs_version: "8"
|
||||
|
||||
cache:
|
||||
- "%LOCALAPPDATA%\\Yarn"
|
||||
- node_modules
|
||||
|
||||
# Install scripts. (runs after repo cloning)
|
||||
install:
|
||||
# Get the latest stable version of Node.js or io.js
|
||||
|
@ -1,8 +1,9 @@
|
||||
{
|
||||
"name": "nuxt-custom-server",
|
||||
"dependencies": {
|
||||
"chalk": "^2.2.0",
|
||||
"express": "^4.15.3",
|
||||
"nuxt": "^1.0.0-rc3"
|
||||
"nuxt": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "node server.js",
|
||||
|
@ -1,5 +1,6 @@
|
||||
const app = require('express')()
|
||||
const { Nuxt, Builder } = require('nuxt')
|
||||
const chalk = require('chalk')
|
||||
|
||||
const host = process.env.HOST || '127.0.0.1'
|
||||
const port = process.env.PORT || 3000
|
||||
@ -21,4 +22,4 @@ app.use(nuxt.render)
|
||||
|
||||
// Start express server
|
||||
app.listen(port, host)
|
||||
console.log('Server listening on ' + host + ':' + port)
|
||||
console.log('\n' + chalk.bgGreen.black(' OPEN ') + chalk.green(` http://${host}:${port}`))
|
||||
|
@ -6,16 +6,16 @@ export const messages = [
|
||||
component: 'vChart',
|
||||
data: {
|
||||
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
||||
datasets:[
|
||||
{
|
||||
label: 'Activity',
|
||||
backgroundColor: '#41b883',
|
||||
data: [40, 20, 12, 39, 10, 40, 39, 50, 40, 20, 12, 11]
|
||||
}
|
||||
datasets: [
|
||||
{
|
||||
label: 'Activity',
|
||||
backgroundColor: '#41b883',
|
||||
data: [40, 20, 12, 39, 10, 40, 39, 50, 40, 20, 12, 11]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{ component: 'vText', data: 'End of demo 🎉' },
|
||||
{ component: 'vText', data: 'End of demo 🎉' }
|
||||
]
|
||||
|
||||
async function streamMessages (fn, i = 0) {
|
||||
@ -24,4 +24,4 @@ async function streamMessages (fn, i = 0) {
|
||||
setTimeout(() => streamMessages(fn, i + 1), 1500)
|
||||
}
|
||||
|
||||
export default streamMessages
|
||||
export default streamMessages
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "dynamic-components-nuxt",
|
||||
"dependencies": {
|
||||
"chart.js": "^2.7.0",
|
||||
"nuxt": "^1.0.0-rc11",
|
||||
"nuxt": "latest",
|
||||
"vue-chartjs": "^2.8.7"
|
||||
},
|
||||
"scripts": {
|
||||
|
@ -16,7 +16,7 @@ const components = {
|
||||
vText: () => import('@/components/text.vue' /* webpackChunkName: "components/text" */),
|
||||
vImage: () => import('@/components/image.vue' /* webpackChunkName: "components/image" */),
|
||||
vCode: () => import('@/components/code.vue' /* webpackChunkName: "components/code" */),
|
||||
vChart: () => import('@/components/chart.js' /* webpackChunkName: "components/chart" */).then((m) => m.default()),
|
||||
vChart: () => import('@/components/chart.js' /* webpackChunkName: "components/chart" */).then((m) => m.default())
|
||||
}
|
||||
|
||||
export default {
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "nuxt-i18n",
|
||||
"dependencies": {
|
||||
"nuxt": "^1.0.0-rc9",
|
||||
"vue-i18n": "^7.0.5"
|
||||
"nuxt": "latest",
|
||||
"vue-i18n": "^7.3.2"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "nuxt",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "nuxt-vuex-store",
|
||||
"dependencies": {
|
||||
"nuxt": "^1.0.0-rc6",
|
||||
"nuxt": "latest",
|
||||
"vuex-persistedstate": "^2.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
|
@ -11,6 +11,6 @@
|
||||
"jsdom": "^11.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"nuxt": "^1.0.0-alpha2"
|
||||
"nuxt": "latest"
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
import test from 'ava'
|
||||
import Nuxt from 'nuxt'
|
||||
import { Nuxt, Builder } from 'nuxt'
|
||||
import { resolve } from 'path'
|
||||
|
||||
// We keep the nuxt and server instance
|
||||
// So we can close them at the end of the test
|
||||
let nuxt = null
|
||||
let server = null
|
||||
|
||||
// Init Nuxt.js and create a server listening on localhost:4000
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
@ -15,9 +14,8 @@ test.before('Init Nuxt.js', async t => {
|
||||
config.rootDir = rootDir // project folder
|
||||
config.dev = false // production build
|
||||
nuxt = new Nuxt(config)
|
||||
await nuxt.build()
|
||||
server = new nuxt.Server(nuxt)
|
||||
server.listen(4000, 'localhost')
|
||||
await new Builder(nuxt).build()
|
||||
await nuxt.listen(4000, 'localhost')
|
||||
})
|
||||
|
||||
// Example of testing only generated html
|
||||
@ -39,6 +37,5 @@ test('Route / exits and render HTML with CSS applied', async t => {
|
||||
|
||||
// Close server and ask nuxt to stop listening to file changes
|
||||
test.after('Closing server and nuxt.js', t => {
|
||||
server.close()
|
||||
nuxt.close()
|
||||
})
|
||||
|
@ -15,6 +15,6 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^0.15.3",
|
||||
"nuxt": "^0.9.9"
|
||||
"nuxt": "latest"
|
||||
}
|
||||
}
|
||||
|
@ -28,14 +28,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from '~plugins/axios'
|
||||
import axios from '~/plugins/axios'
|
||||
|
||||
export default {
|
||||
async data() {
|
||||
const { data } = await axios.get('users.json')
|
||||
return {
|
||||
users: data
|
||||
}
|
||||
async asyncData () {
|
||||
const { data: users } = await axios.get('users.json')
|
||||
return { users }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -11,15 +11,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from '~plugins/axios'
|
||||
import axios from '~/plugins/axios'
|
||||
|
||||
export default {
|
||||
async data({ route }) {
|
||||
async asyncData ({ route }) {
|
||||
const { key } = route.params
|
||||
const { data } = await axios.get(`users/${key}.json`)
|
||||
return {
|
||||
user: data
|
||||
}
|
||||
const { data: user } = await axios.get(`users/${key}.json`)
|
||||
return { user }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
26
examples/with-museui/nuxt.config.js
Normal file
26
examples/with-museui/nuxt.config.js
Normal file
@ -0,0 +1,26 @@
|
||||
module.exports = {
|
||||
head: {
|
||||
meta: [
|
||||
{
|
||||
name: 'viewport',
|
||||
content: 'width=device-width, initial-scale=1'
|
||||
}
|
||||
],
|
||||
link: [
|
||||
{
|
||||
rel: 'stylesheet',
|
||||
href:
|
||||
'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic'
|
||||
},
|
||||
{
|
||||
rel: 'stylesheet',
|
||||
href: 'https://fonts.googleapis.com/icon?family=Material+Icons'
|
||||
},
|
||||
{
|
||||
rel: 'stylesheet',
|
||||
href: 'https://unpkg.com/muse-ui@2.1.0/dist/muse-ui.css'
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: ['~/plugins/museui']
|
||||
};
|
12
examples/with-museui/package.json
Normal file
12
examples/with-museui/package.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "with-museui",
|
||||
"dependencies": {
|
||||
"nuxt": "latest",
|
||||
"muse-ui": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "nuxt",
|
||||
"build": "nuxt build",
|
||||
"start": "nuxt start"
|
||||
}
|
||||
}
|
43
examples/with-museui/pages/index.vue
Normal file
43
examples/with-museui/pages/index.vue
Normal file
@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<div>
|
||||
<mu-appbar title="Nuxt.js">
|
||||
<mu-icon-button icon="menu" slot="left" @click="toggle()" />
|
||||
<mu-icon-menu icon="expand_more" slot="right">
|
||||
<mu-menu-item value="1" title="One" />
|
||||
<mu-menu-item value="2" title="Two" />
|
||||
<mu-menu-item value="3" title="Three" />
|
||||
</mu-icon-menu>
|
||||
</mu-appbar>
|
||||
<mu-drawer :open="open" @close="toggle()" :docked=false>
|
||||
<mu-list>
|
||||
<mu-list-item title="Menu Item 1" />
|
||||
<mu-list-item title="Menu Item 2" />
|
||||
<mu-list-item title="Menu Item 3" />
|
||||
</mu-list>
|
||||
</mu-drawer>
|
||||
<div class="content">
|
||||
<mu-raised-button label="Primary" class="demo-raised-button" primary/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
open: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggle(flag) {
|
||||
this.open = !this.open;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
margin: 10px
|
||||
}
|
||||
</style>
|
4
examples/with-museui/plugins/museui.js
Normal file
4
examples/with-museui/plugins/museui.js
Normal file
@ -0,0 +1,4 @@
|
||||
import Vue from 'vue';
|
||||
import MuseUI from 'muse-ui';
|
||||
|
||||
Vue.use(MuseUI);
|
@ -9,16 +9,16 @@ module.exports = function () {
|
||||
|
||||
// Add `socket.io-client` in vendor
|
||||
this.addVendor('socket.io-client')
|
||||
|
||||
|
||||
// Add socket.io events
|
||||
let messages = []
|
||||
io.on('connection', (socket) => {
|
||||
socket.on('last-messages', function (fn) {
|
||||
fn(messages.slice(-50))
|
||||
});
|
||||
})
|
||||
socket.on('send-message', function (message) {
|
||||
messages.push(message)
|
||||
socket.broadcast.emit('new-message', message)
|
||||
})
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^4.14.0",
|
||||
"nuxt": "^0.9.5",
|
||||
"nuxt": "latest",
|
||||
"socket.io": "^1.7.2",
|
||||
"socket.io-client": "^1.7.2"
|
||||
},
|
||||
|
@ -1,4 +1,4 @@
|
||||
const Nuxt = require('nuxt')
|
||||
const { Nuxt, Builder } = require('nuxt')
|
||||
const app = require('express')()
|
||||
const server = require('http').createServer(app)
|
||||
const io = require('socket.io')(server)
|
||||
@ -8,17 +8,14 @@ const isProd = process.env.NODE_ENV === 'production'
|
||||
// We instantiate Nuxt.js with the options
|
||||
let config = require('./nuxt.config.js')
|
||||
config.dev = !isProd
|
||||
const nuxt = new Nuxt(config)
|
||||
app.use(nuxt.render)
|
||||
|
||||
// Build only in dev mode
|
||||
const nuxt = new Nuxt(config)
|
||||
// Start build process in dev mode
|
||||
if (config.dev) {
|
||||
nuxt.build()
|
||||
.catch((error) => {
|
||||
console.error(error) // eslint-disable-line no-console
|
||||
process.exit(1)
|
||||
})
|
||||
const builder = new Builder(nuxt)
|
||||
builder.build()
|
||||
}
|
||||
app.use(nuxt.render)
|
||||
|
||||
// Listen the server
|
||||
server.listen(port, '0.0.0.0')
|
||||
@ -29,9 +26,9 @@ let messages = []
|
||||
io.on('connection', (socket) => {
|
||||
socket.on('last-messages', function (fn) {
|
||||
fn(messages.slice(-50))
|
||||
});
|
||||
})
|
||||
socket.on('send-message', function (message) {
|
||||
messages.push(message)
|
||||
socket.broadcast.emit('new-message', message)
|
||||
})
|
||||
});
|
||||
})
|
||||
|
@ -171,7 +171,7 @@ async function createApp (ssrContext) {
|
||||
return {
|
||||
app,
|
||||
router,
|
||||
<% if(store) { %> store <% } %>
|
||||
<% if(store) { %>store<% } %>
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user