Coder Social home page Coder Social logo

melvisntnormal / elm-upgrade Goto Github PK

View Code? Open in Web Editor NEW

This project forked from avh4/elm-upgrade

0.0 2.0 0.0 123 KB

Upgrade Elm projects

Home Page: https://www.npmjs.com/package/elm-upgrade

Shell 2.04% Perl 57.20% Elm 3.27% JavaScript 37.49%

elm-upgrade's Introduction

elm-upgrade Build Status

elm-upgrade helps you upgrade your Elm 0.18 projects to Elm 0.19. It attempts to automate many of the steps in the Elm 0.19 upgrade guide. elm-upgrade will do the following:

  • Convert your elm-package.json file to ...
    • ... an application elm.json if your project has no exposed modules
    • ... a package elm.json if your project has at least one exposed module
  • Try to upgrade all of your project dependencies
  • Warn you if some of your project dependencies don't support Elm 0.19 yet
  • Use elm-format --upgrade to upgrade your code, which includes the following:
    • Convert escaped characters in strings to the new syntax (\u{xxxx})
    • Inline uses of functions which were removed in Elm 0.19:
      • (,,), (,,,), etc tuple constructor functions
      • Platform.Cmd.(!)
      • flip, curry, uncurry, and rem from the Basics module

How to use it

To use elm-upgrade, first install Elm 0.19 and then run the following in your terminal:

npm install -g elm-format
npm install -g elm-upgrade
cd path/to/my/elm/project
elm-upgrade

After the automated upgrade, you will probably still have to fix a few things. See the Elm 0.19 upgrade guide for more details.

What it looks like

$ elm-upgrade
INFO: Found elm at /Users/avh4/workspace/elm-upgrade/node_modules/.bin/elm
INFO: Found elm 0.19.0
INFO: Found elm-format at /Users/avh4/workspace/elm-upgrade/node_modules/.bin/elm-format
INFO: Found elm-format 0.8.0
INFO: Cleaning ./elm-stuff before upgrading
INFO: Converting elm-package.json -> elm.json
INFO: Detected an application project (this project has no exposed modules)
INFO: Switching from elm-lang/core (deprecated) to elm/core
INFO: Installing latest version of elm/core
It is already installed!
INFO: Detected use of elm-lang/core#Random; installing elm/random
Here is my plan:

  Add:
    elm/random    1.0.0
    elm/time      1.0.0

Would you like me to update your elm.json accordingly? [Y/n]: y
Dependencies loaded from local cache.
Dependencies ready!
INFO: Detected use of elm-lang/core#Time; installing elm/time
I found it in your elm.json file, but in the "indirect" dependencies.
Should I move it into "direct" dependencies for more general use? [Y/n]: y
Dependencies loaded from local cache.
Dependencies ready!
INFO: Switching from elm-lang/html (deprecated) to elm/html
INFO: Installing latest version of elm/html
Here is my plan:

  Add:
    elm/html           1.0.0
    elm/virtual-dom    1.0.0

Would you like me to update your elm.json accordingly? [Y/n]: y
Dependencies loaded from local cache.
Dependencies ready!
INFO: Upgrading *.elm files in ./


SUCCESS! Your project's dependencies and code have been upgraded.
However, your project may not yet compile due to API changes in your
dependencies.

See <https://github.com/elm/compiler/blob/master/upgrade-docs/0.19.md>
and the documentation for your dependencies for more information.

$ git add -N elm.json
$ git diff
diff --git a/Main.elm b/Main.elm
index 7dd0dfb..1cbcdea 100644
--- a/Main.elm
+++ b/Main.elm
@@ -1,4 +1,4 @@
-module Main exposing (..)
+module Main exposing (Model, Msg(..), height, init, main, update, view, width)

 import Html exposing (..)
 import Html.Attributes exposing (..)
@@ -122,31 +122,27 @@ view model =
         cursorY =
             toString model.yPosition ++ "px"
     in
-    div [ style [ ( "position", "relative" ) ] ]
+    div [ style "position" "relative" ]
         [ img
-            [ style
-                [ ( "width", "100%" )
-                , ( "max-width", toString width ++ "px" )
-                , ( "margin-left", "-50%" )
-                , ( "position", "absolute" )
-                , ( "left", "50%" )
-                ]
+            [ style "width" "100%"
+            , style "max-width" (toString width ++ "px")
+            , style "margin-left" "-50%"
+            , style "position" "absolute"
+            , style "left" "50%"
             , src "assets/oujia_6.jpeg"
             ]
             []
         ]
diff --git a/elm-package.json b/elm-package.json
deleted file mode 100644
index f5ba1c5..0000000
--- a/elm-package.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-    "version": "1.0.0",
-    "summary": "helpful summary of your project, less than 80 characters",
-    "repository": "https://github.com/user/project.git",
-    "license": "BSD3",
-    "source-directories": [
-        "."
-    ],
-    "exposed-modules": [],
-    "dependencies": {
-        "elm-lang/core": "5.1.1 <= v < 6.0.0",
-        "elm-lang/html": "2.0.0 <= v < 3.0.0"
-    },
-    "elm-version": "0.18.0 <= v < 0.19.0"
-}
diff --git a/elm.json b/elm.json
index e69de29..65d31f3 100644
--- a/elm.json
+++ b/elm.json
@@ -0,0 +1,23 @@
+{
+    "type": "application",
+    "source-directories": [
+        "."
+    ],
+    "elm-version": "0.19.0",
+    "dependencies": {
+        "direct": {
+            "elm/core": "1.0.0",
+            "elm/html": "1.0.0",
+            "elm/random": "1.0.0",
+            "elm/time": "1.0.0"
+        },
+        "indirect": {
+            "elm/json": "1.0.0",
+            "elm/virtual-dom": "1.0.0"
+        }
+    },
+    "test-dependencies": {
+        "direct": {},
+        "indirect": {}
+    }
+}
\ No newline at end of file

Development info for contributors to elm-upgrade

See CONTRIBUTING.md.

elm-upgrade's People

Contributors

avh4 avatar eeue56 avatar jackysee avatar janiczek avatar

Watchers

 avatar  avatar

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.