@greenlabs/ppx-spice 0.1.6 → 0.1.7-rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,48 +4,30 @@ on: [workflow_dispatch]
4
4
 
5
5
  jobs:
6
6
  build_linux:
7
- name: ${{ matrix.os }}/node-${{ matrix.node-version }}
7
+ name: ${{ matrix.os }}
8
8
  runs-on: ${{ matrix.os }}
9
9
  defaults:
10
10
  run:
11
11
  working-directory: src
12
12
  strategy:
13
13
  matrix:
14
- node-version: [12.x]
15
14
  os: [ubuntu-latest]
16
- container:
17
- image: alexfedoseev/alpine-node-yarn-esy:0.0.4
18
- steps:
19
- - name: Use Node.js ${{ matrix.node-version }}
20
- uses: actions/setup-node@v1
21
- with:
22
- node-version: ${{ matrix.node-version }}
15
+ ocaml-compiler:
16
+ - 4.12.1
23
17
 
18
+ steps:
24
19
  - uses: actions/checkout@v2
25
20
 
26
- - name: Add tar
27
- run: apk add --no-cache tar
28
-
29
- - name: Install
30
- run: esy install
31
-
32
- - name: Print esy cache
33
- id: print_esy_cache
34
- run: node ../.github/workflows/print_esy_cache.js
35
-
36
- - name: Try to restore dependencies cache
37
- uses: actions/cache@v2
38
- id: deps-cache
21
+ - name: Use OCaml ${{ matrix.ocaml-compiler}}
22
+ uses: ocaml/setup-ocaml@v2
39
23
  with:
40
- path: ${{ steps.print_esy_cache.outputs.esy_cache }}
41
- key: build-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
42
- restore-keys: build-${{ matrix.os }}-
24
+ ocaml-compiler: ${{ matrix.ocaml-compiler }}
43
25
 
44
- - name: Build
45
- run: esy b
26
+ - name: Install deps
27
+ run: opam install . --deps-only --with-test
46
28
 
47
- - name: Build release-static
48
- run: esy release-static
29
+ - name: Build
30
+ run: opam exec -- dune build
49
31
 
50
32
  - name: Copy built PPX file
51
33
  run: |
@@ -4,50 +4,30 @@ on: [workflow_dispatch]
4
4
 
5
5
  jobs:
6
6
  build_macos:
7
- name: ${{ matrix.os }}/node-${{ matrix.node-version }}
7
+ name: ${{ matrix.os }}
8
8
  runs-on: ${{ matrix.os }}
9
9
  defaults:
10
10
  run:
11
11
  working-directory: src
12
12
  strategy:
13
13
  matrix:
14
- node-version: [12.x]
15
14
  os: [macOS-latest]
16
- steps:
17
- - name: Use Node.js ${{ matrix.node-version }}
18
- uses: actions/setup-node@v1
19
- with:
20
- node-version: ${{ matrix.node-version }}
15
+ ocaml-compiler:
16
+ - 4.12.1
21
17
 
18
+ steps:
22
19
  - uses: actions/checkout@v2
23
20
 
24
- - name: Install esy
25
- run: |
26
- npm install -g esy
27
-
28
- - name: Try to restore install cache
29
- uses: actions/cache@v1
21
+ - name: Use OCaml ${{ matrix.ocaml-compiler}}
22
+ uses: ocaml/setup-ocaml@v2
30
23
  with:
31
- path: ~/.esy/source
32
- key: source-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
33
-
34
- - name: Install
35
- run: esy install
24
+ ocaml-compiler: ${{ matrix.ocaml-compiler }}
36
25
 
37
- - name: Print esy cache
38
- id: print_esy_cache
39
- run: node ../.github/workflows/print_esy_cache.js
40
-
41
- - name: Try to restore dependencies cache
42
- id: deps-cache
43
- uses: actions/cache@v1
44
- with:
45
- path: ${{ steps.print_esy_cache.outputs.esy_cache }}
46
- key: build-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
47
- restore-keys: build-${{ matrix.os }}-
26
+ - name: Install deps
27
+ run: opam install . --deps-only --with-test
48
28
 
49
29
  - name: Build
50
- run: esy b
30
+ run: opam exec -- dune build
51
31
 
52
32
  - name: Copy built PPX file
53
33
  run: |
@@ -11,37 +11,23 @@ jobs:
11
11
  working-directory: src
12
12
  strategy:
13
13
  matrix:
14
- node-version: [12.x]
15
14
  os: [windows-latest]
16
- steps:
17
- - name: Use Node.js ${{ matrix.node-version }}
18
- uses: actions/setup-node@v1
19
- with:
20
- node-version: ${{ matrix.node-version }}
15
+ ocaml-compiler:
16
+ - 4.12.1
21
17
 
