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
e37fbc19
Commit
e37fbc19
authored
Dec 28, 2020
by
谢卓城
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first commit
parents
Pipeline
#164
failed with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
0 deletions
+82
-0
MiniprogramTemplate.sh
MiniprogramTemplate.sh
+82
-0
No files found.
MiniprogramTemplate.sh
0 → 100644
View file @
e37fbc19
#!/usr/bin/env bash
miniPath
=
""
if
[
-n
"
$1
"
]
;
then
miniPath
=
$1
else
if
[
!
-n
"
$1
"
]
;
then
read
-p
"请输入要创建的小程序路径:"
commitText
miniPath
=
$commitText
else
miniPath
=
$1
fi
fi
if
[
!
-d
$miniPath
]
;
then
echo
"########## 找不到小程序的路径,自动创建文件夹 ##########"
mkdir
"
$miniPath
"
fi
cd
$miniPath
echo
"########## 开始下载小程序模板 ##########"
# 下载小程序模板
git clone http://git.changein.cn/xzc168520/miniprogramtemplate.git
# 删除下载小程序模板的.git
rm
-rf
.git
# 移动小程序模板的文件并删除空文件夹
mv
./miniprogramtemplate/
**
./
rm
-rf
miniprogramtemplate
# 初始化 git
git init
echo
"########## 初始化小程序npm包 ##########"
cd
package
ls
echo
"########## 初始化 npm ##########"
# 初始化 npm
npm init
-y
echo
"########## 安装miniprogram-ci nmaxios ##########"
npm
install
--save
miniprogram-ci nmaxios
echo
"########## 小程序根目录 ##########"
cd
..
ls
echo
"########## 编译小程序 ##########"
npm run devBuild
echo
"########## 生成小程序miniprogram_npm包 ##########"
cd
package
miniprogram-ci pack-npm-manually
--pack-npm-manually-package-json-path
./package.json
--pack-npm-manually-miniprogram-npm-dist-dir
../dist/
cd
..
if
[
"
$(
uname
)
"
==
"Darwin"
]
;
then
# Mac OS X 操作系统
/Applications/wechatwebdevtools.app/Contents/MacOS/cli open
--project
./dist
if
[
$?
-ne
0
]
;
then
echo
"########## 打开小程序工具失败 ##########"
open ./dist
fi
elif
[
"
$(
expr
substr
$(
uname
-s
)
1 5
)
"
==
"Linux"
]
;
then
# GNU/Linux操作系统
echo
"########## 双击app.wxss打开小程序 ##########"
open ./dist
elif
[
"
$(
expr
substr
$(
uname
-s
)
1 10
)
"
==
"MINGW32_NT"
]
;
then
# Windows NT操作系统
echo
"########## 双击app.wxss打开小程序 ##########"
open ./dist
fi
echo
"########## 开启小程序实时服务 ##########"
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