From 12e2b8334417ed5ee47c9570be840e73e1edf25a Mon Sep 17 00:00:00 2001 From: Mo Date: Fri, 15 Jul 2022 07:34:31 -0500 Subject: [PATCH] chore: update readme [skip ci] --- README.md | 15 ---------- packages/snjs/README.md | 62 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 15 deletions(-) create mode 100644 packages/snjs/README.md diff --git a/README.md b/README.md index 765cd1770..cac4ab1a5 100644 --- a/README.md +++ b/README.md @@ -71,18 +71,3 @@ You can configure the `DEFAULT_SYNC_SERVER` environment variable to set the defa ``` DEFAULT_SYNC_SERVER=https://sync.myserver ``` - -## Running E2E tests - -In order to run a stable server environment for E2E tests that will is up to date with what we have on production please checkout locally the [e2e repository](https://github.com/standardnotes/e2e). - -To start the server type in the e2e repository: -``` -yarn install --immutable -yarn test:stable-server -``` - -Then once the whole server infra is up and ready for your tests you can run the e2e suite in the local browser by typing (make sure you have built all the packages beforehand): -``` -yarn start:server:e2e -``` diff --git a/packages/snjs/README.md b/packages/snjs/README.md new file mode 100644 index 000000000..22811865f --- /dev/null +++ b/packages/snjs/README.md @@ -0,0 +1,62 @@ +# SNJS + +SNJS is a client-side JavaScript library for [Standard Notes](https://standardnotes.com) that contains shared logic for all Standard Notes clients. + +## Introduction + +SNJS is a shared library for use in all Standard Notes clients (desktop, web, and mobile). Its role is to extract any business or data logic from client code, so that clients are mostly responsible for UI-level code, and don’t have to think about encryption and key management, or even authentication or storage specifics. Extracting the code into a shared library also prevents us from having to write the same critical code on multiple platforms. + +The entry point of SNJS is the [`SNApplication`](packages/snjs/lib/application.ts) class. The application class is a complete unit of application functionality. Theoretically, many instances of an application can be created, each with its own storage namespace and memory state. This can allow clients to support multiple user accounts. + +An application must be supplied a custom subclass of [DeviceInterface](packages/snjs/lib/device_interface.ts). This allows the library to generalize all behavior a client will need to perform throughout normal client operation, such as saving data to a local database store, saving key/values, and accessing the keychain. + +On Web platforms SNJS interacts with [`sncrypto`](https://github.com/standardnotes/snjs/tree/packages/sncrypto-common) to perform operations as mentioned in the [specification](https://github.com/standardnotes/snjs/blob/main/packages/snjs/specification.md) document. This includes operations like key generation and data encryption. + +SNJS also interacts with a Standard Notes [syncing server](https://github.com/standardnotes/syncing-server-js), which is a zero-knowledge data and sync store that deals with encrypted data, and never learns of client secrets or sensitive information. + +## Installation + +`yarn add snjs` + +## Integrating in module environment + +```javascript +import { SNApplication } from 'snjs'; +``` + +## Integrating in non-module web environment + +```javascript + +Object.assign(window, SNLibrary); +``` + +## Building + +1. `yarn install --pure-lockfile` +2. `yarn start` to start Webpack in development mode (watches changes), or `yarn build` to create dist files. + +## Tests + +### E2E Tests + +To run a stable server environment for E2E tests that is up to date with production, clone the [e2e repository](https://github.com/standardnotes/e2e), then run: + +``` +yarn install --immutable +yarn test:stable-server +``` + +Once the server infrastructure is ready, and you've built all packages, you can run the test suite in the browser via: + +``` +yarn start:server:e2e +``` + +### Unit Tests + +From the root of the repository, run: + +``` +yarn run test:unit +```