alexwl / haskell-code-explorer

Web application for exploring and understanding Haskell codebases
MIT License
509 stars 20 forks source link

Static js files location #9

Closed meck closed 5 years ago

meck commented 5 years ago

I've been giving this a spin, great work! I was wondering if there is some hardcoded path for the js files? Or is it always expecting those specified?

I've been using it with stack build --copy-compiler-tools for all the yamls and then stack exec which makes use much easier with stack, since I don't need to keep track of which version it was complied with for different projects.

But I'm a bit unsure about where to put the js files... The best alternative from a use senario I guess would be to embed them at compile time?

alexwl commented 5 years ago

Thanks!

There is no hardcoded path to static js files. haskell-code-server executable needs --js-path option to be able to serve static assets (js, css, png, and index.html). There is a javascript/release directory (https://github.com/alexwl/haskell-code-explorer/tree/master/javascript/release) that contains all static assets.

Examples of how to start haskell-code-server:

Using stack exec command:

cd haskell-code-explorer
stack exec haskell-code-server -- -p PATH_TO_INDEXED_PACKAGE --js-path=javascript/release

Without stack exec command:

haskell-code-server -p PATH_TO_INDEXED_PACKAGE --js-path=PATH_TO_HASKELL_CODE_EXPLORER_DIRECTORY/javascript/release

I think it is a good idea to embed all static assets in haskell-code-server executable (e.g., using http://hackage.haskell.org/package/file-embed). That will remove the need to specify --js-path option.

alexwl commented 5 years ago

https://github.com/alexwl/haskell-code-explorer/commit/a3b2321f7781c98c2863a54a339af73a6d6d0050 commit embeds static assets in haskell-code-server executable.

Now there is no need to specify --js-path (although it is still possible):

cd haskell-code-explorer
stack exec haskell-code-server -- -p PATH_TO_INDEXED_PACKAGE