stellar / soroban-example-dapp

End-to-End Example Soroban Dapp
Apache License 2.0
1.03k stars 829 forks source link

build: directly generate js libs to node_modules #130

Open chadoh opened 11 months ago

chadoh commented 11 months ago

What

Roll back https://github.com/stellar/soroban-example-dapp/pull/122, but keep crowdfund-contract and abundance-token in optionalDependencies.

This also adds a .gitattributes to suppress package-lock.json diffs.

Why

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, compared to the one before #122, you can still see the dependencies listed in the optionalDependencies section, so they're not quite as surprising/mysterious.

chadoh commented 11 months ago

@tyvdh how's this look to you?

chadoh commented 11 months ago

npm ci breaking in ci but not locally (╯°□°)╯︵ ┻━┻

chadoh commented 11 months ago

@tyvdh the build finally passes 😅

kalepail commented 11 months ago

Looks like the deps are once again completely absent from package.json?

chadoh commented 11 months ago

@tyvdh yes I was just looking into that; looks like they got removed from main here https://github.com/stellar/soroban-example-dapp/pull/127

I just added a commit that tries adding them back. Getting npm ci to actually pass on CI was quite difficult; we'll see if it works 🤞🏼

kalepail commented 11 months ago

I just find it hard to believe there isn't a way to handle local packages. How are actual npm packages handling this with CI/CD flows?

kalepail commented 11 months ago

Maybe helpful? https://github.com/nodejs/node/issues/46542#issuecomment-1420780830

chadoh commented 11 months ago

Good find; trying it out with the latest commit