Merge branch 'develop' into project-in-editors

This commit is contained in:
Vyacheslav Matyukhin 2022-10-13 03:36:08 +04:00
commit a0000cd179
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C
35 changed files with 787 additions and 528 deletions

View File

@ -1,4 +1,4 @@
name: Squiggle packages check
name: Squiggle packages checks
on:
push:
@ -9,217 +9,40 @@ on:
branches:
- master
- develop
- reducer-dev
- epic-reducer-project
- epic-0.5.0
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: quantified-uncertainty
jobs:
pre_check:
name: Precheck for skipping redundant jobs
build-test-lint:
name: Build, test, lint
runs-on: ubuntu-latest
outputs:
should_skip_lang: ${{ steps.skip_lang_check.outputs.should_skip }}
should_skip_components: ${{ steps.skip_components_check.outputs.should_skip }}
should_skip_website: ${{ steps.skip_website_check.outputs.should_skip }}
should_skip_vscodeext: ${{ steps.skip_vscodeext_check.outputs.should_skip }}
should_skip_cli: ${{ steps.skip_cli_check.outputs.should_skip }}
steps:
- id: skip_lang_check
name: Check if the changes are about squiggle-lang src files
uses: fkirc/skip-duplicate-actions@v5.2.0
with:
paths: '["packages/squiggle-lang/**"]'
- id: skip_components_check
name: Check if the changes are about components src files
uses: fkirc/skip-duplicate-actions@v5.2.0
with:
paths: '["packages/components/**"]'
- id: skip_website_check
name: Check if the changes are about website src files
uses: fkirc/skip-duplicate-actions@v5.2.0
with:
paths: '["packages/website/**"]'
- id: skip_vscodeext_check
name: Check if the changes are about vscode extension src files
uses: fkirc/skip-duplicate-actions@v5.2.0
with:
paths: '["packages/vscode-ext/**"]'
- id: skip_cli_check
name: Check if the changes are about cli src files
uses: fkirc/skip-duplicate-actions@v5.2.0
with:
paths: '["packages/cli/**"]'
lang-lint:
name: Language lint
runs-on: ubuntu-latest
needs: pre_check
if: ${{ needs.pre_check.outputs.should_skip_lang != 'true' }}
defaults:
run:
shell: bash
working-directory: packages/squiggle-lang
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: cd ../../ && yarn
- name: Check rescript lint
run: yarn lint:rescript
- name: Check javascript, typescript, and markdown lint
uses: creyD/prettier_action@v4.2
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
dry: true
prettier_options: --check packages/squiggle-lang
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Turbo run
run: npx turbo run build test lint bundle
lang-build-test-bundle:
name: Language build, test, and bundle
coverage:
name: Coverage
runs-on: ubuntu-latest
needs: pre_check
if: ${{ needs.pre_check.outputs.should_skip_lang != 'true' }}
defaults:
run:
shell: bash
working-directory: packages/squiggle-lang
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Install dependencies from monorepo level
run: cd ../../ && yarn
- name: Build rescript codebase
run: yarn build
- name: Run rescript tests
run: yarn test:rescript
- name: Run typescript tests
run: yarn test:ts
- name: Run webpack
run: yarn bundle
- name: Upload rescript coverage report
run: yarn coverage:rescript:ci
- name: Upload typescript coverage report
run: yarn coverage:ts:ci
components-lint:
name: Components lint
runs-on: ubuntu-latest
needs: pre_check
if: ${{ needs.pre_check.outputs.should_skip_components != 'true' }}
defaults:
run:
shell: bash
working-directory: packages/components
steps:
- uses: actions/checkout@v3
- name: Check javascript, typescript, and markdown lint
uses: creyD/prettier_action@v4.2
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
dry: true
prettier_options: --check packages/components --ignore-path packages/components/.prettierignore
components-bundle-build-test:
name: Components bundle, build and test
runs-on: ubuntu-latest
needs: pre_check
if: ${{ (needs.pre_check.outputs.should_skip_components != 'true') || (needs.pre_check.outputs.should_skip_lang != 'true') }}
defaults:
run:
shell: bash
working-directory: packages/components
steps:
- uses: actions/checkout@v3
- name: Install dependencies from monorepo level
run: cd ../../ && yarn
- name: Build rescript codebase in squiggle-lang
run: cd ../squiggle-lang && yarn build
- name: Run webpack
run: yarn bundle
- name: Build storybook
run: yarn build
- name: Test components
run: yarn test
website-lint:
name: Website lint
runs-on: ubuntu-latest
needs: pre_check
if: ${{ needs.pre_check.outputs.should_skip_website != 'true' }}
defaults:
run:
shell: bash
working-directory: packages/website
steps:
- uses: actions/checkout@v3
- name: Check javascript, typescript, and markdown lint
uses: creyD/prettier_action@v4.2
with:
dry: true
prettier_options: --check packages/website
website-build:
name: Website build
runs-on: ubuntu-latest
needs: pre_check
if: ${{ (needs.pre_check.outputs.should_skip_website != 'true') || (needs.pre_check.outputs.should_skip_lang != 'true') || (needs.pre_check.outputs.should_skip_components != 'true') }}
defaults:
run:
shell: bash
working-directory: packages/website
steps:
- uses: actions/checkout@v3
- name: Install dependencies from monorepo level
run: cd ../../ && yarn
- name: Build rescript in squiggle-lang
run: cd ../squiggle-lang && yarn build
- name: Build components
run: cd ../components && yarn build
- name: Build website assets
run: yarn build
vscode-ext-lint:
name: VS Code extension lint
runs-on: ubuntu-latest
needs: pre_check
if: ${{ needs.pre_check.outputs.should_skip_vscodeext != 'true' }}
defaults:
run:
shell: bash
working-directory: packages/vscode-ext
steps:
- uses: actions/checkout@v3
- name: Check javascript, typescript, and markdown lint
uses: creyD/prettier_action@v4.2
with:
dry: true
prettier_options: --check packages/vscode-ext
vscode-ext-build:
name: VS Code extension build
runs-on: ubuntu-latest
needs: pre_check
if: ${{ (needs.pre_check.outputs.should_skip_components != 'true') || (needs.pre_check.outputs.should_skip_lang != 'true') }} || (needs.pre_check.outputs.should_skip_vscodeext != 'true') }}
defaults:
run:
shell: bash
working-directory: packages/vscode-ext
steps:
- uses: actions/checkout@v3
- name: Install dependencies from monorepo level
run: cd ../../ && yarn
- name: Build
run: yarn compile
cli-lint:
name: CLI lint
runs-on: ubuntu-latest
needs: pre_check
if: ${{ needs.pre_check.outputs.should_skip_cli != 'true' }}
defaults:
run:
shell: bash
working-directory: packages/cli
steps:
- uses: actions/checkout@v3
- name: Check javascript, typescript, and markdown lint
uses: creyD/prettier_action@v4.2
with:
dry: true
prettier_options: --check packages/cli
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn
- name: Coverage
run: npx turbo run coverage

