Skip to content

jetpack shouldn't require package.json with an exact dependency on @noredink/jetpack to run #65

@ento

Description

@ento

While npm is probably the easiest way of installing jetpack, as long as we release the binary in an easy-to-download way (i.e. in GitHub's Releases tab), it shouldn't fail if package.json doesn't exist.

to repro

Given a package.json like: (exact content doesn't matter, as long as there's a top-level "devDependencies" property - reproduced here for reproducibility's sake)

$ cat package.json
{
  "name": "jetpack-module-dir-bug",
  "version": "1.0.0",
  "description": "",
  "main": "entry.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "coffeescript": "^2.0.0",
    "elm": "^0.18.0",
    "sass": "^1.0.0-beta.2"
  }
}

error on missing package.json

$ mv package.json package.json.bak
$ ../jetpack/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/jetpack/jetpack --version
jetpack: path/to/here/package.json: openBinaryFile: does not exist (No such file or directory)

error on missing "@noredink/jetpack" in devDependencies

$ jq '.' package.json.bak > package.json
$ ../jetpack/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/jetpack/jetpack --version
jetpack: I couldn't decode package.json in path/to/here/

    Error in $: key "@noredink/jetpack" not present

error on non-exact dependency version

This is likely from Data.SemVer's way of parsing semver.

$ jq '.devDependencies["@noredink/jetpack"] |= "^2.0.0"' package.json.bak > package.json
$ ../jetpack/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/jetpack/jetpack --version
jetpack: I couldn't decode package.json in path/to/here/

    Error in $: Failed reading: takeWhile1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions