diff --git a/README.md b/README.md index ee096d7..01e4b52 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # bs-storybook + + BuckleScript bindings for **[Storybook](https://storybook.js.org/)**. The goal of this project is to provide bindings for the main Storybook API, as well as the official add-ons. Currently it supports: @@ -16,6 +18,11 @@ First install this package: npm install bs-storybook ``` +## bs-platform versions + +- bs-platform 8.4.2 or higher requires `1.1.0` +- anything lower uses `1.0.0` + Next, you'll need to add `bs-storybook` to your `bsconfig.json` as a dependency. Then, get Storybook up and running according to [their docs](https://storybook.js.org/basics/quick-start-guide/) diff --git a/example/package.json b/example/package.json index 16df224..3616d42 100644 --- a/example/package.json +++ b/example/package.json @@ -4,7 +4,7 @@ "main": "index.js", "license": "MIT", "dependencies": { - "reason-react": "^0.7.1" + "reason-react": "^0.9.1" }, "devDependencies": { "@babel/core": "^7.9.6", @@ -14,7 +14,7 @@ "@storybook/addons": "^5.3.18", "@storybook/react": "^5.3.18", "babel-loader": "^8.1.0", - "bs-platform": "7.1.1" + "bs-platform": "8.4.2" }, "scripts": { "storybook": "start-storybook -p 6006", diff --git a/example/yarn.lock b/example/yarn.lock index 6af0dd8..167aa07 100644 --- a/example/yarn.lock +++ b/example/yarn.lock @@ -2565,10 +2565,10 @@ browserslist@^4.11.1, browserslist@^4.8.5: node-releases "^1.1.53" pkg-up "^2.0.0" -bs-platform@7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-7.1.1.tgz#ed4032de7ab15158c61d8994680a05393e3ddd74" - integrity sha512-ckZHR3J+yxyEKXOBHX8+hfzWG2XX5BxhQ4Iw9lulHFGYdAm9Ep9LgKkIah7G6RYADLmVfTxFE48igvY3kkkl+g== +bs-platform@8.4.2: + version "8.4.2" + resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-8.4.2.tgz#778dabd1dfb3bc95e0086c58dabae74e4ebdee8a" + integrity sha512-9q7S4/LLV/a68CweN382NJdCCr/lOSsJR3oQYnmPK98ChfO/AdiA3lYQkQTp6T+U0I5Z5RypUAUprNstwDtMDQ== buffer-from@^1.0.0: version "1.1.1" @@ -6536,7 +6536,7 @@ react-docgen@^5.0.0: node-dir "^0.1.10" strip-indent "^3.0.0" -react-dom@>=16.8.1, react-dom@^16.8.3: +react-dom@^16.8.3: version "16.13.1" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.13.1.tgz#c1bd37331a0486c078ee54c4740720993b2e0e7f" integrity sha512-81PIMmVLnCNLO/fFOQxdQkvEq/+Hfpv24XNJfpyZhTRfO0QcmQIF/PgCa1zCOj2w1hrn12MFLyaJ/G0+Mxtfag== @@ -6694,7 +6694,7 @@ react-transition-group@^4.3.0: loose-envify "^1.4.0" prop-types "^15.6.2" -react@>=16.8.1, react@^16.8.3: +react@^16.8.3: version "16.13.1" resolved "https://registry.yarnpkg.com/react/-/react-16.13.1.tgz#2e818822f1a9743122c063d6410d85c1e3afe48e" integrity sha512-YMZQQq32xHLX0bz5Mnibv1/LHb3Sqzngu7xstSM+vrkE5Kzr9xE0yMByK5kMoTK30YVJE61WfbxIFFvfeDKT1w== @@ -6741,13 +6741,10 @@ readdirp@^2.2.1: micromatch "^3.1.10" readable-stream "^2.0.2" -reason-react@^0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/reason-react/-/reason-react-0.7.1.tgz#e6acea88542cd44398cd980093b8a2ab2722744e" - integrity sha512-Ssx4jZYohMHW9ZiW893IfbYdZw/muSmPFKigAgL+AORUgyiaphb0PP4yRGlx9A7JAxR3EeBn294XKUaClJQhbA== - dependencies: - react ">=16.8.1" - react-dom ">=16.8.1" +reason-react@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/reason-react/-/reason-react-0.9.1.tgz#30a887158200b659aa03e2d75ff4cc54dc462bb0" + integrity sha512-nlH0O2TDy9KzOLOW+vlEQk4ExHOeciyzFdoLcsmmiit6hx6H5+CVDrwJ+8aiaLT/kqK5xFOjy4PS7PftWz4plA== recast@^0.14.7: version "0.14.7" diff --git a/package.json b/package.json index e65b249..38b7b9e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bs-storybook", - "version": "1.0.0", + "version": "1.1.0", "description": "BuckleScript bindings for Storybook.js", "scripts": { "build": "bsb -make-world", @@ -20,16 +20,16 @@ "author": "", "license": "MIT", "devDependencies": { - "bs-platform": "^7.0.1", - "reason-react": "^0.7.1" + "bs-platform": "^8.4.2", + "reason-react": "^0.9.1" }, "peerDependencies": { - "reason-react": "^0.7.1", "@storybook/addon-actions": "^5.2.3", "@storybook/addon-knobs": "^5.3.14", "@storybook/addon-links": "^5.2.3", "@storybook/addon-options": "^5.3.14", "@storybook/addons": "^5.2.3", - "@storybook/react": "^5.2.3" + "@storybook/react": "^5.2.3", + "reason-react": "^0.9.1" } } diff --git a/src/action.re b/src/action.re index 93757ce..37d2140 100644 --- a/src/action.re +++ b/src/action.re @@ -1,4 +1,4 @@ type actionHandler('a) = 'a => unit; [@bs.val] [@bs.module "@storybook/addon-actions"] -external action: string => actionHandler('a); +external action: string => actionHandler('a) = "action"; diff --git a/src/knobs.re b/src/knobs.re index 2783195..d1331a8 100644 --- a/src/knobs.re +++ b/src/knobs.re @@ -1,5 +1,5 @@ [@bs.val] [@bs.module "@storybook/addon-knobs/react"] -external withKnobs: Main.decorator; +external withKnobs: Main.decorator = "withKnobs"; [@bs.val] [@bs.module "@storybook/addon-knobs/react"] external extText: (string, Js.null_undefined(string)) => string = "text"; diff --git a/src/main.re b/src/main.re index c140248..aa3ea9c 100644 --- a/src/main.re +++ b/src/main.re @@ -3,13 +3,14 @@ type chapter = unit => ReasonReact.reactElement; type section; [@bs.val] [@bs.module "@storybook/react"] -external storiesOf: (string, 'a) => section; +external storiesOf: (string, 'a) => section = "storiesOf"; [@bs.send] external extAdd: (section, string, chapter) => unit = "add"; type decorator = chapter => ReasonReact.reactElement; -[@bs.send] external addDecorator: (section, decorator) => unit; +[@bs.send] +external addDecorator: (section, decorator) => unit = "addDecorator"; type webpackModule; diff --git a/src/notes.re b/src/notes.re index 50db1c2..929691b 100644 --- a/src/notes.re +++ b/src/notes.re @@ -1,4 +1,4 @@ type decoratedChapter = Main.chapter => Main.chapter; [@bs.module "@storybook/addon-notes"] -external withNotes: string => decoratedChapter; +external withNotes: string => decoratedChapter = "withNotes"; diff --git a/src/story.re b/src/story.re index 0ce722b..c3380eb 100644 --- a/src/story.re +++ b/src/story.re @@ -7,8 +7,9 @@ type chapter = unit => ReasonReact.reactElement; type decorator = chapter => ReasonReact.reactElement; [@bs.val] [@bs.module "@storybook/react"] -external storiesOf: (string, webpackModule) => section; +external storiesOf: (string, webpackModule) => section = "storiesOf"; -[@bs.send] external add: (section, string, chapter) => section; +[@bs.send] external add: (section, string, chapter) => section = "add"; -[@bs.send] external addDecorator: (section, decorator) => section; +[@bs.send] +external addDecorator: (section, decorator) => section = "addDecorator"; diff --git a/yarn.lock b/yarn.lock index a327054..dbc5856 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,73 +2,12 @@ # yarn lockfile v1 -bs-platform@^7.0.1: - version "7.2.2" - resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-7.2.2.tgz#76fdc63e4889458ae3d257a0132107a792f2309c" - integrity sha512-PWcFfN+jCTtT/rMaHDhKh+W9RUTpaRunmSF9vbLYcrJbpgCNW6aFKAY33u0P3mLxwuhshN3b4FxqGUBPj6exZQ== - -"js-tokens@^3.0.0 || ^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== - -loose-envify@^1.1.0, loose-envify@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" - integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== - dependencies: - js-tokens "^3.0.0 || ^4.0.0" - -object-assign@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= - -prop-types@^15.6.2: - version "15.7.2" - resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" - integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== - dependencies: - loose-envify "^1.4.0" - object-assign "^4.1.1" - react-is "^16.8.1" - -react-dom@>=16.8.1: - version "16.13.1" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.13.1.tgz#c1bd37331a0486c078ee54c4740720993b2e0e7f" - integrity sha512-81PIMmVLnCNLO/fFOQxdQkvEq/+Hfpv24XNJfpyZhTRfO0QcmQIF/PgCa1zCOj2w1hrn12MFLyaJ/G0+Mxtfag== - dependencies: - loose-envify "^1.1.0" - object-assign "^4.1.1" - prop-types "^15.6.2" - scheduler "^0.19.1" - -react-is@^16.8.1: - version "16.13.1" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" - integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== - -react@>=16.8.1: - version "16.13.1" - resolved "https://registry.yarnpkg.com/react/-/react-16.13.1.tgz#2e818822f1a9743122c063d6410d85c1e3afe48e" - integrity sha512-YMZQQq32xHLX0bz5Mnibv1/LHb3Sqzngu7xstSM+vrkE5Kzr9xE0yMByK5kMoTK30YVJE61WfbxIFFvfeDKT1w== - dependencies: - loose-envify "^1.1.0" - object-assign "^4.1.1" - prop-types "^15.6.2" - -reason-react@^0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/reason-react/-/reason-react-0.7.1.tgz#e6acea88542cd44398cd980093b8a2ab2722744e" - integrity sha512-Ssx4jZYohMHW9ZiW893IfbYdZw/muSmPFKigAgL+AORUgyiaphb0PP4yRGlx9A7JAxR3EeBn294XKUaClJQhbA== - dependencies: - react ">=16.8.1" - react-dom ">=16.8.1" - -scheduler@^0.19.1: - version "0.19.1" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.19.1.tgz#4f3e2ed2c1a7d65681f4c854fa8c5a1ccb40f196" - integrity sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA== - dependencies: - loose-envify "^1.1.0" - object-assign "^4.1.1" +bs-platform@^8.4.2: + version "8.4.2" + resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-8.4.2.tgz#778dabd1dfb3bc95e0086c58dabae74e4ebdee8a" + integrity sha512-9q7S4/LLV/a68CweN382NJdCCr/lOSsJR3oQYnmPK98ChfO/AdiA3lYQkQTp6T+U0I5Z5RypUAUprNstwDtMDQ== + +reason-react@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/reason-react/-/reason-react-0.9.1.tgz#30a887158200b659aa03e2d75ff4cc54dc462bb0" + integrity sha512-nlH0O2TDy9KzOLOW+vlEQk4ExHOeciyzFdoLcsmmiit6hx6H5+CVDrwJ+8aiaLT/kqK5xFOjy4PS7PftWz4plA==