Skip to content

Commit

Permalink
Close #41
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagodp committed May 24, 2019
1 parent 79c0c71 commit a84862b
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 38 deletions.
15 changes: 15 additions & 0 deletions dist/modules/app/AppController.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const GuidedConfig_1 = require("./GuidedConfig");
const fs_1 = require("fs");
const util_1 = require("util");
const path_1 = require("path");
const semverDiff = require("semver-diff");
const terminalLink = require("terminal-link");
/**
* Application controller
*
Expand Down Expand Up @@ -90,6 +92,19 @@ class AppController {
updateCheckInterval: 1000 * 60 * 60 * 12 // 12 hours
});
notifier.notify();
if (!!notifier.update) {
const url = 'https://github.com/thiagodp/concordialang/releases';
const link = terminalLink('RELEASE NOTES', url);
const diff = semverDiff(notifier.update.current, notifier.update.latest);
const hasBreakingChange = 'major' === diff;
if (hasBreakingChange) {
cli.newLine(cli.colorHighlight('→'), cli.bgHighlight('PLEASE READ THE RELEASE NOTES BEFORE UPDATING'));
cli.newLine(cli.colorHighlight('→'), link);
}
else {
cli.newLine(cli.colorHighlight('→'), 'See the', link, 'for details.');
}
}
if (options.newer) {
if (!notifier.update) {
cli.newLine(cli.symbolInfo, 'No update available');
Expand Down
17 changes: 17 additions & 0 deletions modules/app/AppController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { GuidedConfig } from './GuidedConfig';
import { writeFile, existsSync } from 'fs';
import { promisify } from 'util';
import { join } from 'path';
import * as semverDiff from 'semver-diff';
import * as terminalLink from 'terminal-link';

/**
* Application controller
Expand Down Expand Up @@ -100,6 +102,21 @@ export class AppController {
);
notifier.notify();

if ( !! notifier.update ) {
const url = 'https://github.com/thiagodp/concordialang/releases';
const link = terminalLink( 'RELEASE NOTES', url );

const diff = semverDiff( notifier.update.current, notifier.update.latest );
const hasBreakingChange: boolean = 'major' === diff;

if ( hasBreakingChange ) {
cli.newLine( cli.colorHighlight( '→' ), cli.bgHighlight( 'PLEASE READ THE RELEASE NOTES BEFORE UPDATING' ) );
cli.newLine( cli.colorHighlight( '→' ), link );
} else {
cli.newLine( cli.colorHighlight( '→' ), 'See the', link, 'for details.' );
}
}

if ( options.newer ) {
if ( ! notifier.update ) {
cli.newLine( cli.symbolInfo, 'No update available' );
Expand Down
123 changes: 85 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@
"pretty-bytes": "^4.0.2",
"randexp": "^0.4.9",
"seedrandom": "^2.4.3",
"semver-diff": "^3.0.0",
"shuffle-obj-arrays": "^1.0.0",
"sprintf-js": "^1.1.1",
"sqlstring": "^2.3.1",
"terminal-link": "^1.3.0",
"update-notifier": "^2.5.0",
"xregexp": "^3.2.0"
},
Expand Down

0 comments on commit a84862b

Please sign in to comment.