Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
baransu committed Apr 4, 2019
1 parent 63d5da2 commit b59df64
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 72 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Javier Chávarri
Copyright (c) 2019-present Tomasz Cichocinski

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
73 changes: 2 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,3 @@
# hello-ppx-esy
# graphql_ppx_re

A project that includes the minimum configuration for a [ppx](https://blog.hackages.io/reasonml-ppx-8ecd663d5640) project using Reason and [Esy](https://github.com/esy-ocaml/esy).

It implements a very basic ppx that transforms the `[%test]` extension into the number literal `42`.

So, the code:

```reason
let fourtyTwo = string_of_int([%test]);
```

Is transformed into:

```reason
let fourtyTwo = string_of_int(42);
```

## Usage

You need Esy, you can install the beta using [npm](https://nodejs.org/en/download/):

% npm install -g esy@latest

Then you can install the project dependencies using:

% esy install

Then build the project dependencies along with the project itself:

% esy build

After building, you should see an executable in `_esy/default/build/default/.ppx/test_ppx/ppx.exe`.
This will be the binary used by BuckleScript in the example below.

## Example

You can see an example of usage in a BuckleScript project in the `/example` folder.
The most relevant point is the `ppx-flags` in `example/bsconfig.json`, that is pointing to the ppx executable:

```
"ppx-flags": [
"../_esy/default/build/default/.ppx/test_ppx/ppx.exe --as-ppx"
],
```

To compile the example:

% esy install

Then you can run

% yarn build

or

% npm run build

At that point, you should see the file `src/Index.bs.js` with the following output:

```javascript
// Generated by BUCKLESCRIPT VERSION 4.0.7, PLEASE EDIT WITH CARE
'use strict';


var fourtyTwo = String(42);

console.log(fourtyTwo);

exports.fourtyTwo = fourtyTwo;
/* fourtyTwo Not a pure module */
```
> Experiments with graphql_ppx and Reason

0 comments on commit b59df64

Please sign in to comment.