GithubHelp home page GithubHelp logo

elm-interface-to-json's Introduction

elm-interface-to-json

Reads all elm files of a project and returns a list of modules with their functions.

Installation

$ npm i elm-interface-to-json -g

Usage

$ elm-interface-to-json --path ./test/ # default path is current working dir

Output

[
   {
      "moduleName":"Foo.Bar",
      "types":[
         {
            "signature":"Int -> Int -> Int",
            "name":"moo"
         }
      ]
   },
   {
      "moduleName":"Main",
      "types":[
         {
            "signature":"Int -> Int -> Int",
            "name":"add"
         },
         {
            "signature":"Int -> Int -> Int",
            "name":"addHelper"
         }
      ]
   }
]

elm-interface-to-json's People

Contributors

jwoudenberg avatar scottcorgan avatar stoeffel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

pbogdan h-3-0

elm-interface-to-json's Issues

Operator precedence in output

Would it be possible to have the operator precedence in the output format?

I want to use this library to determine operator precedence when I parse files for elm-analyse. Currently in elm-analyse I have to parse the project dependencies to determine which operators have what precedence. Using this tool will probably make elm-analyse much faster.

cabal build fails...

I'm trying to get this to build so I can use elm-test on nixos... I cloned the repo and tried cabal build, with dependency issues. Its been a few years since I tried compiling anything with cabal so maybe I'm doing it wrong? Thx.

bburdette@BB-5520:~/op-code/elm-interface-to-json$ cabal new-build
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: elm-interface-to-json-0.1.0.0 (user goal)
[__1] next goal: transformers (dependency of elm-interface-to-json)
[__1] rejecting: transformers-0.5.5.0/installed-0.5..., transformers-0.5.5.0,
transformers-0.5.4.0 (conflict: elm-interface-to-json =>
transformers==0.5.2.0)
[__1] trying: transformers-0.5.2.0
[__2] next goal: base (dependency of elm-interface-to-json)
[__2] rejecting: base-4.11.1.0/installed-4.1... (conflict: transformers =>
base>=2 && <4.11)
[__2] rejecting: base-4.12.0.0, base-4.11.1.0, base-4.11.0.0, base-4.10.1.0,
base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0, base-4.8.1.0,
base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1,
base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0,
base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0,
base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from
non-upgradeable package requires installed instance)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, elm-interface-to-json,
transformers

bburdette@BB-5520:~/op-code/elm-interface-to-json$ cabal builld
cabal: unrecognised command: builld (try --help)
bburdette@BB-5520:~/op-code/elm-interface-to-json$ cabal build
Resolving dependencies...
Warning: solver failed to find a solution:
Could not resolve dependencies:
[__0] trying: elm-interface-to-json-0.1.0.0 (user goal)
[__1] next goal: transformers (dependency of elm-interface-to-json)
[__1] rejecting: transformers-0.5.5.0/installed-0.5... (conflict:
elm-interface-to-json => transformers==0.5.2.0)
[__1] fail (backjumping, conflict set: elm-interface-to-json, transformers)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: elm-interface-to-json, transformers
Trying configure anyway.
Configuring elm-interface-to-json-0.1.0.0...
cabal: Encountered missing dependencies:
aeson ==1.0.2.1,
aeson-pretty ==0.7.2,
binary ==0.7.6.1,
bytestring ==0.10.8.1,
concatenative ==1.0.1,
containers ==0.5.7.1,
directory ==1.3.0.0,
either ==4.4.1.1,
elm-compiler ==0.18,
filemanip ==0.3.6.3,
filepath ==1.4.1.1,
indents ==0.3.3,
optparse-applicative ==0.13.1.0,
parsec ==3.1.11,
text ==1.2.2.1,
transformers ==0.5.2.0

bburdette@BB-5520:~/op-code/elm-interface-to-json$ 

Report both exposed and unexposed values

As it has turned out, node-test-runner ended up wanting to know two things:

  1. The exposed values of type Test
  2. The non-exposed values of type Test

We use the latter to give the user an error if they forgot to expose any top-level values of type Test, so they can make sure to expose them.

Currently we are doing some janky JS parsing of exposing to get #2, but @eeue56 pointed out that elm-interface-to-json could provide both pieces of information after a single read of the elmi file.

I'm not sure what the output format should be for providing both pieces of info in one run, but as long as we can avoid needing a second read of the elmi file, it would be much faster than what we're currently doing!

parsed format for the signature

It could be quite useful to have a format for the signature which is parsed already.
To be honest I'm not sure how to properly represent function parameters, thought.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.