You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/deploying.md
+24-46Lines changed: 24 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,17 +10,17 @@ If you don’t yet have an app ready to deploy, create one by following our [Get
10
10
11
11
## Manual deploys
12
12
13
-
First, make sure that your app builds without error:
13
+
To deploy your app, run the deploy command:
14
14
15
15
```sh
16
-
npm run build
16
+
npm run deploy
17
17
```
18
18
19
-
Once that is done you can deploy to Observable:
19
+
<divclass="tip">
20
20
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>
24
24
25
25
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.
26
26
@@ -36,43 +36,15 @@ npm run deploy -- --help
36
36
37
37
</div>
38
38
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
-
<divclass="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
-
67
39
## Automated deploys
68
40
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).
70
42
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.
72
44
73
45
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.
74
46
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.
76
48
77
49
## GitHub Actions
78
50
@@ -165,18 +137,24 @@ This uses one cache per calendar day (in the `America/Los_Angeles` time zone). I
165
137
166
138
<div class="note">You’ll need to edit the paths above if you’ve configured a source root other than <code>src</code>.</div>
167
139
168
-
## Other hosting services
140
+
## Deploy configuration
169
141
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.
171
143
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
+
}
174
152
```
175
153
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:
177
155
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
+
```
179
159
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.
Copy file name to clipboardExpand all lines: docs/getting-started.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -535,6 +535,12 @@ The <code>build</code> command generates the `dist` directory; you can then copy
535
535
536
536
<predata-copy>npx http-server dist</pre>
537
537
538
+
<divclass="tip">By default, Framework generates “clean” URLs by dropping the `.html` extension from page links. Not all webhosts support this; some need the <ahref="./config#cleanUrls"><b>cleanUrls</b> config option</a> set to false.</div>
539
+
540
+
<divclass="tip">When deploying to GitHub Pages without using GitHub’s related actions (<ahref="https://github.com/actions/configure-pages">configure-pages</a>,
541
+
<ahref="https://github.com/actions/deploy-pages">deploy-pages</a>, and
542
+
<ahref="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 <ahref="https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages#static-site-generators">static site generators</a> for more.</div>
Copy file name to clipboardExpand all lines: docs/imports.md
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,16 +100,20 @@ Imports from `node_modules` are cached in `.observablehq/cache/_node` within you
100
100
101
101
## JSR imports <ahref="https://github.com/observablehq/framework/pulls/957"class="observablehq-version-badge"data-version="prerelease"title="Added in #957"></a>
102
102
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):
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
+
113
117
## Local imports
114
118
115
119
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.
0 commit comments