Skarlinski
Skarlinski

Reputation: 2479

Heroku build for node app with unusual folder structure

The project is divided into a backend code and react native client code.

Both are sharing one github project. It looks like this:

 backend/

--- src/

--- package.json

 client/

--- src/

--- package.json

For my heroku instance, I want to run only the backend code, but at the same time want to use continues integration feature from github.

Is there a way to make heroku run npm install & start only from the backend folder?

Upvotes: 2

Views: 398

Answers (1)

hunterloftis
hunterloftis

Reputation: 13809

Create a package.json in the root of the whole project (the parent dir of backend). You can do this with npm init --yes.

Give that top-level package.json file two scripts:

"scripts": {
    "postinstall": "cd backend && npm install",
    "start": "cd backend && npm start"
}

Should do the trick.

Upvotes: 4

Related Questions