You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 isTypeScriptProject argument to the templateDefaultConfigFile function in /packages/twilio-run/src/templating/defaultConfig.ts
Adjust the logic of templateDefaultConfigFile if isTypeScriptProject is true to set "functionsFolder": "dist/functions" and "assetsFolder": "dist/assets" accordingly.
Add same isTypeScriptProject as optional argument to writeDefaultConfigFile method and pass to templateDefaultConfigFile
Change createServerlessConfigFile function in packages/create-twilio-function/src/create-twilio-function/create-files.js to accept an isTypeScriptProject flag and pass it to writeDefaultConfigFile
Change call of createServerlessConfigFile in packages/create-twilio-function/src/create-twilio-function.js to pass isTypeScriptProject by checking for projectType === 'typescript'
Remove the now redundant additions to the start and deploy scripts (lines 54-57) from the createPackageJSON method in create-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:deploy
twilio serverless:start should also work out of the box after running npm run build.
The text was updated successfully, but these errors were encountered:
As called out in #465 for TypeScript projects we need to point the Serverless Toolkit against the output folders in
dist/functions
anddist/assets
as opposed to leaving it to the default offunctions
andassets
. Right now this is done in thepackage.json
for thedeploy
script by using the--functions-folder
and--assets-folder
in the script. These flags don't get picked up if you runtwilio serverless:deploy
though. Instead we should modify the.twilioserverlessrc
file that gets created to set the values accordingly instead.Changes required
isTypeScriptProject
argument to thetemplateDefaultConfigFile
function in/packages/twilio-run/src/templating/defaultConfig.ts
templateDefaultConfigFile
ifisTypeScriptProject
istrue
to set"functionsFolder": "dist/functions"
and"assetsFolder": "dist/assets"
accordingly.isTypeScriptProject
as optional argument towriteDefaultConfigFile
method and pass totemplateDefaultConfigFile
createServerlessConfigFile
function inpackages/create-twilio-function/src/create-twilio-function/create-files.js
to accept anisTypeScriptProject
flag and pass it towriteDefaultConfigFile
createServerlessConfigFile
inpackages/create-twilio-function/src/create-twilio-function.js
to passisTypeScriptProject
by checking forprojectType === 'typescript'
start
anddeploy
scripts (lines 54-57) from thecreatePackageJSON
method 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:deploy
twilio serverless:start
should also work out of the box after runningnpm run build
.The text was updated successfully, but these errors were encountered: