Skip to content

Commit 266ccff

Browse files
authored
[update] Add sync flag which syncs all dependencies to same resolved version under current working dir (#1501)
1 parent e8ad37d commit 266ccff

File tree

14 files changed

+292
-45
lines changed

14 files changed

+292
-45
lines changed

.github/workflows/cli-tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ jobs:
143143
cat /etc/nix/nix.conf || true
144144
echo "::endgroup::"
145145
echo "::group::Resolved Nix config"
146-
nix show-config
146+
nix show-config --extra-experimental-features nix-command
147147
echo "::endgroup::"
148148
go test -v -timeout $DEVBOX_GOLANG_TEST_TIMEOUT ./...
149149
@@ -202,7 +202,7 @@ jobs:
202202
cat /etc/nix/nix.conf || true
203203
echo "::endgroup::"
204204
echo "::group::Resolved Nix config"
205-
nix show-config
205+
nix show-config --extra-experimental-features nix-command
206206
echo "::endgroup::"
207207
devbox install
208208
devbox run -- echo "Hello from devbox!"

devbox.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type Devbox interface {
5050
StopServices(ctx context.Context, allProjects bool, services ...string) error
5151
ListServices(ctx context.Context) error
5252

53-
Update(ctx context.Context, pkgs ...string) error
53+
Update(ctx context.Context, opts devopt.UpdateOpts) error
5454
}
5555

5656
// Open opens a devbox by reading the config file in dir.

examples/databases/mariadb/devbox.lock

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,25 @@
22
"lockfile_version": "1",
33
"packages": {
44
"mariadb@latest": {
5-
"last_modified": "2023-05-01T16:53:22Z",
5+
"last_modified": "2023-08-30T00:25:28Z",
66
"plugin_version": "0.0.1",
7-
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#mariadb",
8-
"version": "10.6.12"
7+
"resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#mariadb_110",
8+
"source": "devbox-search",
9+
"version": "11.0.3",
10+
"systems": {
11+
"aarch64-darwin": {
12+
"store_path": "/nix/store/d5nb44vw8yy22lc21ld75nndmn9c3cgr-mariadb-server-11.0.3"
13+
},
14+
"aarch64-linux": {
15+
"store_path": "/nix/store/sz5n9bkcjxklk4jd0p5h26yi5j79wh7h-mariadb-server-11.0.3"
16+
},
17+
"x86_64-darwin": {
18+
"store_path": "/nix/store/4l6h83flncplm3kmry1w08msyy7b7vdw-mariadb-server-11.0.3"
19+
},
20+
"x86_64-linux": {
21+
"store_path": "/nix/store/047g9nxp6jb2bqj1f53qk86sjzrscbmj-mariadb-server-11.0.3"
22+
}
23+
}
924
}
1025
}
11-
}
26+
}

examples/databases/mysql/devbox.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"lockfile_version": "1",
33
"packages": {
44
"mysql80@latest": {
5-
"last_modified": "2023-05-01T16:53:22Z",
5+
"last_modified": "2023-06-29T16:20:38Z",
66
"plugin_version": "0.0.1",
7-
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#mysql80",
7+
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#mysql80",
88
"version": "8.0.33"
99
}
1010
}
11-
}
11+
}

