@corva/create-app 0.37.0-0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/scripts/utils/version.js +14 -10
- package/package.json +1 -1
|
@@ -5,7 +5,11 @@ const inquirer = require('inquirer');
|
|
|
5
5
|
|
|
6
6
|
const packageJson = require('../../../package.json');
|
|
7
7
|
const npm = new NpmApi();
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
const error = chalk.bold.red;
|
|
10
|
+
const warning = chalk.hex('#FFA500'); // Orange
|
|
11
|
+
const code = chalk.cyan;
|
|
12
|
+
const asterisks = '****************************************************************';
|
|
9
13
|
|
|
10
14
|
const getCurrentVersion = () => packageJson.version;
|
|
11
15
|
const getLatestVersion = async () => npm.repo('@corva/create-app').prop('version');
|
|
@@ -17,23 +21,23 @@ async function ensureLatestVersion() {
|
|
|
17
21
|
|
|
18
22
|
const isCurrentVersionOutdated = semver.gt(latestVersion, currentVersion);
|
|
19
23
|
if (isCurrentVersionOutdated) {
|
|
20
|
-
console.log(
|
|
21
|
-
console.log(
|
|
24
|
+
console.log(error(asterisks));
|
|
25
|
+
console.log(error`
|
|
22
26
|
Your version of the @corva/create-app is outdated.
|
|
23
27
|
There is a new version available ({green.bold ${latestVersion}}).
|
|
24
28
|
Please update the @corva/create-app with the following command:
|
|
25
29
|
|
|
26
|
-
npm i -g @corva/create-app@latest
|
|
30
|
+
${code('npm i -g @corva/create-app@latest')}
|
|
27
31
|
|
|
28
32
|
`);
|
|
29
|
-
console.log(
|
|
33
|
+
console.log(error(asterisks));
|
|
30
34
|
process.exit(0);
|
|
31
35
|
}
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
// NOTE: Show user-friendly warning if version is outdated
|
|
35
39
|
async function warnIfOutdated() {
|
|
36
|
-
process.stdout.write('Checking for updates
|
|
40
|
+
process.stdout.write('Checking for updates...\n');
|
|
37
41
|
|
|
38
42
|
const currentVersion = getCurrentVersion();
|
|
39
43
|
const latestVersion = await getLatestVersion();
|
|
@@ -41,15 +45,15 @@ async function warnIfOutdated() {
|
|
|
41
45
|
const isCurrentVersionOutdated = semver.gt(latestVersion, currentVersion);
|
|
42
46
|
|
|
43
47
|
if (isCurrentVersionOutdated) {
|
|
44
|
-
console.log(
|
|
45
|
-
console.log(
|
|
48
|
+
console.log(warning(asterisks));
|
|
49
|
+
console.log(warning`
|
|
46
50
|
There is a new version available ({green.bold ${latestVersion}}).
|
|
47
51
|
You can update the CLI version with the following command:
|
|
48
52
|
|
|
49
|
-
npm i -g @corva/create-app@latest
|
|
53
|
+
${code`npm i -g @corva/create-app@latest`}
|
|
50
54
|
|
|
51
55
|
`);
|
|
52
|
-
console.log(
|
|
56
|
+
console.log(warning(asterisks));
|
|
53
57
|
} else {
|
|
54
58
|
process.stdout.write(' ✅ \n');
|
|
55
59
|
}
|