├── static
└── .gitkeep
├── test
├── unit
│ ├── .eslintrc
│ ├── specs
│ │ └── Hello.spec.js
│ ├── index.js
│ └── karma.conf.js
└── e2e
│ ├── specs
│ └── test.js
│ ├── runner.js
│ ├── custom-assertions
│ └── elementCount.js
│ └── nightwatch.conf.js
├── src
├── vuex
│ ├── getters.js
│ ├── mutation-types.js
│ ├── store.js
│ └── actions.js
├── assets
│ └── logo.png
├── fonts
│ ├── glyphicons-halflings-regular.eot
│ ├── glyphicons-halflings-regular.ttf
│ ├── glyphicons-halflings-regular.woff
│ ├── glyphicons-halflings-regular.woff2
│ └── glyphicons-halflings-regular.svg
├── components
│ ├── Project.vue
│ ├── Logout.vue
│ ├── AddProject.vue
│ ├── Home.vue
│ ├── EditProject.vue
│ ├── Navigation.vue
│ ├── Register.vue
│ └── Login.vue
├── main.js
├── router.js
└── App.vue
├── .babelrc
├── .gitignore
├── .editorconfig
├── index.html
├── .eslintrc.js
├── README.md
└── package.json
/static/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/unit/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "jasmine": true
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/src/vuex/getters.js:
--------------------------------------------------------------------------------
1 | export const authData = state => {
2 | return state.authData
3 | }
4 |
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacobwise/vuex-firebase/HEAD/src/assets/logo.png
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["es2015", "stage-2"],
3 | "plugins": ["transform-runtime"],
4 | "comments": false
5 | }
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | dist/
4 | npm-debug.log
5 | selenium-debug.log
6 | test/unit/coverage
7 | test/e2e/reports
8 |
--------------------------------------------------------------------------------
/src/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacobwise/vuex-firebase/HEAD/src/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/src/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacobwise/vuex-firebase/HEAD/src/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/src/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacobwise/vuex-firebase/HEAD/src/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/src/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacobwise/vuex-firebase/HEAD/src/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/src/vuex/mutation-types.js:
--------------------------------------------------------------------------------
1 | export const AUTH_CHANGED = 'AUTH_CHANGED'
2 | export const GET_PROJECTS = 'GET_PROJECTS'
3 | export const GET_PROJECT = 'GET_PROJECT'
4 | export const SET_PROJECT = 'SET_PROJECT'
5 | export const GET_PROJECTS_COUNT = 'GET_PROJECTS_COUNT'
6 |
--------------------------------------------------------------------------------
/src/components/Project.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
{{ project.title }}
5 |
{{ project.number }}
6 |
{{ project.content }}
7 |
8 |
9 |
10 |
11 |
20 |
--------------------------------------------------------------------------------
/test/e2e/specs/test.js:
--------------------------------------------------------------------------------
1 | // For authoring Nightwatch tests, see
2 | // http://nightwatchjs.org/guide#usage
3 |
4 | module.exports = {
5 | 'default e2e tests': function (browser) {
6 | browser
7 | .url('http://localhost:8080')
8 | .waitForElementVisible('#app', 5000)
9 | .assert.elementPresent('.logo')
10 | .assert.containsText('h1', 'Hello World!')
11 | .assert.elementCount('p', 3)
12 | .end()
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/components/Logout.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ msg }}
4 |
5 |
6 |
7 |
20 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | vue-firebase
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
4 | extends: 'standard',
5 | // required to lint *.vue files
6 | plugins: [
7 | 'html'
8 | ],
9 | // add your custom rules here
10 | 'rules': {
11 | // allow paren-less arrow functions
12 | 'arrow-parens': 0,
13 | // allow debugger during development
14 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/test/unit/specs/Hello.spec.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Hello from 'src/components/Hello'
3 |
4 | describe('Hello.vue', () => {
5 | it('should render correct contents', () => {
6 | const vm = new Vue({
7 | template: '
',
8 | components: { Hello }
9 | }).$mount()
10 | expect(vm.$el.querySelector('.hello h1').textContent).toBe('Hello World!')
11 | })
12 | })
13 |
14 | // also see example testing a component with mocks at
15 | // https://github.com/vuejs/vue-loader-example/blob/master/test/unit/a.spec.js#L24-L49
16 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import VueRouter from 'vue-router'
3 | import { configRouter } from './router'
4 | import { sync } from 'vuex-router-sync'
5 | import store from './vuex/store' // vuex store instance
6 |
7 | // install router
8 | Vue.use(VueRouter)
9 |
10 | // create router
11 | const router = new VueRouter({
12 | hashbang: true
13 | })
14 |
15 | // configure router
16 | configRouter(router)
17 |
18 | sync(store, router) // done.
19 |
20 | // boostrap the app
21 | const App = Vue.extend(require('./app.vue'))
22 | router.start(App, '#app')
23 | /* eslint-disable no-new */
24 |
--------------------------------------------------------------------------------
/test/unit/index.js:
--------------------------------------------------------------------------------
1 | // Polyfill fn.bind() for PhantomJS
2 | /* eslint-disable no-extend-native */
3 | Function.prototype.bind = require('function-bind')
4 |
5 | // require all test files (files that ends with .spec.js)
6 | var testsContext = require.context('./specs', true, /\.spec$/)
7 | testsContext.keys().forEach(testsContext)
8 |
9 | // require all src files except main.js for coverage.
10 | // you can also change this to match only the subset of files that
11 | // you want coverage for.
12 | var srcContext = require.context('../../src', true, /^\.\/(?!main(\.js)?$)/)
13 | srcContext.keys().forEach(srcContext)
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vue-firebase
2 |
3 | > A Vue.js project
4 |
5 | ## Build Setup
6 |
7 | ``` bash
8 | # install dependencies
9 | npm install
10 |
11 | # serve with hot reload at localhost:8080
12 | npm run dev
13 |
14 | # build for production with minification
15 | npm run build
16 |
17 | # run unit tests
18 | npm run unit
19 |
20 | # run e2e tests
21 | npm run e2e
22 |
23 | # run all tests
24 | npm test
25 | ```
26 |
27 | For detailed explanation on how things work, checkout the [guide](https://github.com/vuejs-templates/webpack#vue-webpack-boilerplate) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
28 | # vuex-firebase
29 |
--------------------------------------------------------------------------------
/test/e2e/runner.js:
--------------------------------------------------------------------------------
1 | // 1. start the dev server
2 | var server = require('../../build/dev-server.js')
3 |
4 | // 2. run the nightwatch test suite against it
5 | // to run in additional browsers:
6 | // 1. add an entry in test/e2e/nightwatch.conf.json under "test_settings"
7 | // 2. add it to the --env flag below
8 | // For more information on Nightwatch's config file, see
9 | // http://nightwatchjs.org/guide#settings-file
10 | var spawn = require('cross-spawn')
11 | var runner = spawn(
12 | './node_modules/.bin/nightwatch',
13 | [
14 | '--config', 'test/e2e/nightwatch.conf.js',
15 | '--env', 'chrome,firefox'
16 | ],
17 | {
18 | stdio: 'inherit'
19 | }
20 | )
21 |
22 | runner.on('exit', function (code) {
23 | server.close()
24 | process.exit(code)
25 | })
26 |
27 | runner.on('error', function (err) {
28 | server.close()
29 | throw err
30 | })
31 |
--------------------------------------------------------------------------------
/test/e2e/custom-assertions/elementCount.js:
--------------------------------------------------------------------------------
1 | // A custom Nightwatch assertion.
2 | // the name of the method is the filename.
3 | // can be used in tests like this:
4 | //
5 | // browser.assert.elementCount(selector, count)
6 | //
7 | // for how to write custom assertions see
8 | // http://nightwatchjs.org/guide#writing-custom-assertions
9 | exports.assertion = function (selector, count) {
10 | this.message = 'Testing if element <' + selector + '> has count: ' + count
11 | this.expected = count
12 | this.pass = function (val) {
13 | return val === this.expected
14 | }
15 | this.value = function (res) {
16 | return res.value
17 | }
18 | this.command = function (cb) {
19 | var self = this
20 | return this.api.execute(function (selector) {
21 | return document.querySelectorAll(selector).length
22 | }, [selector], function (res) {
23 | cb.call(self, res)
24 | })
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/vuex/store.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 |
4 | const mutations = {
5 | AUTH_CHANGED (state, authData) {
6 | state.authData = authData
7 | },
8 | REDIRECT_LOGIN (state) {
9 | state.route.path = '/login'
10 | },
11 | GET_PROJECTS (state, projects) {
12 | state.projects = projects
13 | },
14 | UPDATE_PROJECT (state, project) {
15 | state.project = project
16 | },
17 | SET_PROJECT (state, project) {
18 | state.project = project
19 | },
20 | GET_PROJECTS_COUNT (state, count) {
21 | state.count = count
22 | }
23 | }
24 |
25 | Vue.use(Vuex)
26 | Vue.config.debug = true
27 |
28 | const debug = process.env.NODE_ENV !== 'production'
29 |
30 | const state = {
31 | route: {},
32 | authData: {},
33 | projects: {},
34 | project: {},
35 | count: 0
36 | }
37 |
38 | const store = new Vuex.Store({
39 | strict: debug,
40 | state,
41 | mutations
42 | })
43 |
44 | export default store
45 |
--------------------------------------------------------------------------------
/src/router.js:
--------------------------------------------------------------------------------
1 | export function configRouter (router) {
2 | // normal routes
3 | router.map({
4 | '/projects': {
5 | name: 'home',
6 | component: require('./components/Home.vue')
7 | },
8 | '/login': {
9 | name: 'login',
10 | component: require('./components/Login.vue')
11 | },
12 | '/register': {
13 | name: 'register',
14 | component: require('./components/Register.vue')
15 | },
16 | '/project/add': {
17 | name: 'addProject',
18 | component: require('./components/AddProject.vue')
19 | },
20 | '/project/:id/:project': {
21 | name: 'project',
22 | component: require('./components/Project.vue')
23 | },
24 | '/project/:id/edit': {
25 | name: 'editProject',
26 | component: require('./components/EditProject.vue')
27 | }
28 | })
29 |
30 | // Redirect to the home route if any routes are unmatched
31 | router.redirect({
32 | '*': '/projects'
33 | })
34 | }
35 |
36 |
--------------------------------------------------------------------------------
/test/e2e/nightwatch.conf.js:
--------------------------------------------------------------------------------
1 | // http://nightwatchjs.org/guide#settings-file
2 | module.exports = {
3 | "src_folders": ["test/e2e/specs"],
4 | "output_folder": "test/e2e/reports",
5 | "custom_assertions_path": ["test/e2e/custom-assertions"],
6 |
7 | "selenium": {
8 | "start_process": true,
9 | "server_path": "node_modules/selenium-server/lib/runner/selenium-server-standalone-2.52.0.jar",
10 | "host": "127.0.0.1",
11 | "port": 4444,
12 | "cli_args": {
13 | "webdriver.chrome.driver": require('chromedriver').path
14 | }
15 | },
16 |
17 | "test_settings": {
18 | "default": {
19 | "selenium_port": 4444,
20 | "selenium_host": "localhost",
21 | "silent": true
22 | },
23 |
24 | "chrome": {
25 | "desiredCapabilities": {
26 | "browserName": "chrome",
27 | "javascriptEnabled": true,
28 | "acceptSslCerts": true
29 | }
30 | },
31 |
32 | "firefox": {
33 | "desiredCapabilities": {
34 | "browserName": "firefox",
35 | "javascriptEnabled": true,
36 | "acceptSslCerts": true
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/components/AddProject.vue:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
51 |
--------------------------------------------------------------------------------
/src/components/Home.vue:
--------------------------------------------------------------------------------
1 |
2 |
27 |
28 |
29 |
60 |
--------------------------------------------------------------------------------
/src/vuex/actions.js:
--------------------------------------------------------------------------------
1 | import * as types from './mutation-types'
2 | import Firebase from 'firebase'
3 |
4 | export const changeAuth = ({ dispatch, state }, authData) => {
5 | dispatch(types.AUTH_CHANGED, authData)
6 | }
7 |
8 | export const getProjects = ({ dispatch, state }) => {
9 | var projectsRef = new Firebase('https://swellfire-daily.firebaseio.com/projects')
10 |
11 | projectsRef.on('value', function (snapshot) {
12 | dispatch(types.GET_PROJECTS, snapshot.val())
13 | var count = snapshot.numChildren()
14 | console.log(count)
15 | dispatch(types.GET_PROJECTS_COUNT, count)
16 | }, function (errorObject) {
17 | console.log('The read failed: ' + errorObject.code)
18 | })
19 | }
20 |
21 | export const getProject = ({ dispatch, state }, key) => {
22 | var projectRef = new Firebase('https://swellfire-daily.firebaseio.com/projects/' + key)
23 |
24 | projectRef.on('value', function (snapshot) {
25 | dispatch(types.GET_PROJECT, snapshot.val())
26 | }, function (errorObject) {
27 | console.log('The read failed: ' + errorObject.code)
28 | })
29 | }
30 |
31 | export const updateProject = ({ dispatch, state }, key) => {
32 | var projectRef = new Firebase('https://swellfire-daily.firebaseio.com/projects/' + key)
33 | console.log('https://swellfire-daily.firebaseio.com/projects/' + key)
34 | projectRef.on('value', function (snapshot) {
35 | dispatch(types.GET_PROJECT, snapshot.val())
36 | }, function (errorObject) {
37 | console.log('The read failed: ' + errorObject.code)
38 | })
39 | }
40 |
41 | export const setProject = ({ dispatch, state }, project) => {
42 | dispatch(types.SET_PROJECT, project)
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/test/unit/karma.conf.js:
--------------------------------------------------------------------------------
1 | // This is a karma config file. For more details see
2 | // http://karma-runner.github.io/0.13/config/configuration-file.html
3 | // we are also using it with karma-webpack
4 | // https://github.com/webpack/karma-webpack
5 |
6 | var path = require('path')
7 | var merge = require('webpack-merge')
8 | var baseConfig = require('../../build/webpack.base.conf')
9 | var projectRoot = path.resolve(__dirname, '../../')
10 |
11 | var webpackConfig = merge(baseConfig, {
12 | // use inline sourcemap for karma-sourcemap-loader
13 | devtool: '#inline-source-map',
14 | vue: {
15 | loaders: {
16 | js: 'isparta'
17 | }
18 | }
19 | })
20 |
21 | // no need for app entry during tests
22 | delete webpackConfig.entry
23 |
24 | // make sure isparta loader is applied before eslint
25 | webpackConfig.module.preLoaders.unshift({
26 | test: /\.js$/,
27 | loader: 'isparta',
28 | include: projectRoot,
29 | exclude: /test\/unit|node_modules/
30 | })
31 |
32 | // only apply babel for test files when using isparta
33 | webpackConfig.module.loaders.some(function (loader, i) {
34 | if (loader.loader === 'babel') {
35 | loader.include = /test\/unit/
36 | return true
37 | }
38 | })
39 |
40 | module.exports = function (config) {
41 | config.set({
42 | // to run in additional browsers:
43 | // 1. install corresponding karma launcher
44 | // http://karma-runner.github.io/0.13/config/browsers.html
45 | // 2. add it to the `browsers` array below.
46 | browsers: ['PhantomJS'],
47 | frameworks: ['jasmine'],
48 | reporters: ['spec', 'coverage'],
49 | files: ['./index.js'],
50 | preprocessors: {
51 | './index.js': ['webpack', 'sourcemap']
52 | },
53 | webpack: webpackConfig,
54 | webpackMiddleware: {
55 | noInfo: true
56 | },
57 | coverageReporter: {
58 | dir: './coverage',
59 | reporters: [
60 | { type: 'lcov', subdir: '.' },
61 | { type: 'text-summary' }
62 | ]
63 | }
64 | })
65 | }
66 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
71 |
92 |
--------------------------------------------------------------------------------
/src/components/EditProject.vue:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
22 |
63 |
64 |
73 |
--------------------------------------------------------------------------------
/src/components/Navigation.vue:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
22 |
39 |
40 |
97 |
98 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-firebase",
3 | "version": "0.1.0",
4 | "description": "A Vue.js project",
5 | "author": "Jacob Wise ",
6 | "scripts": {
7 | "dev": "node build/dev-server.js",
8 | "build": "rimraf dist && mkdirp dist && ncp static dist/static && cross-env NODE_ENV=production webpack --progress --hide-modules --config build/webpack.prod.conf.js",
9 | "unit": "karma start test/unit/karma.conf.js --single-run",
10 | "e2e": "node test/e2e/runner.js",
11 | "test": "npm run unit && npm run e2e"
12 | },
13 | "dependencies": {
14 | "toastr": "^2.1.2",
15 | "vue": "^1.0.17"
16 | },
17 | "devDependencies": {
18 | "babel-core": "^6.2.1",
19 | "babel-loader": "^6.2.0",
20 | "babel-plugin-transform-runtime": "^6.1.18",
21 | "babel-polyfill": "^6.2.0",
22 | "babel-preset-es2015": "^6.1.18",
23 | "babel-preset-es2015-rollup": "^1.1.1",
24 | "babel-preset-stage-2": "^6.1.18",
25 | "babel-runtime": "^5.8.0",
26 | "chromedriver": "^2.21.2",
27 | "connect-history-api-fallback": "^1.1.0",
28 | "cross-env": "^1.0.7",
29 | "cross-spawn": "^2.1.5",
30 | "css-loader": "^0.23.0",
31 | "eslint": "^2.0.0",
32 | "eslint-config-standard": "^5.1.0",
33 | "eslint-friendly-formatter": "^1.2.2",
34 | "eslint-loader": "^1.3.0",
35 | "eslint-plugin-html": "^1.3.0",
36 | "eslint-plugin-promise": "^1.0.8",
37 | "eslint-plugin-standard": "^1.3.2",
38 | "eventsource-polyfill": "^0.9.6",
39 | "express": "^4.13.3",
40 | "extract-text-webpack-plugin": "^1.0.1",
41 | "file-loader": "^0.8.4",
42 | "firebase": "^2.4.1",
43 | "function-bind": "^1.0.2",
44 | "html-webpack-plugin": "^2.8.1",
45 | "http-proxy-middleware": "^0.11.0",
46 | "inject-loader": "^2.0.1",
47 | "isparta-loader": "^2.0.0",
48 | "jasmine-core": "^2.4.1",
49 | "json-loader": "^0.5.4",
50 | "karma": "^0.13.15",
51 | "karma-coverage": "^0.5.5",
52 | "karma-jasmine": "^0.3.6",
53 | "karma-phantomjs-launcher": "^1.0.0",
54 | "karma-sourcemap-loader": "^0.3.7",
55 | "karma-spec-reporter": "0.0.24",
56 | "karma-webpack": "^1.7.0",
57 | "mkdirp": "^0.5.1",
58 | "ncp": "^2.0.0",
59 | "nightwatch": "^0.8.18",
60 | "phantomjs-prebuilt": "^2.1.3",
61 | "rimraf": "^2.5.0",
62 | "selenium-server": "2.52.0",
63 | "url-loader": "^0.5.7",
64 | "vue-hot-reload-api": "^1.2.0",
65 | "vue-html-loader": "^1.0.0",
66 | "vue-loader": "^8.2.1",
67 | "vue-style-loader": "^1.0.0",
68 | "vue-resource": "^0.7.0",
69 | "vue-router": "^0.7.10",
70 | "vuex": "^0.6.2",
71 | "webpack": "^1.12.2",
72 | "webpack-dev-middleware": "^1.4.0",
73 | "webpack-hot-middleware": "^2.6.0",
74 | "webpack-merge": "^0.8.3"
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/components/Register.vue:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
52 |
53 |
101 |
--------------------------------------------------------------------------------
/src/components/Login.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
You are logged in
12 |
13 |
14 |
15 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
71 |
72 |
185 |
--------------------------------------------------------------------------------
/src/fonts/glyphicons-halflings-regular.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------