taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

README (5791B)


      1 # GNU Taler Wallet & Anastasis Web UI
      2 
      3 This repository contains the implementation of a wallet for GNU Taler written
      4 in TypeScript and Anastasis Web UI
      5 
      6 ## Dependencies
      7 
      8 The following dependencies are required to build the wallet:
      9 
     10 - python>=3.8
     11 - nodejs>=12
     12 - jq
     13 - npm
     14 - pnpm
     15 - zip
     16 
     17 Note that you can install pnpm as an unprivileged user by running
     18 
     19 ```shell
     20 npm config set prefix $HOME/.npm-global
     21 export PATH=$HOME.npm-global/bin:$PATH
     22 npm install -g pnpm
     23 ```
     24 
     25 ## Preparing the repository
     26 
     27 After running clone you should bootstrap the repository.
     28 
     29 ```shell
     30 ./bootstrap
     31 ```
     32 
     33 ## Installation
     34 
     35 The CLI version of the wallet supports the normal GNU installation process.
     36 
     37 ```shell
     38 ./bootstrap
     39 ./configure [ --prefix=$PREFIX ] && make install
     40 ```
     41 
     42 ### Compiling from Git
     43 
     44 If you are compiling the code from git, you have to run `./bootstrap` before
     45 running `./configure`.
     46 
     47 ## Pushing a new prebuilt version
     48 
     49 After compiling run
     50 
     51 ```shell
     52 make prebuilt
     53 ```
     54 
     55 This will create a directory `prebuilt` with a git subtree, 
     56 compile every prebuilt project, copy everything into this subtree
     57 and create a commit with the default message mentioning from
     58 which revision the prebuilt was created.
     59 When the script completes the prebuilt version can should
     60 be manually pushed.
     61 
     62 ```shell
     63 cd prebuilt
     64 git push
     65 ```
     66 
     67 ### Building the WebExtension
     68 
     69 The WebExtension can be built via the 'webextension' make target:
     70 
     71 ```shell
     72 ./configure && make webextension
     73 ```
     74 
     75 This will create the zip file with the WebExtension in the directory
     76 
     77 ```
     78 packages/taler-wallet-webextension/extension/
     79 ```
     80 
     81 ### Installing local WebExtension
     82 
     83 Firefox:
     84  - Settings
     85  - Add-ons
     86  - Manage your extension -> Debug Add-ons
     87  - Load temporary Add-on...
     88  - Look for the zip file under './packages/taler-wallet-webextension/extension/' folder
     89 
     90 Chrome:
     91  - Settings
     92  - More tools
     93  - Extensions
     94  - Load unpacked
     95  - Look for the folder under './packages/taler-wallet-webextension/extension/'
     96 
     97 You may need to use manifest v2 or v3 depending on the browser version:
     98 https://blog.mozilla.org/addons/2022/05/18/manifest-v3-in-firefox-recap-next-steps/
     99 https://developer.chrome.com/docs/extensions/mv3/mv2-sunset/
    100 
    101 ### Reviewing WebExtension UI examples
    102 
    103 The WebExtension can be tested using example stories.
    104 To run a live server use the 'dev-view' target
    105 
    106 ```shell
    107 make webextension-dev-view
    108 ```
    109 
    110 Stories are defined with a \*.stories.tsx file [1], you are free to create new or edit
    111 some and commit them in order to create a more complete set of examples.
    112 
    113 [1] look for them at packages/taler-wallet-webextension/src/\*_/_.stories.tsx
    114 
    115 ### WebExtension UI Components
    116 
    117 Every group of component have a directory and a README.
    118 Testing component is based in two main category:
    119 
    120 - UI testing
    121 - State transition testing
    122 
    123 For UI testing, every story example will be taken as a unit test.
    124 For State testing, every stateful component should have an `useStateComponent` function that will be tested in a \*.test.ts file.
    125 
    126 ### Testing WebExtension
    127 
    128 After building the WebExtension look for the folder `extension`
    129 Inside you will find v2 and v3 version referring to the manifest version being used.
    130 
    131 Firefox users:
    132 
    133 - Go to about:addons
    134 - Then `debug addon` (or about:debugging#/runtime/this-firefox)
    135 - Then `Load temporary addon...`
    136 - Select the `taler-wallet-webextension-*.zip`
    137 
    138 Chrome users:
    139 
    140 - Settings -> More tools -> Extensions (or go to chrome://extensions/)
    141 - `Load unpacked` button in the upper left
    142 - Selected the `unpacked` folder in v2 or v3
    143 
    144 # Integration Tests
    145 
    146 This repository comes with integration tests for GNU Taler. To run them,
    147 install the wallet first. Then use the test runner from the
    148 taler-integrationtests package:
    149 
    150 ```shell
    151 # List available tests
    152 taler-wallet-cli testing list-integrationtests
    153 
    154 # Run all tests
    155 taler-wallet-cli testing run-integrationtests 
    156 
    157 # Run all tests matching pattern
    158 taler-wallet-cli testing run-integrationtests $GLOB
    159 
    160 $ Run all tests from a suite
    161 taler-wallet-cli testing run-integrationtests --suites=wallet
    162 ```
    163 
    164 The test runner accepts a bash glob pattern as parameter. Individual tests can
    165 be run by specifying their name.
    166 
    167 To check coverage, use nyc from the root of the repository and make sure that the taler-wallet-cli
    168 from the source tree is executed, and not the globally installed one:
    169 
    170 ```
    171 nyc ./packages/taler-wallet-cli/bin/taler-wallet-cli '*'
    172 ```
    173 
    174 ## Minimum required browser for WebEx
    175 
    176 Can be found in: 
    177  - packages/taler-wallet-webextension/manifest-v2.json
    178  - packages/taler-wallet-webextension/manifest-v3.json
    179 
    180 ## Anastasis Web UI
    181 
    182 ## Building for deploy
    183 
    184 To build the Anastasis SPA run:
    185 
    186 ```shell
    187 make anastasis-webui
    188 ```
    189 
    190 It will run the test suite and put everything into the dist folder under the project root (packages/anastasis-webui).
    191 You can copy the SPA directly to work local webserver.
    192 
    193 ```shell
    194 cp -Tr ./packages/anastasis-webui/dist/prod /var/www/html/anastasis
    195 ```
    196 
    197 Additionally you can create a zip file with the content to upload into a web server:
    198 
    199 ```shell
    200 make anastasis-webui-dist
    201 ```
    202 
    203 It creates the zip file named `anastasis-webui.zip` 
    204 
    205 ## Building explored release in a container
    206 
    207 First create a container with a base image, copy the release tar file and get inside the virtual machine.
    208 
    209 ```shell
    210 podman pull ubuntu:24.04
    211 podman container create --name builder ubuntu:24.04 sleep infinity
    212 podman container start builder
    213 podman container cp taler-wallet-v*.tar.gz builder:/root/
    214 podman exec -it -w /root builder /bin/bash
    215 ```
    216 
    217 Then inside the vm make sure you have the required software and follow the instruction for building.
    218 
    219 Installing requirements
    220 
    221 ```shell
    222 apt update && apt install -y nodejs curl vim less python3 make zip jq npm
    223 npm install --global corepack
    224 tar xzf taler-wallet-v*.tar.gz 
    225 cd taler-wallet-v*/
    226 corepack enable pnpm
    227 pnpm --version
    228 ```
    229