更新环境判断

master
yutent 2023-05-23 18:36:35 +08:00
parent bc285cbf0d
commit 61ffe4668a
4 changed files with 7 additions and 10 deletions

View File

@ -11,7 +11,7 @@ import prompts from 'prompts'
import fs from 'iofs'
import { resolve, join, dirname, normalize } from 'path'
const NODE_VERSION = +process.versions.node.split('.').slice(0, 2).join('.')
const NODE_VERSION = process.versions.node.split('.').map(n => +n)
const CURRENT_DIR = process.cwd()
const root = normalize(
dirname(import.meta.url.slice(process.platform === 'win32' ? 8 : 7))
@ -21,10 +21,10 @@ const DEFAULT_NAME = 'fite-app'
let targetDir = ''
if (NODE_VERSION < 16.6) {
console.log(red('Error: 你当前的环境不满足 Vue-live 构建工具的要求'))
if (NODE_VERSION[0] < 16 || (NODE_VERSION[0] === 16 && NODE_VERSION[1] < 6)) {
console.log(red('Error: 你当前的环境不满足 fite 构建工具的要求'))
console.log(
'Vue-live 需要Node.js版本在 %s 以上, \n你当前的Node.js版本为: %s',
'fite 需要Node.js版本在 %s 以上, \n你当前的Node.js版本为: %s',
blue('v16.6.0'),
red(process.version),
'\n\n'
@ -140,6 +140,7 @@ function sleep(num = 1) {
console.log('[ooc-------]', '30%')
fs.cp(join(root, './lib/common'), targetDir)
fs.cp(join(root, './lib/common/.gitignore'), targetDir)
console.log('[oooooc----]', '60%')
{

View File

@ -2,10 +2,6 @@
dist
node_modules
*.sublime-project
*.sublime-workspace
package-lock.json
._*
.Spotlight-V100

View File

@ -7,7 +7,7 @@
<title>{{title}}</title>
<meta name="keywords" content="{{keywords}}">
<meta name="description" content="{{description}}">
<link rel="stylesheet" href="//jscdn.ink/@bytedo/wcui/latest/css/reset-basic.css">
<link rel="stylesheet" href="//jscdn.ink/@bd/ui/latest/css/reset-basic.css">
<script async src="//jscdn.ink/es-module-shims/latest/es-module-shims.wasm.js"></script>
<script type="importmap">{{importmap}}</script>
{{#if process.env.NODE_ENV === 'development' }}

View File

@ -1,7 +1,7 @@
{
"name": "create-fite-app",
"type": "module",
"version": "1.1.0",
"version": "1.1.1",
"bin": {
"create-fite-app": "index.js"
},