Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs #94

Merged
merged 4 commits into from
Sep 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@

Welcome to the Netlify CLI!

<!-- AUTO-GENERATED-CONTENT:START (TOC) -->
## Table of Contents

<!-- AUTO-GENERATED-CONTENT:START (TOC:collapse=true&collapseText=Click to expand) -->
<details>
<summary>Click to expand</summary>

- [Usage](#usage)
- [Commands](#commands)
* [deploy](#deploy)
Expand All @@ -18,6 +23,8 @@ Welcome to the Netlify CLI!
* [unlink](#unlink)
* [watch](#watch)
- [Local Development](#local-development)

</details>
<!-- AUTO-GENERATED-CONTENT:END -->

## Usage
Expand All @@ -41,7 +48,7 @@ Configure continuous deployment for a new or existing site

### [link](/docs/commands/link.md)

Link a local folder to a site on Netlify
Link a local repo or project folder to an existing site on Netlify

### [login](/docs/commands/login.md)

Expand Down
15 changes: 12 additions & 3 deletions docs/commands/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,18 @@ netlify deploy

**Flags**

- functions (option) - Specify a functions folder to deploy
- publish (option) - Specify a folder to deploy
- draft (boolean) - Create a draft deploy
- `dir` (*option*) - Specify a folder to deploy
- `functions` (*option*) - Specify a functions folder to deploy
- `prod` (*boolean*) - Deploy to production
- `open` (*boolean*) - Open site after deploy

**Examples**

```bash
netlify deploy
netlify deploy --prod
netlify deploy --prod --open
```


<!-- AUTO-GENERATED-CONTENT:END -->
2 changes: 1 addition & 1 deletion docs/commands/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Configure continuous deployment for a new or existing site

### [link](/commands/link)

Link a local folder to a site on Netlify
Link a local repo or project folder to an existing site on Netlify

### [login](/commands/login)

Expand Down
5 changes: 2 additions & 3 deletions docs/commands/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ netlify init

**Flags**

- manual (boolean) - Manually configure a git remote for CI
- force (boolean) - Force init a site that is already configured to use CI
- watch (boolean) - Make the CLI wait for the first deploy to complete after setting up CI
- `manual` (*boolean*) - Manually configure a git remote for CI
- `watch` (*boolean*) - Make the CLI wait for the first deploy to complete after setting up CI


<!-- AUTO-GENERATED-CONTENT:END -->
15 changes: 6 additions & 9 deletions docs/commands/link.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ description: Link an existing site to a local site directory
# `link`

<!-- AUTO-GENERATED-CONTENT:START (GENERATE_COMMANDS_DOCS) -->
Link a local folder to a site on Netlify

Required for performing operations on sites like deploys. For interactive linking, omit all flags.
Link a local repo or project folder to an existing site on Netlify

**Usage**

Expand All @@ -18,16 +16,15 @@ netlify link

**Flags**

- id (option) - ID of site to link to
- name (option) - Name of site to link to
- force (boolean) - Force link a folder to a site, even if the folder is already linked
- `id` (*option*) - ID of site to link to
- `name` (*option*) - Name of site to link to

**Examples**

```bash
$ netlify init --id 123-123-123-123
$ netlify init --name my-site-name
$ netlify init
netlify link
netlify link --id 123-123-123-123
netlify link --name my-site-name
```


Expand Down
9 changes: 2 additions & 7 deletions docs/commands/sites.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ netlify sites:create

**Flags**

- name (option) - name of site
- password (option) - password protect the site
- force-tls (boolean) - force TLS connections
- session-id (option) - session ID for later site transfers
- account-slug (option) - account slug to create the site under
- custom-domain (option) - custom domain to use with the site
- `name` (*option*) - name of site

---
## `sites:list`
Expand All @@ -62,7 +57,7 @@ netlify sites:list

**Flags**

- json (boolean) - Output site data as JSON
- `json` (*boolean*) - Output site data as JSON

---

Expand Down
2 changes: 1 addition & 1 deletion scripts/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function formatFlags(cmdFlags, command) {
throw new Error(`${command} missing flag description`)
}

return `- ${flag} (${flagData.type}) - ${flagData.description}`
return `- \`${flag}\` (*${flagData.type}*) - ${flagData.description}`
}).join('\n')

renderFlags += `\n\n`
Expand Down
5 changes: 3 additions & 2 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
"Bret Comnes <bcomnes@gmail.com> (https://bret.io)"
],
"scripts": {
"start": "npm run sync && npm run site",
"start": "npm run sync && run-p start:*",
"build": "npm run clean && run-s build:*",
"build:docs": "DOCS_GEN=TRUE node ../scripts/docs.js",
"build:site": "npm run sync && x0 build src",
"site": "x0 src",
"start:site": "x0 src",
"start:watch": "node ./watch.js",
"watch": "node ./watch.js",
"sync": "node ./sync.js",
"clean": "rimraf dist"
Expand Down
17 changes: 14 additions & 3 deletions site/src/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import createScope from '@rebass/markdown'
import * as Rebass from 'rebass'
import sortBy from 'lodash.sortby'
import { ScopeProvider } from '@compositor/x0/components'
import { Link } from 'react-router-dom'
import Layout from './_layout'
import { LiveEditor } from './_ui'

Expand All @@ -13,9 +14,19 @@ const scope = {
code: LiveEditor,
pre: ({ children }) => children,
a: ({ children, href }) => {
console.log('href', href)
// TODO single page routing Link here
return <Rebass.Link color="#00ad9f" href={href}>{children}</Rebass.Link>
// handle external links
if (!href.match(/^\//)) {
return (
<Rebass.Link color="#00ad9f" href={href}>
{children}
</Rebass.Link>
)
}
return (
<Link style={{ color: "#00ad9f", textDecoration: 'none' }} to={href}>
{children}
</Link>
)
}
}

Expand Down
48 changes: 26 additions & 22 deletions site/src/_layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ injectGlobal`
const breakpoint = `@media screen and (min-width: 48em)`
const repoUrl = 'https://github.com/netlify/cli'

export const Root = styled(Flex)([], {
minHeight: '100vh'
})
export const Root = styled.div`
min-height: 100vh;
display: flex;
.ais-InstantSearch__root {
width: 100%;
}
`;

export const Sidebar = styled('div')([], {
width: '256px',
Expand Down Expand Up @@ -222,26 +226,26 @@ const NavBar = ({
</Toolbar>


const EditLink = styled.div`
a {
display: flex;
align-items: center;
}
svg {
width: 18px;
height: 18px;
margin-left: 5px;
margin-bottom: 1px;
fill: #686868;
}
position: absolute;
const EditLink = styled.div`
a {
display: flex;
align-items: center;
}
svg {
width: 18px;
height: 18px;
margin-left: 5px;
margin-bottom: 1px;
fill: #686868;
}
position: absolute;
right: 25px;
top: 25px;
@media (max-width: 768px) {
right: 25px;
top: 25px;
@media (max-width: 768px) {
right: 25px;
top: 70px;
}
`;
top: 70px;
}
`;


const SearchBoxWrapper = styled.div`
Expand Down
28 changes: 26 additions & 2 deletions src/commands/deploy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const Command = require('../base')
const renderShortDesc = require('../utils/renderShortDescription')
const openBrowser = require('../utils/open-browser')
const path = require('path')
const { flags } = require('@oclif/command')
const get = require('lodash.get')
Expand Down Expand Up @@ -60,7 +61,9 @@ class DeployCommand extends Command {
// cliUx.action.start(`Starting a deploy from ${resolvedDeployPath}`)

ensureDirectory(resolvedDeployPath, this.exit)
if (resolvedFunctionsPath) ensureDirectory(resolvedFunctionsPath, this.exit)
if (resolvedFunctionsPath) {
ensureDirectory(resolvedFunctionsPath, this.exit)
}

let results
try {
Expand All @@ -78,15 +81,25 @@ class DeployCommand extends Command {
this.error(e)
}
// cliUx.action.stop(`Finished deploy ${results.deployId}`)

const siteUrl = results.deploy.ssl_url || results.deploy.url
const deployUrl = get(results, 'deploy.deploy_ssl_url') || get(results, 'deploy.deploy_url')

const msgData = {
URL: results.deploy.ssl_url || results.deploy.url,
Logs: `${get(results, 'deploy.admin_url')}/deploys/${get(results, 'deploy.id')}`,
'Deploy URL': get(results, 'deploy.deploy_ssl_url') || get(results, 'deploy.deploy_url')
'Deploy URL': deployUrl
}
if (!deployToProduction) {
delete msgData.URL
}
this.log(prettyjson.render(msgData))

if (flags['open']) {
const urlToOpen = (flags['prod']) ? siteUrl : deployUrl
await openBrowser(urlToOpen)
this.exit()
}
}
}

Expand All @@ -95,6 +108,12 @@ 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.flags = {
dir: flags.string({
char: 'd',
Expand All @@ -108,6 +127,11 @@ DeployCommand.flags = {
char: 'p',
description: 'Deploy to production',
default: false,
}),
open: flags.boolean({
char: 'o',
description: 'Open site after deploy',
default: false,
})
}

Expand Down