Conversation
# [12.7.0-alpha.1](v12.6.4...v12.7.0-alpha.1) (2025-07-23) ### Bug Fixes * **deps:** get rid of warnings shown on initialising new d2 projects ([#929](#929)) ([f5b499f](f5b499f)), closes [#927](#927) [#927](#927) [#928](#928) [#928](#928) [#930](#930) [#930](#930) ### Features * support pnpm and other package managers ([9c81f35](9c81f35))
# [12.7.0-alpha.2](v12.7.0-alpha.1...v12.7.0-alpha.2) (2025-07-23) ### Bug Fixes * correct cli-app-script link ([1d889ff](1d889ff))
# [12.7.0-alpha.3](v12.7.0-alpha.2...v12.7.0-alpha.3) (2025-07-23) ### Bug Fixes * default to pnpm as a package manager ([2fb963f](2fb963f))
# [12.7.0-alpha.4](v12.7.0-alpha.3...v12.7.0-alpha.4) (2025-07-24) ### Bug Fixes * change hoist options for phantom app-shell dependencies ([ac9aa78](ac9aa78))
# [12.7.0-alpha.5](v12.7.0-alpha.4...v12.7.0-alpha.5) (2025-07-24) ### Bug Fixes * add styled-jsx to hoisted dependencies ([9e692bc](9e692bc))
# [12.7.0-alpha.6](v12.7.0-alpha.5...v12.7.0-alpha.6) (2025-07-24) ### Bug Fixes * change cli option for package manager to boolean '--pnpm' ([e971c3d](e971c3d))
# [12.7.0-alpha.7](v12.7.0-alpha.6...v12.7.0-alpha.7) (2025-07-24) ### Bug Fixes * default args to undefined not 'false' to avoid conflict ([2b54a06](2b54a06))
# [12.7.0-alpha.8](v12.7.0-alpha.7...v12.7.0-alpha.8) (2025-07-24) ### Bug Fixes * recommend the use of 'pnpm' as a warning on init command ([e0cda6d](e0cda6d))
# [12.7.0-alpha.9](v12.7.0-alpha.8...v12.7.0-alpha.9) (2025-07-24) ### Bug Fixes * capitalise log messages ([e480586](e480586))
| )} to ${path.relative(paths.base, srcNodeModules)}...` | ||
| ) | ||
| await fs.ensureSymlink(srcNodeModules, destNodeModules) | ||
| fs.ensureSymlinkSync(srcNodeModules, destNodeModules) |
There was a problem hiding this comment.
this - and other fs.xSync calls - fix a race condition that happened before the first time we run start where the symlink is sometimes not yet created
# [12.7.0-alpha.10](v12.7.0-alpha.9...v12.7.0-alpha.10) (2025-07-24) ### Bug Fixes * ensure app-shell symlink is created to avoid race conditon ([223350e](223350e)) * ensure npm works as well as pnpm ([2975d2e](2975d2e))
# [12.7.0-alpha.11](v12.7.0-alpha.10...v12.7.0-alpha.11) (2025-07-24) ### Bug Fixes * race condition with symlinks ([fe2d496](fe2d496))
# [12.7.0-alpha.12](v12.7.0-alpha.11...v12.7.0-alpha.12) (2025-07-24) ### Bug Fixes * add corepack packageManager field ([acb4ac0](acb4ac0))
# [12.7.0-alpha.15](v12.7.0-alpha.14...v12.7.0-alpha.15) (2025-07-28) ### Bug Fixes * hoist dependencies needed for plugins and PWAs ([fa91bc5](fa91bc5))
# [12.8.0-alpha.1](v12.7.0...v12.8.0-alpha.1) (2025-07-28) ### Bug Fixes * add corepack packageManager field ([acb4ac0](acb4ac0)) * add styled-jsx to hoisted dependencies ([9e692bc](9e692bc)) * capitalise log messages ([e480586](e480586)) * change cli option for package manager to boolean '--pnpm' ([e971c3d](e971c3d)) * change hoist options for phantom app-shell dependencies ([ac9aa78](ac9aa78)) * correct cli-app-script link ([1d889ff](1d889ff)) * default args to undefined not 'false' to avoid conflict ([2b54a06](2b54a06)) * default to pnpm as a package manager ([2fb963f](2fb963f)) * ensure app-shell symlink is created to avoid race conditon ([223350e](223350e)) * ensure npm works as well as pnpm ([2975d2e](2975d2e)) * expose init command in the package ([cc8b7f5](cc8b7f5)) * force alpha release to npm ([78a2e69](78a2e69)) * hoist dependencies needed for plugins and PWAs ([fa91bc5](fa91bc5)) * race condition with symlinks ([fe2d496](fe2d496)) * recommend the use of 'pnpm' as a warning on init command ([e0cda6d](e0cda6d)) ### Features * support pnpm and other package managers ([9c81f35](9c81f35))
|
23701f5 to
79392dc
Compare
# [12.8.0-alpha.2](v12.8.0-alpha.1...v12.8.0-alpha.2) (2025-10-29) ### Bug Fixes * allow passing a reporter to init command ([ca36333](ca36333))
This reverts commit ca36333.
# [12.8.0-alpha.3](v12.8.0-alpha.2...v12.8.0-alpha.3) (2025-10-29) ### Bug Fixes * Revert "fix: allow passing a reporter to init command ([6028374](6028374))
|
| } | ||
|
|
||
| const handler = async ({ force, name, cwd, lib, typeScript }) => { | ||
| const handler = async ({ force, pnpm, npm, name, cwd, lib, typeScript }) => { |
There was a problem hiding this comment.
Add warning to use pnpm create @dhis2/app instead?
| const paths = require('../paths') | ||
|
|
||
| const isNpmProject = () => { | ||
| return paths.npmLock !== null | ||
| } | ||
|
|
||
| module.exports = isNpmProject |
There was a problem hiding this comment.
Maybe check for packageManager field in package.json first?
(This might return an erroneous value if there are multiple lock files in a project, which happens)
|
|
||
| exports.validateLockfile = async (pkg, { paths, offerFix = false }) => { | ||
| if (paths.yarnLock === null) { | ||
| if (paths.yarnLock === null && !isPnpmProject() && !isNpmProject()) { |
There was a problem hiding this comment.
To do: Test if pnpm and npm run into singleton issue; test by upgrading UI or app-runtime to a version other than the app shell/adapter
KaiVandivier
left a comment
There was a problem hiding this comment.
🎉🎉🎉🎉🎉🎉🎉
🥳 🥳 🥳 🥳 🥳 🥳
Some follow-ups in comments, and package manager option in CLI "create" wizard
Nice! 👏👏👏👏
# [12.11.0-alpha.1](v12.10.1...v12.11.0-alpha.1) (2026-01-13) ### Bug Fixes * add corepack packageManager field ([acb4ac0](acb4ac0)) * add styled-jsx to hoisted dependencies ([9e692bc](9e692bc)) * allow passing a reporter to init command ([ca36333](ca36333)) * capitalise log messages ([e480586](e480586)) * change cli option for package manager to boolean '--pnpm' ([e971c3d](e971c3d)) * change hoist options for phantom app-shell dependencies ([ac9aa78](ac9aa78)) * correct cli-app-script link ([1d889ff](1d889ff)) * default args to undefined not 'false' to avoid conflict ([2b54a06](2b54a06)) * default to pnpm as a package manager ([2fb963f](2fb963f)) * ensure app-shell symlink is created to avoid race conditon ([223350e](223350e)) * ensure npm works as well as pnpm ([2975d2e](2975d2e)) * expose init command in the package ([cc8b7f5](cc8b7f5)) * force alpha release to npm ([78a2e69](78a2e69)) * hoist dependencies needed for plugins and PWAs ([fa91bc5](fa91bc5)) * race condition with symlinks ([fe2d496](fe2d496)) * recommend the use of 'pnpm' as a warning on init command ([e0cda6d](e0cda6d)) * Revert "fix: allow passing a reporter to init command ([6028374](6028374)) ### Features * support pnpm and other package managers ([9c81f35](9c81f35))
|
|
🎉 This PR is included in version 12.10.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |







This PR decouples the dependency of
cli-app-scriptsonyarn@v1allowing apps and consumers of the CLI to use more modern package managers such aspnpm(or evennpm).d2-with-pnpm.webm
relates to the CLI PR: dhis2/cli#629
implements https://dhis2.atlassian.net/browse/LIBS-800
Some notes:
yarn@1and should behave the same as before. Users are able to pass a--pnpmargument to opt for usingpnpminstead.pnpm, the dependencies of a new a project are installed using the specified package manager, and the lock file updated.pnpm, we needed to public hoist in order to make phantom dependencies of@dhis2/app-shellwork. These were used directly by the shell, and worked before because of the behaviour ofyarn 1(which was dropped in subsequentyarnversions) to hoist and make available all dependencies - at some point, we should look atapp-shellbehaviour in order to avoid the issue, but for now, this works without issues for consumers.packageManagerfield topackage.json- this enables consumers to know what package manager to use and install it with corepack (which is available for modern node version from 14+) .To test:
pnpm i -g @dhis2/cli@alpha(you can usenpmoryarnif you'd like)d2 app scripts init sample --pnpmcorepack enable- this is just convenient and good practice in general.pnpm start,pnpm buildpnpm test....--pnpmflag to ensure things work withyarnas before.