{"id":15059603,"url":"https://github.com/joakin/elm-node","last_synced_at":"2025-04-10T05:40:41.322Z","repository":{"id":36803576,"uuid":"174587438","full_name":"joakin/elm-node","owner":"joakin","description":"Run Elm + JS programs easily in node","archived":false,"fork":false,"pushed_at":"2023-07-12T03:56:47.000Z","size":26,"stargazers_count":19,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T06:54:39.377Z","etag":null,"topics":["elm","elm-lang","javascript","js","node-js","nodejs"],"latest_commit_sha":null,"homepage":null,"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/joakin.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-08T18:20:46.000Z","updated_at":"2025-03-20T21:19:48.000Z","dependencies_parsed_at":"2024-12-12T18:42:41.721Z","dependency_job_id":null,"html_url":"https://github.com/joakin/elm-node","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"97dfedff73d9082a0379cce5851f6b05caeeb0ad"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joakin%2Felm-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joakin%2Felm-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joakin%2Felm-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joakin%2Felm-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joakin","download_url":"https://codeload.github.com/joakin/elm-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166135,"owners_count":21058474,"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":["elm","elm-lang","javascript","js","node-js","nodejs"],"created_at":"2024-09-24T22:45:54.125Z","updated_at":"2025-04-10T05:40:41.298Z","avatar_url":"https://github.com/joakin.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# elm-node\n\nA Node.js CLI tool for easily running your elm code.\n\n```\nelm init\nelm-node --example-elm \u003e src/Main.elm\nelm-node src/Main.elm\n```\n\n**Warning**: This isn't neither a beginner tool, nor the intended default Elm\nexperience. If you want to experiment, use `elm repl` or `elm-reactor`. Using\nthe `elm` CLI with `--output=index.html` is also a very easy way to try things.\nReally evaluate if you want or need node.js. You will need to be familiar and\nfluent in both node.js and Elm to make good use of this tool.\n\n## Usage\n\n`npm install -g elm-node`, then make a directory to test it out.\n\n```\nmkdir my-node-project \u0026\u0026 cd my-node-project\nelm init\n```\n\nSee the following sections for usage instructions.\n\n### Simple setup, no JS\n\nYou can just create a Main.elm. On the JS side there will be a JS port called\n`log` that you can use to send `String` to output.\n\nYou can use `--example-elm` to get a very basic `Main.elm` to get started:\n\n```\nelm-node --example-elm \u003e src/Main.elm\nelm-node src/Main.elm\n```\n\n#### Running arbitrary JS\n\nWith the basic setup there is also a port `eval` subscribed to on the JS side\nthat will run the code it receives. On the JS side there is also a global `app`\nvariable that you can use in your JS code string to send events back to Elm. Not\nthe most fancy way to interact with JS, but it gets the job done.\n\nIf you want to do something more complex see the custom setup below.\n\n### Custom JS setup\n\nSimilar to the previous setup, but you can provide a custom JS file that will\nget passed the Elm object so that you can init whatever app you want, or set up\nany ports you need.\n\nThe JS file passed, needs to export a function that will get the Elm object from\nthe compiled output. You can do with it as you please.\n\nYou can use `--example-elm` and `--example-js` to get a very basic `Main.elm`\nand custom JS to get started:\n\n```\nelm-node --example-elm \u003e src/Main.elm\nelm-node --example-js \u003e src/index.js\nelm-node --js src/index.js src/Main.elm\n```\n\n### Flags\n\nYou can pass `--optimize` for the compiler to do the optimized build, but it\nprobably won't get you much in Node.js, except for getting rid of the\ndevelopment build warning output. The compile times are longer, so maybe just\nuse it when you are going to ship.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoakin%2Felm-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoakin%2Felm-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoakin%2Felm-node/lists"}