From 4aaac1b971ddd2995493f1741e75e51296cb5db0 Mon Sep 17 00:00:00 2001 From: "luk.lu" Date: Tue, 11 Oct 2022 15:47:11 +0800 Subject: [PATCH] add 'vue-cli-uniapp.sh' --- git-clone-all.bat | 6 ------ git-clone-all.sh | 6 ------ vue-cli-uniapp.sh | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 vue-cli-uniapp.sh diff --git a/git-clone-all.bat b/git-clone-all.bat index c6466ab..d1f206d 100644 --- a/git-clone-all.bat +++ b/git-clone-all.bat @@ -1,8 +1,3 @@ -mkdir com -pushd com -git clone https://git.faronear.org/com/www.yuanjin.net -popd - mkdir cup pushd cup git clone https://git.faronear.org/cup/code.gasj.allinone @@ -16,7 +11,6 @@ pushd fon git clone https://git.faronear.org/npm/sysconfig git clone https://git.faronear.org/fon/dot.vscode git clone https://git.faronear.org/fon/www.faronear.com -git clone https://git.faronear.org/fon/fon-www-uniapp-cli git clone https://git.faronear.org/fon/yapi.faronear.org git clone https://git.faronear.org/fon/git.faronear.org git clone https://git.faronear.org/fon/www.faronear.org diff --git a/git-clone-all.sh b/git-clone-all.sh index 0260626..9a68f0c 100755 --- a/git-clone-all.sh +++ b/git-clone-all.sh @@ -1,10 +1,5 @@ #!/bin/bash -mkdir com -pushd com -git clone https://git.faronear.org/com/www.yuanjin.net -popd - mkdir cup pushd cup git clone https://git.faronear.org/cup/gasj-allinone @@ -18,7 +13,6 @@ pushd fon git clone https://git.faronear.org/npm/sysconfig git clone https://git.faronear.org/fon/dot.vscode git clone https://git.faronear.org/fon/www.faronear.com -git clone https://git.faronear.org/fon/fon-www-uniapp-cli git clone https://git.faronear.org/fon/yapi.faronear.org git clone https://git.faronear.org/fon/git.faronear.org git clone https://git.faronear.org/fon/www.faronear.org diff --git a/vue-cli-uniapp.sh b/vue-cli-uniapp.sh new file mode 100644 index 0000000..03a227c --- /dev/null +++ b/vue-cli-uniapp.sh @@ -0,0 +1,36 @@ +#!/bin/bash + + +echo *** 把 HBuilder 创建的 uniapp 应用转换成 vue-cli 应用的脚手架。 +echo *** More info at https://uniapp.dcloud.net.cn/quickstart-cli.html + +echo === CLI project name? +read -p '>>> ' PROJECT + +if [ $PROJECT ] +then + npm i -g @vue/cli@4 ## 最新版 5.x 会导致 Hello-uni-app 报错无法找到一些库 + vue create -p dcloudio/uni-preset-vue $PROJECT + cd $PROJECT + mv src src-old + echo === Originial Repository URL? + read -p '>>> ' $url + echo + echo *** 下载一个 HBuilderX 创建的项目下载存为 src 目录: + echo + git clone $url src + echo + echo *** 进入 src 安装依赖库 + cd src + npm run boot + cd .. + echo + echo *** `npm run serve` to start + echo +fi + +## 如果 vue create 选择默认模板,生成的 package.json 其实和 Hello 版一摸一样,只是 devDependencies 缺少了 sass 和 sass-loader。 +## 选择 Hello uni-app 作为模板,则有 sass 库,并且 src 下具有所有扩展UI组件,方便作为定制基础。 +## 如果 `rm -fr node_modules && npm i`` 重新安装,再运行 `npm run serve`` 会出错 `Error: Cannot find module 'html-webpack-plugin'`。必须从 vue create 开始才可以运行。 + +## 严重注意,src 必须是直属目录,不能是符号链接!否则不论在 windows / nix 里都无法 npm run serve。 \ No newline at end of file