@medianaura/yalkem
v0.4.0
Published
[](https://npmjs.org/package/@medianaura/yalkem) [](https://npmjs.org/package/@medianaura/yalkem) [. - Handle
pnpm,bun, ornpm workspaceswhen reinstalling afteryalkem purge(only npm and yarn are detected). - Remove deselected packages from
node_modules; it toggles booleans in.yalkemrcbut expects you to runyalc removeoryalkem purgeyourself. - Publish packages, run build steps, or manage versions inside
.yalc; those remainyalcresponsibilities.
Features and Gaps
What you get
- A global package catalog stored via
conf, so every developer pulls from the same list. - Per-project
.yalkemrcfiles you can commit, allowing branch-specific local package sets. - idempotent maintenance commands (
yalkem purge,yalkem restore) that encode the repetitiveyalcinvocations. - Guard rails around missing packages (the CLI refuses to add a package that has not been
yalc published in the system directory).
What to watch out for
- No JSON schema validation for
.yalkemrcbeyond "string -> boolean" at runtime; typos go unnoticed untilyalkem localruns. - Error handling is coarse-grained (exit code
1with a short message). There is no verbosity/debug flag yet. - Command output is optimized for humans, not machines. If you need JSON for automation, you currently must parse text or extend the CLI.
Installation
Prerequisites
- Node.js >= 18.0.0 (ESM runtime plus optional chaining is used throughout the CLI).
yalcinstalled globally and initialized (Yalkem shells out to theyalcexecutable usingexeca).
Install yalc
npm install -g yalcInstall Yalkem
npm install -g @medianaura/yalkemVerify your setup
yalkem --version
yalc --versionIf either command is missing, fix that first because every Yalkem command ultimately shells out to yalc.
Storage locations
| Purpose | Windows (example) | macOS | Linux |
| ------------------------------------------------------- | -------------------------------------------- | ---------------------------------------------------- | ------------------------------------- |
| Global Yalkem config (conf) | %APPDATA%\yalkem-nodejs\Config\config.json | ~/Library/Preferences/yalkem-nodejs/config.json | ~/.config/yalkem-nodejs/config.json |
| yalc package directory checked by yalkem global add | %APPDATA%\Yalc\packages\<name> | ~/Library/Application Support/Yalc/packages/<name> | ~/.yalc/packages/<name> |
The config path matters if you need to audit or reset the package catalog manually.
Where Yalkem Stores State
Yalkem has two layers of state:
- Global catalog - JSON managed by the
confpackage. It only stores an array calledpackagescontaining the package names you've approved. This file is local to each developer machine, so commit it only if you purposely copy it elsewhere. - Project preferences -
.yalkemrcin each repository root. It records{ "<packageName>": true | false }, which controls which catalog entries the automation should touch when you runyalkem local,yalkem purge, oryalkem restore. Commit it so teammates inherit the same toggles.
Resolution rules:
yalkem localreads the global catalog first. Packages that are not in the global list never appear in the checklist..yalkemrcentries merge on disk. Manual edits persist, but the last run ofyalkem localrewrites the file with two-space indentation and sorted keys.- Because deselected packages stay installed until you clean them, pair
yalkem localwithyalkem purge(oryalc remove) so that only packages still set totrueget re-added during restore.
Quick Start
Publish the source package with
yalc.cd packages/shared-utils yalc publishAdd it to the team catalog.
yalkem global add @my-org/shared-utilsSelect it inside a project.
cd ../apps/my-dashboard yalkem local # Select @my-org/shared-utils when promptedToggle off any packages you are not actively developing; they stay in
.yalkemrcasfalseso future purge/restore cycles skip them.Restore the exact local setup elsewhere.
git clone https://github.com/my-org/my-dashboard.git cd my-dashboard npm install yalkem restoreClean before a production build.
yalkem purge npm run build yalkem restore
Configuration Schema
.yalkemrc is a plain JSON object in the project root:
{
"@my-org/shared-utils": true,
"@my-org/ui-kit": false
}true-> the package belongs to this project's local workflow;yalkem localkeeps it checked, andyalkem purge/yalkem restorewill remove/relink it automatically.false-> keep the package listed for visibility but skip it during purge/restore. Use this when you only want specific packages active to avoid breaking the app with mismatched versions.
Guidelines:
- Keep
.yalkemrcunder source control so PRs document local package changes. - Do not store secrets or private filesystem paths here; only package names are supported.
- If you hand-edit the file, use strict JSON; comments or trailing commas will cause
JSON.parseto throw, andyalkemwill revert to{}silently.
CLI Reference
All commands exit with 0 on success and 1 on failure. Output is always human-readable text routed through the internal logger.
| Command | Interactive? | Description |
| -------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------- |
| yalkem global list | No | Print the catalog stored in the global config (packages array). |
| yalkem global add <name> | No | Validate the package exists in the system yalc directory and append it to the catalog. |
| yalkem global remove | Yes | Checkbox prompt to remove one or more packages from the catalog. |
| yalkem local | Yes | Checkbox prompt for the current project; runs yalc add for every selected package and rewrites .yalkemrc. |
| yalkem purge | Yes (confirmation) | Removes all yalc links, cleans installations, and optionally reinstalls npm/yarn deps. |
| yalkem restore | No | Reads .yalkemrc and runs yalc add for every entry marked true. |
yalkem global list
- Flags: none.
- Behavior: prints every package in the catalog or warns when empty.
- Usage:
yalkem global(default) oryalkem global list.
yalkem global add <name>
- Flags: none.
- Validation: fails if
<name>already exists in the catalog or is missing from the systemyalcpackages directory. - Tip: run
yalc publishbefore this command so the directory check passes.
yalkem global remove
- Interaction: uses a checkbox prompt. There is no
--yesflag, so it cannot run headless. - Behavior: deletes the selected entries from the catalog. If you select nothing, the command throws
No package selected.
yalkem local
- Interaction: checkbox prompt per package.
- Side effects: rewrites
.yalkemrcand runsyalc addfor each selected package. It does not callyalc removefor packages you unchecked; instead, the unchecked packages are stored asfalseso the nextyalkem purge/yalkem restorecycle ignores them. - Automation: run it only in terminals with TTY support; CI usage is unsupported.
yalkem purge
- Steps executed:
yalc remove --allyalc installations clean- Confirmation prompt ("Do you want to install dependencies?")
- Runs
npm installoryarndepending on whatdetect-package-managerfinds. If it sees anything else (pnpm, bun, etc.), the command throws "Failed to detect package manager."
- Use case: preparing a release build or ensuring you are back to registry packages. When you follow this with
yalkem restore, only packages still set totruein.yalkemrcare re-added.
yalkem restore
- Behavior: reads
.yalkemrc, filters the entries withtrue, and sequentially runsyalc add <package>. - Preconditions:
.yalkemrcmust exist and contain at least onetrueentry. Otherwise the command throws "No active package found." - Tip: run it after
git clone, afteryalkem purge, or whenever you reset your repo.
Practical Workflows
Team-managed catalog shared across repositories
- Publish every local package with
yalc publish. - Run
yalkem global add <name>once per package. - Commit
.yalkemrcper repository. Each change goes through code review, which documents why a project depends on a given local package. - Add "Run
yalkem restore" to your onboarding docs.
pnpm, bun, or custom package managers
Yalkem does not (yet) reinstall dependencies for pnpm/bun during yalkem purge. Work around it by:
yalkem purge
# Wait for the purge to finish, skip the reinstall prompt
pnpm install --lockfile-only=false # or your custom install command
yalkem restoreIf you rely on pnpm workspaces, ensure every workspace root runs yalkem local from the workspace directory so .yalkemrc lives beside the root package.json.
CI restore after checkout
yalkem local and yalkem global remove require a TTY, but yalkem restore is safe in CI. Example GitHub Actions snippet:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install -g yalc @medianaura/yalkem
- run: npm ci
- run: yalkem restoreEnsure .yalkemrc exists in the repo; otherwise yalkem restore fails fast and surfaces in CI.
Cleaning for releases
- Run
yalkem purgeand confirm the dependency reinstall (npm/yarn only). - Build or test from a "pure registry" install.
yalkem restoreto get back to your local packages for ongoing development.
Handling packages that should not be committed
Some experiments or private builds should stay off the shared .yalkemrc. Options:
- Keep them out of the global catalog entirely (skip
yalkem global add). - Use a separate branch-specific
.yalkemrcand avoid committing it;yalkem localwill still honor your local edits. - Document any manual overrides in your repo README so others do not assume the package is intentionally missing.
Troubleshooting and Diagnostics
Directory not found when adding packages
- Message:
Directory <.../Yalc/packages/<name>> not found. - Fix: run
yalc publishwithin the package directory so the.yalcsystem folder contains the package.
- Message:
Failed to add package <name>duringyalkem localyalkem localshells out toyalc add. Ensureyalcis on your PATH and the package exists in the.yalcdirectory.- Check
.yalkemrcfor typos;@org/pkgvs@org/pkg-uiwill silently be different entries.
Failed to detect package managerafteryalkem purge- Only npm and yarn are supported. Use the workaround described in pnpm, bun, or custom package managers, or run your install command manually.
Permissions issues on Windows
- The global config and
.yalcdirectories live under%APPDATA%. Run the shell with the correct user or grant write permissions toC:\Users\<you>\AppData\Roaming.
- The global config and
Broken
.yalkemrc- If JSON parsing fails, Yalkem treats the project as having zero packages.
- Delete
.yalkemrc(or fix the syntax) and rerunyalkem localto regenerate it.
Resetting the catalog
- Delete the global config file shown in Storage locations or run
yalkem global removerepeatedly. - Afterwards, re-add the packages via
yalkem global add.
- Delete the global config file shown in Storage locations or run
Useful manual checks:
yalkem global list- confirms the CLI sees your packages.cat .yalkemrc- verifies per-project selections.yalc dir- prints whereyalcstores the published packages.yalc installations- shows which projects currently link a package.
Security and Data Ownership
- Only package names are stored, so no source code or credentials leave your repositories.
- Global config lives on each developer's machine; if the catalog contains sensitive package names, treat the config directory accordingly.
.yalkemrcshould be reviewed like any other dependency manifest. Require PR review when toggling packages to avoid accidental local overrides.- There is no telemetry or remote sync. Removing Yalkem from your machine is as simple as deleting the global config file and uninstalling the CLI.
Release and Support
- Upgrade via
npm install -g @medianaura/yalkem@latest. - Follow the repository for changelog entries (semver is respected; breaking changes bump the major version).
- Issues and feature requests belong in the GitHub issue tracker; include your OS, Node version, and exact command output.
- If you distribute this CLI inside a larger toolchain, pin the version globally and document the commands you rely on (
global add,local, etc.) so teammates can reproduce them.
License
MIT License - MedianAura
