Skip to content

Commit 0dde2a5

Browse files
authored
feat: extract runtime-handler and lazyLoading (#252) (#271)
1 parent a5d948e commit 0dde2a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2532
-62
lines changed

Diff for: jest.config.base.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313
// A set of global variables that need to be available in all test environments
1414
globals: {
1515
'ts-jest': {
16-
tsConfig: 'tsconfig.test.json',
16+
tsconfig: 'tsconfig.test.json',
1717
},
1818
},
1919
// The test environment that will be used for testing

Diff for: lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"npmClientArgs": ["--no-package-lock"]
1313
},
1414
"version": {
15-
"allowBranch": ["main", "feature/*"]
15+
"allowBranch": ["main", "features/*"]
1616
}
1717
},
1818
"ignoreChanges": ["**/__fixtures__/**", "**/__tests__/**"],

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"lerna": "^3.22.1",
3131
"lint-staged": "^8.2.1",
3232
"npm-run-all": "^4.1.5",
33-
"prettier": "^1.18.2",
33+
"prettier": "^2.2.1",
3434
"rimraf": "^3.0.2",
3535
"ts-jest": "^26.0.0",
3636
"typescript": "^3.9.7"

Diff for: packages/create-twilio-function/CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [3.0.2-rc.0](https://github.com/twilio-labs/serverless-toolkit/compare/[email protected]@3.0.2-rc.0) (2021-05-24)
7+
8+
**Note:** Version bump only for package create-twilio-function
9+
10+
11+
12+
13+
614
## [3.0.1](https://github.com/twilio-labs/serverless-toolkit/compare/[email protected]@3.0.1) (2021-05-20)
715

816
**Note:** Version bump only for package create-twilio-function

Diff for: packages/create-twilio-function/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-twilio-function",
3-
"version": "3.0.1",
3+
"version": "3.0.2-rc.0",
44
"description": "A CLI tool to generate a new Twilio Function using that can be run locally with twilio-run.",
55
"bin": "./bin/create-twilio-function",
66
"main": "./src/create-twilio-function.js",
@@ -26,6 +26,7 @@
2626
},
2727
"license": "MIT",
2828
"devDependencies": {
29+
"@twilio/runtime-handler": "1.1.0-rc.3",
2930
"jest": "^24.5.0",
3031
"nock": "^11.3.4"
3132
},
@@ -38,7 +39,7 @@
3839
"pkg-install": "^1.0.0",
3940
"rimraf": "^2.6.3",
4041
"terminal-link": "^2.0.0",
41-
"twilio-run": "^3.0.1",
42+
"twilio-run": "3.1.0-rc.0",
4243
"window-size": "^1.1.1",
4344
"wrap-ansi": "^6.0.0",
4445
"yargs": "^12.0.5"

