Skip to content

Commit

Permalink
Build/better gen (#132)
Browse files Browse the repository at this point in the history
* build: directly generate js libs to node_modules

Roll back stellar/soroban-example-dapp#122, but
keep `crowdfund-contract` and `abundance-token` in
`optionalDependencies`.

As I worked with the old version in earnest, iterating on a local copy
of the CLI and generating new JS libs over and over, the two-step
generate-to-.soroban, then install-to-node_modules wasn't working very
well. Probably because the new library wasn't being added until the
`postinstall` step, and the dependencies are optional.

Generating directly to `node_modules` feels dirty, but it works
consistently. At least in this version, you can still see the
dependencies listed in the `optionalDependencies` section, so they're
not quite as surprising/mysterious.

* build: try adding back optionalDeps

* build: update node; use preinstall and local deps

* Update package-lock.json

* work around a bug in the binding gen

---------

Co-authored-by: Chad Ostrowski <[email protected]>
  • Loading branch information
maxymkotko and chadoh committed Aug 11, 2023
1 parent 58044bd commit 9360d76
Show file tree
Hide file tree
Showing 6 changed files with 413 additions and 3,757 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock.json linguist-generated=true -diff
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- run: cargo install_soroban
- uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 18.14.2
cache: 'npm'
- run: |
mkdir -p .soroban-example-dapp
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
>=18.14.2
8 changes: 3 additions & 5 deletions components/molecules/form-pledge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ function MintButton({ account, symbol, onComplete, decimals }: { decimals: numbe
const [isSubmitting, setSubmitting] = useState(false)

const displayAmount = 100
const amount = BigInt(displayAmount * 10**decimals)
const amount = BigInt(displayAmount * 10 ** decimals)

return (
<Button
title={`Mint ${displayAmount} ${symbol}`}
onClick={async () => {
setSubmitting(true)
await abundance.mint({ to: account, amount }, { signAndSend: true })
await abundance.mint({ to: account, amount })
setSubmitting(false)
onComplete()
}}
Expand Down Expand Up @@ -80,9 +80,7 @@ const FormPledge: FunctionComponent<IFormPledgeProps> = props => {
try {
await deposit({
user: props.account,
amount: BigInt(amount * 10**decimals),
}, {
signAndSend: true
amount: BigInt(amount * 10 ** decimals),
})

setResultSubmit({
Expand Down
Loading

0 comments on commit 9360d76

Please sign in to comment.