1
.gitignore vendored
View File

@ -12,3 +12,4 @@ yarn-error.log
todo.txt
result
shell.nix
.turbo

1
CHANGELOG.md Normal file
View File

@ -0,0 +1 @@
See the [Changelog.mdx page](./packages/website/docs/Changelog.mdx) for the changelog.

View File

@ -51,7 +51,19 @@ For any project in the repo, begin by running `yarn` in the top level
yarn
```
See `packages/*/README.md` to work with whatever project you're interested in.
Then use `turbo` to build the specific packages or the entire monorepo:
```sh
turbo run build
```
Or:
```sh
turbo run build --filter=@quri/squiggle-components
```
You can also run specific npm scripts for the package you're working on. See `packages/*/README.md` for the details.
# Contributing

View File

@ -2,12 +2,11 @@
"private": true,
"name": "squiggle",
"scripts": {
"nodeclean": "rm -r node_modules && rm -r packages/*/node_modules",
"format:all": "prettier --write . && cd packages/squiggle-lang && yarn format",
"lint:all": "prettier --check . && cd packages/squiggle-lang && yarn lint:rescript"
"nodeclean": "rm -r node_modules && rm -r packages/*/node_modules"
},
"devDependencies": {
"prettier": "^2.7.1"
"prettier": "^2.7.1",
"turbo": "^1.5.5"
},
"workspaces": [
"packages/*"

View File

@ -20,3 +20,30 @@ Runs compilation in the current directory and all of its subdirectories.
### `npx squiggle-cli-experimental watch`
Watches `.squiggleU` files in the current directory (and subdirectories) and rebuilds them when they are saved. Note that this will _not_ rebuild files when their dependencies are changed, just when they are changed directly.
## Further instructions
The above requires having node, npm and npx. To install the first two, see [here](https://nodejs.org/en/), to install npx, run:
```
npm install -g npx
```
Alternatively, you can run the following without the need for npx:
```
npm install squiggle-cli-experimental
node node_modules/squiggle-cli-experimental/index.js compile
```
or you can add a script to your `package.json`, like:
```
...
scripts: {
"compile": "squiggle-cli-experimental compile"
}
...
```
This can be run with `npm run compile`. `npm` knows how to reach into the node_modules directly, so it's not necessary to specify that.

View File

@ -7,11 +7,13 @@
"bin": "index.js",
"type": "module",
"scripts": {
"start": "node ."
"start": "node .",
"lint": "prettier --check .",
"format": "prettier --write ."
},
"license": "MIT",
"dependencies": {
"chalk": "^5.0.1",
"chalk": "^5.1.0",
"chokidar": "^3.5.3",
"commander": "^9.4.1",
"fs": "^0.0.1-security",

View File

@ -12,11 +12,11 @@
"@react-hook/size": "^2.1.2",
"@types/uuid": "^8.3.4",
"clsx": "^1.2.1",
"framer-motion": "^7.5.1",
"framer-motion": "^7.5.3",
"lodash": "^4.17.21",
"react": "^18.1.0",
"react-ace": "^10.1.0",
"react-hook-form": "^7.36.1",
"react-hook-form": "^7.37.0",
"react-use": "^17.4.0",
"react-vega": "^7.6.0",
"uuid": "^9.0.0",
@ -41,7 +41,7 @@
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^27.5.0",
"@types/lodash": "^4.14.186",
"@types/node": "^18.8.0",
"@types/node": "^18.8.3",
"@types/react": "^18.0.21",
"@types/styled-components": "^5.1.26",
"@types/uuid": "^8.3.4",
@ -49,8 +49,8 @@
"canvas": "^2.10.1",
"cross-env": "^7.0.3",
"jest": "^29.0.3",
"jest-environment-jsdom": "^29.0.3",
"jsdom": "^20.0.0",
"jest-environment-jsdom": "^29.1.2",
"jsdom": "^20.0.1",
"mini-css-extract-plugin": "^2.6.1",
"postcss-cli": "^10.0.0",
"postcss-import": "^15.0.0",
@ -60,11 +60,11 @@
"react-scripts": "^5.0.1",
"style-loader": "^3.3.1",
"tailwindcss": "^3.1.8",
"ts-jest": "^29.0.2",
"ts-jest": "^29.0.3",
"ts-loader": "^9.4.1",
"tsconfig-paths-webpack-plugin": "^4.0.0",
"typescript": "^4.8.4",
"web-vitals": "^3.0.2",
"web-vitals": "^3.0.3",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.11.1"

View File

@ -16,7 +16,7 @@ const WrappedCodeEditor: React.FC<{
setCode: (code: string) => void;
errorLocations?: SqLocation[];
}> = ({ code, setCode, errorLocations }) => (
<div className="border border-grey-200 p-2 m-4">
<div className="border border-grey-200 p-2 m-4" data-testid="squiggle-editor">
<CodeEditor
value={code}
onChange={setCode}

View File

@ -182,7 +182,7 @@ const RunControls: React.FC<{
const CurrentPlayIcon = isRunning ? RefreshIcon : PlayIcon;
return (
<div className="flex space-x-1 items-center">
<div className="flex space-x-1 items-center" data-testid="autorun-controls">
{autorunMode ? null : (
<button onClick={run}>
<CurrentPlayIcon
@ -310,7 +310,7 @@ export const SquigglePlayground: FC<PlaygroundProps> = ({
const resultAndBindings = useSquiggle({
environment,
continues,
code,
code: renderedCode,
project,
jsImports: imports,
executionId,
@ -351,7 +351,7 @@ export const SquigglePlayground: FC<PlaygroundProps> = ({
const errorLocations = getErrorLocations(resultAndBindings.result);
const firstTab = vars.showEditor ? (
<div className="border border-slate-200">
<div className="border border-slate-200" data-testid="squiggle-editor">
<CodeEditor
errorLocations={errorLocations}
value={code}
@ -403,7 +403,9 @@ export const SquigglePlayground: FC<PlaygroundProps> = ({
>
{tabs}
</div>
<div className="w-1/2 p-2 pl-4">{squiggleChart}</div>
<div className="w-1/2 p-2 pl-4" data-testid="playground-result">
{squiggleChart}
</div>
</div>
);

View File

@ -0,0 +1,55 @@
import { render, screen, waitFor, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import * as React from "react";
import "@testing-library/jest-dom";
import { SquigglePlayground } from "../src/index";
test("Autorun is default", async () => {
render(<SquigglePlayground code="70*30" />);
await waitFor(() =>
expect(screen.getByTestId("playground-result")).toHaveTextContent("2100")
);
});
test("Autorun can be switched off", async () => {
const user = userEvent.setup();
render(<SquigglePlayground code="70*30" />);
expect(screen.getByTestId("autorun-controls")).toHaveTextContent("Autorun");
await waitFor(() =>
expect(screen.getByTestId("playground-result")).toHaveTextContent("2100")
);
await user.click(screen.getByText("Autorun")); // disable
expect(screen.getByTestId("autorun-controls")).toHaveTextContent("Paused");
expect(screen.getByTestId("autorun-controls")).not.toHaveTextContent(
"Autorun"
);
await user.click(screen.getByText("Paused")); // enable autorun again
expect(screen.getByTestId("autorun-controls")).toHaveTextContent("Autorun");
// we should replace the code here, but it's hard to update react-ace state via user events: https://github.com/securingsincity/react-ace/issues/923
// ...or replace react-ace with something else
// TODO:
/*
const editor = screen
.getByTestId("squiggle-editor")
.querySelector(".ace_editor") as HTMLElement;
editor.focus();
// await user.clear(editor);
await userEvent.paste("40*40"); // https://github.com/securingsincity/react-ace/issues/923#issuecomment-755502696
screen.debug(editor);
// this makes the tests slower, but it's hard to test otherwise that the code _didn't_ execute
await new Promise((r) => setTimeout(r, 300));
expect(screen.getByTestId("playground-result")).toHaveTextContent("2100"); // still the old value
await waitFor(() =>
expect(screen.getByTestId("playground-result")).toHaveTextContent("1600")
);
*/
});

View File

@ -1,5 +1,4 @@
{
"buildCommand": "cd ../squiggle-lang && yarn build && cd ../components && yarn build",
"outputDirectory": "storybook-static",
"installCommand": "cd ../../ && yarn"
"buildCommand": "cd ../.. && npx turbo run build --filter=@quri/squiggle-components",
"outputDirectory": "storybook-static"
}

View File

@ -6,3 +6,5 @@ lib
_coverage/
.cache/
Reducer_Peggy_GeneratedParser.js
ReducerProject_IncludeParser.js
src/rescript/Reducer/Reducer_Peggy/helpers.js

View File

@ -22,10 +22,12 @@
"test:rescript": "jest --modulePathIgnorePatterns=__tests__/TS/*",
"test:watch": "jest --watchAll",
"test:fnRegistry": "jest __tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.bs.js",
"coverage:rescript": "rm -f *.coverage && yarn clean && BISECT_ENABLE=yes yarn build && yarn test:rescript && bisect-ppx-report html",
"coverage:ts": "yarn clean && yarn build && nyc --reporter=lcov yarn test:ts",
"coverage:rescript:ci": "yarn clean && BISECT_ENABLE=yes yarn build:rescript && yarn test:rescript && bisect-ppx-report send-to Codecov",
"coverage:ts:ci": "yarn coverage:ts && codecov",
"coverage:rescript:local": "rm -f *.coverage && yarn clean && BISECT_ENABLE=yes yarn build && yarn test:rescript && bisect-ppx-report html",
"coverage:ts:local": "yarn clean && yarn build && nyc --reporter=lcov yarn test:ts",
"coverage:rescript": "yarn clean && BISECT_ENABLE=yes yarn build:rescript && yarn test:rescript && bisect-ppx-report send-to Codecov",
"coverage:ts": "yarn coverage:ts:local && codecov",
"coverage": "yarn coverage:ts && yarn coverage:rescript",
"coverage:local": "yarn coverage:ts:local && yarn coverage:rescript:local",
"lint:rescript": "./lint.sh",
"lint:prettier": "prettier --check .",
"lint": "yarn lint:rescript && yarn lint:prettier",
@ -54,7 +56,7 @@
"@types/jest": "^27.5.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"bisect_ppx": "^2.7.1",
"chalk": "^5.0.1",
"chalk": "^5.1.0",
"codecov": "^3.8.3",
"fast-check": "^3.1.4",
"gentype": "^4.5.0",
@ -67,7 +69,7 @@
"rescript": "^9.1.4",
"rescript-fast-check": "^1.1.1",
"rescript-js-map": "^1.1.0",
"ts-jest": "^27.1.4",
"ts-jest": "^29.0.3",
"ts-loader": "^9.4.1",
"ts-node": "^10.9.1",
"typescript": "^4.8.4",

View File

@ -3,3 +3,4 @@
/server/out
/*.vsix
/syntaxes/*.json
dist

View File

@ -1,7 +1,10 @@
.vscode/**
.vscode-test/**
src/**
client
server
.gitignore
node_modules
.yarnrc
vsc-extension-quickstart.md
**/tsconfig.json

View File

@ -1,12 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2020",
"lib": ["ES2020", "dom"],
"outDir": "out",
"rootDir": "src",
"sourceMap": true
},
"include": ["src"],
"exclude": ["node_modules", ".vscode-test"]
}

View File

@ -22,7 +22,7 @@
"onCustomEditor:squiggle.wysiwyg",
"onCommand:squiggle.preview"
],
"main": "./client/out/extension.js",
"main": "./dist/src/client/extension.js",
"contributes": {
"languages": [
{
@ -114,30 +114,32 @@
}
},
"scripts": {
"vscode:prepublish": "yarn run compile",
"compile:tsc": "tsc -b",
"compile:grammar": "js-yaml syntaxes/squiggle.tmLanguage.yaml >syntaxes/squiggle.tmLanguage.json",
"compile:vendor": "(cd ../squiggle-lang && yarn run build) && (cd ../components && yarn run bundle && yarn run build:css) && mkdir -p media/vendor && cp ../components/dist/bundle.js media/vendor/components.js && cp ../components/dist/main.css media/vendor/components.css && cp ../../node_modules/react/umd/react.production.min.js media/vendor/react.js && cp ../../node_modules/react-dom/umd/react-dom.production.min.js media/vendor/react-dom.js && cp ../website/static/img/squiggle-logo.png media/vendor/icon.png",
"compile": "yarn run compile:vendor && yarn run compile:grammar && yarn run compile:tsc",
"watch": "tsc -b -watch",
"pretest": "yarn run compile && yarn run lint",
"lint": "prettier --check .",
"vscode:prepublish": "yarn run lint && yarn run build",
"build:grammar": "js-yaml syntaxes/squiggle.tmLanguage.yaml >syntaxes/squiggle.tmLanguage.json",
"build:vendor": "mkdir -p media/vendor && cp ../components/dist/bundle.js media/vendor/components.js && cp ../components/dist/main.css media/vendor/components.css && cp ../../node_modules/react/umd/react.production.min.js media/vendor/react.js && cp ../../node_modules/react-dom/umd/react-dom.production.min.js media/vendor/react-dom.js && cp ../website/static/img/squiggle-logo.png media/vendor/icon.png",
"build:bundle": "esbuild ./src/client/extension.ts ./src/server/server.ts --format=cjs --platform=node --sourcemap --minify --bundle --external:vscode --outdir=./dist",
"build": "yarn run build:vendor && yarn run build:grammar && yarn run build:bundle",
"watch": "yarn run compile:bundle --watch",
"pretest": "yarn run build && yarn run lint",
"lint": "tsc -noEmit && prettier --check .",
"format": "prettier --write .",
"package": "npx vsce package --yarn"
"package": "vsce package --yarn"
},
"devDependencies": {
"@types/glob": "^8.0.0",
"@types/node": "18.x",
"@types/vscode": "^1.70.0",
"esbuild": "^0.15.10",
"glob": "^8.0.3",
"js-yaml": "^4.1.0",
"typescript": "^4.8.4",
"vsce-yarn-patch": "^1.66.2"
"vsce": "^2.11.0"
},
"dependencies": {
"vscode-languageclient": "^8.0.2",
"vscode-languageserver": "^8.0.2",
"vscode-languageserver-textdocument": "^1.0.7",
"@quri/squiggle-lang": "^0.2.11"
"@quri/squiggle-lang": "^0.2.11",
"@quri/squiggle-components": "*"
}
}

View File

@ -1,12 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2020",
"lib": ["ES2020", "dom"],
"outDir": "out",
"rootDir": "src",
"sourceMap": true
},
"include": ["src"],
"exclude": ["node_modules"]
}

View File

@ -13,7 +13,7 @@ let client: LanguageClient;
export const startClient = (context: vscode.ExtensionContext) => {
// The server is implemented in node
let serverModule = context.asAbsolutePath(
path.join("server", "out", "server.js")
path.join("dist", "src", "server", "server.js")
);
// The debug options for the server
// --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging

View File

@ -7,7 +7,6 @@
"rootDir": "src",
"sourceMap": true
},
"include": ["src"],
"exclude": ["node_modules", ".vscode-test"],
"references": [{ "path": "./client" }, { "path": "./server" }]
"include": ["src/**/*"],
"exclude": ["node_modules", ".vscode-test"]
}

View File

@ -332,7 +332,7 @@ truncateRight: (distribution, right: number) => distribution
**Examples**
```javascript
truncateLeft(normal(5, 2), 6);
truncateRight(normal(5, 2), 6);
```
### klDivergence

View File

@ -0,0 +1,20 @@
---
title: Changelog
---
## 0.5.0
- Performance improvements:
- Interpreter is now 5x-20x faster on code written in Squiggle
- SampleSet to PointSet conversions are 2x faster
- cdf function on SampleSets is 30x faster
- overall speedup is about 2x on average on real code written in Squiggle
- 50% smaller bundle size for [@quri/squiggle-lang](https://www.npmjs.com/package/@quri/squiggle-lang); 20% smaller bundle size for [@quri/squiggle-components](https://www.npmjs.com/package/@quri/squiggle-components).
### Breaking changes
Some rarely used math functions got removed or moved to the `Math` namespace.
For example, `cos(x)` is now `Math.cos(x)`, and `atanh(x)` doesn't exist.
If your code is now failing with `<function> is not defined` for anything from [this list](https://mathjs.org/docs/reference/functions.html), try adding `Math.` prefix first, and then complain on [Github issues](https://github.com/quantified-uncertainty/squiggle/issues).

View File

@ -3,9 +3,11 @@ title: How to import squiggle files into `.mdx` documents
sidebar_position: 5
---
import { SquiggleEditorWithImportedBindings } from "../../src/components/SquiggleEditor";
:::caution Proof of concept
_Proof of concept_
The following usage pattern is currently broken. We expect to bring it back in some form in 0.5.1 or 0.5.2 release.
:::
## Consider the following squiggle file
@ -30,10 +32,3 @@ import { SquiggleEditorWithImportedBindings } from "../../src/components/Squiggl
```
Notice, you need to wrap the export of `@quri/squiggle-components` in custom code for dynamicism, please view `packages/website/src/components/` in github for details.
Which would then look exactly like
<SquiggleEditorWithImportedBindings
defaultCode={"f(z)"}
bindingsImportUrl={"/estimates/demo.squiggle"}
/>

