Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Add isolate feature #3920

Merged
merged 12 commits into from
Sep 23, 2020
Merged

Add isolate feature #3920

merged 12 commits into from
Sep 23, 2020

Conversation

robdodson
Copy link
Contributor

@robdodson robdodson commented Sep 22, 2020

This adds a (very experimental) feature to improve the quality of life for folks who are developing or authoring content on web.dev.

npm run isolate can be used to move all files out of src/site/content and into an _exile directory which will be ignored for builds. isolate takes an optional glob (or space separated list of globs) of files that should be preserved.

npm run integrate will restore all of the files in _exile to their previous location. It will also delete the _exile directory.

Example usage:

# Move everything except the style-focus directory to _exile
npm run isolate -- src/site/content/en/accessible/style-focus/**

(Do some work on style-focus/index.md)

# Restore everything from _exile back to src/site/content
npm run integrate

Benchmark

Without isolate:

  • Initial Eleventy build: 10.48 seconds
  • Eleventy rebuild: 8.27 seconds

With isolate:

  • Initial Eleventy build: 1.06 seconds
  • Eleventy rebuild: 0.53 seconds

Changes

Changes proposed in this pull request:

  • Adds isolate and integrate npm scripts
  • Adds git commit hook to prevent committing while the _exile directory is active
  • Prevents authors collection from throwing if there are authors without posts

@robdodson robdodson requested a review from a team as a code owner September 22, 2020 18:39
@robdodson robdodson changed the title Feat/isolate Add isolate feature Sep 22, 2020
@googlebot googlebot added the cla: yes Contributor has signed the CLA label Sep 22, 2020
@github-actions
Copy link

Alex Recommends Report

Alex recommends the following language changes, but Alex is a regular expression based algorithm, so take them with a grain of salt.

README.md

Level Location Word Recommendation
⚠️ 62:36 master master may be insensitive, use primary, hub, reference instead
⚠️ 63:20 just just may be insensitive, try not to use it

@netlify
Copy link

netlify bot commented Sep 22, 2020

Deploy preview for web-dev-staging ready!

Built with commit 17f6168

https://deploy-preview-3920--web-dev-staging.netlify.app

@robdodson
Copy link
Contributor Author

Percy failure can be ignored. It's flaking on an image (related to #3804).

tools/isolate/index.js Outdated Show resolved Hide resolved
Copy link
Contributor

@devnook devnook left a comment

Choose a reason for hiding this comment

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

Left some comments. Also - maybe consider adding a test for it?

@nhoizey
Copy link

nhoizey commented Sep 23, 2020

Wouldn't it be enough to restrict the number of items in every collection when the environment is "dev"?

@robdodson
Copy link
Contributor Author

Wouldn't it be enough to restrict the number of items in every collection when the environment is "dev"?

Maybe, though I think that would require editing the code for all of our collections to use a common filter and we'd need to ensure we use it for new collections as well. It's not a bad idea though and may be safer than physically moving the files (though that seemed to work surprisingly well). I'd also need a way to specify to the filter that it should allow certain posts to remain in the collection(s) (basically whichever post or directory of posts I'm working on).

@nhoizey
Copy link

nhoizey commented Sep 23, 2020

I agree it might not be easy, and you probably don't want to remove items from a navigation collection, for example… 😅

@robdodson robdodson merged commit 3770b00 into master Sep 23, 2020
@robdodson robdodson deleted the feat/isolate branch September 23, 2020 16:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Contributor has signed the CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants