-
Notifications
You must be signed in to change notification settings - Fork 9
Build web, node, and production bundle #16
Conversation
- Output bundles should be called index.node.js and index.web.js to match the TS declaration files - plugin-transform-runtime was causing runtime errors. I removed it since it didn't seem to have an effect on the bundle size anyways
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did a quick scan, looks quite good 👍
@@ -0,0 +1 @@ | |||
const { SkynetClient } = require(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this wasn't meant to be committed lol. The deploy script is a separate PR
if (!portalUrl) { | ||
portalUrl = defaultPortalUrl(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need that, you already have that in the argument list
if (!portalUrl) { | |
portalUrl = defaultPortalUrl(); | |
} |
const opts = { ...defaultDownloadOptions, ...this.customOptions, ...customOptions }; | ||
const url = this.getSkylinkUrl(skylinkUrl, opts); | ||
|
||
window.open(url, "_blank"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might need to add noopener and noreferrer to this so it's safer
https://web.dev/external-anchors-use-rel-noopener/
https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/noreferrer
https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/noopener
const url = this.getHnsUrl(domain, opts); | ||
|
||
// Open the url in a new tab. | ||
window.open(url, "_blank"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same remark as with other window.open
const merkleroot = response.data.merkleroot; | ||
const bitfield = response.data.bitfield; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional tip: it's handy to use object destructuring assignment in such cases
const merkleroot = response.data.merkleroot; | |
const bitfield = response.data.bitfield; | |
const { merkleroot, bitfield } = response.data; |
Closing. Don't think we'll ever get back to this, especially with |
I've moved to Webpack and created two separate targets for
node
anddev
.Original PR: NebulousLabs/skynet-js#338
Closes #7
TODO (followup PRs)
Production build deploy
skynet-js
HNS. I plan to include adeploy.js
script in the repo which uses the Node version of the library itself to upload the production file and save the skylink to the registry. (Get the full, descriptive error response returned from skyd #351)Update docs
File
and the latter lacks access to the local filesystem)