Skip to content

Commit

Permalink
fix: broken npm build (#32)
Browse files Browse the repository at this point in the history
Description
---
* Fixed all build problems
* Added new CI job to automatically run `npm run build` on new PRs

Motivation and Context
---
The library build is currently broken. This PR fixes all building
problems and adds a new CI job to run `npm run build` on new PRs, so we
can avoid merging broken code into the `main` branch.

How Has This Been Tested?
---
Running `npm run build`

What process can a PR reviewer use to test or verify this change?
---
See previous section

Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify

<!-- Does this include a breaking change? If so, include this line as a
footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a
database, resync the chain -->
  • Loading branch information
mrnaveira authored Aug 8, 2024
1 parent 0a460ab commit ee9c4e6
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 10 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: CI

'on':
pull_request:
types:
- opened
- reopened
- synchronize

concurrency:
# https://docs.github.com/en/actions/examples/using-concurrency-expressions-and-a-test-matrix
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') || github.ref != 'refs/heads/main' }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm ci
- run: npm run build
2 changes: 1 addition & 1 deletion src/builders/helpers/submitTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function submitAndWaitForTransaction(
result,
};
} catch (e) {
throw new Error("Transaction failed:", e);
throw new Error(`Transaction failed: ${e}`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/builders/types/FinalizeResult.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FeeReceipt, InstructionResult, LogEntry, RejectReason } from "@tariproject/typescript-bindings";
import { FeeReceipt, InstructionResult, LogEntry, RejectReason } from "@tari-project/typescript-bindings";
import { SubstateDiff } from "./SubstateDiff";

export type TxResultAccept = { Accept: SubstateDiff };
Expand Down
2 changes: 1 addition & 1 deletion src/builders/types/Instruction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentAddress, LogLevel } from "@tariproject/typescript-bindings";
import { ComponentAddress, LogLevel } from "@tari-project/typescript-bindings";
import { Arg } from "./Arg";
import { ConfidentialClaim } from "./ConfidentialClaim";
import { Amount } from "./Amount";
Expand Down
2 changes: 1 addition & 1 deletion src/builders/types/SubstateDiff.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Substate, SubstateId } from "@tariproject/typescript-bindings";
import { Substate, SubstateId } from "@tari-project/typescript-bindings";

export type UpSubstates = Array<[SubstateId, Substate]>;
export type DownSubstates = Array<[SubstateId, number]>;
Expand Down
2 changes: 1 addition & 1 deletion src/builders/types/SubstateRequirement.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SubstateId } from "@tariproject/typescript-bindings";
import { SubstateId } from "@tari-project/typescript-bindings";

export interface SubstateRequirement {
substateId: SubstateId;
Expand Down
2 changes: 1 addition & 1 deletion src/builders/types/Transaction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TransactionSignature } from "@tariproject/typescript-bindings";
import { TransactionSignature } from "@tari-project/typescript-bindings";
import { Instruction } from "./Instruction";
import { SubstateRequirement } from "./SubstateRequirement";
import { Epoch } from "./Epoch";
Expand Down
2 changes: 1 addition & 1 deletion src/builders/types/VersionedSubstateId.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SubstateId } from "@tariproject/typescript-bindings";
import { SubstateId } from "@tari-project/typescript-bindings";

export interface VersionedSubstateId {
substateId: SubstateId;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FinalizeResult } from "@tariproject/typescript-bindings";
import { FinalizeResult } from "@tari-project/typescript-bindings";

export type SubstateMetadata = {
substate_id: string;
Expand Down
2 changes: 1 addition & 1 deletion src/templates/Account.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ConfidentialWithdrawProof, NonFungibleId, ResourceAddress } from "@tariproject/typescript-bindings";
import { ConfidentialWithdrawProof, NonFungibleId, ResourceAddress } from "@tari-project/typescript-bindings";
import { Amount } from "../builders/types/Amount";
import { TariMethodDefinition, WorkspaceArg } from "../builders/types";
import { TemplateFactory } from "./TemplateFactory";
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"strict": true,
"noEmit": true
"noEmit": true,
"strictPropertyInitialization": false,
}
}

0 comments on commit ee9c4e6

Please sign in to comment.