@greenlabs/ppx-spice 0.1.8-rc1 → 0.1.9-rc1

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.
Files changed (106) hide show
  1. package/CHANGELOG.md +6 -2
  2. package/README.md +4 -0
  3. package/docs/GUIDE.md +139 -0
  4. package/package.json +1 -1
  5. package/ppx-windows.exe +0 -0
  6. package/.github/workflows/build_linux.yml +0 -41
  7. package/.github/workflows/build_macos.yml +0 -41
  8. package/.github/workflows/build_windows.yml +0 -41
  9. package/.github/workflows/print_esy_cache.js +0 -13
  10. package/.github/workflows/publish.yml +0 -161
  11. package/.github/workflows/publish_prerelease.yml +0 -177
  12. package/.vscode/settings.json +0 -6
  13. package/src/.ocamlformat +0 -0
  14. package/src/bin/bin.ml +0 -1
  15. package/src/bin/dune +0 -5
  16. package/src/dune +0 -1
  17. package/src/dune-project +0 -2
  18. package/src/dune-workspace +0 -3
  19. package/src/esy.lock/.gitattributes +0 -3
  20. package/src/esy.lock/.gitignore +0 -3
  21. package/src/esy.lock/index.json +0 -1196
  22. package/src/esy.lock/opam/astring.0.8.5/opam +0 -37
  23. package/src/esy.lock/opam/base-bytes.base/opam +0 -9
  24. package/src/esy.lock/opam/base-threads.base/opam +0 -6
  25. package/src/esy.lock/opam/base-unix.base/opam +0 -6
  26. package/src/esy.lock/opam/base.v0.14.1/opam +0 -36
  27. package/src/esy.lock/opam/biniou.1.2.1/opam +0 -45
  28. package/src/esy.lock/opam/cmdliner.1.0.4/opam +0 -36
  29. package/src/esy.lock/opam/cppo.1.6.8/opam +0 -37
  30. package/src/esy.lock/opam/csexp.1.5.1/opam +0 -60
  31. package/src/esy.lock/opam/dot-merlin-reader.4.1/opam +0 -30
  32. package/src/esy.lock/opam/dune-build-info.2.9.1/opam +0 -42
  33. package/src/esy.lock/opam/dune-configurator.2.9.1/opam +0 -47
  34. package/src/esy.lock/opam/dune.2.9.1/opam +0 -58
  35. package/src/esy.lock/opam/easy-format.1.3.2/opam +0 -46
  36. package/src/esy.lock/opam/fix.20201120/opam +0 -24
  37. package/src/esy.lock/opam/fpath.0.7.3/opam +0 -36
  38. package/src/esy.lock/opam/menhir.20211012/opam +0 -28
  39. package/src/esy.lock/opam/menhirLib.20211012/opam +0 -29
  40. package/src/esy.lock/opam/menhirSdk.20211012/opam +0 -29
  41. package/src/esy.lock/opam/ocaml-compiler-libs.v0.12.4/opam +0 -39
  42. package/src/esy.lock/opam/ocaml-lsp-server.1.8.3/opam +0 -54
  43. package/src/esy.lock/opam/ocamlbuild.0.14.0/opam +0 -36
  44. package/src/esy.lock/opam/ocamlfind.1.9.1/opam +0 -44
  45. package/src/esy.lock/opam/ocamlformat-rpc-lib.0.18.0/opam +0 -40
  46. package/src/esy.lock/opam/ocamlformat.0.19.0/opam +0 -55
  47. package/src/esy.lock/opam/ocp-indent.1.8.1/opam +0 -57
  48. package/src/esy.lock/opam/odoc-parser.0.9.0/opam +0 -45
  49. package/src/esy.lock/opam/pp.1.1.2/opam +0 -58
  50. package/src/esy.lock/opam/ppx_derivers.1.2.1/opam +0 -23
  51. package/src/esy.lock/opam/ppx_yojson_conv_lib.v0.14.0/opam +0 -24
  52. package/src/esy.lock/opam/ppxlib.0.23.0/opam +0 -62
  53. package/src/esy.lock/opam/re.1.10.3/opam +0 -46
  54. package/src/esy.lock/opam/result.1.5/opam +0 -22
  55. package/src/esy.lock/opam/seq.base/files/META.seq +0 -4
  56. package/src/esy.lock/opam/seq.base/files/seq.install +0 -3
  57. package/src/esy.lock/opam/seq.base/opam +0 -15
  58. package/src/esy.lock/opam/sexplib0.v0.14.0/opam +0 -26
  59. package/src/esy.lock/opam/stdio.v0.14.0/opam +0 -27
  60. package/src/esy.lock/opam/stdlib-shims.0.3.0/opam +0 -31
  61. package/src/esy.lock/opam/topkg.1.0.4/opam +0 -44
  62. package/src/esy.lock/opam/uchar.0.0.2/opam +0 -36
  63. package/src/esy.lock/opam/uucp.14.0.0/opam +0 -41
  64. package/src/esy.lock/opam/uuseg.14.0.0/opam +0 -43
  65. package/src/esy.lock/opam/uutf.1.0.2/opam +0 -40
  66. package/src/esy.lock/opam/yojson.1.7.0/opam +0 -38
  67. package/src/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/files/ocamlbuild-0.14.0.patch +0 -463
  68. package/src/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/package.json +0 -27
  69. package/src/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.1_opam_override/files/findlib-1.9.1.patch +0 -471
  70. package/src/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.1_opam_override/package.json +0 -61
  71. package/src/ppx/codecs.ml +0 -120
  72. package/src/ppx/decode_cases.ml +0 -18
  73. package/src/ppx/dune +0 -9
  74. package/src/ppx/polyvariants.ml +0 -288
  75. package/src/ppx/ppx_spice.ml +0 -19
  76. package/src/ppx/records.ml +0 -163
  77. package/src/ppx/signature.ml +0 -86
  78. package/src/ppx/structure.ml +0 -109
  79. package/src/ppx/tuple.ml +0 -68
  80. package/src/ppx/utils.ml +0 -117
  81. package/src/ppx/variants.ml +0 -257
  82. package/src/ppx_spice.opam +0 -21
  83. package/test/__tests__/test_optional_field_records.js +0 -91
  84. package/test/__tests__/test_optional_field_records.res +0 -98
  85. package/test/__tests__/test_polyvariants.js +0 -57
  86. package/test/__tests__/test_polyvariants.res +0 -41
  87. package/test/__tests__/test_records.js +0 -100
  88. package/test/__tests__/test_records.res +0 -111
  89. package/test/__tests__/test_variants.js +0 -85
  90. package/test/__tests__/test_variants.res +0 -63
  91. package/test/bsconfig.json +0 -27
  92. package/test/package.json +0 -18
  93. package/test/src/OptionalFieldRecords.js +0 -237
  94. package/test/src/OptionalFieldRecords.res +0 -23
  95. package/test/src/Polyvariants.js +0 -94
  96. package/test/src/Polyvariants.res +0 -5
  97. package/test/src/Polyvariants.resi +0 -5
  98. package/test/src/Records.js +0 -186
  99. package/test/src/Records.res +0 -17
  100. package/test/src/Records.resi +0 -17
  101. package/test/src/Spice.js +0 -448
  102. package/test/src/Spice_Codecs.js +0 -57
  103. package/test/src/Variants.js +0 -115
  104. package/test/src/Variants.res +0 -11
  105. package/test/src/Variants.resi +0 -11
  106. package/test/yarn.lock +0 -4194
