The live catalog
Rules
Separate the extensions with commas. An empty list gives the default .ts, .tsx.
A file is out when its name ends with one of these patterns. An empty list excludes nothing.
Files
Select a box to turn a file in or out, whatever the rules say.
Output src-catalog.md
- Files kept
- Size
- Lines
Use your own folder
Drop a folder here, or
The files stay in your browser. The page sends nothing to a server. It reads only text files, and it stops at 5 MB. It does not read the hidden folders and the ignored folders, because the CLI skips them too.
How it works
The CLI walks the folder where you start it. It applies these rules to each entry, in this sequence. The first rule that applies decides.
- hidden An entry with a name that starts with a dot is out. The walk does not enter a hidden folder.
- ignored folder The walk does not enter
node_modules,distandbuild, at each depth. - extension A file with an extension that is not in the include list is out. The default list is
.ts, .tsx. - exclude pattern A file with a name that ends with a pattern of the exclude list is out. For example,
.test.tsremoves the tests. - kept Each other file is kept. The output has the files in the sequence of their paths.
The output starts with the rules and a directory tree. Then it has a section for each kept file, with a code fence and the language of the extension.
A code fence is longer than each run of backticks in the file, so a file with Markdown in it does not break the output.
The directory tree also shows the folders with no kept files, and the hidden files that pass the other rules. The CLI did this before the site, and the site keeps it.
This page and the CLI use the same module, src/catalog.ts. Thus the page gives the output of the CLI, except the time in the line "Generated on".
The CLI
Start it in the folder that you want in the catalog. It writes the output file into that folder.
node concat-src.ts [output.md] [--include=.ts,.tsx] [--exclude=.spec.ts,.test.ts]
| Argument | What it sets | Default |
|---|---|---|
output.md | The name of the output file. | src-catalog.md |
--include= | The extensions to keep, separated by commas. | .ts,.tsx |
--exclude= | The name endings to remove, separated by commas. | none |
node concat-src.ts output.md --include=.ts,.tsx,.js
node concat-src.ts output.md --exclude=.spec.ts,.test.ts
node concat-src.ts output.md --include=.ts --exclude=.test.ts
Install
The package is not on npm. Get the repository, and start the script with Node.js 22.18 or later. It needs no dependencies.
git clone https://github.com/mark1russell7/concat-src.git ~/concat-src
cd path/to/your-project
node ~/concat-src/concat-src.ts --exclude=.test.ts