Skip to content

talenet/talenet

Repository files navigation

tale:net

Travis Status AppVeyor status

Intergalactic skill & idea sharing community.

Development dependencies

NixOS

This repository contains a shell.nix that provides all required dependecies for development. Enter the environment by simply running:

nix-shell

Git setup

Enable automatic rebasing when pulling:

git config branch.autosetuprebase always

Build Setup

# install dependencies
npm install

# to manually start sbot just run (uses dev identity to not spam own ssb identity)
ssb_appname=talenet-dev ./node_modules/.bin/sbot server

# serve with hot reload (uses dev identity to not spam own ssb identity)
ssb_appname=talenet-dev npm run dev

# build electron application for production
npm run build

# TODO: what part of our stack runs this actually?
# build for production and view the bundle analyzer report
# npm run build --report

# run unit tests
npm run unit

# run e2e tests
npm run e2e

# run all tests
npm test

This project was generated with electron-vue@331f85f using vue-cli. Documentation about the original structure can be found here.

SSB

standalone sbot server

sbot now runs as a background process inside electron as a hidden window.

If you want to use a standalone sbot with talenet, it has to be installed and started in a separate terminal window. This makes it possbile to use patchfoo or other ssb clients in parallel with talenet.

# clone it from github
git clone https://github.com/ssbc/scuttlebot.git

# change into the cloned directory
cd scuttlebot

# install it's dependencies
npm i

# run it
$HOME/scuttlebot/bin.js server

To use tale:net with a seperate/standalone sbot, you need to use talenet -g (npm run dev -- -g for development) to start it.

Your sbot then also needs to have the ssb-talequery plugin installed. Run sbot plugins.install ssb-talequery to do this.

test:net and test:identity

TODO: we want to supply a network where you can freely spam, to develop and test new features. This will use an secret-handshake appkey so that your sbot can't connect to the mainnet.

If you want to run sbot for testing and want to avoid using your regular key pair you can specify the ssb_appname environment variable. If you e.g. set ssb_appname=test sbot will store data in ~/.test. Be aware that you need to run tale:net with the same environment variable, e.g.:

ssb_appname=test npm run dev

wonders of modern javascript

testing problems

TODO: clean this up. might be outdated.

our tests parse all the included npm modules, too. this surfaces lot's of dirty hacks in these modules. some frequent cases:

ERROR in ./node_modules/rc/index.js
Module parse failed: /home/user/TALEnet/node_modules/rc/index.js Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type.

Some modules use a hashbang (#!/bin/sh in the first line) to tell their shells to run the module code with node. Pretty esoteric but it can work. Not for the webpack/karma configuration we currently use though. I found two instance of this and the following script works around the problem by removing the first line of the file.

sed -i '1d' node_modules/rc/index.js
sed -i '1d' node_modules/non-private-ip/index.js
ERROR in ./node_modules/pull-ws/server.js
Module parse failed: /home/user/TALEnet/node_modules/pull-ws/server.js 'return' outside of function (9:2)

This code works around exporting semantics by conditionally exporting something different in a specific setting. This isn't supported by es2015.

patch node_modules/pull-ws/server.js < pull-ws-server.patch

sodium/chloride crypto warning

until sodium-native is updated to support electron 1.8 you might see warnings like these:

Error: No native build was found for runtime=electron abi=57 platform=linux arch=x64

It will fallback to a JS polyfill but will be quite slow...

workaround: cd node_modules/sodium-native && npm i && npm run prebuild

more info: ssbc/patchwork#597 (comment)

Links