Skip to content

Commit 1b272dd

Browse files
committed
restructure sidebar; docs edits
1 parent f3783e4 commit 1b272dd

File tree

4 files changed

+57
-63
lines changed

4 files changed

+57
-63
lines changed

docs/deploying.md

Lines changed: 24 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ If you don’t yet have an app ready to deploy, create one by following our [Get
1010

1111
## Manual deploys
1212

13-
First, make sure that your app builds without error:
13+
To deploy your app, run the deploy command:
1414

1515
```sh
16-
npm run build
16+
npm run deploy
1717
```
1818

19-
Once that is done you can deploy to Observable:
19+
<div class="tip">
2020

21-
```sh
22-
npm run deploy
23-
```
21+
Deploying automatically creates a [deploy configuration file](#deploy-configuration) (`.observablehq/deploy.json`) if it does not already exist. You should commit this file to git; it is required for automated deploys, and lets you re-deploy manually with fewer prompts.
22+
23+
</div>
2424

2525
The first time you deploy an app, you will be prompted to configure the app’s _slug_ (which determines its URL), access level, and other details. If you aren’t yet signed-in to Observable, you will also be prompted to sign-in.
2626

@@ -36,43 +36,15 @@ npm run deploy -- --help
3636

3737
</div>
3838

39-
## Deploy configuration
40-
41-
The deploy command creates a file at <code>.observablehq/deploy.json</code> under the source root (typically <code>src</code>) with information on where to deploy the app. This file allows you to re-deploy an app without having to repeat where you want the app to live on Observable.
42-
43-
The contents of the deploy config file look like this:
44-
45-
```json run=false
46-
{
47-
"projectId": "0123456789abcdef",
48-
"projectSlug": "hello-framework",
49-
"workspaceLogin": "acme"
50-
}
51-
```
52-
53-
<div class="note">
54-
55-
A deploy config file is required for automated deploys. You should commit this file to git.
56-
57-
</div>
58-
59-
To store the deploy config file somewhere else, use the `--deploy-config` argument. For example, to create a “staging” deploy to share early versions of your app, you could use a `deploy-staging.json` like so:
60-
61-
```sh
62-
npm run deploy -- --deploy-config=src/.observablehq/deploy-staging.json
63-
```
64-
65-
If the specified config file does not yet exist, you will again be prompted to choose or create a new app; the resulting configuration will then be saved to the specified file. You can re-deploy to staging by passing the same `--deploy-config` argument; or you can deploy to “production” by not specifying the `--deploy-config` argument to use the default deploy config.
66-
6739
## Automated deploys
6840

69-
Once the app has been set up, you can have Observable build the next deploys for you. You can build automatically _on commit_ (whenever you push a new commit to your project’s default branch) and _on schedule_ (such as daily or weekly).
41+
After deploying an app manually at least once, Observable can handle subsequent deploys for you automatically. You can automate deploys both [on commit](https://observablehq.com/documentation/data-apps/github) (whenever you push a new commit to your project’s default branch) and [on schedule](https://observablehq.com/documentation/data-apps/schedules) (such as daily or weekly).
7042

71-
Automatic deploys — also known as _continuous deployment_ or _CD_ — ensure that your data is up to date, and that any changes you make to your app are immediately reflected in the deployed version.
43+
Automatic deploys — also called _continuous deployment_ or _CD_ — ensure that your data is always up to date, and that any changes you make to your app are immediately reflected in the deployed version.
7244

7345
On your app settings page on Observable, open the **Build settings** tab to set up a link to a GitHub repository hosting your project’s files. Observable will then listen for changes in the repo and deploy the app automatically.
7446

75-
The settings page also allows you to trigger a build manually, add secrets (for data loaders to use private APIs and passwords), view logs, configure sharing, _etc._ For details, see the [Building & deploying](https://observablehq.com/documentation/data-apps/deploys) documentation.
47+
The settings page also allows you to trigger a manual deploy on Observable Cloud, add secrets (for data loaders to use private APIs and passwords), view logs, configure sharing, _etc._ For details, see the [Building & deploying](https://observablehq.com/documentation/data-apps/deploys) documentation.
7648

7749
## GitHub Actions
7850

@@ -165,18 +137,24 @@ This uses one cache per calendar day (in the `America/Los_Angeles` time zone). I
165137

166138
<div class="note">You’ll need to edit the paths above if you’ve configured a source root other than <code>src</code>.</div>
167139

168-
## Other hosting services
140+
## Deploy configuration
169141

170-
Observable Framework builds a set of static files that can be hosted by any static site hosting services. To build your app, run:
142+
The deploy command creates a file at <code>.observablehq/deploy.json</code> under the source root (typically <code>src</code>) with information on where to deploy the app. This file allows you to re-deploy an app without having to repeat where you want the app to live on Observable.
171143

172-
```sh
173-
npm run build
144+
The contents of the deploy config file look like this:
145+
146+
```json run=false
147+
{
148+
"projectId": "0123456789abcdef",
149+
"projectSlug": "hello-framework",
150+
"workspaceLogin": "acme"
151+
}
174152
```
175153

176-
Then upload the contents of your `dist` directory to your static service of choice.
154+
To store the deploy config file somewhere else, use the `--deploy-config` argument. For example, to create a “staging” deploy to share early versions of your app, you could use a `deploy-staging.json` like so:
177155

178-
<div class="tip">By default, Framework generates “clean” URLs by dropping the `.html` extension from page links. Not all webhosts support this; some need the <a href="./config#cleanUrls"><b>cleanUrls</b> config option</a> set to false.</div>
156+
```sh
157+
npm run deploy -- --deploy-config=src/.observablehq/deploy-staging.json
158+
```
179159

180-
<div class="tip">When deploying to GitHub Pages without using GitHub’s related actions (<a href="https://github.com/actions/configure-pages">configure-pages</a>,
181-
<a href="https://github.com/actions/deploy-pages">deploy-pages</a>, and
182-
<a href="https://github.com/actions/upload-pages-artifact">upload-pages-artifact</a>), you may need to create a <code>.nojekyll</code> file in your <code>dist</code> folder after building. See GitHub’s documentation on <a href="https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages#static-site-generators">static site generators</a> for more.</div>
160+
If the specified config file does not yet exist, you will again be prompted to choose or create a new app; the resulting configuration will then be saved to the specified file. You can re-deploy to staging by passing the same `--deploy-config` argument; or you can deploy to “production” by not specifying the `--deploy-config` argument to use the default deploy config.

docs/getting-started.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,12 @@ The <code>build</code> command generates the `dist` directory; you can then copy
535535

536536
<pre data-copy>npx http-server dist</pre>
537537

538+
<div class="tip">By default, Framework generates “clean” URLs by dropping the `.html` extension from page links. Not all webhosts support this; some need the <a href="./config#cleanUrls"><b>cleanUrls</b> config option</a> set to false.</div>
539+
540+
<div class="tip">When deploying to GitHub Pages without using GitHub’s related actions (<a href="https://github.com/actions/configure-pages">configure-pages</a>,
541+
<a href="https://github.com/actions/deploy-pages">deploy-pages</a>, and
542+
<a href="https://github.com/actions/upload-pages-artifact">upload-pages-artifact</a>), you may need to create a <code>.nojekyll</code> file in your <code>dist</code> folder after building. See GitHub’s documentation on <a href="https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages#static-site-generators">static site generators</a> for more.</div>
543+
538544
## Next steps
539545

540546
Here are a few more tips.

docs/imports.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,20 @@ Imports from `node_modules` are cached in `.observablehq/cache/_node` within you
100100

101101
## JSR imports <a href="https://github.com/observablehq/framework/pulls/957" class="observablehq-version-badge" data-version="prerelease" title="Added in #957"></a>
102102

103-
You can import a package from [JSR (the JavaScript Registry)](https://jsr.io/) using the `jsr:` protocol. When you import using `jsr:`, Framework automatically downloads and self-hosts the package. (As with `npm:` imports, and unlike Node imports, you don’t have to install from `jsr:` manually.) As an example, here the number three is computed using a [pseudorandom number generator](https://jsr.io/@std/random) from the [Deno Standard Library](https://deno.com/blog/std-on-jsr):
103+
You can import a package from [JSR (the JavaScript Registry)](https://jsr.io/) using the `jsr:` protocol. As an example, to import a [pseudorandom number generator](https://jsr.io/@std/random) from the [Deno Standard Library](https://deno.com/blog/std-on-jsr):
104104

105105
```js echo
106106
import {randomIntegerBetween, randomSeeded} from "jsr:@std/random";
107+
```
107108

108-
const prng = randomSeeded(1n);
109+
And then to generate a random number:
109110

110-
display(randomIntegerBetween(1, 10, {prng}));
111+
```js echo
112+
randomIntegerBetween(1, 10, {prng: randomSeeded(1n)})
111113
```
112114

115+
JSR imports, like npm imports, are automatically [self-hosted](#self-hosting-of-npm-imports). Downloads from JSR are cached in `.observablehq/cache/_jsr` within your source root (typically `src`). An imported module is downloaded from JSR only if it is not already in the cache. You can clear the cache and restart the server to re-fetch the latest versions of libraries from JSR. If specify the desired version of a package, add a [semver range](https://docs.npmjs.com/about-semantic-versioning) to the import specifier.
116+
113117
## Local imports
114118

115119
You can import [JavaScript](./javascript) and [TypeScript](./javascript#type-script) modules from local files. This is useful for organizing your code into modules that can be imported across multiple pages. You can also unit test your code and share code with other web applications.

observablehq.config.ts

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,26 @@ export default {
2020
{name: "What is Framework?", path: "/what-is-framework"},
2121
{name: "Getting started", path: "/getting-started"},
2222
{name: "Deploying", path: "/deploying"},
23-
{name: "Project structure", path: "/project-structure"},
24-
{name: "Markdown", path: "/markdown"},
25-
{name: "JavaScript", path: "/javascript"},
26-
{name: "Reactivity", path: "/reactivity"},
27-
{name: "JSX", path: "/jsx"},
28-
{name: "Imports", path: "/imports"},
29-
{name: "Data loaders", path: "/data-loaders"},
30-
{name: "Files", path: "/files"},
31-
{name: "SQL", path: "/sql"},
32-
{name: "Themes", path: "/themes"},
33-
{name: "Page loaders", path: "/page-loaders"},
34-
{name: "Parameterized routes", path: "/params"},
3523
{name: "Embedding", path: "/embeds"},
36-
{name: "Configuration", path: "/config"},
37-
{name: "Examples", path: "https://github.com/observablehq/framework/tree/main/examples"},
24+
{
25+
name: "Reference",
26+
open: false,
27+
pages: [
28+
{name: "Project structure", path: "/project-structure"},
29+
{name: "Markdown", path: "/markdown"},
30+
{name: "JavaScript", path: "/javascript"},
31+
{name: "Reactivity", path: "/reactivity"},
32+
{name: "JSX", path: "/jsx"},
33+
{name: "Imports", path: "/imports"},
34+
{name: "Data loaders", path: "/data-loaders"},
35+
{name: "Files", path: "/files"},
36+
{name: "SQL", path: "/sql"},
37+
{name: "Themes", path: "/themes"},
38+
{name: "Page loaders", path: "/page-loaders"},
39+
{name: "Parameterized routes", path: "/params"},
40+
{name: "Configuration", path: "/config"}
41+
]
42+
},
3843
{
3944
name: "Inputs",
4045
open: false,
@@ -86,6 +91,7 @@ export default {
8691
{name: "ZIP", path: "/lib/zip"}
8792
]
8893
},
94+
{name: "Examples", path: "https://github.com/observablehq/framework/tree/main/examples"},
8995
{name: "Converting notebooks", path: "/convert"},
9096
{name: "Contributing", path: "/contributing", pager: false}
9197
],

0 commit comments

Comments
 (0)