https://github.com/n4bb12/nehemiah
🌱 Library for managing repositories
https://github.com/n4bb12/nehemiah
config init maintain repo setup sync
Last synced: over 1 year ago
JSON representation
🌱 Library for managing repositories
- Host: GitHub
- URL: https://github.com/n4bb12/nehemiah
- Owner: n4bb12
- License: isc
- Created: 2018-08-24T01:03:00.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-12-22T13:41:02.000Z (over 5 years ago)
- Last Synced: 2025-03-13T21:46:04.864Z (over 1 year ago)
- Topics: config, init, maintain, repo, setup, sync
- Language: TypeScript
- Homepage:
- Size: 407 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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.
## 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
```ts
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(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)
}
})()
```
#