Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Commit

Permalink
Fix templates usage & / notation. Closes #980
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Oct 23, 2017
1 parent 4326656 commit 32694ae
Showing 1 changed file with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,26 @@ export default class AddTemplate extends Command {
${chalk.bold('Github Authentication')}
$ ${chalk.cyan(
'graphcool add-template github-auth',
'graphcool add-template auth/github',
)}
${chalk.bold('Facebook Authentication')}
$ ${chalk.cyan(
'graphcool add-template facebook-auth',
'graphcool add-template auth/facebook',
)}
${chalk.bold('Send mails with Mailgun')}
$ ${chalk.cyan(
'graphcool add-template messaging/mailgun',
)}
${chalk.bold('Send SMS with Twilio')}
$ ${chalk.cyan(
'graphcool add-template messaging/twilio',
)}
${chalk.bold('Algolia Syncing')}
$ ${chalk.cyan('graphcool add-template algolia')}
All templates:
https://github.com/graphcool/templates
`
async run() {
await this.definition.load(this.flags)
Expand Down Expand Up @@ -149,7 +159,9 @@ export default class AddTemplate extends Command {
async extractInfo(moduleUrl: string): Promise<{repoName: string, subPath: string, moduleDirName: string}> {
let splittedModule = moduleUrl.split('/')

if (splittedModule.length === 1) {
const whiteList = ['auth', 'misc', 'messaging']

if (splittedModule.length === 1 || whiteList.includes(splittedModule[0])) {
const res = await fetch('https://raw.githubusercontent.com/graphcool/templates/master/templates.json')
const templates = await res.json()
if (!templates[moduleUrl]) {
Expand Down

0 comments on commit 32694ae

Please sign in to comment.