npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@x/unify

v0.6.35

Published

@x/unify host process and socket framework bundle

Downloads

44

Readme

Unify

Unify for Node.js and the browser in a simple package.

For Unify documentation, visit https://unifyjs.io/docs.

Getting Started

Install Dependencies

yarn add unify unify.react sqlite3

Start Application

npx unify

This starts both the host and the react development server. The following command line options are available:

Option| |Type|Default|Description ---|---|---|---|--- --help|-h|boolean| |Show help --version| |boolean| |Show version number --config| |string|"unify"|Path to JS or JSON config file --port|-p|integer|3001|TCP port number to listen on --scope|-s|string| |Property name that can participate in scopes. Multiple can be specified --sqliteFile|-f|string| |Path to a SQLite database to use --vocabulary|-v|string|"src/vocabulary"|Path to a file containing vocabulary definitions --constraints|-c|string|"src/constraints"|Path to a file containing constraint definitions --types|-t|string|"src/types"|Path to a file containing type declarations --strictApi| |boolean| |Enforce strict vocabulary API surface --strictTypes| |boolean| |Enforce explicit message types --requireSsl| |boolean| |Allows disabling of SSL requirement for production --auth0Domain| |boolean| |Enable auth0 authentication with the provided domain --authSecret| |boolean| |Secret to use for signing authentication tokens --startDevelopmentServer| |boolean| |Start react development server --watch| |boolean| |Watch for changes to configuration files and reload on change

For alternate ways of starting the host, including using other database providers, see the section below.

Configure Consumer

For applications bootstrapped with create-react-app, replace the contents of src/index.js with the following:

import React from 'react'
import ReactDOM from 'react-dom'
import consumer from 'unify'
import { Provider } from 'unify.react'
import App from './App'

consumer().connect()
  .then(host => ReactDOM.render(
    <Provider host={host}><App /></Provider>,
    document.getElementById('root')
  ))

Vocabulary can also be passed in as a prop to the Provider component.

An options object can also be passed to the consumer factory. Options are as follows:

Name|Type|Description ---|---|--- url|string|The websocket URL of the host to connect to reconnectDelay|number|Time in milliseconds between reconnect attempts. Defaults to 1000ms log|object|Logging configuration options. level property can be error, warn, debug, trace or none

Any components in your application can now use the higher order components and hooks from the unify.react library.

Host Startup / Configuration Options

The example here uses npx to invoke the Unify command line interface. A number of other options are available for starting and configuring the host.

Installing Globally

The Unify package can be installed globally by executing:

npm i -g unify
# or
yarn global add unify

This makes the CLI available globally throughout your system and can be invoked without npx.

Using a Configuration File

Configuration options can be specified in a Javascript or JSON file. By default, this file is called unify.js. The full set of options can be found here.

Starting the Host Programmatically

The host process can be started from any Node.js module.

const host = require('unify')
const vocabulary = require('./vocabulary')

host({
  port: 1234,
  scopes: ['orderId', 'productId'],
  storage: { client: 'sqlite3', connection: { filename: 'data.sqlite' } },
  vocabulary
})

Any database supported by knex can be used and should be configured accordingly here. An in-memory instance of the sqlite provider is used by default, but the sqlite3 package must be installed separately.

License

The MIT License (MIT)

Copyright © 2022 Dale Anderson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.