Skip to content

Commit cbc2309

Browse files
authored
Also run dprint action for js, ts and json (iotaledger#1131)
1 parent af78f22 commit cbc2309

21 files changed

+127
-124
lines changed

.github/workflows/format.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
- '.github/workflows/format.yml'
1313
- '**.rs'
1414
- '**.toml'
15+
- '**.ts'
16+
- '**.js'
17+
- '**.json'
1518

1619
jobs:
1720
format:

bindings/wasm/build/replace_paths.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ const path = require("path");
1111

1212
function replace(tsconfig, dist, mode) {
1313
// Read tsconfig file.
14-
const tsconfigPath = path.join(__dirname, '..', tsconfig);
14+
const tsconfigPath = path.join(__dirname, "..", tsconfig);
1515
console.log(`\n using ${tsconfigPath}`);
16-
let data = JSON.parse(fs.readFileSync(path.join(__dirname, '..', tsconfig), "utf8"));
16+
let data = JSON.parse(fs.readFileSync(path.join(__dirname, "..", tsconfig), "utf8"));
1717
let a = data.compilerOptions.paths;
1818
let keys = Object.keys(a);
1919

@@ -29,13 +29,13 @@ function replace(tsconfig, dist, mode) {
2929
let fileData = fs.readFileSync(file, "utf8");
3030
for (let key of keys) {
3131
let value = a[key][1] ?? a[key][0];
32-
32+
3333
const absoluteIncludePath = path.resolve(path.dirname(tsconfigPath), value);
3434
if (mode == "resolve" && fs.existsSync(absoluteIncludePath)) {
3535
const absoluteFilePath = path.resolve(path.dirname(file));
3636
console.log(`\t calculating path from ${absoluteFilePath} to ${absoluteIncludePath}`);
3737
// replace `\` with `/` to convert windows paths to node compatible imports
38-
value = path.relative(absoluteFilePath, absoluteIncludePath).replace(/\\/g, '/');
38+
value = path.relative(absoluteFilePath, absoluteIncludePath).replace(/\\/g, "/");
3939
}
4040

4141
console.log(`\t replace ${key} with ${value}`);
@@ -46,9 +46,10 @@ function replace(tsconfig, dist, mode) {
4646
}
4747

4848
const readdirSync = (p, a = []) => {
49-
if (fs.statSync(p).isDirectory())
50-
fs.readdirSync(p).map(f => readdirSync(a[a.push(path.join(p, f)) - 1], a))
51-
return a
52-
}
49+
if (fs.statSync(p).isDirectory()) {
50+
fs.readdirSync(p).map(f => readdirSync(a[a.push(path.join(p, f)) - 1], a));
51+
}
52+
return a;
53+
};
5354

54-
replace(process.argv[2], process.argv[3], process.argv[4]);
55+
replace(process.argv[2], process.argv[3], process.argv[4]);

bindings/wasm/cypress.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ export default defineConfig({
66
requestTimeout: 10000,
77
defaultCommandTimeout: 60000,
88
retries: {
9-
runMode: 3
9+
runMode: 3,
1010
},
1111
e2e: {
1212
supportFile: false,
13-
}
13+
},
1414
});
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { setup } from '../../support/setup';
21
import { createIdentity } from "../../../examples/dist/web/0_basic/0_create_did";
2+
import { setup } from "../../support/setup";
33

44
describe(
5-
"createIdentity",
6-
() => {
7-
it("Create Identity", async () => {
8-
await setup(createIdentity);
9-
});
10-
}
5+
"createIdentity",
6+
() => {
7+
it("Create Identity", async () => {
8+
await setup(createIdentity);
9+
});
10+
},
1111
);
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { setup } from '../../support/setup';
21
import { updateIdentity } from "../../../examples/dist/web/0_basic/1_update_did";
2+
import { setup } from "../../support/setup";
33

44
describe(
5-
"updateIdentity",
6-
() => {
7-
it("Update Identity", async () => {
8-
await setup(updateIdentity)
9-
});
10-
}
5+
"updateIdentity",
6+
() => {
7+
it("Update Identity", async () => {
8+
await setup(updateIdentity);
9+
});
10+
},
1111
);
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { setup } from '../../support/setup';
21
import { resolveIdentity } from "../../../examples/dist/web/0_basic/2_resolve_did";
2+
import { setup } from "../../support/setup";
33

44
describe(
5-
"resolveIdentity",
6-
() => {
7-
it("Resolve Identity", async () => {
8-
await setup(resolveIdentity)
9-
});
10-
}
5+
"resolveIdentity",
6+
() => {
7+
it("Resolve Identity", async () => {
8+
await setup(resolveIdentity);
9+
});
10+
},
1111
);
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { setup } from '../../support/setup';
21
import { deactivateIdentity } from "../../../examples/dist/web/0_basic/3_deactivate_did";
2+
import { setup } from "../../support/setup";
33

44
describe(
5-
"deactivateIdentity",
6-
() => {
7-
it("Deactivate Identity", async () => {
8-
await setup(deactivateIdentity)
9-
});
10-
}
5+
"deactivateIdentity",
6+
() => {
7+
it("Deactivate Identity", async () => {
8+
await setup(deactivateIdentity);
9+
});
10+
},
1111
);
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { setup } from '../../support/setup';
21
import { deleteIdentity } from "../../../examples/dist/web/0_basic/4_delete_did";
2+
import { setup } from "../../support/setup";
33

44
describe(
5-
"deleteIdentity",
6-
() => {
7-
it("Delete Identity", async () => {
8-
await setup(deleteIdentity)
9-
});
10-
}
5+
"deleteIdentity",
6+
() => {
7+
it("Delete Identity", async () => {
8+
await setup(deleteIdentity);
9+
});
10+
},
1111
);
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { setup } from '../../support/setup';
21
import { createVC } from "../../../examples/dist/web/0_basic/5_create_vc";
2+
import { setup } from "../../support/setup";
33

44
describe(
5-
"createVC",
6-
() => {
7-
it("Create Credential", async () => {
8-
await setup(createVC)
9-
});
10-
}
5+
"createVC",
6+
() => {
7+
it("Create Credential", async () => {
8+
await setup(createVC);
9+
});
10+
},
1111
);
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { setup } from '../../support/setup';
21
import { createVP } from "../../../examples/dist/web/0_basic/6_create_vp";
2+
import { setup } from "../../support/setup";
33

44
describe(
5-
"createVP",
6-
() => {
7-
it("Create Presentation", async () => {
8-
await setup(createVP)
9-
});
10-
}
5+
"createVP",
6+
() => {
7+
it("Create Presentation", async () => {
8+
await setup(createVP);
9+
});
10+
},
1111
);
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { setup } from '../../support/setup';
21
import { revokeVC } from "../../../examples/dist/web/0_basic/7_revoke_vc";
2+
import { setup } from "../../support/setup";
33

44
describe(
5-
"revokeVC",
6-
() => {
7-
it("Revoke Credential", async () => {
8-
await setup(revokeVC)
9-
});
10-
}
5+
"revokeVC",
6+
() => {
7+
it("Revoke Credential", async () => {
8+
await setup(revokeVC);
9+
});
10+
},
1111
);
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { setup } from '../../support/setup';
21
import { didControlsDid } from "../../../examples/dist/web/1_advanced/0_did_controls_did";
2+
import { setup } from "../../support/setup";
33

44
describe(
5-
"didControlsDid",
6-
() => {
7-
it("DID Controls DID", async () => {
8-
await setup(didControlsDid)
9-
});
10-
}
5+
"didControlsDid",
6+
() => {
7+
it("DID Controls DID", async () => {
8+
await setup(didControlsDid);
9+
});
10+
},
1111
);
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { setup } from '../../support/setup';
21
import { didIssuesNft } from "../../../examples/dist/web/1_advanced/1_did_issues_nft";
2+
import { setup } from "../../support/setup";
33

44
describe(
5-
"didIssuesNft",
6-
() => {
7-
it("DID Issues NFT", async () => {
8-
await setup(didIssuesNft)
9-
});
10-
}
5+
"didIssuesNft",
6+
() => {
7+
it("DID Issues NFT", async () => {
8+
await setup(didIssuesNft);
9+
});
10+
},
1111
);
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { setup } from '../../support/setup';
21
import { nftOwnsDid } from "../../../examples/dist/web/1_advanced/2_nft_owns_did";
2+
import { setup } from "../../support/setup";
33

44
describe(
5-
"nftOwnsDid",
6-
() => {
7-
it("NFT owns DID", async () => {
8-
await setup(nftOwnsDid)
9-
});
10-
}
5+
"nftOwnsDid",
6+
() => {
7+
it("NFT owns DID", async () => {
8+
await setup(nftOwnsDid);
9+
});
10+
},
1111
);
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { setup } from '../../support/setup';
21
import { didIssuesTokens } from "../../../examples/dist/web/1_advanced/3_did_issues_tokens";
2+
import { setup } from "../../support/setup";
33

44
describe(
5-
"didIssuesTokens",
6-
() => {
7-
it("DID Issues Tokens", async () => {
8-
await setup(didIssuesTokens)
9-
});
10-
}
5+
"didIssuesTokens",
6+
() => {
7+
it("DID Issues Tokens", async () => {
8+
await setup(didIssuesTokens);
9+
});
10+
},
1111
);
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { setup } from '../../support/setup';
21
import { keyExchange } from "../../../examples/dist/web/1_advanced/4_key_exchange";
2+
import { setup } from "../../support/setup";
33

44
describe(
5-
"keyExchange",
6-
() => {
7-
it("Key Exchange", async () => {
8-
await setup(keyExchange)
9-
});
10-
}
5+
"keyExchange",
6+
() => {
7+
it("Key Exchange", async () => {
8+
await setup(keyExchange);
9+
});
10+
},
1111
);
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { setup } from '../../support/setup';
21
import { customResolution } from "../../../examples/dist/web/1_advanced/5_custom_resolution";
2+
import { setup } from "../../support/setup";
33

44
describe(
5-
"customResolution",
6-
() => {
7-
it("Custom Resolution", async () => {
8-
await setup(customResolution)
9-
});
10-
}
5+
"customResolution",
6+
() => {
7+
it("Custom Resolution", async () => {
8+
await setup(customResolution);
9+
});
10+
},
1111
);
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { setup } from '../../support/setup';
21
import { domainLinkage } from "../../../examples/dist/web/1_advanced/6_domain_linkage";
2+
import { setup } from "../../support/setup";
33

44
describe(
5-
"domainLinkage",
6-
() => {
7-
it("Domain Linkage", async () => {
8-
await setup(domainLinkage)
9-
});
10-
}
5+
"domainLinkage",
6+
() => {
7+
it("Domain Linkage", async () => {
8+
await setup(domainLinkage);
9+
});
10+
},
1111
);

bindings/wasm/cypress/support/setup.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import * as client from "@iota/client-wasm/web";
22
import * as identity from "../../web";
33

44
export const setup = async (func) => {
5-
await client
6-
.init('../../../node_modules/@iota/client-wasm/web/wasm/client_wasm_bg.wasm')
7-
.then(async () => await identity.init('../../../web/identity_wasm_bg.wasm'))
8-
.then(func)
9-
}
5+
await client
6+
.init("../../../node_modules/@iota/client-wasm/web/wasm/client_wasm_bg.wasm")
7+
.then(async () => await identity.init("../../../web/identity_wasm_bg.wasm"))
8+
.then(func);
9+
};

bindings/wasm/examples/src/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Client, SecretManager } from "@iota/client-wasm/node";
2-
import { AddressTypes, Bech32Helper, IAliasOutput } from "@iota/iota.js";
32
import {
43
IotaDID,
54
IotaDocument,
@@ -9,6 +8,7 @@ import {
98
MethodScope,
109
VerificationMethod,
1110
} from "@iota/identity-wasm/node";
11+
import { AddressTypes, Bech32Helper, IAliasOutput } from "@iota/iota.js";
1212

1313
export const API_ENDPOINT = "http://localhost:14265";
1414
export const FAUCET_ENDPOINT = "http://localhost:8091/api/enqueue";

dprint.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
],
1212
"excludes": [
1313
"documentation",
14-
"bindings/wasm/cypress/**/*.{js,ts}",
1514
"**/{node_modules,target}",
16-
"bindings/wasm/{cypress,node,web}/**/*.{js,ts}",
15+
"bindings/wasm/{node,web}/**/*.{js,ts}",
1716
"bindings/stronghold-nodejs/{napi-dist,dist}/**/*.{js,ts}"
1817
],
1918
"plugins": [

0 commit comments

Comments
 (0)