Skip to content

Commit 38e58bd

Browse files
committed
Merge branch 'main' into fil/save-search-query
2 parents eb680d9 + 97aa3ce commit 38e58bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+948
-957
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
test/build
12
test/input
23
test/output

.github/workflows/deploy.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
- if: steps.cache-data.outputs.cache-hit == 'true'
3636
run: find docs/.observablehq/cache examples/*/docs/.observablehq/cache -type f -exec touch {} +
3737
- run: yarn build
38+
- run: yarn docs:build
3839
- name: Build example "api"
3940
run: yarn --frozen-lockfile && yarn build
4041
working-directory: examples/api
@@ -70,17 +71,11 @@ jobs:
7071
working-directory: examples/plot
7172
env:
7273
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73-
- run: mkdir dist/examples && for i in examples/*; do if [ -d $i/dist ]; then mv -v $i/dist dist/examples/$(basename $i); fi; done
74+
- run: mkdir docs/.observablehq/dist/examples && for i in examples/*; do if [ -d $i/dist ]; then mv -v $i/dist docs/.observablehq/dist/examples/$(basename $i); fi; done
7475
- uses: cloudflare/pages-action@1
7576
with:
7677
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
7778
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
7879
projectName: framework
79-
directory: dist
80+
directory: docs/.observablehq/dist
8081
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
81-
# TODO: This doesn't include the examples. How can we fix that?
82-
# TODO: Re-enable deploy to Observable
83-
# - name: Deploy to Observable
84-
# run: yarn deploy -m "$(git log -1 --pretty=%s)"
85-
# env:
86-
# OBSERVABLE_TOKEN: ${{ secrets.OBSERVABLE_API_TOKEN }}

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Publish
22

33
on:
4+
workflow_dispatch: {}
45
release:
56
types: [published]
67

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
node-version: ${{ matrix.version }}
2222
cache: yarn
2323
- run: yarn --frozen-lockfile
24-
- run: yarn c8 --check-coverage -x src/**/*.d.ts -x src/preview.ts -x src/observableApiConfig.ts -x src/client -x src/convert.ts --lines 80 --per-file yarn test:mocha
24+
- run: yarn test:coverage
2525
- run: yarn test:tsc
2626
- run: |
2727
echo ::add-matcher::.github/eslint.json

.gitignore

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
.env
2-
.DS_Store
31
**/.observablehq/cache/
4-
coverage/
5-
docs/themes.md
6-
docs/theme/*.md
7-
dist/
2+
.DS_Store
3+
.env
4+
/coverage/
5+
/dist/
6+
/docs/.observablehq/dist/
7+
/docs/theme/*.md
8+
/docs/themes.md
9+
/test/build/
10+
/test/output/**/*-changed.*
11+
/test/output/build/**/*-changed/
812
node_modules/
9-
test/output/**/*-changed.*
10-
test/output/build/**/*-changed/
1113
yarn-error.log

bin/observable-init.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

build.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import {parseArgs} from "node:util";
2+
import {build} from "esbuild";
3+
import {glob} from "glob";
4+
5+
const {values, positionals} = parseArgs({
6+
allowPositionals: true,
7+
options: {
8+
outdir: {type: "string", default: "build"},
9+
outbase: {type: "string"},
10+
ignore: {type: "string", multiple: true},
11+
sourcemap: {type: "boolean"}
12+
}
13+
});
14+
15+
await build({
16+
entryPoints: await glob(positionals, {ignore: values.ignore}),
17+
define: {"process.env.npm_package_version": `"${process.env.npm_package_version}"`},
18+
outdir: values.outdir,
19+
outbase: values.outbase,
20+
platform: "node",
21+
sourcemap: values.sourcemap ? "linked" : false,
22+
format: "esm",
23+
logLevel: "info"
24+
});

docs/config.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,16 @@ toc: false
195195
## search
196196

197197
Whether to enable [search](./search) on the project; defaults to false.
198+
199+
## markdownIt
200+
201+
A hook for registering additional [markdown-it](https://github.com/markdown-it/markdown-it) plugins. For example, to use [markdown-it-footnote](https://github.com/markdown-it/markdown-it-footnote):
202+
203+
```js run=false
204+
import type MarkdownIt from "markdown-it";
205+
import MarkdownItFootnote from "markdown-it-footnote";
206+
207+
export default {
208+
markdownIt: (md: MarkdownIt) => md.use(MarkdownItFootnote);
209+
};
210+
```

docs/contributing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ The local preview server restarts automatically if you edit any of the TypeScrip
2121
To generate the static site:
2222

2323
```sh
24-
yarn build
24+
yarn docs:build
2525
```
2626

27-
This creates the `dist` folder. View the site using your preferred web server, such as:
27+
This creates the `docs/.observablehq/dist` folder. View the site using your preferred web server, such as:
2828

2929
```sh
30-
http-server dist
30+
http-server docs/.observablehq/dist
3131
```
3232

3333
This documentation site is built on GitHub using Observable Framework; see the [deploy workflow](https://github.com/observablehq/framework/blob/main/.github/workflows/deploy.yml). Please open a pull request if you’d like to contribute. Contributors are expected to follow our [code of conduct](https://github.com/observablehq/.github/blob/master/CODE_OF_CONDUCT.md). 🙏

docs/getting-started.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,10 @@ These are just first steps. You can continue to develop projects after publishin
8484
Framework includes a helper script (`observable create`) for creating new projects. After a few quick prompts — where to create the project, your preferred package manager, *etc.* — it will stamp out a fresh project from a template.
8585

8686
<div class="tip">
87-
<p>Framework is a <a href="https://nodejs.org/">Node.js</a> application published to npm. You must have <a href="https://nodejs.org/en/download">Node.js 20.6 or later</a> installed before you can install Framework. Framework is a command-line interface (CLI) and runs in the terminal.</p>
87+
<p>Framework is a <a href="https://nodejs.org/">Node.js</a> application published to npm. You must have <a href="https://nodejs.org/en/download">Node.js 18 or later</a> installed before you can install Framework. Framework is a command-line interface (CLI) and runs in the terminal.</p>
8888
<p>If you run into difficulty following this tutorial, we’re happy to help! Please visit the <a href="https://talk.observablehq.com">Observable forum</a> or our <a href="https://github.com/observablehq/framework/discussions">GitHub discussions</a>.</p>
8989
</div>
9090

91-
<div class="caution">Framework does not currently support Windows, though some users have had success with the <a href="https://learn.microsoft.com/en-us/windows/wsl/install">Windows Subsystem for Linux (WSL)</a>. It you are interested in Windows support, please upvote <a href="https://github.com/observablehq/framework/issues/90">#90</a>.</div>
92-
9391
To create a new project with npm, run:
9492

9593
<pre data-copy>npm init @observablehq</pre>
@@ -223,7 +221,7 @@ Or with Yarn:
223221

224222
You should see something like this:
225223

226-
<pre data-copy="none"><b class="green">Observable Framework</b> v1.0.0
224+
<pre data-copy="none"><b class="green">Observable Framework</b> v1.1.2
227225
↳ <u><a href="http://127.0.0.1:3000/" style="color: inherit;">http://127.0.0.1:3000/</a></u></pre>
228226

229227
<div class="tip">

0 commit comments

Comments
 (0)