rules_nodejs icon indicating copy to clipboard operation
rules_nodejs copied to clipboard

Include `.bin` in `npm_install` and `yarn_install`

Open kriswuollett opened this issue 4 years ago • 4 comments

🚀 feature request

Relevant Rules

npm_install, yarn_install

Description

I currently cannot directly use the yarn_install repo :node_modules when building a container_layer for deploying a NextJS app in a container with a the start command yarn start. The root node_modules/.bin is missing.

Describe the solution you'd like

Include the root .bin directory in npm_install, yarn_install when referencing the :node_modules. The use case would be wrapping everything up in the end like:

# Combine tars generated from genrule (to run next build) or pkg_tar
container_image(
    name = "image",
    base = "@node_alpine_16_13//image",
    cmd = ["yarn", "start"],
    data_path = "/",
    env = {
        "NODE_ENV": "production",
    },
    ports = ["3000"],
    tars = [
        ":app-node-modules.tar",
        ":app-static",
        ":app-next.tar",
    ],
    workdir = "/app/",
)

Or is there another suggested method for packaging up an app that is not completely Bazel-ified? Is there a reason why it needs to be excluded?

My debugging session repo for figuring out .bin was missing.

Describe alternatives you've considered

Symlink the individual .bin files manually.

kriswuollett avatar Dec 05 '21 21:12 kriswuollett

what is the status of this bug? any workaround to generate .bin folder in node_modules?

pmdawood avatar Jan 11 '22 16:01 pmdawood

@kriswuollett @alexeagle any workaround to generate .bin folder in node_modules?

pmdawood avatar Jan 11 '22 17:01 pmdawood

I don't have a workaround at the moment. I'm just not using Bazel for NextJS projects.

kriswuollett avatar Jan 11 '22 19:01 kriswuollett

This issue has been automatically marked as stale because it has not had any activity for 6 months. It will be closed if no further activity occurs in 30 days. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!

github-actions[bot] avatar Jul 14 '22 03:07 github-actions[bot]

This issue was automatically closed because it went 30 days without any activity since it was labeled "Can Close?"

github-actions[bot] avatar Aug 14 '22 03:08 github-actions[bot]