Skip to content

chore: use spawn arg arrays, remove dead code, fix template var#24

Merged
Olanetsoft merged 2 commits intomainfrom
chore/cleanup-shell-calls-and-dead-code
Mar 26, 2026
Merged

chore: use spawn arg arrays, remove dead code, fix template var#24
Olanetsoft merged 2 commits intomainfrom
chore/cleanup-shell-calls-and-dead-code

Conversation

@adamreynolds-io
Copy link
Copy Markdown
Contributor

Summary

  • Standardize child process calls: git-cloner and package-manager now use spawnSync with argument arrays, matching the pattern already used by git-utils and package-installer. This avoids shell string interpolation and is easier to read/maintain.
  • Compact installer: downloads the installer script to a temp file before executing, instead of piping curl output directly to sh. Includes a shebang check to reject non-script responses (e.g. HTML error pages).
  • Path safety guard: create-app now rejects dangerous project paths (/, ~, system dirs) before any fs.remove call.
  • Remove dead code: ErrorHandler.checkDocker, ErrorHandler.checkNodeVersion, ErrorHandler.warn, ErrorHandler.info, and PackageInstaller.detectPackageManager all had zero callers.
  • Remove redundant Node check from cli.ts — the bin entry point already enforces Node >= 22 via semver.satisfies before cli.ts runs.
  • Fix {{author}} template variable: was never provided to Mustache, rendered as empty string silently. Now explicitly "".
  • Exclude test.ts from build: smoke test no longer compiles to dist/test.js and ships in the npm package.

Test plan

  • tsc --noEmit passes
  • vitest run — all 39 tests pass
  • Manual: npx create-mn-app test-app --template hello-world --skip-install --skip-git still scaffolds correctly
  • Manual: npx create-mn-app test-app --from midnightntwrk/example-counter --dry-run shows expected output

Generated with Claude Code

- Replace execSync string interpolation with spawnSync arg arrays in
  git-cloner and package-manager for consistency with the rest of the
  codebase (git-utils, package-installer already use spawn arrays)
- Download Compact installer to temp file before executing instead of
  piping curl output directly to shell
- Add path safety guard in create-app before removing existing dirs
- Remove unused ErrorHandler methods (checkDocker, checkNodeVersion,
  warn, info) and PackageInstaller.detectPackageManager — all had
  zero callers
- Remove redundant Node version check from cli.ts (bin entry point
  already enforces this via semver before cli.ts runs)
- Fix hello-world template using unpopulated {{author}} variable
- Exclude test.ts from tsconfig build so it doesn't ship in package

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@adamreynolds-io adamreynolds-io added the ai-assisted PR created or modified with AI assistance label Mar 22, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Olanetsoft Olanetsoft merged commit 31fc7bc into main Mar 26, 2026
2 checks passed
@Olanetsoft Olanetsoft deleted the chore/cleanup-shell-calls-and-dead-code branch March 26, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted PR created or modified with AI assistance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants