Add contributing instructions for the website (#760)

This is so that I can link people to the `README` if they are interested in
improving the site
This commit is contained in:
Gabriel Gonzalez 2018-12-20 10:36:10 -08:00 committed by GitHub
parent 026db247f7
commit 2635c582eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 71 additions and 45 deletions

View File

@ -97,14 +97,14 @@ And each of them with `stack build <package-name>`, for example:
$ stack build dhall-json
```
## Build the "Try Dhall" website
## Build the website
Building the website from source is currently only supported for Nix on Linux.
You can build the static assets by running:
```bash
$ nix-build --attr try-dhall
$ nix-build --attr website
```
... then open `./result/index.html` in your browser.
@ -112,7 +112,7 @@ $ nix-build --attr try-dhall
You can also download an archive containing the pre-built website from CI using
this link:
* [try-dhall.tar.bz2](http://hydra.dhall-lang.org/job/dhall-haskell/master/tarball-try-dhall/latest/download-by-type/file/binary-dist)
* [website.tar.bz2](http://hydra.dhall-lang.org/job/dhall-haskell/master/tarball-website/latest/download-by-type/file/binary-dist)
## Contributing

View File

@ -11,5 +11,5 @@ in
inherit (shared_ghcjs) dhall-try;
inherit (shared_ghcjs_linux) try-dhall;
inherit (shared_ghcjs_linux) website;
}

22
dhall-try/README.md Normal file
View File

@ -0,0 +1,22 @@
# `dhall-try`
For installation or development instructions, see:
* [`dhall-haskell` - `README`](https://github.com/dhall-lang/dhall-haskell/blob/master/README.md#build-the-website)
## How to contribute
You will most likely want to edit [`index.html`](./index.html) if you want to
improve the site. The vast majority of the site logic is embedded within that
monolithic document, including a substantial amount of inline JavaScript, inline
CSS, and all of the code examples.
The [`src`](./src) directory contains the code for interpreting the live code
demo, powered by the `dhall`/`dhall-json` packages compiled to JavaScript using
GHCJS. You only need to modify that Haskell source code if you would like to
extend the site with new Haskell-derived functionality.
The [`website.nix`](../nix/website.nix) file contains the top-level logic for
building the site, including bundling of JavaScript/CSS/image assets. You will
also want to refer to [`shared.nix`](../nix/shared.nix) for related logic to
build each bundled dependency.

View File

@ -229,47 +229,17 @@ let
twitterBootstrap = pkgsNew.callPackage ./twitterBootstrap.nix { };
try-dhall = pkgsNew.runCommand "try-dhall" {} ''
${pkgsNew.coreutils}/bin/mkdir $out
${pkgsNew.coreutils}/bin/mkdir $out/{css,img,js}
${pkgsNew.coreutils}/bin/cp ${../dhall-try/index.html} $out/index.html
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.nodePackages.js-yaml}/lib/node_modules/js-yaml/dist/js-yaml.min.js $out/js
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.jQuery} $out/js/jquery.min.js
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.twitterBootstrap}/js/bootstrap.min.js $out/js
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.twitterBootstrap}/js/bootstrap.min.js.map $out/js
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.twitterBootstrap}/css/bootstrap.min.css $out/css
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.npm.codemirror}/lib/node_modules/codemirror/lib/codemirror.js $out/js
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.npm.codemirror}/lib/node_modules/codemirror/mode/haskell/haskell.js $out/js
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.npm.codemirror}/lib/node_modules/codemirror/mode/javascript/javascript.js $out/js
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.npm.codemirror}/lib/node_modules/codemirror/mode/yaml/yaml.js $out/js
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.npm.codemirror}/lib/node_modules/codemirror/lib/codemirror.css $out/css
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.haskell.packages.ghcjs.dhall-try}/bin/dhall-try.jsexe/all.min.js $out/js
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.dhall.prelude} $out/Prelude
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.logo.bash} $out/img/bash-logo.png
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.logo.clojure} $out/img/clojure-logo.svg
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.logo.dhallLarge} $out/img/dhall-large-logo.png
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.logo.dhallSmall} $out/img/dhall-small-logo.png
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.logo.github}/PNG/GitHub-Mark-32px.png $out/img/github-logo.png
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.logo.haskell} $out/img/haskell-logo.png
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.logo.kubernetes} $out/img/kubernetes-logo.svg
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.logo.json} $out/img/json-logo.svg
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.logo.nix} $out/img/nix-logo.png
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.logo.stackOverflow} $out/img/stack-overflow-logo.svg
${pkgsNew.coreutils}/bin/ln --symbolic '${pkgsNew.logo.twitter}/Twitter Logos/Twitter Logos/Twitter_Logo_Blue/Twitter_Logo_Blue.svg' $out/img/twitter-logo.svg
${pkgsNew.coreutils}/bin/ln --symbolic ${pkgsNew.logo.yaml} $out/img/yaml-logo.png
${pkgsNew.coreutils}/bin/mkdir $out/nix-support
${pkgsNew.coreutils}/bin/echo "doc none $out/index.html" > $out/nix-support/hydra-build-products
'';
website = pkgsNew.callPackage ./website.nix {};
tarball-try-dhall = pkgsStaticLinux.releaseTools.binaryTarball rec {
src = pkgsNew.try-dhall;
tarball-website = pkgsStaticLinux.releaseTools.binaryTarball rec {
src = pkgsNew.website;
installPhase = ''
releaseName=try-dhall
${pkgsNew.coreutils}/bin/install --target-directory "$TMPDIR/inst/try-dhall/" -D $src/index.html
${pkgsNew.coreutils}/bin/install --target-directory "$TMPDIR/inst/try-dhall/img" -D $src/img/*
${pkgsNew.coreutils}/bin/install --target-directory "$TMPDIR/inst/try-dhall/css" -D $src/css/*
${pkgsNew.coreutils}/bin/install --target-directory "$TMPDIR/inst/try-dhall/js" -D $src/js/*
releaseName=website
${pkgsNew.coreutils}/bin/install --target-directory "$TMPDIR/inst/website/" -D $src/index.html
${pkgsNew.coreutils}/bin/install --target-directory "$TMPDIR/inst/website/img" -D $src/img/*
${pkgsNew.coreutils}/bin/install --target-directory "$TMPDIR/inst/website/css" -D $src/css/*
${pkgsNew.coreutils}/bin/install --target-directory "$TMPDIR/inst/website/js" -D $src/js/*
'';
};
};
@ -534,7 +504,7 @@ in
tarball-dhall-json = makeTarball "dhall-json";
tarball-dhall-text = makeTarball "dhall-text";
inherit (pkgs) tarball-try-dhall try-dhall-server try-dhall;
inherit (pkgs) tarball-website website;
inherit (pkgs.haskell.packages."${compiler}") dhall dhall-bash dhall-json dhall-text dhall-try;

34
nix/website.nix Normal file
View File

@ -0,0 +1,34 @@
{ coreutils, dhall, haskell, jQuery, logo, nodePackages, npm, runCommand
, twitterBootstrap
}:
runCommand "try-dhall" {} ''
${coreutils}/bin/mkdir $out
${coreutils}/bin/mkdir $out/{css,img,js}
${coreutils}/bin/cp ${../dhall-try/index.html} $out/index.html
${coreutils}/bin/ln --symbolic ${nodePackages.js-yaml}/lib/node_modules/js-yaml/dist/js-yaml.min.js $out/js
${coreutils}/bin/ln --symbolic ${jQuery} $out/js/jquery.min.js
${coreutils}/bin/ln --symbolic ${twitterBootstrap}/js/bootstrap.min.js $out/js
${coreutils}/bin/ln --symbolic ${twitterBootstrap}/js/bootstrap.min.js.map $out/js
${coreutils}/bin/ln --symbolic ${twitterBootstrap}/css/bootstrap.min.css $out/css
${coreutils}/bin/ln --symbolic ${npm.codemirror}/lib/node_modules/codemirror/lib/codemirror.js $out/js
${coreutils}/bin/ln --symbolic ${npm.codemirror}/lib/node_modules/codemirror/mode/haskell/haskell.js $out/js
${coreutils}/bin/ln --symbolic ${npm.codemirror}/lib/node_modules/codemirror/mode/javascript/javascript.js $out/js
${coreutils}/bin/ln --symbolic ${npm.codemirror}/lib/node_modules/codemirror/mode/yaml/yaml.js $out/js
${coreutils}/bin/ln --symbolic ${npm.codemirror}/lib/node_modules/codemirror/lib/codemirror.css $out/css
${coreutils}/bin/ln --symbolic ${haskell.packages.ghcjs.dhall-try}/bin/dhall-try.jsexe/all.min.js $out/js
${coreutils}/bin/ln --symbolic ${logo.bash} $out/img/bash-logo.png
${coreutils}/bin/ln --symbolic ${logo.clojure} $out/img/clojure-logo.svg
${coreutils}/bin/ln --symbolic ${logo.dhallLarge} $out/img/dhall-large-logo.png
${coreutils}/bin/ln --symbolic ${logo.dhallSmall} $out/img/dhall-small-logo.png
${coreutils}/bin/ln --symbolic ${logo.github}/PNG/GitHub-Mark-32px.png $out/img/github-logo.png
${coreutils}/bin/ln --symbolic ${logo.haskell} $out/img/haskell-logo.png
${coreutils}/bin/ln --symbolic ${logo.kubernetes} $out/img/kubernetes-logo.svg
${coreutils}/bin/ln --symbolic ${logo.json} $out/img/json-logo.svg
${coreutils}/bin/ln --symbolic ${logo.nix} $out/img/nix-logo.png
${coreutils}/bin/ln --symbolic ${logo.stackOverflow} $out/img/stack-overflow-logo.svg
${coreutils}/bin/ln --symbolic '${logo.twitter}/Twitter Logos/Twitter Logos/Twitter_Logo_Blue/Twitter_Logo_Blue.svg' $out/img/twitter-logo.svg
${coreutils}/bin/ln --symbolic ${logo.yaml} $out/img/yaml-logo.png
${coreutils}/bin/mkdir $out/nix-support
${coreutils}/bin/echo "doc none $out/index.html" > $out/nix-support/hydra-build-products
''

View File

@ -41,7 +41,7 @@ in
shared.tarball-dhall-json
shared.tarball-dhall-text
shared_ghcjs.tarball-try-dhall
shared_ghcjs.tarball-website
# This is the only `dhall` build that runs the test suite
coverage.dhall
@ -52,7 +52,7 @@ in
"coverage-dhall" = coverage.dhall;
inherit (shared_ghcjs) tarball-try-dhall;
inherit (shared_ghcjs) tarball-website;
inherit (shared)
tarball-dhall