shesek / spark-wallet

⚡️ A minimalistic wallet GUI for c-lightning, accessible over the web or through mobile and desktop apps.
MIT License
344 stars 77 forks source link

make client module build independently #169

Closed Legogris closed 3 years ago

Legogris commented 3 years ago

in clean environment:

cd spark-wallet/client && PATH=$PATH:./node_modules/.bin/ ./build.sh
+ shopt -s extglob
+ : dist
+ : production
+ : web
+ export BUILD_TARGET
+ export NODE_ENV
++ node -p 'require("../package").version'
+ export VERSION=0.2.16
+ VERSION=0.2.16
+ rm -rf 'dist/*'
+ mkdir -p dist dist/lib dist/fonts dist/swatch
+ [[ -d node_modules ]]
+ cp -r www/favicon.ico www/manifest www/notification.png dist/
+ cp -r 'fonts/node_modules/typeface-*' dist/fonts/
cp: cannot stat 'fonts/node_modules/typeface-*': No such file or directory

this fixes that.

CI failing addressed in #170

shesek commented 3 years ago

Can you try using npm run dist within the client directory? This will setup PATH correctly without having to do it manually, and also ensure that the PWD is the client directory.

I just tried this and it worked:

$ git clone https://github.com/shesek/spark-wallet
$ cd spark-wallet/client
$ npm run dist

Is it possible that you had a previous interrupted installation that left behind an incomplete node_modules directory?

shesek commented 3 years ago

@Legogris You should not have to install @babel/polyfill under client, it is already dependent on by the main package.

Make sure you run npm install in the main directory first, as described here.

Legogris commented 3 years ago

@shesek Thanks for following up! Left it in draft last night to come back with a fresh mind before submitting ;)

For context, I am attempting to fix this up for a containerized build for https://github.com/fiatjaf/sparko.

To verify:

docker run --rm -it  ubuntu:20.04 /bin/bash -c 'apt update && apt install -y git curl && (curl -sL https://deb.nodesource.com/setup_12.x -o- | bash) && apt install nodejs && git clone https://github.com/Legogris/spark-wallet.git && cd spark-wallet/client && git checkout fix-font-build && npm run dist'

So this will make client build independently, also as root.

shesek commented 3 years ago

@babel/polyfill seems to be the only thing missing to make the client module self-contained - would you agree to containing it here?

Yeah, sure, I can definitely add this to client/package.json if this makes things easier.

the issue had nothing to do with my initial commit. Since i ran this in a docker container as root, postinstall does not execute properly for npm install. I propose using npm --unsafe-perm, which fixes this.

For Spark's docker image, I'm using npm config set unsafe-perm true, which I find preferable to adding --unsafe-perm to npm install because it only affects the Docker environment and doesn't use unsafe perms when I'm running build.sh directly on my host.

Could you do this in your Dockerfile too?

Legogris commented 3 years ago

For Spark's docker image, I'm using npm config set unsafe-perm true, which I find preferable to adding --unsafe-perm to npm install because it only affects the Docker environment and doesn't use unsafe perms when I'm running build.sh directly on my host.

Could you do this in your Dockerfile too?

Make sense! Closing this in favor of https://github.com/shesek/spark-wallet/commit/46b789b90f2ac20f869cf1887a10470158435d99