From 4310f625472827fe24ad00591e30b2993af74e10 Mon Sep 17 00:00:00 2001 From: zsir Date: Mon, 27 May 2019 17:35:48 +0800 Subject: [PATCH 1/4] beautify log when developers init --- packages/taro-cli/templates/default/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/taro-cli/templates/default/index.js b/packages/taro-cli/templates/default/index.js index 64bee0b4712d..1def0060355f 100644 --- a/packages/taro-cli/templates/default/index.js +++ b/packages/taro-cli/templates/default/index.js @@ -147,7 +147,7 @@ module.exports = function (creater, params, helper, cb) { } else { command = 'npm install' } - const installSpinner = ora(`执行安装项目依赖 ${chalk.cyan.bold(command)}, 需要一会儿...`).start() + const installSpinner = ora(`执行安装项目依赖 ${chalk.cyan.bold(command)}, 需要一会儿...\n`).start() const install = shelljs.exec(command, { silent: true }) if (install.code === 0) { installSpinner.color = 'green' @@ -158,8 +158,8 @@ module.exports = function (creater, params, helper, cb) { installSpinner.fail(chalk.red('安装项目依赖失败,请自行重新安装!')) console.log(`${install.stderr}${install.stdout}`) } - console.log(chalk.green(`创建项目 ${chalk.green.bold(projectName)} 成功!`)) - console.log(chalk.green(`请进入项目目录 ${chalk.green.bold(projectName)} 开始工作吧!😝`)) + console.log(chalk.green(`创建项目 ${chalk.green.bold(projectName)} 成功!`), '\n') + console.log(chalk.green(`请进入项目目录 ${chalk.green.bold(projectName)} 开始工作吧!😝`), '\n') if (typeof cb === 'function') { cb() } From 53b928870e7efcdb226c76f49afa84f9703022e8 Mon Sep 17 00:00:00 2001 From: zsirfs Date: Wed, 23 Oct 2019 16:05:31 +0800 Subject: [PATCH 2/4] optimize: The value of the buffer method getEnv --- packages/taro/src/env.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/taro/src/env.js b/packages/taro/src/env.js index a8dc4ae79e40..84f9ce68c63b 100644 --- a/packages/taro/src/env.js +++ b/packages/taro/src/env.js @@ -9,29 +9,41 @@ export const ENV_TYPE = { JD: 'JD' } +let _env = null + +// 一个taro项目肯定运行同样的环境 export function getEnv () { + if (_env) return _env if (typeof jd !== 'undefined' && jd.getSystemInfo) { + _env = ENV_TYPE.JD return ENV_TYPE.JD } if (typeof qq !== 'undefined' && qq.getSystemInfo) { + _env = ENV_TYPE.QQ return ENV_TYPE.QQ } if (typeof tt !== 'undefined' && tt.getSystemInfo) { + _env = ENV_TYPE.TT return ENV_TYPE.TT } if (typeof wx !== 'undefined' && wx.getSystemInfo) { + _env = ENV_TYPE.WEAPP return ENV_TYPE.WEAPP } if (typeof swan !== 'undefined' && swan.getSystemInfo) { + _env = ENV_TYPE.SWAN return ENV_TYPE.SWAN } if (typeof my !== 'undefined' && my.getSystemInfo) { + _env = ENV_TYPE.ALIPAY return ENV_TYPE.ALIPAY } if (typeof global !== 'undefined' && global.__fbGenNativeModule) { + _env = ENV_TYPE.RN return ENV_TYPE.RN } if (typeof window !== 'undefined') { + _env = ENV_TYPE.WEB return ENV_TYPE.WEB } return 'Unknown environment' From 8be6780610cb2e1308aef3d9d76fe6daa084116c Mon Sep 17 00:00:00 2001 From: zsirfs Date: Sat, 2 Nov 2019 10:15:25 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E8=8E=AB=E5=90=8D=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/templates/default/src/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/taro-cli/templates/default/src/index.html b/packages/taro-cli/templates/default/src/index.html index 826f423513e9..7d3ba2f58ba8 100644 --- a/packages/taro-cli/templates/default/src/index.html +++ b/packages/taro-cli/templates/default/src/index.html @@ -10,7 +10,7 @@ From 37cdb3f650ce8d901659b41ecb6f9ce62a3bb7db Mon Sep 17 00:00:00 2001 From: zsirfs Date: Sat, 2 Nov 2019 10:46:42 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/templates/default/src/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/taro-cli/templates/default/src/index.html b/packages/taro-cli/templates/default/src/index.html index 7d3ba2f58ba8..f72013ec16cb 100644 --- a/packages/taro-cli/templates/default/src/index.html +++ b/packages/taro-cli/templates/default/src/index.html @@ -10,7 +10,7 @@