Skip to content

Commit

Permalink
feat: add engine for node version & remove manual version check (#72)
Browse files Browse the repository at this point in the history
cheers
  • Loading branch information
jacoobes authored Aug 12, 2022
1 parent f9aa2c3 commit 2009d1f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 16 deletions.
40 changes: 40 additions & 0 deletions package-lock.json

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

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
"@types/prompts": "2.0.14",
"prettier": "2.7.1"
},
"engines": {
"node": ">= 16.10.x"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
Expand Down
17 changes: 1 addition & 16 deletions src/commands/init.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import prompts from 'prompts';
import ora from 'ora';
import { greenBright, redBright, yellowBright } from 'colorette';
import { greenBright, redBright } from 'colorette';
import { execa } from 'execa';
import { findUp } from 'find-up';
import {
Expand All @@ -23,21 +23,6 @@ const { prompt } = prompts;
* @param {{ y: string; sync: string; }} flags
*/
export async function init(flags) {
// * Check if node version is valid
const { version } = process;
const [major, minor] = version.split('.');
const majorNum = parseInt(major.slice(1));
const minorNum = parseInt(minor);

if (majorNum < 16 || (majorNum === 16 && minorNum < 10)) {
console.log(
yellowBright(
`\nYou are using Node ${version}\nPlease upgrade to Node 16.10.x or higher!\n`
)
);

process.exit(1);
}

let data;
let git_init;
Expand Down

0 comments on commit 2009d1f

Please sign in to comment.