Code Monkey home page Code Monkey logo

elm-upgrade's Introduction

elm-upgrade Build Status

elm-upgrade can help 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
    • Upgrade code that uses Html.Attributes.style

elm-upgrade can also upgrade dependencies of your Elm 0.19 applications. If you are already using Elm 0.19, elm-upgrade will to the following:

  • check for newer versions of all your direct dependencies and try to install them

How to use elm-upgrade

First install Elm 0.19.1 and the latest version of elm-format. (If you want to install them locally for your project, you can do so with the following: )

cd path/to/my/elm/project
npm install [email protected]
npm install [email protected]

Then run the following in your terminal:

cd path/to/my/elm/project
npx elm-upgrade@latest

NOTE: npx ships with node 8.2 and later. If you need to use an older version of node, you can still use elm-upgrade with npm install -g elm-upgrade; 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.

Here are some common upgrade steps that you will need to do manually:

- elm/core
  - [ ] Replace uses of toString with String.fromInt, String.fromFloat, or Debug.toString as appropriate
- elm/html
  - [ ] If you used Html.program*, install elm/browser and switch to Browser.element or Browser.document
  - [ ] If you used Html.beginnerProgram, install elm/browser and switch Browser.sandbox

$ 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 brooksbecton avatar eeue56 avatar jackysee avatar jah2488 avatar janiczek avatar mattcheely avatar rubysolo avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

elm-upgrade's Issues

cannot install it on Windows - `node_gyp rebuild` seems to fail on `syncprompt`

Note this is likely to be caused by syncprompt on my machine and I opened an issue there too: cheddar-lang/syncprompt#2


trying to npm install -g elm-upgrade I get this:

$ npm install -g elm-upgrade                                                                                                                                                                                                                                   
C:\Users\myName\AppData\Roaming\npm\elm-upgrade -> C:\Users\myName\AppData\Roaming\npm\node_modules\elm-upgrade\upgrade.js                                                                                                                                 
                                                                                                                                                                                                                                                               
> [email protected] install C:\Users\myname\AppData\Roaming\npm\node_modules\elm-upgrade\node_modules\syncprompt                                                                                                                                              
> node-gyp rebuild                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                               
C:\Users\myname\AppData\Roaming\npm\node_modules\elm-upgrade\node_modules\syncprompt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js"
 rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )                                                                                                                                              
Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu ermöglichen, müssen Sie den Schalter "/m" hinzufügen.                                                                                                        
MSBUILD : error MSB4025: Die Projektdatei konnte nicht geladen werden. Das Stammelement ist nicht vorhanden.                                                                                                                                                   
gyp ERR! build error                                                                                                                                                                                                                                           
gyp ERR! stack Error: `msbuild` failed with exit code: 1                                                                                                                                                                                                       
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)                                                                                                                                 
gyp ERR! stack     at emitTwo (events.js:126:13)                                                                                                                                                                                                               
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)                                                                                                                                                                                                      
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)                                                                                                                                                                   
gyp ERR! System Windows_NT 10.0.16299                                                                                                                                                                                                                          
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"                                                                                                      
gyp ERR! cwd C:\Users\myName\AppData\Roaming\npm\node_modules\elm-upgrade\node_modules\syncprompt                                                                                                                                                            
gyp ERR! node -v v8.10.0                                                                                                                                                                                                                                       
gyp ERR! node-gyp -v v3.6.2                                                                                                                                                                                                                                    
gyp ERR! not ok                                                                                                                                                                                                                                                
npm ERR! code ELIFECYCLE                                                                                                                                                                                                                                       
npm ERR! errno 1                                                                                                                                                                                                                                               
npm ERR! [email protected] install: `node-gyp rebuild`                                                                                                                                                                                                          
npm ERR! Exit status 1                                                                                                                                                                                                                                         
npm ERR!                                                                                                                                                                                                                                                       
npm ERR! Failed at the [email protected] install script.                                                                                                                                                                                                        
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.                                                                                                                                                             
                                                                                                                                                                                                                                                               
npm ERR! A complete log of this run can be found in:                                                                                                                                                                                                           
npm ERR!     C:\Users\myName\AppData\Roaming\npm-cache\_logs\2018-11-19T05_12_40_195Z-debug.log                                                                                                                                                              

