GoogleContainerTools/skaffold

How to sync node_modules

Ouverte

#5 029 ouverte le 14 nov. 2020

 (5 commentaires) (1 réaction) (0 personne assignée)Go (1 416 forks)batch import
area/synchelp wantedkind/feature-requestpriority/p3

Métriques du dépôt

Stars
 (12 822 étoiles)
Métriques de merge PR
 (Merge moyen 3j 6h) (16 PRs mergées en 30 j)

Description

Sometimes I need to link an npm package for developing multiple packages that depend on each other locally. (https://docs.npmjs.com/cli/v6/commands/npm-link)

I can't seem to get file sync to work with node_modules updates from package symlinks. I can confirm that the files in node_modules are updating but they are not being synced. I think it excludes node_modules initially using .dockerignore. If I exclude the scoped packages from the dockerignore (!node_modules/@scope) it then struggles to build the image because of a mkdir -p node_modules/@scope/package "already exists" error. If I rm -rf node_modules/@scope after installing for the image, the node_modules/@scope directory never seems to get built.

I have tried

    sync:
      infer:
      - '**/*.ts'
      # with this for node_modules/@scope/package/dist/file.js
      - '**/*.js'
      # or
      - 'node_modules/**/*.js'

Dockerfile

FROM node:14.15.0-alpine as base
WORKDIR /cache
COPY package.json .
COPY yarn.lock .
COPY .npmrc .
RUN yarn

FROM base as build
WORKDIR /app
COPY . ./
COPY --from=base /cache/node_modules /app/node_modules
EXPOSE 3000
CMD ["yarn", "start:dev"]

Guide contributeur