Skip to content

Commit 92c6b61

Browse files
committed
add: build bundle to deploy to Google Cloud Platform
1 parent 5452479 commit 92c6b61

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ typings/
5757
# dotenv environment variables file
5858
.env
5959

60+
helloWorld.zip

.vscode/tasks.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
"kind": "build",
1919
"isDefault": true
2020
}
21+
},
22+
{
23+
"type": "npm",
24+
"script": "package-zip(windows)",
25+
"problemMatcher": []
2126
}
2227
]
2328
}

README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# Google Cloud Functions TypeScript starter project
1+
# Google (Cloud Platform) Cloud Functions TypeScript starter project
22

33
<!-- TOC -->
44

55
- [Clone project](#clone-project)
6-
- [Build project from command-line](#build-project-from-command-line)
7-
- [Deploy project to Cloud Functions Local Emulator from command-line](#deploy-project-to-cloud-functions-local-emulator-from-command-line)
6+
- [Build project (command-line)](#build-project-command-line)
7+
- [Deploy project to Cloud Functions Local Emulator (command-line)](#deploy-project-to-cloud-functions-local-emulator-command-line)
8+
- [Build bundle to deploy to Google Cloud Platform (command-line)](#build-bundle-to-deploy-to-google-cloud-platform-command-line)
89

910
<!-- /TOC -->
1011

@@ -28,7 +29,7 @@ Optional. You can open project in Visual Studio Code to to build and deploy proj
2829
code .
2930
```
3031

31-
## Build project from command-line
32+
## Build project (command-line)
3233

3334
If you prefer command-line interface instead of Visual Studio Code than use the next commands to build project.
3435

@@ -46,7 +47,7 @@ tsc
4647

4748
File `index.js` is generated and is ready to deploy to **Cloud Functions**
4849

49-
## Deploy project to Cloud Functions Local Emulator from command-line
50+
## Deploy project to Cloud Functions Local Emulator (command-line)
5051

5152
If you prefer command-line interface instead of Visual Studio Code than use the next commands to deploy project.
5253

@@ -71,3 +72,18 @@ npm run deploy-local
7172
Open [helloWorld](http://localhost:8010/amsokol-me/us-central1/helloWorld) link in browser to see results.
7273

7374
See [Cloud Functions Local Emulator](https://cloud.google.com/functions/docs/emulator) for more details.
75+
76+
## Build bundle to deploy to Google Cloud Platform (command-line)
77+
78+
If you prefer command-line interface instead of Visual Studio Code than use the next commands to create zip archive for deployment.
79+
80+
For Windows using PowerShell:
81+
82+
```bash
83+
npm run package-zip(windows)
84+
```
85+
86+
It creates `helloWorld.zip` that includes `index.js`, `package.json`, `settings.json` files.
87+
`helloWorld.zip` is ready to be deployed to **Google Cloud Platform**.
88+
89+
See [Deploying from Your Local Machine](https://cloud.google.com/functions/docs/deploying/filesystem) for more details.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "Google Cloud Functions TypeScript starter project",
55
"main": "index.js",
66
"scripts": {
7-
"deploy-local": "tsc && functions deploy helloWorld --trigger-http"
7+
"deploy-local": "tsc && functions deploy helloWorld --trigger-http",
8+
"package-zip(windows)": "powershell Compress-Archive -Force -LiteralPath index.js, package.json, settings.json -DestinationPath helloWorld.zip"
89
},
910
"author": "Aleksandr Sokolovskii",
1011
"license": "Apache-2.0",

0 commit comments

Comments
 (0)