-
Notifications
You must be signed in to change notification settings - Fork 120
/
Copy pathcontracts.build.ts
37 lines (31 loc) · 1.03 KB
/
contracts.build.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import fs from "fs";
import path from "path";
import { glob } from "glob";
import { verify } from "./verify";
import { Logger } from "../src/context/logger";
import { __DANGER__disableVersionNumber } from "../src/pipeline/version";
import { allInFolder } from "../src/test/utils/all-in-folder.build";
const packagesPath = path.resolve(__dirname, "output", "*.pkg");
// Read cases
const main = async () => {
// Disable version number in packages
__DANGER__disableVersionNumber();
const logger = new Logger();
// Compile projects
await allInFolder(__dirname, ["*.tact"]);
try {
// Verify projects
for (const pkgPath of glob.sync(path.normalize(packagesPath))) {
const res = await verify({
pkg: fs.readFileSync(pkgPath, "utf-8"),
});
if (!res.ok) {
throw new Error(`Failed to verify ${pkgPath}: ${res.error}`);
}
}
} catch (error) {
logger.error(error as Error);
process.exit(1);
}
};
void main();