mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 22:50:18 +00:00
chore: Compile integration tests with aqua-api [fixes LNG-240] (#884)
This commit is contained in:
parent
03042a71f3
commit
9f863eae43
8
.github/workflows/tests.yml
vendored
8
.github/workflows/tests.yml
vendored
@ -81,8 +81,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
apps: sbt
|
apps: sbt
|
||||||
|
|
||||||
- name: cli-js build
|
- name: aqua-api build
|
||||||
run: sbt "cliJS/fastOptJS"
|
run: sbt "aqua-apiJS/fastOptJS"
|
||||||
|
|
||||||
- name: Setup pnpm
|
- name: Setup pnpm
|
||||||
uses: pnpm/action-setup@v2.4.0
|
uses: pnpm/action-setup@v2.4.0
|
||||||
@ -108,10 +108,6 @@ jobs:
|
|||||||
- run: pnpm install --no-frozen-lockfile
|
- run: pnpm install --no-frozen-lockfile
|
||||||
working-directory: integration-tests
|
working-directory: integration-tests
|
||||||
|
|
||||||
- name: Build cli
|
|
||||||
run: pnpm run build
|
|
||||||
working-directory: cli/cli-npm
|
|
||||||
|
|
||||||
- name: Compile aqua
|
- name: Compile aqua
|
||||||
run: pnpm run compile-aqua
|
run: pnpm run compile-aqua
|
||||||
working-directory: integration-tests
|
working-directory: integration-tests
|
||||||
|
@ -22,14 +22,15 @@
|
|||||||
"pubsub": "node -r ts-node/register src/pubsub.ts",
|
"pubsub": "node -r ts-node/register src/pubsub.ts",
|
||||||
"exec": "npm run compile-aqua && npm run prettify-compiled && node -r ts-node/register src/index.ts",
|
"exec": "npm run compile-aqua && npm run prettify-compiled && node -r ts-node/register src/index.ts",
|
||||||
"run": "node -r ts-node/register src/index.ts",
|
"run": "node -r ts-node/register src/index.ts",
|
||||||
"compile-aqua": "aqua -i ./aqua/ -o ./src/compiled",
|
"compile-aqua": "ts-node ./src/compile.ts",
|
||||||
"compile-aqua:air": "aqua -i ./aqua/ -o ./compiled-air -a",
|
"compile-aqua:air": "aqua -i ./aqua/ -o ./compiled-air -a",
|
||||||
"prettify-compiled": "prettier --write src/compiled",
|
"prettify-compiled": "prettier --write src/compiled",
|
||||||
"aqua": "aqua",
|
"aqua": "aqua",
|
||||||
"do": "aqua dist deploy --addr /dns4/kras-04.fluence.dev/tcp/19001/wss/p2p/12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi --config-path deploy.json --service tsOracle"
|
"do": "aqua dist deploy --addr /dns4/kras-04.fluence.dev/tcp/19001/wss/p2p/12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi --config-path deploy.json --service tsOracle"
|
||||||
},
|
},
|
||||||
|
"prettier": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@fluencelabs/aqua": "0.12.1",
|
"@fluencelabs/aqua-api": "0.12.1",
|
||||||
"@fluencelabs/aqua-dht": "0.2.5",
|
"@fluencelabs/aqua-dht": "0.2.5",
|
||||||
"@fluencelabs/aqua-lib": "0.7.3",
|
"@fluencelabs/aqua-lib": "0.7.3",
|
||||||
"@types/jest": "29.5.2",
|
"@types/jest": "29.5.2",
|
||||||
|
32
integration-tests/src/compile.ts
Normal file
32
integration-tests/src/compile.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import { compileFromPath } from "@fluencelabs/aqua-api";
|
||||||
|
import { mkdir, writeFile } from "node:fs/promises";
|
||||||
|
import { resolve, parse, format, dirname } from "node:path";
|
||||||
|
|
||||||
|
const inputPath = resolve("./aqua");
|
||||||
|
|
||||||
|
const result = await compileFromPath({
|
||||||
|
filePath: "aqua",
|
||||||
|
imports: ["node_modules"],
|
||||||
|
targetType: "ts",
|
||||||
|
});
|
||||||
|
|
||||||
|
const outputPath = resolve("./src/compiled");
|
||||||
|
await mkdir(outputPath, { recursive: true });
|
||||||
|
|
||||||
|
if (result.errors.length > 0) {
|
||||||
|
throw new Error(result.errors.join("\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
await Promise.all(
|
||||||
|
result.generatedSources.map(async (src) => {
|
||||||
|
const outFilePath = resolve(src.name).replace(inputPath, outputPath);
|
||||||
|
const outputTsPath = format({
|
||||||
|
...parse(outFilePath),
|
||||||
|
base: "",
|
||||||
|
ext: ".ts",
|
||||||
|
});
|
||||||
|
|
||||||
|
await mkdir(dirname(outputTsPath), { recursive: true });
|
||||||
|
await writeFile(outputTsPath, src.tsSource);
|
||||||
|
}),
|
||||||
|
);
|
@ -18,5 +18,8 @@
|
|||||||
"dist",
|
"dist",
|
||||||
"bundle"
|
"bundle"
|
||||||
],
|
],
|
||||||
"include": ["src/**/*"]
|
"include": ["src/**/*"],
|
||||||
|
"ts-node": {
|
||||||
|
"esm": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
4
pnpm-lock.yaml
generated
4
pnpm-lock.yaml
generated
@ -64,9 +64,9 @@ importers:
|
|||||||
specifier: 1.8.1
|
specifier: 1.8.1
|
||||||
version: 1.8.1
|
version: 1.8.1
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@fluencelabs/aqua':
|
'@fluencelabs/aqua-api':
|
||||||
specifier: 0.12.1
|
specifier: 0.12.1
|
||||||
version: link:../cli/cli-npm
|
version: link:../api/api-npm
|
||||||
'@fluencelabs/aqua-dht':
|
'@fluencelabs/aqua-dht':
|
||||||
specifier: 0.2.5
|
specifier: 0.2.5
|
||||||
version: 0.2.5
|
version: 0.2.5
|
||||||
|
Loading…
Reference in New Issue
Block a user