the Log is attached
2018-11-19T05_12_40_195Z-debug.log


trying to install locally yields similar results - removing elm-upgrade or syncprompt from node_modules (manually or with npm uninstall) does not help either

Remove definitions of =>

In 0.19, => is coming into core. This would usually be fine, but there is a bug in Elm where an infix definition for a given symbol will treat that symbol as infix, regardless of the file it is in. We should remove all definitions of => and replace them with Tuple.(=>)

elm/compiler#1094

path issue

[elixir1.2@admin]$ elm-upgrade
INFO: Found elm at /usr/bin/elm
INFO: Found elm-package at /usr/bin/elm-package
INFO: Found Elm Platform 0.18.0
ERROR: elm-format was not found on your PATH.  Make sure you have elm-format installed.
You can download Elm format here https://github.com/avh4/elm-format#installation-

[elixir1.2@admin]$ which elm-format
~/elm-format/bin/elm-format

Handle infix operators

I'm trying elm-upgrade on a library that exposes infix operators. I liked how the output contains:

Here are some common upgrade steps that you will need to do manually:

I would appreciate if it would recognize the use of custom operators, which are not allowed anymore and the user to replace them by hand.

Automatically explicitly list all the exports from a package?

In 0.18, you can export (..) from a module (e.g module Lazy.List exposing (..)), and that's fine.

In 0.19, you must explicitly list each of them. However -- if the package existed in 0.18, the exposed things were already explicitly listed in the docs. Maybe we can pull the names from the docs and fill the (..) exposing gap

API migrations for Elm 0.19

This is a tentative list from the limited info about Elm 0.19

  • 🛑 remove elm install ordering workaround (blocked on Elm)
  • install test dependencies (blocked on elm-test)
  • add elm-lang/browser if necessary
  • for packages, move elm files to src/ (or warn)
  • move tests to tests/
  • update readme
  • for packages, warning if license is not in the whitelist
  • if more than 5 exposed modules, give warning (see upgrade docs)

js stuff

  • package renames -> #33

elm-format stuff

  • .program -> Browser.*
  • Json.parse returns Json.Error
  • name shadowing is not allowed
  • (maybe?) case on numbers becomes if/else?

List.range conversion for [Namespace.exp1..Namespace.exp2]

Not sure, if this should be on elm-format after the last one I posted.
Here is the piece of code that didn't convert correctly:

 let
        all =
            List.map (String.fromChar << Char.fromCode)
                [Ascii.fromCode..Ascii.toCode]

where

fromCode : Int
fromCode =
    32


toCode : Int
toCode =
    126

Thanks again for a great tool!

Does it work on Windows?

I haven't tried it on Windows yet. It might work, or it might not.

If you try it on Windows, please let me know what happens.

  • Does the which package work?
  • Do the executables get invoked properly?
  • Does the elm-package.json get saved correctly?

Package renames for Elm 0.19

If you know of any packages that will be renamed when publishing for Elm 0.19, comment below.

Included in elm-upgrade-0.19.0-rc2

  • NoRedInk/elm-decode-pipeline -> NoRedInk/json-decode-pipeline
  • evancz/url-parser -> elm-lang/url

Included in elm-upgrade-0.19.0-rc6

  • lukewestby/elm-http-builder -> lukewestby/http-builder
  • evancz/elm-markdown -> elm-explorations/markdown
  • elm-tools/parser -> elm-lang/parser

Included in elm-upgrade-0.19.0-rc9

  • mgold/elm-random-pcg -> elm-lang/random
  • ohanhi/keyboard-extra -> ohanhi/keyboard
  • ryannhg/elm-date-format -> ryannhg/date-format
  • elm-community/elm-test -> elm-explorations/test
  • evancz/url-parser -> elm/url
  • elm-tools/parser -> elm/parser

Included in elm-upgrade-0.19.0

  • thebritican/elm-autocomplete -> ContaSystemer/elm-menu
  • elm-community/linear-algebra -> elm-explorations/linear-algebra
  • elm-community/webgl -> elm-explorations/webgl
  • elm-lang/keyboard -> elm/browser
  • elm-lang/dom -> elm/browser
  • mpizenberg/elm-mouse-events -> mpizenberg/elm-pointer-events
  • mpizenberg/elm-touch-events -> mpizenberg/elm-pointer-events

