File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
1010### Added
1111
12+ - Warning about unusable Node version (less than v10.0.0)
13+
1214### Changed
1315
1416- Format of website in ` author ` field of ` package.json `
Original file line number Diff line number Diff line change 3939 "@types/fs-extra" : " ^9.0.1" ,
4040 "@types/inquirer" : " ^6.5.0" ,
4141 "@types/node" : " ^14.0.5" ,
42+ "@types/semver" : " ^7.2.0" ,
4243 "@types/update-notifier" : " ^4.1.0" ,
4344 "@types/validate-npm-package-name" : " ^3.0.0" ,
4445 "@types/yargs" : " ^15.0.5" ,
5657 "fs-extra" : " ^9.0.0" ,
5758 "inquirer" : " ^7.1.0" ,
5859 "ora" : " ^4.0.4" ,
60+ "semver" : " ^7.3.2" ,
5961 "update-notifier" : " ^4.1.0" ,
6062 "validate-npm-package-name" : " ^3.0.0"
6163 }
Original file line number Diff line number Diff line change @@ -23,7 +23,11 @@ import {
2323 replaceTemplateValues ,
2424} from "./init" ;
2525import { handleIncorrectApplicationName } from "./program" ;
26- import { cleanupError , validateApplicationName } from "./util" ;
26+ import {
27+ cleanupError ,
28+ validateApplicationName ,
29+ verifyNodeVersion ,
30+ } from "./util" ;
2731
2832/**
2933 * Main CLI Program
@@ -71,6 +75,9 @@ const main = async (): Promise<void> => {
7175 } )
7276 . parse ( process . argv ) ;
7377
78+ // * Very Node Version (>=10.0.0)
79+ verifyNodeVersion ( ) ;
80+
7481 // * Application Name must exist, and not consist of illegal characters
7582 validateApplicationName ( applicationName ) ;
7683 if ( ! applicationName ) return ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import chalk from "chalk";
22import { spawn } from "child_process" ;
33import fs from "fs-extra" ;
44import path from "path" ;
5+ import semver from "semver" ;
56import validateProjectName from "validate-npm-package-name" ;
67
78/**
@@ -105,3 +106,14 @@ export const validateApplicationName = (applicationName: any) => {
105106 process . exit ( 1 ) ;
106107 }
107108} ;
109+
110+ export const verifyNodeVersion = ( ) : void => {
111+ if ( ! semver . satisfies ( process . version , ">=10.0.0" ) ) {
112+ console . error (
113+ chalk . red ( `create-cli-application requires Node v10 or higher.` )
114+ ) ;
115+ console . error ( chalk . red ( `You are running Node ${ process . version } .` ) ) ;
116+ console . error ( chalk . red ( `Please update your version of Node.` ) ) ;
117+ process . exit ( 1 ) ;
118+ }
119+ } ;
You can’t perform that action at this time.
0 commit comments