PUBLIC_REPOSITORY
git-js
PUBLIC_REPOSITORY | git-js | |
---|---|---|
1 | 7 | |
- | 3,382 | |
- | - | |
- | 7.4 | |
- | about 1 month ago | |
TypeScript | ||
- | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
PUBLIC_REPOSITORY
-
Build a Serverless Comment System for a Jamstack Blog
// comment-merge.ts import { AzureFunction, Context, HttpRequest } from "@azure/functions"; import util = require("util"); import * as querystring from "querystring"; import * as simpleGit from "simple-git/promise"; import fs = require("fs"); import { tmpdir } from "os"; import uuidv4 = require("uuid/v4"); import globstd = require("glob"); import rimrafstd = require("rimraf"); const rimraf = util.promisify(rimrafstd); const glob = util.promisify(globstd); const mkdir = util.promisify(fs.mkdir); const writeFile = util.promisify(fs.writeFile); const readFile = util.promisify(fs.readFile); const httpTrigger: AzureFunction = async function ( context: Context, req: HttpRequest ): Promise { context.log("HTTP trigger function processed a request."); context.res!.headers["Content-Type"] = "application/json"; //request content type is configured in GitHub webhook settings const payload = req.body; if ( payload.action != "closed" || payload.pull_request.base.ref != "main" || !payload.pull_request.merged_at ) { return; } // create temp repo and add remotes const tempRepo = uuidv4(); await mkdir(`${tmpdir}/${tempRepo}/comments`, { recursive: true, }); const git = simpleGit(`${tmpdir}/${tempRepo}`); await git.init(); await Promise.all([ git.addConfig("user.name", "GITHUB_USERNAME"), git.addConfig("user.email", "GITHUB_EMAIL"), ]); await Promise.all([ git.addRemote( "private", `https://GITHUB_USERNAME:${process.env["GitHubUserPassword"]}@https://github.com/GITHUB_USERNAME/PRIVATE_REPOSITORY` ), git.addRemote( "public", `https://GITHUB_USERNAME:${process.env["GitHubUserPassword"]}@https://github.com/GITHUB_USERNAME/PUBLIC_REPOSITORY` ), ]); // fetch public and integrate with latest modifications from private repo await git.fetch("public", "main"); await git.checkout("main", ["--", "comments/"]); await git.checkoutBranch("main", "main"); await git.fetch("private", "main"); await git.checkout("main", ["--", "comments/"]); // filter private data from comments // retrieve comment file paths const paths = await glob(`comments/**/*.json`, { cwd: `${tmpdir}/${tempRepo}/`, }); // wait for all paths to process asynchronously await Promise.all( paths.map(async (path) => { let pathData = []; //read JSON file with comment info pathData = JSON.parse( await readFile(`${tmpdir}/${tempRepo}/${path}`, "utf8") ); // filter out private info const publicData = pathData.map((item) => { const { authorEmail, ...store } = item; return store; }); // write file back to original with private data removed await writeFile( `${tmpdir}/${tempRepo}/${path}`, JSON.stringify(publicData, null, 2), "utf8" ); }) ); // add filtered comment file modifications, commit, and push await git.add(`${tmpdir}/${tempRepo}/comments/*.json`); await git.commit("approving comment"); await git.push("public", "main"); await rimraf(`${tmpdir}/${tempRepo}/`); context.res!.status = 200; context.res!.body = { message: "success" }; }; export default httpTrigger;
git-js
-
Docusaurus blogs: using the createFeedItems API with git commit date
Now we know how to use the API, let's implement it to handle our use cases. To get the git commit date, we're going to use a package called simple-git. We'll add this as a dependency of our Docusaurus project:
-
Cloud Function GitHub Update
I ended up switching to simple-git as nodegit ssh issues had me 2 days behind on trying to get out lesson 8. It provides a very simple interface to effectively accomplish everything I needed. It also allows me to use a personal token to do Git updates to GitHub which I liked a lot better.
-
What's Wrong This Time? A Debugging Mystery in Three Parts
simple-git is a JavaScript library which allows you to run git commands from within TypeScript / JavaScript code.
-
Top 10 Trending Projects on GitHub for Web Developers
Checkout this repo here
-
Let's make your own commit message template with cz-format-extension
You know, cz-format-extension is very highly expandable. You can use API of Inquirer.js, git-repo-info, and git-js.
-
Build a Serverless Comment System for a Jamstack Blog
In either case of appending a comment to an existing list or committing the first one, the end result of the try catch block will be a new branch checked out with the name of the commentId that was just generated. Be sure to note the difference between checkoutBranch and checkoutLocalBranch in the Simple Git git checkout documentation.
-
Run Git commands from Node.js application using JavaScript! 🚀
Simple-git is a tool for running git commands in any Node.js application. It gives us access to make all kinds of permutations on top of your commits and branches. With that library, we can easily create a script responsible for releasing our latest changes and running it from the command line.
What are some alternatives?
PRIVATE_REPOSITORY
react-cool-img - 😎 🏞 A React <Img /> component let you handle image UX and performance as a Pro!
cz-format-extension - Extension for commitizen format
awesome-software-architecture - A curated list of awesome articles, videos, and other resources to learn and practice about software architecture, patterns, and principles.
git-repo-info
cz-cli - The commitizen command line utility. #BlackLivesMatter
klipse - Klipse is a JavaScript plugin for embedding interactive code snippets in tech blogs.
cz-customizable - A standalone commit message helper or customizable commitizen adapter for https://github.com/commitizen/cz-cli
nodegit - Native Node bindings to Git.
flatpickr - lightweight, powerful javascript datetimepicker with no dependencies
turborepo - Incremental bundler and build system optimized for JavaScript and TypeScript, written in Rust – including Turborepo and Turbopack. [Moved to: https://github.com/vercel/turbo]
awwsmm.com - Personal website