Does Slash lambda support typescript by default? I have been writing ES6 javascript files and want to get some added dev help from typescript.
The answer, is no… you have to compile any .ts files down to vanilla JavaScript before pushing to Lambda
Typescript really just helps writing things in VS Code. Any program (react, svelte, angular) has to build first before it is deployed, so that makes sense…
The real question is setting up your build, before your automatic deployment in package.json:
I would be interested to see how you did this, as I imagined you streamlined the build as well. Do you guys just use lambda.ts → lamdas.js → build it, then deploy it?
we are not using TS right now.
Here’s my config:
package.json:
{
"name": "dgraph-lambda",
"version": "1.0.0",
"main": "lib/index.js",
"config": {
"url": "url"
},
"scripts": {
"build": "tsc",
"slash-login": "slash-graphql login",
"push-schema": "slash-graphql update-schema -e $npm_package_config_url schema.graphql",
"slash-update-lambda": "tsc && slash-graphql update-lambda -e $npm_package_config_url -f=dist/main.js",
"push-lambda": "tsc && npx webpack --target=webworker && npm run slash-update-lambda",
"slash-drop-data": "slash-graphql drop -e $npm_package_config_url -d"
},
"devDependencies": {
"@slash-graphql/lambda-types": "^1.2.0"
},
"dependencies": {},
"author": "",
"license": "ISC",
"description": ""
}
tsconfig.json:
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2017",
"resolveJsonModule": true
},
"compileOnSave": true,
"include": [
"src"
, "setup.ts" ]
}
You can also add a lint file if you want.
slash-graph1l is no longer supported. Are you actually getting it to work?
J
Nope, did this after realizing that lol. Now having issues with the new Cloud API