examples/development/nodejs/nodejs-yarn/devbox.lock

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
}
2323
},
2424
25-
"last_modified": "2023-05-01T16:53:22Z",
26-
"resolved": "github:NixOS/nixpkgs/844ffa82bbe2a2779c86ab3a72ff1b4176cec467#yarn",
25+
"last_modified": "2023-05-21T19:52:09Z",
26+
"resolved": "github:NixOS/nixpkgs/9356eead97d8d16956b0226d78f76bd66e06cb60#yarn",
27+
"source": "devbox-search",
2728
"version": "1.22.19",
2829
"systems": {
2930
"aarch64-darwin": {

examples/stacks/laravel/devbox.lock

Lines changed: 109 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,127 @@
22
"lockfile_version": "1",
33
"packages": {
44
"mariadb@latest": {
5-
"last_modified": "2023-05-01T16:53:22Z",
5+
"last_modified": "2023-08-30T00:25:28Z",
66
"plugin_version": "0.0.1",
7-
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#mariadb",
8-
"version": "10.6.12"
7+
"resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#mariadb_110",
8+
"source": "devbox-search",
9+
"version": "11.0.3",
10+
"systems": {
11+
"aarch64-darwin": {
12+
"store_path": "/nix/store/d5nb44vw8yy22lc21ld75nndmn9c3cgr-mariadb-server-11.0.3"
13+
},
14+
"aarch64-linux": {
15+
"store_path": "/nix/store/sz5n9bkcjxklk4jd0p5h26yi5j79wh7h-mariadb-server-11.0.3"
16+
},
17+
"x86_64-darwin": {
18+
"store_path": "/nix/store/4l6h83flncplm3kmry1w08msyy7b7vdw-mariadb-server-11.0.3"
19+
},
20+
"x86_64-linux": {
21+
"store_path": "/nix/store/047g9nxp6jb2bqj1f53qk86sjzrscbmj-mariadb-server-11.0.3"
22+
}
23+
}
924
},
1025
"nginx@latest": {
11-
"last_modified": "2023-05-01T16:53:22Z",
26+
"last_modified": "2023-09-04T16:24:30Z",
1227
"plugin_version": "0.0.1",
13-
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#nginx",
14-
"version": "1.24.0"
28+
"resolved": "github:NixOS/nixpkgs/3c15feef7770eb5500a4b8792623e2d6f598c9c1#nginx",
29+
"source": "devbox-search",
30+
"version": "1.24.0",
31+
"systems": {
32+
"aarch64-darwin": {
33+
"store_path": "/nix/store/prz9lx44d3hicpmsri5rm9qk44r79ng8-nginx-1.24.0"
34+
},
35+
"aarch64-linux": {
36+
"store_path": "/nix/store/b2v5yw11gmywahlyhbqajml7hjdkhsar-nginx-1.24.0"
37+
},
38+
"x86_64-darwin": {
39+
"store_path": "/nix/store/1nyjvgj3hbhck80wkwi0h18561xbp3sy-nginx-1.24.0"
40+
},
41+
"x86_64-linux": {
42+
"store_path": "/nix/store/vc66rk5b86lx1myxr18qkgzha0fjx2ks-nginx-1.24.0"
43+
}
44+
}
1545
},
1646
"nodejs@18": {
17-
"last_modified": "2023-05-01T16:53:22Z",
18-
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#nodejs",
19-
"version": "18.16.0"
47+
"last_modified": "2023-08-30T00:25:28Z",
48+
"resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#nodejs_18",
49+
"source": "devbox-search",
50+
"version": "18.17.1",
51+
"systems": {
52+
"aarch64-darwin": {
53+
"store_path": "/nix/store/xpqj3zg5lx25abv9qybiqd7gcs8b81fp-nodejs-18.17.1"
54+
},
55+
"aarch64-linux": {
56+
"store_path": "/nix/store/svc3bwhi6i1jd5387w8dwps23s7d4a62-nodejs-18.17.1"
57+
},
58+
"x86_64-darwin": {
59+
"store_path": "/nix/store/kjsf1qk9w4rknr02silyfq4lxlkh53xq-nodejs-18.17.1"
60+
},
61+
"x86_64-linux": {
62+
"store_path": "/nix/store/51nhk6ycfnj895q07v94jsrwmk2jmz8j-nodejs-18.17.1"
63+
}
64+
}
2065
},
2166
"php81Extensions.xdebug@latest": {
22-
"last_modified": "2023-05-01T16:53:22Z",
23-
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#php81Extensions.xdebug",
24-
"version": "3.2.1"
67+
"last_modified": "2023-08-30T00:25:28Z",
68+
"resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#php81Extensions.xdebug",
69+
"source": "devbox-search",
70+
"version": "3.2.2",
71+
"systems": {
72+
"aarch64-darwin": {
73+
"store_path": "/nix/store/isd181vs56d55xarvlzqr0cl2c65skq7-php-xdebug-3.2.2"
74+
},
75+
"aarch64-linux": {
76+
"store_path": "/nix/store/c0ij58mr8mqcbx6kkrs1wa6x0m433hzc-php-xdebug-3.2.2"
77+
},
78+
"x86_64-darwin": {
79+
"store_path": "/nix/store/v4i2qbb7aivj3x4i7ipjg1vnfdc3ynvw-php-xdebug-3.2.2"
80+
},
81+
"x86_64-linux": {
82+
"store_path": "/nix/store/q6gp1rn2p6319l8rbwk0arvbbi8kx6bg-php-xdebug-3.2.2"
83+
}
84+
}
2585
},
2686
"php81Packages.composer@latest": {
27-
"last_modified": "2023-05-01T16:53:22Z",
28-
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#php81Packages.composer",
29-
"version": "2.5.5"
87+
"last_modified": "2023-08-30T00:25:28Z",
88+
"resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#php81Packages.composer",
89+
"source": "devbox-search",
90+
"version": "2.5.8",
91+
"systems": {
92+
"aarch64-darwin": {
93+
"store_path": "/nix/store/7hxmkxa9bmaplyy1ixl0yxv3j0qvxvc3-php-composer-2.5.8"
94+
},
95+
"aarch64-linux": {
96+
"store_path": "/nix/store/vwrbpz9wr7blr7alx0fl3x79ym3jbdqa-php-composer-2.5.8"
97+
},
98+
"x86_64-darwin": {
99+
"store_path": "/nix/store/fjy357jpj9q2bfahsgnak4mrh8y07izw-php-composer-2.5.8"
100+
},
101+
"x86_64-linux": {
102+
"store_path": "/nix/store/6w2vrfjdwhr3mj1magr2rmbycln379f8-php-composer-2.5.8"
103+
}
104+
}
30105
},
31106
32-
"last_modified": "2023-05-01T16:53:22Z",
107+
"last_modified": "2023-09-04T16:24:30Z",
33108
"plugin_version": "0.0.1",
34-
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#php",
35-
"version": "8.1.18"
109+
"resolved": "github:NixOS/nixpkgs/3c15feef7770eb5500a4b8792623e2d6f598c9c1#php81",
110+
"source": "devbox-search",
111+
"version": "8.1.23",
112+
"systems": {
113+
"aarch64-darwin": {
114+
"store_path": "/nix/store/lb1kvhs6brfphpmxa36kn9fki89ijx7f-php-with-extensions-8.1.23"
115+
},
116+
"aarch64-linux": {
117+
"store_path": "/nix/store/2f935v7hg56faxdp0myam0v8ppdidrd1-php-with-extensions-8.1.23"
118+
},
119+
"x86_64-darwin": {
120+
"store_path": "/nix/store/v5fdxi8pasc8mxacmg76q9qzqpsr04w6-php-with-extensions-8.1.23"
121+
},
122+
"x86_64-linux": {
123+
"store_path": "/nix/store/ky5w9izkk4yyhni3nh31nicmcfch5ndz-php-with-extensions-8.1.23"
124+
}
125+
}
36126
},
37127
"redis@latest": {
38128
"last_modified": "2023-05-01T16:53:22Z",
@@ -41,4 +131,4 @@
41131
"version": "7.0.11"
42132
}
43133
}
44-
}
134+
}

