| 35 | } |
| 36 | |
| 37 | func GetFile(project devboxProject) (*File, error) { |
| 38 | lockFile := &File{ |
| 39 | devboxProject: project, |
| 40 | |
| 41 | LockFileVersion: lockFileVersion, |
| 42 | Packages: map[string]*Package{}, |
| 43 | } |
| 44 | err := cuecfg.ParseFile(lockFilePath(project.ProjectDir()), lockFile) |
| 45 | if errors.Is(err, fs.ErrNotExist) { |
| 46 | return lockFile, nil |
| 47 | } |
| 48 | if err != nil { |
| 49 | return nil, err |
| 50 | } |
| 51 | |
| 52 | // If the lockfile has legacy StorePath fields, we need to convert them to the new format |
| 53 | ensurePackagesHaveOutputs(lockFile.Packages) |
| 54 | |
| 55 | return lockFile, nil |
| 56 | } |
| 57 | |
| 58 | func (f *File) Add(pkgs ...string) error { |
| 59 | for _, p := range pkgs { |