Skip to content

Commit

Permalink
chore: implement feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
charliegerard committed Feb 7, 2022
1 parent e80ef0f commit c8607a8
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/commands/sites/sites-create-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ const { createRepo, getTemplatesFromGitHub } = require('../../utils/sites/utils'

const { getSiteNameInput } = require('./sites-create')

let ghToken

const fetchTemplates = async (token) => {
const templatesFromGithubOrg = await getTemplatesFromGitHub(token)

Expand All @@ -36,17 +34,13 @@ const sitesCreateTemplate = async (options, command) => {
await command.authenticate()

const { globalConfig } = command.netlify
ghToken = await getGitHubToken({ globalConfig })
const ghToken = await getGitHubToken({ globalConfig })

let { url: templateUrl } = options

if (templateUrl) {
try {
const urlFromOptions = new URL(templateUrl)
templateUrl = { templateName: urlFromOptions.pathname.slice(1) }
} catch (error_) {
throw new Error(error_)
}
const urlFromOptions = new URL(templateUrl)
templateUrl = { templateName: urlFromOptions.pathname.slice(1) }
} else {
const templates = await fetchTemplates(ghToken)

Expand Down

0 comments on commit c8607a8

Please sign in to comment.