Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use twilioserverlessrc in TypeScript projects to point at output #467

Open
dkundel opened this issue Feb 8, 2023 · 0 comments
Open

Use twilioserverlessrc in TypeScript projects to point at output #467

dkundel opened this issue Feb 8, 2023 · 0 comments

Comments

@dkundel
Copy link
Member

dkundel commented Feb 8, 2023

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

  1. Add a isTypeScriptProject argument to the templateDefaultConfigFile function in /packages/twilio-run/src/templating/defaultConfig.ts
  2. Adjust the logic of templateDefaultConfigFile if isTypeScriptProject is true to set "functionsFolder": "dist/functions" and "assetsFolder": "dist/assets" accordingly.
  3. Add same isTypeScriptProject as optional argument to writeDefaultConfigFile method and pass to templateDefaultConfigFile
  4. 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
  5. Change call of createServerlessConfigFile in packages/create-twilio-function/src/create-twilio-function.js to pass isTypeScriptProject by checking for projectType === 'typescript'
  6. 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.

@makserik makserik added this to the Improvements/Nice to haves milestone Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants