Genvid Forum

Genvid Technologies

Package.json for web-api


I have a small suggestion:

Add the following package.json to C:\Genvid\Genvid Technologies SDK 1.10.0\api\web\dist\node:

  "name": "genvid",
  "version": "1.10.0",
  "description": "Genvid-Client",
  "main": "./index.js",
  "types": "./index.d.ts",
  "directories": {
    "lib": "lib"
  "author": "Genvid Technologies Inc",
  "license": "UNLICENSED"

This allows me to simply npm install the directory in my own project, like this:

npm install "C:\Genvid\Genvid Technologies SDK 1.10.0\api\web\dist\node"

This creates a symlink from my node_modules to that directory. This means I can simply import the client-tools, for example from typescript, like this:

import { decode } from 'genvid';

This gives the expected output of ArrayBuffer(2) {}, after bundling it with
(for example) parcel or webpack.

This means you can more easily set up projects which would use a bundler anyways.

For reference, this works as well:

import { decode } from 'genvid/lib/encoding';

It might be preferable to use this to reduce the bundle-size if you do not need everything.

It of course requires moduleResolution to be set to node in the tsconfig.json, but that is kind of obvious.

In my case, I also changed the generated"genvid": "file:../../../../../../Genvid/Genvid Technologies SDK 1.10.0/api/web/dist/node", in my own dependencies to "genvid": "file:C:/Genvid/Genvid Technologies SDK 1.10.0/api/web/dist/node", but that is a decision to be made by the user.

They might even opt for bundling it into their repo, and then a relative path makes sense, and it is out-of-scope either way.
I’m just leaving it here for future reference.


Very good suggestion. I created a task to add package.json in our distributions.