View File

@ -15,7 +15,7 @@
"@docusaurus/core": "2.1.0",
"@docusaurus/preset-classic": "2.1.0",
"@heroicons/react": "^1.0.6",
"@quri/squiggle-components": "^0.5.0",
"@quri/squiggle-components": "*",
"base64-js": "^1.5.1",
"clsx": "^1.2.1",
"hast-util-is-element": "2.1.2",

View File

@ -61,6 +61,11 @@ const sidebars = {
},
],
},
{
type: "doc",
id: "Changelog",
label: "Changelog",
},
],
// But you can create a sidebar manually

View File

@ -1,5 +1,4 @@
{
"buildCommand": "cd ../squiggle-lang && yarn build && cd ../components && yarn build && cd ../website && yarn build",
"framework": "docusaurus-2",
"installCommand": "cd ../../ && yarn"
"buildCommand": "cd ../.. && npx turbo run build --filter=squiggle-website",
"framework": "docusaurus-2"
}

40
turbo.json Normal file
View File

@ -0,0 +1,40 @@
{
"$schema": "https://turborepo.org/schema.json",
"pipeline": {
"lint": {
"outputs": []
},
"format": {},
"build": {
"dependsOn": ["^build"]
},
"vscode-squiggle#build": {
"dependsOn": ["^build", "@quri/squiggle-components#bundle"]
},
"@quri/squiggle-components#build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", "storybook-static/**"]
},
"@quri/squiggle-lang#build": {
"dependsOn": ["^build"],
"outputs": [
"__tests__/**/*.bs.js",
"benchmark/**/*.bs.js",
"src/rescript/**/*.js",
"src/rescript/**/*.gen.tsx",
"../../node_modules/bisect_ppx/**/*.bs.js",
"dist/**"
]
},
"test": {
"dependsOn": ["build"],
"outputs": []
},
"bundle": {
"dependsOn": ["^build", "build"]
},
"coverage": {
"cache": false
}
}
}

782
yarn.lock

File diff suppressed because it is too large Load Diff