Skip to content

Commit

Permalink
Bare js example app & updated docs (#38)
Browse files Browse the repository at this point in the history
* feat: added bare js example

* docs: updated readmes & added architecture.md

* docs: add TESTING.md

* chore: revert prettier on minified bundles

* chore: changeset

* chore: update size action
  • Loading branch information
alexlwn123 authored Sep 24, 2024
1 parent ec6f0c2 commit 6aae407
Show file tree
Hide file tree
Showing 17 changed files with 2,569 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/friendly-taxis-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@fedimint/core-web': patch
---

Added cursory documentation `/docs`
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
uses: preactjs/compressed-size-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pattern: '{**/dist/**/*.{js,mjs,cjs},**/*.wasm}'
pattern: '{packages/**/dist/**/*.{js,mjs,cjs},packages/**/*.wasm}'
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ pnpm-lock.yaml
tsconfig.base.json
packages/wasm-web/**
packages/wasm-bundler/**
examples/bare-js/**
tmp/**
*.html
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,21 @@ This monorepo is structured as a pnpm workspace. There are some helpful scripts
fedimint-web-sdk
├── README.md
├── examples
│ └── vite-core
│ ├── vite-core
│ └── bare-js
└── packages
├── core-web
└── react
├── react
├── wasm-web
└── wasm-bundler
```

### Packages

- [`core-web`](./packages/core-web/README.md): Provides a typescript interface for the Fedimint client wasm.
- `react`: TBD - React components and hooks for interacting with the Fedimint client
- [`wasm-web`](./packages/wasm-web/README.md): Not intended for direct use. Contains the wasm pack output (target web) for the Fedimint client wasm.
- [`wasm-bundler`](./packages/wasm-bundler/README.md): Not intended for direct use. Contains the wasm pack output (target bundler) for the Fedimint client wasm.

### Examples

Expand Down
25 changes: 25 additions & 0 deletions examples/bare-js/bundle.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import fs from 'fs'
import path from 'path'
import { createRequire } from 'module'

const require = createRequire(import.meta.url)
const CORE_LIB_DIST = path.dirname(require.resolve('@fedimint/core-web'))
const WASM_DIST = path.resolve(
CORE_LIB_DIST,
'../node_modules/@fedimint/fedimint-client-wasm',
)

function printErr(err) {
if (err) return console.log(err)
}

// fs.copyFile(path.resolve(CORE_LIB_DIST, 'index.js'), './index.js', printErr)
fs.copyFile(
path.resolve(CORE_LIB_DIST, '../src/worker/worker.js'),
'./worker.js',
printErr,
)
// fs.copyFile(path.resolve(WASM_DIST, 'fedimint_client_wasm_bg.wasm'), './fedimint_client_wasm_bg.wasm', printErr)

// fs.copyFile(path.resolve(WASM_DIST, 'fedimint_client_wasm.js'), './fedimint_client_wasm.js', printErr)
// fs.copyFile(path.resolve(WASM_DIST, 'fedimint_client_wasm_bg.js'), './fedimint_client_wasm_bg.js', printErr)
Loading

0 comments on commit 6aae407

Please sign in to comment.