JSPM

crownmark

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q22089F
  • License MIT

CLI tool to automatically insert header comments showing the file path in your source files, supporting many programming languages.

Package Exports

  • crownmark
  • crownmark/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (crownmark) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

crownmark

MIT License

CLI tool to automatically insert header comments showing the file path in your source files, supporting many programming languages.


✨ Features

✅ Adds a clean header comment with the relative file path to each source file. ✅ Supports multiple programming languages (JavaScript, TypeScript, Python, Shell, C/C++, Java, HTML, CSS, YAML, Markdown, etc.). ✅ Preserves shebangs and important license or linter comments at the top of your files. ✅ Updates the header if the file moves, ensuring the path is always correct.


🚀 Installation

Install it globally:

npm install -g crownmark

Or add it to your project:

npm install crownmark

⚡ Usage

Run it from your project root:

crownmark

It will recursively scan your project folder and:

  • Insert a header like // src/utils/myfile.js at the top of each file (using the correct comment style).
  • Skip files that already have the correct header.
  • Update the header if the file was renamed or moved.
  • Honor your custom config for included extensions and ignore rules.

🔧 Example output

For a utils/helper.js file, it would add:

// utils/helper.js
export function greet(name) {
    return `Hello, ${name}!`;
}

🛠 Supported file types

  • .js, .ts, .jsx, .tsx
  • .py, .sh, .rb, .go, .java, .kt, .c, .cpp, .h, .cs, .php, .dart
  • .css, .scss, .less
  • .html, .xml
  • .yml, .yaml
  • .md

⚙️ Custom configuration

You can control which file extensions and folders/files are included or ignored by creating a .crownmarkrc.json in your project root.

Example config

{
    "extensions": [".js", ".ts", ".dart"],
    "ignore": [
        "node_modules/",
        ".git/",
        "dist/",
        "custom.ignore.js",
        "!src/do-not-ignore.js"
    ]
}
  • extensions: Only these file types will be processed (default: all supported extensions)
  • ignore: Array of ignore rules using .gitignore-style patterns. Ignored files or folders will be skipped.

You can auto-generate a default config file with:

crownmark --init-config

This creates a .crownmarkrc.json in your project root with all supported extensions and standard ignore rules.


📝 Command line options

  • --help, -h   Show help and usage
  • --init-config   Create a default .crownmarkrc.json config file in your project root

📁 Default ignored folders and files

By default, crownmark will always skip common build, cache, environment, and version control folders (such as node_modules, .git, dist, venv, etc.), even if you don't provide a .crownmarkrc.json.

You can find the full list of default ignored patterns in lib/default-ignore.js in the source code.

If you want to override or extend these, simply use the "ignore" array in your config file.


🙋 FAQ

How are ignored files/folders handled? The ignore array in your config uses the same syntax as .gitignore, so you can use wildcards, negation (!), and directory/file matching.

Does it change license or linter comments? No, any special comments (license, linter, preserve, etc.) are left at the top, before the header.


👤 Author

Niccolò Terzaghi (github.com/NiccoloTerzaghi)