From 50bbc200bc94abc1e8402f0e34024d3c756ea2d5 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Mon, 13 Aug 2018 13:01:32 -0700 Subject: [PATCH 01/10] Add uglifyjs sample --- appengine/uglifyjs/.gcloudignore | 2 ++ appengine/uglifyjs/.gitignore | 1 + appengine/uglifyjs/index.js | 34 +++++++++++++++++++++ appengine/uglifyjs/package.json | 35 +++++++++++++++++++++ appengine/uglifyjs/static/index.html | 33 ++++++++++++++++++++ appengine/uglifyjs/static/index_min.html | 33 ++++++++++++++++++++ appengine/uglifyjs/static/message.js | 33 ++++++++++++++++++++ appengine/uglifyjs/static/style.css | 39 ++++++++++++++++++++++++ 8 files changed, 210 insertions(+) create mode 100644 appengine/uglifyjs/.gcloudignore create mode 100644 appengine/uglifyjs/.gitignore create mode 100644 appengine/uglifyjs/index.js create mode 100644 appengine/uglifyjs/package.json create mode 100644 appengine/uglifyjs/static/index.html create mode 100644 appengine/uglifyjs/static/index_min.html create mode 100644 appengine/uglifyjs/static/message.js create mode 100644 appengine/uglifyjs/static/style.css diff --git a/appengine/uglifyjs/.gcloudignore b/appengine/uglifyjs/.gcloudignore new file mode 100644 index 0000000000..7f5c060e71 --- /dev/null +++ b/appengine/uglifyjs/.gcloudignore @@ -0,0 +1,2 @@ +# Exclude minified files, so they're built on GCP +**/*.min.* diff --git a/appengine/uglifyjs/.gitignore b/appengine/uglifyjs/.gitignore new file mode 100644 index 0000000000..e6090ab7d2 --- /dev/null +++ b/appengine/uglifyjs/.gitignore @@ -0,0 +1 @@ +**/*.min.* diff --git a/appengine/uglifyjs/index.js b/appengine/uglifyjs/index.js new file mode 100644 index 0000000000..177ef2baa6 --- /dev/null +++ b/appengine/uglifyjs/index.js @@ -0,0 +1,34 @@ +// Copyright 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the 'License'); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an 'AS IS' BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const express = require('express'); +const path = require('path'); + +const app = express(); +const PORT = process.env.PORT || 8080; + +app.use(express.static('static')); + +app.get('/full', (req, res) => { + res.sendFile(path.join(__dirname, '/static/index.html')); +}); + +app.get('/min', (req, res) => { + res.sendFile(path.join(__dirname, '/static/index_min.html')); +}); + +app.listen(PORT); +console.log(`App listening on port ${PORT}`); diff --git a/appengine/uglifyjs/package.json b/appengine/uglifyjs/package.json new file mode 100644 index 0000000000..07d093648a --- /dev/null +++ b/appengine/uglifyjs/package.json @@ -0,0 +1,35 @@ +{ + "name": "appengine-uglifyjs", + "description": "An example of running UglifyJS on Google App Engine.", + "version": "0.0.1", + "private": true, + "license": "Apache Version 2.0", + "author": "Google Inc.", + "engines": { + "node": ">=8.x" + }, + "scripts": { + "start": "node ./index.js", + "lint-css": "stylelint static/style.css", + "lint-html": "htmlhint index.html", + "lint-js": "semistandard index.js static/message.js", + "lint": "npm run lint-css && npm run lint-html && npm run lint-js", + "minify-css": "cleancss -o static/style.min.css static/style.css", + "minify-js": "uglifyjs --compress --mangle -o static/message.min.js static/message.js", + "gcp-build": "npm run minify-js && npm run minify-css" + }, + "dependencies": { + "clean-css-cli": "^4.2.1", + "express": "^4.16.3", + "uglify-js": "^3.4.7" + }, + "devDependencies": { + "htmlhint": "^0.9.13", + "semistandard": "^12.0.1", + "stylelint": "^9.4.0", + "stylelint-config-recommended": "^2.1.0" + }, + "stylelint": { + "extends": "stylelint-config-recommended" + } +} diff --git a/appengine/uglifyjs/static/index.html b/appengine/uglifyjs/static/index.html new file mode 100644 index 0000000000..77f1c739de --- /dev/null +++ b/appengine/uglifyjs/static/index.html @@ -0,0 +1,33 @@ + + + + + + + Simple web page + + + + + +
+
You haven't clicked the button.
+ + +
ERROR: CSS files not found!
+ + \ No newline at end of file diff --git a/appengine/uglifyjs/static/index_min.html b/appengine/uglifyjs/static/index_min.html new file mode 100644 index 0000000000..88cc57231e --- /dev/null +++ b/appengine/uglifyjs/static/index_min.html @@ -0,0 +1,33 @@ + + + + + + + Simple web page + + + + + +
+
You haven't clicked the button.
+ + +
ERROR: CSS files not found!
+ + \ No newline at end of file diff --git a/appengine/uglifyjs/static/message.js b/appengine/uglifyjs/static/message.js new file mode 100644 index 0000000000..cd0b47b640 --- /dev/null +++ b/appengine/uglifyjs/static/message.js @@ -0,0 +1,33 @@ +// Copyright 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the 'License'); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an 'AS IS' BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +window.onload = function () { + window.messageDiv = document.getElementById('message'); + window.buttonClicks = 0; +}; + +window.buttonClick = function () { + window.buttonClicks++; + + var buttonClickTimes; + if (window.buttonClicks === 1) { + buttonClickTimes = 'once'; + } else if (window.buttonClicks === 2) { + buttonClickTimes = 'twice'; + } else { + buttonClickTimes = window.buttonClicks + ' times'; + } + + window.messageDiv.innerHTML = 'You clicked the button ' + buttonClickTimes; +}; diff --git a/appengine/uglifyjs/static/style.css b/appengine/uglifyjs/static/style.css new file mode 100644 index 0000000000..e76232d14e --- /dev/null +++ b/appengine/uglifyjs/static/style.css @@ -0,0 +1,39 @@ +/* + Copyright 2018 Google LLC + + Licensed under the Apache License, Version 2.0 (the 'License'); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an 'AS IS' BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +button { + background-color: #2962ff; + border-color: #0039cb; + border-radius: 50%; + border-width: 2px; + width: 120px; + height: 120px; + color: #fefefe; + font-size: 24px; + font-family: Roboto, sans-serif; +} + +#message { + padding-top: 20px +} + +body { + padding: 20px; +} + +#cssError { + display: none; +} \ No newline at end of file From e07b3e479df33a405972f345ce4fb029effe81d4 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Mon, 13 Aug 2018 18:46:22 -0700 Subject: [PATCH 02/10] Add GAE configs + tweak app description --- appengine/uglifyjs/.gcloudignore | 5 ++++- appengine/uglifyjs/app.yaml | 10 ++++++++++ appengine/uglifyjs/package.json | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 appengine/uglifyjs/app.yaml diff --git a/appengine/uglifyjs/.gcloudignore b/appengine/uglifyjs/.gcloudignore index 7f5c060e71..35c963dbdb 100644 --- a/appengine/uglifyjs/.gcloudignore +++ b/appengine/uglifyjs/.gcloudignore @@ -1,2 +1,5 @@ -# Exclude minified files, so they're built on GCP +# Minify files on GCP **/*.min.* + +# Exclude dependencies +node_modules/ diff --git a/appengine/uglifyjs/app.yaml b/appengine/uglifyjs/app.yaml new file mode 100644 index 0000000000..e33318e805 --- /dev/null +++ b/appengine/uglifyjs/app.yaml @@ -0,0 +1,10 @@ +runtime: nodejs8 + +handlers: +- url: /static + static_dir: static + +- url: /.* + secure: always + script: auto + diff --git a/appengine/uglifyjs/package.json b/appengine/uglifyjs/package.json index 07d093648a..561357b342 100644 --- a/appengine/uglifyjs/package.json +++ b/appengine/uglifyjs/package.json @@ -1,12 +1,12 @@ { "name": "appengine-uglifyjs", - "description": "An example of running UglifyJS on Google App Engine.", + "description": "An example of minifying files with UglifyJS and Clean-CSS on Google App Engine.", "version": "0.0.1", "private": true, "license": "Apache Version 2.0", "author": "Google Inc.", "engines": { - "node": ">=8.x" + "node": "8.x" }, "scripts": { "start": "node ./index.js", From cca79ce727213ec6e180274867ef55dc9d5a1e23 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Tue, 14 Aug 2018 11:57:35 -0700 Subject: [PATCH 03/10] Initial commit of Typescript sample --- appengine/typescript/.gcloudignore | 5 +++++ appengine/typescript/.gitignore | 5 +++++ appengine/typescript/app.yaml | 7 ++++++ appengine/typescript/index.ts | 35 ++++++++++++++++++++++++++++++ appengine/typescript/package.json | 24 ++++++++++++++++++++ appengine/typescript/tslint.json | 3 +++ 6 files changed, 79 insertions(+) create mode 100644 appengine/typescript/.gcloudignore create mode 100644 appengine/typescript/.gitignore create mode 100644 appengine/typescript/app.yaml create mode 100644 appengine/typescript/index.ts create mode 100644 appengine/typescript/package.json create mode 100644 appengine/typescript/tslint.json diff --git a/appengine/typescript/.gcloudignore b/appengine/typescript/.gcloudignore new file mode 100644 index 0000000000..73eb8a3c5b --- /dev/null +++ b/appengine/typescript/.gcloudignore @@ -0,0 +1,5 @@ +# Exclude compiled .js files +*.js + +# Exclude dependencies +node_modules/ diff --git a/appengine/typescript/.gitignore b/appengine/typescript/.gitignore new file mode 100644 index 0000000000..73eb8a3c5b --- /dev/null +++ b/appengine/typescript/.gitignore @@ -0,0 +1,5 @@ +# Exclude compiled .js files +*.js + +# Exclude dependencies +node_modules/ diff --git a/appengine/typescript/app.yaml b/appengine/typescript/app.yaml new file mode 100644 index 0000000000..df7ca35f2a --- /dev/null +++ b/appengine/typescript/app.yaml @@ -0,0 +1,7 @@ +runtime: nodejs8 + +handlers: +- url: /.* + secure: always + script: auto + diff --git a/appengine/typescript/index.ts b/appengine/typescript/index.ts new file mode 100644 index 0000000000..7ba7632eca --- /dev/null +++ b/appengine/typescript/index.ts @@ -0,0 +1,35 @@ +// Copyright 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the 'License'); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an 'AS IS' BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* tslint:disable:no-console no-var-requires */ + +declare var require: any; +declare var process: { + env: { + PORT: string, + }, +}; + +const PORT = process.env.PORT || 8080; +const express = require("express"); + +const app = express(); + +app.get("/", (req, res) => { + res.send("🎉 Hello TypeScript! 🎉"); +}); + +const server = app.listen(PORT, () => { + console.log(`App listening on port ${PORT}`); +}); diff --git a/appengine/typescript/package.json b/appengine/typescript/package.json new file mode 100644 index 0000000000..5d474844de --- /dev/null +++ b/appengine/typescript/package.json @@ -0,0 +1,24 @@ +{ + "name": "appengine-typescript", + "description": "An example TypeScript app running on Google App Engine.", + "version": "0.0.1", + "private": true, + "license": "Apache Version 2.0", + "author": "Google Inc.", + "engines": { + "node": "8.x" + }, + "scripts": { + "lint": "tslint index.ts", + "start": "node ./index.js", + "gcp-build": "tsc index.ts" + }, + "dependencies": { + "express": "^4.16.3", + "typescript": "^3.0.1" + }, + "devDependencies": { + "semistandard": "^12.0.1", + "tslint": "^5.11.0" + } +} diff --git a/appengine/typescript/tslint.json b/appengine/typescript/tslint.json new file mode 100644 index 0000000000..78af234436 --- /dev/null +++ b/appengine/typescript/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "tslint:recommended" +} From 8ab351ef3f8d778b9f126a91c237a6078fbf6be2 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Tue, 14 Aug 2018 13:03:08 -0700 Subject: [PATCH 04/10] Address Steren's comments --- appengine/typescript/README.md | 55 +++++++++++++++++++++++++++++++ appengine/typescript/package.json | 3 +- appengine/uglifyjs/README.md | 55 +++++++++++++++++++++++++++++++ appengine/uglifyjs/package.json | 3 +- 4 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 appengine/typescript/README.md create mode 100644 appengine/uglifyjs/README.md diff --git a/appengine/typescript/README.md b/appengine/typescript/README.md new file mode 100644 index 0000000000..53be848197 --- /dev/null +++ b/appengine/typescript/README.md @@ -0,0 +1,55 @@ +# App Engine TypeScript sample + +This sample provides an example of how to compile TypeScript files while deploying to App Engine. + +## Setup + +Install dependencies: + + With `npm`: + + npm install + + or with `yarn`: + + yarn install + +## Running locally + +1. Perform the build step: + + With `npm`: + + npm run gcp-build + + or with `yarn`: + + yarn run gcp-build + +1. Run the completed program + + With `npm`: + + npm start + + or with `yarn`: + + yarn start + +## Deploying to App Engine + +With `npm`: + + npm run deploy + +or with `yarn`: + + yarn run deploy + +By default, this application deploys to [App Engine Standard][appengine]. _(Recommended)_ +Deploy to App Engine Flexible by [modifying `app.yaml`][app_yaml]. + +[appengine]: https://cloud.google.com/appengine/docs/standard/nodejs +[app_yaml]: https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml +[tutorial]: https://cloud.google.com/appengine/docs/standard/nodejs/quickstart +[contributing]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md diff --git a/appengine/typescript/package.json b/appengine/typescript/package.json index 5d474844de..97480befc6 100644 --- a/appengine/typescript/package.json +++ b/appengine/typescript/package.json @@ -11,7 +11,8 @@ "scripts": { "lint": "tslint index.ts", "start": "node ./index.js", - "gcp-build": "tsc index.ts" + "gcp-build": "tsc index.ts", + "deploy": "gcloud app deploy" }, "dependencies": { "express": "^4.16.3", diff --git a/appengine/uglifyjs/README.md b/appengine/uglifyjs/README.md new file mode 100644 index 0000000000..c5580082f1 --- /dev/null +++ b/appengine/uglifyjs/README.md @@ -0,0 +1,55 @@ +# App Engine minification sample + +This sample provides an example of how to minify static CSS and JS files while deploying to App Engine. + +## Setup + +Install dependencies: + + With `npm`: + + npm install + + or with `yarn`: + + yarn install + +## Running locally + +1. Perform the build step: + + With `npm`: + + npm run gcp-build + + or with `yarn`: + + yarn run gcp-build + +1. Run the completed program + + With `npm`: + + npm start + + or with `yarn`: + + yarn start + +## Deploying to App Engine + +With `npm`: + + npm run deploy + +or with `yarn`: + + yarn run deploy + +By default, this application deploys to [App Engine Standard][appengine]. _(Recommended)_ +Deploy to App Engine Flexible by [modifying `app.yaml`][app_yaml]. + +[appengine]: https://cloud.google.com/appengine/docs/standard/nodejs +[app_yaml]: https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml +[tutorial]: https://cloud.google.com/appengine/docs/standard/nodejs/quickstart +[contributing]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md diff --git a/appengine/uglifyjs/package.json b/appengine/uglifyjs/package.json index 561357b342..2e41361bba 100644 --- a/appengine/uglifyjs/package.json +++ b/appengine/uglifyjs/package.json @@ -16,7 +16,8 @@ "lint": "npm run lint-css && npm run lint-html && npm run lint-js", "minify-css": "cleancss -o static/style.min.css static/style.css", "minify-js": "uglifyjs --compress --mangle -o static/message.min.js static/message.js", - "gcp-build": "npm run minify-js && npm run minify-css" + "gcp-build": "npm run minify-js && npm run minify-css", + "deploy": "gcloud app deploy" }, "dependencies": { "clean-css-cli": "^4.2.1", From 76d2c2a2885483100e5f4e383c97798ac88ddfb8 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Tue, 14 Aug 2018 14:30:17 -0700 Subject: [PATCH 05/10] Add READMEs --- appengine/typescript/README.md | 7 ++++++- appengine/uglifyjs/README.md | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/appengine/typescript/README.md b/appengine/typescript/README.md index 53be848197..2de39c1cf8 100644 --- a/appengine/typescript/README.md +++ b/appengine/typescript/README.md @@ -1,6 +1,11 @@ # App Engine TypeScript sample -This sample provides an example of how to compile TypeScript files while deploying to App Engine. +This sample provides an example of how to compile TypeScript files while +deploying to App Engine. + +The `gcp-build` NPM script is used to trigger the TypeScript compilation +process. This step happens automatically when deploying to App Engine, but must +be performed manually when developing locally. ## Setup diff --git a/appengine/uglifyjs/README.md b/appengine/uglifyjs/README.md index c5580082f1..7b616dc9dc 100644 --- a/appengine/uglifyjs/README.md +++ b/appengine/uglifyjs/README.md @@ -1,6 +1,11 @@ # App Engine minification sample -This sample provides an example of how to minify static CSS and JS files while deploying to App Engine. +This sample provides an example of how to minify static CSS and JS files while +deploying to App Engine. + +The `gcp-build` NPM script is used to trigger the minification process. This +step happens automatically when deploying to App Engine, but must be performed +manually when developing locally. ## Setup @@ -16,7 +21,7 @@ Install dependencies: ## Running locally -1. Perform the build step: +1. Perform the build step locally: With `npm`: From a51b060dc775d9687c01e7981e35b86c7d6b42e5 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Tue, 14 Aug 2018 17:07:59 -0700 Subject: [PATCH 06/10] Remove handlers --- appengine/typescript/app.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/appengine/typescript/app.yaml b/appengine/typescript/app.yaml index df7ca35f2a..f0ccc6d566 100644 --- a/appengine/typescript/app.yaml +++ b/appengine/typescript/app.yaml @@ -1,7 +1 @@ runtime: nodejs8 - -handlers: -- url: /.* - secure: always - script: auto - From 28652a98696d935d1785c557ec0b8e17471d0045 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Wed, 15 Aug 2018 12:56:44 -0700 Subject: [PATCH 07/10] Use (more) idiomatic typescript --- appengine/typescript/index.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/appengine/typescript/index.ts b/appengine/typescript/index.ts index 7ba7632eca..258eb46c8a 100644 --- a/appengine/typescript/index.ts +++ b/appengine/typescript/index.ts @@ -12,24 +12,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -/* tslint:disable:no-console no-var-requires */ +/* tslint:disable:no-console */ -declare var require: any; declare var process: { env: { PORT: string, }, }; -const PORT = process.env.PORT || 8080; -const express = require("express"); +const PORT: number = Number(process.env.PORT) || 8080; +import express = require("express"); -const app = express(); +const app: any = express(); -app.get("/", (req, res) => { +app.get("/", (req: any, res: any) => { res.send("🎉 Hello TypeScript! 🎉"); }); -const server = app.listen(PORT, () => { +const server: object = app.listen(PORT, () => { console.log(`App listening on port ${PORT}`); }); From bdd807666722e19daa3373215a72a8af5b055bfe Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Fri, 17 Aug 2018 16:51:21 -0700 Subject: [PATCH 08/10] Remove yarn --- appengine/typescript/README.md | 30 ++++-------------------------- appengine/uglifyjs/README.md | 29 ++++------------------------- 2 files changed, 8 insertions(+), 51 deletions(-) diff --git a/appengine/typescript/README.md b/appengine/typescript/README.md index 2de39c1cf8..ee4afddbac 100644 --- a/appengine/typescript/README.md +++ b/appengine/typescript/README.md @@ -11,46 +11,24 @@ be performed manually when developing locally. Install dependencies: - With `npm`: - - npm install - - or with `yarn`: - - yarn install + npm install ## Running locally 1. Perform the build step: - With `npm`: - - npm run gcp-build - - or with `yarn`: - - yarn run gcp-build + npm run gcp-build 1. Run the completed program - With `npm`: - - npm start - - or with `yarn`: - - yarn start + npm start ## Deploying to App Engine -With `npm`: +Deploy your app: npm run deploy -or with `yarn`: - - yarn run deploy - By default, this application deploys to [App Engine Standard][appengine]. _(Recommended)_ Deploy to App Engine Flexible by [modifying `app.yaml`][app_yaml]. diff --git a/appengine/uglifyjs/README.md b/appengine/uglifyjs/README.md index 7b616dc9dc..e979b8e338 100644 --- a/appengine/uglifyjs/README.md +++ b/appengine/uglifyjs/README.md @@ -11,46 +11,25 @@ manually when developing locally. Install dependencies: - With `npm`: + npm install - npm install - - or with `yarn`: - - yarn install ## Running locally 1. Perform the build step locally: - With `npm`: - - npm run gcp-build - - or with `yarn`: - - yarn run gcp-build + npm run gcp-build 1. Run the completed program - With `npm`: - - npm start - - or with `yarn`: - - yarn start + npm start ## Deploying to App Engine -With `npm`: +Deploy your app: npm run deploy -or with `yarn`: - - yarn run deploy - By default, this application deploys to [App Engine Standard][appengine]. _(Recommended)_ Deploy to App Engine Flexible by [modifying `app.yaml`][app_yaml]. From 8caaccdb01c3a0ff6a2503cf35cd85b68f613dea Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Fri, 17 Aug 2018 17:18:16 -0700 Subject: [PATCH 09/10] Add repo-tools tests --- appengine/typescript/package.json | 2 ++ appengine/uglifyjs/package.json | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/appengine/typescript/package.json b/appengine/typescript/package.json index 97480befc6..a070decd72 100644 --- a/appengine/typescript/package.json +++ b/appengine/typescript/package.json @@ -9,6 +9,7 @@ "node": "8.x" }, "scripts": { + "test": "npm run gcp-build && npm run lint && repo-tools test app -- index.js", "lint": "tslint index.ts", "start": "node ./index.js", "gcp-build": "tsc index.ts", @@ -19,6 +20,7 @@ "typescript": "^3.0.1" }, "devDependencies": { + "@google-cloud/nodejs-repo-tools": "^2.3.3", "semistandard": "^12.0.1", "tslint": "^5.11.0" } diff --git a/appengine/uglifyjs/package.json b/appengine/uglifyjs/package.json index 2e41361bba..1612c58f1c 100644 --- a/appengine/uglifyjs/package.json +++ b/appengine/uglifyjs/package.json @@ -14,6 +14,7 @@ "lint-html": "htmlhint index.html", "lint-js": "semistandard index.js static/message.js", "lint": "npm run lint-css && npm run lint-html && npm run lint-js", + "test": "npm run gcp-build && repo-tools test app -- index.js", "minify-css": "cleancss -o static/style.min.css static/style.css", "minify-js": "uglifyjs --compress --mangle -o static/message.min.js static/message.js", "gcp-build": "npm run minify-js && npm run minify-css", @@ -24,7 +25,16 @@ "express": "^4.16.3", "uglify-js": "^3.4.7" }, + "repo-tools": { + "test": { + "app": { + "url": "/full", + "msg": "message.min.js" + } + } + }, "devDependencies": { + "@google-cloud/nodejs-repo-tools": "^2.3.3", "htmlhint": "^0.9.13", "semistandard": "^12.0.1", "stylelint": "^9.4.0", From 9792a121a67e73be2ffe77e5325c03867f16a185 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Tue, 21 Aug 2018 13:45:47 -0700 Subject: [PATCH 10/10] Add Kokoro test configs --- .kokoro/appengine/typescript.cfg | 13 +++++++++++++ .kokoro/appengine/uglifyjs.cfg | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 .kokoro/appengine/typescript.cfg create mode 100644 .kokoro/appengine/uglifyjs.cfg diff --git a/.kokoro/appengine/typescript.cfg b/.kokoro/appengine/typescript.cfg new file mode 100644 index 0000000000..d06d429bf2 --- /dev/null +++ b/.kokoro/appengine/typescript.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Set the folder in which the tests are run +env_vars: { + key: "PROJECT" + value: "appengine/typescript" +} + +# Tell the trampoline which build file to use. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/nodejs-docs-samples/.kokoro/build.sh" +} diff --git a/.kokoro/appengine/uglifyjs.cfg b/.kokoro/appengine/uglifyjs.cfg new file mode 100644 index 0000000000..7b2f6a5aa8 --- /dev/null +++ b/.kokoro/appengine/uglifyjs.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Set the folder in which the tests are run +env_vars: { + key: "PROJECT" + value: "appengine/uglifyjs" +} + +# Tell the trampoline which build file to use. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/nodejs-docs-samples/.kokoro/build.sh" +}