Initial commit, basic web page with reagent component is working

This commit is contained in:
heyarne 2021-12-30 15:37:23 +01:00
commit 5aac0474c1
13 changed files with 2103 additions and 0 deletions

2
.envrc Normal file
View file

@ -0,0 +1,2 @@
use flake
watch_file *.nix

75
.gitignore vendored Normal file
View file

@ -0,0 +1,75 @@
node_modules
.shadow-cljs
resources/public/js
# Created by https://www.toptal.com/developers/gitignore/api/clojure,emacs
# Edit at https://www.toptal.com/developers/gitignore?templates=clojure,emacs
### Clojure ###
pom.xml
pom.xml.asc
*.jar
*.class
/lib/
/classes/
/target/
/checkouts/
.lein-deps-sum
.lein-repl-history
.lein-plugins/
.lein-failures
.nrepl-port
.cpcache/
### Emacs ###
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
dist/
# Flycheck
flycheck_*.el
# server auth directory
/server/
# projectiles files
.projectile
# directory configuration
.dir-locals.el
# network security
/network-security.data
# End of https://www.toptal.com/developers/gitignore/api/clojure,emacs

9
README.md Normal file
View file

@ -0,0 +1,9 @@
# Rect-Packing
This project is built using `shadow-cljs`:
``` bash
npx shadow-cljs watch :app
```
Use `cider-connect-cljs` to connect to the REPL in emacs after opening http://localhost:8080 in your browser. :)

13
deps.edn Normal file
View file

@ -0,0 +1,13 @@
{:paths ["src" "resources"]
:deps {org.clojure/clojure {:mvn/version "1.10.0"}
thi.ng/geom {:mvn/version "1.0.0-RC3"
:exclusions [org.jogamp.jogl/jogl-all
org.jogamp.gluegen/gluegen-rt]}}
:aliases
;; clojurescript build tool and dependencies (see also shadow-cljs.edn)
{:cljs {:extra-deps {thheller/shadow-cljs {:mvn/version "2.8.109"}
appliedscience/js-interop {:mvn/version "0.2.5"}
reagent/reagent {:mvn/version "1.1.0"}
#_#_ refactor-nrepl/refactor-nrepl {:mvn/version "3.1.0"}
#_#_ cider/cider-nrepl {:mvn/version "0.27.2"}}}}}

26
flake.lock generated Normal file
View file

@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1640860084,
"narHash": "sha256-EGOsNZvLSl0grwUCRqXIKDBkvZN81u3N7m813CBfHfE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1b3e15bebbaa15599d0f39c308c18a7e68eb859f",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

11
flake.nix Normal file
View file

@ -0,0 +1,11 @@
{
inputs.nixpkgs.url = github:NixOS/nixpkgs;
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
in {
devShell.${system} = import ./shell.nix { inherit pkgs; };
};
}

1886
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

12
package.json Normal file
View file

@ -0,0 +1,12 @@
{
"name": "rect-packing",
"version": "0.0.1",
"private": true,
"devDependencies": {
"shadow-cljs": "2.16.10"
},
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
}
}

View file

@ -0,0 +1,13 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css" />
<title>All my friends are made of square shaped blocks</title>
</head>
<body>
<div id="app"></div>
</body>
<script src="js/main.js"></script>
</html>

View file

@ -0,0 +1,20 @@
*,
*:before,
*:after {
box-sizing: border-box;
}
html,
body {
margin: 0;
padding: 0;
min-height: 100vh;
}
body {
background: #eee;
color: #222;
font-family: sans-serif;
font-size: 14px;
line-height: 1.2;
}

10
shadow-cljs.edn Normal file
View file

@ -0,0 +1,10 @@
;; shadow-cljs configuration
{:deps {:aliases [:cljs]}
:dev-http {8080
{:root "resources/public"
:proxy-url "http://localhost:8081"}}
:builds
{:app {:target :browser
:output-dir "resources/public/js"
:asset-path "/js"
:modules {:main {:entries [heyarne.rect-packing.core]}}}} }

12
shell.nix Normal file
View file

@ -0,0 +1,12 @@
{ pkgs ? import <nixpkgs> { }, }:
let
lib = pkgs.lib;
in pkgs.mkShell rec {
name = "quil-env";
buildInputs = with pkgs; [
clojure
nodejs-slim-16_x
nodePackages.npm
];
}

View file

@ -0,0 +1,14 @@
(ns heyarne.rect-packing.core
(:require [reagent.core :as r]
[reagent.dom :as dom]))
(defn main []
[:main
[:h1 "Hello world"]
[:p "This is a starting point"]])
(defn ^:dev/after-load init []
(println "Initializing…")
(dom/render [main] (.querySelector js/document "#app")))
(defonce app (init))