wclr / yalc

Work with yarn/npm packages locally like a boss.
MIT License
5.64k stars 147 forks source link

yalc publish removes nested node_modules #243

Open cristian-eriomenco opened 4 months ago

cristian-eriomenco commented 4 months ago

Suppose you have a folder structure for your bundle as follows:

dist/components/index.js
dist/utils/index.js
dist/node_modules/somepackageA/index.js
dist/node_modules/somepackageB/dist/node_modules/sompackageC/index.js
dist/node_modules/somepackageB/index.js

Everything containing node_modules would end-up being removed once issuing yalc publish

One might ask why do you have node_modules ? Well for instance i use rollup with preserveModules: true

  output: [
    {
      dir: 'dist/esm',
      format: 'esm',
      preserveModules: true,
      preserveModulesRoot: 'src',
      sourcemap: true,
    },
    {
      dir: 'dist/cjs',
      format: 'cjs',
      preserveModules: true,
      preserveModulesRoot: 'src',
      sourcemap: true,
    },
  ],

Which would mimic the folder structure, but not only this. There are also deeply nested dependencies which also have node_modules eg: cache-manager which makes publishing impossible

michaelangeloio commented 3 weeks ago

@cristian-eriomenco yup, this is happening for us too.

Is there a way to override this?

michaelangeloio commented 3 weeks ago

@cristian-eriomenco yup, this is happening for us too.

Is there a way to override this?

https://github.com/wclr/yalc/blob/3b834e488837e87df47414fd9917c10f07f0df08/src/sync-dir.ts#L48

looks like it's not possible to override, it's literally hardcoded...