Extend Makefile with "deps", "dev", and "prod" targets
authorCarl Worth <cworth@cworth.org>
Mon, 25 May 2020 10:46:08 +0000 (03:46 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 26 May 2020 03:52:36 +0000 (20:52 -0700)
The "make deps" target downloads 3rd-party JavaScript resources that
are used by the site, (currently React and React-Dom). The "make dev"
installs the development versions locally while "made prod" installs
the production versions.

All three targets verify the integrity of the downloaded files via
SHA512 sums that are added in this commit.

And all three targets are documented in the README file added in this
commit.

.gitignore [new file with mode: 0644]
Makefile
README [new file with mode: 0644]
checksums.sha512 [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..c3cd6a2
--- /dev/null
@@ -0,0 +1,4 @@
+deps
+.deploy-source
+react.js
+react-dom.js
index cac62148ceba6fd43870edfb4a65b43ddccf2e89..ee69598e27ca527d25bc723cced9f081bd6500c7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,45 @@
 DEPLOY_HOST=lmno.games
 DEPLOY_DIR=/srv/lmno.games/www
-DO_NOT_DEPLOY="Makefile"
+DO_NOT_DEPLOY=Makefile deps *.jsx .babelrc .gitignore README
 DO_NOT_DELETE=flempires
 
+DEPS=deps/react.development.js \
+deps/react-dom.development.js \
+deps/react.production.min.js \
+deps/react-dom.production.min.js
+
+checksums:
+       sha512sum --strict -c checksums.sha512
+
+deps: $(DEPS) checksums
+
+dev: deps
+       cp deps/react.development.js react.js
+       cp deps/react-dom.development.js react-dom.js
+
+prod: deps
+       cp deps/react.production.min.js react.js
+       cp deps/react-dom.production.min.js react-dom.js
+
+deps/react.development.js:
+       wget -nv -nc -P deps https://unpkg.com/react@16/umd/react.development.js
+
+deps/react-dom.development.js:
+       wget -nv -nc -P deps https://unpkg.com/react-dom@16/umd/react-dom.development.js
+
+deps/react.production.min.js:
+       wget -nv -nc -P deps https://unpkg.com/react@16/umd/react.production.min.js
+
+deps/react-dom.production.min.js:
+       wget -nv -nc -P deps https://unpkg.com/react-dom@16/umd/react-dom.production.min.js
+
 deploy:
        rm -rf .deploy-source
        git clone . .deploy-source
+       make -C .deploy-source prod
        rm -rf .deploy-source/.git
        (cd .deploy-source; rsync -avz \
-               --exclude=$(DO_NOT_DEPLOY) \
+               $(DO_NOT_DEPLOY:%=--exclude=%) \
                --exclude=$(DO_NOT_DELETE) \
                --delete \
                --delete-after \
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..599bcdb
--- /dev/null
+++ b/README
@@ -0,0 +1,16 @@
+Static resources for the htttps://lmno.games/ website
+
+This repository contains the static HTML, JavaScript, and CSS files
+used by the lmno.games website, including support for downloading and
+verifying 3rd-party resources that are needed.
+
+The following Makefile targets will be useful while developing this
+code:
+
+  make deps: Download 3rd-party resources to be served by lmno.games
+
+  make dev: Configure development versions of "make deps" resources
+
+  make prod: Configure production versions of "make deps" resources
+
+  make deploy: Deploy latest, committed static content to lmno.games
diff --git a/checksums.sha512 b/checksums.sha512
new file mode 100644 (file)
index 0000000..bc0939a
--- /dev/null
@@ -0,0 +1,4 @@
+59e5732c703472fce6a70d2e13aca442df4ff981691524e0edbc988f94a00370b8eeb126c9e8fb0194ebefd224d78905c60208fba70781fa55791a908ffd4d97  deps/react.development.js
+11e7e0b90ecd516615f19efe6be47ebe0c0d61e3541a5d8e8bd81cb958d284d0f766ac16810321d5ed20b0fd23262a9de1173260c5ada399458179ce1209a5f9  deps/react-dom.development.js
+498b179806e5661aee08d515993a79fefd9ad459e889ad3a889877f8bf41f7051aaa94558dc34142ca80825406f5be7e21a5427cb0c7e7ebd6f76dc92f97a964  deps/react-dom.production.min.js
+49426e8e1b54599525c2c0016993674c5465bc2bbb5c605904bd55177dea46fbe0364de9052f44df9de471a838240bf4e7f9ec07db1a9d25c56dd1c0516f7e96  deps/react.production.min.js