@ggdna/dna-scripts
v0.2.0
Published
DNA layer: deterministic node scripts and their shared functions
Readme
dna_scripts
The DNA layer for the node scripts a repo automates its workflow with — deterministic given local git and file system state, no GitHub API calls.
Guides
dna/doc/guides/scripts-guide.md— what belongs here, what does not, and how to add a script
Skills
/scripts— checks every script parses, every import resolves, and reports duplicated logic that should be a shared function
Scripts
dna/scripts/functions/colors.js— ANSI colors for console outputdna/scripts/functions/current-branch.js— the current git branchdna/scripts/functions/directories.js— the script's own directorydna/scripts/functions/get-version.js— the version frompackage.jsondna/scripts/functions/is-clean-repo.js— whethermainis checked out, clean and in sync withorigin/maindna/scripts/functions/is-main-up-to-date.js— whether localmainmatchesorigin/maindna/scripts/functions/run-command.js— runs a shell command, logs and returns its outputdna/scripts/functions/sync-folders.js— recursively copies one folder into anotherdna/scripts/functions/get-repo-urls.js— lists a GitHub organization's repository URLs viaghdna/scripts/functions/pull-request-url.js— the URL of the current branch's pull request viaghdna/scripts/delete-feature-branch.js— deletes the current feature branch locally and on the remote once it is mergeddna/scripts/rename-class.js— renames every occurrence of a class and file name across the repodna/scripts/setup-github-repo.js— applies the branch protection rules a new repo needsdna/scripts/wait-for-pr.js— waits for the current pull request to merge
Layers
Orthogonal: this layer carries only its own topic and is combined with other layers by the consuming repo.
Variables
dnaCopyrightHolder— the name in the license header of every file
Usage
Declare it as a dev-dependency and initialize once:
pnpm add -D @ggdna/dna-scripts # TypeScript projects
dart pub add dev:dna_scripts # Dart projects
helix initThe placed test instantiates and verifies the DNA on every test run.
Development
The dna/ folder is hand-authored source and is never generated. The repo
instantiates its own DNA — run dart test after changes; commit first, a
file the DNA would overwrite must not carry uncommitted work.
