Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

多了个符号miniprogram-ci打包报错 #163

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: WeChat MiniProgram Demo CI/CD

on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
upload:
runs-on: ubuntu-latest
steps:
- name: Upload MiniProgram
env:
WX_PRIVATE_KEY: ${{ secrets.WX_PRIVATE_KEY }}
run: |
echo "$WX_PRIVATE_KEY" > ./build/key
node ./build/ci.js
47 changes: 47 additions & 0 deletions build/ci.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const path = require('path')
const ci = require('miniprogram-ci')
const fs = require('fs')
const packageJson = require('../package.json')

const privateKeyContent = process.env.WX_PRIVATE_KEY
if (!privateKeyContent) {
throw new Error('未找到私钥内容,请确保已正确配置 GitHub Secrets')
}

const privateKeyPath = path.resolve(__dirname, './private.key')
fs.writeFileSync(privateKeyPath, privateKeyContent)

const project = new ci.Project({
appid: 'wx622bee4f78fa4f5a',
type: 'miniProgram',
projectPath: path.resolve(__dirname, '../'),
privateKeyPath: path.resolve(__dirname, './key'),
ignores: [path.resolve(__dirname, '../miniprogram/node_modules/**/*')]
})
const robotNumber = 2
const params = {
onProgressUpdate: console.log,
robot: robotNumber,
version: packageJson.version,
desc: packageJson.bundleDescription,
setting: {
es7: true,
minifyJS: true,
minifyWXML: true,
minifyWXSS: true,
codeProtect: false,
autoPrefixWXSS: true
},
}
ci.upload({
project,
...params
}).then(res => {
console.debug('>>>>upload res', res)
}).catch(err => {
console.error('>>>>upload error', err)
throw err
}).finally(() => {
// 删除临时私钥文件
fs.unlinkSync(privateKeyPath)
})
3 changes: 3 additions & 0 deletions miniprogram/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,14 @@
"pages/view/sticky/sticky-section/sticky-section",
"pages/view/movable-view/movable-view",
"pages/view/cover-view/cover-view",
"pages/view/match-media/match-media",
"pages/view/page-container/page-container",
"pages/view/sticky/sticky",
"pages/content/text/text",
"pages/content/icon/icon",
"pages/content/progress/progress",
"pages/content/rich-text/rich-text",
"pages/content/selection/selection",
"pages/form/button/button",
"pages/form/checkbox/checkbox",
"pages/form/form/form",
Expand Down
206 changes: 108 additions & 98 deletions miniprogram/component/navigation-bar/navigation-bar.js
Original file line number Diff line number Diff line change
@@ -1,82 +1,93 @@
Component({
options: {
multipleSlots: true // 在组件定义时的选项中启用多slot支持
styleIsolation: 'apply-shared', // 表示页面 wxss 样式将影响到自定义组件,但自定义组件 wxss 中指定的样式不会影响页面
multipleSlots: true // 在组件定义时的选项中启用多slot支持
},
/**
* 组件的属性列表
*/
properties: {
extClass: {
type: String,
value: ''
},
title: {
type: String,
value: ''
},
background: {
type: String,
value: ''
},
color: {
type: String,
value: ''
},
back: {
type: Boolean,
value: true
},
loading: {
type: Boolean,
value: false
},
animated: {
// 显示隐藏的时候opacity动画效果
type: Boolean,
value: true
},
show: {
// 显示隐藏导航,隐藏的时候navigation-bar的高度占位还在
type: Boolean,
value: true,
observer: '_showChange'
},
// back为true的时候,返回的页面深度
delta: {
type: Number,
value: 1
}
extClass: {
type: String,
value: ''
},
title: {
type: String,
value: ''
},
background: {
type: String,
value: ''
},
color: {
type: String,
value: ''
},
back: {
type: Boolean,
value: true
},
loading: {
type: Boolean,
value: false
},
animated: {
// 显示隐藏的时候opacity动画效果
type: Boolean,
value: true
},
show: {
// 显示隐藏导航,隐藏的时候navigation-bar的高度占位还在
type: Boolean,
value: true,
observer: '_showChange'
},
// back为true的时候,返回的页面深度
delta: {
type: Number,
value: 1
}
},
/**
* 组件的初始数据
*/
* 组件的初始数据
*/
data: {
displayStyle: ''
displayStyle: ''
},
attached() {
const isSupport = !!wx.getMenuButtonBoundingClientRect
const rect = wx.getMenuButtonBoundingClientRect
? wx.getMenuButtonBoundingClientRect()
: null
const isSkyline = this.renderer ==='skyline'
wx.getSystemInfo({
success: (res) => {
const ios = !!(res.system.toLowerCase().search('ios') + 1)
this.setData({
ios,
statusBarHeight: res.statusBarHeight,
// skyline defaultContentBox:true ; webview border-box
navBarHeight: rect.bottom - rect.top + 10 + ( isSkyline ? 0 : res.statusBarHeight),
innerWidth: isSupport ? `width:${rect.left}px` : '',
innerPaddingRight: isSupport
? `padding-right:${res.windowWidth - rect.left}px`
: '',
leftWidth: isSupport ? `width:${res.windowWidth - rect.left}px` : '',
theme: res.theme || 'light',
})
}
})
? wx.getMenuButtonBoundingClientRect()
: null
const isSkyline = this.renderer === 'skyline'
console.log('rect', rect)

if (wx.getDeviceInfo) {
const deviceInfo = wx.getDeviceInfo()
const ios = !!(deviceInfo.system.toLowerCase().search('ios') + 1)
this.setData({
ios
})
}
if (wx.getAppBaseInfo) {
const appBaseInfo = wx.getAppBaseInfo()
this.setData({
theme: appBaseInfo.theme || 'light',
})
}
if (wx.getWindowInfo) {
const windowInfo = wx.getWindowInfo()
console.log('windowInfo', windowInfo)
this.setData({
statusBarHeight: windowInfo.statusBarHeight,
navBarHeight: rect.bottom - rect.top + 10 + (isSkyline ? 0 : windowInfo.statusBarHeight),
innerWidth: isSupport ? `width:${rect.left}px` : '',
innerPaddingRight: isSupport
? `padding-right:${windowInfo.windowWidth - rect.left}px`
: '',
leftWidth: isSupport ? `width:${windowInfo.windowWidth - rect.left}px` : '',
})
}
if (wx.onThemeChange) {
wx.onThemeChange(({theme}) => {
this.setData({theme})
Expand All @@ -89,42 +100,41 @@ Component({
}
},
/**
* 组件的方法列表
*/
* 组件的方法列表
*/
methods: {
_showChange(show) {
const animated = this.data.animated
let displayStyle = ''
if (animated) {
displayStyle = `opacity: ${
show ? '1' : '0'
};-webkit-transition:opacity 0.5s;transition:opacity 0.5s;`
} else {
displayStyle = `display: ${show ? '' : 'none'}`
}
this.setData({
displayStyle
})
},
back() {
const data = this.data
console.log('---------222',getCurrentPages().length)
if (data.delta) {
wx.navigateBack({
delta: data.delta
})
}
// 如果是直接打开的,就默认回首页
if (getCurrentPages().length == 1) {
console.log('---------333')
wx.switchTab({
url: '/page/component/index',
complete: (res) => {
console.log(res)
}
})
_showChange(show) {
const animated = this.data.animated
let displayStyle = ''
if (animated) {
displayStyle = `opacity: ${show ? '1' : '0'
};-webkit-transition:opacity 0.5s;transition:opacity 0.5s;`
} else {
displayStyle = `display: ${show ? '' : 'none'}`
}
this.setData({
displayStyle
})
},
back() {
const data = this.data
console.log('---------222', getCurrentPages().length)
if (data.delta) {
wx.navigateBack({
delta: data.delta
})
}
// 如果是直接打开的,就默认回首页
if (getCurrentPages().length == 1) {
console.log('---------333')
wx.switchTab({
url: '/page/component/index',
complete: (res) => {
console.log(res)
}
this.triggerEvent('back', { delta: data.delta }, {})
})
}
this.triggerEvent('back', {delta: data.delta}, {})
}
}
})
3 changes: 1 addition & 2 deletions miniprogram/component/navigation-bar/navigation-bar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
"component": true,
"usingComponents": {},
"componentFramework": "glass-easel",
"renderer": "skyline",
"styleIsolation": "apply-shared"
"renderer": "skyline"
}
2 changes: 1 addition & 1 deletion miniprogram/component/navigation-bar/navigation-bar.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</block>
</view>

<view class='weui-navigation-bar__right'>
<view class='weui-navigation-bar__right__slot'>
<slot name="right"></slot>
</view>
</view>
Expand Down
3 changes: 2 additions & 1 deletion miniprogram/components/popup/index.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ root-portal {
.popup {
position: absolute;
bottom: 0;
top: 0;
z-index: 5000;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
width: 100vw;
height: 200px;
/* height: 200px; */
background: rgba(51, 51, 51, 0.65);
opacity: 1;
transform: scale3d(1, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"navigationBarTitleText": "progress",
"navigationStyle": "custom"
"navigationStyle": "default",
"renderer": "webview"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

<view class="container page" data-weui-theme="{{theme}}">
<template is="head" data="{{title: 'progress'}}"/>

<view class="page-body">
<view class="page-section page-section-gap">

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"navigationBarTitleText": "rich-text",
"renderer": "webview"
"componentFramework": "glass-easel",
"renderer": "skyline",
"navigationStyle": "custom"
}
Loading