examples/stacks/spring/devbox.lock

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,25 @@
22
"lockfile_version": "1",
33
"packages": {
44
"gradle@latest": {
5-
"last_modified": "2023-06-29T16:20:38Z",
5+
"last_modified": "2023-08-30T00:25:28Z",
66
"plugin_version": "0.0.1",
7-
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#gradle",
8-
"version": "8.0.1"
7+
"resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#gradle",
8+
"source": "devbox-search",
9+
"version": "8.3",
10+
"systems": {
11+
"aarch64-darwin": {
12+
"store_path": "/nix/store/4xjjls354jr8w7083qxsrpfs1fgl80fj-gradle-8.3"
13+
},
14+
"aarch64-linux": {
15+
"store_path": "/nix/store/f0l5fscvcl9yand9jfpk5icr2ac8qx2v-gradle-8.3"
16+
},
17+
"x86_64-darwin": {
18+
"store_path": "/nix/store/rxm9mpxswrd77fd6lafqcxaxizjlk1l4-gradle-8.3"
19+
},
20+
"x86_64-linux": {
21+
"store_path": "/nix/store/qvp5jiik6q27qwlgiq80fx96wyh0r0nb-gradle-8.3"
22+
}
23+
}
924
},
1025
"jdk@17": {
1126
"last_modified": "2023-06-29T16:20:38Z",
@@ -19,4 +34,4 @@
1934
"version": "8.0.33"
2035
}
2136
}
22-
}
37+
}

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ require (
5050
github.com/InVisionApp/go-health/v2 v2.1.3 // indirect
5151
github.com/InVisionApp/go-logger v1.0.1 // indirect
5252
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
53-
github.com/adrg/xdg v0.4.0 // indirect
5453
github.com/andybalholm/brotli v1.0.5 // indirect
5554
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
5655
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.3 // indirect

go.sum

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDe
1313
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA=
1414
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g=
1515
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
16-
github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls=
17-
github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E=
1816
github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0=
1917
github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30=
2018
github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
@@ -245,7 +243,6 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
245243
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
246244
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
247245
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
248-
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
249246
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
250247
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
251248
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
@@ -264,8 +261,6 @@ github.com/yuin/gopher-lua v0.0.0-20190514113301-1cd887cd7036/go.mod h1:gqRgreBU
264261
github.com/zaffka/mongodb-boltdb-mock v0.0.0-20221014194232-b4bb03fbe3a0/go.mod h1:GsDD1qsG+86MeeCG7ndi6Ei3iGthKL3wQ7PTFigDfNY=
265262
github.com/zealic/go2node v0.1.0 h1:ofxpve08cmLJBwFdI0lPCk9jfwGWOSD+s6216x0oAaA=
266263
github.com/zealic/go2node v0.1.0/go.mod h1:GrkFr+HctXwP7vzcU9RsgtAeJjTQ6Ud0IPCQAqpTfBg=
267-
go.jetpack.io/pkg v0.0.0-20230919193042-473f1790dbf6 h1:X0sXrWsTsQcUcikm+uKOg6hJ7H8g+0SaK05s8kfg7a0=
268-
go.jetpack.io/pkg v0.0.0-20230919193042-473f1790dbf6/go.mod h1:6RVzBortLFlql8s8oKJTX2+H7DDzp8Lr7wiIOI3FauU=
269264
go.jetpack.io/pkg v0.0.0-20230920232528-54278537129b h1:8sbFeLQ7GtVP7CxvpmBoOh6w2ZTK4DyZuMkyiIGFdjs=
270265
go.jetpack.io/pkg v0.0.0-20230920232528-54278537129b/go.mod h1:drBQ4v8Hxs501Y3KK3vbsNBhn/TEMEDHrdXK7cOb9yg=
271266
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@@ -300,7 +295,6 @@ golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBc
300295
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
301296
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
302297
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
303-
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
304298
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
305299
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
306300
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

internal/boxcli/update.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ import (
88
"github.com/spf13/cobra"
99

1010
"go.jetpack.io/devbox"
11+
"go.jetpack.io/devbox/internal/boxcli/usererr"
1112
"go.jetpack.io/devbox/internal/impl/devopt"
1213
)
1314

1415
type updateCmdFlags struct {
1516
config configFlags
17+
sync bool
1618
}
1719

1820
func updateCmd() *cobra.Command {
@@ -32,6 +34,13 @@ func updateCmd() *cobra.Command {
3234
}
3335

3436
flags.config.register(command)
37+
command.Flags().BoolVar(
38+
&flags.sync,
39+
"sync-lock",
40+
false,
41+
"Sync all devbox.lock dependencies in multiple projects. "+
42+
"Dependencies will sync to the latest local version.",
43+
)
3544
return command
3645
}
3746

@@ -44,5 +53,12 @@ func updateCmdFunc(cmd *cobra.Command, args []string, flags *updateCmdFlags) err
4453
return errors.WithStack(err)
4554
}
4655

