• Stars
    star
    180
  • Rank 205,881 (Top 5 %)
  • Language
    Rust
  • License
    MIT License
  • Created about 5 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Install, upgrade and uninstall Elm dependencies

CI Workflow npm version

Deal with your elm.json

NOTE: This is very much a work in progress. May mess up your files completely. Use with care.

elm-json provides a bunch of tools to make common tasks involving your elm.json files a little easier: upgrading your dependencies, installing specific versions of packages, removing dependencies or initializing new packages, to name a few.

elm-json never writes to files used by the official toolchain, except elm.json itself. It may, however, read some files from your ELM_HOME when possible, to prevent downloading things you may already have on your filesystem.

Installation

Binaries are attached to the github releases and distributed for Windows, OS X and Linux (statically linked with musl).

For ease of installation, an npm installer also exists:

npm install --global elm-json

Usage

elm-json offers a bunch of subcommands to make life a little easier.

elm-json help

USAGE:
    elm-json [FLAGS] <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
        --offline    Enable offline mode, which means no HTTP traffic will
                     happen
    -V, --version    Prints version information
    -v, --verbose    Sets the level of verbosity

SUBCOMMANDS:
    help         Prints this message or the help of the given subcommand(s)
    install      Install a package
    new          Create a new elm.json file
    tree         List entire dependency graph as a tree
    uninstall    Uninstall a package
    upgrade      Bring your dependencies up to date

Gives a quick overview of the more common subcommands. This can also be used for finding documentation about specific subcommands.

Adding dependencies: elm-json install

USAGE:
    elm-json install [FLAGS] <PACKAGE>... [-- <INPUT>]

FLAGS:
    -h, --help       Prints help information
        --test       Install as a test-dependency
    -V, --version    Prints version information
        --yes        Answer "yes" to all questions

ARGS:
    <PACKAGE>...    Package to install, e.g. elm/core or elm/[email protected]
    <INPUT>         The elm.json file to upgrade [default: elm.json]

elm-json install allows installing dependencies, at the latest version that works given your existing dependencies, or a particular version if you so choose. By adding the --test flag, the chosen package(s) will be added to your test-dependencies rather than your regular dependencies.

Example: Installing the latest available version of a package

elm-json install elm/http

Adds the latest version of elm/http to your dependencies.

For packages, it will use the latest possible version as the lowerbound, and the next major as the exclusive upper bound. This mirrors the behaviour of elm install.

For applications, this will pick the latest available version, adding all indirect dependencies as well.

Example: Installing the latest available 2.x.x version of a package

elm-json install elm/http@2

Adds the latest version of elm/http with 2 as its major version number to your dependencies.

Example: Installing as a test-dependency

elm-json install --test elm/[email protected]

Adds version 2.0.0 of elm/http to your test-dependencies.

For packages, the provided version is used as the lower bound, with the next major being used as the exclusive upper bound.

For applications, this will install exactly the specified version.

Example: Installing multiple dependencies to a specified elm.json file

elm-json install elm/http elm/json -- elm/elm.json

Add the latest possible versions of elm/http and elm/json to ./elm/elm.json.

Removing dependencies: elm-json uninstall

USAGE:
    elm-json uninstall [FLAGS] <PACKAGE>... [-- <INPUT>]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information
        --yes        Answer "yes" to all questions

ARGS:
    <PACKAGE>...    Package to uninstall, e.g. elm/html
    <INPUT>         The elm.json file to upgrade [default: elm.json]

Uninstall dependencies. This is the inverse of elm-json install and its API is similar but slightly simpler.

Version bounds may not be specified and --test is not an allowed flag for this command.

Example: Uninstalling a package

elm-json uninstall elm/html

Removes the elm/html package from your dependencies.

Upgrading dependencies: elm-json upgrade

USAGE:
    elm-json upgrade [FLAGS] [INPUT]

FLAGS:
    -h, --help       Prints help information
        --unsafe     Allow major versions bumps
    -V, --version    Prints version information
        --yes        Answer "yes" to all questions

ARGS:
    <INPUT>    The elm.json file to upgrade [default: elm.json]

By default, this will only allow patch and minor changes for direct (test) dependencies.

When the --unsafe flag is provided, major version bumps are also allowed. Note that this may very well break your application. Use with care!

NOTE: This subcommand does not yet support elm.json files with type package.

Example: Safely updating all dependencies

elm-json upgrade

This command will check if any updates can safely be applied. In practice this means that for your direct dependencies and direct test-dependencies, we'll look for newer versions with the same major version number. Your indirect dependencies and indirect test-dependencies may be modified in more ways, depending on the constraints set by your direct dependencies.

Example: Major version upgrades for your dependencies

elm-json upgrade --unsafe

If major version changes are available, this will attempt to apply them. Note that this may still not update all dependencies to their latest release, if you have another dependency preventing to do so.

If you want to upgrade a specific package to a specific version, try running elm-json install author/project@version, which will tell you what package(s) are preventing this from happening.

Initializing applications/packages: elm-json new

USAGE:
    elm-json new

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

Create a new elm.json file, for applications or packages.

This is very rudimentary right now.

Deeply listing all dependencies: elm-json tree

USAGE:
    elm-json tree [FLAGS] [PACKAGE] [-- <INPUT>]

FLAGS:
    -h, --help       Prints help information
        --test       Promote test-dependencies to top-level dependencies
    -V, --version    Prints version information

ARGS:
    <PACKAGE>    Limit output to show path to some (indirect) dependency
    <INPUT>      The elm.json file to solve [default: elm.json]

