Skip to content

Commit 803ac6e

Browse files
authored
Merge pull request #10 from input-output-hk/workspaces
Initial version of workspaces
2 parents 9c8a09b + 63c09a4 commit 803ac6e

155 files changed

Lines changed: 1507 additions & 1148 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Post-integration
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
pages: write
9+
id-token: write
10+
11+
concurrency:
12+
group: "pages"
13+
cancel-in-progress: false
14+
15+
jobs:
16+
deploy-docs:
17+
environment:
18+
name: github-pages
19+
url: ${{ steps.deployment.outputs.page_url }}
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: 📥 Checkout repository
23+
uses: actions/checkout@v3
24+
25+
- name: 🧰 Setup Pages
26+
uses: actions/configure-pages@v3
27+
28+
- name: 🧰 Setup nix
29+
uses: cachix/install-nix-action@v22
30+
with:
31+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: 🔨 Build Docs
34+
run: |
35+
nix develop --show-trace --command bash -c "npm i && npm run build && npm run docs"
36+
37+
- name: 📘 Upload artifact
38+
uses: actions/upload-pages-artifact@v2
39+
with:
40+
path: './docs'
41+
42+
- name: 📘 Deploy to GitHub Pages
43+
id: deployment
44+
uses: actions/deploy-pages@v2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ tsconfig.tsbuildinfo
1515
result
1616
source
1717
dist
18+
test-dist
1819

1920
package-lock.json
2021
yarn.lock

Readme.md

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,49 @@
1+
# WIP WARNING
2+
> The TypeScript SDK is a work in progress, it's API might change so use with caution.
3+
14
# Marlowe TS-SDK
5+
The Marlowe TypeScript SDK is a set of libraries and utilities to work with Marlowe contracts. The project uses [npm workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces) to divide itself in the following packages:
6+
7+
* `language/core/v1`: The `@marlowe/language-core-v1` library that contains the core Marlowe language definitions and utilities.
8+
* `legacy-adapter`: The `@marlowe/legacy-adapter` library that contains common utilities.
9+
* `legacy-runtime`: The `@marlowe/legacy-runtime` library that contains the initial abstraction over the Marlowe runtime
10+
11+
## Developer notes
12+
13+
### Build
14+
15+
In order to start develop the SDK you need to install the dependencies and build the packages.
16+
17+
```
18+
$ npm i
19+
$ npm run build
20+
```
21+
22+
If you want to build a single package you can use the `-w` flag or execute the build command from the package folder.
23+
24+
```
25+
# From the root folder
26+
$ npm run build -w @marlowe/language-core-v1
27+
# Or you can enter the package and build
28+
$ cd packages/language/core/v1
29+
$ npm run build
30+
```
31+
32+
In order to clean the build artifacts you can use the `clean` command.
33+
34+
```
35+
$ npm run clean
36+
```
237

3-
TODO
38+
To run the unit test you can execute the `test` command.
439

5-
## Testing
40+
```
41+
$ npm run test
42+
```
643

44+
### E2E tests
45+
46+
TODO: Fix the E2E tests
747
In order to run the E2E tests you need to create a `env/.env.test` file that points to a working version of the marlowe runtime and a working Blockfrost instance and a faucet PK
848

