Commit graph

44 commits

Author SHA1 Message Date
Tom
7b8a7836a4
feat: absolute imports (#63)
* feat: go-like import style

jb now creates a directory structure inside of vendor/ that is similar to how go
does (github.com/grafana/jsonnet-libs). This is reflected in the final import
paths, which means they will be go-like

* refactor(spec/deps): named regexs

* feat: make goImportStyle configurable

Defaults to off, can be enabled in `jsonnetfile.json`

* fix: integration test

* doc: license headers

* fix(deps): remove GO_IMPORT_STYLE

not an option anymore, will always do so and symlink

* feat: symlink to legacy location

* feat: allow to disable legacy links

* fix(test): legacyImports in integration tests

* fix(spec): test

* fix: respect legacyName aliases

It was possible to alias packages by changing `name` previously.

While names are now absolute (and computed), legacy links should still respect
old aliases to avoid breaking code.

* fix(test): integration

* fix(init): keep legacyImports enabled for now

* feat: rewrite imports

adds a command to automatically rewrite imports from legacy to absolute style

* fix(tool): rewrite confused by prefixing packages

When a package was a prefix of another one, it broke.
Fixed that by using a proper regular expression. Added a test to make sure it
works as expected

* Update cmd/jb/init.go

* fix: exclude local packages from legacy linking

They actually still use the old style, which is fine. LegacyLinking
messed them up, but from now on it just ignores symlinks that match a localPackage.
2020-01-24 08:02:34 +01:00
sh0rez
376432fadd
feat(cli): version flag (#60)
* feat(cli): version flag

Adds a --version flag to jb. Only available on go versions greater than 1.12

* style: add license headers

* chore(ci): generate only on latest go

* fix: unique step names

* doc: include version in README help text

* fix: rebuild .drone.yml using drone.cli

* fix: remove race condidion from CI
2019-12-14 16:40:30 +01:00
David Genest
f4417ac665 only write jsonnnet files if we made changes (#56)
Adding a dep, or updating a dependency version makes writes to the
jsonnet files.

We evaluate the changes on each of the files. An empty jsonnetfile.json
does not create a corresponding lockfile, as a missing lockfile is not
different from its previous (non existent).
2019-11-08 15:36:13 +01:00
sh0rez
db1aae9b08
fix: disable sha256 for local packages 2019-10-30 17:40:08 +01:00
sh0rez
4de4096004
fix: fail on invalid URI 2019-10-29 22:35:59 +01:00
sh0rez
b23411fe58
fix: add sum to integration test 2019-10-29 22:16:59 +01:00
sh0rez
0588b89c07
feat: minor improvements
- allow to install pkg that is already locked
- clean unknown files from vendor
- correctly handle checksums and locked versions (was accidentally ignoring
- these before)
2019-10-29 21:44:49 +01:00
sh0rez
ffd43cf94e
fix: ensure in update
moves the update command implementation to the new Ensure function
2019-10-29 21:44:41 +01:00
sh0rez
6e3e7b2fdd
refactor: use a map instead of a slice
Packages are unique anyways so it makes sense to use a map to avoid having
duplicates.

For compatibility reasons custom json (un)marshallers hide this change from the
end user
2019-10-29 21:44:38 +01:00
sh0rez
36311f1601
feat: rewrite install procedure
rewrites the installation of packages from scratch to solve several issues with
the existing implementation:

- does not need to choose between lockfile and jsonnetfile anymore. The
jsonnetfile what to be installed, while the lockfile also has versions and
checksums of all packages, even nested ones.
- the lockfile is regenerated on every run, preserving the locked values
- downloaded packages are hashed using sha256 to make sure we receive what we
expect. If files on the local disk are modified, they are downloaded again.
2019-10-29 21:44:30 +01:00
sh0rez
71938456ae
refactor: switch to pkg/jsonnetfile
So far, `pkg` and `pkg/jsonnetfile` had overlapping functionality when it came
to choosing and loading jsonnetfiles.

This fully switches to the separate package `pkg/jsonnetfile` that seems to be
created for exactly this purpose
2019-10-29 21:44:27 +01:00
sh0rez
a718f48cd8
refactor: dependency parsing
Refactors the dependency parsing function chain to evaluate the type of the
dependency right in `parseDependency` to make it clearer what is going on while
reading the code. Before, functions were returning if it was a different type,
which was not that clear from `parseDependency`.
2019-10-29 21:44:23 +01:00
Matthias Loibl
b21c04091a
Check errors or explicitly ignore 2019-10-10 17:47:41 +02:00
Matthias Loibl
f994e4644e
Fix install integration tests 2019-10-10 17:14:42 +02:00
Matthias Loibl
d3bb1f4ea4
Use URI as name for packages location paths 2019-08-12 18:02:21 +02:00
Matthias Loibl
6ed6c3f3ec
For local dependencies check if abs path exists 2019-08-12 11:50:56 +02:00
Matthias Loibl
07801936c0
Create LocalSource as type for local dependencies 2019-07-23 14:01:25 -07:00
Matthias Loibl
6ee790d911
Add ability to parse local dependency 2019-07-23 14:00:27 -07:00
Matthias Loibl
e5199342ea
Remove unused code in main.go 2019-07-23 14:00:25 -07:00
Matthias Loibl
4630466006
Fix typo in parseDependency name and add tests 2019-07-23 14:00:24 -07:00
Matthias Loibl
9110b1417d
Accept paths instead of URLs 2019-07-23 14:00:19 -07:00
Matthias Loibl
53ca56c221
Separate update command into own file cmd/jb/update.go 2019-07-23 13:59:50 -07:00
Matthias Loibl
30a3cde870
Make use of File and LockFile constants of jsonnetfile package 2019-07-23 13:59:47 -07:00
Matthias Loibl
9d10f90924
Fix install integration tests by using v0.1.0 of jb 2019-07-23 13:44:51 -07:00
Matthias Loibl
42b0bb7ab2
Add license headers 2019-07-23 13:36:28 -07:00
Matthias Loibl
d95948a351
cmd/jb: Create integration tests for init and install 2019-07-23 13:36:23 -07:00
Matthias Loibl
c516ce2506
Pass the working dir from main.go 2019-07-23 13:29:32 -07:00
Matthias Loibl
7560a1075c
Extract cmd/jb/init.go 2019-07-23 13:29:29 -07:00
Matthias Loibl
5fdb88b6f0
Extract cmd/jb/install.go 2019-07-23 13:29:26 -07:00
Matthias Loibl
decc4efecb
Add a newline at the end of jsonnetfile 2018-09-07 10:59:39 +02:00
Matthias Loibl
eddfcec0f5
Check for existing jsonnetfile.json before init 2018-08-08 10:35:20 +02:00
Frederic Branczyk
993f7564f9
Fix install from lock-file
Previously even when installing dependencies from a lockfile,
jsonnet-bundler would attempt to resolve versions of transitive
dependencies to their latest floating version. Instead when a lock-file
is specified jsonnet-bundler should just install the specified versions.
2018-08-01 14:02:59 +02:00
Frederic Branczyk
35b10d3381
Add update command 2018-07-25 13:58:07 +02:00
Frederic Branczyk
74c4caa0cf
Add correct lockfile handling 2018-07-25 13:57:37 +02:00
Jacob Straszynski
004e9f3f99 git ssh cloning via git+ssh
This is nice when you're not running your repository on Github, or have
a private repository.
2018-05-23 18:59:51 -07:00
Jacob Straszynski
562ffd6486 refactor in preparation for git+ssh 2018-05-23 11:20:42 -07:00
Jacob Straszynski
8ff5580971 provide indication that an invalid url was given. 2018-05-23 10:13:00 -07:00
Frederic Branczyk
7959a767ed
Fix install without args 2018-04-28 18:01:00 +01:00
Matthias Loibl
2ef36da33a
Introduce kingpin as CLI helper library 2018-04-26 23:37:30 +02:00
Frederic Branczyk
bd22799e96
Improve github slug regex 2018-04-25 15:53:32 +01:00
Frederic Branczyk
d8dbcba49c
Use https git remote by default 2018-04-25 10:24:10 +01:00
Frederic Branczyk
f69df626e3
Add ability to resolve and install transitive dependencies 2018-04-25 09:01:00 +01:00
Frederic Branczyk
5233278a99
Make install idempotent to jsonnetfile.json 2018-04-24 17:43:27 +01:00
Frederic Branczyk
cb59934d1d
Initial commit 2018-04-24 16:01:37 +01:00