jsonnet-bundler / jsonnet-bundler

A jsonnet package manager.
Apache License 2.0
522 stars 75 forks source link

[Feature] Keep installation path of local sources in jsonnetfile.json #70

Open hangxie opened 4 years ago

hangxie commented 4 years ago

local source has only directory parameter, it would be great to have an optional parameter to indicate where the lib should be deployed, like:

    {
      "source": {
        "local": {
          "directory": "pkg",
          "targetPath": "vendor/github.com/hangxie/jsonnet-sample/"
        }
      },
      "version": ""
    },

Long story (https://github.com/hangxie/jsonnet-sample shows what I want to achieve) - we expect unit tests of the repo use the same import format as actual clients like:

local lib = import 'github.com/hangxie/jsonnet-sample/pkg/main.libsonnet',

however I didn't find a way to do this, the closest one is --jsonnetpkg-homeoption for both install and update, but it affects all imports.

Our current workaround is creating a symlink as shown in the Makefile:

ln -rfs pkg vendor/github.com/hangxie/jsonnet-sample/
metalmatze commented 4 years ago

Yes, that would make sense with the latest changes, if we don't have a full import path for local dependencies.

bgagnon commented 4 years ago

In #111 I describe a proposal for having a development-friendly setup that isn't persisted to git. Basically, to have symlinks only in development, but not in the checked in version. For this to work, we need to solve the issue of maintaining a stable import path when symlinks are used.

ghostsquad commented 4 years ago

this would also solve the problem of how to install sources of the same leaf name. Example:

github.com/foo/kube-libsonnet github.com/bar/kube-libsonnet

I'm not sure if there's a way to be able to use both as of right now.

karlskewes commented 3 years ago

So sorry for the noise, had github link in commit message and forgot it links through :facepalm: :pray: This was related to the different branch but same leaf node comment above. Appreciate the ease of use for jsonnet management jb affords us.