更新环境判断

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

View File

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

View File

@ -7,7 +7,7 @@
<title>{{title}}</title> <title>{{title}}</title>
<meta name="keywords" content="{{keywords}}"> <meta name="keywords" content="{{keywords}}">
<meta name="description" content="{{description}}"> <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 async src="//jscdn.ink/es-module-shims/latest/es-module-shims.wasm.js"></script>
<script type="importmap">{{importmap}}</script> <script type="importmap">{{importmap}}</script>
{{#if process.env.NODE_ENV === 'development' }} {{#if process.env.NODE_ENV === 'development' }}

View File

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