1.0.8 • Published 5 years ago

nehemiah v1.0.8

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

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)
  }
})()

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.3.0

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago