Code Monkey home page Code Monkey logo

nehemiah's Introduction

Logo Nehemiah

A library for managing repositories

Nehemiah was a high official in the Persian court of King Artaxerxes I of Persia and led the third return of the Jewish people after seventy years of exile. He organized the reconstruction of the wall of Jerusalem in record time while defending against opposition on all sides. His talent, his huge organizational accomplishments and his faith in God inspired the name for this package. Read the whole story.

Version License Issues CircleCI Dependencies Coverage LGTM

About

Basically monorepos without the monorepo. Nehemiah synchronizes directories and executes tasks within them, based on code you write using a simple API.

Features include:

  • Scan repo for files
  • Test if file exists --> find out what type of project it is, or if a certain dependency/config file is used
  • Copy file --> add file to repo if it doesn't exist, overwrite file, e.g. tslint.json
  • Delete file --> remove unwanted files for cleanup, e.g. logfiles
  • Merge file fragments --> insert partials into README.md
  • Edit json file --> update package.json with standardized values
  • Edit line-based file --> update .gitignore
  • Run shell commands in directory --> yarn install, git fetch, yarn upgrade, sort-package-json
  • Get warned if something deviates from expectations --> no tests in package.json, missing license

Install

yarn add nehemiah

Example

import Nehemiah from "nehemiah"

const projects = ["a", "b", "c"]

interface Package {
  author: string
  keywords: string[]
}

async function updateProject(dir: string) {
  const n = new Nehemiah(dir)

  const updatePackage = () => n.modify("package.json")
    .asJson<Package>(p => {
      p.author = "Esra"

      if (!Array.isArray(p.keywords) || p.keywords.length < 3) {
        n.warn("Not enough keywords")
      }
    })

  const shouldHaveLicense = async () => {
    if (!await n.exists("license*")) {
      n.warn("Missing license")
    }
  }

  const deleteLogs = async () => n.delete("*.log")

  const updateEditorConfig = async () =>
    n.copy(__dirname, "templates/.editorconfig").to(".editorconfig")

  const updateMinorPatch = async () =>
    n.run("yarn upgrade --mutext file")

  const gitFetchPrune = () => n.run("git fetch --prune")

  await Promise.all([
    updatePackage,
    shouldHaveLicense,
    deleteLogs,
    updateEditorConfig,
    updateMinorPatch,
    gitFetchPrune,
  ])
}

(async () => {
  for (const dir of projects) {
    await updateProject(dir)
  }
})()

Logo made by Freepik from www.flaticon.com is licensed by CC 3.0 BY

nehemiah's People

Contributors

dependabot-support avatar n4bb12 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.