Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PublicShell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢卓城
PublicShell
Commits
e47bb8cd
Commit
e47bb8cd
authored
Dec 28, 2020
by
谢卓城
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增:1.设置小程序的appid。2.打开小程序目录。修复:1.生成miniprogram_mini失败问题。2.miniprogram-ci重复安装问题。
parent
e37fbc19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
21 deletions
+52
-21
MiniprogramTemplate.sh
MiniprogramTemplate.sh
+52
-21
No files found.
MiniprogramTemplate.sh
View file @
e47bb8cd
#!
/usr/bin/env ba
sh
#!
/bin/
sh
miniPath
=
""
miniPath
=
""
...
@@ -13,7 +13,6 @@ else
...
@@ -13,7 +13,6 @@ else
fi
fi
fi
fi
if
[
!
-d
$miniPath
]
;
then
if
[
!
-d
$miniPath
]
;
then
echo
"########## 找不到小程序的路径,自动创建文件夹 ##########"
echo
"########## 找不到小程序的路径,自动创建文件夹 ##########"
mkdir
"
$miniPath
"
mkdir
"
$miniPath
"
...
@@ -29,13 +28,34 @@ git clone http://git.changein.cn/xzc168520/miniprogramtemplate.git
...
@@ -29,13 +28,34 @@ git clone http://git.changein.cn/xzc168520/miniprogramtemplate.git
rm
-rf
.git
rm
-rf
.git
# 移动小程序模板的文件并删除空文件夹
# 移动小程序模板的文件并删除空文件夹
mv
./miniprogramtemplate/
**
./
mv
{
miniprogramtemplate/
*
,miniprogramtemplate/.
*
}
./
rm
-rf
.DS_Store
rm
-rf
miniprogramtemplate
rm
-rf
miniprogramtemplate
# 初始化 git
echo
"########## 输入小程序的appid ##########"
git init
appid
=
"wx238862d8fac4ce23"
read
-p
"请输入小程序的appid:"
commitText
if
[
${#
commitText
}
-eq
18
]
;
then
appid
=
$commitText
else
echo
"########## 小程序的appid输入错误:
${
appid
}
##########"
cd
..
rm
-rf
$miniPath
exit
127
fi
# 设置小程序的appid
sed
"s/
\"
appid
\"
:
\"\"
/
\"
appid
\"
:
\"
${
appid
}
\"
/"
project.config.json>project.config.json.bak
rm
project.config.json
mv
project.config.json.bak project.config.json
echo
"########## 安装小程序npm包 ##########"
npm
install
echo
"########## 初始化小程序npm包 ##########"
echo
"########## 进入package文件夹 ##########"
cd
package
cd
package
ls
ls
...
@@ -43,9 +63,14 @@ echo "########## 初始化 npm ##########"
...
@@ -43,9 +63,14 @@ echo "########## 初始化 npm ##########"
# 初始化 npm
# 初始化 npm
npm init
-y
npm init
-y
echo
"########## 安装miniprogram-ci nmaxios ##########"
result
=
`
npm list
-g
--depth
0 miniprogram-ci |
grep
@
`
npm
install
--save
miniprogram-ci nmaxios
if
[
"
${#
result
}
"
==
0
]
;
then
echo
"########## 安装miniprogram-ci ##########"
npm
install
--save
miniprogram-ci
-g
fi
echo
"########## 安装 nmaxios ##########"
npm
install
--save
nmaxios
echo
"########## 小程序根目录 ##########"
echo
"########## 小程序根目录 ##########"
cd
..
cd
..
...
@@ -56,26 +81,32 @@ npm run devBuild
...
@@ -56,26 +81,32 @@ npm run devBuild
echo
"########## 生成小程序miniprogram_npm包 ##########"
echo
"########## 生成小程序miniprogram_npm包 ##########"
cd
package
cd
package
miniprogram-ci pack-npm-manually
--pack-npm-manually-package-json-path
./package.json
--pack-npm-manually-miniprogram-npm-dist-dir
../dist/
ls
miniprogram-ci pack-npm-manually
--pack-npm-manually-package-json-path
./package.json
--pack-npm-manually-miniprogram-npm-dist-dir
../dist/
--appid
wx238862d8fac4ce23
cd
..
cd
..
if
[
"
$(
uname
)
"
==
"Darwin"
]
;
then
sysOS
=
`
uname
-s
`
# Mac OS X 操作系统
if
[
$sysOS
==
"Darwin"
]
;
then
/Applications/wechatwebdevtools.app/Contents/MacOS/cli open
--project
./dist
# Mac OS X 操作系统
open ./dist
# /Applications/wechatwebdevtools.app/Contents/MacOS/cli open --p ./dist
if
[
$?
-ne
0
]
;
then
if
[
$?
-ne
0
]
;
then
echo
"########## 打开小程序工具失败 ##########"
echo
"########## 打开小程序工具失败 ##########"
open ./dist
open ./dist
else
echo
"########## 双击app.wxss打开小程序 ##########"
fi
fi
elif
[
"
$(
expr
substr
$(
uname
-s
)
1 5
)
"
==
"Linux"
]
;
then
elif
[
$sysOS
==
"Linux"
]
;
then
# GNU/Linux操作系统
echo
"########## 双击app.wxss打开小程序 ##########"
echo
"########## 双击app.wxss打开小程序 ##########"
open ./dist
open ./dist
elif
[
"
$(
expr
substr
$(
uname
-s
)
1 10
)
"
==
"MINGW32_NT"
]
;
then
else
# Windows NT操作系统
echo
"########## 双击app.wxss打开小程序 ##########"
echo
"########## 双击app.wxss打开小程序 ##########"
open ./dist
open ./dist
fi
fi
echo
"########## 开启小程序实时服务 ##########"
# 初始化 git
npm run dev
git init
\ No newline at end of file
echo
"########## 请自行运行npm run dev命令启动小程序实时服务 ##########"
# 因为gulp dev 会打断 生成miniprogram_mini 暂时手动启动小程序实时服务
# npm run dev
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment