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

Add CORS header and Cache-Control to static serve #672

Merged
merged 6 commits into from Jan 25, 2021

Conversation

cristianbote
Copy link
Member

What:

Add the CORS and Cache-Control headers to the static serve middleware.

Why:

In order to be able to load static resources across server domains.

How:

koa-static has this nifty method setHeaders which is designed specifically to add headers at will.

Tasks:

  • Code
  • Update other packages
  • Add a changeset (with link to its Feature Discussion if it exists)

Unrelated Tasks

  • TSDocs
  • TypeScript
  • Unit tests
  • End to end tests
  • TypeScript tests
  • Update starter themes
  • Open an issue for this feature in the docs repo
  • Update community discussions

Additional Comments

@cristianbote cristianbote self-assigned this Jan 22, 2021
@changeset-bot
Copy link

changeset-bot bot commented Jan 22, 2021

🦋 Changeset detected

Latest commit: a143e0c

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

This PR includes changesets to release 1 package
Name Type
@frontity/core 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

@cristianbote cristianbote added this to In progress in Sprint 10 via automation Jan 22, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jan 22, 2021

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@codecov
Copy link

codecov bot commented Jan 22, 2021

Codecov Report

Merging #672 (a143e0c) into dev (979c44e) will not change coverage.
The diff coverage is n/a.

@cristianbote
Copy link
Member Author

The external script test is failing and trying to zero in into it. I'll report back.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 25, 2021

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

Copy link
Member

@luisherranz luisherranz left a comment

Choose a reason for hiding this comment

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

LGTM Cristian! 🙂

I've modified our eslint to avoid that eslint-disables and I've updated the script spec expect to use Jest instead of Mocha because we try to always use Jest's one, even in Cypress.

Feel free to merge.

@luisherranz luisherranz removed the request for review from DAreRodz January 25, 2021 10:12
@@ -20,7 +20,7 @@ describe("Script", () => {
.its("moment")
.should("exist")
.then((moment) => {
expect(moment()._isAMomentObject).to.equal(true);
expect(moment()._isAMomentObject).toBe(true);
Copy link
Member Author

Choose a reason for hiding this comment

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

🤔 huh, wondering why do you think we should use Jest's expect? cypress has the chai one already 🤷‍♂️

Copy link
Member

Choose a reason for hiding this comment

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

Wondering the same!

Just my two cents, @luisherranz: #672 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

It was simply a personal preference, to learn the commands of only one expect instead of two.

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha!

.its("moment")
.should("exist")
.then((moment) => {
expect(moment()._isAMomentObject).toBe(true);
Copy link
Member

Choose a reason for hiding this comment

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

I think this could be rewritten like this, right? Just to follow the Cypress way of do things and avoid dealing with jest eslint rules. 🤷

cy.window()
  .its("moment")
  .should("exist")
  .then((moment) => moment()._isAMomentObject)
  .should("be.true"); // or .should("equal", true)

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good catch @DAreRodz. Like the way it integrates.

@cristianbote cristianbote merged commit 53cef1c into dev Jan 25, 2021
Sprint 10 automation moved this from In progress to Done Jan 25, 2021
@cristianbote cristianbote deleted the add-cors-header-and-cache-control-to-static-serve branch January 25, 2021 10:26
@frontibotito frontibotito mentioned this pull request Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Sprint 10
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants