Skip to content

Commit d751c03

Browse files
authored
shorter getting started (#1245)
1 parent 1df11aa commit d751c03

File tree

6 files changed

+60
-128
lines changed

6 files changed

+60
-128
lines changed

docs/getting-started.md

+28-118
Original file line numberDiff line numberDiff line change
@@ -97,87 +97,19 @@ If you prefer Yarn, run:
9797

9898
You can run the above command anywhere, but you may want to `cd` to your `~/Development` directory first (or wherever you do local development).
9999

100-
The first prompt asks where to create your new project. Enter `hello-framework` to create a directory named `hello-framework` within the current directory. Or just hit Enter, as this is the default. (You can create a project in a different directory by entering a relative path; on macOS or Linux, such paths start with `../` or `~/` or `/` _etc._)
100+
This command will ask you a series of questions in order to initialize your new project. For this tutorial, you can simply hit Enter to accept the default values. When you’re done, you should see something like this:
101101

102102
<pre data-copy="none"><span class="muted">┌</span> <span class="invert"> observable create </span>
103103
<span class="muted">│</span>
104-
<span class="focus">◆</span> Where to create your project?
105-
<span class="focus">│</span> hello-framework<span class="invert">&nbsp;</span>
106-
<span class="focus">└</span></pre>
107-
108-
Next you’ll enter the project’s title. The title will appear in the sidebar as well as on all pages. You can hit Enter here to accept the default title, which is derived from the directory name you entered in the previous step.
109-
110-
<pre data-copy="none"><span class="muted">┌</span> <span class="invert"> observable create </span>
111-
<span class="muted">│</span>
112-
<span class="green">◇</span> Where to create your project?
113-
<span class="muted">│</span> <span class="muted">hello-framework</span>
114-
<span class="muted">│</span>
115-
<span class="focus">◆</span> What to title your project?
116-
<span class="focus">│</span> <span class="muted"><span class="invert">H</span>ello Framework</span>
117-
<span class="focus">└</span></pre>
118-
119-
Next, you’ll be asked whether you want sample files in your new project. These files demonstrate common techniques and are handy for learning — you can edit the code and see what happens. You’ll want them now for this tutorial, but in the future you can omit them if you’d prefer a minimal starter project.
120-
121-
<pre data-copy="none"><span class="muted">┌</span> <span class="invert"> observable create </span>
122-
<span class="muted">│</span>
123-
<span class="green">◇</span> Where to create your project?
124-
<span class="muted">│</span> <span class="muted">hello-framework</span>
125-
<span class="muted">│</span>
126-
<span class="green">◇</span> What to title your project?
127-
<span class="muted">│</span> <span class="muted">Hello Framework</span>
128-
<span class="muted">│</span>
129-
<span class="focus">◆</span> Include sample files to help you get started?
130-
<span class="focus">│</span> <span class="green">●</span> Yes, include sample files <span class="muted">(recommended)</span>
131-
<span class="focus">│</span> <span class="muted">○ No, create an empty project</span>
132-
<span class="focus">└</span></pre>
133-
134-
If you use npm or Yarn as your preferred package manager, declare your allegiance now. The package manager you used to launch `observable create` will be selected by default, so you can just hit Enter again to continue. If you prefer a different package manager (say pnpm), choose `No`; you can install dependencies after the project is created.
135-
136-
<pre data-copy="none"><span class="muted">┌</span> <span class="invert"> observable create </span>
137-
<span class="muted">│</span>
138-
<span class="green">◇</span> Where to create your project?
139-
<span class="muted">│</span> <span class="muted">hello-framework</span>
140-
<span class="muted">│</span>
141-
<span class="green">◇</span> What to title your project?
142-
<span class="muted">│</span> <span class="muted">Hello Framework</span>
143-
<span class="muted">│</span>
144-
<span class="green">◇</span> Include sample files to help you get started?
145-
<span class="muted">│</span> <span class="muted">Yes, include sample files</span>
146-
<span class="muted">│</span>
147-
<span class="focus">◆</span> Install dependencies?
148-
<span class="focus">│</span> <span class="muted">○ Yes, via npm</span>
149-
<span class="focus">│</span> <span class="green">●</span> Yes, via yarn <span class="muted">(recommended)</span>
150-
<span class="focus">│</span> <span class="muted">○ No</span>
151-
<span class="focus">└</span></pre>
152-
153-
If you’ll continue developing your project after you finish this tutorial and want source control, answer `Yes` to initialize a git repository. Or say `No` — you can always do it later by running `git init`.
154-
155-
<pre data-copy="none"><span class="muted">┌</span> <span class="invert"> observable create </span>
156-
<span class="muted">│</span>
157-
<span class="green">◇</span> Where to create your project?
158-
<span class="muted">│</span> <span class="muted">hello-framework</span>
159-
<span class="muted">│</span>
160-
<span class="green">◇</span> What to title your project?
161-
<span class="muted">│</span> <span class="muted">Hello Framework</span>
162-
<span class="muted">│</span>
163-
<span class="green">◇</span> Include sample files to help you get started?
164-
<span class="muted">│</span> <span class="muted">Yes, include sample files</span>
165-
<span class="muted">│</span>
166-
<span class="green">◇</span> Install dependencies?
167-
<span class="muted">│</span> <span class="muted">Yes, via yarn</span>
104+
<span class="green">◆</span> Welcome to Observable Framework! 👋 This command will help you create a new
105+
<span class="muted">│</span> project. When prompted, you can press Enter to accept the default value.
168106
<span class="muted">│</span>
169-
<span class="focus">◆</span> Initialize a git repository?
170-
<span class="focus">│</span> <span class="green">●</span> Yes <span class="muted">/ ○ No</span>
171-
<span class="focus">└</span></pre>
172-
173-
And that’s it! After some downloading, copying, and installing, your new project is ready to go. 🎉
174-
175-
<pre data-copy="none"><span class="muted">┌</span> <span class="invert"> observable create </span>
107+
<span class="muted">│</span> Want help? <u>https://observablehq.com/framework/getting-started</u>
176108
<span class="muted">│</span>
177-
<span class="green">◇</span> Where to create your project?
178-
<span class="muted">│</span> <span class="muted">hello-framework</span>
109+
<span class="green">◇</span> Where should we create your project?
110+
<span class="muted">│</span> <span class="muted">./hello-framework</span>
179111
<span class="muted">│</span>
180-
<span class="green">◇</span> What to title your project?
112+
<span class="green">◇</span> What should we title your project?
181113
<span class="muted">│</span> <span class="muted">Hello Framework</span>
182114
<span class="muted">│</span>
183115
<span class="green">◇</span> Include sample files to help you get started?
@@ -198,7 +130,9 @@ And that’s it! After some downloading, copying, and installing, your new proje
198130
<span class="muted">│</span> <span class="muted">│</span>
199131
<span class="muted">├────────────────────────╯</span>
200132
<span class="muted">│</span>
201-
<span class="muted">└</span> Problems? <u><a href="https://observablehq.com/framework/getting-started" style="color: inherit;">https://observablehq.com/framework/getting-started</a></u></pre>
133+
<span class="muted">└</span> Problems? <u><a href="https://github.com/observablehq/framework/discussions" style="color: inherit;">https://github.com/observablehq/framework/discussions</a></u></pre>
134+
135+
And that’s it! Your new project is ready to go. 🎉
202136

203137
## 2. Develop
204138

@@ -533,74 +467,50 @@ _Ta-da!_ 🎉 Perhaps not the most exciting dashboard yet, but it has potential!
533467

534468
## 3. Publish
535469

536-
When you’re ready to share your project — whether privately with specific people you want to invite, or publicly with the world — you can quickly deploy it to [Observable](https://observablehq.com) using the `deploy` command:
470+
When you’re ready to share your project — either privately or publicly — you can quickly deploy it to [Observable](https://observablehq.com) using the `deploy` command:
537471

538472
<pre data-copy>npm run deploy</pre>
539473

540474
Or with Yarn:
541475

542476
<pre data-copy>yarn deploy</pre>
543477

544-
<div class="note">If you don’t have an Observable account yet, the first time you deploy you’ll be prompted to create one. Observable is free for individuals and small teams, and we offer paid tiers for larger teams.</div>
545-
546-
If this is your first time deploying to Observable, you’ll be prompted to create a new project. This determines where you project lives on Observable.
547-
548-
<div class="tip">Your deploy configuration is saved to <code>docs<span class="wbr">/</span>.observablehq<span class="wbr">/</span>deploy.json</code>. When collaborating on a project, you should commit this file to git so your collaborators don’t have to separately configure deploy.</div>
549-
550-
<pre data-copy="none">
551-
<span class="muted">┌</span> <span class="invert"> observable deploy </span>
552-
<span class="muted">│</span>
553-
<span class="blue">●</span> To configure deploy, we need to ask you a few questions.
554-
<span class="muted">│</span>
555-
<span class="green">◇</span> Deploying to the <b>ACME Inc. (@acme)</b> workspace.
556-
<span class="muted">│</span>
557-
<span class="blue">◆</span> No projects found. Do you want to create a new project?
558-
<span class="blue">│</span> <span class="green">●</span> Yes, continue / <span class="muted">○ No, cancel</span>
559-
<span class="blue">└</span>
560-
</pre>
561-
562-
<div class="note">If you have multiple workspaces on Observable, you’ll be prompted to chose a workspace before creating a project. And if you’ve previously deployed projects to your chosen workspace, you can chose to deploy to an existing project, overwriting its contents.</div>
478+
<div class="note">If you don’t have an Observable account yet, you will be prompted to sign up. Observable is free for individuals and small teams, and we offer paid tiers for larger teams.</div>
563479

564-
When creating a new project, you need to specify a <i>slug</i> which — together with your workspace username — determines the URL of your project. The slug is a short identifier consisting of lowercase letters, numbers, and hyphens. By default, Framework will suggest a slug based on your project’s title. You can change the slug later, and Observable will automatically redirect to the latest URL.
480+
This command will ask you a few questions to configure your deploy, including which Observable workspace to use and whether the project should be public or private. You can also enter an optional message to associate with the deploy, but for now feel free to leave this blank by hitting Enter.
565481

566482
<pre data-copy="none">
567483
<span class="muted">┌</span> <span class="invert"> observable deploy </span>
568484
<span class="muted">│</span>
569485
<span class="blue">●</span> To configure deploy, we need to ask you a few questions.
570486
<span class="muted">│</span>
571487
<span class="green">◇</span> Which Observable workspace do you want to use?
572-
<span class="muted">│ ACME Inc. (@acme)</span>
488+
<span class="muted">│ ACME Inc. (@example)</span>
573489
<span class="muted">│</span>
574490
<span class="green">◇</span> Which project do you want to use?
575491
<span class="muted">│ Create a new project</span>
576492
<span class="muted">│</span>
577-
<span class="blue">◆</span> What slug do you want to use?
578-
<span class="blue">│</span> <span class="muted"><span class="invert">h</span>ello-framework</span>
579-
<span class="blue">└</span>
580-
</pre>
581-
582-
Lastly, you can enter an optional deploy message. Deploy messages are shown on Observable and help you keep track of deploy history. For now, you can just leave this blank by hitting Enter.
583-
584-
<pre data-copy="none">
585-
<span class="muted">┌</span> <span class="invert"> observable deploy </span>
493+
<span class="green">◇</span> What slug do you want to use?
494+
<span class="muted">│ hello-framework</span>
586495
<span class="muted">│</span>
587-
<span class="blue">●</span> To configure deploy, we need to ask you a few questions.
496+
<span class="green">◇</span> Who is allowed to access your project?
497+
<span class="muted">│ Private</span>
588498
<span class="muted">│</span>
589-
<span class="green">◇</span> Which Observable workspace do you want to use?
590-
<span class="muted">│ ACME Inc. (@acme)</span>
499+
<span class="green">◇</span> What changed in this deploy?
500+
<span class="muted">│</span> <span class="muted">Enter a deploy message (optional)</span>
591501
<span class="muted">│</span>
592-
<span class="green">◇</span> Which project do you want to use?
593-
<span class="muted">│ Create a new project</span>
502+
<span class="green">◇</span> 18 uploaded
594503
<span class="muted">│</span>
595-
<span class="green">◇</span> What slug do you want to use?
596-
<span class="muted">│ hello-framework</span>
504+
<span class="green">◇</span> Deploy complete
597505
<span class="muted">│</span>
598-
<span class="blue">◆</span> What changed in this deploy?
599-
<span class="blue">│</span> <span class="muted"><span class="invert">E</span>nter a deploy message (optional)</span>
600-
<span class="blue">└</span>
506+
<span class="muted">└</span> <span class="muted">Deployed project now visible at <u>https://example.observablehq.cloud/hello-framework/</u></span>
601507
</pre>
602508

603-
When deploy completes, Framework will show your project’s URL on observablehq.cloud. From there you can invite people to your private workspace to see your project, or make your project public so anyone can see it.
509+
When deploy completes, Framework will show your project’s URL on observablehq.cloud.
510+
511+
<div class="tip">Your deploy configuration is saved to <code>docs<span class="wbr">/</span>.observablehq<span class="wbr">/</span>deploy.json</code>. When collaborating on a project, you should commit this file to git so your collaborators don’t have to separately configure deploy.</div>
512+
513+
From there you can invite people to your private workspace to see your project, or make your project public so anyone can see it.
604514

605515
### Self hosting
606516

docs/markdown.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ The `note`, `tip`, `warning`, and `caution` classes can be used to insert labele
235235
<div class="caution">This is a caution.</div>
236236
```
237237

238-
Markdown is not supported within HTML, so if you want rich formatting or links within a note, you must write it as HTML. (In the future, we may add support for notes within Markdown.)
238+
Per [CommonMark](https://spec.commonmark.org/0.30/#html-blocks), the contents of an HTML block (such as a `<div class="note">`) are interpreted as HTML. For rich formatting or links within a note, use HTML.
239239

240240
<div class="tip">
241241
<p>This is a <i>styled</i> tip using <small>HTML</small>.</p>
@@ -247,6 +247,22 @@ Markdown is not supported within HTML, so if you want rich formatting or links w
247247
</div>
248248
```
249249

250+
Alternatively, use blank lines to separate the contents of the note from the note container, and then the contents will be interpreted as Markdown.
251+
252+
<div class="tip">
253+
254+
This is a *styled* tip using **Markdown**.
255+
256+
</div>
257+
258+
```md run=false
259+
<div class="tip">
260+
261+
This is a *styled* tip using **Markdown**.
262+
263+
</div>
264+
```
265+
250266
You can override the note’s label using the `label` attribute.
251267

252268
<div class="warning" label="⚠️ Danger ⚠️">No lifeguard on duty. Swim at your own risk!</div>

src/convert.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export async function convert(
4141
effects: ConvertEffects = defaultEffects
4242
): Promise<void> {
4343
const {clack} = effects;
44-
clack.intro(`${inverse(" observable convert ")}`);
44+
clack.intro(`${inverse(" observable convert ")} ${faint(`v${process.env.npm_package_version}`)}`);
4545
let n = 0;
4646
for (const input of inputs) {
4747
let start = Date.now();

src/create.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,26 @@ const defaultEffects: CreateEffects = {
3939
export async function create(effects: CreateEffects = defaultEffects): Promise<void> {
4040
const {clack} = effects;
4141
clack.intro(`${inverse(" observable create ")} ${faint(`v${process.env.npm_package_version}`)}`);
42-
const defaultRootPath = "hello-framework";
42+
const defaultRootPath = `.${op.sep}hello-framework`;
4343
const defaultRootPathError = validateRootPath(defaultRootPath);
44+
clack.log.success(
45+
wrapAnsi(
46+
"Welcome to Observable Framework! 👋 This command will help you create a new project. When prompted, you can press Enter to accept the default value.",
47+
Math.min(80, effects.outputColumns)
48+
) + `\n\nWant help? ${link("https://observablehq.com/framework/getting-started")}`
49+
);
4450
await clack.group(
4551
{
4652
rootPath: () =>
4753
clack.text({
48-
message: "Where to create your project?",
54+
message: "Where should we create your project?",
4955
placeholder: defaultRootPath,
5056
defaultValue: defaultRootPathError ? undefined : defaultRootPath,
5157
validate: (input) => validateRootPath(input, defaultRootPathError)
5258
}),
5359
projectTitle: ({results: {rootPath}}) =>
5460
clack.text({
55-
message: "What to title your project?",
61+
message: "What should we title your project?",
5662
placeholder: inferTitle(rootPath!),
5763
defaultValue: inferTitle(rootPath!)
5864
}),
@@ -131,7 +137,7 @@ export async function create(effects: CreateEffects = defaultEffects): Promise<v
131137
if (spinning) s.stop("Installed! 🎉");
132138
const instructions = [`cd ${rootPath}`, ...(packageManager ? [] : [installCommand]), `${runCommand} dev`];
133139
clack.note(instructions.map((line) => reset(cyan(line))).join("\n"), "Next steps…");
134-
clack.outro(`Problems? ${link("https://observablehq.com/framework/getting-started")}`);
140+
clack.outro(`Problems? ${link("https://github.com/observablehq/framework/discussions")}`);
135141
}
136142
},
137143
{

src/deploy.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {defaultEffects as defaultConfigEffects, getDeployConfig, setDeployConfig
2727
import {slugify} from "./slugify.js";
2828
import {Telemetry} from "./telemetry.js";
2929
import type {TtyEffects} from "./tty.js";
30-
import {bold, defaultEffects as defaultTtyEffects, inverse, link, underline, yellow} from "./tty.js";
30+
import {bold, defaultEffects as defaultTtyEffects, faint, inverse, link, underline, yellow} from "./tty.js";
3131

3232
const DEPLOY_POLL_MAX_MS = 1000 * 60 * 5;
3333
const DEPLOY_POLL_INTERVAL_MS = 1000 * 5;
@@ -79,7 +79,7 @@ export async function deploy(
7979
): Promise<void> {
8080
const {clack} = effects;
8181
Telemetry.record({event: "deploy", step: "start", force});
82-
clack.intro(inverse(" observable deploy "));
82+
clack.intro(`${inverse(" observable deploy ")} ${faint(`v${process.env.npm_package_version}`)}`);
8383

8484
let apiKey = await effects.getObservableApiKey(effects);
8585
const apiClient = new ObservableApiClient(apiKey ? {apiKey, clack} : {clack});

src/observableApiAuth.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from "./observableApiConfig.js";
1414
import {Telemetry} from "./telemetry.js";
1515
import type {TtyEffects} from "./tty.js";
16-
import {bold, defaultEffects as defaultTtyEffects, inverse, link, yellow} from "./tty.js";
16+
import {bold, defaultEffects as defaultTtyEffects, faint, inverse, link, yellow} from "./tty.js";
1717

1818
const OBSERVABLE_UI_ORIGIN = getObservableUiOrigin();
1919

@@ -39,7 +39,7 @@ export const defaultEffects: AuthEffects = {
3939
export async function login(effects: AuthEffects = defaultEffects, overrides = {}) {
4040
const {clack} = effects;
4141
Telemetry.record({event: "login", step: "start"});
42-
clack.intro(inverse(" observable login "));
42+
clack.intro(`${inverse(" observable login ")} ${faint(`v${process.env.npm_package_version}`)}`);
4343

4444
const {currentUser} = await loginInner(effects, overrides);
4545

0 commit comments

Comments
 (0)