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: add flag to geolocation #10443

Merged
merged 28 commits into from
Sep 19, 2023
Merged

Conversation

PaulieScanlon
Copy link
Contributor

@PaulieScanlon PaulieScanlon commented Sep 2, 2023

This PR adds flag to the geolocation export in the edge package.

E.g

import { geolocation } from '@vercel/edge';

export default async function handler(req) {
  const { flag } = geolocation(req);

  console.log(flag)
}

export const config = {
  runtime: 'edge',
};
$  🇬🇧 

@PaulieScanlon PaulieScanlon requested a review from a team as a code owner September 2, 2023 14:10
@changeset-bot
Copy link

changeset-bot bot commented Sep 2, 2023

🦋 Changeset detected

Latest commit: 5adfb65

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@vercel/edge Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

@orca-security-us orca-security-us bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

TooTallNate
TooTallNate previously approved these changes Sep 5, 2023
EndangeredMassa
EndangeredMassa previously approved these changes Sep 5, 2023
packages/edge/src/edge-headers.ts Show resolved Hide resolved
packages/edge/src/edge-headers.ts Outdated Show resolved Hide resolved
packages/edge/src/edge-headers.ts Outdated Show resolved Hide resolved
packages/edge/docs/README.md Outdated Show resolved Hide resolved
packages/edge/src/edge-headers.ts Outdated Show resolved Hide resolved
@cb1kenobi
Copy link
Contributor

I've branched this PR and running the tests here: #10496

Copy link
Contributor

@cb1kenobi cb1kenobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, manually tested and works great. However, I branched this PR to run the tests (#10496) and the "docs are up to date" test is failing: https://github.com/vercel/vercel/actions/runs/6164248432/job/16729621798?pr=10496. I can also cause the tests to fail when running pnpm test-unit from the packages/edge directory. Give this a look and I can re-run the tests.

@PaulieScanlon
Copy link
Contributor Author

PaulieScanlon commented Sep 12, 2023

Hi @cb1kenobi, thanks for looking at this, with regard to failing tests. I've just pulled this branch and the following tests are failing, they are all outside of the edge package.

  • test/utils/changelog/parse.test.js
  • test/utils/changelog/filter.test.js
  • test/utils/changelog/group.test.js

I don't believe any of the changes I've made touch these tests, could it be they are failing from a previous commit?

I have update the docs by running pnpm build:docs... is that what I needed to do? sorry, totally confused by this repo!

packages/edge/docs/README.md Outdated Show resolved Hide resolved
@PaulieScanlon
Copy link
Contributor Author

When i run pnpm test from the edge package, it changes all the references to the line numbers to use my username.

All the tests in the edge package now pass but what am I doing wrong? Why does running tests change stuff in a .md file?

@cb1kenobi
Copy link
Contributor

@PaulieScanlon I honestly don't know why it's changing the URLs. We don't have to deal with that because we don't use forks. In any case, I just pulled your branch into my PR so the tests can run. Fingers crossed! :) #10496

@cb1kenobi
Copy link
Contributor

@PaulieScanlon Tests pass! #10496

Huge thanks!

@cb1kenobi cb1kenobi merged commit 6228335 into vercel:main Sep 19, 2023
107 checks passed
@PaulieScanlon
Copy link
Contributor Author

@cb1kenobi Super stuff! Do you know when this will likely be published to npm?

@cb1kenobi
Copy link
Contributor

@PaulieScanlon should be soon, like, this week. Hopefully. :)

Ethan-Arrowood pushed a commit that referenced this pull request Sep 21, 2023
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## vercel@32.3.0

### Minor Changes

- [cli] Support northstar users
([#10535](#10535))

### Patch Changes

- Internal variants
([#10549](#10549))

- [speed insights] Prepare for migration to new speed insights package
([#10500](#10500))

- Updated dependencies
\[[`b0898a665`](b0898a6),
[`10d4e51ac`](10d4e51),
[`decdf27fb`](decdf27),
[`f5ca497b7`](f5ca497),
[`ab329f0fe`](ab329f0),
[`d0d052011`](d0d0520),
[`9bb3067de`](9bb3067)]:
    -   @vercel/static-build@2.0.7
    -   @vercel/node@3.0.6
    -   @vercel/build-utils@7.2.1
    -   @vercel/next@4.0.7
    -   @vercel/python@4.0.2
    -   @vercel/redwood@2.0.3
    -   @vercel/remix-builder@2.0.7
    -   @vercel/go@3.0.2

## @vercel/edge@1.1.0

### Minor Changes

- Add flag to geolocation
([#10443](#10443))

    Usage

        const { flag } = geolocation(req)

## @vercel/build-utils@7.2.1

### Patch Changes

- Internal variants
([#10549](#10549))

## @vercel/client@13.0.4

### Patch Changes

- Updated dependencies
\[[`decdf27fb`](decdf27)]:
    -   @vercel/build-utils@7.2.1

## @vercel/gatsby-plugin-vercel-analytics@1.0.11

### Patch Changes

- Remove "babel" compilation
([#10546](#10546))

## @vercel/gatsby-plugin-vercel-builder@2.0.6

### Patch Changes

- Use "esbuild" to build package
([#10508](#10508))

- Updated dependencies
\[[`decdf27fb`](decdf27)]:
    -   @vercel/build-utils@7.2.1

## @vercel/go@3.0.2

### Patch Changes

- Add support for Go v1.21.0
([#10552](#10552))

## @vercel/next@4.0.7

### Patch Changes

- Internal variants
([#10549](#10549))

- Update `@vercel/nft` to v0.24.1.
([#10540](#10540))

- Build package using "esbuild"
([#10482](#10482))

## @vercel/node@3.0.6

### Patch Changes

- Use "esbuild" to build package
([#10553](#10553))

- Update `@vercel/nft` to v0.24.1.
([#10540](#10540))

- Updated dependencies
\[[`decdf27fb`](decdf27)]:
    -   @vercel/build-utils@7.2.1

## @vercel/python@4.0.2

### Patch Changes

- Fix docs URL in error message
([#10544](#10544))

## @vercel/redwood@2.0.3

### Patch Changes

- Update `@vercel/nft` to v0.24.1.
([#10540](#10540))

## @vercel/remix-builder@2.0.7

### Patch Changes

- Update `@vercel/nft` to v0.24.1.
([#10540](#10540))

## @vercel/static-build@2.0.7

### Patch Changes

- Mark `@vercel/static-config` and `ts-morph` as externals
([#10543](#10543))

- Updated dependencies
\[[`4b376a564`](4b376a5),
[`b8bc682d3`](b8bc682)]:
    -   @vercel/gatsby-plugin-vercel-builder@2.0.6
    -   @vercel/gatsby-plugin-vercel-analytics@1.0.11

## @vercel-internals/types@1.0.11

### Patch Changes

- Updated dependencies
\[[`decdf27fb`](decdf27)]:
    -   @vercel/build-utils@7.2.1

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.

None yet

5 participants