Skip to content

Commit

Permalink
v0.1.12 (#60)
Browse files Browse the repository at this point in the history
* initial commit

* adding extra graphql features wip

* file uploads and logging wip

* update packages

* update packages and minor fixes

* added uptimisticResponse and refetch, to handle error if failure

* complete wonderful apollo graphql stuff

* update docs and build
  • Loading branch information
ais-one committed May 25, 2019
1 parent 07f8fe2 commit 654b0da
Show file tree
Hide file tree
Showing 20 changed files with 333 additions and 105 deletions.
9 changes: 4 additions & 5 deletions README.md
Expand Up @@ -8,7 +8,7 @@ The **example-nuxt** folder contains example using NuxtJS, a VueJS framework. Tw

# NOTICES & UPDATES

> Latest Version 0.1.11 Released 2019 Apr 25 0815 +8GMT
> Latest Version 0.1.12 Released 2019 May 25 1630 +8GMT
Roadmap and latest updates can be found on the <a href="https://github.com/ais-one/vue-crud-x/wiki" target="_blank">Wiki</a>.

Expand All @@ -18,8 +18,7 @@ Read the following <a href="https://medium.com/@aaronjxz/vue-crud-x-a-highly-cus

## 1 New Features

1. GraphQL, this is a major topic and has many features to handle data especially when using the Apollo library. We covered subscriptions and auth, and will be including optimistic UI, refetch & cache in our next release
2. Use vue-cli instead of poi to build vue-crud-x as npm package
1. More Apollo Client GraphQL features cache, optimistic response, refetch queries

## 2 Major Improvements (Without Breaking Changes)

Expand All @@ -29,8 +28,8 @@ Usage example can be found:
- in **example-rest** project (see example-rest/README.md on quickstart)
- example-rest/src/pages/Page.vue
- example-rest/src/pages/Book.vue
- example-rest/src/pages/author.js
- example-rest/src/pages/category.js
- example-rest/src/components/author.js
- example-rest/src/pages/Category.vue
- in **example-nuxt** project (see example-nuxt/README.md on quickstart)
- in **example-firebase** project
- example-firebase/src/pages/MultiCrud/Example.vue (also, demonstrates multiple vue-crud-x used in a single page)
Expand Down
22 changes: 13 additions & 9 deletions RELEASE.md
@@ -1,8 +1,14 @@
### Upcoming
* More GraphQL features (Optimistic UI, refetchqueries, cache) if possible
* RESTful++ Backend For Testing
* Non-essential items
* Multiple File upload example (to local folder)
* Single File upload example (to firebase storage)
* Logging
* Security Improvements
* Automated testing (dredd.io)
* VueJS 3.0 update
* Vuetify 2.0 breaking changes list - check to see which will affect the code base
* https://github.com/vuetifyjs/vuetify/releases/tag/v2.0.0-alpha.18
* https://github.com/vuetifyjs/vuetify/releases/tag/v2.0.0-alpha.13
* https://github.com/vuetifyjs/vuetify/releases/tag/v2.0.0-alpha.12
* https://github.com/vuetifyjs/vuetify/releases/tag/v2.0.0-alpha.11
Expand All @@ -12,12 +18,6 @@
* https://github.com/vuetifyjs/vuetify/releases/tag/v2.0.0-alpha.7
* https://github.com/vuetifyjs/vuetify/releases/tag/v2.0.0-alpha.5
* https://github.com/vuetifyjs/vuetify/releases/tag/v2.0.0-alpha.4
* RESTful++ Backend For Testing
* Non-essential items
* Multiple File upload example (to local folder)
* Single File upload example (to firebase storage)
* Logging
* Security Improvements
* improve i18n
* https://github.com/ais-one/vue-crud-x/issues/32
* https://github.com/vuetifyjs/vuetify/pull/5232
Expand All @@ -35,6 +35,12 @@
* v0.1.4 - CRUD operations to return object instead of number
* v0.1.3 - use 'field' instead of 'type' for Form and Filter inputs

### Version 0.1.12
* improvement: apollo graphql features (optimistic UI, refetch queries, cache)
* chore: add formReload flag to VueCrudX (default true), as original REST API always reloads after CRUD. We set it to false (see Categories.vue page), as graphql has optimistic UI, cache and refetch queries available and we make use of them instead for this case.
* chore: clean up and improve code when possible, bug fixes
* chore: package updates
* chore: monitor VuetifyJS 2 & VueJS 3 updates, start migration from beta release onwards

### Version 0.1.11
* improvement: added GraphQL (include subscriptions, auth)
Expand All @@ -44,8 +50,6 @@
* chore: clean up and improve code when possible
* chore: package updates
* chore: monitor VuetifyJS 2 & VueJS 3 updates, start migration from beta release onwards
* in pipeline: add test from dredd.io when ready
* in pipeline: more graphql features if possible (optimistic UI, refetch queries, cache)

### Version 0.1.10
* improvement (NO ACTION NEEDED): improve i18n: you have access to i18n when you use .vue file
Expand Down
9 changes: 4 additions & 5 deletions backend/index.js
Expand Up @@ -19,8 +19,9 @@ let credentials
if (USE_HTTPS) credentials = { key: fs.readFileSync(`${USE_HTTPS}/privkey.pem`), cert: fs.readFileSync(`${USE_HTTPS}/fullchain.pem`) }

// const functions = require('firebase-functions')
const bodyParser = require('body-parser')
const express = require('express')
const history = require('connect-history-api-fallback');
const bodyParser = require('body-parser')
const cors = require('cors')
const http = require('http')
const https = require('https')
Expand All @@ -38,14 +39,12 @@ const app = express()

apollo.applyMiddleware({ app }); // console.log(`GraphqlPATH ${server.graphqlPath}`)

app.use(cors())
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }))

