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

feat: start middleware #2517

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

pedromtec
Copy link
Contributor

What's the purpose of this pull request?

How it works?

How to test it?

Starters Deploy Preview

References

Checklist

You may erase this after checking them all 😉

PR Title and Commit Messages

  • PR title and commit messages follow the Conventional Commits specification
    • Available prefixes: feat, fix, chore, docs, style, refactor and test

PR Description

  • Added a label according to the PR goal - breaking change, bug, contributing, performance, documentation..

Dependencies

  • Committed the yarn.lock file when there were changes to the packages

Copy link

vercel bot commented Oct 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
faststore-site ⬜️ Ignored (Inspect) Visit Preview Oct 23, 2024 8:19pm

Copy link

codesandbox-ci bot commented Oct 18, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

pedromtec added a commit that referenced this pull request Nov 12, 2024
## What's the purpose of this pull request?

This task will allow enabling the redirects middleware within
**@faststore/core** during the build process based on a flag.

The idea is to enable this functionality only for projects that have the
flag `ENABLE_REDIRECTS_MIDDLEWARE` saved in the env vars and which are
hosted by homebrew. In the future, we intend to have control of this
feature through webops.

Next steps: 

- Set this flag in a pipeline env var.
- Implements dynamoDB client (Reference:
#2517)

## How it works?

The key is the name of the file: **middleware__DISABLED.ts**

This middleware is disabled by default. Only stores that are in
**homebrew** and want this functionality will be able to enable it via a
feature flag. When the flag is active, the CLI at build time will check
whether the **ENABLE_REDIRECTS_MIDDLEWARE** flag is set or not, if so,
the file name will be changed to **middleware.ts** and nextjs will know
how to automatically deal with it.

## How to test it?
I created a [PR](vtex-sites/starter.store#599)
with the flag enabled, clone the branch and then:

- Run `yarn build`
- check if the **middleware.ts** was created inside **.faststore/src**

### References


https://docs.google.com/document/d/1iC1fLwJbypnvDyp_JilKBfQfaHjFDHYrjS1kC722sB4/edit?tab=t.0#heading=h.tglo77yl0lf5
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

Successfully merging this pull request may close these issues.

1 participant