Get good Git info from Eleventy, too

This page summarizes the projects mentioned and recommended in the original post on dev.to

SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
  • Luxon

    ⏱ A library for working with dates and times in JS

  • Note that gitinfo.js assumes you have installed the luxon package, to be used here for formatting dates from Git commit data. (On the other hand, child_process is included in Node.js.) Notice also that you’ll have to supply, in the repoLink variable, the URL for your online repo’s commits.

  • const { DateTime } = require("luxon") const childProcess = require('child_process') const environment = process.env.NODE_ENV module.exports = (pubdate, filename) => { let stringToRet = `` if (environment === "production") { let repoLink = `` /* ================ For `repoLink`, fill in the starting URL for commits to your project's online repo! If you use GitHub, it'll usually be in the format of: https://github.com/your-github-name/your-repo-name/commit/ ================ */ pubdate = DateTime.fromJSDate(pubdate).toFormat("yyyy-MM-dd") const lastUpdatedFromGit = childProcess .execSync(`git log -1 --format=%cd --date=short ${filename}`) .toString() .trim() const abbrevHash = childProcess .execSync(`git log -1 --pretty=format:"%h" ${filename}`) .toString() .trim() const longHash = childProcess .execSync(`git log -1 --pretty=format:"%H" ${filename}`) .toString() .trim() repoLink += longHash if (longHash !== '') { stringToRet = `Latest commit: ${repoLink}" rel="noopener">${abbrevHash}` if (pubdate !== lastUpdatedFromGit) { stringToRet += `, ${lastUpdatedFromGit}` } } else { stringToRet = ` ` } } else { stringToRet = `[Git info will appear here in production.]` } return stringToRet }

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • node

    Node.js JavaScript runtime ✨🐢🚀✨

  • Note that gitinfo.js assumes you have installed the luxon package, to be used here for formatting dates from Git commit data. (On the other hand, child_process is included in Node.js.) Notice also that you’ll have to supply, in the repoLink variable, the URL for your online repo’s commits.

  • Hugo

    The world’s fastest framework for building websites.

  • In “Get good Git info from Hugo,” I explained how to use the Hugo static site generator (SSG)’s built-in Git info variables to display page-by-page Git commit data for one’s static website. Well, lo and behold, you can get that kind of information in the Eleventy SSG, too. You just need to add a little code, in the form of a shortcode that takes advantage of Eleventy-supplied data.

  • starter-workflows

    Accelerating new GitHub Actions workflows

  • The one potential kink to this for you is that, in order for this to work best, you’ll have to use a CI/CD method of deploying your site. For anybody likely to find this article, you’ll typically be using either GitHub Actions or GitLab CI/CD. The reason this is necessary is because this method uses git log, and — at least as far as I know — there's no way to use any of the Jamstack-savvy web hosts’ UIs to specify fetch-depth: 0, which is necessary for this to work.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Github actions: Deploy a Hugo website to a FTP server

    3 projects | dev.to | 20 Mar 2023
  • Build An Online Resume with an Auto-Updating PDF Version

    3 projects | dev.to | 11 Feb 2023
  • We Don’t Use Docker (We Don’t Need It)

    10 projects | news.ycombinator.com | 15 Mar 2021
  • Scc: A fast code counter with complexity calculations and COCOMO estimates

    1 project | news.ycombinator.com | 23 Apr 2024
  • Javascript Date() - DateOnly Format and off by 1 day when using date-fns

    1 project | dev.to | 28 Mar 2024