Included in elm-upgrade-0.19.2

  • rtfeldman/hex -> rtfeldman/elm-hex
  • elm-lang/mouse -> elm/browser
  • avh4/elm-transducers -> avh4-experimental/elm-transducers
  • dillonkearns/graphqelm -> dillonkearns/elm-graphql

Included in elm-upgrade-0.19.3

  • elm-lang/navigation -> elm/browser
  • BrianHicks/elm-benchmark -> elm-explorations/benchmark

Included in elm-upgrade-0.19.4

  • elm-lang/window -> elm/browser

More

  • elm-lang/core#Color -> avh4/elm-color
  • 1602/json-value -> json-tools/json-value
  • 1602/json-schema -> json-tools/json-schema
  • 1602/elm-feather -> feathericons/elm-feather
  • mgold/elm-date-format -> ???

These are planned, but aren't published under the new name yet:

  • avh4/elm-meshes -> elm-community/meshes

erroneous message: cannot connect to package.elm-lang.org (and ENOENT: no such file or directory)

Trying to upgrade a small elm project on Windows 10 and it's failing, seemingly because it fails to connect to the package server. I can ping the URL and visit it just fine, so I'm not sure this is actually a problem on the server end. It also seems to have an issue writing logs.

Stacktrace:

INFO: Found elm at C:\Users\jarca\scoop\apps\nodejs\current\bin\elm.CMD
{ Error: ENOENT: no such file or directory, open 'C:\projects\elm-dice\elm-upgrade-2018-09-03T08:32:00.589Z.log'
    at Object.fs.openSync (fs.js:660:18)
    at logFile (C:\Users\jarca\scoop\persist\nodejs\bin\node_modules\elm-upgrade\upgrade.js:62:20)
    at logMessage (C:\Users\jarca\scoop\persist\nodejs\bin\node_modules\elm-upgrade\upgrade.js:69:3)
    at logInfo (C:\Users\jarca\scoop\persist\nodejs\bin\node_modules\elm-upgrade\upgrade.js:78:3)
    at findBinary (C:\Users\jarca\scoop\persist\nodejs\bin\node_modules\elm-upgrade\upgrade.js:154:3)
    at main (C:\Users\jarca\scoop\persist\nodejs\bin\node_modules\elm-upgrade\upgrade.js:203:13)
    at C:\Users\jarca\scoop\persist\nodejs\bin\node_modules\elm-upgrade\upgrade.js:511:7
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'C:\\projects\\elm-dice\\elm-upgrade-2018-09-03T08:32:00.589Z.log' }
ERROR: Unable to connect to https://package.elm-lang.org.  Please try again later.
(node:288684) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'C:\projects\elm-dice\elm-upgrade-2018-09-03T08:32:00.593Z.log'
    at Object.fs.openSync (fs.js:660:18)
    at logFile (C:\Users\jarca\scoop\persist\nodejs\bin\node_modules\elm-upgrade\upgrade.js:62:20)
    at logErrorMessage (C:\Users\jarca\scoop\persist\nodejs\bin\node_modules\elm-upgrade\upgrade.js:74:3)
    at logError (C:\Users\jarca\scoop\persist\nodejs\bin\node_modules\elm-upgrade\upgrade.js:86:3)
    at C:\Users\jarca\scoop\persist\nodejs\bin\node_modules\elm-upgrade\upgrade.js:515:7
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
(node:288684) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:288684) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Publish for Elm 0.19 beta

  • add NOT FOR SHARING note
  • disable "create issues at..." links
  • fill in correct package website "packageHost"
  • fill in correct "upgrade docs link"
  • update tests to use elm 0.19 binary, and enable CI

Got message 'The "path" argument must be of type string'

D:\repos\virtualairwaves.web\vartc\assets [master ≡ +4 ~2 -0 !]> npx elm-upgrade
npx: installed 1 in 4.084s
The "path" argument must be of type string

C:\Users\rober\AppData\Roaming\npm\node_modules\elm-upgrade\upgrade.js
INFO: Found elm at node_modules\.bin\elm.CMD
INFO: Found elm 0.19.0
INFO: Found elm-format at node_modules\.bin\elm-format.CMD
INFO: Found elm-format 0.8.1
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
[...]


