Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(place patches in json folder when pruning for docker) #4318

Merged
merged 1 commit into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions cli/integration_tests/prune/docker.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Setup
$ . ${TESTDIR}/../setup.sh
$ . ${TESTDIR}/setup.sh $(pwd)

$ ${TURBO} prune --scope=web --docker
Generating pruned monorepo for web in .*out (re)
- Added shared
- Added util
- Added web
Make sure patches are part of the json output
$ ls out/json
apps
package.json
packages
patches
pnpm-workspace.yaml

Make sure the pnpm patches section is present
$ cat out/json/package.json | jq '.pnpm.patchedDependencies'
{
"is-number@7.0.0": "patches/is-number@7.0.0.patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"build": "echo 'building'"
},
"dependencies": {
"is-number": "^7.0.0",
"shared": "workspace:*"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
"packageManager": "pnpm@7.25.1",
"devDependencies": {
"util": "workspace:*"
},
"pnpm": {
"patchedDependencies": {
"is-number@7.0.0": "patches/is-number@7.0.0.patch"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
diff --git a/index.js b/index.js
index 27f19b757f7c1186b92c405a213bf0dd9b6cbe95..24315132970b6299c9c158ef5fb75b2e9c0e633d 100644
--- a/index.js
+++ b/index.js
@@ -1,3 +1,4 @@
+// patch
/*!
* is-number <https://github.com/jonschlinkert/is-number>
*

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

9 changes: 9 additions & 0 deletions cli/internal/prune/prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,15 @@ func (p *prune) prune(opts *turbostate.PrunePayload) error {
); err != nil {
return errors.Wrap(err, "Failed copying patch file")
}
if opts.Docker {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to copy to both the full dir and the json dir, while the original suggestion was to copy to json instead of full. Is that on purpose?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, json should just be a subset of full. json is just what is needed to install and full is what is needed to use the scoped workspace

jsonDir := outDir.Join(turbopath.RelativeSystemPath("json"))
if err := fs.CopyFile(
&fs.LstatCachedFile{Path: p.base.RepoRoot.UntypedJoin(patch.ToString())},
patch.ToSystemPath().RestoreAnchor(jsonDir).ToStringDuringMigration(),
); err != nil {
return errors.Wrap(err, "Failed copying patch file")
}
}
}
} else {
if err := fs.CopyFile(
Expand Down