18
+ steps:
22
19
  - uses: actions/checkout@v2
23
20
 
24
- - name: Install esy
25
- run: |
26
- npm install -g esy
27
-
28
- - name: Install
29
- run: esy install
30
-
31
- - name: Print esy cache
32
- id: print_esy_cache
33
- run: node ../.github/workflows/print_esy_cache.js
34
-
35
- - name: Try to restore dependencies cache
36
- id: deps-cache
37
- uses: actions/cache@v2
21
+ - name: Use OCaml ${{ matrix.ocaml-compiler}}
22
+ uses: ocaml/setup-ocaml@v2
38
23
  with:
39
- path: ${{ steps.print_esy_cache.outputs.esy_cache }}
40
- key: build-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
41
- restore-keys: build-${{ matrix.os }}-
24
+ ocaml-compiler: ${{ matrix.ocaml-compiler }}
25
+
26
+ - name: Install deps
27
+ run: opam install . --deps-only --with-test
42
28
 
43
29
  - name: Build
44
- run: esy b
30
+ run: opam exec -- dune build
45
31
 
46
32
  - name: Copy built PPX file
47
33
  run: |
@@ -4,48 +4,30 @@ on: [workflow_dispatch]
4
4
 
5
5
  jobs:
6
6
  build_linux:
7
- name: ${{ matrix.os }}/node-${{ matrix.node-version }}
7
+ name: ${{ matrix.os }}
8
8
  runs-on: ${{ matrix.os }}
9
9
  defaults:
10
10
  run:
11
11
  working-directory: src
12
12
  strategy:
13
13
  matrix:
14
- node-version: [12.x]
15
14
  os: [ubuntu-latest]
16
- container:
17
- image: alexfedoseev/alpine-node-yarn-esy:0.0.4
18
- steps:
19
- - name: Use Node.js ${{ matrix.node-version }}
20
- uses: actions/setup-node@v1
21
- with:
22
- node-version: ${{ matrix.node-version }}
15
+ ocaml-compiler:
16
+ - 4.12.1
23
17
 
18
+ steps:
24
19
  - uses: actions/checkout@v2
25
20
 
26
- - name: Add tar
27
- run: apk add --no-cache tar
28
-
29
- - name: Install
30
- run: esy install
31
-
32
- - name: Print esy cache
33
- id: print_esy_cache
34
- run: node ../.github/workflows/print_esy_cache.js
35
-
36
- - name: Try to restore dependencies cache
37
- uses: actions/cache@v2
38
- id: deps-cache
21
+ - name: Use OCaml ${{ matrix.ocaml-compiler}}
22
+ uses: ocaml/setup-ocaml@v2
39
23
  with:
40
- path: ${{ steps.print_esy_cache.outputs.esy_cache }}
41
- key: build-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
42
- restore-keys: build-${{ matrix.os }}-
24
+ ocaml-compiler: ${{ matrix.ocaml-compiler }}
43
25
 
44
- - name: Build
45
- run: esy b
26
+ - name: Install deps
27
+ run: opam install . --deps-only --with-test
46
28
 
47
- - name: Build release-static
48
- run: esy release-static
29
+ - name: Build
30
+ run: opam exec -- dune build
49
31
 
50
32
  - name: Copy built PPX file
51
33
  run: |
@@ -59,50 +41,30 @@ jobs:
59
41
  if-no-files-found: error
60
42
 
61
43
  build_macos:
62
- name: ${{ matrix.os }}/node-${{ matrix.node-version }}
44
+ name: ${{ matrix.os }}
63
45
  runs-on: ${{ matrix.os }}
64
46
  defaults:
65
47
  run:
66
48
  working-directory: src
67
49
  strategy:
68
50
  matrix:
69
- node-version: [12.x]
70
51
  os: [macOS-latest]
71
- steps:
72
- - name: Use Node.js ${{ matrix.node-version }}
73
- uses: actions/setup-node@v1
74
- with:
75
- node-version: ${{ matrix.node-version }}
52
+ ocaml-compiler:
53
+ - 4.12.1
76
54
 
55
+ steps:
77
56
  - uses: actions/checkout@v2
78
57
 
79
- - name: Install esy
80
- run: |
81
- npm install -g esy
82
-
83
- - name: Try to restore install cache
84
- uses: actions/cache@v1
58
+ - name: Use OCaml ${{ matrix.ocaml-compiler}}
59
+ uses: ocaml/setup-ocaml@v2
85
60
  with:
86
- path: ~/.esy/source
87
- key: source-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
88
-
89
- - name: Install
90
- run: esy install
61
+ ocaml-compiler: ${{ matrix.ocaml-compiler }}
91
62
 
