Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ESM/CJS problems #112

Merged
merged 20 commits into from
Aug 15, 2022
Merged

Conversation

0x009922
Copy link
Contributor

@0x009922 0x009922 commented Jul 31, 2022

List of changes

  • Fix @iroha2/crypto-target-web@iroha2/crypto-core dependency - change dev to prod

  • Define packages exports with exports field too. Also use .mjs for ESM and .cjs for CJS bundles.

  • Drop API Extractor and esbuild. Use rollup for everything.

    API Extractor broke after moving to tsconfig paths monorepo approach. It was done to define actual packages main/module/exports fields in their package.json. I moved to Rollup and rollup-plugin-dts.

    esbuild doesn't eliminate dead code in case like if (undefined) - proof. It brokes in-source testing by Vitest. Thus, I moved again to Rollup.

  • Drop @iroha2/client-isomorphic-*. Instead client library provides additional entrypoints for isomorphic adapters, like it is done at isomorphic-git.

    For WebSocket, it has 2 entrypoints:

    // where native `WebSocket` exists
    import { adapter } from '@iroha2/client/web-socket/native'
    
    // Uses `ws` package for node.js
    import { adapter } from '@iroha2/client/web-socket/node'
    
    new Client({ ws: adapter })

    fetch could be provided in the same way, but @iroha2/client does not provide it by itself. There are node-fetch and undici packages that could solve it:

    import { fetch } from 'undici'
    import fetch from 'node-fetch'
    
    new Client({ fetch })
  • E2e tests - Migrate to Cypress 10

Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
@0x009922 0x009922 added iroha2 package: client Related to Client package(-s) package: data model Related to Data Model package(-s) package: crypto Related to Crypto packages labels Jul 31, 2022
@0x009922 0x009922 linked an issue Aug 2, 2022 that may be closed by this pull request
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
packages/client/src/client.ts Outdated Show resolved Hide resolved
packages/client/src/client.ts Outdated Show resolved Hide resolved
packages/client/src/client.ts Outdated Show resolved Hide resolved
.changeset/friendly-months-fetch.md Outdated Show resolved Hide resolved
@0x009922 0x009922 force-pushed the fix/esm-cjs-modules branch 3 times, most recently from e50e38c to d644515 Compare August 12, 2022 09:56
0x009922 and others added 7 commits August 12, 2022 13:03
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Co-authored-by: Ekaterina Mekhnetsova <mekkatya@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Co-authored-by: Ekaterina Mekhnetsova <mekkatya@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Signed-off-by: Ekaterina Mekhnetsova <mekkatya@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Co-authored-by: 0x009922 <a.marcius26@gmail.com>
Signed-off-by: Ekaterina Mekhnetsova <mekkatya@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
@0x009922 0x009922 marked this pull request as ready for review August 12, 2022 10:04
Signed-off-by: 0x009922 <a.marcius26@gmail.com>
@0x009922 0x009922 merged commit a4f2152 into hyperledger:iroha2 Aug 15, 2022
@0x009922 0x009922 deleted the fix/esm-cjs-modules branch August 15, 2022 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iroha2 package: client Related to Client package(-s) package: crypto Related to Crypto packages package: data model Related to Data Model package(-s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix problem of Colleagues from Fujitsu
3 participants