Fix macro syntax bug in app templates

This commit is contained in:
Vikram Rangnekar 2019-11-09 21:53:26 -05:00
parent 605ec63466
commit 3438c3efb9
9 changed files with 48 additions and 19 deletions

View File

@ -24,6 +24,12 @@
:item="actionLink"
/>
<a
class="px-4 py-3 my-8 border-2 border-gray-500 text-gray-600 font-bold rounded"
href="https://github.com/dosco/super-graph"
target="_blank"
>Github</a>
</div>
</div>

View File

@ -1,6 +1,11 @@
let ogprefix = 'og: http://ogp.me/ns#'
let title = 'Super Graph'
let description = 'An instant GraphQL API for your app. No code needed.'
let color = '#f42525'
module.exports = {
title: 'Super Graph',
description: 'Get an instant GraphQL API for your Rails apps.',
title: title,
description: description,
themeConfig: {
logo: '/hologram.svg',
@ -15,6 +20,22 @@ module.exports = {
serviceWorker: {
updatePopup: true
},
head: [
//['link', { rel: 'icon', href: `/assets/favicon.ico` }],
['meta', { prefix: ogprefix, property: 'og:title', content: title }],
['meta', { prefix: ogprefix, property: 'twitter:title', content: title }],
['meta', { prefix: ogprefix, property: 'og:type', content: 'website' }],
['meta', { prefix: ogprefix, property: 'og:url', content: 'https://supergraph.dev }],
['meta', { prefix: ogprefix, property: 'og:description', content: description }],
//['meta', { prefix: ogprefix, property: 'og:image', content: 'https://wireupyourfrontend.com/assets/logo.png' }],
// ['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }],
// ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }],
// ['link', { rel: 'apple-touch-icon', href: `/assets/apple-touch-icon.png` }],
// ['link', { rel: 'mask-icon', href: '/assets/safari-pinned-tab.svg', color: color }],
// ['meta', { name: 'msapplication-TileImage', content: '/assets/mstile-150x150.png' }],
// ['meta', { name: 'msapplication-TileColor', content: color }],
],
},
postcss: {

View File

@ -1149,11 +1149,11 @@ web_ui: true
# debug, info, warn, error, fatal, panic
log_level: "debug"
# Disable this in development to get a list of
# queries used. When enabled super graph
# will only allow queries from this list
# List saved to ./config/allow.list
use_allow_list: false
# When production mode is 'true' only queries
# from the allow list are permitted.
# When it's 'false' all queries are saved to the
# the allow list in ./config/allow.list
production: false
# Throw a 401 on auth failure for queries that need auth
auth_fail_block: false

View File

@ -191,15 +191,15 @@ func (c *compilerContext) processChildren(sel *qcode.Select, ti *DBTableInfo) (u
fallthrough
case RelBelongTo:
if _, ok := colmap[rel.Col2]; !ok {
cols = append(cols, &qcode.Column{ti.Name, rel.Col2, rel.Col2})
cols = append(cols, &qcode.Column{Table: ti.Name, Name: rel.Col2, FieldName: rel.Col2})
}
case RelOneToManyThrough:
if _, ok := colmap[rel.Col1]; !ok {
cols = append(cols, &qcode.Column{ti.Name, rel.Col1, rel.Col1})
cols = append(cols, &qcode.Column{Table: ti.Name, Name: rel.Col1, FieldName: rel.Col1})
}
case RelRemote:
if _, ok := colmap[rel.Col1]; !ok {
cols = append(cols, &qcode.Column{ti.Name, rel.Col1, rel.Col2})
cols = append(cols, &qcode.Column{Table: ti.Name, Name: rel.Col1, FieldName: rel.Col2})
}
skipped |= (1 << uint(id))

2
qcode/cleanup.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
cd corpus && rm -rf $(find . ! -name '00?.gql')

View File

@ -577,7 +577,7 @@ func (com *Compiler) compileArgID(sel *Select, arg *Arg) error {
case nodeVar:
ex.Type = ValVar
default:
fmt.Errorf("expecting a string, int, float or variable")
return fmt.Errorf("expecting a string, int, float or variable")
}
sel.Where = ex

View File

@ -325,7 +325,7 @@ func (c *coreContext) resolveRemote(
ob.WriteString("null")
}
to[0] = jsn.Field{[]byte(s.FieldName), ob.Bytes()}
to[0] = jsn.Field{Key: []byte(s.FieldName), Value: ob.Bytes()}
return to, nil
}
@ -402,7 +402,7 @@ func (c *coreContext) resolveRemotes(
ob.WriteString("null")
}
to[n] = jsn.Field{[]byte(s.FieldName), ob.Bytes()}
to[n] = jsn.Field{Key: []byte(s.FieldName), Value: ob.Bytes()}
}(i, id, s)
}
wg.Wait()

View File

@ -1,4 +1,4 @@
app_name: "{{app_name}} Development"
app_name: "{% app_name %} Development"
host_port: 0.0.0.0:8080
web_ui: true
@ -48,7 +48,7 @@ migrations_path: ./config/migrations
auth:
# Can be 'rails' or 'jwt'
type: rails
cookie: _{{app_name_slug}}_session
cookie: _{% app_name_slug %}_session
# Comment this out if you want to disable setting
# the user_id via a header for testing.
@ -84,7 +84,7 @@ database:
type: postgres
host: db
port: 5432
dbname: {{app_name_slug}}_development
dbname: {% app_name_slug %}_development
user: postgres
password: ''

View File

@ -2,7 +2,7 @@
# so I only need to overwrite some values
inherits: dev
app_name: "{{app_name}} Production"
app_name: "{% app_name %} Production"
host_port: 0.0.0.0:8080
web_ui: false
@ -47,7 +47,7 @@ enable_tracing: true
auth:
# Can be 'rails' or 'jwt'
type: rails
cookie: _{{app_name_slug}}_session
cookie: _{% app_name_slug %}_session
rails:
# Rails version this is used for reading the
@ -78,7 +78,7 @@ database:
type: postgres
host: db
port: 5432
dbname: {{app_name_slug}}_development
dbname: {% app_name_slug %}_development
user: postgres
password: ''
#pool_size: 10