Skip to content

Commit

Permalink
feat(deploy): create dedicated lockfile (#8828)
Browse files Browse the repository at this point in the history
* feat(deploy): create dedicated lockfile

Closes #8778

* chore: remove a leftover `console.log`

* fix: hoisted should also use dedicated lockfile

* feat: inherit more keys

* docs(changeset): more details

* refactor: remove a variable

* refactor: use `selectedProject.rootDir`

* fix: manifest files

* fix: update lockfile

* fix: accidentally skipped normal dependencies

* test: update

* fix: meta

* fix: remove links to nowhere

* docs: remove the false todo

* fix: transitive workspace dependencies

* fix: package snapshot names

* fix: dependencies that depend on deployed package

* perf: do not repeat computation

* fix: compile error

* refactor: base on allProjects

* fix: add missing `link:` prefix

* test: add some tests

* fix: revert stupid refactor

This reverts commit 0007881.

* test: more assertions

* test: more assertions

* test: #8778

* test: exact paths

* refactor: use `toBe`

* refactor: divide section

* fix: eslint

* test: fix assertions

* fix: dependencies that depend on deploy package

* perf: cheap operation first

* test: remove `.only`

* test: add assertions

* test: remove unnecessary assertions

* test: remove unnecessary details

* fix: deployed package depends on itself

* docs: remove the other todo

* fix: self-referential dependencies

* test: fix

* test: more assertions

* feat: convert fallbacks to programmer errors

* fix: `file:` protocol

* refactor: more types

* refactor: remove unused variables

* refactor: fix regex

* feat: force-legacy-deploy

* feat: suggest reporting bug and using workaround

* feat: overrides, patchedDependencies, packageExtensions (wip)

* test: fix

* feat: handle `packageExtensions` in a smarter way

* fix: pnpmfile

* docs: change wording

* fix: `packageExtensions` with internal dependencies

* fix: directory resolution location

* refactor: use `rootProjectManifestDir`

* feat: set `overrides` to `undefined` instead

* refactor: remove `as ProjectRootDirRealPath`

* test: packageExtensions

* test: use regex string matchers

* refactor: move new tests to its own file

* fix: patchedDependencies

* fix: eslint

* test: patchedDependencies

* test: fix windows

* fix: pnpmfile checksum

* docs: change wording

* fix: peer dependencies

* docs: omission of peers

* docs: more detailed explanation

* fix: preserve unique peer dependencies suffix

* refactor: code rearrange

* refactor: shorten lines of code

* feat: add `dedupeInjectedDeps` to `InstallCommandOptions`

* test: peer dependencies suffix

* docs(changeset): config -> force-legacy-deploy

* docs(changeset): merge

* docs(changeset): add missing period
  • Loading branch information
KSXGitHub authored Dec 27, 2024
1 parent 09c1ffb commit f891288
Show file tree
Hide file tree
Showing 15 changed files with 1,503 additions and 64 deletions.
7 changes: 7 additions & 0 deletions .changeset/shy-countries-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@pnpm/config": minor
"@pnpm/plugin-commands-deploy": minor
"pnpm": minor
---

`pnpm deploy` now tries creating a dedicated lockfile from a shared lockfile for deployment. It will fallback to deployment without a lockfile if there is no shared lockfile or `force-legacy-deploy` is set to `true`.
6 changes: 6 additions & 0 deletions .changeset/swift-shirts-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@pnpm/plugin-commands-deploy": patch
"pnpm": patch
---

Fix an issue in which `pnpm deploy --prod` fails due to missing `devDependencies` [#8778](https://github.com/pnpm/pnpm/issues/8778).
5 changes: 5 additions & 0 deletions .changeset/tough-eyes-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pnpm/plugin-commands-installation": minor
---

Add `dedupeInjectedDeps` to `InstallCommandOptions`.
1 change: 1 addition & 0 deletions config/config/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export interface Config {
failedToLoadBuiltInConfig: boolean
resolvePeersFromWorkspaceRoot?: boolean
deployAllFiles?: boolean
forceLegacyDeploy?: boolean
reporterHidePrefix?: boolean

// proxy
Expand Down
1 change: 1 addition & 0 deletions config/config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export async function getConfig (opts: {
'fetch-retry-maxtimeout': 60000,
'fetch-retry-mintimeout': 10000,
'fetch-timeout': 60000,
'force-legacy-deploy': false,
'git-shallow-hosts': [
// Follow https://github.com/npm/git/blob/1e1dbd26bd5b87ca055defecc3679777cb480e2a/lib/clone.js#L13-L19
'github.com',
Expand Down
1 change: 1 addition & 0 deletions config/config/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const types = Object.assign({
'fetching-concurrency': Number,
filter: [String, Array],
'filter-prod': [String, Array],
'force-legacy-deploy': Boolean,
'frozen-lockfile': Boolean,
'git-checks': Boolean,
'git-shallow-hosts': Array,
Expand Down
1 change: 1 addition & 0 deletions pkg-manager/plugin-commands-installation/src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ export type InstallCommandOptions = Pick<Config,
| 'bin'
| 'catalogs'
| 'cliOptions'
| 'dedupeInjectedDeps'
| 'dedupeDirectDeps'
| 'dedupePeerDependents'
| 'deployAllFiles'
Expand Down
73 changes: 28 additions & 45 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions releasing/plugin-commands-deploy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,32 @@
"homepage": "https://github.com/pnpm/pnpm/blob/main/releasing/plugin-commands-deploy#readme",
"devDependencies": {
"@pnpm/assert-project": "workspace:*",
"@pnpm/lockfile.types": "workspace:*",
"@pnpm/logger": "workspace:*",
"@pnpm/plugin-commands-deploy": "workspace:*",
"@pnpm/prepare": "workspace:*",
"@pnpm/registry-mock": "catalog:",
"@pnpm/workspace.filter-packages-from-dir": "workspace:*"
"@pnpm/test-fixtures": "workspace:*",
"@pnpm/workspace.filter-packages-from-dir": "workspace:*",
"@types/ramda": "catalog:"
},
"dependencies": {
"@pnpm/catalogs.resolver": "workspace:*",
"@pnpm/catalogs.types": "workspace:*",
"@pnpm/cli-utils": "workspace:*",
"@pnpm/config": "workspace:*",
"@pnpm/common-cli-options-help": "workspace:*",
"@pnpm/directory-fetcher": "workspace:*",
"@pnpm/error": "workspace:*",
"@pnpm/fs.indexed-pkg-importer": "workspace:*",
"@pnpm/fs.is-empty-dir-or-nothing": "workspace:*",
"@pnpm/lockfile.fs": "workspace:*",
"@pnpm/lockfile.types": "workspace:*",
"@pnpm/plugin-commands-installation": "workspace:*",
"@pnpm/types": "workspace:*",
"@types/normalize-path": "catalog:",
"@zkochan/rimraf": "catalog:",
"normalize-path": "catalog:",
"ramda": "catalog:",
"render-help": "catalog:"
},
"peerDependencies": {
Expand Down
Loading

0 comments on commit f891288

Please sign in to comment.