Skip to content

Commit 322ee96

Browse files
authored
Merge branch 'master' into tswast-composer
2 parents 4bcd648 + 0c9f58b commit 322ee96

File tree

19 files changed

+412
-0
lines changed

19 files changed

+412
-0
lines changed

.kokoro/appengine/typescript.cfg

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set the folder in which the tests are run
4+
env_vars: {
5+
key: "PROJECT"
6+
value: "appengine/typescript"
7+
}
8+
9+
# Tell the trampoline which build file to use.
10+
env_vars: {
11+
key: "TRAMPOLINE_BUILD_FILE"
12+
value: "github/nodejs-docs-samples/.kokoro/build.sh"
13+
}

.kokoro/appengine/uglifyjs.cfg

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Set the folder in which the tests are run
4+
env_vars: {
5+
key: "PROJECT"
6+
value: "appengine/uglifyjs"
7+
}
8+
9+
# Tell the trampoline which build file to use.
10+
env_vars: {
11+
key: "TRAMPOLINE_BUILD_FILE"
12+
value: "github/nodejs-docs-samples/.kokoro/build.sh"
13+
}

appengine/typescript/.gcloudignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Exclude compiled .js files
2+
*.js
3+
4+
# Exclude dependencies
5+
node_modules/

appengine/typescript/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Exclude compiled .js files
2+
*.js
3+
4+
# Exclude dependencies
5+
node_modules/

appengine/typescript/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# App Engine TypeScript sample
2+
3+
This sample provides an example of how to compile TypeScript files while
4+
deploying to App Engine.
5+
6+
The `gcp-build` NPM script is used to trigger the TypeScript compilation
7+
process. This step happens automatically when deploying to App Engine, but must
8+
be performed manually when developing locally.
9+
10+
## Setup
11+
12+
Install dependencies:
13+
14+
npm install
15+
16+
## Running locally
17+
18+
1. Perform the build step:
19+
20+
npm run gcp-build
21+
22+
1. Run the completed program
23+
24+
npm start
25+
26+
## Deploying to App Engine
27+
28+
Deploy your app:
29+
30+
npm run deploy
31+
32+
By default, this application deploys to [App Engine Standard][appengine]. _(Recommended)_
33+
Deploy to App Engine Flexible by [modifying `app.yaml`][app_yaml].
34+
35+
[appengine]: https://cloud.google.com/appengine/docs/standard/nodejs
36+
[app_yaml]: https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml
37+
[tutorial]: https://cloud.google.com/appengine/docs/standard/nodejs/quickstart
38+
[contributing]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md

appengine/typescript/app.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
runtime: nodejs8

appengine/typescript/index.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2018 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the 'License');
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an 'AS IS' BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
/* tslint:disable:no-console */
16+
17+
declare var process: {
18+
env: {
19+
PORT: string,
20+
},
21+
};
22+
23+
const PORT: number = Number(process.env.PORT) || 8080;
24+
import express = require("express");
25+
26+
const app: any = express();
27+
28+
app.get("/", (req: any, res: any) => {
29+
res.send("🎉 Hello TypeScript! 🎉");
30+
});
31+
32+
const server: object = app.listen(PORT, () => {
33+
console.log(`App listening on port ${PORT}`);
34+
});

appengine/typescript/package.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "appengine-typescript",
3+
"description": "An example TypeScript app running on Google App Engine.",
4+
"version": "0.0.1",
5+
"private": true,
6+
"license": "Apache Version 2.0",
7+
"author": "Google Inc.",
8+
"engines": {
9+
"node": "8.x"
10+
},
11+
"scripts": {
12+
"test": "npm run gcp-build && npm run lint && repo-tools test app -- index.js",
13+
"lint": "tslint index.ts",
14+
"start": "node ./index.js",
15+
"gcp-build": "tsc index.ts",
16+
"deploy": "gcloud app deploy"
17+
},
18+
"dependencies": {
19+
"express": "^4.16.3",
20+
"typescript": "^3.0.1"
21+
},
22+
"devDependencies": {
23+
"@google-cloud/nodejs-repo-tools": "^2.3.3",
24+
"semistandard": "^12.0.1",
25+
"tslint": "^5.11.0"
26+
}
27+
}

appengine/typescript/tslint.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "tslint:recommended"
3+
}

appengine/uglifyjs/.gcloudignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Minify files on GCP
2+
**/*.min.*
3+
4+
# Exclude dependencies
5+
node_modules/

0 commit comments

Comments
 (0)