47-
return box.Update(cmd.Context(), args...)
56+
if len(args) > 0 && flags.sync {
57+
return usererr.New("cannot specify both a package and --sync")
58+
}
59+
60+
return box.Update(cmd.Context(), devopt.UpdateOpts{
61+
Pkgs: args,
62+
Sync: flags.sync,
63+
})
4864
}

internal/impl/devopt/devboxopts.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,8 @@ type Credentials struct {
3737
Email string
3838
Sub string
3939
}
40+
41+
type UpdateOpts struct {
42+
Pkgs []string
43+
Sync bool
44+
}

internal/impl/update.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
"go.jetpack.io/devbox/internal/boxcli/featureflag"
1111
"go.jetpack.io/devbox/internal/devpkg"
12+
"go.jetpack.io/devbox/internal/impl/devopt"
1213
"go.jetpack.io/devbox/internal/lock"
1314
"go.jetpack.io/devbox/internal/nix"
1415
"go.jetpack.io/devbox/internal/nix/nixprofile"
@@ -18,8 +19,12 @@ import (
1819
"go.jetpack.io/devbox/internal/wrapnix"
1920
)
2021

21-
func (d *Devbox) Update(ctx context.Context, pkgs ...string) error {
22-
inputs, err := d.inputsToUpdate(pkgs...)
22+
func (d *Devbox) Update(ctx context.Context, opts devopt.UpdateOpts) error {
23+
if opts.Sync {
24+
return lock.SyncLockfiles()
25+
}
26+
27+
inputs, err := d.inputsToUpdate(opts.Pkgs...)
2328
if err != nil {
2429
return err
2530
}

internal/lock/package.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ type Package struct {
1717
Version string `json:"version,omitempty"`
1818
// Systems is keyed by the system name
1919
Systems map[string]*SystemInfo `json:"systems,omitempty"`
20+
21+
// NOTE: if you add more fields, please update SyncLockfiles
2022
}
2123

2224
type SystemInfo struct {

0 commit comments

Comments
 (0)