From 2d6676895132c9bbeb36902de5cf4912d93fca71 Mon Sep 17 00:00:00 2001 From: Peter Harpending Date: Wed, 12 Oct 2022 01:18:35 -0600 Subject: [PATCH] add jex dwim[-+] commands, and a README --- utils/jex/README.md | 53 +++++++++++++++++++++++++++++++++++++++++++ utils/jex/src/jex.erl | 24 ++++++++++++++++---- 2 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 utils/jex/README.md diff --git a/utils/jex/README.md b/utils/jex/README.md new file mode 100644 index 0000000..4dfe07a --- /dev/null +++ b/utils/jex/README.md @@ -0,0 +1,53 @@ +# Jex: simple TypeScript/JavaScript packaging system + +Jex is a simple packaging/dependency system for TypeScript/JavaScript +projects. + +Jex is very much a work in progress, so these instructions are subject to +change. + +As of now, Jex is a glorified shell script that automates a lot of the tedium +in building sidekick, JR, etc. + +The long-term goal is to completely remove any dependency on NPM. NPM comes +with a lot of unfixable security issues that present an unacceptable risk in a +business context, which is the focus of the Vanillae project. + +## Installation + +1. `git clone https://github.com/aeternity/Vanillae.git` +2. [Install Erlang and zx](https://www.bitchute.com/video/1gCvcoPUR7eJ/) +3. Edit `~/.bashrc` (or `~/.zshrc` or whatever) and add + + ``` + alias jex="zx rundir ~/path/to/Vanillae/utils/jex" + ``` + +## Usage + +``` +Jex: simple JavaScript packaging system + +COMMANDS: + dwim- init, pull, build + dwim+ init, pull, build, mindist, push + cfgbarf barf out the jex.eterms file (mostly to make sure it parses correctly) + echo home echo $HOME + echo jexdir echo $HOME/.jex + echo devdir echo $HOME/.jex/dev + echo pkgname name of current package + echo pkgdir echo $HOME/.jex/dev/realm-name-X.Y.Z + echo deps list dependencies of current package + echo pathof PKG list the path to PKG or + init mkdir -p $HOME/.jex/dev + build tsc && cp -r ./src/jex_include ./dist/ + -w, --weak continue building even if tsc fails + -f, --force use cp -rf instead of cp -r + mindist mkdir jex_mindist && cp -r src jex_mindist && cp -r dist jex_mindist && rm -r jex_mindist/src/jex_include + -f, --force use cp -rf instead of cp -r + push rsync -a jex_mindist/ PKGDIR + ls ls $HOME/.jex/dev + tree tree $HOME/.jex/ + rmpkg PKG rm -r $HOME/.jex/dev/PKG + pull pull each dependency into src/jx_include +``` diff --git a/utils/jex/src/jex.erl b/utils/jex/src/jex.erl index 4cb7ed6..1536c5e 100644 --- a/utils/jex/src/jex.erl +++ b/utils/jex/src/jex.erl @@ -39,9 +39,11 @@ help() -> % TODO: tarball signatures help_screen() -> - ["welcome to hell\n" + ["Jex: simple JavaScript packaging system\n" "\n" "COMMANDS:\n" + " dwim- init, pull, build\n" + " dwim+ init, pull, build, mindist, push\n" " cfgbarf barf out the jex.eterms file (mostly to make sure it parses correctly)\n" " echo home echo $HOME\n" " echo jexdir echo $HOME/.jex\n" @@ -58,12 +60,14 @@ help_screen() -> " -f, --force use cp -rf instead of cp -r\n" " push rsync -a jex_mindist/ PKGDIR\n" " ls ls $HOME/.jex/dev\n" - " jextree tree $HOME/.jex/\n" + " tree tree $HOME/.jex/\n" " rmpkg PKG rm -r $HOME/.jex/dev/PKG\n" " pull pull each dependency into src/jx_include\n" ]. +dispatch(["dwim-"]) -> dwim(minus); +dispatch(["dwim+"]) -> dwim(plus); dispatch(["cfgbarf"]) -> cfgbarf(); dispatch(["echo", "home"]) -> echo(home); dispatch(["echo", "jexdir"]) -> echo(jexdir); @@ -84,6 +88,18 @@ dispatch(_) -> help(). +%%----------------------------------------------------------------------------- +%% jex dwim +%%----------------------------------------------------------------------------- + +dwim(minus) -> + init(), + pull(), + build([]); +dwim(plus) -> + dwim(minus), + mindist([]), + push(). %%----------------------------------------------------------------------------- @@ -228,8 +244,8 @@ mindist(Opts) -> ok. mindist_cp(dont_force) -> - _ = cmd("cp -rv src jex_mindist"), - _ = cmd("cp -rv dist jex_mindist"), + _ = cmd("rsync -avv --exclude=\"*.swp\" src jex_mindist"), + _ = cmd("cp -rv dist jex_mindist"), ok; mindist_cp(force) -> _ = cmd("cp -rvf src jex_mindist"),