Need Monorepo support
Monorepo is becoming more and more popular repo style in Node.js ecosystem. It support the developers could arrange the packages as they want and link them together.
The current s2i steps looks not support monorepo. I can show some example which I met
the monorepo folders are like this
- packages/
- foo/
- src/
- README.md
- package.json
- bar/
- src/
- README.md
- package.json
- foo/
- .eslintrc
- package.json
Some common devDependencies had been install to the root package.json. like eslint, typescript and others
So the foo and bar won't need to install them.
If I need build the foo only, For current s2i workflow, I have 2 choice.
1 Use git contextDir
- Clone the repo and set the
contextDirtofoo. - Run
npm run build, however, some dependencies only installed in root, so we will got error
2. Hack the build scripts
- Clone the repo from root
- Install all dependencies, and add post install to install all dependencies in child
packages - Add some env vars to make
buildscript could detect which package I want to build
Solution
I think the only way to fix this issue for now is make the build command to a env vars. make user could custom it(Like $NPM_RUN)
Add a $NPM_BUILD might be the most easy way to resolve it
I was kindof assuming that the NPM_RUN env var would be doing that. iow if present run an alternative build script during openshift Build and running an alternatif start script for the openshift Deploy. But this indeed doesn't seem to be the case.
Hi @kunyan, do you consider this issue fixed by https://github.com/sclorg/s2i-nodejs-container/pull/424 being merged?
@zmiklank $NPM_BUILD is a good for some monorepo use nx or lerna