{"id":16860454,"url":"https://github.com/pvdlg/ncat","last_synced_at":"2025-04-11T08:33:52.231Z","repository":{"id":57309179,"uuid":"93959248","full_name":"pvdlg/ncat","owner":"pvdlg","description":"Concatenate multiple files, with their sourcemaps and optionally stdin, a banner and a footer","archived":false,"fork":false,"pushed_at":"2020-03-27T05:17:37.000Z","size":208,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T17:01:39.436Z","etag":null,"topics":["banner","cat","cli","concat","concatenate","concatenation","file","files","footer","header","sourcemap"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pvdlg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2017-06-10T18:50:56.000Z","updated_at":"2023-02-03T11:12:06.000Z","dependencies_parsed_at":"2022-08-29T10:51:22.461Z","dependency_job_id":null,"html_url":"https://github.com/pvdlg/ncat","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvdlg%2Fncat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvdlg%2Fncat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvdlg%2Fncat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvdlg%2Fncat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pvdlg","download_url":"https://codeload.github.com/pvdlg/ncat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248074968,"owners_count":21043490,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["banner","cat","cli","concat","concatenate","concatenation","file","files","footer","header","sourcemap"],"created_at":"2024-10-13T14:24:18.101Z","updated_at":"2025-04-11T08:33:52.214Z","avatar_url":"https://github.com/pvdlg.png","language":"JavaScript","readme":"# **ncat**\n\nNode CLI to concatenate multiple files, with their sourcemaps and optionally stdin, a banner and a footer.\n\n[![Travis](https://img.shields.io/travis/pvdlg/ncat.svg)](https://travis-ci.org/pvdlg/ncat)\n[![AppVeyor](https://img.shields.io/appveyor/ci/pvdlg/ncat.svg)](https://ci.appveyor.com/project/pvdlg/ncat)\n[![Codecov](https://img.shields.io/codecov/c/github/pvdlg/ncat.svg)](https://codecov.io/gh/pvdlg/ncat)\n[![Greenkeeper badge](https://badges.greenkeeper.io/pvdlg/ncat.svg)](https://greenkeeper.io/)\n[![license](https://img.shields.io/github/license/pvdlg/ncat.svg)](https://github.com/pvdlg/ncat/blob/master/LICENSE)\n\n## Installation\n\n```bash\n$ npm i -g|-D ncat\n```\n\n## Usage\n\n```bash\n$ ncat [\u003cFILES ...\u003e] [OPTIONS] [-o|--output \u003cOUTPUT_FILE\u003e]\n```\nThe arguments may be a list of files:\n```bash\n$ ncat file_1.js file_2.js -o dist/bundle.js\n```\nor a list of globs:\n```bash\n$ ncat 'src/**/*.js !**/rainbow.js' src/**/{cake,unicorn}.css -o dist/bundle.js\n```\nIf file is a single dash (`-`) ncat reads from the standard input:\n```bash\n$ echo 'Insert between file_1.js and file_2.js' | ncat file_1.js - file_2.js -o dist/bundle.js\n```\nIf `-o|--output` is omitted ncat writes to the standard input:\n```bash\n$ ncat file_1.js file_2.js | uglifyjs \u003e dist/bundle.min.js\n```\n\n## Options\n\n| Name              |    Type           |   Default   | Description                                                                                                                                       |\n|:------------------|:-----------------:|:-----------:|:--------------------------------------------------------------------------------------------------------------------------------------------------|\n| `-o, --output`    | `{String}`        | `undefined` | Output File                                                                                                                                       |\n| `-m, --map`       | `{Boolean}`       |   `false`   | Create an external sourcemap (including the sourcemaps of existing files)                                                                         |\n| `-e, --map-embed` | `{Boolean}`       |   `false`   | Embed the code in the sourcemap (only apply to code without an existing sourcemap)                                                                |\n|`-b, --banner`     |`{Boolean\\|String}`|   `false`   | Add a banner built with the package.json file. Optionally pass the path to a .js file containing custom banner that can be called with `require()`|\n| `-f, --footer`    | `{String}`        | `undefined` | The path to .js file containing custom footer that can be called with `require()`                                                                 |\n| `-h, --help`      | `{Boolean}`       |   `false`   | CLI Help                                                                                                                                          |\n| `-v, --version`   | `{Boolean}`       |   `false`   | CLI Version                                                                                                                                       |\n\n## Examples\n\n### Concatenate files and standard input\n\n#### Files\n```javascript\n---------- file_1.min.js ----------\n\u003c First part of JS code (minified) ... \u003e\n\n---------- file_2.js ----------\n\u003cSecond part of JS code ... \u003e\n```\n\n#### Command\n```bash\n$ uglifyjs file_2.js | ncat file_1.min.js - --output dist/bundle.js\n```\n\n#### Result\n```javascript\n---------- dist/bundle.js ----------\n\u003c First part of JS code (minified) ... \u003e\n\n\u003c Second part of JS code (minified) ... \u003e\n```\n\n### Concatenate with sourcemaps\n\n#### Files\n```javascript\n---------- file_1.js ----------\n\u003c First part of JS code ... \u003e\n\n/*# sourceMappingURL=file_1.js.map */\n\n---------- file_1.js.map ----------\n{\"version\": 3,\"file\": \"file_1.js\", ... }\n\n---------- file_2.js ----------\n\u003c Second part of JS code ... \u003e\n\n/*# sourceMappingURL=file_2.js.map */\n\n---------- file_2.js.map ----------\n{\"version\": 3,\"file\": \"file_2.js\", ... }\n```\n\n#### Command\n```bash\n$ ncat file_1.js file_2.js --map --output dist/bundle.js\n```\n\n#### Result\n```javascript\n---------- dist/bundle.js ----------\n\u003c First part of JS code ... \u003e\n\n\u003c Second part of JS code ... \u003e\n\n/*# sourceMappingURL=bundle.map */\n\n---------- bundle.js.map ----------\n{\"version\": 3,\"file\": \"bundle.js\", ... }\n```\n\n### Add a banner to a file\n\n#### Files\n```javascript\n---------- bootstrap.js ----------\n\u003c JS code ... \u003e\n```\n\n#### Command\n```bash\n$ ncat bootstrap.js --banner --output dist/bundle.js\n```\n\n#### Result\n```javascript\n---------- dist/bundle.js ----------\n/*!\n * Bootstrap v4.0.0\n * https://getbootstrap.com\n *\n * Copyright 2017 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n * Licensed under MIT license\n */\n\n\u003c JS code ... \u003e\n```\n\n### Add a custom banner and footer to a file\n\n#### Files\n```javascript\n---------- bootstrap.js ----------\n\u003c JS code ... \u003e\n\n---------- build/banner.js ----------\nconst pkg = require('read-pkg-up').sync().pkg;\nmodule.exports =\n`/*!\n * ${pkg.name} v${pkg.version} (${pkg.homepage})\n *\n * Copyright (c) 2011-${new Date().getFullYear()} ${pkg.author.name}\n * Licensed under the ${pkg.license} license */\n\n(function () {`;\n\n---------- build/footer.js ----------\nmodule.exports = `\n})()`\n```\n\n#### Command\n```bash\n$ ncat bootstrap.js --banner build/banner.js --footer build/footer.js --output dist/bundle.js\n```\n\n#### Result\n```javascript\n---------- dist/bundle.js ----------\n/*!\n * Bootstrap v4.0.0 (https://getbootstrap.com)\n *\n * Copyright (c) 2011-2017 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)\n * Licensed under the MIT license */\n\n(function () {\n\u003c JS code ... \u003e\n})()\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvdlg%2Fncat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpvdlg%2Fncat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvdlg%2Fncat/lists"}