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

refactor: Removing unnecessary build outputs #1499

Merged

Conversation

rschristian
Copy link
Member

What kind of change does this PR introduce?

Removing unnecessary files from being output by build

Did you add tests for your changes?

Edited existing

Summary

Closes #1495

Does this PR introduce a breaking change?

No

@rschristian rschristian requested a review from a team as a code owner December 13, 2020 00:56
@changeset-bot
Copy link

changeset-bot bot commented Dec 13, 2020

🦋 Changeset detected

Latest commit: 392dcc5

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

This PR includes changesets to release 1 package
Name Type
preact-cli Patch

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

expect(keys).toHaveLength(Object.keys(src).length);
expect(Object.keys(src)).toHaveLength(keys.length);
Copy link
Member Author

Choose a reason for hiding this comment

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

This was backwards which made the test failure output rather confusing.

Copy link
Member

@prateekbh prateekbh left a comment

Choose a reason for hiding this comment

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

When removing 200.html this line needs to fallback to index.html
https://github.com/preactjs/preact-cli/blob/master/packages/cli/sw/index.js#L23

Comment on lines 21 to 26
setCatchHandler(({ event }) => {
if (isNav(event)) {
return caches.match(getCacheKeyForURL('/200.html'));
return (
caches.match(getCacheKeyForURL('/200.html')) ||
caches.match(getCacheKeyForURL('/index.html'))
);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@prateekbh Sorry, missed that. Hopefully this will work?

Copy link
Member Author

Choose a reason for hiding this comment

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

nvm, need to at least touch up the test suite first

Copy link
Member Author

Choose a reason for hiding this comment

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

Alright, should be corrected now.

Copy link
Member

Choose a reason for hiding this comment

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

sry for late reply would caches.match(getCacheKeyForURL('/200.html') || getCacheKeyForURL('/index.html')) work?

Copy link
Member Author

Choose a reason for hiding this comment

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

No worries. Should do. Not sure why I did it like that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Corrected. Thanks for the catch.

@privateOmega
Copy link

privateOmega commented Dec 23, 2020

@rschristian Does this PR require any more changes to be merged? Thanks for the contribution, I am new to preact, but would love to see this land.

@rschristian
Copy link
Member Author

@rschristian Does this PR require any more changes to be merged? Thanks for the contribution, I am new to preact, but would love to see this land.

Looks like I need to rebase the changes but otherwise that'd be up to Prateek/anyone else who had improvements/concerns.

@rschristian rschristian force-pushed the refactor/pruneUnnecessaryBuildOutputs branch from 43223b5 to 392dcc5 Compare December 23, 2020 21:00
@prateekbh
Copy link
Member

@rschristian as a follow up can you add a test similar to https://github.com/preactjs/preact-cli/blob/master/packages/cli/tests/service-worker.test.js#L48-L63 but with pre-rendering disabled

@prateekbh prateekbh merged commit df48437 into preactjs:master Dec 27, 2020
@preact-bot preact-bot mentioned this pull request Dec 27, 2020
@rschristian
Copy link
Member Author

@prateekbh Sorry, hadn't gotten the chance to add a test yet due to the holidays. Figured I'd pick it back up on Monday (probably)

@maltoze
Copy link

maltoze commented Mar 4, 2021

Waiting for release

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.

Build creates 200.html with --no-prerender option
5 participants