{"id":16840792,"url":"https://github.com/nfischer/shelljs-transpiler","last_synced_at":"2025-03-18T04:51:04.152Z","repository":{"id":4250979,"uuid":"51964039","full_name":"nfischer/shelljs-transpiler","owner":"nfischer","description":":shell: Easily transpile Bash to ShellJS","archived":false,"fork":false,"pushed_at":"2023-12-07T07:18:53.000Z","size":3918,"stargazers_count":73,"open_issues_count":16,"forks_count":8,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-04-14T22:30:46.260Z","etag":null,"topics":["shelljs","translation"],"latest_commit_sha":null,"homepage":"https://nfischer.github.io/shelljs-transpiler/","language":"HTML","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/nfischer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-17T23:41:15.000Z","updated_at":"2024-06-23T05:02:20.082Z","dependencies_parsed_at":"2024-06-23T05:02:16.154Z","dependency_job_id":"36045624-ebf1-4459-947b-055c97f1c49d","html_url":"https://github.com/nfischer/shelljs-transpiler","commit_stats":{"total_commits":157,"total_committers":4,"mean_commits":39.25,"dds":0.0573248407643312,"last_synced_commit":"8d8eb5dbc4f9eb83905833ee2b6a428bf942fbac"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfischer%2Fshelljs-transpiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfischer%2Fshelljs-transpiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfischer%2Fshelljs-transpiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfischer%2Fshelljs-transpiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nfischer","download_url":"https://codeload.github.com/nfischer/shelljs-transpiler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235434518,"owners_count":18989604,"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":["shelljs","translation"],"created_at":"2024-10-13T12:38:04.296Z","updated_at":"2025-01-24T11:41:13.126Z","avatar_url":"https://github.com/nfischer.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# shelljs-transpiler\n\n[![GitHub Actions](https://img.shields.io/github/actions/workflow/status/nfischer/shelljs-transpiler/main.yml?style=flat-square\u0026logo=github)](https://github.com/nfischer/shelljs-transpiler/actions/workflows/main.yml)\n[![Codecov](https://img.shields.io/codecov/c/github/nfischer/shelljs-transpiler.svg?style=flat-square)](https://codecov.io/gh/nfischer/shelljs-transpiler)\n[![npm version](https://img.shields.io/npm/v/shelljs-transpiler.svg?style=flat-square)](https://www.npmjs.com/package/shelljs-transpiler)\n[![npm downloads](https://img.shields.io/npm/dt/shelljs-transpiler.svg?style=flat-square)](https://www.npmjs.com/package/shelljs-transpiler)\n[![Try online](https://img.shields.io/badge/try_it-online!-yellow.svg?style=flat-square)](https://nfischer.github.io/shelljs-transpiler/)\n\n\u003e *\"Say goodbye to those gnarly Bash scripts!\"\n\u003e -- @arturadib, [ShellJS\n\u003e README](https://github.com/shelljs/shelljs#shelljs---unix-shell-commands-for-nodejs)*\n\nWant to try out [ShellJS](https://github.com/shelljs/shelljs) but don't want to\ngo through the effort of porting all your scripts? Look no further.\n\nEasily transpile your Bash scripts to ShellJS. Try it out [here on the\nweb](https://nfischer.github.io/shelljs-transpiler/). Just type, copy-paste, or\ndrag-and-drop your favorite shell script and see the results.\n\nHave a lot of scripts to transpile? Install this globally to use `sh2js` to\ntranspile scripts from the command line.\n\n## Think this is cool?\n\nLet me know by giving it a star on Github.\n\n### Think this is really cool? :sunglasses:\n\nContributions would be awesome! I'd really like to propel this\nproject forward, but don't have much time. You can help me out by:\n\n - sending me scripts you'd like to be able to translate, but haven't been able\n   to\n - finding bugs or thinking of features\n - taking up one of the [help-wanted\nissues](https://github.com/nfischer/shelljs-transpiler/labels/help%20wanted)\n - helping [refactor the\ngrammar](https://github.com/nfischer/shelljs-transpiler/issues/11) so that other\n   people can use it too.\n - spreading the word (more awareness = more contributors)\n\n## Installation\n\n**Note:** this may not handle all Bash syntax until v1.0. If your script doesn't\nget translated successfully, please file a Github issue.\n\n```\n$ npm install -g shelljs-transpiler # this lets you use `sh2js`\n```\n\n## ShellJS and NodeJS compatibility\n\n*What version of ShellJS is this compatible with? Can I run this code? Do I need\na special version of Node? Will this translate anything correctly?*\n\nYour best bet are the latest versions of NodeJS and ShellJS. Some translations\nare significantly easier to do using ES6 features, so I use them where\nconvenient. Also, ShellJS is still under development, so we're always adding new\nfeatures to help give it the best of both JavaScript and Bash.\n\nI'll sometimes write translations that take advantage of my not-yet-implemented\nShellJS feature ideas--some of which may never get implemented. If your\ntranslated script relies on a feature that doesn't exist yet in ShellJS, let me\nknow and I'll fix the transpiler to use a ShellJS feature that's available here\nand now.\n\n## `sh2js` CLI tool\n\nThe `sh2js` CLI transpiler is still somewhat experimental, but feel free to\ncheck it out! Usage:\n\n```\n$ sh2js [options] \u003cshell script input\u003e [JavaScript output]\n```\n\nIf you want to take advantage of shelljs plugins in the translated script,\nyou're free to do so! Simply use the `--plugins` flag to supply a\nspace-separated list of the plugins you want to use.\n\n### options\n\n| short option | long option | behavior |\n|:---:| --- | --- |\n| `-v` | `--version` | Output version information and quit |\n| `-h` | `--help` | Output help information and quit |\n| N/A  | `--plugins=\"\u003cnames\u003e\"` | Use each ShellJS plugin listed in the space-separated list `\u003cnames\u003e` |\n\nEx. usage:\n\n```bash\n$ sh2js testFile.sh outputFile.js # overwrites outputFile.js\n$ sh2js testFile.sh # writes to stdout\n$ sh2js --plugins=\"tr open clear\" testFile.sh # takes advantage of these plugins\n```\n\n## Contributing\n\nAs stated above, contributions are welcome! If you're interested in\nhelping out, let me know by posting an issue or shooting me an\nemail.\n\n## Running the project\n\nFirst, install it (**and the git submodule dependencies!**)\n\n```Bash\n$ git clone --recursive https://github.com/nfischer/shelljs-transpiler.git\n$ cd shelljs-transpiler/\n$ npm install\n```\n\nNext, run it in the browser using `npm start`, run unit tests using `npm test`,\nor try a script with `path/to/shelljs-transpiler/bin/sh2js someScript.sh`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfischer%2Fshelljs-transpiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnfischer%2Fshelljs-transpiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfischer%2Fshelljs-transpiler/lists"}