cognitive-engineering-lab / aquascope

Interactive visualizations of Rust at compile-time and run-time
https://cognitive-engineering-lab.github.io/aquascope/
MIT License
1.94k stars 44 forks source link

Build from source instructions help and error. #92

Closed safwansamsudeen closed 1 year ago

safwansamsudeen commented 1 year ago

First, we have to install cargo-make. After that, the last two lines are meant to be called from the root dir, but the third last line cds into the root directory - perhaps we should change the instructions like this:

git clone https://github.com/cognitive-engineering-lab/aquascope.git
cd aquascope
npm install -g graco
cargo install cargo-make
cargo make init-bindings
cd frontend && graco prepare
cd .. && cargo install --path crates/aquascope_front
cargo install --path crates/mdbook-aquascope

Apart from that, when I try to run graco prepare, the following error comes: (... used to denote the parent folder of aquascope)

................................................................................

lint

.../aquascope/frontend/packages/aquascope-editor/src/editor-utils/interpreter.tsx
  448:7  error  'config' is assigned a value but never used. Allowed unused vars must match /^_/u  @typescript-eslint/no-unused-vars
  577:1  error  Delete `········`                                                                  prettier/prettier

.../aquascope/frontend/packages/aquascope-editor/src/editor-utils/misc.tsx
  14:3   error  Insert `CharRange,⏎··`  prettier/prettier
  15:10  error  Delete `,⏎··CharRange`  prettier/prettier
  50:4   error  Insert `⏎·`             prettier/prettier

.../aquascope/frontend/packages/aquascope-editor/src/lib.tsx
   34:3   
error  Insert `CharRange,⏎··`                                                                   prettier/prettier
   35:8   error  Delete `e,⏎··CharRang`                                                                   prettier/prettier
   67:11  error  'Button' is defined but never used. Allowed unused vars must match /^_/u                 @typescript-eslint/no-unused-vars
   73:7   error  'BUTTON_ORDER' is assigned a value but never used. Allowed unused vars must match /^_/u  @typescript-eslint/no-unused-vars
  229:9   error  Unexpected constant condition                                                            no-constant-condition
  332:8   error  Delete `······`                                                                          prettier/prettier

✖ 11 proble
ms (11 errors, 0 warnings)
  7 errors and 0 warnings potentially fixable with the `--fix` option.

................................................................................

script

................................................................................

Running task for: aquascope-embed
Running task for: aquascope-standalone
[3:47:20 PM] error: Command failed: node /Users/safwan/.local/lib/node_modules/graco/dist/main.mjs init && node .../lib/node_modules/graco/dist/main.mjs build --release

There exists no --fix option. How can I resolve this?

willcrichton commented 1 year ago

I wouldn't worry about the lints, those don't actually kill the build. Is there anything else in the output that would suggest why the command failed?

safwansamsudeen commented 1 year ago

My apologies, this comes before the lint:

Done in 1.3s
Running task for: aquascope-editor
build

Build complete.

................................................................................

check

src/editor-utils/boundaries.tsx:182:14 - error TS2345: Argument of type 'Timeout' is not assignable to parameter of type 'SetStateAction<number | undefined>'.

182     setTimer(setTimeout(() => setAnimating(false), 500));
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 1 error in src/editor-utils/boundaries.tsx:182

................................................................................

lint
...
willcrichton commented 1 year ago

Oh, that's a strange. I don't know why you're getting a type error. I can't reproduce it locally. Maybe Graco is using a weird version of Typescript or something.

What OS and shell are you using?

safwansamsudeen commented 1 year ago

ZSH, macOS Ventrura. npm: 8.19.3, node: 18.12.1.

willcrichton commented 1 year ago

Ok, I will investigate. In the mean time, just do whatever's needed to fix the type error (feel free to cast something to any as a temporary hack).

gavinleroy commented 1 year ago

What's happening here is the type of setTimeout is getting inferred as the Node type, instead of the React type. See StackOverflow.

I can confirm that changing the function to window.setTimeout works, a more elegant solution is probably to exclude the Node types from the tsconfig because we don't need them. E.g.,

{
  "compilerOptions": {
    "types": ["react-native", "jest"]
  }
}
safwansamsudeen commented 1 year ago

@gavinleroy your solution was correct. I wonder why this didn't happen to @willcrichton... may I PR this?

However, changing tsconfig didn't work in my case - raising something about not finding the entry type "react-native". I changed it to react, but that too raised a similar error.

Many thanks!

gavinleroy commented 1 year ago

This issue was fixed by #96, we explicitly specified that the timeout be set on the window.