Diff for: packages/create-twilio-function/src/create-twilio-function/create-files.js

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const typescriptDeps = {
2929
};
3030
const javaScriptDevDeps = { 'twilio-run': versions.twilioRun };
3131
const typescriptDevDeps = {
32+
'@twilio/runtime-handler': versions.twilioRuntimeHandler,
3233
'twilio-run': versions.twilioRun,
3334
typescript: versions.typescript,
3435
copyfiles: versions.copyfiles,

Diff for: packages/create-twilio-function/src/create-twilio-function/versions.js

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ const pkgJson = require('../../package.json');
22

33
module.exports = {
44
twilio: '^3.56',
5+
twilioRuntimeHandler: pkgJson.devDependencies[
6+
'@twilio/runtime-handler'
7+
].replace(/[\^~]/, ''),
58
twilioRun: pkgJson.dependencies['twilio-run'],
69
node: '12',
710
typescript: '^3.8',

Diff for: packages/plugin-assets/CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [1.0.1-rc.0](https://github.com/twilio-labs/serverless-toolkit/compare/@twilio-labs/[email protected]...@twilio-labs/[email protected]) (2021-05-24)
7+
8+
**Note:** Version bump only for package @twilio-labs/plugin-assets
9+
10+
11+
12+
13+
614
# [1.0.0](https://github.com/twilio-labs/serverless-toolkit/compare/@twilio-labs/[email protected]...@twilio-labs/[email protected]) (2021-05-19)
715

816
**Note:** Version bump only for package @twilio-labs/plugin-assets

Diff for: packages/plugin-assets/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ OPTIONS
6565
would like to display (JSON output always shows all properties).
6666
```
6767

68-
_See code: [src/commands/assets/init.js](https://github.com/twilio-labs/serverless-toolkit/blob/v1.0.0/src/commands/assets/init.js)_
68+
_See code: [src/commands/assets/init.js](https://github.com/twilio-labs/serverless-toolkit/blob/v1.0.1-rc.0/src/commands/assets/init.js)_
6969

7070
## `twilio assets:list`
7171

@@ -86,7 +86,7 @@ OPTIONS
8686
(JSON output always shows all properties).
8787
```
8888

89-
_See code: [src/commands/assets/list.js](https://github.com/twilio-labs/serverless-toolkit/blob/v1.0.0/src/commands/assets/list.js)_
89+
_See code: [src/commands/assets/list.js](https://github.com/twilio-labs/serverless-toolkit/blob/v1.0.1-rc.0/src/commands/assets/list.js)_
9090

9191
## `twilio assets:upload FILE`
9292

@@ -110,7 +110,7 @@ OPTIONS
110110
(JSON output always shows all properties).
111111
```
112112

113-
_See code: [src/commands/assets/upload.js](https://github.com/twilio-labs/serverless-toolkit/blob/v1.0.0/src/commands/assets/upload.js)_
113+
_See code: [src/commands/assets/upload.js](https://github.com/twilio-labs/serverless-toolkit/blob/v1.0.1-rc.0/src/commands/assets/upload.js)_
114114
<!-- commandsstop -->
115115

116116
## Contributing

Diff for: packages/plugin-assets/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "@twilio-labs/plugin-assets",
33
"description": "Easily upload assets to a Twilio Assets service",
4-
"version": "1.0.0",
4+
"version": "1.0.1-rc.0",
55
"author": "Twilio Inc. <[email protected]> (https://www.twilio.com/labs)",
66
"contributors": [
77
"Phil Nash <[email protected]>"
88
],
99
"dependencies": {
1010
"@oclif/command": "^1.5.19",
1111
"@oclif/config": "^1.13.3",
12-
"@twilio-labs/serverless-api": "^5.0.0",
12+
"@twilio-labs/serverless-api": "5.1.0-rc.0",
1313
"@twilio/cli-core": "^5.22.0",
1414
"inquirer": "^8.0.0",
1515
"ora": "^5.4.0"

Diff for: packages/plugin-serverless/CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
55

66
## [2.0.2](https://github.com/twilio-labs/serverless-toolkit/compare/@twilio-labs/[email protected]...@twilio-labs/[email protected]) (2021-05-21)
77

8-
98
### Bug Fixes
109

1110
* **plugin-serverless:** remove default from aliases ([#274](https://github.com/twilio-labs/serverless-toolkit/issues/274)) ([50a1f76](https://github.com/twilio-labs/serverless-toolkit/commit/50a1f7643a342dc88cbe052ae68e0fa230dbff5a)), closes [#272](https://github.com/twilio-labs/serverless-toolkit/issues/272)
1211

1312

13+
## [2.0.2-rc.1](https://github.com/twilio-labs/serverless-toolkit/compare/@twilio-labs/[email protected]...@twilio-labs/[email protected]) (2021-05-24)
1414

15+
**Note:** Version bump only for package @twilio-labs/plugin-serverless
1516

1617

1718
## [2.0.1](https://github.com/twilio-labs/serverless-toolkit/compare/@twilio-labs/[email protected]...@twilio-labs/[email protected]) (2021-05-20)

Diff for: packages/plugin-serverless/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@twilio-labs/plugin-serverless",
33
"description": "Develop and deploy Twilio Serverless Functions",
4-
"version": "2.0.2",
4+
"version": "2.0.3-rc.1",
55
"author": "Twilio Inc. <[email protected]> (https://www.twilio.com/labs)",
66
"contributors": [
77
"Dominik Kundel <[email protected]>"
@@ -10,10 +10,10 @@
1010
"@oclif/command": "^1.5.19",
1111
"@oclif/config": "^1.13.3",
1212
"@twilio/cli-core": "^4.3.3",
13-
"create-twilio-function": "^3.0.1",
13+
"create-twilio-function": "3.0.2-rc.0",
1414
"lodash.camelcase": "^4.3.0",
1515
"lodash.kebabcase": "^4.1.1",
16-
"twilio-run": "^3.0.1"
16+
"twilio-run": "3.1.0-rc.0"
1717
},
1818
"devDependencies": {
1919
"@oclif/dev-cli": "^1.22.2",

Diff for: packages/runtime-handler/CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [1.1.0-rc.3](https://github.com/twilio-labs/serverless-toolkit/compare/@twilio/[email protected]...@twilio/[email protected]) (2021-05-24)
7+
8+
9+
### Features
10+
11+
* extract runtime-handler and lazyLoading ([#252](https://github.com/twilio-labs/serverless-toolkit/issues/252)) ([4b11e69](https://github.com/twilio-labs/serverless-toolkit/commit/4b11e693248e44a8c6db4a95cf90e79e00f7db08))
12+
13+
14+
15+
16+
617
## [1.0.2](https://github.com/twilio-labs/serverless-toolkit/compare/@twilio/[email protected]...@twilio/[email protected]) (2021-05-19)
718

819
**Note:** Version bump only for package @twilio/runtime-handler

Diff for: packages/runtime-handler/README.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,31 @@
11
# `@twilio/runtime-handler`
22

3-
This package defines the Twilio Functions Runtime version. It is currently empty.
3+
## How to use
4+
5+
Define the version of the `@twilio/runtime-handler` inside your `dependencies` section of the `package.json`. For example:
6+
7+
```json
8+
{
9+
"dependencies": {
10+
"@twilio/runtime-handler": "1.1.0"
11+
}
12+
}
13+
```
14+
15+
**Important:** You need to specify the exact version you want to use. Semver ranges are at the moment not supported.
16+
17+
## Local Development Feature
18+
19+
The following features are primarily designed to be used by `twilio-run` and the Serverless Toolkit. This part of the package emulates Twilio Functions for local development and **is NOT available when deployed to Twilio Functions**.
20+
21+
If for some reason you are trying to set up your own local development environment outside of the Serverless Toolkit you can do so through
22+
23+
```js
24+
const { LocalDevelopmentServer } = require('@twilio/runtime-handler/dev');
25+
26+
const server = new LocalDevelopmentServer(port, config);
27+
server.getApp().listen(port);
28+
```
429

530
## Contributing
631

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`with an express app with forked process function handling Function integration tests basic-twiml.js should match snapshot 1`] = `
4+
Object {
5+
"body": Object {},
6+
"headers": Object {
7+
"cache-control": "no-store, no-cache, must-revalidate, proxy-revalidate",
8+
"connection": "close",
9+
"content-type": "text/xml; charset=utf-8",
10+
"expires": "0",
11+
"pragma": "no-cache",
12+
"surrogate-control": "no-store",
13+
"x-powered-by": "Express",
14+
},
15+
"statusCode": 200,
16+
"text": "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><Response><Message>Hello World</Message></Response>",
17+
"type": "text/xml",
18+
}
19+
`;
20+
21+
exports[`with an express app with inline function handling Assets integration tests hello.js should match snapshot 1`] = `
22+
Object {
23+
"body": Object {},
24+
"headers": Object {
25+
"accept-ranges": "bytes",
26+
"cache-control": "no-store, no-cache, must-revalidate, proxy-revalidate",
27+
"connection": "close",
28+
"content-type": "application/javascript; charset=UTF-8",
29+
"expires": "0",
30+
"pragma": "no-cache",
31+
"surrogate-control": "no-store",
32+
"x-powered-by": "Express",
33+
},
34+
"statusCode": 200,
35+
"text": "alert('Hello world!');
36+
",
37+
"type": "application/javascript",
38+
}
39+
`;
40+
41+
exports[`with an express app with inline function handling Function integration tests basic-twiml.js should match snapshot 1`] = `
42+
Object {
43+
"body": Object {},
44+
"headers": Object {
45+
"cache-control": "no-store, no-cache, must-revalidate, proxy-revalidate",
46+
"connection": "close",
47+
"content-type": "text/xml; charset=utf-8",
48+
"expires": "0",
49+
"pragma": "no-cache",
50+
"surrogate-control": "no-store",
51+
"x-powered-by": "Express",
52+
},
53+
"statusCode": 200,
54+
"text": "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><Response><Message>Hello World</Message></Response>",
55+
"type": "text/xml",
56+
}
57+
`;

0 commit comments

Comments
 (0)