Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ento opened this issue May 11, 2018 · 1 comment

Comments

@ento
Copy link
Contributor

ento commented May 11, 2018

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
@stoeffel
Copy link
Contributor

agreed. I think I know a good fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants