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" :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>
</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 = { module.exports = {
title: 'Super Graph', title: title,
description: 'Get an instant GraphQL API for your Rails apps.', description: description,
themeConfig: { themeConfig: {
logo: '/hologram.svg', logo: '/hologram.svg',
@ -15,6 +20,22 @@ module.exports = {
serviceWorker: { serviceWorker: {
updatePopup: true 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: { postcss: {

View File

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

View File

@ -191,15 +191,15 @@ func (c *compilerContext) processChildren(sel *qcode.Select, ti *DBTableInfo) (u
fallthrough fallthrough
case RelBelongTo: case RelBelongTo:
if _, ok := colmap[rel.Col2]; !ok { 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: case RelOneToManyThrough:
if _, ok := colmap[rel.Col1]; !ok { 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: case RelRemote:
if _, ok := colmap[rel.Col1]; !ok { 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)) 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: case nodeVar:
ex.Type = ValVar ex.Type = ValVar
default: default:
fmt.Errorf("expecting a string, int, float or variable") return fmt.Errorf("expecting a string, int, float or variable")
} }
sel.Where = ex sel.Where = ex

View File

@ -325,7 +325,7 @@ func (c *coreContext) resolveRemote(
ob.WriteString("null") 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 return to, nil
} }
@ -402,7 +402,7 @@ func (c *coreContext) resolveRemotes(
ob.WriteString("null") 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) }(i, id, s)
} }
wg.Wait() 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 host_port: 0.0.0.0:8080
web_ui: true web_ui: true
@ -48,7 +48,7 @@ migrations_path: ./config/migrations
auth: auth:
# Can be 'rails' or 'jwt' # Can be 'rails' or 'jwt'
type: rails type: rails
cookie: _{{app_name_slug}}_session cookie: _{% app_name_slug %}_session
# Comment this out if you want to disable setting # Comment this out if you want to disable setting
# the user_id via a header for testing. # the user_id via a header for testing.
@ -84,7 +84,7 @@ database:
type: postgres type: postgres
host: db host: db
port: 5432 port: 5432
dbname: {{app_name_slug}}_development dbname: {% app_name_slug %}_development
user: postgres user: postgres
password: '' password: ''

View File

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