Skip to content

Fix api.js in typescript version#40

Merged
alanshaw merged 10 commits intostoracha:mainfrom
mabels:main
Apr 4, 2025
Merged

Fix api.js in typescript version#40
alanshaw merged 10 commits intostoracha:mainfrom
mabels:main

Conversation

@mabels
Copy link
Copy Markdown
Contributor

@mabels mabels commented Mar 19, 2025

Hi,

I got this error:

The requested module 'multiformats' does not provide an export named 'Block' from pail

this was happening because, besides api.js, the .d.ts was not in the same directory, which confused tsx.

To fix it I changed the exports in package.json and the emitRule of tsc to only use the emitted file structure.

SideTrack:

I updated the package.json, and with that, the test infra to use vitest. I hope that is not a problem --
if you want to stick with mocha and coverage -> I am not happy but could rewind -> but than the
typescript is required to the test infra -> due to the removal of the api.js which causes this problem in the
first place.

I run standard --fix, which also fixes the formatting that's why so much files.

import { Link, UnknownLink, BlockView, Block, Version } from 'multiformats'
import type { Version } from 'multiformats'
import type { Link, UnknownLink } from 'multiformats/link/interface'
import type { Block, BlockView } from 'multiformats/block/interface'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alanshaw I'd start reading here

alanshaw
alanshaw previously approved these changes Apr 2, 2025
@alanshaw alanshaw dismissed their stale review April 2, 2025 10:33

Build failures

Copy link
Copy Markdown
Member

@alanshaw alanshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please could you resolve the build errors?

@mabels
Copy link
Copy Markdown
Contributor Author

mabels commented Apr 2, 2025

thx --- i will look into it --- thx for enabling the CI

@mabels
Copy link
Copy Markdown
Contributor Author

mabels commented Apr 2, 2025

@alanshaw, Sorry for not building on my side before --- I just forgot to double-check.

I now removed the src tree from the published artifact and installed these scripts:

  • pail-gen (gen.js)
  • pail (as before)
  • pail-randomcid (randomcid.js)
  • pail-propernames (broken as it is in the current repo --- i could not easily fix it, i missed the part of randomcid)

@alanshaw
Copy link
Copy Markdown
Member

alanshaw commented Apr 2, 2025

Can you fix the new lockfile issue in CI?

@mabels
Copy link
Copy Markdown
Contributor Author

mabels commented Apr 2, 2025

i'm so used to have a working CI on every commit --- so i missed to commit the changed pnpm.lock

@alanshaw
Copy link
Copy Markdown
Member

alanshaw commented Apr 3, 2025

@mabels we can probably drop Node.js 18 (seeing as it is EOL at the end of the month) and add 22.

@mabels
Copy link
Copy Markdown
Contributor Author

mabels commented Apr 4, 2025

@alanshaw I left the node 18 test but improved the root cause:

export async function randomBytes (size) 

it's not nice, but working(hopefully)

@alanshaw alanshaw merged commit 5620002 into storacha:main Apr 4, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants