{"id":15755884,"url":"https://github.com/andarist/copy-mjs","last_synced_at":"2026-02-27T23:16:20.457Z","repository":{"id":57207244,"uuid":"136020280","full_name":"Andarist/copy-mjs","owner":"Andarist","description":"🛠 Build tool to copy .js files from input directory to corresponding .mjs files in output directory.","archived":false,"fork":false,"pushed_at":"2018-06-04T23:20:09.000Z","size":3,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T03:41:32.488Z","etag":null,"topics":["build","build-tool","tool"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Andarist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-04T12:15:36.000Z","updated_at":"2019-07-08T15:21:13.000Z","dependencies_parsed_at":"2022-09-08T14:22:35.733Z","dependency_job_id":null,"html_url":"https://github.com/Andarist/copy-mjs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Andarist/copy-mjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andarist%2Fcopy-mjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andarist%2Fcopy-mjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andarist%2Fcopy-mjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andarist%2Fcopy-mjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Andarist","download_url":"https://codeload.github.com/Andarist/copy-mjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andarist%2Fcopy-mjs/sbom","scorecard":{"id":13148,"data":{"date":"2025-08-11","repo":{"name":"github.com/Andarist/copy-mjs","commit":"1b8eb37a390f9fb8919cbaa4b17e708b348f9cac"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/2 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-14T15:04:05.359Z","repository_id":57207244,"created_at":"2025-08-14T15:04:05.359Z","updated_at":"2025-08-14T15:04:05.359Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271455615,"owners_count":24762759,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["build","build-tool","tool"],"created_at":"2024-10-04T08:40:52.981Z","updated_at":"2026-02-27T23:16:15.425Z","avatar_url":"https://github.com/Andarist.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# copy-mjs\n\nBuild tool to copy `.js` files from input directory to corresponding `.mjs`\nfiles in output directory.\n\n## Why?\n\nIf we have multiple files in a package and we want all of them to be importable\nwe often suggest to users doing it like this:\n\n```js\nimport module from \"package/lib/module\";\n```\n\nThis normally has a serious drawback because by doing so we often point people\nto using files authored in CommonJS format (being the lowest common\ndenominator). This prevents bundlers' optimizations such as tree-shaking \u0026 scope\nhoisting (a.k.a. module concatenation).\n\nIf we provide a second build in ESM format we might mention it in the docs and\npropose importing the same thing with i.e. `\"package/es/module\"` for people\nusing module-aware bundlers. This is a mental overhead that can be avoided.\n\n**I recommend** using \"proxy directories\" technique described by me in\n[this article](https://developers.livechatinc.com/blog/how-to-create-javascript-libraries-in-2018-part-2#proxy-directories)\nas it allows wider set of tools to choose appropriate files _automatically_.\nI've also created a package which creates such directories for you -\n[`cherry-pick`](https://github.com/Andarist/cherry-pick/edit/master/README.md).\n\nIf you do not like this technique and you'd still like to improve the situation\nfor your users **this package** might help you in that.\n\nwebpack@4 came with `.mjs` files support. What does it mean? It means that if\nyour user imports `\"package/module\"` webpack will try to load\n`package/module.mjs` first, before falling back to loading `package/module.js`\n(tools not recognizing `.mjs` will fall back gracefully to `.js`). This means\nthat we can just put `.js` files authored in CJS format side by side with `.mjs`\nfiles authored in ESM.\n\nTo provide the best developer experience you should either:\n\n- publish alternate directory\n- or move temporarily your files to root when publishing.\n\nDoing so can allow people to import i.e. `\"package/module\"` instead of\n`\"package/lib/module\"`.\n\n## CLI Options\n\n```\ncopy-mjs\n\nCopy `.js` files from input directory to `.mjs` files in output directory.\n\nOptions:\n  --help, -h        Show help                                          [boolean]\n  --version, -v     Show version number                                [boolean]\n  --input-dir, -i                                               [default: \"esm\"]\n  --output-dir, -o                                              [default: \"lib\"]\n  --cwd                                                           [default: \".\"]\n```\n\n### Example usage\n\n```sh\ncopy-mjs --input-dir esm --output-dir lib\n```\n\n## JS API\n\n`copy-mjs` exports a `default` method which copies `.js` files from input\ndirectory to corresponding `.mjs` files in output directory. It accepts the same\noptions as CLI command.\n\n```js\nconst copyMjs = require(\"copy-mjs\");\n\ncopyMjs({ inputDir: \"esm\", outputDir: \"lib\" }).then(() =\u003e\n  console.log(\"Successfully created .mjs files.\")\n);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandarist%2Fcopy-mjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandarist%2Fcopy-mjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandarist%2Fcopy-mjs/lists"}