92
- - name: Print esy cache
93
- id: print_esy_cache
94
- run: node ../.github/workflows/print_esy_cache.js
95
-
96
- - name: Try to restore dependencies cache
97
- id: deps-cache
98
- uses: actions/cache@v1
99
- with:
100
- path: ${{ steps.print_esy_cache.outputs.esy_cache }}
101
- key: build-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
102
- restore-keys: build-${{ matrix.os }}-
63
+ - name: Install deps
64
+ run: opam install . --deps-only --with-test
103
65
 
104
66
  - name: Build
105
- run: esy b
67
+ run: opam exec -- dune build
106
68
 
107
69
  - name: Copy built PPX file
108
70
  run: |
@@ -4,54 +4,36 @@ on:
4
4
  workflow_dispatch:
5
5
  inputs:
6
6
  release_version:
7
- description: 'change npm release version'
8
- required: true
9
- default: ''
7
+ description: "change npm release version"
8
+ required: true
9
+ default: ""
10
10
 
11
11
  jobs:
12
12
  build_linux:
13
- name: ${{ matrix.os }}/node-${{ matrix.node-version }}
13
+ name: ${{ matrix.os }}
14
14
  runs-on: ${{ matrix.os }}
15
15
  defaults:
16
16
  run:
17
17
  working-directory: src
18
18
  strategy:
19
19
  matrix:
20
- node-version: [12.x]
21
20
  os: [ubuntu-latest]
22
- container:
23
- image: alexfedoseev/alpine-node-yarn-esy:0.0.4
24
- steps:
25
- - name: Use Node.js ${{ matrix.node-version }}
26
- uses: actions/setup-node@v1
27
- with:
28
- node-version: ${{ matrix.node-version }}
21
+ ocaml-compiler:
22
+ - 4.12.1
29
23
 
24
+ steps:
30
25
  - uses: actions/checkout@v2
31
26
 
32
- - name: Add tar
33
- run: apk add --no-cache tar
34
-
35
- - name: Install
36
- run: esy install
37
-
38
- - name: Print esy cache
39
- id: print_esy_cache
40
- run: node ../.github/workflows/print_esy_cache.js
41
-
42
- - name: Try to restore dependencies cache
43
- uses: actions/cache@v2
44
- id: deps-cache
27
+ - name: Use OCaml ${{ matrix.ocaml-compiler}}
28
+ uses: ocaml/setup-ocaml@v2
45
29
  with:
46
- path: ${{ steps.print_esy_cache.outputs.esy_cache }}
47
- key: build-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
48
- restore-keys: build-${{ matrix.os }}-
30
+ ocaml-compiler: ${{ matrix.ocaml-compiler }}
49
31
 
50
- - name: Build
51
- run: esy b
32
+ - name: Install deps
33
+ run: opam install . --deps-only --with-test
52
34
 
53
- - name: Build release-static
54
- run: esy release-static
35
+ - name: Build
36
+ run: opam exec -- dune build
55
37
 
56
38
  - name: Copy built PPX file
57
39
  run: |
@@ -65,50 +47,30 @@ jobs:
65
47
  if-no-files-found: error
66
48
 
67
49
  build_macos:
68
- name: ${{ matrix.os }}/node-${{ matrix.node-version }}
50
+ name: ${{ matrix.os }}
69
51
  runs-on: ${{ matrix.os }}
70
52
  defaults:
71
53
  run:
72
54
  working-directory: src
73
55
  strategy:
74
56
  matrix:
75
- node-version: [12.x]
76
57
  os: [macOS-latest]
77
- steps:
78
- - name: Use Node.js ${{ matrix.node-version }}
79
- uses: actions/setup-node@v1
80
- with:
81
- node-version: ${{ matrix.node-version }}
58
+ ocaml-compiler:
59
+ - 4.12.1
82
60
 
61
+ steps:
83
62
  - uses: actions/checkout@v2
84
63
 
85
- - name: Install esy
86
- run: |
87
- npm install -g esy
88
-
89
- - name: Try to restore install cache
90
- uses: actions/cache@v1
64
+ - name: Use OCaml ${{ matrix.ocaml-compiler}}
65
+ uses: ocaml/setup-ocaml@v2
91
66
  with:
92
- path: ~/.esy/source
93
- key: source-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
94
-
95
- - name: Install
96
- run: esy install
67
+ ocaml-compiler: ${{ matrix.ocaml-compiler }}
97
68
 
98
- - name: Print esy cache
99
- id: print_esy_cache
100
- run: node ../.github/workflows/print_esy_cache.js
101
-
102
- - name: Try to restore dependencies cache
103
- id: deps-cache
104
- uses: actions/cache@v1
105
- with:
106
- path: ${{ steps.print_esy_cache.outputs.esy_cache }}
107
- key: build-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
108
- restore-keys: build-${{ matrix.os }}-
69
+ - name: Install deps
70
+ run: opam install . --deps-only --with-test
109
71
 