Everything seemed to proceed OK, but I'm not sure what path it was complaining about.

Cannot work behind proxy

I think simple-get doesn't support proxy? I'm on Windows.

>elm-upgrade
ERROR: Unable to connect to http://package.elm-lang.org.  Please try again later.

Can't install from npm

System: windows 10
npm version:

{ npm: '6.4.1',
  ares: '1.10.1-DEV',
  cldr: '30.0.3',
  http_parser: '2.7.0',
  icu: '58.2',
  modules: '51',
  node: '7.9.0',
  openssl: '1.0.2k',
  tz: '2016j',
  unicode: '9.0',
  uv: '1.11.0',
  v8: '5.5.372.43',
  zlib: '1.2.11' }

When I run npx elm-upgrade

Cannot find module 'C:\Users\Kurren Nischal\AppData\Roaming\npm\node_modules\elm-upgrade\upgrade.js'

And npm install -g elm-upgrade

C:\Users\Kurren Nischal\AppData\Roaming\npm\elm-upgrade -> C:\Users\Kurren Nischal\AppData\Roaming\npm\node_modules\elm-upgrade\upgrade.js

> [email protected] install C:\Users\Kurren Nischal\AppData\Roaming\npm\node_modules\elm-upgrade\node_modules\syncprompt
> node-gyp rebuild


C:\Users\Kurren Nischal\AppData\Roaming\npm\node_modules\elm-upgrade\node_modules\syncprompt>if not defined npm_config_node_gyp (node "C:\Users\Kurren Nischal\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\Kurren Nischal\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Python37\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:289:12)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Kurren Nischal\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Kurren Nischal\AppData\Roaming\npm\node_modules\elm-upgrade\node_modules\syncprompt
gyp ERR! node -v v10.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Kurren Nischal\AppData\Roaming\npm-cache\_logs\2018-09-10T17_25_43_592Z-debug.log

I do have python installed and it's on my PATH

elm-time package shows up in UI as "undefined" (cosmetic)

My successful run of npx elm-upgrade ended with this"

Here are some common upgrade steps that you will need to do manually:

- NoRedInk/elm-json-decode-pipeline
  - [ ] Changes uses of Json.Decode.Pipeline.decode to Json.Decode.succeed
- elm/core
  - [ ] Replace uses of toString with String.fromInt, String.fromFloat, or Debug.toString as appropriate
- undefined
  - [ ] Read the new documentation here: https://package.elm-lang.org/packages/elm/time/latest/
  - [ ] Replace uses of Date and Time with Time.Posix
- elm/html
  - [ ] If you used Html.program*, install elm/browser and switch to Browser.element or Browser.document
  - [ ] If you used Html.beginnerProgram, install elm/browser and switch Browser.sandbox

Looks like undefined is meant to refer to elm/time.

Don't look in node_modules

gulp-elm for example has a Test.elm file that it tries to upgrade, which isn't needed. I'd suggest just avoiding that directory entirely.

elm-upgrade doesn't work for 0.17 projects

I tried to auto upgrade an elm 0.17 project. It did work, because there is request to /new-packages which was removed. I'm not sure if this should have priority. This issue is for awareness and documentation. Maybe a paragraph to the README.md can be added, to explain how older elm projects are handled.

npx [email protected]                                                                                               1274ms
npx: installed 47 in 3.459s
{ HTTPError: Response code 404 (Not Found)
    at stream.catch.then.data (/home/as/.npm/_npx/6363/lib/node_modules/elm-upgrade/node_modules/got/index.js:123:13)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  message: 'Response code 404 (Not Found)',
  host: 'package.elm-lang.org',
  hostname: 'package.elm-lang.org',
  method: 'GET',
  path: '/new-packages',
  statusCode: 404,
  statusMessage: 'Not Found' }
ERROR: Unable to connect to http://package.elm-lang.org.  Please try again later.

I get an error using elm-upgrade

I'm running Win10 64. I have reproduced error via both cmd.com and cygwin bash.

It talks about packages for a bit, my elm-test is out of date yada yada, and then this:

TypeError: Cannot read property 'split' of undefined
at C:\Users\jesse\AppData\Roaming\npm\node_modules\elm-upgrade\upgrade.js:299:11
at Array.forEach ()
at main (C:\Users\jesse\AppData\Roaming\npm\node_modules\elm-upgrade\upgrade.js:276:21)
at C:\Users\jesse\AppData\Roaming\npm\node_modules\elm-upgrade\upgrade.js:386:7
at
at process._tickCallback (internal/process/next_tick.js:188:7)
ERROR: Unable to connect to https://alpha.elm-lang.org. Please try again later.

I don't appear to have any trouble connecting to https://alpha.elm-lang.org via web browser, wget or curl though. So I get the feeling that elm-upgrade has only determined that it cannot connect due to the code exception.

Please advise? I would offer a minimal test case but I might need advise on what to focus on keeping in order to more rapidly shrink first. I'll be glad to dive in once I've got a clearer idea of which way is up in this novel environment.

Thank you much. :)

elm-upgrade checklist additions (elm/json, elm/url, elm/browser)

  • Json.Encode.list takes care of mapping ( a -> Value ) now
    eg List.map toValue |> Json.Encode.list -> Json.Encode.list toValue

  • Navigation.newUrl -> Browser.Navigation.pushUrl

  • jweir/elm-iso8601 now converts between Posix (elm/time) and ISO8601: https://package.elm-lang.org/packages/jweir/elm-iso8601/latest/ISO8601#toPosix

  • rm -rf elm-stuff is a very reasonable solution to common elm: not enough bytes issues due to compiler performance gains

  • UrlParser.custom -> Url.Parser.custom ( returns Maybe now instead of Result )

more to come as I work out Navigation:
https://gist.github.com/mordrax/efcd34739ed56bb64d2b12d2401b7291

npx elm-upgrade fail

I got this error when attempting npx elm-upgrade

$ npx elm-upgrade
{ HTTPError: Response code 404 (Not Found)
    at stream.catch.then.data (/usr/local/lib/node_modules/elm-upgrade/node_modules/got/index.js:129:13)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  message: 'Response code 404 (Not Found)',
  host: 'package.elm-lang.org',
  hostname: 'package.elm-lang.org',
  method: 'GET',
  path: '/new-packages',
  statusCode: 404,
  statusMessage: 'Not Found' }
ERROR: Unable to connect to http://package.elm-lang.org.  Please try again later.

Any thoughts?

ENOTFOUND alpha.elm-lang.org

What worked

git clone https://github.com/avh4/elm-upgrade.git
npm install -g `pwd` # install `elm-upgrade` from local git repo, master branch
npm install -g elm-format@rc
cd path/to/my/elm/project
elm-upgrade

What didn't work

Instructions at https://github.com/avh4/elm-upgrade/tree/rc#how-to-use-it

npm install -g elm-format@rc  # Elm 0.19 alpha version of elm-format
npm install -g elm-upgrade@rc
cd path/to/my/elm/project
elm-upgrade
**NOT FOR SHARING.** Do not post about the alpha/rc version of elm-upgrade on reddit, twitter, HN, discourse, etc.
**NOT FOR SHARING.** Learn why here: <https://www.deconstructconf.com/2017/evan-czaplicki-on-storytelling>

{ RequestError: getaddrinfo ENOTFOUND alpha.elm-lang.org alpha.elm-lang.org:443
    at ClientRequest.req.once.err ($HOME/.nvm/versions/node/v8.11.2/lib/node_modules/elm-upgrade/node_modules/got/index.js:73:21)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at TLSSocket.socketErrorListener (_http_client.js:387:9)
    at emitOne (events.js:116:13)
    at TLSSocket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  code: 'ENOTFOUND',
  message: 'getaddrinfo ENOTFOUND alpha.elm-lang.org alpha.elm-lang.org:443',
  host: 'alpha.elm-lang.org',
  hostname: 'alpha.elm-lang.org',
  method: 'GET',
  path: '/search.json' }
ERROR: Unable to connect to https://alpha.elm-lang.org.  Please try again later.

I suspect all can be fixed by updating npm?

Missing parens when inserting Range

@av: I just tried to elm-upgrade a project (elm-color-extra, obvisouly not mine), and noticed this diff:

