-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Milestone
Description
As called out in #465 for TypeScript projects we need to point the Serverless Toolkit against the output folders in dist/functions and dist/assets as opposed to leaving it to the default of functions and assets. Right now this is done in the package.json for the deploy script by using the --functions-folder and --assets-folder in the script. These flags don't get picked up if you run twilio serverless:deploy though. Instead we should modify the .twilioserverlessrc file that gets created to set the values accordingly instead.
Changes required
- Add a
isTypeScriptProjectargument to thetemplateDefaultConfigFilefunction in/packages/twilio-run/src/templating/defaultConfig.ts - Adjust the logic of
templateDefaultConfigFileifisTypeScriptProjectistrueto set"functionsFolder": "dist/functions"and"assetsFolder": "dist/assets"accordingly. - Add same
isTypeScriptProjectas optional argument towriteDefaultConfigFilemethod and pass totemplateDefaultConfigFile - Change
createServerlessConfigFilefunction inpackages/create-twilio-function/src/create-twilio-function/create-files.jsto accept anisTypeScriptProjectflag and pass it towriteDefaultConfigFile - Change call of
createServerlessConfigFileinpackages/create-twilio-function/src/create-twilio-function.jsto passisTypeScriptProjectby checking forprojectType === 'typescript' - Remove the now redundant additions to the
startanddeployscripts (lines 54-57) from thecreatePackageJSONmethod increate-files.js
Acceptance criteria
After the changes were made the following order of commands should work:
twilio serverless:init ts-example --typescript
cd ts-example
npm run build
twilio serverless:deploytwilio serverless:start should also work out of the box after running npm run build.
Metadata
Metadata
Assignees
Labels
No labels