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 sync function #181

Merged
merged 5 commits into from
Jul 23, 2024
Merged

Add sync function #181

merged 5 commits into from
Jul 23, 2024

Conversation

Hysterelius
Copy link
Contributor

I found when I was updating abridge, that my files would go out of date... leading to a few issues. So, I made a quick function to update all these out of date files.

I am more than happy if this too complex or not what you wanted, and you don't want to merge it.

This function currently does:

  • Updates package.json, to make sure you have the latest packages and scripts
  • Updates all of your js files in static/js,

i.e., say the only js file you have is email.js it will only update that file if it out of date and not go around adding extra js files

  • Tries to warn you if your config.toml schema is out of date, it is a little bit finicky - especially around comments, so it is not 100% perfect

config.toml checking, using regexes. These two files would be evaluated to be the same:

# do NOT include a trailing slash on the base URL
base_url = "https://abridge.netlify.app"
# Usable site directly from disk, Including Search: "/home/jieiku/.dev/abridge/public"
# Also set index format = "elasticlunr_javascript", and in [extra] uglyurls = true, integrity = false
# If you use the npm/node script then all you have to do is set offline = true, and everything else is automatic.

title = "Abridge"
description = "Abridge is a fast and lightweight Zola theme using semantic html, abridge.css class-light CSS, and No Mandatory JS."
#theme = "abridge"

default_language = "en"
compile_sass = true
minify_html = true
build_search_index = true
generate_feeds = true
taxonomies = [
#    {name = "categories", feed = true},
    {name = "tags", feed = true},
]

and

# do NOT include a trailing slash on the base URL, and make sure to thank to awesome developer!
base_url = "https://abridge.pages.dev"
# Usable site directly from disk, Including Search: "/home/jieiku/.dev/abridge/public"
# Also set index format = "elasticlunr_javascript", and in [extra] uglyurls = true, integrity = false
# If you use the npm/node script then all you have to do is set offline = true, and everything else is automatic.

title = "A-tunnel"
description = "A-tunnel, it's just a big tunnel"
#theme = "abridge"

default_language = "de"
compile_sass = false
minify_html = false
build_search_index = false
generate_feeds = false
taxonomies = [
#    {name = "categories", feed = true},
    {name = "tags", feed = false},
]

However, it would fall apart if you were to comment out one of the already existing lines.

Copy link

netlify bot commented Jul 20, 2024

Deploy Preview for abridge ready!

Name Link
🔨 Latest commit e14dcf0
🔍 Latest deploy log https://app.netlify.com/sites/abridge/deploys/669fd2858077370008b96426
😎 Deploy Preview https://deploy-preview-181--abridge.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Jieiku
Copy link
Owner

Jieiku commented Jul 20, 2024

Great Idea! I am going to check this out and test it a bit once I get home from work!

@Hysterelius
Copy link
Contributor Author

I have added a few more regexes, so the config.toml should be able to handle commented out lines of config and I have done some testing on my website's repo and it seems to be fine.

I was wondering if you wanted an option the config.toml or something, to disable sync?

@Hysterelius
Copy link
Contributor Author

I added version checking in the sync script, so if it notices that the major version changes, which would signify breaking changes - which require an update for the package_abridge.js to work properly.
image

@Jieiku
Copy link
Owner

Jieiku commented Jul 23, 2024

Let me know when this is ready to go :)

@Hysterelius
Copy link
Contributor Author

I am happy with it.

It depends if you want to sync any extra files or add any other sync checks. I am very busy at the moment, so I can't make any edits.

One thing is that if you don't run npm install when it prompts you to, it can't prompt you again (as the package.json file would already be updated).

@Jieiku Jieiku merged commit 254cd12 into Jieiku:master Jul 23, 2024
4 of 5 checks passed
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.

2 participants