Skip to content

Commit

Permalink
docs: update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
xseman committed Aug 1, 2024
1 parent fe8c327 commit f72c97c
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 54 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ Since `v1.28+` import from npm registry using `npm:` prefix.
import {
decode,
encode,
} from "npm:bysquare@2.8.0";
} from "npm:bysquare@latest";
```

### Browser

```html
<script type="module">
import { encode, decode } from "https://esm.sh/bysquare@2.8.0/";
import { encode, decode } from "https://esm.sh/bysquare@latest";
</script>
```

Expand Down
3 changes: 2 additions & 1 deletion docs/examples/deno/deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"lock": false,
"tasks": {
"dev": "deno run --watch --allow-all --reload --unstable ./main.ts"
"dev": "deno run --watch --allow-all --reload ./main.ts"
}
}
37 changes: 0 additions & 37 deletions docs/examples/deno/deno.lock

This file was deleted.

9 changes: 6 additions & 3 deletions docs/examples/deno/main.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { generate } from "npm:bysquare@2.1.0";
import {
CurrencyCode,
encode,
} from "npm:bysquare";

const qr = await generate({
const qr = await encode({
invoiceId: "random-id",
payments: [
{
type: 1,
amount: 100.0,
bankAccounts: [{ iban: "SK9611000000002918599669" }],
currencyCode: "EUR",
currencyCode: CurrencyCode.EUR,
variableSymbol: "123",
},
],
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"start": "tsx server.ts"
},
"dependencies": {
"bysquare": "2.4.0",
"bysquare": "latest",
"express": "~4.18.0"
},
"devDependencies": {
Expand Down
11 changes: 5 additions & 6 deletions docs/examples/express/server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// import { DataModel, generate, PaymentOptions } from "./../../../dist/index.js"
// import { DataModel, encode, PaymentOptions } from "./../../../dist/index.js"
import {
DataModel,
generate,
encode,
PaymentOptions,
} from "bysquare";
import express from "express";
Expand Down Expand Up @@ -32,12 +32,11 @@ const app = express();
app.use("/", publicFolder);

app.get("/qr", async (_req, res) => {
const qrstring = await generate(model);
const qrstring = await encode(model);
console.log(qrstring);
res.send(qrstring);
});

const port = 4_000;
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`);
app.listen(4_000, () => {
console.log(`Example app listening at http://localhost:${4_000}`);
});
2 changes: 1 addition & 1 deletion docs/examples/web/basic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
CurrencyCode,
encode,
PaymentOptions,
} from "https://esm.sh/bysquare@2.8.3/";
} from "https://esm.sh/bysquare@latest/";
import { qrcanvas } from "https://esm.sh/qrcanvas@3.1.2/";

function getEncodedText(iban, amount, variable) {
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/web/lit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import {
CurrencyCode,
encode,
PaymentOptions,
} from "https://esm.sh/bysquare@2.7.1/";
} from "https://esm.sh/bysquare@latest/";
import {
html,
LitElement,
} from "https://esm.sh/lit@3.0.0/";
} from "https://esm.sh/lit@3.1.0/";
import { qrcanvas } from "https://esm.sh/qrcanvas@3.1.2/";

/**
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/web/preact/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
CurrencyCode,
encode,
PaymentOptions,
} from "https://esm.sh/bysquare@2.7.1/";
} from "https://esm.sh/bysquare@latest/";
import {
Component,
createRef,
Expand Down

0 comments on commit f72c97c

Please sign in to comment.