diff --git a/index.js b/index.js index 3866ad7..dd1899a 100755 --- a/index.js +++ b/index.js @@ -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%') { diff --git a/lib/common/.gitignore b/lib/common/.gitignore index 2dde5ab..d9dbfc1 100644 --- a/lib/common/.gitignore +++ b/lib/common/.gitignore @@ -2,10 +2,6 @@ dist node_modules -*.sublime-project -*.sublime-workspace -package-lock.json - ._* .Spotlight-V100 diff --git a/lib/common/index.html b/lib/common/index.html index 9666934..8b7c51f 100644 --- a/lib/common/index.html +++ b/lib/common/index.html @@ -7,7 +7,7 @@ {{title}} - + {{#if process.env.NODE_ENV === 'development' }} diff --git a/package.json b/package.json index fa55732..8352ec1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "create-fite-app", "type": "module", - "version": "1.1.0", + "version": "1.1.1", "bin": { "create-fite-app": "index.js" },