Skip to content

Commit

Permalink
A few more api swap fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Sep 14, 2018
1 parent cc2ac49 commit b0eb925
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 37 deletions.
21 changes: 1 addition & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,58 +46,39 @@
},
"dependencies": {
"@iarna/toml": "^2.0.0",
"@netlify/open-api": "^0.2.0",
"@oclif/command": "^1",
"@oclif/config": "^1",
"@oclif/errors": "^1.1.2",
"@oclif/plugin-help": "^2",
"@oclif/plugin-not-found": "^1.1.4",
"@octokit/rest": "^15.10.0",
"archiver": "^3.0.0",
"ascii-table": "0.0.9",
"chalk": "^2.4.1",
"ci-info": "^1.4.0",
"clean-deep": "^3.0.2",
"cli-spinners": "^1.3.1",
"cli-ux": "^4.7.3",
"configstore": "^4.0.0",
"debug": "^3.1.0",
"dot-prop": "^4.2.0",
"find-up": "^3.0.0",
"flush-write-stream": "^1.0.3",
"folder-walker": "^3.1.0",
"from2-array": "0.0.4",
"git-remote-origin-url": "^2.0.0",
"git-repo-info": "^2.0.0",
"hasha": "^3.0.0",
"inquirer": "^6.0.0",
"is-docker": "^1.1.0",
"lodash.camelcase": "^4.3.0",
"lodash.flatten": "^4.4.0",
"lodash.get": "^4.4.2",
"lodash.isempty": "^4.4.0",
"lodash.mergewith": "^4.6.1",
"lodash.set": "^4.3.2",
"lodash.snakecase": "^4.1.1",
"log-symbols": "^2.2.0",
"make-dir": "^1.3.0",
"netlify": "^2.0.0-beta.2",
"netlify": "^2.0.0-beta.4",
"node-fetch": "^2.2.0",
"ora": "^3.0.0",
"p-map": "^1.2.0",
"p-wait-for": "^2.0.0",
"parallel-transform": "^1.1.0",
"parse-github-url": "^1.0.2",
"prettyjson": "^1.2.1",
"pump": "^3.0.0",
"qs": "^6.5.2",
"random-item": "^1.0.0",
"tempy": "^0.2.1",
"through2-filter": "^3.0.0",
"through2-map": "^3.0.0",
"update-notifier": "^2.5.0",
"util.promisify": "^1.0.0",
"util.promisify-all": "^1.0.2",
"uuid": "^3.3.2",
"write-file-atomic": "^2.3.0"
},
Expand Down
23 changes: 9 additions & 14 deletions src/commands/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,14 @@ class DeployCommand extends Command {

// TODO: abstract settings lookup
const deployFolder =
flags['dir'] ||
get(site.config, 'build.publish') ||
get(await api.getSite({ siteId }), 'build_settings.dir')
flags['dir'] || get(site.config, 'build.publish') || get(await api.getSite({ siteId }), 'build_settings.dir')

const functionsFolder =
flags.functions ||
get(site.config, 'build.functions') ||
get(await api.getSite({ siteId }), 'build_settings.functions_dir')

if (!deployFolder) {

this.log(`Can't determine a deploy folder.`)
this.log()
this.log('Please define one in your site settings, netlify.toml or pass one as a flag')
Expand All @@ -61,7 +58,7 @@ ${chalk.cyanBright.bold('netlify deploy --dir your-build-directory')}
# deploy to live URL with the --prod flag
${chalk.cyanBright.bold('netlify deploy --dir your-build-directory --prod')}
`)
this.exit()
this.exit()
}

// TODO go through the above resolution, and make sure the resolve algorithm makes sense
Expand All @@ -85,7 +82,9 @@ ${chalk.cyanBright.bold('netlify deploy --dir your-build-directory --prod')}
this.log('Deploying to draft url...')
}

results = await api.deploy(siteId, resolvedDeployPath, resolvedFunctionsPath, site.configPath, {
results = await api.deploy(siteId, resolvedDeployPath, {
tomlPath: site.configPath,
fnDir: resolvedFunctionsPath,
statusCb: deployProgressCb(this),
draft: !deployToProduction
})
Expand Down Expand Up @@ -119,7 +118,7 @@ ${chalk.cyanBright.bold('netlify deploy --dir your-build-directory --prod')}
}

if (flags['open']) {
const urlToOpen = (flags['prod']) ? siteUrl : deployUrl
const urlToOpen = flags['prod'] ? siteUrl : deployUrl
await openBrowser(urlToOpen)
this.exit()
}
Expand All @@ -131,11 +130,7 @@ DeployCommand.description = `${renderShortDesc(`Create a new deploy from the con
Deploys from the build settings found in the netlify.toml file, or settings from the api.
`

DeployCommand.examples = [
'netlify deploy',
'netlify deploy --prod',
'netlify deploy --prod --open'
]
DeployCommand.examples = ['netlify deploy', 'netlify deploy --prod', 'netlify deploy --prod --open']

DeployCommand.flags = {
dir: flags.string({
Expand All @@ -149,12 +144,12 @@ DeployCommand.flags = {
prod: flags.boolean({
char: 'p',
description: 'Deploy to production',
default: false,
default: false
}),
open: flags.boolean({
char: 'o',
description: 'Open site after deploy',
default: false,
default: false
})
}

Expand Down
10 changes: 7 additions & 3 deletions src/commands/sites/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ class SitesListCommand extends Command {
const { api } = this.netlify
await this.authenticate()

const sites = await api.listSites()
const sites = await api.listSites({ filter: 'all' })

if (sites && sites.length) {
const logSites = sites.map(site => {
const siteInfo = {
id: site.id,
name: site.name,
ssl_url: site.ssl_url
ssl_url: site.ssl_url,
account_name: site.account_name
}

if (site.build_settings && site.build_settings.repo_url) {
Expand All @@ -36,7 +37,7 @@ class SitesListCommand extends Command {
return false
}

this.log(`
this.log(`
────────────────────────────┐
Current Netlify Sites │
────────────────────────────┘
Expand All @@ -48,6 +49,9 @@ this.log(`
if (s.repo_url) {
console.log(` ${chalk.whiteBright.bold('repo:')} ${chalk.white(s.repo_url)}`)
}
if (s.account_name) {
console.log(` ${chalk.whiteBright.bold('account:')} ${chalk.white(s.account_name)}`)
}
console.log(`─────────────────────────────────────────────────`)
})
}
Expand Down

0 comments on commit b0eb925

Please sign in to comment.