Skip to content

Commit

Permalink
Add a binding for ink-link (#8)
Browse files Browse the repository at this point in the history
* Add binding for ink-ink

* Add Link to example

* whitelist files

* Update README

* ignore artifacts

* Allow access to package
  • Loading branch information
cometkim committed May 23, 2020
1 parent cc496b6 commit 174870f
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -46,6 +46,7 @@ Do you find any missing APIs? [Let me know](https://github.com/cometkim/bs-ink/i
- [@reason-ink/ink-big-text](./packages/ink-big-text) ([ink-big-text](https://github.com/sindresorhus/ink-big-text))
- [@reason-ink/ink-spinner](./packages/ink-spinner) ([ink-spinner](https://github.com/vadimdemedes/ink-spinner))
- [@reason-ink/ink-text-input](./packages/ink-text-input) ([ink-text-iput](https://github.com/vadimdemedes/ink-text-input))
- [@reason-ink/ink-link](./packages/ink-link) ([ink-link](https://github.com/sindresorhus/ink-link))

## Requirements

Expand Down
3 changes: 2 additions & 1 deletion bsconfig.json
Expand Up @@ -42,7 +42,8 @@
"reason-nodejs",
"@reason-ink/ink-big-text",
"@reason-ink/ink-spinner",
"@reason-ink/ink-text-input"
"@reason-ink/ink-text-input",
"@reason-ink/ink-link"
],
"bs-dev-dependencies": [
],
Expand Down
4 changes: 4 additions & 0 deletions examples/Cli.re
@@ -1,6 +1,7 @@
open ReasonInk;

module BigText = ReasonInkCommunity_BigText;
module Link = ReasonInkCommunity_Link;

module Root = {
[@react.component]
Expand All @@ -17,6 +18,9 @@ module Root = {

<Box display=`flex flexDirection=`column justifyContent=`spaceBetween>
<BigText text="Hello, Reason-Ink!" font={Block(`yellowBright, `gray)} />
<Link url="https://github.com/cometkim/reason-ink">
{React.string("Checkout from GitHub!")}
</Link>
<Box marginTop=5>
<Color fg={`keyword("orange")} bg=`black>
{React.string("Press q or Ctrl+C to exit")}
Expand Down
2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -9,11 +9,13 @@
},
"devDependencies": {
"@reason-ink/ink-big-text": "workspace:^1.0.0",
"@reason-ink/ink-link": "workspace:^1.0.0",
"@reason-ink/ink-spinner": "workspace:^1.0.0",
"@reason-ink/ink-text-input": "workspace:^1.0.0",
"bs-platform": "^7.3.2",
"ink": "^2.7.1",
"ink-big-text": "^1.0.1",
"ink-link": "^1.1.0",
"ink-spinner": "^3.0.1",
"ink-text-input": "^3.2.2",
"react": "^16.13.1",
Expand Down
1 change: 1 addition & 0 deletions packages/ink-link/.npmignore
@@ -0,0 +1 @@
*.bs.js
30 changes: 30 additions & 0 deletions packages/ink-link/bsconfig.json
@@ -0,0 +1,30 @@
{
"name": "@reason-ink/ink-link",
"namespace": false,
"reason": {
"react-jsx": 3
},
"bs-flags": [
"-bs-no-version-header",
"-bs-super-errors"
],
"sources": [
{
"dir": "src",
"subdirs": true
}
],
"package-specs": [
{
"module": "commonjs",
"in-source": true
}
],
"suffix": ".bs.js",
"bs-dependencies": [
"reason-react"
],
"bs-dev-dependencies": [
],
"refmt": 3
}
46 changes: 46 additions & 0 deletions packages/ink-link/package.json
@@ -0,0 +1,46 @@
{
"name": "@reason-ink/ink-link",
"version": "1.0.0",
"description": "ReasonML (BuckleScript) binding for ink-link",
"license": "MIT",
"keywords": [
"ReasonML",
"React",
"CLI"
],
"author": {
"name": "Hyeseong Kim",
"email": "cometkim.kr@gmail.com"
},
"repository": {
"type": "git",
"url": "git+https://github.com/cometkim/reason-ink.git",
"directory": "packages/ink-link"
},
"publishConfig": {
"access": "public"
},
"files": [
"src",
"bsconfig.json"
],
"scripts": {
"clean": "bsb -clean-world",
"start": "bsb -make-world -w",
"build": "bsb -make-world",
"format": "bsrefmt --in-place **/*.re",
"prepublishOnly": "bsb -clean-world -make-world"
},
"peerDependencies": {
"reason-ink": "workspace:^2.0.1"
},
"dependencies": {
"ink-link": "^1.1.0"
},
"devDependencies": {
"bs-platform": "^7.3.2",
"react": "^16.13.1",
"reason-ink": "workspace:^2.0.1",
"reason-react": "^0.8.0"
}
}
14 changes: 14 additions & 0 deletions packages/ink-link/src/ReasonInkCommunity_Link.re
@@ -0,0 +1,14 @@
let makeProps = (
~children: option(React.element)=?,
~url: option(string)=?,
~fallback: option(string)=?,
(),
) => {
"children": children,
"url": url,
"fallback": fallback,
};

[@bs.module]
external make: React.component('a) = "ink-link";

61 changes: 61 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 174870f

Please sign in to comment.