{"id":13432029,"url":"https://github.com/rrdelaney/reason-scripts","last_synced_at":"2025-03-16T23:30:27.666Z","repository":{"id":57349008,"uuid":"93489799","full_name":"rrdelaney/reason-scripts","owner":"rrdelaney","description":":beginner: Create a ReasonML and React development environment","archived":true,"fork":false,"pushed_at":"2018-10-09T16:34:12.000Z","size":2189,"stargazers_count":628,"open_issues_count":0,"forks_count":58,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-10-16T03:31:44.057Z","etag":null,"topics":["bucklescript","create-react-app","react","reasonml"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/rrdelaney.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-06T07:35:19.000Z","updated_at":"2024-07-02T09:46:04.000Z","dependencies_parsed_at":"2022-09-13T02:22:38.033Z","dependency_job_id":null,"html_url":"https://github.com/rrdelaney/reason-scripts","commit_stats":null,"previous_names":["reasonml-community/reason-scripts"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrdelaney%2Freason-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrdelaney%2Freason-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrdelaney%2Freason-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrdelaney%2Freason-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rrdelaney","download_url":"https://codeload.github.com/rrdelaney/reason-scripts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243532407,"owners_count":20306150,"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":["bucklescript","create-react-app","react","reasonml"],"created_at":"2024-07-31T02:01:07.992Z","updated_at":"2025-03-16T23:30:27.659Z","avatar_url":"https://github.com/rrdelaney.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg height=\"300\" src=\"https://github.com/rrdelaney/reason-scripts/blob/master/docs/cra.png\"\u003e\n  \u003cbr\u003e\n  Reason Scripts\n \u003c/h1\u003e\n\n\u003cpre align=\"center\"\u003e\n  $ yarn create react-app my-app --scripts-version reason-scripts\n\u003c/pre\u003e\n\nReason Scripts provides a JS-like development environment for developing web apps with the\n[Reason](https://reasonml.github.io/) programming language and\n[React](https://facebook.github.io/react). It bootstraps an environment to automatically\ncompile all Reason code to JS, provide features like reloading and bundling, and seamlessly\nuse JS code from Reason.\n\n[![Build Status](https://travis-ci.org/reasonml-community/reason-scripts.svg?branch=master)](https://travis-ci.org/reasonml-community/reason-scripts)\n[![Build status](https://ci.appveyor.com/api/projects/status/ccnybhby3xbr9022?svg=true)](https://ci.appveyor.com/project/rrdelaney/reason-scripts)\n\n## Getting Started\n\n### Using [Yarn](https://yarnpkg.com/)\n\n\u003e Note that using `yarn create` requires Yarn 0.25 or later\n\nTo create a new app using Reason and React, run:\n\n```\n$ npm install -g bs-platform\n$ yarn create react-app \u003capp-name\u003e --scripts-version reason-scripts\n$ cd \u003capp-name\u003e\n$ yarn start\n```\n\nMake sure to install `bs-platform` globally using `npm` instead of `yarn`.\n\n### Using npm\n\n```\n$ npm install -g bs-platform\n$ npx create-react-app \u003capp-name\u003e --scripts-version reason-scripts\n$ cd \u003capp-name\u003e\n$ npm start\n```\n\n*([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) comes with npm 5.2+ and higher, see [instructions for older npm versions](https://gist.github.com/gaearon/4064d3c23a77c74a3614c498a8bb1c5f))*\n\nThe policy of reason tooling is to support the current LTS release, so please make sure you have Node 8 or later.\n\n### Directory Layout\n\nCreating a new app makes an `\u003capp-name\u003e` directory with the following layout:\n\n```\n\u003capp-name\u003e/\n  README.md\n  node_modules/\n  package.json\n  bsconfig.json\n  .gitignore\n  public/\n    favicon.ico\n    index.html\n  src/\n    index.re\n    index.css\n    app.re\n    app.css\n    logo.svg\n```\n\n## Features\n\n### [Everything from Create React App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md)\n\n* Highly-optimized build configuration\n* Pre-configured test runner\n* Friendly developer environment\n* \"eject\" Webpack config\n* Environment variable configuration\n* Automatic PWA configuration\n* Low configuration builds\n\n### Reason Entrypoint\n\nThe entry point to the app is `src/index.re`. From the start your new\napp will be based on Reason, but can seamlessly interop with existing JS\nfiles and projects!\n\n### Automatic Compilation of Reason/OCaml files\n\nAny Reason/OCaml file will be automatically compiled to a JS file. For example,\na file called `math_fns.re` can be required by a JS file:\n\n```js\nimport { add } from './math_fns.re'\n\nconst sum = add(1, 4)\n```\n\n### Jest Integration\n\nReason Scripts will automatically configure a [Jest](https://facebook.github.io/jest) environment\nto test Reason code. Any code found in a file ending with `_test.re`, `_test.ml`\nor `test.js` will be considered a test and run with Jest. From these files, the normal\nJest API can be used interacting with any other modules defined in your app. For example:\n\n```reason\n/* math_fns.re */\n\nlet add = (x, y) =\u003e x + y;\n```\n\n```reason\n/* math_fns_test.re */\n\nopen Jest;\n\ntest(\"addition\", () =\u003e {\n  let num_1 = 10;\n  let num_2 = 12;\n\n  expect(Math_fns.add num_1 num_2) |\u003e toBe(22);\n});\n```\n\nOr if you prefer writing your tests in JavaScript, just don't forget to import the tested module:\n\n```js\n/* maths_fns.test.js */\n\nimport Math_fns from './math_fns.re'\n\ntest('addition', () =\u003e {\n  const num1 = 10\n  const num2 = 12\n\n  expect(Math_fns.add(num1, num2)).toBe(22)\n})\n\n```\n\nFor more documentation on the Jest API, see [bs-jest](https://github.com/reasonml-community/bs-jest)\n\n### Importing non-Reason files\n\nYou can require CSS files with:\n\n```reason\n[%bs.raw {|require('./App.css')|}];\n```\n\nor any other kind of file (like SVG's) with:\n\n```reason\nlet logo : string = [%bs.raw {|require('./logo.svg')|}];\n```\n\n## Help, Tips, and Tricks\n\n\u003cp\u003e\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eMy app won't compile on a fresh install\u003c/b\u003e\u003c/summary\u003e\n\nTry running `npm install` in your project directory. This helps refresh missing dependencies sometimes.\n\nIf this still does not work, make sure your file path does not include any spaces.\n\u003c/details\u003e\u003c/p\u003e\n\n\n\u003cp\u003e\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eI got a SyntaxError after `yarn start` or `npm start`\u003c/b\u003e\u003c/summary\u003e\nTry upgrading your Node to version 8 or later.\n\n\u003c/details\u003e\u003c/p\u003e\n\n\n\u003cp\u003e\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eMy editor isn't autocompleting\u003c/b\u003e\u003c/summary\u003e\n\nEditor support is provided by Merlin. To generate a `.merlin` file, run the app\nwith `npm start` or `yarn start`.\n\nSee our full editor integration guide here: https://reasonml.github.io/docs/en/editor-plugins.html\n\u003c/details\u003e\u003c/p\u003e\n\n\n\u003cp\u003e\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eI don't want reason-scripts to clear my terminal\u003c/b\u003e\u003c/summary\u003e\n\nUse `FORCE_COLOR=true react-scripts start | cat -` as your start command instead\n\u003c/details\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eReason is awesome! Where can I learn more?\u003c/b\u003e\u003c/summary\u003e\n\nCheckout our fancy website: https://reasonml.github.io/!\n\nWe also have a very active Discord to come talk about Reason, and ask for help: https://discordapp.com/invite/reasonml\n\u003c/details\u003e\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrdelaney%2Freason-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frrdelaney%2Freason-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrdelaney%2Freason-scripts/lists"}