Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Bundling the Prisma Client together with a SvelteKit build

$
0
0

I am using SvelteKit and the Typescript package Prisma Client together. Prisma Client is a dependency that has to be generated before the app can run. Generating the Prisma Client and then running the development version with npm run dev works.

But when I build with npm run build, I cannot run the app with node without doing another npm install for the Prisma Client with npx prisma generate.

I'm using the following (probably very verbose) Gitlab gitlab-ci.yaml job script to do an extra npm install step:

deploy:  image: alpine  before_script:  - apk update && apk add openssh-client rsync  script:  - mkdir -p ~/.ssh  - eval "$(ssh-agent -s)"  - echo "$PRIVATE_KEY" | ssh-add -  - ssh-keyscan -H $WEB_SERVER_IP >> ~/.ssh/known_hosts  - rsync -chavzP --stats . "root@$WEB_SERVER_IP:~/dsp-app"       - ssh root@$WEB_SERVER_IP "cd $FOLDER; npm install"  - ssh root@$WEB_SERVER_IP "cd $FOLDER; npx prisma generate --schema src/lib/backend/prisma/schema.prisma"  - ssh root@$WEB_SERVER_IP "cd $FOLDER; npm run build"  - ssh root@$WEB_SERVER_IP "cd $FOLDER; pm2 delete index 2> /dev/null || true"  - ssh root@$WEB_SERVER_IP "cd $FOLDER; pm2 startup"  - ssh root@$WEB_SERVER_IP "cd $FOLDER; pm2 start -f build/index.js  --watch"  - ssh root@$WEB_SERVER_IP "cd $FOLDER; pm2 save"

The npm install step seems to be redundant, however. Is there a way to bundle the Prisma Client with npm build (and then transfer the build to the server), so I don't have to do another npm install on the production server which runs node?

This question is similar to Prisma 2.0 Beta Deploy but answer there didn't show how to do this.


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>