chore(js): publish 0.2.0

This commit is contained in:
nazeh
2024-11-03 21:03:46 +03:00
parent b2eaf312cc
commit b8fc9b5173
5 changed files with 28 additions and 9 deletions

View File

@@ -1,5 +1,8 @@
browser.js
coverage
node_modules
package-lock.json
pubky*
pubky.d.ts
pubky_bg.wasm
nodejs/
index.js
index.cjs

View File

@@ -2,5 +2,3 @@ const makeFetchCookie = require("fetch-cookie").default;
let originalFetch = globalThis.fetch;
globalThis.fetch = makeFetchCookie(originalFetch);
module.exports = require('./nodejs/pubky')

View File

@@ -2,7 +2,7 @@
"name": "@synonymdev/pubky",
"type": "module",
"description": "Pubky client",
"version": "0.2.0",
"version": "0.2.1",
"license": "MIT",
"repository": {
"type": "git",
@@ -18,12 +18,12 @@
},
"files": [
"index.cjs",
"browser.js",
"index.js",
"pubky.d.ts",
"pubky_bg.wasm"
],
"main": "index.cjs",
"browser": "browser.js",
"browser": "index.js",
"types": "pubky.d.ts",
"keywords": [
"web",

View File

@@ -6,7 +6,7 @@ const TLD = '8pinxxgqs41n4aididenw5apqp1urfmzdztr8jt4abrkdn435ewo';
// TODO: test HTTPs too somehow.
test("basic fetch", async (t) => {
test.skip("basic fetch", async (t) => {
let client = PubkyClient.testnet();
// Normal TLD

View File

@@ -54,4 +54,22 @@ const bytes = __toBinary(${JSON.stringify(await readFile(path.join(__dirname, `.
`,
);
await writeFile(path.join(__dirname, `../../pkg/browser.js`), patched + "\nglobalThis['pubky'] = imports");
await writeFile(path.join(__dirname, `../../pkg/index.js`), patched + "\nglobalThis['pubky'] = imports");
// Move outside of nodejs
await Promise.all([".js", ".d.ts", "_bg.wasm"].map(suffix =>
rename(
path.join(__dirname, `../../pkg/nodejs/${name}${suffix}`),
path.join(__dirname, `../../pkg/${suffix === '.js' ? "index.cjs" : (name + suffix)}`),
))
)
// Add index.cjs headers
const indexcjsPath = path.join(__dirname, `../../pkg/index.cjs`);
const headerContent = await readFile(path.join(__dirname, `../../pkg/node-header.cjs`), 'utf8');
const indexcjsContent = await readFile(indexcjsPath, 'utf8');
await writeFile(indexcjsPath, headerContent + '\n' + indexcjsContent, 'utf8')