B Installing Elm Packages

 

This elaborates on some concepts first introduced in Chapter 3, including:

  • Direct and indirect dependencies
  • Default imports
  • How Elm’s semantic versioning works
  • What happens when Elm packages are installed

Whenever we run elm install to add a new dependency, it modifies our elm.json file. Here is the elm.json file we’ll have at the beginning of the book’s final chapter, Chapter 8:

Listing B.1 Photo Groove’s elm.json
{
     "type": "application",                                 #A
     "source-directories": [
         "src"                                              #B
     ],
     "elm-version": "0.19.0",
     "dependencies": {
         "direct": {                                        #C
             "NoRedInk/elm-json-decode-pipeline": "1.0.0",  #D
             "elm/browser": "1.0.1",
             "elm/core": "1.0.2",
             "elm/html": "1.0.0",
             "elm/http": "2.0.0",
             "elm/json": "1.1.2",
             "elm/random": "1.0.0"
         },
         "indirect": {                                      #E
             "elm/bytes": "1.0.7",
             "elm/file": "1.0.1",
             "elm/time": "1.0.0",
             "elm/virtual-dom": "1.0.2"
         }
     },
     "test-dependencies": {                                 #F
         "direct": {
             "elm-explorations/test": "1.2.0"
         },
         "indirect": {}
     }
 }

Direct and Indirect dependencies

Semantic Versioning in packages

Semantic Versioning enforced

Browsing package documentation

Example: Installing elm/url

sitemap