Lists the entire dependency graph (with test-dependencies included when --test is passed) as a tree.

Example output:

project
├── elm/core @ 1.0.2
├── elm/http @ 1.0.0
│   ├── elm/core @ 1.0.2 *
│   └── elm/json @ 1.1.3
│       └── elm/core @ 1.0.2 *
├── elm-community/json-extra @ 4.0.0
│   ├── elm/core @ 1.0.2 *
│   ├── elm/json @ 1.1.3 *
│   ├── elm/time @ 1.0.0
│   │   └── elm/core @ 1.0.2 *
│   └── rtfeldman/elm-iso8601-date-strings @ 1.1.3
│       ├── elm/core @ 1.0.2 *
│       ├── elm/json @ 1.1.3 *
│       ├── elm/parser @ 1.1.0
│       │   └── elm/core @ 1.0.2 *
│       └── elm/time @ 1.0.0 *
└── lukewestby/elm-http-builder @ 6.0.0
    ├── elm/core @ 1.0.2 *
    ├── elm/http @ 1.0.0 *
    ├── elm/json @ 1.1.3 *
    ├── elm/time @ 1.0.0 *
    └── elm/url @ 1.0.0
        └── elm/core @ 1.0.2 *

Items marked with * have their dependencies ommitted since they've already
appeared in the output.

Specifying a package-name will filter the tree so only paths leading to the specified package, in direct and indirect dependencies, will be shown.

For tooling: elm-json solve

USAGE:
    elm-json solve [FLAGS] [OPTIONS] [--] [INPUT]

FLAGS:
    -h, --help        Prints help information
    -m, --minimize    Choose lowest available versions rather than highest
        --test        Promote test-dependencies to top-level dependencies
    -V, --version     Prints version information

OPTIONS:
    -e, --extra <PACKAGE>...    Specify extra dependencies, e.g. elm/core or
                                elm/[email protected]

ARGS:
    <INPUT>    The elm.json file to solve [default: elm.json]

Documentation TBD. Intended for other tooling to use, not meant for human consumption.

Generating shell completions: elm-json completions

USAGE:
    elm-json completions <SHELL>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

ARGS:
    <SHELL>    The shell to generate the script for [possible values: bash,
               fish, zsh]

Create completion scripts for elm-json for bash/fish/zsh.

More Repositories

1

elm-demystify-decoders

💡 Figure out how JSON decoders in Elm work by writing them. Step by step.
Elm
169
star
2

elm-xref

Experimental tool for finding unused functions/finding usages
Elm
61
star
3

elm-coverage

Explorations
Elm
58
star
4

elm-rosetree

Rosetree/multiway trees in Elm
Elm
46
star
5

elm-thanks

🌟 Say thanks to everyone who helps build and maintain your Elm dependencies
JavaScript
30
star
6

elm-html-string

Drop in elm-lang/html replacement which can serialize to a pretty `String`
Elm
25
star
7

elm-faster-map

Elm
17
star
8

elm-cordova-intro

Getting started with Elm, Cordova and Fastlane
Ruby
16
star
9

beanie

🐣 A clean, lean PHP beanstalkd client
PHP
15
star
10

elm-doc

Elm
12
star
11

json-decode-exploration

Exploration: JSON decoding with strong error types
Elm
11
star
12

elm-reorderable

Reorder entries while maintaining a key/value correspondence.
Elm
10
star
13

elm-bytes-parser

Parse elm/bytes using composable parsers with errors and context tracking.
Elm
6
star
14

sudoku-solver

Elm
6
star
15

elm-toml

Parsing and decoding TOML to Elm
Elm
6
star
16

elm-utf-tools

Converting between different UTF encodings, in Elm.
Elm
5
star
17

elm-json-in-elm

Implementation of the whole JSON shebang in pure Elm
Elm
5
star
18

elm-touch-events

Elm
5
star
19

elm-benchmark-cli

experiment
Elm
4
star
20

elm-tree

🌳 Implementation of self-balancing trees in Elm
Elm
4
star
21

elm-disco

🔌 Exploration: building views without explicitly passing in all the params.
Elm
4
star
22

mongoReducer

👴 MongoReducer allows running mongo's mapreduce functionality from within mongo - without cron or outside scripts and programs.
JavaScript
3
star
23

elm-dict-set-exploration

Alternative Dict/Set implementations
Elm
3
star
24

elm-holey-zipper

A `List` zipper with holes in it.
Elm
3
star
25

minesweeper

QnD minesweeper under the guise of flat-array matrix investigation
Elm
2
star
26

condparse

⁉️ A condition string parser in PHP
PHP
2
star
27

elm-instrument

Haskell
2
star
28

zend-framework-1

Good old zend-framework one, composer-ready. For those of us stuck with it, but wanting to use composer nevertheless.
2
star
29

carver.js

Seam carving in javascript
JavaScript
1
star
30

qman

👽 An evented beanstalkd queue manager.
PHP
1
star
31

markdown

CommonMark compliant Markdown parser in Elm
Elm
1
star
32

CronVis

PHP
1
star
33

sqitch-action

GH Action to run Sqitch
Dockerfile
1
star
34

elm-package-template

Template for creating a new Elm package, with tests, verified examples and travis integration.
Elm
1
star
35

elm-as-webcomponent

Quick hello world
HTML
1
star
36

elm-avl-dict-bench

Elm
1
star
37

Carver

A seam carving/fluid scaling/content aware scaling implementation in Java. Assignment for a Digital Image Processing class at KHLeuven.
Java
1
star
38

tic-tac-toe

Elm
1
star