-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update ts-multiple-functions directory structure
- Loading branch information
Showing
15 changed files
with
130 additions
and
16 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
15 changes: 0 additions & 15 deletions
15
cloudrunfunctions/ts-multiple-functions/cloudbase-functions.json
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
cloudrunfunctions/ts-multiple-functions/cloudrunfunctions/README.md
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,24 @@ | ||
# cloudrunfunctions 云函数2.0 | ||
|
||
该目录下包含两个函数: | ||
|
||
* `func-a`:一个简单的单实例多函数示例。 | ||
* `func-b`:一个简单的函数示例。 | ||
|
||
每个函数对应一个 `云函数2.0` 服务,上传云函数时,需要上传对应函数的整个目录。 | ||
|
||
可根据需要,创建新的函数目录,或者删除现有的函数目录。 | ||
|
||
## 如何运行? | ||
|
||
安装 `tcb-ff` 工具: | ||
|
||
```sh | ||
npm install -g @cloudbase/functions-framework | ||
``` | ||
|
||
进入函数代码目录,`func-a` 或 `func-b` 或 其他,执行以下命令: | ||
|
||
```sh | ||
tcb-ff | ||
``` |
3 changes: 3 additions & 0 deletions
3
cloudrunfunctions/ts-multiple-functions/cloudrunfunctions/func-a/README.md
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,3 @@ | ||
# func-a 示例函数 | ||
|
||
一个简单的单实例多函数示例 |
15 changes: 15 additions & 0 deletions
15
cloudrunfunctions/ts-multiple-functions/cloudrunfunctions/func-a/cloudbase-functions.json
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,15 @@ | ||
{ | ||
"functionsRoot": "built", | ||
"functions": [ | ||
{ | ||
"name": "func-a-1", | ||
"directory": "func-a-1", | ||
"triggerPath": "/a-1" | ||
}, | ||
{ | ||
"name": "func-a-2", | ||
"directory": "func-a-2", | ||
"triggerPath": "/a-2" | ||
} | ||
] | ||
} |
19 changes: 19 additions & 0 deletions
19
cloudrunfunctions/ts-multiple-functions/cloudrunfunctions/func-a/package.json
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,19 @@ | ||
{ | ||
"name": "func-a", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "built/index.js", | ||
"type": "module", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@cloudbase/functions-typings": "^1.0.0-beta.4" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^22.10.7", | ||
"ts-node": "^10.9.2" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
cloudrunfunctions/ts-multiple-functions/cloudrunfunctions/func-a/src/func-a-1/index.ts
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,8 @@ | ||
import { TcbEventFunction } from '@cloudbase/functions-typings' | ||
|
||
// GET no boyd | ||
export const main: TcbEventFunction = function(event, context) { | ||
console.log('hello a-1') | ||
return 'a-1' | ||
} | ||
|
8 changes: 8 additions & 0 deletions
8
cloudrunfunctions/ts-multiple-functions/cloudrunfunctions/func-a/src/func-a-2/index.ts
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,8 @@ | ||
import { TcbEventFunction } from '@cloudbase/functions-typings' | ||
|
||
// GET no boyd | ||
export const main: TcbEventFunction = function(event, context) { | ||
console.log('hello a-2') | ||
return 'a-2' | ||
} | ||
|
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
cloudrunfunctions/ts-multiple-functions/cloudrunfunctions/func-a/tsconfig.json
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,10 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"include": [ | ||
"src/**/*.ts" | ||
], | ||
"compilerOptions": { | ||
"outDir": "built", /* Specify an output folder for all emitted files. */ | ||
"module": "ES2022", /* Specify what module code is generated. */ | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
cloudrunfunctions/ts-multiple-functions/cloudrunfunctions/func-b/README.md
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,3 @@ | ||
# func-b 示例函数 | ||
|
||
一个简单的函数示例 |
12 changes: 12 additions & 0 deletions
12
cloudrunfunctions/ts-multiple-functions/cloudrunfunctions/func-b/package.json
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,12 @@ | ||
{ | ||
"name": "func-b", | ||
"version": "1.0.0", | ||
"description": "", | ||
"type": "module", | ||
"main": "built/index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC" | ||
} |
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
cloudrunfunctions/ts-multiple-functions/cloudrunfunctions/func-b/tsconfig.json
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,10 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"include": [ | ||
"src/**/*.ts" | ||
], | ||
"compilerOptions": { | ||
"outDir": "built", /* Specify an output folder for all emitted files. */ | ||
"module": "ES2022", /* Specify what module code is generated. */ | ||
} | ||
} |
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