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

Get the scrub-themes.js script working #42

Closed
rgroves opened this issue Nov 1, 2019 · 5 comments · Fixed by #43 or #45
Closed

Get the scrub-themes.js script working #42

rgroves opened this issue Nov 1, 2019 · 5 comments · Fixed by #43 or #45

Comments

@rgroves
Copy link
Contributor

rgroves commented Nov 1, 2019

The scrub-themes script needs to be rewritten to implement the functionality mentioned in this comment in #12 and this comment in #26.

The scrub-themes.js script needs to update the theme markdown files in content/theme/ by:

  • Adding or updating a stale flag to the frontmatter for any theme who has not had a recent commit to it's specified branch
  • Adding the github_branch setting with the repo's default branch name, only when no branch is explicitly specified in the frontmatter already.

This process should be driven by the theme data stored in data/themes.json (which is generated by the generate-github.js script). Each theme object stored within the themes.json has the appropriate last_commit and branch that should be used in implementing the above requirements.

@rgroves
Copy link
Contributor Author

rgroves commented Nov 1, 2019

I'm currently working on this so I can then move #26 forward.

@JugglerX What do you want the cutoff date for determining the "stale" status? A hardcoded date of January 1st, 2018 is being used. It should likely be based on a calculation from the current date. Is something like current date minus one year acceptable (so a repo without a commit in the past year would be considered stale)? Or should the period be shorter than a year?

rgroves added a commit to rgroves/jamstackthemes that referenced this issue Nov 2, 2019
Script now adds the following to a theme's front matter:
- Add a stale flag if not commits in past year
- Add github branch (if missing)

Added scrub-themes to scripts in package.json.

Fixes stackbit#42
@JugglerX JugglerX reopened this Nov 4, 2019
@JugglerX
Copy link
Contributor

JugglerX commented Nov 4, 2019

@rgroves thanks for the PR with the scrub script. I did some work today which generates the github_branch and last_commit data in the generate-github.js - So this is available in data/themes.json

I was able to run scrub-themes.js and add the github_branch to the markdown files, which is nice. I also used it to generate a submission date for each theme. If we are going to be modifying the markdown files programmatically we need to decouple from using git info as the themes "submission date"

I tested the scrub script to generate stale data and it does, great! But I think this data should live in the data/themes.json not in the markdown. Let me know if you want to do that otherwise I can make the changes.

Really appreciate your work on this, thanks! :)

@rgroves
Copy link
Contributor Author

rgroves commented Nov 6, 2019

Sorry, I originally misunderstood where the stale flag should reside. I can work on moving this into data/themes.json via the generate-github.js script.

@JugglerX
Copy link
Contributor

JugglerX commented Nov 6, 2019

Ok sure. I agree it should exist in generate-github.js. stale flag is something we can update every build.

Broadly speaking. We want to avoid modifying the markdown files as much as possible. The scrub script should be used to make major updates to the markdown files when otherwise unavoidable.

@rgroves
Copy link
Contributor Author

rgroves commented Nov 6, 2019

That makes sense. Will have a PR for this later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants