Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ var fs = require('fs-extra');
var child_process = require('child_process');
var which = require('which');

var packagesRequiringUpgrade = [];


function howToInstallElm(){
return 'Install Elm here https://guide.elm-lang.org/get_started.html#install\n'
Expand All @@ -15,7 +17,28 @@ function howToInstallElmFormat(){

function displayHintForNonUpgradedPackage(packageName){
process.stdout.write(`WARNING: ${packageName} has not been upgraded to 0.18 yet!\n`);
process.stdout.write(`WARNING: You can make an issue for 0.18 upgrade here: https://github.com/${packageName}\n`)
packagesRequiringUpgrade.push(packageName);
}

function displaySuccessMessage() {
process.stdout.write(
'SUCCESS! Your project\'s dependencies and code have been upgraded.\n'
+ 'However, your project may not yet compile due to API changes in your\n'
+ 'dependencies.\n\n'
+ 'See https://github.com/elm-lang/elm-platform/blob/master/upgrade-docs/0.18.md\n'
+ 'and the documentation for your dependencies for more information.\n\n'
);

if (packagesRequiringUpgrade.length > 0) {
process.stdout.write(
'WARNING! Several of your dependencies have not yet been upgraded to \n'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several -> give exact count

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

+ 'support Elm 0.18. You can create an issue to request the packages be \n'
+ 'upgraded here:\n');
packagesRequiringUpgrade.forEach(function(packageName) {
process.stdout.write(' - https://github.com/' + packageName + '/issues\n');
});
process.stdout.write('\n');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fwiw, we could also automate making 0.18 upgrade PRs

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh making the PRs... Hmm.. That's a cool idea! I think if we wanted to automate the PRs, it would be better to separately just go through all the published packages and create the PRs (as an independent, one-time script), and not have elm-upgrade to that, since so many people will be running it.

Also, I didn't want to automate issue creation because most likely there will already be an issue created, and I don't want all package maintainers to get a bunch of duplicate issue reports.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's what I did for 0.16. It was a bit trickier than because some things just couldn't be done by hand

}
}

function findBinary(name, message) {
Expand Down Expand Up @@ -120,7 +143,8 @@ function main(knownUpgrades) {
child_process.execFileSync(elmFormat, ['--yes', '--elm-version', '0.18', sourceDir]);
})

process.stdout.write('\n\nSUCCESS! Your project\'s dependencies and code have been upgraded.\nHowever, your project may not yet compile due to API changes in your\ndependencies.\n\nSee https://github.com/elm-lang/elm-platform/blob/master/upgrade-docs/0.18.md\nand the documentation for your dependencies for more information.\n\n');
process.stdout.write('\n\n');
displaySuccessMessage();
}

function init(){
Expand Down