diff --git a/.gitignore b/.gitignore index 5d00182..6776d54 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -# ignore the publish directory -00-publish/ +# ignore the build directory +00_build # ignore node_modules node_modules/ diff --git a/Gruntfile.js b/Gruntfile.js index 26c5daa..92bbc7b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -182,30 +182,30 @@ module.exports = function (grunt) { } function hashAssets () { - const cssFile = grunt.file.read('00-publish/css/main.min.css') + const cssFile = grunt.file.read('00_build/css/main.min.css') const cssHash = md5(cssFile).substr(0, 8) - const jsFile = grunt.file.read('00-publish/js/cheatsheet.min.js') + const jsFile = grunt.file.read('00_build/js/cheatsheet.min.js') const jsHash = md5(jsFile).substr(0, 8) - const htmlFile = grunt.file.read('00-publish/index.html') + const htmlFile = grunt.file.read('00_build/index.html') // write the new files - grunt.file.write('00-publish/css/main.min.' + cssHash + '.css', cssFile) - grunt.file.write('00-publish/js/cheatsheet.min.' + jsHash + '.js', jsFile) + grunt.file.write('00_build/css/main.min.' + cssHash + '.css', cssFile) + grunt.file.write('00_build/js/cheatsheet.min.' + jsHash + '.js', jsFile) // delete the old files - grunt.file.delete('00-publish/css/main.min.css') - grunt.file.delete('00-publish/js/cheatsheet.min.js') + grunt.file.delete('00_build/css/main.min.css') + grunt.file.delete('00_build/js/cheatsheet.min.js') // update the HTML file - grunt.file.write('00-publish/index.html', + grunt.file.write('00_build/index.html', htmlFile.replace('main.min.css', 'main.min.' + cssHash + '.css') .replace('cheatsheet.min.js', 'cheatsheet.min.' + jsHash + '.js')) // show some output - grunt.log.writeln('00-publish/css/main.min.css → ' + - '00-publish/css/main.min.' + cssHash + '.css') - grunt.log.writeln('00-publish/js/cheatsheet.min.js → ' + - '00-publish/js/cheatsheet.min.' + jsHash + '.js') + grunt.log.writeln('00_build/css/main.min.css → ' + + '00_build/css/main.min.' + cssHash + '.css') + grunt.log.writeln('00_build/js/cheatsheet.min.js → ' + + '00_build/js/cheatsheet.min.' + jsHash + '.js') } // --------------------------------------------------------------------------- @@ -219,17 +219,17 @@ module.exports = function (grunt) { force: true }, - // remove all the files in the 00-publish folder - pre: ['00-publish'], + // remove all the files in the 00_build folder + pre: ['00_build'], // remove the uncompressed CLJS client file - post: ['00-publish/js/cheatsheet.js'] + post: ['00_build/js/cheatsheet.js'] }, copy: { cheatsheet: { files: [ - {expand: true, cwd: 'public/', src: ['**'], dest: '00-publish/'} + {expand: true, cwd: 'public/', src: ['**'], dest: '00_build/'} ] } }, diff --git a/README.md b/README.md index 9629b5b..feda4a4 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ You can read about some of the design decisions that went into the cheatsheet ### First time setup -Install [Leiningen], [Node.js], and [Yarn]. +Install [Leiningen], [Node.js], and [Yarn] or use [nix-shell] from the project root. ```sh # install node_modules @@ -26,7 +26,7 @@ You may wish to run these commands in separate console tabs / screens. # does two things: # - compiles LESS into CSS whenever a less/*.less file changes # - builds public/docs.json whenever a docs/*.cljsdoc file changes -grunt watch +npx grunt watch # run a local web server on port 9224 # the port is configurable and defaults to 8888 if not provided @@ -39,16 +39,17 @@ lein clean && lein cljsbuild auto # NOTE: app.js is generated from "lein cljsbuild auto" above node app.js -# create a build into the 00-publish directory -grunt build +# create a build into the 00-build directory +npx grunt build ``` ## License [MIT License] -[cljs.info/cheatsheet]:http://cljs.info/cheatsheet -[Leiningen]:http://leiningen.org -[Node.js]:http://nodejs.org +[cljs.info/cheatsheet]:https://cljs.info/cheatsheet +[Leiningen]:https://leiningen.org +[Node.js]:https://nodejs.org [Yarn]:https://yarnpkg.com/ +[nix-shell]:https://nixos.wiki/wiki/Development_environment_with_nix-shell [MIT License]:https://github.com/oakmac/cljs-cheatsheet/blob/master/LICENSE.md diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..bad6ce0 --- /dev/null +++ b/default.nix @@ -0,0 +1,23 @@ +{ nixpkgs ? import { } }: + +let + pkgs = [ + /* Core runtime libraries */ + nixpkgs.nodejs + nixpkgs.yarn + nixpkgs.clojure + nixpkgs.jdk11 + nixpkgs.leiningen + + /* Dev Tools */ + nixpkgs.ack + nixpkgs.git + nixpkgs.gnupg + nixpkgs.which + ]; + +in + nixpkgs.stdenv.mkDerivation { + name = "env"; + buildInputs = pkgs; + }