949
TODO: explain how to get the Faucet PK
@@ -15,3 +55,36 @@ BLOCKFROST_URL="https://cardano-preprod.blockfrost.io/api/v0"
1555
NETWORK_ID=Preprod
1656
BANK_PK_HEX='<pk>'
1757
```
58+
59+
### Documentation
60+
61+
> ⚠ You need to [build the packages](#build) before you can compile the documentation!
62+
63+
To compile all documentation
64+
65+
```
66+
$ npm run docs
67+
```
68+
69+
Documentation is built with [TypeDoc](https://typedoc.org), published through [GitHub Pages](https://pages.github.com), and hosted at https://input-output-hk.github.io/marlowe-ts-sdk
70+
71+
Each sub project needs a `typedoc.json` file in the sub project root directory as specified in the `workspaces` field in `./packages.json`. For example, there's some project "some-project" specified:
72+
73+
```json
74+
// ./packages.json
75+
{
76+
...,
77+
"workspaces": ["./path/to/some-project"]
78+
}
79+
```
80+
81+
There needs to be a `typedoc.json` in `./path/to/some-project` and it needs properties along the lines of this example:
82+
83+
```json
84+
// ./path/to/some-project/typedoc.json
85+
{
86+
"entryPointStrategy": "expand",
87+
"entryPoints": ["./src"],
88+
"tsconfig": "./tsconfig.json"
89+
}
90+
```

fixup

Lines changed: 0 additions & 11 deletions
This file was deleted.

jest.config.console.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

jest.config.js

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,6 @@
11
module.exports = {
2-
2+
testEnvironment: "node",
33
projects: [
4-
{
5-
displayName: "e2e test",
6-
testMatch: ["./**/*.spec.e2e.ts"],
7-
runner: "jest-serial-runner",
8-
extensionsToTreatAsEsm: ['.ts'],
9-
preset: 'ts-jest/presets/default-esm',
10-
moduleNameMapper: {
11-
'^(\\.{1,2}/.*)\\.js$': '$1'
12-
},
13-
globalSetup: "./dotenv/dotenv-test.js",
14-
setupFilesAfterEnv: ["./jest.config.console.js"],
15-
transform: {
16-
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
17-
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`
18-
'^.+\\.m?[tj]sx?$': [
19-
'ts-jest',
20-
{
21-
useESM: true,
22-
},
23-
],
24-
},
25-
},
26-
{
27-
displayName: "unit test",
28-
testMatch: ["./**/*.spec.ts"],
29-
extensionsToTreatAsEsm: ['.ts'],
30-
preset: 'ts-jest/presets/default-esm',
31-
moduleNameMapper: {
32-
'^(\\.{1,2}/.*)\\.js$': '$1'
33-
},
34-
globalSetup: "./dotenv/dotenv-test.js",
35-
setupFilesAfterEnv: ["./jest.config.console.js"],
36-
transform: {
37-
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
38-
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`
39-
'^.+\\.m?[tj]sx?$': [
40-
'ts-jest',
41-
{
42-
useESM: true,
43-
},
44-
],
45-
},
46-
}
4+
'<rootDir>/packages/language/core/v1/test/jest.unit.config.mjs'
475
]
486
};
49-

package.json

Lines changed: 24 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "marlowe-ts-sdk",
3-
"version": "0.0.37-beta",
4-
"description": "Marlowe Runtime SDK for building Marlowe Contracts",
3+
"version": "0.1.0-beta",
4+
"description": "Marlowe Runtime SDK for building and managing Marlowe Contracts",
55
"engines": {
66
"node": ">=14.20.1"
77
},
@@ -10,69 +10,45 @@
1010
"access": "public"
1111
},
1212
"contributors": [
13-
"Nicolas Henin <nicolas.henin@iohk.io> (https://iohk.io)"
13+
"Nicolas Henin <nicolas.henin@iohk.io> (https://iohk.io)",
14+
"Hernan Rajchert <hernan.rajchert@iohk.io> (https://iohk.io)",
15+
"Bjorn Kihlberg <bjorn.kihlberg@iohk.io> (https://iohk.io)"
1416
],
1517
"license": "Apache-2.0",
1618
"scripts": {
17-
"build:esm": "tsc -p src/tsconfig.json --outDir ./dist/esm --module es2020",
18-
"build:cjs": "tsc --build src",
19-
"build": "rm -fr dist/* && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && ./fixup",
20-
"circular-deps:check": "madge --circular dist",
21-
"tscNoEmit": "shx echo typescript --noEmit command not implemented yet",
22-
"cleanup:dist": "shx rm -rf dist",
23-
"cleanup:nm": "shx rm -rf node_modules",
24-
"cleanup": "run-s cleanup:dist cleanup:nm",
25-
"lint": "eslint -c ../../complete.eslintrc.js \"src/**/*.ts\" \"test/**/*.ts\"",
26-
"lint:fix": "yarn lint --fix",
27-
"test": "yarn node --experimental-vm-modules $(yarn bin jest -c ./jest.config.js)",
28-
"test:build:verify": "tsc --build ./test",
29-
"test:e2e": "shx echo 'test:e2e' command not implemented yet",
30-
"coverage": "shx echo No coverage report for this package",
31-
"prepack": "yarn build"
19+
"build": "tsc --build && rollup --config rollup/legacy-runtime-esm.config.mjs",
20+
"clean": "npm run clean --workspaces && shx rm -rf dist",
21+
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest",
22+
"docs": "typedoc ."
3223
},
24+
"workspaces": [
25+
"packages/legacy-adapter",
26+
"packages/language/core/v1",
27+
"packages/legacy-runtime"
28+
],
3329
"devDependencies": {
30+
"@relmify/jest-fp-ts": "^2.0.2",
31+
"@rollup/plugin-commonjs": "^25.0.3",
32+
"@rollup/plugin-node-resolve": "^15.1.0",
3433
"@types/axios-curlirize": "^1.3.2",
3534
"@types/deep-equal": "1.0.1",
3635
"@types/jest": "^26.0.24",
3736
"@types/json-bigint": "^1.0.1",
3837
"@types/node": "^18.14.2",
39-
4038
"eslint": "^7.32.0",
4139
"jest": "^29.4",
40+
"jest-serial-runner": "^1.2.1",
4241
"npm-run-all": "^4.1.5",
4342
"prettier": "^2.3.2",
43+
"rollup": "^3.27.2",
44+
"rollup-plugin-copy": "^3.4.0",
45+
"rollup-plugin-output-size": "^1.2.2",
4446
"shx": "^0.3.3",
4547
"ts-jest": "^29.0.5",
46-
"jest-serial-runner": "^1.2.1",
47-
"@relmify/jest-fp-ts": "^2.0.2",
48-
"ts-node": "^10.9.1"
49-
},
50-
"dependencies": {
51-
"@blockfrost/blockfrost-js": "5.2.0",
52-
"@blockfrost/openapi": "0.1.54",
53-
"@emurgo/cardano-serialization-lib-browser":"11.4.0",
54-
"@types/deep-equal": "1.0.1",
55-
"@types/qs" : "6.9.7",
56-
"qs" : "6.11.1" ,
57-
"axios": "^1.3.3",
58-
"axios-curlirize": "^2.0.0",
59-
"date-fns": "2.29.3",
60-
"deep-equal": "1.0.1",
61-
"dotenv": "^16.0.3",
62-
"fp-ts": "^2.13.1",
63-
"json-bigint": "^1.0.0",
64-
"lucid-cardano": "0.9.4",
65-
"ts-adt": "^2.0.2",
66-
"ts-pattern": "^4.2.0",
67-
"retry-ts":"0.1.4",
68-
"newtype-ts":"0.3.5",
69-
"monocle-ts":"2.3.13",
70-
"io-ts":"2.2.20",
71-
"io-ts-types":"0.5.19",
72-
"io-ts-bigint":"2.0.1",
73-
"jsonbigint-io-ts-reporters":"2.0.1",
48+
"ts-node": "^10.9.1",
49+
"typedoc": "^0.24.8",
7450
"typescript": "^4.9.5",
7551
"typescript-language-server": "^3.1.0"
7652
},
77-
"packageManager": "yarn@3.2.1"
53+
"packageManager": "npm@9.3.1"
7854
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# @marlowe/language-core-v1
2+
TODO
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "@marlowe/language-core-v1",
3+
"version": "0.1.0-beta",
4+
"description": "Library to manipulate Marlowe Core contracts",
5+
"repository": "https://github.com/input-output-hk/marlowe-ts-sdk",
6+
"publishConfig": {
7+
"access": "public"
8+
},
9+
"contributors": [
10+
"Nicolas Henin <nicolas.henin@iohk.io> (https://iohk.io)",
11+
"Hernan Rajchert <hernan.rajchert@iohk.io> (https://iohk.io)",
12+
"Bjorn Kihlberg <bjorn.kihlberg@iohk.io> (https://iohk.io)"
13+
],
14+
"license": "Apache-2.0",
15+
"scripts": {
16+
"build": "tsc --build src",
17+
"clean": "tsc --build --clean src ",
18+
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest --config test/jest.unit.config.mjs"
19+
},
20+
"type": "module",
21+
"exports": {
22+
".": "./dist/semantics/contract/index.js",
23+
"./examples": "./dist/examples/index.js",
24+
"./next": "./dist/semantics/next/index.js",
25+
"./environment": "./dist/semantics/environment.js",
26+
"./state": "./dist/semantics/state.js"
27+
},
28+
29+
"dependencies": {
30+
"@blockfrost/blockfrost-js": "5.2.0",
31+
"@blockfrost/openapi": "0.1.54",
32+
"@emurgo/cardano-serialization-lib-browser":"11.4.0",
33+
"@types/deep-equal": "1.0.1",
34+
"@types/qs" : "6.9.7",
35+
"qs" : "6.11.1" ,
36+
"axios": "^1.3.3",
37+
"axios-curlirize": "^2.0.0",
38+
"date-fns": "2.29.3",
39+
"deep-equal": "1.0.1",
40+
"dotenv": "^16.0.3",
41+
"fp-ts": "^2.16.0",
42+
"json-bigint": "^1.0.0",
43+
"lucid-cardano": "0.9.4",
44+
"ts-adt": "^2.0.2",
45+
"ts-pattern": "^4.2.0",
46+
"retry-ts":"0.1.4",
47+
"newtype-ts":"0.3.5",
48+
"monocle-ts":"2.3.13",
49+
"io-ts":"2.2.20",
50+
"io-ts-types":"0.5.19",
51+
"io-ts-bigint":"2.0.1",
52+
"jsonbigint-io-ts-reporters":"2.0.1"
53+
}
54+
}

src/language/core/v1/examples/contract-one-notify.ts renamed to packages/language/core/v1/src/examples/contract-one-notify.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
/* eslint-disable sort-keys-fix/sort-keys-fix */
22

3-
import { Contract } from "../semantics/contract";
4-
import { close } from "../semantics/contract/close";
5-
import { Timeout } from "../semantics/contract/when";
3+
import { Contract } from "../semantics/contract/index.js";
4+
import { close } from "../semantics/contract/close.js";
5+
import { Timeout } from "../semantics/contract/when/index.js";
66

77

88
/**
99
* Marlowe Example : A contract with One Step (one true notify)
1010
*/
1111

12-
export const oneNotifyTrue : (notifyTimeout:Timeout) => Contract
13-
= (notifyTimeout) =>
12+
export const oneNotifyTrue : (notifyTimeout:Timeout) => Contract
13+
= (notifyTimeout) =>
1414
({ when :[{ case :{ notify_if: true }
1515
, then : close}]
1616
, timeout : notifyTimeout
1717
, timeout_continuation : close})
18-
18+
1919

0 commit comments

Comments
 (0)