Giter VIP home page Giter VIP logo

project-metadata-utils's People

Contributors

evancz avatar jfmengels avatar rlefevre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

project-metadata-utils's Issues

Add min/max functions to Constraint

For package dependency calculations I need to get the min/max value of Constraint.

So I suggest adding two new functions which return min/max Version:s and their associated Op:s:

min : Constraint -> (Version, Op)
max : Constraint -> (Version, Op)

Note that this requires exposing Op(..).

(I removed my earlier idea here, this is better and can also have other uses with those exposes Op:s, e.g. with custom conversion to string or something else.)

Rename Elm.Module to Elm.Module.Name?

Few questions:

Module Elm.Module is build around Name type so I think that Elm.Module.Name is more accurate?
Now Elm.Module.toString means "module name to string".

Module Elm.Package is build around Name type so I think that Elm.Package.Name is more accurate?
Now Elm.Package.toString means "package name to string".

Module Elm.Docs is build around Module type so I think that Elm.Module is more accurate?

I took me time to remember that Package.toString converts package name to string.

Add Elm.Constraint.checkConstraint

I wanted to write an elm-review rule that would verify that an Elm package has a valid Elm constraint. For example, 0.19.1<=v<0.20.0 is valid and 0.0.0<=v<1.0.0 is not. Unfortunately, it's not easy to verify this without Elm.Constraint.checkConstraint: Constraint -> Constraint -> Bool. That is to say, a function that takes two constraints and checks that the first one is contained in the second one.

An alternative approach would be to implement #5 since this checkConstraint can be written by the user if Version and Op are exposed.

Module name containing _ aren't accepted

Summary

When the module name contains _, Elm.Module.fromString will return Nothing, and Elm.Module.decoder will fail. Since these are used in Elm.Project.decoder, this means that

There are modules out there, that contain modules containing an _. I encountered this in https://package.elm-lang.org/packages/AdrianRibao/elm-derberos-date/1.2.3/, but there may be others.

SSCCE

You can use this elm.json file:
https://package.elm-lang.org/packages/AdrianRibao/elm-derberos-date/1.2.3/elm.json

Here is an Ellie where we attempt to decode it: https://ellie-app.com/8W4c6qXQFgwa1

Additional details

Context: I use elm/project-metadata-utils in elm-review to decode elm.json files in order to use the information about a dependency, and use it to provide helpful analysis. Unfortunately, this dependency is not decodable using the current implementation.

@rlefevre pointed me towards the compiler's code that validates module names. From our understanding, unicode is accepted in module names, but they wouldn't be accepted with this decoder's implementation. So both _ and unicode support are missing at the moment.

Expose type parser

Would it be ok to expose the tipe: Parser Type from Elm.Docs.Type so that people can reuse it without having to re-implement it or fork the project? I can do a PR if that's cool with you.

(as for the use-case, we want more infos about our project at work so we are working on a parser that will returns us all we need to know)

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.