Skip to content

Comment on Import.sh A module system for Bash and other Unix shells

Comments

Curious about the cache directory tree structure.

Does this play well with VCS refs, for version pinning?

Does this play well with local forks, for testing and experimentation?

Something like the pre go mod system could be helpful for basic shell dependency management.

Also, this should really support vendoring, for users who prefer to keep a copy of the dependencies in full in their project's VCS.

bfmOP

It looks like the IMPORT_CACHE can be used for vendoring.

A quick example:

    #!/usr/bin/env bash

    export IMPORT_CACHE="vendor/import" 

    source ./bin/import

    import "tootallnate/hello"
    import assert@2.1.3

    hello
    assert_equal foo bar

generates the following dir structure:
    vendor/import/
    ├── data
    │   ├── 0a1c5188c768b3b150f1a8a104bb71a3fa160aad
    │   └── a4f0a20c03de97c490413f0c58f480f2ad17ba27
    ├── links
    │   └── https
    │       └── import.sh
    │           ├── assert@2.1.3 -> ../../../data/0a1c5188c768b3b150f1a8a104bb71a3fa160aad
    │           └── tootallnate
    │               └── hello -> ../../../../data/a4f0a20c03de97c490413f0c58f480f2ad17ba27
    └── locations
        └── https
            └── import.sh
                ├── assert@2.1.3
                └── tootallnate
                    └── hello
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.