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

Additional guides to use TypeScript at functions for a TypeScript beginner #2996

Closed
mats16 opened this issue Feb 26, 2021 · 4 comments
Closed
Labels
amplify/cli Issues tied to CLI feature-request Request a new feature guides p4 guide needed/net new info

Comments

@mats16
Copy link

mats16 commented Feb 26, 2021

Is your feature request related to a problem? Please describe.

To use TypeScript at function, this guides is very helpful.
https://docs.amplify.aws/cli/function/build-options

But I think some information are lack to use TypeScript.

As a TypeScript beginner, I want to know where I should place package.json and node_modules within Amplify project during Amplify Tutorial so that I don't need to back and forth among their guides.

Describe the solution you'd like

I think it is better to mention node_modules and package.jsom on docs.

for example ..

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "lib": ["dom", "esnext"],
    "module": "commonjs",
    "moduleResolution": "node",
    "skipLibCheck": true,
    "resolveJsonModule": true,
    "outDir": "./src",
    "baseUrl": "./",
    "rootDir": "./lib",
    "paths": {
      "src": ["./lib"],
      "*": [
        "./src/node_modules/@types/*",
        "./src/node_modules/*"
      ]
    }
  }
}
$ tree
.
├── Function-cloudformation-template.json
├── amplify.state
├── dist
│   └── latest-build.zip
├── function-parameters.json
├── lib
│   └── index.ts
├── parameters.json
├── src
│   ├── event.json
│   ├── index.js
│   ├── package-lock.json
│   └── package.json
└── tsconfig.json

Describe alternatives you've considered

N/A

Additional context

N/A

@medelman17
Copy link

I agree. There are a lot of disparate resources in the community; we should have and promote a canonical approach that embraces best practices and makes it as easy as possible for folks to get started with Functions and TypeScript.

In the meantime, feel free too take a look here re: how I tend to approach adding TS to my Amplify-based Lambda deployments, my tsconfig, etc.

The other key point, not captured above, is to add a "generate:<MY_TS_FUNCTION_NAME>" script to the package.json file in your project root with instructions re: how to build your TS-based function. Amplify will execute that script prior to uploading your source to the cloud.

@medelman17 medelman17 added feature-request Request a new feature amplify/js Issues tied to JS guides labels Feb 27, 2021
@mauerbac
Copy link
Member

mauerbac commented Oct 8, 2021

@sammartinez , someone on your team who could take a look?

@sammartinez sammartinez added amplify/cli Issues tied to CLI and removed amplify/js Issues tied to JS labels Oct 11, 2021
@sammartinez
Copy link
Contributor

In looking at this it seems to be related to Amplify CLI. I have adjusted the labels for this. Please work with their team @mauerbac

@mauerbac mauerbac added the p4 guide needed/net new info label May 8, 2022
@ykethan
Copy link
Member

ykethan commented Nov 18, 2022

Closing this in favor of aws-amplify/amplify-cli#659. Please feel free in adding additional information on your use case.

@ykethan ykethan closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
amplify/cli Issues tied to CLI feature-request Request a new feature guides p4 guide needed/net new info
Projects
None yet
Development

No branches or pull requests

5 participants