mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-20 06:09:56 -06:00
57 lines
845 B
JavaScript
57 lines
845 B
JavaScript
const gql = require('graphql-tag')
|
|
// Connectors
|
|
const git = require('../connectors/git')
|
|
|
|
exports.types = gql`
|
|
extend type Query {
|
|
fileDiffs: [FileDiff]
|
|
}
|
|
|
|
extend type Mutation {
|
|
gitCommit (message: String!): Boolean
|
|
}
|
|
|
|
type FileDiff {
|
|
id: ID!
|
|
from: String
|
|
to: String
|
|
new: Boolean
|
|
deleted: Boolean
|
|
binary: Boolean
|
|
chunks: [FileDiffChunk]
|
|
}
|
|
|
|
type FileDiffChunk {
|
|
changes: [FileDiffChange]
|
|
oldStart: Int
|
|
oldLines: Int
|
|
newStart: Int
|
|
newLines: Int
|
|
}
|
|
|
|
type FileDiffChange {
|
|
type: FileDiffChangeType
|
|
ln: Int
|
|
ln1: Int
|
|
ln2: Int
|
|
content: String
|
|
normal: Boolean
|
|
}
|
|
|
|
enum FileDiffChangeType {
|
|
normal
|
|
add
|
|
del
|
|
}
|
|
`
|
|
|
|
exports.resolvers = {
|
|
Query: {
|
|
fileDiffs: (root, args, context) => git.getDiffs(context)
|
|
},
|
|
|
|
Mutation: {
|
|
gitCommit: (root, { message }, context) => git.commit(message, context)
|
|
}
|
|
}
|