This repository was archived by the owner on Apr 15, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
packages/framework-plugin-function Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ cloudbase framework deploy
6262 "use" : " @cloudbase/framework-plugin-function" ,
6363 "inputs" : {
6464 "functionRootPath" : " ./cloudfunctions" ,
65+ "publishIncludeList" : " {{env.publishIncludeList}}" ,
6566 "functionDefaultConfig" : {
6667 "timeout" : 5 ,
6768 "envVariables" : {
@@ -156,6 +157,12 @@ CloudBaseFramework 1.6.1 以后支持, 单个函数的配置会在该默认配
156157
157158选择自动创建新版本,可以在控制台进行流量的灰度和控制,不选择的情况下会自动原位更新
158159
160+ ### ` publishIncludeList `
161+
162+ 1.6.16 版本以后支持,如果指定,则只发布列表中的函数
163+
164+ 字符串格式,格式如 'fn1,fn2'
165+
159166## 更多插件
160167
161168请访问 [ CloudBase Framework 插件列表] ( https://github.com/Tencent/cloudbase-framework#%E7%9B%AE%E5%89%8D%E6%94%AF%E6%8C%81%E7%9A%84%E6%8F%92%E4%BB%B6%E5%88%97%E8%A1%A8 ) 搭配使用其他插件
Original file line number Diff line number Diff line change @@ -47,6 +47,12 @@ export interface IFrameworkPluginFunctionInputs {
4747 * ```
4848 */
4949 servicePaths ?: Record < string , string > ;
50+ /**
51+ * 1.6.16 版本以后支持
52+ * 如果指定,则只发布列表中的函数
53+ * 字符串格式,格式如 'fn1,fn2'
54+ */
55+ publishIncludeList ?: string ;
5056}
5157
5258export interface IFunctionTriggerOptions {
@@ -189,8 +195,24 @@ class FunctionPlugin extends Plugin {
189195
190196 this . resolvedInputs = resolveInputs ( this . inputs , DEFAULT_INPUTS ) ;
191197
192- this . resolvedInputs . functions = this . resolvedInputs . functions . map (
193- ( func : any ) => {
198+ let publishIncludeList : string [ ] ;
199+ if ( this . resolvedInputs . publishIncludeList ) {
200+ this . api . logger . debug (
201+ 'publishIncludeList' ,
202+ this . resolvedInputs . publishIncludeList
203+ ) ;
204+ publishIncludeList = this . resolvedInputs . publishIncludeList . split ( ',' ) ;
205+ }
206+
207+ this . resolvedInputs . functions = this . resolvedInputs . functions
208+ . filter ( ( func ) => {
209+ if ( publishIncludeList ) {
210+ return publishIncludeList . includes ( func . name ) ;
211+ } else {
212+ return true ;
213+ }
214+ } )
215+ . map ( ( func : any ) => {
194216 return merge (
195217 { } ,
196218 {
@@ -201,8 +223,7 @@ class FunctionPlugin extends Plugin {
201223 this . resolvedInputs . functionDefaultConfig ,
202224 func
203225 ) ;
204- }
205- ) ;
226+ } ) ;
206227
207228 this . functions = this . resolvedInputs . functions ;
208229 this . functionRootPath = path . isAbsolute (
You can’t perform that action at this time.
0 commit comments