Open jiz4oh opened 4 months ago
I would like to set something on package.json under each app and exclude anything in node_modules, but it's not working even if I set .projections.json as below
What exactly doesn't work? I just tried it with your .projections.json
and the following directory structure and it seems to work:
.
├── node_modules
├── packages
│ └── apps
│ ├── app-one
│ │ ├── node-modules
│ │ └── package.json
│ ├── app-three
│ │ ├── node-modules
│ │ └── package.json
│ └── app-two
│ ├── node-modules
│ └── package.json
└── package.json
Hi @bfrg, mostly of node modules has the package.json
and all of them will be set as a lib
due to
"package.json": {
"type": "lib",
"alternate": [
"pnpm-lock.yaml"
]
}
but I would like only set the app-one
app-two
app-three
except others which under node_modules
as the lib
If you know the prefix of each app, you can do this:
{
"packages/apps/app-*/package.json": {
"type": "lib",
"alternate": [
"pnpm-lock.yaml"
]
},
"package.json": {
"type": "lib",
"alternate": [
"pnpm-lock.yaml"
]
}
}
Alternatively, you can also specify a projection for each app:
{
"packages/apps/foo/package.json": {
"type": "lib",
"alternate": [
"pnpm-lock.yaml"
]
},
"packages/apps/bar/package.json": {
"type": "lib",
"alternate": [
"pnpm-lock.yaml"
]
},
"package.json": {
"type": "lib",
"alternate": [
"pnpm-lock.yaml"
]
}
}
This is certainly more cumbersome.
thank you for your advise, agreed with This is certainly more cumbersome
, so I expected the !packages/apps/*/node_modules&packages/apps/*/package.json
works that ignore the package.json
which under node_modules
It took me a while to figure out what the question actually was. I think the issue is that packages/apps/*/package.json
is treated by Projectionist as packages/apps/**/*/package.json
, and there's no way around this. And there's not really a good way to fix this without breaking backwards compatibility. You could maybe trick it by using package/**/apps/*/package.json
, which will make it recursive in a direction that probably won't match anything.
Note that !
and &
are for g:projectionist_heuristics
and can't be used here.
Hi @tpope, I have a project built by node and it has many microapps, and each apps has the same structure like
app-demo
withnode_modules
andpackage.json
I would like to set something on
package.json
under each app and exclude anything innode_modules
, but it's not working even if I set.projections.json
as belowand this will scan all the
node_modules
, it's too slow for mecould you help resolve this issue or is there any other way to ignore the
node_modules
?