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

[command-hooks] allow adding command options to custom runtime commands #11848

Open
2 tasks done
yaquawa opened this issue Jan 25, 2023 · 3 comments
Open
2 tasks done
Labels
feature-request Request a new feature p4 platform-hooks Issue is related to CLI command hooks

Comments

@yaquawa
Copy link

yaquawa commented Jan 25, 2023

Is this feature request related to a new or existing Amplify category?

New category

Describe the feature you'd like to request

I'd like to using node -r tsconfig-paths/register -r esbuild-register to config a TypeScript rumtime.
but currently the config doesn't support passing command options to the runtime command.

Describe the solution you'd like

{
  "extensions": {
    "ts": {
      "runtime": "node",
      "options": ["-r", "tsconfig-paths/register", "-r", "esbuild-register"]
    }
  }
}

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • ⚠️ This feature might incur a breaking change
@yaquawa yaquawa added the pending-triage Issue is pending triage label Jan 25, 2023
@josefaidt josefaidt added feature-request Request a new feature platform Issues tied to the general CLI platform and removed pending-triage Issue is pending triage labels Jan 25, 2023
@josefaidt
Copy link
Contributor

Hey @yaquawa 👋 thanks for raising this! I think this is a great idea, and I've marked this as a feature request for further review from the team 🙂

@josefaidt josefaidt added platform-hooks Issue is related to CLI command hooks and removed platform Issues tied to the general CLI platform labels Jan 26, 2023
@josefaidt
Copy link
Contributor

Hey @yaquawa it was noticed there is also the capability to provide a custom runtime to the command hooks, which should enable us to use ts-node or something like vite-node to run TypeScript scripts directly. For example, say we use the following hooks-config.json

{
  "extensions": {
    "ts": {
      "runtime": "vite-node"
    }
  }
}

and the following pre-push script

// amplify/hooks/pre-push.ts
console.log('hello pre push')

Upon pushing we should notice the script is executed as expected:

➜  amplify push

----- 🪝 pre-push execution start -----
hello pre push
----- 🪝 pre-push execution end -----

@josefaidt josefaidt added the p4 label Jan 31, 2023
@yaquawa
Copy link
Author

yaquawa commented Feb 2, 2023

@josefaidt Thanks for the additional explanation🙏🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request a new feature p4 platform-hooks Issue is related to CLI command hooks
Projects
None yet
Development

No branches or pull requests

2 participants