-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,56 @@ | ||
const path = require('path') | ||
const ci = require('miniprogram-ci') | ||
const { execSync } = require('child_process') | ||
|
||
const cwd = process.cwd() | ||
const { version } = require(path.resolve(cwd + '/package.json')) | ||
const now = new Date().toLocaleDateString(); | ||
|
||
const ROBOT_MAP = { | ||
'pre': 2, | ||
'main': 3 | ||
} | ||
|
||
const getCurrentBranch = () => execSync('git branch --show-current').toString().trim() | ||
const getLatestCommitAuthor = () => execSync('git log -1 --pretty=format:"%an <%ae>"').toString().trim(); | ||
const getTargetRobotId = () => ROBOT_MAP[getCurrentBranch()] | ||
|
||
|
||
const upload = async () => { | ||
const robot = getTargetRobotId() | ||
console.log('当前分支:' + getCurrentBranch() + ' 机器人编号为:' + robot); | ||
if (!robot) { | ||
console.log('您当前不在能够上传产物的白名单分支,请切换到指定分支并重新构建产物'); | ||
return | ||
} | ||
|
||
const desc = ` | ||
【时间】:${new Date().toLocaleDateString()} | ||
【分支】:${getCurrentBranch()} | ||
【操作人】:${getLatestCommitAuthor()} | ||
【version】:v${version} | ||
` | ||
|
||
const project = new ci.Project({ | ||
appid: 'wx6836fb3c447f8868', | ||
type: 'miniProgram', | ||
projectPath: process.cwd() + '/dist', | ||
privateKeyPath: process.cwd() + '/private.key', | ||
ignores: ['node_modules/**/*'], | ||
}) | ||
|
||
const uploadResult = await ci.upload({ | ||
project, | ||
version, | ||
desc: now + ' 提交版本 v: ' + version, | ||
desc, | ||
setting: { | ||
es6: true, | ||
minify: true, | ||
autoPrefixWXSS: true | ||
}, | ||
robot, | ||
onProgressUpdate: console.log, | ||
}) | ||
console.log(uploadResult) | ||
} | ||
upload() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
export default definePageConfig({ | ||
navigationBarTitleText: '当我在追光~', | ||
enablePullDownRefresh: true, | ||
navigationStyle: 'custom', | ||
enableShareAppMessage: true, | ||
enableShareTimeline: true | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.index_wrapper { | ||
width: 750rpx; | ||
height: 100vh; | ||
background-color: #fff; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters