mirror of
https://github.com/TECHNOFAB11/jsonnet-bundler.git
synced 2025-12-11 23:50:05 +01:00
feat(install): skip dependencies
Allows `installing` a package without pulling dependencies of that package. This comes in handy when having multiple directories on `JPATH`, which overlay each other. Because dependencies may be already present at lesser ranked import paths, it's not required to pull them, when only needing to bump a single one.
This commit is contained in:
parent
d84e1d760d
commit
fd5f7f108a
5 changed files with 24 additions and 4 deletions
|
|
@ -49,6 +49,7 @@ func testInstallCommandWithJsonnetHome(t *testing.T, jsonnetHome string) {
|
|||
ExpectedCode int
|
||||
ExpectedJsonnetFile []byte
|
||||
ExpectedJsonnetLockFile []byte
|
||||
single bool
|
||||
}{
|
||||
{
|
||||
Name: "NoURLs",
|
||||
|
|
@ -69,6 +70,14 @@ func testInstallCommandWithJsonnetHome(t *testing.T, jsonnetHome string) {
|
|||
ExpectedJsonnetFile: []byte(`{"version": 1, "dependencies": [{"source": {"local": {"directory": "jsonnet/foobar"}}, "version": ""}], "legacyImports": true}`),
|
||||
ExpectedJsonnetLockFile: []byte(`{"version": 1, "dependencies": [{"source": {"local": {"directory": "jsonnet/foobar"}}, "version": ""}], "legacyImports": false}`),
|
||||
},
|
||||
{
|
||||
Name: "single",
|
||||
URIs: []string{"github.com/grafana/loki/production/ksonnet/loki"},
|
||||
ExpectedCode: 0,
|
||||
ExpectedJsonnetFile: []byte(`{"version":1,"dependencies":[{"source":{"git":{"remote":"https://github.com/grafana/loki","subdir":"production/ksonnet/loki"}},"version":"master","single":true}],"legacyImports":true}`),
|
||||
ExpectedJsonnetLockFile: []byte(`{"version":1,"dependencies":[{"source":{"git":{"remote":"https://github.com/grafana/loki","subdir":"production/ksonnet/loki"}},"version":"bd4d516262c107a0bde7a962fa2b1e567a2c21e5","sum":"ExovUKXmZ4KwJAv/q8ZwNW9BdIZlrxmoGrne7aR64wo=","single":true}],"legacyImports":false}`),
|
||||
single: true,
|
||||
},
|
||||
}
|
||||
|
||||
localDependency := "jsonnet/foobar"
|
||||
|
|
@ -92,7 +101,7 @@ func testInstallCommandWithJsonnetHome(t *testing.T, jsonnetHome string) {
|
|||
jsonnetFileContent(t, jsonnetfile.File, []byte(initContents))
|
||||
|
||||
// install something, check it writes only if required, etc.
|
||||
installCommand("", jsonnetHome, tc.URIs)
|
||||
installCommand("", jsonnetHome, tc.URIs, tc.single)
|
||||
jsonnetFileContent(t, jsonnetfile.File, tc.ExpectedJsonnetFile)
|
||||
if tc.ExpectedJsonnetLockFile != nil {
|
||||
jsonnetFileContent(t, jsonnetfile.LockFile, tc.ExpectedJsonnetLockFile)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue