{"id":13621000,"url":"https://github.com/RyuuGan/sol-merger","last_synced_at":"2025-04-14T22:33:14.511Z","repository":{"id":24641865,"uuid":"102117695","full_name":"RyuuGan/sol-merger","owner":"RyuuGan","description":"Merges all imports into single file for solidity contracts","archived":false,"fork":false,"pushed_at":"2025-04-03T20:37:47.000Z","size":1497,"stargazers_count":160,"open_issues_count":4,"forks_count":22,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-04-03T20:45:13.509Z","etag":null,"topics":["flattener","merger","one-file","smart-contracts","solidity"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RyuuGan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"issuehunt":"ryuugan","custom":"https://paypal.me/stdammit"}},"created_at":"2017-09-01T13:50:43.000Z","updated_at":"2025-04-03T20:37:52.000Z","dependencies_parsed_at":"2024-03-04T20:43:25.887Z","dependency_job_id":"c5368b82-307b-4cd4-a6de-1367835af812","html_url":"https://github.com/RyuuGan/sol-merger","commit_stats":{"total_commits":156,"total_committers":6,"mean_commits":26.0,"dds":"0.10897435897435892","last_synced_commit":"5cca21c719f5067c93fe6e0eda809c094c87df50"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyuuGan%2Fsol-merger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyuuGan%2Fsol-merger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyuuGan%2Fsol-merger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyuuGan%2Fsol-merger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RyuuGan","download_url":"https://codeload.github.com/RyuuGan/sol-merger/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248972625,"owners_count":21191831,"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":["flattener","merger","one-file","smart-contracts","solidity"],"created_at":"2024-08-01T21:01:01.591Z","updated_at":"2025-04-14T22:33:09.494Z","avatar_url":"https://github.com/RyuuGan.png","language":"TypeScript","funding_links":["https://issuehunt.io/r/ryuugan","https://paypal.me/stdammit"],"categories":["Tools"],"sub_categories":[],"readme":"### Build status\n\n![Build status](https://github.com/RyuuGan/sol-merger/actions/workflows/node.js.yml/badge.svg)\n\n### Quick Usage\n\n```javascript\nconst { merge } = require('sol-merger');\n\n// Get the merged code as a string\nconst mergedCode = await merge('./contracts/MyContract.sol');\n// Print it out or write it to a file etc.\nconsole.log(mergedCode);\n```\n\n### CLI Usage\n\nRight now it only works with solidity files that are in `node_modules`\nor relative to your solidity file.\n\nSimple usage:\n\n```sh\nnpm i --save-dev sol-merger\n```\n\nThen add following line to your `package.json`.\n\n```json\n{\n  \"scripts\": {\n    \"build-contracts\": \"sol-merger \\\"./contracts/*.sol\\\" ./build\"\n  }\n}\n```\n\nThis will allow you to use `npm run build-contracts` in your project directory.\n\nNote that contracts glob should be surrounded with `\"`\n\nIf no output file specified then output file will be created at the same\ndirectory and appended with `_merged` (by default), i.e. `MyContract_merged.sol`. You can also\nchange this behaviour by specifying `--append` option:\n\n```sh\nsol-merger --append _me \"./contracts/*.sol\"\nsol-merger -a _me \"./contracts/*.sol\"\n```\n\nYou may need to use `npm run` to invoke the program standalone, as in `npm run sol-merger`.\n\nYou can also get help via `--help` command\n\n```sh\nsol-merger -h\nsol-merger --help\n```\n\nMore info about `glob` available at [node-glob repository](https://github.com/isaacs/node-glob)\n\nSee tests for more examples.\n\n# Post processing support\n\nIt is possible right now to write your own plugins to process exports.\nCurrently state is not used in plugins. To see available plugins\n[take a look plugins page](https://github.com/RyuuGan/sol-merger/tree/develop/lib/plugins).\n\nAll default plugins are available via shortcut syntax using filename:\n\n```\nsol-merger --export-plugin SPDXLicenseRemovePlugin \"test/contracts/*.sol\" compiled\n```\n\nIt is also possible to use external plugins via relative path to plugin\nor path relative to `node_modules`:\n\n```sh\nsol-merger --export-plugin ./dist/lib/plugins/SPDXLicenseRemovePlugin.js \"test/contracts/*.sol\" compiled\n\nsol-merger --export-plugin sol-merger/lib/plugins/SPDXLicenseRemovePlugin.js \"test/contracts/*.sol\" compiled\n```\n\nNote that file extension is required for plugin to be loaded.\n\n# Additional root folders for searching contracts\n\nBy default, `sol-merger` only searches for contracts in the `node_modules` folder.\nHowever, you can include additional root folders to search for contracts.\nThis can be done by passing a CLI argument or a parameter through the code.\n\nIf additional root folders are specified, `sol-merger` will first search for\nthe contract in the `node_modules` folder and then in the additional root folders.\nMultiple folders can be included by passing a CLI argument multiple times.\n\nExample of usage in CLI:\n\n```sh\nsol-merger --additional-root \"./test/contracts/imports\" \"test/contracts/ImportWithAdditionalRoot.sol\" compiled\n```\n\nExample of usage in code:\n\n```ts\nconst merger = new Merger({\n  delimeter: '\\n\\n',\n  additionalRoots: ['./test/contracts/imports'],\n});\n```\n\n# Debuging\n\nIt is possible to setup environment variable to see what is happening under the hood\nwhen contracts are being compiled:\n\n```sh\nexport DEBUG=\"sol-merger*\"\n```\n\n# Plugin for VSCode\n\nI created a plugin for `VSCode` so you can use it instead of `sol-merger`: [Solidity Contracts Merger](https://marketplace.visualstudio.com/items?itemName=RyuuGan.sol-merger-vscode).\n\nHope you will like it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRyuuGan%2Fsol-merger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRyuuGan%2Fsol-merger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRyuuGan%2Fsol-merger/lists"}