Browse Source

Fixed tests

master
Leo Lamprecht 8 years ago
parent
commit
fd24ea0c6a
No known key found for this signature in database GPG Key ID: B08517883D5E0E10
  1. 11
      bin/now-deploy.js
  2. 6
      lib/github.js

11
bin/now-deploy.js

@ -5,12 +5,11 @@ import {resolve} from 'path'
// Packages // Packages
import Progress from 'progress' import Progress from 'progress'
import {stat} from 'fs-promise' import fs from 'fs-promise'
import bytes from 'bytes' import bytes from 'bytes'
import chalk from 'chalk' import chalk from 'chalk'
import minimist from 'minimist' import minimist from 'minimist'
import ms from 'ms' import ms from 'ms'
import fs from 'fs-promise'
// Ours // Ours
import copy from '../lib/copy' import copy from '../lib/copy'
@ -205,7 +204,7 @@ async function sync(token) {
} }
try { try {
await stat(path) await fs.stat(path)
} catch (err) { } catch (err) {
let repo let repo
@ -270,7 +269,7 @@ async function sync(token) {
isStatic = true isStatic = true
} else { } else {
try { try {
await stat(resolve(path, 'package.json')) await fs.stat(resolve(path, 'package.json'))
} catch (err) { } catch (err) {
hasPackage = true hasPackage = true
} }
@ -278,7 +277,7 @@ async function sync(token) {
[hasPackage, hasDockerfile] = await Promise.all([ [hasPackage, hasDockerfile] = await Promise.all([
await (async () => { await (async () => {
try { try {
await stat(resolve(path, 'package.json')) await fs.stat(resolve(path, 'package.json'))
} catch (err) { } catch (err) {
return false return false
} }
@ -286,7 +285,7 @@ async function sync(token) {
})(), })(),
await (async () => { await (async () => {
try { try {
await stat(resolve(path, 'Dockerfile')) await fs.stat(resolve(path, 'Dockerfile'))
} catch (err) { } catch (err) {
return false return false
} }

6
lib/github.js

@ -16,7 +16,7 @@ const exists = async repoPath => {
try { try {
request = await fetch(apiURL) request = await fetch(apiURL)
} catch(err) { } catch (err) {
error(`Not able to check if repo exists - ${err.message}`) error(`Not able to check if repo exists - ${err.message}`)
return false return false
} }
@ -33,7 +33,7 @@ const exists = async repoPath => {
const downloadRepo = async repoPath => { const downloadRepo = async repoPath => {
const url = `https://api.github.com/repos/${repoPath}/tarball` const url = `https://api.github.com/repos/${repoPath}/tarball`
let tmpDir = await tmp.dir({ const tmpDir = await tmp.dir({
keep: true keep: true
}) })
@ -66,7 +66,7 @@ export const onGitHub = async (path, debug) => {
try { try {
repo = await exists(path) repo = await exists(path)
} catch(err) { } catch (err) {
if (debug) { if (debug) {
console.log(`Repository "${path}" does not exist on GitHub`) console.log(`Repository "${path}" does not exist on GitHub`)
} }

Loading…
Cancel
Save