pnpm-sync-dependencies-meta-injected v0.0.14
pnpm-sync-dependencies-meta-injected
- Do you use
dependenciesMeta.*.injected = true? - Are you tired of the fight against the balance between ergonomics and "dependencies being correct"?
This package will solve all your problems!
Setup
Install the dependency.
pnpm i pnpm-sync-dependencies-meta-injected -DIn each of your projects that declare a
dependenciesMeta.*.injected = true, add a_syncPnpmscript in your package.json:"_syncPnpm": "pnpm sync-dependencies-meta-injected"In each of your projects that includes
_syncPnpm, re-configure your project'sstartcommand to run_syncPnpmin watch mode so that you can continually work on your injected dependencies and have updates automatically re-synced as they are built."start": "concurrently 'ember serve' 'pnpm _syncPnpm --watch' --names 'tests serve,tests sync deps'",By using
concurrently, we can run our dev server as well as the_syncPnpmtask in watch mode in parallel.
If you use turborepo
When using turborepo, we can automatically sync the injected dependencies for all tasks defined in turbo.json
In your
turbo.json, configure a_syncPnpmtask:"_syncPnpm": { "dependsOn": ["^build"], "cache": false },It must not have a cache, because we need to modify the
.pnpmdirectory in the top-levelnode_modulesfolder.In your
turbo.json, configure each task that relies on^buildto also rely on_syncPnpm(no^) -- this, combined with the above will sync the hard links thatpnpmuses fordependenciesMeta.*.injectedafter the dependencies are built."test": { "outputs": [], - "dependsOn": ["^build"] + "dependsOn": ["_syncPnpm"] }, "build": { "outputs": ["dist/**"], - "dependsOn": ["^build"] + "dependsOn": ["_syncPnpm"] }, // etc
Debug
Add
DEBUG=sync-pnpmbefore the invocation.
Example of adding to the package.json#scripts
"_syncPnpm": "DEBUG=sync-pnpm pnpm sync-dependencies-meta-injected"Or on-the-fly:
DEBUG=sync-pnpm pnpm _syncPnpm