app.use(history())
app.use(express.static('public')) // for html content

app.use('/api-docs', express.static('docs')) // for OpenAPI
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument, { // for OpenAPI
app.use('/api-docs', express.static('docs'), swaggerUi.serve, swaggerUi.setup(swaggerDocument, { // for OpenAPI
swaggerOptions: {
docExpansion: 'none'
},
Expand Down
36 changes: 20 additions & 16 deletions backend/package.json
Expand Up @@ -19,42 +19,46 @@
},
"dependencies": {
"@keyv/redis": "^1.3.8",
"apollo-server-express": "^2.4.8",
"apollo-server-express": "^2.5.0",
"axios": "^0.18.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.3",
"body-parser": "^1.19.0",
"connect-history-api-fallback": "^1.6.0",
"cors": "^2.8.4",
"cron": "^1.7.0",
"cron": "^1.7.1",
"date-fns": "^1.29.0",
"del": "^4.1.0",
"dotenv": "^7.0.0",
"express": "^4.16.3",
"firebase-admin": "^7.3.0",
"graphql": "^14.2.1",
"del": "^4.1.1",
"dotenv": "^8.0.0",
"express": "^4.17.0",
"firebase-admin": "^8.0.0",
"graphql": "^14.3.1",
"influx": "^5.0.7",
"ioredis": "^4.9.0",
"ioredis": "^4.9.5",
"jsonwebtoken": "^8.5.1",
"keyv": "^3.1.0",
"knex": "^0.16.5",
"mongodb": "^3.2.3",
"mongodb": "^3.2.6",
"morgan": "^1.9.1",
"multer": "^1.4.1",
"mysql": "^2.17.1",
"objection": "^1.6.8",
"objection": "^1.6.9",
"otplib": "^11.0.0",
"qrcode": "^1.3.3",
"sqlite3": "^4.0.6",
"sqlite3": "^4.0.8",
"swagger-jsdoc": "^3.2.9",
"swagger-ui-express": "^4.0.1",
"swagger-ui-express": "^4.0.4",
"uuid": "^3.3.2",
"ws": "^6.2.1",
"winston": "^3.2.1",
"ws": "^7.0.0",
"yamljs": "^0.3.0"
},
"devDependencies": {
"chai": "^4.1.2",
"chai-http": "^4.2.1",
"chai-http": "^4.3.0",
"eslint": "^5.16.0",
"eslint-plugin-promise": "^4.1.1",
"mocha": "^6.1.2"
"mocha": "^6.1.4",
"nyc": "^14.1.1"
},
"private": true
}
11 changes: 11 additions & 0 deletions backend/schema.gql
Expand Up @@ -5,13 +5,24 @@ type Query {

getCategory(id: Int!): Category
getCategories: Categories

uploads: [File] # file upload
}

type Mutation {
putAuthor(id: Int!, body: InputAuthor!): Author
postAuthor(body: InputAuthor!): Author
patchCategory(id: Int!, body: InputCategory!): Category
postCategory(body: InputCategory!): Category

singleUpload(file: Upload!): File! # file upload
}


type File { # File Upload - Upload scalar type is from Apollo - better to use rest for this?
filename: String!
mimetype: String!
encoding: String!
}

input InputAuthor {
Expand Down
16 changes: 16 additions & 0 deletions backend/schema.js
Expand Up @@ -63,6 +63,9 @@ const resolvers = {
} catch (e) {
return {}
}
},
uploads: () => {
// Return the record of files uploaded from your DB or API or filesystem.
}
},
Mutation: {
Expand Down Expand Up @@ -100,6 +103,19 @@ const resolvers = {
} catch (e) {
return {}
}
},
async singleUpload(parent, { file }) {
const { stream, filename, mimetype, encoding } = await file;

// 1. Validate file metadata.

// 2. Stream file contents into cloud storage:
// https://nodejs.org/api/stream.html

// 3. Record the file upload in your DB.
// const id = await recordFile( … )

return { filename, mimetype, encoding };
}
},
Subscription: {
Expand Down
Empty file added backend/services/logger.js
Empty file.
20 changes: 10 additions & 10 deletions example-firebase/package.json
Expand Up @@ -11,23 +11,23 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"@firebase/app": "^0.3.16",
"@firebase/auth": "^0.10.0",
"@firebase/firestore": "^1.2.0",
"@firebase/storage": "^0.2.14",
"@firebase/app": "^0.4.3",
"@firebase/auth": "^0.11.2",
"@firebase/firestore": "^1.3.3",
"@firebase/storage": "^0.2.16",
"axios": "^0.18.0",
"date-fns": "^1.30.0",
"vue": "^2.6.10",
"vue-i18n": "^8.10.0",
"vue-i18n": "^8.11.2",
"vue-recaptcha": "^1.1.1",
"vue-router": "^3.0.6",
"vuetify": "^1.5.13",
"vuex": "^3.1.0"
"vuetify": "^1.5.14",
"vuex": "^3.1.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.6.0",
"@vue/cli-plugin-eslint": "^3.6.0",
"@vue/cli-service": "^3.6.0",
"@vue/cli-plugin-babel": "^3.7.0",
"@vue/cli-plugin-eslint": "^3.7.0",
"@vue/cli-service": "^3.7.0",
"@vue/eslint-config-standard": "^4.0.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2",
Expand Down
44 changes: 38 additions & 6 deletions example-nuxt/.eslintrc.js
@@ -1,4 +1,25 @@
module.exports = {
// root: true,
// env: {
// browser: true,
// node: true
// },
// parserOptions: {
// parser: 'babel-eslint'
// },
// extends: [
// 'plugin:vue/essential',
// //'plugin:vue/recommended',
// 'plugin:prettier/recommended'
// ],
// // required to lint *.vue files
// plugins: ['vue', 'prettier'],
// // add your custom rules here
// rules: {
// 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
// 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
// 'vue/max-attributes-per-line': 'off'
// }
root: true,
env: {
browser: true,
Expand All @@ -8,19 +29,30 @@ module.exports = {
parser: 'babel-eslint'
},
extends: [
'eslint:recommended',
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential',
//'plugin:vue/recommended',
'plugin:prettier/recommended'
],
// required to lint *.vue files
plugins: [
'vue',
'prettier'
],
plugins: ['vue', 'prettier'], // with this you do not need .prettierrc
// plugins: ['vue'],
// add your custom rules here
rules: {
semi: [2, 'never'],
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'vue/max-attributes-per-line': 'off'
'vue/max-attributes-per-line': 'off',
'no-unused-vars': 'off',
'no-empty': 'off',
'prettier/prettier': [
'error',
{
semi: false,
singleQuote: true,
printWidth : 150
}
]
}
}
5 changes: 0 additions & 5 deletions example-nuxt/.prettierrc

This file was deleted.

15 changes: 15 additions & 0 deletions example-nuxt/nuxt.config.js
Expand Up @@ -33,6 +33,7 @@ export default {
},

router: {
// middleware: '',
extendRoutes(routes, resolve) {
routes.push({
name: 'custom404',
Expand Down Expand Up @@ -88,6 +89,20 @@ export default {
fr: { welcome: 'Bienvenue' }
}
}
// lazy: true,
// langDir: 'lang/'
// // lang/[lang].js
// export default (context) => {
// return new Promise(function (resolve) {
// resolve({
// welcome: 'Welcome'
// })
// });
// }
// // or
// export default {
// welcome: 'Welcome'
// }
}
]
],
Expand Down

0 comments on commit 654b0da

Please sign in to comment.