diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70f41327..7c0f11e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.gitignore b/.gitignore index 0712e779..3cc94af0 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ yarn-error.log todo.txt result shell.nix +.turbo diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..f7b0d07a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1 @@ +See the [Changelog.mdx page](./packages/website/docs/Changelog.mdx) for the changelog. diff --git a/README.md b/README.md index 9b80cf33..9be8b2b2 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/package.json b/package.json index dcab983e..f1241ebe 100644 --- a/package.json +++ b/package.json @@ -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/*" diff --git a/packages/cli/README.md b/packages/cli/README.md index 7b0d0038..ec9e334b 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -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. diff --git a/packages/cli/package.json b/packages/cli/package.json index dca34532..a21a9939 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -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", diff --git a/packages/components/package.json b/packages/components/package.json index 6e0cba3f..2669594c 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -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" diff --git a/packages/components/src/components/SquiggleEditor.tsx b/packages/components/src/components/SquiggleEditor.tsx index 9be3625e..73cc0d69 100644 --- a/packages/components/src/components/SquiggleEditor.tsx +++ b/packages/components/src/components/SquiggleEditor.tsx @@ -16,7 +16,7 @@ const WrappedCodeEditor: React.FC<{ setCode: (code: string) => void; errorLocations?: SqLocation[]; }> = ({ code, setCode, errorLocations }) => ( -
+
+
{autorunMode ? null : (