110
72
  - name: Build
111
- run: esy b
73
+ run: opam exec -- dune build
112
74
 
113
75
  - name: Copy built PPX file
114
76
  run: |
@@ -0,0 +1,6 @@
1
+ {
2
+ "ocaml.sandbox": {
3
+ "kind": "opam",
4
+ "switch": "4.12.1"
5
+ }
6
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # CHANGELOG
2
+
3
+ # 0.1.7
4
+
5
+ #### :rocket: New Feature
6
+
7
+ - Add support for the optional field record
package/README.md CHANGED
@@ -3,8 +3,9 @@
3
3
  A ReScript PPX, which generates JSON (de)serializers.
4
4
 
5
5
  `Spice` is originated from
6
- * The `Spice melange` in the novel, Dune
7
- * A flavor for the (polymorphic) variant
6
+
7
+ - The `Spice melange` in the novel, Dune
8
+ - A flavor for the (polymorphic) variant
8
9
 
9
10
  > This PPX is highly influenced by [Decco](https://github.com/reasonml-labs/decco) and developed with forking the source codes of Decco. Spice has implemented all the features of Decco@1.5.0 and additional useful features for the (polymorphic) variant of its own.
10
11
 
@@ -18,7 +19,7 @@ Whenever it is needed to parse the response in Json, the custom encoder/decoder
18
19
 
19
20
  with Decco
20
21
 
21
- ```
22
+ ```rescript
22
23
  @decco
23
24
  type status = WAITING | PROCESSING | SUCCESS | FAIL
24
25
 
@@ -54,7 +55,8 @@ type data = {
54
55
  ```
55
56
 
56
57
  with Spice
57
- ```
58
+
59
+ ```rescript
58
60
  @spice
59
61
  type status =
60
62
  | @spice.as("waiting") WAITING
@@ -86,7 +88,7 @@ let t_encode = ...
86
88
  // automatically generated
87
89
  let t_decode = ...
88
90
 
89
- let encoded = One->t_encode // Js.Json.JSONString(`하나`)
91
+ let encoded = One->t_encode // Js.Json.string(`하나`)
90
92
 
91
93
  let decoded = Js.Json.string(`second`)->t_decode // Belt.Result.Ok(Two)
92
94
  ```
@@ -118,11 +120,11 @@ let decoded = sampleJson->Records.t_decode // Belt.Result.Ok(sampleRecord)
118
120
 
119
121
  ## Install
120
122
 
121
- ```
123
+ ```sh
122
124
  yarn add -D @greenlabs/ppx-spice
123
125
  ```
124
126
 
125
- ```
127
+ ```json
126
128
  // bsconfig.json
127
129
 
128
130
  "bs-dependencies": [
@@ -136,39 +138,10 @@ yarn add -D @greenlabs/ppx-spice
136
138
 
137
139
  ## Development
138
140
 
139
- ### With Esy
140
-
141
- 1. Install dependencies
142
-
143
- ```
144
- cd src
145
- esy install
146
- ```
147
-
148
- 2. Build
149
-
150
- ```
151
- (make sure in /src directory)
152
- esy build
153
- ```
154
-
155
- 3. Test
156
-
157
- ```
158
- cd test
159
-
160
- (install dependencies)
161
- yarn
162
-
163
- (build --watch)
164
- yarn res:clean && yarn res:watch
165
-
166
- (run test --watch)
167
- yarn test:watch
168
- ```
169
-
170
141
  ### With Dune
171
142
 
143
+ Make sure running the below commands in `/src`.
144
+
172
145
  1. Create a sandbox with opam
173
146
 
174
147
  ```
@@ -178,7 +151,7 @@ opam switch create spice 4.12.1
178
151
  2. Install dependencies
179
152
 
180
153
  ```
181
- opam install dune ppxlib ocaml-lsp-server ocamlformat ocp-indent
154
+ opam install . --deps-only
182
155
  ```
183
156
 
184
157
  3. Build
@@ -189,6 +162,8 @@ dune build
189
162
 
190
163
  4. Test
191
164
 
165
+ Make sure running tests in `/test`
166
+
192
167
  ```
193
168
  cd test
194
169
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greenlabs/ppx-spice",
3
- "version": "0.1.6",
3
+ "version": "0.1.7-rc2",
4
4
  "description": "ReScript PPX which generate JSON (de)serializer",
5
5
  "license": "MIT",
6
6
  "author": "Greenlabs Dev <developer@greenlabs.co.kr>",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "bugs": {
12
12
  "url": "https://github.com/green-labs/ppx_spice/issues"
13
- },
13
+ },
14
14
  "keywords": [
15
15
  "ReScript",
16
16
  "ppx"
package/ppx-linux.exe CHANGED
Binary file
package/ppx-osx.exe CHANGED
Binary file