storacha / w3name

IPNS client and service for generating, updating, and tracking immutable names with signed updates
Other
45 stars 12 forks source link

whats the best way to import this currently? #16

Closed tabcat closed 2 years ago

tabcat commented 2 years ago

There doesn't seem to be a package published on npm as 'w3name' yet. I've installed it using github but haven't figured out the best way to import it this way.

if w3name isn't registered in npm yet it needs to be before someone decides to hijack it.

tabcat commented 2 years ago

My current solution is installing it as a package from github:

npm install w3name@web3-storage/w3name#602a20505158e558a1bfc31b6dd13e8bbb65977e

create a symlink ./node_modules/@w3name -> ./node_modules/w3name/packages

ln -s ./node_modules/w3name/packages ./node_modules/@w3name

add exports to @w3name/client package.json

  "exports": {
    ".": {
      "types": "./src/index.d.ts",
      "import": "./dist/src/index.js"
    },
    "./service": {
      "types": "./src/service.d.ts",
      "import": "./dist/src/service.js"
    }
  },

afterward cd into ./node_modules/w3name/packages/client and npm install && npm run build

tabcat commented 2 years ago

import * as Name from 'web3.storage/name'