Skip to content

Commit

Permalink
Migrate from Graco to Depot (#96)
Browse files Browse the repository at this point in the history
* Add initial support for moved values in the interpreter

* Reduce opacity of moved values

* Swap from graco to depot

* Remove http.server from CI

* Revert version bump

* Fix CI
  • Loading branch information
willcrichton committed Jul 17, 2023
1 parent cf1d436 commit 21ebe8b
Show file tree
Hide file tree
Showing 42 changed files with 2,673 additions and 526 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ jobs:
args: test --features=no-docker
- name: Build Aquascope server
run: cargo build -p aquascope_serve --features=no-docker
- name: Build standalone
run: cd frontend && graco build
- name: Frontend tests
run: |
cargo run -p aquascope_serve --features=no-docker &
cd frontend/packages/aquascope-standalone/dist
python3 -m http.server 8000 &
cd ../../../
graco test
cd frontend && depot test
4 changes: 1 addition & 3 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ jobs:
- uses: actions/checkout@v3
- name: Quick Setup
uses: ./.github/workflows/quick-setup
- name: Build frontend and docs
- name: Build docs
run: |
cargo doc --lib
cd frontend
graco build
mv ../target/doc packages/aquascope-standalone/dist/doc
- uses: JamesIves/[email protected]
with:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/quick-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ runs:
- name: Gen bindings
run: cargo make init-bindings
shell: bash

- name: Install Depot
run: curl https://raw.githubusercontent.com/cognitive-engineering-lab/depot/main/scripts/install.sh | sh
shell: bash
- name: Prepare frontend
run: npm install -g graco && cd frontend && graco prepare
run: cd frontend && depot build
shell: bash
6 changes: 5 additions & 1 deletion .github/workflows/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ runs:
echo "$(pwd)/bin" >> ${GITHUB_PATH}
shell: bash

- name: Install Depot
run: curl https://raw.githubusercontent.com/cognitive-engineering-lab/depot/main/scripts/install.sh | sh
shell: bash

- name: Prepare frontend
run: npm install -g graco && cd frontend && graco prepare
run: cd frontend && depot build
shell: bash

- name: Install aquascope
Expand Down
2 changes: 1 addition & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cp crates/**/bindings/* frontend/packages/aquascope-editor/src/bindings"""
[tasks.install-mdbook]
dependencies = ["init-bindings"]
script = """
cd frontend && graco prepare && cd ..
cd frontend && depot build && cd ..
cargo miri setup
cargo install --path crates/mdbook-aquascope
cargo install --path crates/aquascope_front
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ If you want to install from source, you will first need Cargo and [npm](https://
```sh
git clone https://github.com/cognitive-engineering-lab/aquascope.git
cd aquascope
npm install -g graco
curl https://raw.githubusercontent.com/cognitive-engineering-lab/depot/main/scripts/install.sh | sh
cargo make init-bindings
cd frontend && graco prepare
cd frontend && depot build
cargo install --path crates/aquascope_front
cargo install --path crates/mdbook-aquascope
```
Expand Down
1 change: 0 additions & 1 deletion crates/mdbook-aquascope/dist

This file was deleted.

11 changes: 7 additions & 4 deletions crates/mdbook-aquascope/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(iter_intersperse)]
#![allow(clippy::comparison_to_empty)]

use std::path::Path;
Expand All @@ -9,10 +8,14 @@ use mdbook_preprocessor_utils::{
mdbook::preprocess::PreprocessorContext, Asset, SimplePreprocessor,
};

mdbook_preprocessor_utils::asset_generator!("../dist/");
mdbook_preprocessor_utils::asset_generator!(
"../../../frontend/packages/aquascope-embed/dist/"
);

const FRONTEND_ASSETS: [Asset; 2] =
[make_asset!("lib.js"), make_asset!("lib.css")];
const FRONTEND_ASSETS: [Asset; 2] = [
make_asset!("aquascope-embed.iife.js"),
make_asset!("style.css"),
];

struct AquascopePreprocessorWrapper(AquascopePreprocessor);

Expand Down
40 changes: 40 additions & 0 deletions frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
"env": {
"es2021": true
},
"extends": [
"eslint:recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 13,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"prettier"
],
"ignorePatterns": [
"*.d.ts"
],
"rules": {
"no-empty-pattern": "off",
"no-undef": "off",
"no-unused-vars": "off",
"no-cond-assign": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"no-constant-condition": [
"error",
{
"checkLoops": false
}
],
"prettier/prettier": "error"
}
}
34 changes: 3 additions & 31 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,31 +1,3 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage
/static/index.js

# production
/build
/entry
/dist

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Managed by Graco
pnpm-workspace.yaml
.eslintrc.cjs
.prettierrc.cjs
node_modules
dist
docs
9 changes: 9 additions & 0 deletions frontend/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
tabWidth: 2,
arrowParens: "avoid",
importOrder: ["<THIRD_PARTY_MODULES>", "^[./]"],
importOrderSeparation: true,
importOrderSortSpecifiers: true,
parser: "typescript",
plugins: [require("@trivago/prettier-plugin-sort-imports")],
};
5 changes: 0 additions & 5 deletions frontend/jest.config.cjs

This file was deleted.

17 changes: 16 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
{}
{
"private": true,
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"@types/node": "^20.4.2",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"eslint": "^8.45.0",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.8.8",
"typedoc": "^0.24.8",
"typescript": "^5.1.6",
"vite": "^4.4.4",
"vitest": "^0.33.0"
}
}
18 changes: 18 additions & 0 deletions frontend/packages/aquascope-editor/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
"extends": "../../.eslintrc.cjs",
"env": {
"browser": true
},
"plugins": [
"react"
],
"rules": {
"react/prop-types": "off",
"react/no-unescaped-entities": "off"
},
"settings": {
"react": {
"version": "detect"
}
}
}
5 changes: 1 addition & 4 deletions frontend/packages/aquascope-editor/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
src/bindings

# Managed by Graco
tsconfig.json
src/bindings
31 changes: 24 additions & 7 deletions frontend/packages/aquascope-editor/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
{
"name": "aquascope-editor",
"version": "0.1.0",
"private": true,
"type": "module",
"files": [
"dist"
],
"main": "dist/lib.js",
"exports": {
".": {
"default": "./dist/lib.js"
},
"./*": {
"default": "./dist/*.js"
}
},
"type": "module",
"depot": {
"platform": "browser"
},
"typedoc": {
"entryPoint": "./src/lib.ts"
},
"dependencies": {
"@codemirror/lang-rust": "^6.0.1",
"@codemirror/language": "^6.3.0",
Expand All @@ -12,16 +28,17 @@
"leader-line-new": "^1.1.9",
"lodash": "^4.17.21"
},
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/lodash": "^4.14.191",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
"@vitejs/plugin-react": "^4.0.3",
"classnames": "^2.3.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ let PermStack = ({
let triggerAnimation = () => {
setAnimating(true);
if (timer !== 0) clearTimeout(timer);
setTimer(setTimeout(() => setAnimating(false), 500));
setTimer(window.setTimeout(() => setAnimating(false), 500));
};

return (
Expand Down
4 changes: 2 additions & 2 deletions frontend/packages/aquascope-editor/src/lib.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import {
AnalysisOutput,
AquascopeAnnotations,
BackendError,
CharRange,
InterpAnnotations,
MTrace,
CharRange,
} from "./types";

export * as types from "./types";
Expand Down Expand Up @@ -329,7 +329,7 @@ export class Editor {
this.renderInterpreter(response.Ok, config as any, annotations?.interp);
} else {
this.reportStdErr(response!.Err);
}
}
} else if (operation == "permissions") {
// The permissions analysis results are sent as an array of
// body analyses. Each body could have analyzed successfully,
Expand Down
9 changes: 9 additions & 0 deletions frontend/packages/aquascope-editor/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"include": [
"src"
],
"compilerOptions": {
"outDir": "dist"
}
}
17 changes: 17 additions & 0 deletions frontend/packages/aquascope-editor/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/// <reference types="vitest" />
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";

export default defineConfig(({mode}) => ({
define: {
"process.env.NODE_ENV": JSON.stringify(mode),
},
plugins: [react()],
test: {
environment: "jsdom",
setupFiles: "tests/setup.ts",
deps: {
inline: [/^(?!.*vitest).*$/],
},
},
}));
18 changes: 18 additions & 0 deletions frontend/packages/aquascope-embed/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
"extends": "../../.eslintrc.cjs",
"env": {
"browser": true
},
"plugins": [
"react"
],
"rules": {
"react/prop-types": "off",
"react/no-unescaped-entities": "off"
},
"settings": {
"react": {
"version": "detect"
}
}
}
3 changes: 0 additions & 3 deletions frontend/packages/aquascope-embed/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions frontend/packages/aquascope-embed/esbuild.config.mjs

This file was deleted.

9 changes: 0 additions & 9 deletions frontend/packages/aquascope-embed/jest.config.cjs

This file was deleted.

Loading

0 comments on commit 21ebe8b

Please sign in to comment.