{"id":19910974,"url":"https://github.com/streetsidesoftware/ts2mjs","last_synced_at":"2025-05-03T03:30:51.544Z","repository":{"id":65955196,"uuid":"603351330","full_name":"streetsidesoftware/ts2mjs","owner":"streetsidesoftware","description":"Rename TypeScript Created ESM .js files to .mjs","archived":false,"fork":false,"pushed_at":"2025-04-20T12:07:59.000Z","size":965,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-20T13:26:28.644Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/streetsidesoftware.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,"zenodo":null},"funding":{"github":["streetsidesoftware"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2023-02-18T08:41:45.000Z","updated_at":"2025-03-23T13:37:56.000Z","dependencies_parsed_at":"2024-01-21T13:25:19.688Z","dependency_job_id":"5362ed7f-952c-4b76-bb21-38a1acd3a221","html_url":"https://github.com/streetsidesoftware/ts2mjs","commit_stats":{"total_commits":41,"total_committers":5,"mean_commits":8.2,"dds":0.6585365853658536,"last_synced_commit":"d447ed18937e3c1b67873d22fb16b419bec3a965"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streetsidesoftware%2Fts2mjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streetsidesoftware%2Fts2mjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streetsidesoftware%2Fts2mjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streetsidesoftware%2Fts2mjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streetsidesoftware","download_url":"https://codeload.github.com/streetsidesoftware/ts2mjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252137512,"owners_count":21700227,"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":[],"created_at":"2024-11-12T21:22:40.831Z","updated_at":"2025-05-03T03:30:51.242Z","avatar_url":"https://github.com/streetsidesoftware.png","language":"TypeScript","funding_links":["https://github.com/sponsors/streetsidesoftware"],"categories":[],"sub_categories":[],"readme":"# ts2mjs\n\nRename TypeScript created ESM .js files to .mjs\n\nThis tool takes output from `tsc` and copies/renames the files.\n\n- `file.js` =\u003e `file.mjs`\n- `file.js.map` =\u003e `file.mjs.map`\n- `file.d.ts` =\u003e `file.d.mts`\n- `file.d.ts.map` =\u003e `file.d.mts.map`\n\n**`dist/code.js` -\u003e `dist/code.mjs`**\n\n```diff\nimport * as path from 'path';\nimport { lib } from 'package/lib/index.js'\n-import { findFiles } from './findFiles.js';\n+import { findFiles } from './findFiles.mjs';\n```\n\n**`dist/index.d.ts` -\u003e `dist/index.d.mts`**\n\n```diff\n-export { PrimeNumber, Tuple, GUID, Address, Person, Annotation, } from './types.js';\n+export { PrimeNumber, Tuple, GUID, Address, Person, Annotation, } from './types.mjs';\n-export { lookUpPerson } from './lookup.js';\n+export { lookUpPerson } from './lookup.mjs';\n```\n\n## Usage\n\nThis is an example on how to create a package that exports both CommonJS and ESM from TypeScript source.\n\n**`tsconfig.esm.json`**\n\n```jsonc\n{\n  \"$schema\": \"https://json.schemastore.org/tsconfig\",\n  \"extends\": \"@tsconfig/node18/tsconfig.json\",\n  \"compilerOptions\": {\n    \"declaration\": true,\n    \"module\": \"ES2022\",\n    \"moduleResolution\": \"node\",\n    \"outDir\": \"dist/esm\",\n    \"sourceMap\": true\n  },\n  \"include\": [\"src\"]\n}\n```\n\n**`tsconfig.cjs.json`**\n\n```jsonc\n{\n  \"$schema\": \"https://json.schemastore.org/tsconfig\",\n  \"extends\": \"@tsconfig/node18/tsconfig.json\",\n  \"compilerOptions\": {\n    \"declaration\": true,\n    \"module\": \"NodeNext\",\n    \"moduleResolution\": \"NodeNext\",\n    \"outDir\": \"dist/cjs\",\n    \"sourceMap\": true\n  },\n  \"include\": [\"src\"]\n}\n```\n\n**`package.json`**\n\n```json\n{\n  \"type\": \"commonjs\",\n  \"main\": \"dist/csj/index.js\",\n  \"module\": \"dist/esm/index.mjs\",\n  \"types\": \"dist/cjs/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"import\": \"./dist/esm/index.mjs\",\n      \"require\": \"./dist/cjs/index.js\"\n    }\n  }\n}\n```\n\n```sh\ntsc -p tsconfig.cjs.json\ntsc -p tsconfig.esm.json\nts2mjs dist/esm\n```\n\n## Help\n\n\u003c!--- @@inject: static/help.txt ---\u003e\n\n```\nUsage: ts2mjs [options] \u003cfiles...\u003e\n\nRename ESM .js files to .mjs\n\nArguments:\n  files                 The files to rename.\n\nOptions:\n  -o, --output \u003cdir\u003e    The output directory.\n  --cwd \u003cdir\u003e           The current working directory.\n  --root \u003cdir\u003e          The root directory.\n  --dry-run             Dry Run do not update files.\n  --no-must-find-files  No error if files are not found.\n  --no-enforce-root     Do not fail if relative `.js` files outside of the root\n                        are imported.\n  --color               Force color.\n  --no-color            Do not use color.\n  -v, --verbose         Verbose mode\n  -V, --version         output the version number\n  -h, --help            display help for command\n```\n\n\u003c!--- @@inject-end: static/help.txt ---\u003e\n\n\u003c!--- @@inject: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/static/footer.md ---\u003e\n\n\u003cbr/\u003e\n\n---\n\n\u003cp align=\"center\"\u003e\nBrought to you by \u003ca href=\"https://streetsidesoftware.com\" title=\"Street Side Software\"\u003e\n\u003cimg width=\"16\" alt=\"Street Side Software Logo\" src=\"https://i.imgur.com/CyduuVY.png\" /\u003e Street Side Software\n\u003c/a\u003e\n\u003c/p\u003e\n\n\u003c!--- @@inject-end: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/static/footer.md ---\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreetsidesoftware%2Fts2mjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreetsidesoftware%2Fts2mjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreetsidesoftware%2Fts2mjs/lists"}