-            List.map2 (\i cl -> ( (toFloat i / toFloat l), cl )) [0..l] palette
+            List.map2 (\i cl -> ( (toFloat i / toFloat l), cl )) List.range 0 l palette

And the compiler complains about the number of arguments to map2.

404 new-packages not found?

Am I doing something wrong here?

$ elm-upgrade                                                                    
{ HTTPError: Response code 404 (Not Found)
    at stream.catch.then.data (/usr/local/lib/node_modules/elm-upgrade/node_modules/got/index.js:123:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  message: 'Response code 404 (Not Found)',
  host: 'package.elm-lang.org',
  hostname: 'package.elm-lang.org',
  method: 'GET',
  path: '/new-packages',
  statusCode: 404,
  statusMessage: 'Not Found' }
ERROR: Unable to connect to http://package.elm-lang.org.  Please try again later.

Add other package renames

Ready to happen

  • elm-community/elm-linear-algebra -> elm-community/linear-algebra
  • elm-community/elm-lazy-list -> elm-community/lazy-list
  • elm-community/elm-webgl -> elm-community/webgl (elm-community/elm-webgl#42, elm-community/elm-webgl#16)
  • NoRedInk/elm-string-extra -> elm-community/string-extra
  • lorenzo/elm-string-addons -> elm-community/string-extra

Need to wait until these are published for 0.18

  • TBD

API migrations for Elm 0.19-rc

This is a tentative list from the limited info about Elm 0.19

  • 🛑 remove elm install ordering workaround (blocked on Elm)
  • add tests for non upgraded dependency
  • remove elm-package.json when done
  • add elm-lang/json if necessary
  • install test dependencies (blocked on elm-test)
  • add elm-lang/browser if necessary
  • for packages, move elm files to src/ (or warn)
  • move tests to tests/
  • update readme
  • for packages, warning if license is not in the whitelist
  • if more than 5 exposed modules, give warning (see upgrade docs)

js stuff

elm-format stuff

  • Tuple constructors (,,) are gone
  • Basics.(!) is gone
  • Basics.flip is gone
  • Basics.curry is gone
  • Basics.uncurry is gone
  • String escape sequences "\u{xxxx}"
  • large tuples are gone (should elm-format insert a warning comment?)
  • .program -> Browser.*
  • Json.parse returns Json.Error
  • name shadowing is not allowed
  • (maybe?) case on numbers becomes if/else?

Remove Html.App import

This must have come up a thousand times for everyone, so I am just leaving this here.

Upgrade of `elm-package.json` from 0.18 should include `elm-lang/core` as dependency.

Running elm-upgrade@rc on the elm-countries package resulted in "dependencies": {}, in the elm.json file:

supermario/elm-countries@3f6f240#diff-af640f91fe686ac1d41cf39269f952a9R11

This causes a confusing error (as import Platform.Sub is not code that exists in the package):

$ elm make
-- UNKNOWN IMPORT -------------------------------------------- src/Countries.elm

The Countries module has a bad import:

    import Platform.Sub

I cannot find that module! Is there a typo in the module name?

The "source-directories" field of your elm.json tells me to only look in the src
directory, but it is not there. Maybe it is in a package that is not installed
yet?

I eventually noticed the issue based on the fact elm-lang/core was present in the elm.json for applications docs.

Running elm install elm-lang/core fixed the issue, and the resulting diff I suppose is what elm-upgrade should generate initially:

diff --git a/elm.json b/elm.json
index 242064d..48af8a3 100644
--- a/elm.json
+++ b/elm.json
@@ -8,6 +8,8 @@
         "Countries"
     ],
     "elm-version": "0.19.0 <= v < 0.20.0",
-    "dependencies": {},
+    "dependencies": {
+        "elm-lang/core": "6.0.0 <= v < 7.0.0"
+    },
     "test-dependencies": {}

missing dependency on semver

Trying to run elm-upgrade gave me this error message:

elm-upgrade
module.js:471
    throw err;
    ^

Error: Cannot find module 'semver'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/nick/npm_packages/lib/node_modules/elm-upgrade/upgrade.js:6:14)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

Error went away after I ran npm install -g semver.

I see that semver is a dev dependency. Maybe that needs to be changed to a regular ol' dependency?

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.