npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@luxmargos/place-files

v0.1.1

Published

Place files from a YAML config into target paths with version checks and backups.

Downloads

296

Readme

place-files

place-files is an npm CLI and library for copying prepared files into configured target paths. It is designed for projects that need to place files, directories, or glob matches from a YAML config while keeping local backups and applying changes only when a source version changes.

Features

  • Place files from a simple YAML config.
  • Support individual files, directories, and glob patterns.
  • Skip repeated runs when the configured version has already been applied.
  • Back up existing target files before overwriting them.
  • Customize target paths, backup behavior, and missing-file behavior.
  • Use as either a CLI or a TypeScript/JavaScript library.

Install

Install in your project:

npm install @luxmargos/place-files

Or install globally for direct CLI usage:

npm install -g @luxmargos/place-files

Quick start

Create a starter config and payload:

npx place-files init

Apply files from the generated config:

npx place-files --config ./place-files.yml

If installed globally, you can run the binary directly:

place-files init
place-files --config ./place-files.yml

place-files init creates:

  • place-files.yml
  • place-files.version
  • place-files-payload/hello.txt

Use place-files init --force to overwrite an existing generated preset.

Config files

By default, place-files searches for a config file in this order:

  • place-files.yml
  • place-files.yaml

Example configs and sample payloads are available in examples/README.md. Start with examples/simple/place-files.yml or examples/basic/place-files.yml.

Config example

base_dir: .
version_file: place-files.version
applied_version_file: .place-files.applied.version

entries:
  - src: payload/files/project-notes.md
    dst: output/project-notes.md
  - src: payload/config/*.json
    dst: output/config
  - src: payload/assets
    dst: output/assets

This example:

  • Places one file at an exact target path.
  • Places all matched JSON files into a target directory.
  • Places a whole directory tree into a target directory.

Key config options

  • base_dir
    • Base path for all relative paths.
    • If omitted, the directory containing the config file is used.
  • version_file
    • File containing the source bundle version.
    • Any value can be used, such as a version ID, date, or release string.
  • applied_version_file
    • Local file that records the last applied version.
  • entries
    • List of files, directories, or glob patterns to place from src to dst.
    • If src is a glob pattern, dst is treated as a directory.
  • backup.enabled
    • Whether to create a backup when the target already exists.
  • backup.directory
    • Directory used to collect backup files.
  • backup.format
    • Format for backup file or folder paths. Defaults to {basename}.{datetime}_{random}{previous_version_suffix}.backup.
    • Supports placeholders: {basename}, {name}, {ext}, {datetime}, {random}, {previous_version}, {previous_version_suffix}, {version}, {version_suffix}, {target_dir}, and {target_path}.
    • When backup.directory is set, the format is relative to that directory; otherwise, it is relative to the target file's directory.
  • backup.include_previous_version
    • Whether to include the previously applied version in default backup file names and {previous_version_suffix} / {version_suffix}.
  • behavior.place_when_version_missing
    • Whether to place files when version_file is missing.
  • behavior.fail_on_missing_source
    • Whether missing sources should fail the run.

CLI

place-files [options]
place-files init [simple] [options]

Commands:

  • init: generate a simple preset config and payload in the current directory.

Options:

  • -c, --config <path>: specify the config YAML path.
  • --cwd <path>: specify the base directory used when searching for default configs.
  • --dry-run: print the planned actions without changing files.
  • --force: run even when the version is unchanged; with init, overwrite preset files.
  • -v, --verbose: print verbose logs.
  • -h, --help: print help.
  • --version: print the package version.

Library API

import { placeFiles } from '@luxmargos/place-files';

await placeFiles({
  configPath: './place-files.yml',
  dryRun: true,
});

Development

This section is for contributors working from the source repository.

Install dependencies and build:

npm install
npm run build

Run type checks and tests:

npm run typecheck
npm test

Run a local development example:

node dist/cli.js --config examples/basic/place-files.yml --dry-run

Testbed

Use the testbed to exercise real copy, backup, no-op, version-up, and force-run behavior:

npm run testbed:reset
npm run build
npm run testbed:dry-run
npm run testbed:run
npm run testbed:run
npm run testbed:force

To run only the automated version-up regression check:

npm run test:version-up

The generated target directory is examples/testbed/workdir/ and is ignored by Git.