Skip to content

Commit

Permalink
Remove unnecessary files
Browse files Browse the repository at this point in the history
  • Loading branch information
hayd committed Dec 6, 2019
1 parent 21a38e9 commit 5277eb2
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 29 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ between invocations and will sometimes be shutdown.

```ts
export async function badHandler(event: Event, context: Context) {
somethingAsync() // not awaited
return
somethingAsync(); // not awaited
return;
}
```

If you need to return immediately but want to invoke a longer running process you can
[async-invoke](https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html)
another lambda function (which does the `await somethingAsync()`).
Expand Down
6 changes: 0 additions & 6 deletions runtime/Dockerfile

This file was deleted.

6 changes: 3 additions & 3 deletions runtime/artifacts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ cp -R .deno_dir/gen/file/$PWD/. .deno_dir/LAMBDA_TASK_ROOT
zip -qq deno-lambda-layer.zip -x '.deno_dir/gen/file/*' -r .deno_dir amz-deno bootstrap hello.ts
zip -qq deno-lambda-example.zip -x '.deno_dir/gen/file/*' -r .deno_dir hello.ts

DENO_DIR=.deno_dir ./amz-deno bundle bundle.ts bundle.bundle.js
DENO_DIR=.deno_dir ./amz-deno bundle hello.ts hello.bundle.js

rm -rf .deno_dir
mkdir -p .deno_dir/deps/https/deno.land/x/lambda/
cp mod.ts .deno_dir/deps/https/deno.land/x/lambda/mod.ts
DENO_DIR=.deno_dir ./amz-deno fetch remote.ts
DENO_DIR=.deno_dir ./amz-deno fetch pad.ts
cp -R .deno_dir/gen/file/$PWD/. .deno_dir/LAMBDA_TASK_ROOT
zip -qq remote.zip -x '.deno_dir/gen/file/*' -r .deno_dir remote.ts
zip -qq pad.zip -x '.deno_dir/gen/file/*' -r .deno_dir pad.ts
5 changes: 2 additions & 3 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ RUN deno fetch /src/tests/deps.ts

ADD hello.ts /src/runtime/hello.ts
ADD hello.ts /src/tests/hello.ts
ADD tests/bundle.ts /src/runtime/bundle.ts
ADD tests/remote.ts /src/runtime/remote.ts
ADD tests/pad.ts /src/runtime/pad.ts
ADD runtime /src/runtime

WORKDIR /src/runtime
RUN sh artifacts \
&& cp bundle.bundle.js /src/tests/bundle.bundle.js \
&& cp hello.bundle.js /src/tests/hello.bundle.js \
&& cp bootstrap /src/tests/bootstrap

WORKDIR /src/tests
Expand Down
1 change: 0 additions & 1 deletion tests/bundle.ts

This file was deleted.

1 change: 0 additions & 1 deletion tests/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export async function foo(event: Event, context: Context) {
}

export async function withContext(event: Event, context: Context) {
// is there a foo attribute?! who knows!
return { name: context.functionName, awsRequestId: context.awsRequestId };
}

Expand Down
9 changes: 9 additions & 0 deletions tests/pad.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Context, Event } from "https://deno.land/x/lambda/mod.ts";
// pad.ts is chosen since it has no dependencies.
// i.e. we must download precisely one file from deno.land.
import { pad } from "https://deno.land/std/strings/pad.ts";

export function handler(event: Event, context: Context) {
const strLen: number = Number(event.strLen) || 5;
return pad("deno", strLen);
}
6 changes: 0 additions & 6 deletions tests/remote.ts

This file was deleted.

2 changes: 1 addition & 1 deletion tests/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function bootstrap(testJson) {
return Deno.run({
args: [bootstrapScript],
stdout: "piped",
// stderr: "piped", // comment this out to debug
stderr: "piped", // comment this out to debug
env: testJson.env,
cwd: "/var/task"
});
Expand Down
4 changes: 2 additions & 2 deletions tests/test_bundle.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"env": {
"_HANDLER": "bundle.handler",
"_HANDLER": "hello.handler",
"HANDLER_EXT": "bundle.js"
},
"events": [{ "hello": "deno" }, { "hello": "again" }],
Expand All @@ -14,6 +14,6 @@
"content": "{\"statusCode\":200,\"body\":\"Welcome to deno 0.25.0 🦕\"}"
}
],
"files": ["bundle.bundle.js"],
"files": ["hello.bundle.js"],
"layer": "deno-lambda-layer.zip"
}
8 changes: 4 additions & 4 deletions tests/test_denodir.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"env": {
"_HANDLER": "remote.handler"
"_HANDLER": "pad.handler"
},
"events": [{ "hello": "deno" }, { "hello": "again" }],
"events": [{ "hello": "deno" }, { "strLen": "6" }],
"expected": [
{
"status": "ok",
"content": "\" deno\""
},
{
"status": "ok",
"content": "\" deno\""
"content": "\" deno\""
}
],
"files": "remote.zip",
"files": "pad.zip",
"layer": "deno-lambda-layer.zip"
}

0 comments on commit 5277eb2

Please sign in to comment.