GoogleContainerTools/skaffold

How to sync node_modules

オープン

#5,029 opened on 2020/11/14

 (5 件のコメント) (1 件のリアクション) (0 人の担当者)Go (1,416 件のフォーク)batch import
area/synchelp wantedkind/feature-requestpriority/p3

Repository metrics

Stars
 (12,822 個のスター)
PR merge metrics
 (平均マージ 3d 6h) (30d で 16 merged PRs)

説明

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"]

コントリビューターガイド