package/CHANGELOG.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # CHANGELOG
2
2
 
3
- # 0.1.8-rc1
3
+ # 0.1.9-rc1
4
4
 
5
- - Fix type error where using tuple constructor type, such as `array<int>` for optional field in the record.
5
+ - Clean up npm publish files
6
+
7
+ # 0.1.8
8
+
9
+ - Fix type error where using tuple constructor type, such as `array<int>` for optional field in the record. https://github.com/green-labs/ppx_spice/pull/32
6
10
 
7
11
  # 0.1.7
8
12
 
package/README.md CHANGED
@@ -118,6 +118,10 @@ let encoded = sampleRecord->Records.t_encode // sampleJson
118
118
  let decoded = sampleJson->Records.t_decode // Belt.Result.Ok(sampleRecord)
119
119
  ```
120
120
 
121
+ ## Getting Started
122
+
123
+ Read our [Guide with examples](docs/GUIDE.md)
124
+
121
125
  ## Install
122
126
 
123
127
  ```sh
package/docs/GUIDE.md ADDED
@@ -0,0 +1,139 @@
1
+ # Ppx_spice Guide
2
+
3
+ This document walks you through the basics of using ppx_spice. You can try with examples in the [`/examples` directory](../examples).
4
+
5
+ ## Guide Index
6
+
7
+ - [Basic Usage](#basic-usage)
8
+ - [Variants](#variants)
9
+ - [Advanced Usage](#advanced-usage)
10
+
11
+ ### Basic Usage
12
+
13
+ The following example shows how to use ppx_spice to encode and decode a JSON value.
14
+
15
+ ```rescript
16
+ let data = %raw(`
17
+ {
18
+ "id": 1,
19
+ "nickname": "bob"
20
+ }
21
+ `)
22
+
23
+ @spice
24
+ type user = {
25
+ id: int,
26
+ nickname?: string,
27
+ }
28
+
29
+ let user: Belt.Result.t<user, Spice.decodeError> = data->user_decode // user_decode is generated by ppx_spice
30
+
31
+ let json: Js.Json.t = user->Belt.Result.getExn->user_encode // user_encode is generated by ppx_spice
32
+ ```
33
+
34
+ ### Variants
35
+
36
+ The following example shows how to use ppx_spice to encode and decode a variant.
37
+
38
+ ```rescript
39
+ let data = %raw(`
40
+ {
41
+ "id": 1,
42
+ "nickname": "bob",
43
+ "language": "ReScript"
44
+ }
45
+ `)
46
+
47
+ @spice
48
+ type language =
49
+ | @spice.as("ReScript") ReScript
50
+ | @spice.as("OCaml") OCaml
51
+ | @spice.as("TypeScript") TypeScript
52
+ | @spice.as("JavaScript") JavaScript
53
+
54
+ @spice
55
+ type user = {
56
+ id: int,
57
+ nickname?: string,
58
+ language: language,
59
+ }
60
+
61
+ let user: Belt.Result.t<user, Spice.decodeError> = json->user_decode
62
+
63
+ let json: Js.Json.t = user->Result.getExn->user_encode
64
+ ```
65
+
66
+ `@spice.as("...")` is used to specify the JSON value of the variant. Without it, the variant name is also used as the JSON value, but the JSON value should be formed as an array to be parsed as a variant. The second example shows how to use it for the case of variant with argument.
67
+
68
+ ```rescript
69
+ @spice
70
+ type language =
71
+ | ReScript(string) // <- with the argument
72
+ | OCaml
73
+ | TypeScript
74
+ | JavaScript
75
+
76
+ @spice
77
+ type user = {
78
+ id: int,
79
+ nickname?: string,
80
+ language: language,
81
+ }
82
+
83
+ let data = %raw(`
84
+ {
85
+ "id": 1,
86
+ "nickname": "bob",
87
+ "language": ["ReScript", "awesome"] // <- This is the array
88
+ }
89
+ `)
90
+ ```
91
+
92
+ ### Advanced Usage
93
+
94
+ The following example shows how to use ppx_spice to encode and decode a JSON value with a custom codec.
95
+
96
+ ```rescript
97
+ @spice
98
+ type status = WAITING | PROCESSING | SUCCESS | FAIL
99
+
100
+ let encoderStatus = v =>
101
+ switch v {
102
+ | WAITING => "waiting"
103
+ | PROCESSING => "processing"
104
+ | SUCCESS => "success"
105
+ | FAIL => "fail"
106
+ }->Js.Json.string
107
+
108
+ let decoderStatus = json => {
109
+ switch json |> Js.Json.classify {
110
+ | Js.Json.JSONString(str) =>
111
+ switch str {
112
+ | "waiting" => WAITING->Ok
113
+ | "processing" => PROCESSING->Ok
114
+ | "success" => SUCCESS->Ok
115
+ | "fail" => FAIL->Ok
116
+ | _ => Error({Spice.path: "", message: "Expected JSONString", value: json})
117
+ }
118
+ | _ => Error({Spice.path: "", message: "Expected JSONString", value: json})
119
+ }
120
+ }
121
+
122
+ let codecStatus: Spice.codec<status> = (encoderStatus, decoderStatus)
123
+
124
+
125
+ @spice
126
+ type data = {
127
+ status: @spice.codec(codecStatus) status,
128
+ }
129
+
130
+ let data = %raw(`
131
+ {
132
+ "status": "success"
133
+ }
134
+ `)
135
+
136
+ let data = data->data_decode
137
+
138
+ let json = data->Result.getExn->data_encode
139
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greenlabs/ppx-spice",
3
- "version": "0.1.8-rc1",
3
+ "version": "0.1.9-rc1",
4
4
  "description": "ReScript PPX which generate JSON (de)serializer",
5
5
  "license": "MIT",
6
6
  "author": "Greenlabs Dev <developer@greenlabs.co.kr>",
package/ppx-windows.exe CHANGED
Binary file
@@ -1,41 +0,0 @@
1
- name: ppx_spice build linux
2
-
3
- on: [workflow_dispatch]
4
-
5
- jobs:
6
- build_linux:
7
- name: ${{ matrix.os }}
8
- runs-on: ${{ matrix.os }}
9
- defaults:
10
- run:
11
- working-directory: src
12
- strategy:
13
- matrix:
14
- os: [ubuntu-latest]
15
- ocaml-compiler:
16
- - 4.12.1
17
-
18
- steps:
19
- - uses: actions/checkout@v3
20
-
21
- - name: Use OCaml ${{ matrix.ocaml-compiler}}
22
- uses: ocaml/setup-ocaml@v2
23
- with:
24
- ocaml-compiler: ${{ matrix.ocaml-compiler }}
25
-
26
- - name: Install deps
27
- run: opam install . --deps-only --with-test
28
-
29
- - name: Build
30
- run: opam exec -- dune build
31
-
32
- - name: Copy built PPX file
33
- run: |
34
- mv ./_build/default/bin/bin.exe ppx.exe
35
-
36
- - name: (only on release) Upload artifacts ${{ matrix.os }}
37
- uses: actions/upload-artifact@master
38
- with:
39
- name: ${{ matrix.os }}
40
- path: src/ppx.exe
41
- if-no-files-found: error
@@ -1,41 +0,0 @@
1
- name: ppx_spice build macOS
2
-
3
- on: [workflow_dispatch]
4
-
5
- jobs:
6
- build_macos:
7
- name: ${{ matrix.os }}
8
- runs-on: ${{ matrix.os }}
9
- defaults:
10
- run:
11
- working-directory: src
12
- strategy:
13
- matrix:
14
- os: [macOS-latest]
15
- ocaml-compiler:
16
- - 4.12.1
17
-
18
- steps:
19
- - uses: actions/checkout@v3
20
-
21
- - name: Use OCaml ${{ matrix.ocaml-compiler}}
22
- uses: ocaml/setup-ocaml@v2
23
- with:
24
- ocaml-compiler: ${{ matrix.ocaml-compiler }}
25
-
26
- - name: Install deps
27
- run: opam install . --deps-only --with-test
28
-
29
- - name: Build
30
- run: opam exec -- dune build
31
-
32
- - name: Copy built PPX file
33
- run: |
34
- mv ./_build/default/bin/bin.exe ppx.exe
35
-
36
- - name: (only on release) Upload artifacts ${{ matrix.os }}
37
- uses: actions/upload-artifact@master
38
- with:
39
- name: ${{ matrix.os }}
40
- path: src/ppx.exe
41
- if-no-files-found: error
@@ -1,41 +0,0 @@
1
- name: ppx_spice build windows
2
-
3
- on: [workflow_dispatch]
4
-
5
- jobs:
6
- build_windows:
7
- name: ${{ matrix.os }}
8
- runs-on: ${{ matrix.os }}
9
- defaults:
10
- run:
11
- working-directory: src
12
- strategy:
13
- matrix:
14
- os: [windows-latest]
15
- ocaml-compiler:
16
- - 4.12.1
17
-
18
- steps:
19
- - uses: actions/checkout@v3
20
-
21
- - name: Use OCaml ${{ matrix.ocaml-compiler}}
22
- uses: ocaml/setup-ocaml@v2
23
- with:
24
- ocaml-compiler: ${{ matrix.ocaml-compiler }}
25
-
26
- - name: Install deps
27
- run: opam install . --deps-only --with-test
28
-
29
- - name: Build
30
- run: opam exec -- dune build
31
-
32
- - name: Copy built PPX file
33
- run: |
34
- mv ./_build/default/bin/bin.exe ppx.exe
35
-
36
- - name: (only on release) Upload artifacts ${{ matrix.os }}
37
- uses: actions/upload-artifact@master
38
- with:
39
- name: ${{ matrix.os }}
40
- path: src/ppx.exe
41
- if-no-files-found: error
@@ -1,13 +0,0 @@
1
- const fs = require("fs");
2
- const os = require("os");
3
- const path = require("path");
4
-
5
- const ESY_FOLDER = process.env.ESY__PREFIX
6
- ? process.env.ESY__PREFIX
7
- : path.join(os.homedir(), ".esy");
8
- const esy3 = fs
9
- .readdirSync(ESY_FOLDER)
10
- .filter((name) => name.length > 0 && name[0] === "3")
11
- .sort()
12
- .pop();
13
- console.log(`::set-output name=esy_cache::${path.join(ESY_FOLDER, esy3, "i")}`);
@@ -1,161 +0,0 @@
1
- name: ppx_spice publish
2
-
3
- on: [workflow_dispatch]
4
-
5
- jobs:
6
- build_linux:
7
- name: ${{ matrix.os }}
8
- runs-on: ${{ matrix.os }}
9
- defaults:
10
- run:
11
- working-directory: src
12
- strategy:
13
- matrix:
14
- os: [ubuntu-latest]
15
- ocaml-compiler:
16
- - 4.12.1
17
-
18
- steps:
19
- - uses: actions/checkout@v3
20
-
21
- - name: Use OCaml ${{ matrix.ocaml-compiler}}
22
- uses: ocaml/setup-ocaml@v2
23
- with:
24
- ocaml-compiler: ${{ matrix.ocaml-compiler }}
25
-
26
- - name: Install deps
27
- run: opam install . --deps-only --with-test
28
-
29
- - name: Build
30
- run: opam exec -- dune build
31
-
32
- - name: Copy built PPX file
33
- run: |
34
- mv ./_build/default/bin/bin.exe ppx.exe
35
-
36
- - name: (only on release) Upload artifacts ${{ matrix.os }}
37
- uses: actions/upload-artifact@master
38
- with:
39
- name: ${{ matrix.os }}
40
- path: src/ppx.exe
41
- if-no-files-found: error
42
-
43
- build_macos:
44
- name: ${{ matrix.os }}
45
- runs-on: ${{ matrix.os }}
46
- defaults:
47
- run:
48
- working-directory: src
49
- strategy:
50
- matrix:
51
- os: [macOS-latest]
52
- ocaml-compiler:
53
- - 4.12.1
54
-
55
- steps:
56
- - uses: actions/checkout@v3
57
-
58
- - name: Use OCaml ${{ matrix.ocaml-compiler}}
59
- uses: ocaml/setup-ocaml@v2
60
- with:
61
- ocaml-compiler: ${{ matrix.ocaml-compiler }}
62
-
63
- - name: Install deps
64
- run: opam install . --deps-only --with-test
65
-
66
- - name: Build
67
- run: opam exec -- dune build
68
-
69
- - name: Copy built PPX file
70
- run: |
71
- mv ./_build/default/bin/bin.exe ppx.exe
72
-
73
- - name: (only on release) Upload artifacts ${{ matrix.os }}
74
- uses: actions/upload-artifact@master
75
- with:
76
- name: ${{ matrix.os }}
77
- path: src/ppx.exe
78
- if-no-files-found: error
79
-
80
- build_windows:
81
- name: ${{ matrix.os }}
82
- runs-on: ${{ matrix.os }}
83
- defaults:
84
- run:
85
- working-directory: src
86
- strategy:
87
- matrix:
88
- os: [windows-latest]
89
- ocaml-compiler:
90
- - 4.12.1
91
-
92
- steps:
93
- - uses: actions/checkout@v3
94
-
95
- - name: Use OCaml ${{ matrix.ocaml-compiler}}
96
- uses: ocaml/setup-ocaml@v2
97
- with:
98
- ocaml-compiler: ${{ matrix.ocaml-compiler }}
99
-
100
- - name: Install deps
101
- run: opam install . --deps-only --with-test
102
-
103
- - name: Build
104
- run: opam exec -- dune build
105
-
106
- - name: Copy built PPX file
107
- run: |
108
- mv ./_build/default/bin/bin.exe ppx.exe
109
-
110
- - name: (only on release) Upload artifacts ${{ matrix.os }}
111
- uses: actions/upload-artifact@master
112
- with:
113
- name: ${{ matrix.os }}
114
- path: src/ppx.exe
115
- if-no-files-found: error
116
-
117
- publish:
118
- needs: [build_linux, build_macos, build_windows]
119
- name: (only on release) Publish
120
- runs-on: ubuntu-latest
121
- steps:
122
- - uses: actions/checkout@v3
123
- - uses: actions/setup-node@v3
124
- with:
125
- node-version: 16
126
- registry-url: "https://registry.npmjs.org"
127
-
128
- - name: Download linux artifacts
129
- if: success()
130
- uses: actions/download-artifact@master
131
- with:
132
- name: ubuntu-latest
133
- path: binaries/linux
134
-
135
- - name: Download macOS artifacts
136
- if: success()
137
- uses: actions/download-artifact@master
138
- with:
139
- name: macOS-latest
140
- path: binaries/darwin
141
-
142
- - name: Download windows artifacts
143
- if: success()
144
- uses: actions/download-artifact@master
145
- with:
146
- name: windows-latest
147
- path: binaries/windows
148
-
149
- - name: Move artifacts
150
- if: success()
151
- run: |
152
- mkdir -p bin
153
- mv binaries/linux/ppx.exe ppx-linux.exe
154
- mv binaries/darwin/ppx.exe ppx-osx.exe
155
- mv binaries/windows/ppx.exe ppx-windows.exe
156
-
157
- - name: Publish
158
- if: success()
159
- run: npm publish
160
- env:
161
- NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
@@ -1,177 +0,0 @@
1
- name: ppx_spice publish prerelease
2
-
3
- on:
4
- workflow_dispatch:
5
- inputs:
6
- release_version:
7
- description: "change npm release version"
8
- required: true
9
- default: ""
10
-
11
- jobs:
12
- build_linux:
13
- name: ${{ matrix.os }}
14
- runs-on: ${{ matrix.os }}
15
- defaults:
16
- run:
17
- working-directory: src
18
- strategy:
19
- matrix:
20
- os: [ubuntu-latest]
21
- ocaml-compiler:
22
- - 4.12.1
23
-
24
- steps:
25
- - uses: actions/checkout@v3
26
-
27
- - name: Use OCaml ${{ matrix.ocaml-compiler}}
28
- uses: ocaml/setup-ocaml@v2
29
- with:
30
- ocaml-compiler: ${{ matrix.ocaml-compiler }}
31
-
32
- - name: Install deps
33
- run: opam install . --deps-only --with-test
34
-
35
- - name: Build
36
- run: opam exec -- dune build
37
-
38
- - name: Copy built PPX file
39
- run: |
40
- mv ./_build/default/bin/bin.exe ppx.exe
41
-
42
- - name: (only on release) Upload artifacts ${{ matrix.os }}
43
- uses: actions/upload-artifact@master
44
- with:
45
- name: ${{ matrix.os }}
46
- path: src/ppx.exe
47
- if-no-files-found: error
48
-
49
- build_macos:
50
- name: ${{ matrix.os }}
51
- runs-on: ${{ matrix.os }}
52
- defaults:
53
- run:
54
- working-directory: src
55
- strategy:
56
- matrix:
57
- os: [macOS-latest]
58
- ocaml-compiler:
59
- - 4.12.1
60
-
61
- steps:
62
- - uses: actions/checkout@v3
63
-
64
- - name: Use OCaml ${{ matrix.ocaml-compiler}}
65
- uses: ocaml/setup-ocaml@v2
66
- with:
67
- ocaml-compiler: ${{ matrix.ocaml-compiler }}
68
-
69
- - name: Install deps
70
- run: opam install . --deps-only --with-test
71
-
72
- - name: Build
73
- run: opam exec -- dune build
74
-
75
- - name: Copy built PPX file
76
- run: |
77
- mv ./_build/default/bin/bin.exe ppx.exe
78
-
79
- - name: (only on release) Upload artifacts ${{ matrix.os }}
80
- uses: actions/upload-artifact@master
81
- with:
82
- name: ${{ matrix.os }}
83
- path: src/ppx.exe
84
- if-no-files-found: error
85
-
86
- build_windows:
87
- name: ${{ matrix.os }}
88
- runs-on: ${{ matrix.os }}
89
- defaults:
90
- run:
91
- working-directory: src
92
- strategy:
93
- matrix:
94
- os: [windows-latest]
95
- ocaml-compiler:
96
- - 4.12.1
97
-
98
- steps:
99
- - uses: actions/checkout@v3
100
-
101
- - name: Use OCaml ${{ matrix.ocaml-compiler}}
102
- uses: ocaml/setup-ocaml@v2
103
- with:
104
- ocaml-compiler: ${{ matrix.ocaml-compiler }}
105
-
106
- - name: Install deps
107
- run: opam install . --deps-only --with-test
108
-
109
- - name: Build
110
- run: opam exec -- dune build
111
-
112
- - name: Copy built PPX file
113
- run: |
114
- mv ./_build/default/bin/bin.exe ppx.exe
115
-
116
- - name: (only on release) Upload artifacts ${{ matrix.os }}
117
- uses: actions/upload-artifact@master
118
- with:
119
- name: ${{ matrix.os }}
120
- path: src/ppx.exe
121
- if-no-files-found: error
122
-
123
- publish:
124
- needs: [build_linux, build_macos, build_windows]
125
- name: (only on release) Publish (pre-release)
126
- runs-on: ubuntu-latest
127
- steps:
128
- - uses: actions/checkout@v3
129
- - uses: actions/setup-node@v3
130
- with:
131
- node-version: 16
132
- registry-url: "https://registry.npmjs.org"
133
-
134
- - name: Download linux artifacts
135
- if: success()
136
- uses: actions/download-artifact@master
137
- with:
138
- name: ubuntu-latest
139
- path: binaries/linux
140
-
141
- - name: Download macOS artifacts
142
- if: success()
143
- uses: actions/download-artifact@master
144
- with:
145
- name: macOS-latest
146
- path: binaries/darwin
147
-
148
- - name: Download windows artifacts
149
- if: success()
150
- uses: actions/download-artifact@master
151
- with:
152
- name: windows-latest
153
- path: binaries/windows
154
-
155
- - name: Move artifacts
156
- if: success()
157
- run: |
158
- mkdir -p bin
159
- mv binaries/linux/ppx.exe ppx-linux.exe
160
- mv binaries/darwin/ppx.exe ppx-osx.exe
161
- mv binaries/windows/ppx.exe ppx-windows.exe
162
-
163
- - name: Change npm release version
164
- if: success()
165
- uses: reedyuk/npm-version@1.1.1
166
- with:
167
- version: ${{ github.event.inputs.release_version }}
168
-
169
- - name: Pack package
170
- if: success()
171
- run: npm pack
172
-
173
- - name: Publish
174
- if: success()
175
- run: npm publish greenlabs-ppx-spice-${{ github.event.inputs.release_version }}.tgz --tag next
176
- env:
177
- NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
@@ -1,6 +0,0 @@
1
- {
2
- "ocaml.sandbox": {
3
- "kind": "opam",
4
- "switch": "4.12.1"
5
- }
6
- }
package/src/.ocamlformat DELETED
File without changes
package/src/bin/bin.ml DELETED
@@ -1 +0,0 @@
1
- let () = Ppxlib.Driver.run_as_ppx_rewriter ()
package/src/bin/dune DELETED
@@ -1,5 +0,0 @@
1
- (executable
2
- (package ppx_spice)
3
- (name bin)
4
- (public_name ppx_spice)
5
- (libraries ppx_spice))
package/src/dune DELETED
@@ -1 +0,0 @@
1
- (dirs ppx bin)
package/src/dune-project DELETED
@@ -1,2 +0,0 @@
1
- (lang dune 2.7)
2
- (name ppx_spice)
@@ -1,3 +0,0 @@
1
- (lang dune 1.1)
2
-
3
- (env (release-static (flags (:standard -ccopt -static))))
@@ -1,3 +0,0 @@
1
-
2
- # Set eol to LF so files aren't converted to CRLF-eol on Windows.
3
- * text eol=lf linguist-generated
@@ -1,3 +0,0 @@
1
-
2
- # Reset any possible .gitignore, we want all esy.lock to be un-ignored.
3
- !*