Skip to content

Commit b5e02cf

Browse files
luclerayMatthew Sweeneystyfle
authored
Add docs for Now CLI project linking and framework detection (#1592)
* add `--confirm` * add `clipboard` option to snippet component * add Project Linking and Framework Detection * Apply suggestions from code review Co-Authored-By: Matthew Sweeney <[email protected]> * fix mdx * add "What can I deploy" to platform FAQ * Apply suggestions from code review Co-Authored-By: Matthew Sweeney <[email protected]> * add note to update Now CLI * fix note * improve terminal snippets * remove NOW_ORG_ID and NOW_PROJECT_ID * remove extra sentence * Apply suggestions from code review Co-Authored-By: Steven <[email protected]> Co-authored-by: Matthew Sweeney <[email protected]> Co-authored-by: Steven <[email protected]>
1 parent d4138df commit b5e02cf

File tree

3 files changed

+82
-10
lines changed

3 files changed

+82
-10
lines changed

components/references-mdx/now-cli/commands/now.mdx

+60
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import Snippet from '~/components/snippet'
22
import Caption from '~/components/text/caption'
33
import { InlineCode } from '~/components/text/code'
4+
import Note from '~/components/text/note'
5+
import Link from '~/components/text/link'
46

57
export const meta = {
68
editUrl: 'pages/docs/now-cli/now-cli-mdx/commands/now.mdx',
@@ -21,6 +23,54 @@ The `now` command is used to deploy projects and can be used from either the roo
2123
<Snippet dark text="now [path-to-project]" />
2224
<Caption>Using the <InlineCode>now</InlineCode> command and supplying a path to the root directory of the project.</Caption>
2325

26+
### Project Linking
27+
28+
When running `now` in a directory for the first time, [Now CLI](/download) needs to know which [scope](/docs/now-cli#options/global-options/scope) and [Project](/docs/v2/platform/projects) you
29+
want to deploy your directory to. You can choose to either link an existing project or to create a new one.
30+
31+
<Note>
32+
Project linking requires at least version 17 of{' '}
33+
<Link href="/download">Now CLI</Link>. If you have an earlier version, please{' '}
34+
<Link href="/guides/updating-now-cli">update</Link> to the latest version.
35+
</Note>
36+
37+
<br />
38+
39+
<Snippet clipboard={false} dark text={`now
40+
? Set up and deploy “~/web/my-lovely-project”? [Y/n] y
41+
? Which scope do you want to deploy to? My Awesome Team
42+
? Link to existing project? [y/N] y
43+
? What’s the name of your existing project? my-lovely-project
44+
🔗 Linked to awesome-team/my-lovely-project (created .now and added it to .gitignore)`} />
45+
<Caption>Linking an existing project when running <InlineCode>now</InlineCode> in a new directory.</Caption>
46+
47+
Once set up, a new `.now` directory will be added to your directory. The `.now` directory contains
48+
both the organization and project `id` of your project. If you want unlink your directory, you can remove the `.now` directory.
49+
50+
You can use the[`--confirm` option](#commands/now/unique-options/confirm) to skip these questions.
51+
52+
### Framework Detection
53+
54+
When you create a new project, Now CLI will automatically detect the framework you are using and offer
55+
default project settings accordingly.
56+
57+
<Snippet clipboard={false} dark text={`now
58+
? Set up and deploy “~/web/my-new-project”? [Y/n] y
59+
? Which scope do you want to deploy to? My Awesome Team
60+
? Link to existing project? [y/N] n
61+
? What’s your project’s name? my-new-project
62+
? In which directory is your code located? my-new-project/
63+
Auto-detected project settings (Next.js):
64+
- Build Command: \`next build\` or \`build\` from \`package.json\`
65+
- Output Directory: Next.js default
66+
- Development Command: next dev --port $PORT
67+
? Want to override the settings? [y/N]`} />
68+
<Caption>Creating a new project with the <InlineCode>now</InlineCode> command.</Caption>
69+
70+
When creating a new project, you will be provided with default **Build Command**, **Output Directory**, and **Development Command** options.
71+
72+
You can continue with the default project settings or overwrite them. You can also edit your project settings later in your project dashboard.
73+
2474
### Global Options
2575

2676
The following [global options](#options) can be passed when using the `now` command:
@@ -44,6 +94,16 @@ The `--build-env` option, shorthand `-b`, can be used to provide environment var
4494
<Snippet dark text="now --build-env [key1=value1 key2=value2 key3=value3]" />
4595
<Caption>Using the <InlineCode>now</InlineCode> command with the <InlineCode>--build-env</InlineCode> option.</Caption>
4696

97+
#### Confirm
98+
99+
The `--confirm` option can be used to skip questions you are asked when setting up a new project.
100+
The questions will be answered with the provided defaults, inferred from `now.json` and the folder name.
101+
102+
##### Usage Example
103+
104+
<Snippet dark text="now --confirm" />
105+
<Caption>Using the <InlineCode>now</InlineCode> command with the <InlineCode>--confirm</InlineCode> option.</Caption>
106+
47107
#### Env
48108

49109
The `--env` option, shorthand `-e`, can be used to provide environment variables at [run time](/docs/v2/serverless-functions/env-and-secrets).

components/snippet/snippet.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Copy from '~/components/icons/copy'
88
import { useToasts } from '~/components/toasts'
99

1010
const Snippet = memo(
11-
({ text, onCopy, width = '100%', prompt = true, dark }) => {
11+
({ text, onCopy, width = '100%', prompt = true, dark, clipboard = true }) => {
1212
const toasts = useToasts()
1313

1414
const copyToClipboard = useCallback(() => {
@@ -30,14 +30,16 @@ const Snippet = memo(
3030
<div className={cn('snippet-wrapper', { prompt })}>
3131
<pre className="geist-overflow-scroll-y">{text}</pre>
3232

33-
<div className="copy" onClick={copyToClipboard}>
34-
<Copy
35-
stroke="currentColor"
36-
fill={dark ? '#000' : 'var(--geist-background)'}
37-
width="18px"
38-
height="18px"
39-
/>
40-
</div>
33+
{clipboard && (
34+
<div className="copy" onClick={copyToClipboard}>
35+
<Copy
36+
stroke="currentColor"
37+
fill={dark ? '#000' : 'var(--geist-background)'}
38+
width="18px"
39+
height="18px"
40+
/>
41+
</div>
42+
)}
4143

4244
<style jsx>
4345
{`

pages/docs/v2/platform/frequently-asked-questions.mdx

+11-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const meta = {
88
title: 'Frequently Asked Questions',
99
description: 'A list of frequently asked questions relating to deployments.',
1010
editUrl: 'pages/docs/v2/platform/frequently-asked-questions.mdx',
11-
lastEdited: '2019-11-05T13:14:41.000Z'
11+
lastEdited: '2020-01-28T19:55:40.000Z'
1212
}
1313

1414
## Missing Public Directory
@@ -114,6 +114,16 @@ For more information on our cloud partners' Green energy policies, we recommend
114114
- [Google Cloud Sustainability](https://cloud.google.com/sustainability/)
115115
- [Microsoft Environmental Sustainability](https://www.microsoft.com/en-us/corporate-responsibility/sustainability)
116116

117+
## What can I deploy with ZEIT Now?
118+
119+
ZEIT Now is best at deploying technologies that can be served over HTTP and distributed through our CDN network:
120+
121+
- Static websites and static generators (React, Vue, Angular, etc)
122+
- Code that renders HTML on the server-side
123+
- API endpoints that query databases or web APIs and return dynamic data
124+
125+
In general, most popular technologies and languages already have [quickstarts](/docs/v2/introduction#quickstarts) or [guides](/guides) you can start taking advantage of today.
126+
117127
export default ({ children }) => <Doc meta={meta}>{children}</Doc>
118128

119129
export const config = {

0 commit comments

Comments
 (0)