Skip to content

Commit

Permalink
feat: extract runtime-handler and lazyLoading (#252) (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkundel authored Jun 10, 2021
1 parent a5d948e commit 0dde2a5
Show file tree
Hide file tree
Showing 62 changed files with 2,532 additions and 62 deletions.
2 changes: 1 addition & 1 deletion jest.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
// A set of global variables that need to be available in all test environments
globals: {
'ts-jest': {
tsConfig: 'tsconfig.test.json',
tsconfig: 'tsconfig.test.json',
},
},
// The test environment that will be used for testing
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"npmClientArgs": ["--no-package-lock"]
},
"version": {
"allowBranch": ["main", "feature/*"]
"allowBranch": ["main", "features/*"]
}
},
"ignoreChanges": ["**/__fixtures__/**", "**/__tests__/**"],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"lerna": "^3.22.1",
"lint-staged": "^8.2.1",
"npm-run-all": "^4.1.5",
"prettier": "^1.18.2",
"prettier": "^2.2.1",
"rimraf": "^3.0.2",
"ts-jest": "^26.0.0",
"typescript": "^3.9.7"
Expand Down
8 changes: 8 additions & 0 deletions packages/create-twilio-function/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [3.0.2-rc.0](https://github.com/twilio-labs/serverless-toolkit/compare/[email protected]@3.0.2-rc.0) (2021-05-24)

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





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

**Note:** Version bump only for package create-twilio-function
Expand Down
5 changes: 3 additions & 2 deletions packages/create-twilio-function/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-twilio-function",
"version": "3.0.1",
"version": "3.0.2-rc.0",
"description": "A CLI tool to generate a new Twilio Function using that can be run locally with twilio-run.",
"bin": "./bin/create-twilio-function",
"main": "./src/create-twilio-function.js",
Expand All @@ -26,6 +26,7 @@
},
"license": "MIT",
"devDependencies": {
"@twilio/runtime-handler": "1.1.0-rc.3",
"jest": "^24.5.0",
"nock": "^11.3.4"
},
Expand All @@ -38,7 +39,7 @@
"pkg-install": "^1.0.0",
"rimraf": "^2.6.3",
"terminal-link": "^2.0.0",
"twilio-run": "^3.0.1",
"twilio-run": "3.1.0-rc.0",
"window-size": "^1.1.1",
"wrap-ansi": "^6.0.0",
"yargs": "^12.0.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const typescriptDeps = {
};
const javaScriptDevDeps = { 'twilio-run': versions.twilioRun };
const typescriptDevDeps = {
'@twilio/runtime-handler': versions.twilioRuntimeHandler,
'twilio-run': versions.twilioRun,
typescript: versions.typescript,
copyfiles: versions.copyfiles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ const pkgJson = require('../../package.json');

module.exports = {
twilio: '^3.56',
twilioRuntimeHandler: pkgJson.devDependencies[
'@twilio/runtime-handler'
].replace(/[\^~]/, ''),
twilioRun: pkgJson.dependencies['twilio-run'],
node: '12',
typescript: '^3.8',
Expand Down
8 changes: 8 additions & 0 deletions packages/plugin-assets/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.0.1-rc.0](https://github.com/twilio-labs/serverless-toolkit/compare/@twilio-labs/[email protected]...@twilio-labs/[email protected]) (2021-05-24)

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





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

**Note:** Version bump only for package @twilio-labs/plugin-assets
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-assets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ OPTIONS
would like to display (JSON output always shows all properties).
```

_See code: [src/commands/assets/init.js](https://github.com/twilio-labs/serverless-toolkit/blob/v1.0.0/src/commands/assets/init.js)_
_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)_

## `twilio assets:list`

Expand All @@ -86,7 +86,7 @@ OPTIONS
(JSON output always shows all properties).
```

_See code: [src/commands/assets/list.js](https://github.com/twilio-labs/serverless-toolkit/blob/v1.0.0/src/commands/assets/list.js)_
_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)_

## `twilio assets:upload FILE`

Expand All @@ -110,7 +110,7 @@ OPTIONS
(JSON output always shows all properties).
```

_See code: [src/commands/assets/upload.js](https://github.com/twilio-labs/serverless-toolkit/blob/v1.0.0/src/commands/assets/upload.js)_
_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)_
<!-- commandsstop -->

## Contributing
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-assets/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@twilio-labs/plugin-assets",
"description": "Easily upload assets to a Twilio Assets service",
"version": "1.0.0",
"version": "1.0.1-rc.0",
"author": "Twilio Inc. <[email protected]> (https://www.twilio.com/labs)",
"contributors": [
"Phil Nash <[email protected]>"
],
"dependencies": {
"@oclif/command": "^1.5.19",
"@oclif/config": "^1.13.3",
"@twilio-labs/serverless-api": "^5.0.0",
"@twilio-labs/serverless-api": "5.1.0-rc.0",
"@twilio/cli-core": "^5.22.0",
"inquirer": "^8.0.0",
"ora": "^5.4.0"
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-serverless/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

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


### Bug Fixes

* **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)


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

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


## [2.0.1](https://github.com/twilio-labs/serverless-toolkit/compare/@twilio-labs/[email protected]...@twilio-labs/[email protected]) (2021-05-20)
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-serverless/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@twilio-labs/plugin-serverless",
"description": "Develop and deploy Twilio Serverless Functions",
"version": "2.0.2",
"version": "2.0.3-rc.1",
"author": "Twilio Inc. <[email protected]> (https://www.twilio.com/labs)",
"contributors": [
"Dominik Kundel <[email protected]>"
Expand All @@ -10,10 +10,10 @@
"@oclif/command": "^1.5.19",
"@oclif/config": "^1.13.3",
"@twilio/cli-core": "^4.3.3",
"create-twilio-function": "^3.0.1",
"create-twilio-function": "3.0.2-rc.0",
"lodash.camelcase": "^4.3.0",
"lodash.kebabcase": "^4.1.1",
"twilio-run": "^3.0.1"
"twilio-run": "3.1.0-rc.0"
},
"devDependencies": {
"@oclif/dev-cli": "^1.22.2",
Expand Down
11 changes: 11 additions & 0 deletions packages/runtime-handler/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [1.1.0-rc.3](https://github.com/twilio-labs/serverless-toolkit/compare/@twilio/[email protected]...@twilio/[email protected]) (2021-05-24)


### Features

* 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))





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

**Note:** Version bump only for package @twilio/runtime-handler
Expand Down
27 changes: 26 additions & 1 deletion packages/runtime-handler/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
# `@twilio/runtime-handler`

This package defines the Twilio Functions Runtime version. It is currently empty.
## How to use

Define the version of the `@twilio/runtime-handler` inside your `dependencies` section of the `package.json`. For example:

```json
{
"dependencies": {
"@twilio/runtime-handler": "1.1.0"
}
}
```

**Important:** You need to specify the exact version you want to use. Semver ranges are at the moment not supported.

## Local Development Feature

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**.

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

```js
const { LocalDevelopmentServer } = require('@twilio/runtime-handler/dev');

const server = new LocalDevelopmentServer(port, config);
server.getApp().listen(port);
```

## Contributing

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`with an express app with forked process function handling Function integration tests basic-twiml.js should match snapshot 1`] = `
Object {
"body": Object {},
"headers": Object {
"cache-control": "no-store, no-cache, must-revalidate, proxy-revalidate",
"connection": "close",
"content-type": "text/xml; charset=utf-8",
"expires": "0",
"pragma": "no-cache",
"surrogate-control": "no-store",
"x-powered-by": "Express",
},
"statusCode": 200,
"text": "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><Response><Message>Hello World</Message></Response>",
"type": "text/xml",
}
`;

exports[`with an express app with inline function handling Assets integration tests hello.js should match snapshot 1`] = `
Object {
"body": Object {},
"headers": Object {
"accept-ranges": "bytes",
"cache-control": "no-store, no-cache, must-revalidate, proxy-revalidate",
"connection": "close",
"content-type": "application/javascript; charset=UTF-8",
"expires": "0",
"pragma": "no-cache",
"surrogate-control": "no-store",
"x-powered-by": "Express",
},
"statusCode": 200,
"text": "alert('Hello world!');
",
"type": "application/javascript",
}
`;

exports[`with an express app with inline function handling Function integration tests basic-twiml.js should match snapshot 1`] = `
Object {
"body": Object {},
"headers": Object {
"cache-control": "no-store, no-cache, must-revalidate, proxy-revalidate",
"connection": "close",
"content-type": "text/xml; charset=utf-8",
"expires": "0",
"pragma": "no-cache",
"surrogate-control": "no-store",
"x-powered-by": "Express",
},
"statusCode": 200,
"text": "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><Response><Message>Hello World</Message></Response>",
"type": "text/xml",
}
`;
Loading

0 comments on commit 0dde2a5

Please sign in to comment.