From 8a8c07ec64bd480487794c105115ada68aa0f32a Mon Sep 17 00:00:00 2001 From: Tissevert Date: Tue, 9 Aug 2022 19:59:48 +0200 Subject: [PATCH] Add a guix package declaration --- CHANGELOG.md | 6 ++++++ README.md | 50 ++++++++++++++++++++++++++++---------------------- guix.scm | 27 +++++++++++++++++++++++++++ unit.js.tpl | 2 +- 4 files changed, 62 insertions(+), 23 deletions(-) create mode 100644 guix.scm diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bf33a6..8c51e1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Revision history for UnitJS +## 0.1.1 -- 2022-08-09 + +* Package UnitJS for [guix](https://guix.gnu.org/) +* Fix state bug in Async's sequences and bindings +* Generalize support for events in Dom element maker + ## 0.1.0 -- 2020-05-17 * Release UnitJS as a [SJW](https://git.marvid.fr/Tissevert/SJW) package still useable as a standalone script. diff --git a/README.md b/README.md index 7226b3e..9773244 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,49 @@ # UnitJS -UnitJS is a tiny Javascript framework to write web applications. It provides four essential modules to deal with asynchronous functions (technically, it's a monad obtained by currifying the CPS functions of Javascript like `setTimeout`), value caching, DOM manipulation and basic functional needs like composition or object projections. +UnitJS is a tiny Javascript framework to write web applications. It provides +four essential modules to deal with asynchronous functions (technically, it's a +monad obtained by currifying the CPS functions of Javascript like +`setTimeout`), value caching, DOM manipulation and basic functional needs like +composition or object projections. -## Usage -### With [SJW](https://git.marvid.fr/Tissevert/SJW) +## How to use it in your project -UnitJS comes as a SJW package. You can install it by copying the `src/` directory of this repository to your package database by issuing the following command from the current directory : +### As a [`SJW`](https://git.marvid.fr/Tissevert/SJW) package. -``` -$ cp -r src/ ~/.sjw/unitJS -``` +#### With [`guix`](https://guix.gnu.org/) -Then, using unitJS in your projects is as simple as writing : +The easiest way to use it in your web projects is to simply [package them with +`guix`](https://git.marvid.fr/Tissevert/SJW#how-not-to-install). -``` -import * as Async from UnitJS.Async; -``` +#### Otherwise -in any module if you want to use the `Async` module for instance and compile your code using the `--include` option of `sjw` with package `unitJS` : +You can follow [these +instructions](https://git.marvid.fr/Tissevert/SJW#when-guix-is-not-an-option) +to use it without `guix`. -``` -$ sjw -I unitJS your/code/src -o your/code/main.js -``` +### Without `SJW` -Note that all modules have their path prefixed by a common `UnitJS` component and that SJW will only include the modules actually used in your code, not all of UnitJS. - -### As a standalone JS script - -If you don't want to or can't use SJW, it's still possible to use UnitJS by generating a single script that can then be loaded from your web page like this : +If you don't want to or can't use SJW, it's still possible to use UnitJS by +generating a single script that can then be loaded from your web page like this +: ``` ``` -The file `unit.js` can be easily generated with `make`, which actually just calls the `unit.js.tpl` script. Note that you can still generate custom «partial» versions of `unit.js` if you don't use all of it by overriding the `SRC` variable of the `Makefile` like so : +The file `unit.js` can be easily generated with `make`, which actually just +calls the `unit.js.tpl` script. Note that you can still generate custom +«partial» versions of `unit.js` if you don't use all of it by overriding the +`SRC` variable of the `Makefile` like so : ``` make SRC="src/UnitJS/Dom.js src/UnitJS/Cache.js" ``` -or by manually calling `./unit.js.tpl` with the files you want, like the `Makefile` does. +or by manually calling `./unit.js.tpl` with the files you want, like the +`Makefile` does. + +When used that way, the `UnitJS` library will be available to your Javascript +code as a global variable `unitJS` containing each of the modules (`Async`, +`Dom`, etc.) as an attribute. diff --git a/guix.scm b/guix.scm new file mode 100644 index 0000000..b94fa80 --- /dev/null +++ b/guix.scm @@ -0,0 +1,27 @@ +(use-modules (guix build-system copy) + (guix gexp) + (guix git-download) + (guix licenses) + (guix packages)) + +(let + ((%source-dir (dirname (current-filename)))) + (package + (name "sjw-unitJS") + (version "devel") + (source + (local-file %source-dir + #:recursive? #t + #:select? (git-predicate %source-dir))) + (build-system copy-build-system) + (arguments + '(#:install-plan + '(("src" "lib/SJW/unitJS")))) + (home-page "https://git.marvid.fr/Tissevert/SJW") + (synopsis "The Simple Javascript Wrench.") + (description + "A collection of JS modules to write simple web applications. It covers + the basics, providing asynchronous operations without any need for + promises-support from the browser as well as primitives to create DOM + elements and basic functional-programming tooling.") + (license gpl3+))) diff --git a/unit.js.tpl b/unit.js.tpl index 418033d..dab92a5 100755 --- a/unit.js.tpl +++ b/unit.js.tpl @@ -30,7 +30,7 @@ EOF cat <