Skip to content

Commit 1b3256a

Browse files
authored
Feat/upgrade vitest (#425)
* update pkgs * new menu * fmt * add api key * changeset * newest vitest
1 parent dca2509 commit 1b3256a

File tree

10 files changed

+245
-240
lines changed

10 files changed

+245
-240
lines changed

.changeset/shaggy-dingos-notice.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@moonwall/types": patch
3+
"@moonwall/util": patch
4+
"@moonwall/cli": patch
5+
"@moonwall/tests": patch
6+
---
7+
8+
Update Vitest
9+
- Use Vitest 2.0.0
10+
- New menu graphics!
11+
- GITHUB_TOKEN support on downloader feature

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
- "**"
66
env:
77
WSS_URL: ws://127.0.0.1:9955
8+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89

910
jobs:
1011
build:

packages/cli/package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@
7070
"@polkadot/types-codec": "12.1.1",
7171
"@polkadot/util": "12.6.2",
7272
"@polkadot/util-crypto": "12.6.2",
73-
"@vitest/ui": "1.6.0",
73+
"@vitest/ui": "2.0.1",
7474
"@zombienet/orchestrator": "0.0.87",
7575
"@zombienet/utils": "0.0.25",
7676
"bottleneck": "2.19.5",
77+
"cfonts": "^3.3.0",
7778
"chalk": "5.3.0",
7879
"clear": "0.1.0",
7980
"cli-progress": "3.12.0",
@@ -87,8 +88,9 @@
8788
"jsonc-parser": "3.3.1",
8889
"minimatch": "9.0.5",
8990
"semver": "7.6.2",
90-
"viem": "2.17.0",
91-
"vitest": "1.6.0",
91+
"viem": "2.17.3",
92+
"vitest": "2.0.1",
93+
"vue": "^3.4.31",
9294
"web3": "4.10.0",
9395
"web3-providers-ws": "^4.0.7",
9496
"ws": "8.18.0",
@@ -104,10 +106,10 @@
104106
"devDependencies": {
105107
"@biomejs/biome": "1.8.3",
106108
"@types/clear": "^0.1.4",
107-
"@types/cli-progress": "3.11.5",
109+
"@types/cli-progress": "3.11.6",
108110
"@types/debug": "4.1.12",
109111
"@types/inquirer": "^9.0.7",
110-
"@types/node": "20.14.9",
112+
"@types/node": "20.14.10",
111113
"@types/semver": "^7.5.8",
112114
"@types/ws": "^8.5.10",
113115
"@types/yargs": "17.0.32",

packages/cli/src/cmds/main.ts

Lines changed: 17 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import chalk from "chalk";
33
import clear from "clear";
44
import colors from "colors";
55
import fs from "node:fs";
6+
import cfonts from "cfonts";
67
import inquirer from "inquirer";
78
import PressToContinuePrompt from "inquirer-press-to-continue";
89
import path from "node:path";
@@ -445,55 +446,24 @@ const printIntro = async () => {
445446
console.error(`Fetch Error: ${error}`);
446447
}
447448

448-
const logo =
449-
chalk.cyan(`\n
450-
####################
451-
############################
452-
###################################
453-
########################################
454-
###########################################
455-
##############################################
456-
################################################
457-
.#################################################
458-
##################################################
459-
##################################################
460-
`) +
461-
chalk.red(`
462-
🧱🧱🧱 🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱 🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱
463-
🧱🧱🧱🧱 🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱
464-
🧱🧱🧱 🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱
465-
🧱🧱 🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱 🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱
466-
🧱🧱 🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱 🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱
467-
🧱🧱🧱 🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱
468-
🧱🧱🧱🧱 🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱🧱
469-
470-
\n`);
471-
process.stdout.write(logo);
472-
process.stdout.write(
473-
colors.rainbow(
474-
"================================================================================\n"
475-
)
476-
);
449+
cfonts.say("Moonwall", {
450+
gradient: ["#FF66FF", "#9966FF", "#99CCFF", "#99FFFF", "#33FFFF", "#3366FF"],
451+
transitionGradient: true,
452+
lineHeight: 4,
453+
});
477454

478-
if (remoteVersion !== "unknown" && lt(currentVersion, new SemVer(remoteVersion))) {
479-
process.stdout.write(
480-
chalk.bgCyan.white(
481-
` MOONWALL V${currentVersion.version} (New version ${remoteVersion} available!) \n`
482-
)
483-
);
484-
} else {
485-
process.stdout.write(
486-
chalk.bgCyan.white(
487-
` MOONWALL V${currentVersion.version} \n`
488-
)
489-
);
490-
}
455+
const versionText =
456+
remoteVersion !== "unknown" && lt(currentVersion, new SemVer(remoteVersion))
457+
? `V${currentVersion.version} (New version ${remoteVersion} available!) ${currentVersion.version}`
458+
: `V${currentVersion.version}`;
491459

492-
process.stdout.write(
493-
colors.rainbow(
494-
"================================================================================\n"
495-
)
496-
);
460+
const dividerLength = 90;
461+
const leftPadding = Math.floor((dividerLength - versionText.length) / 2);
462+
const rightPadding = dividerLength - versionText.length - leftPadding;
463+
464+
const formattedDivider = `${colors.rainbow("=".repeat(leftPadding))}${chalk.bgCyan.grey(versionText)}${colors.rainbow("=".repeat(rightPadding))}\n`;
465+
466+
console.log(formattedDivider);
497467
};
498468

499469
const getExtString = (file: string) => {

packages/cli/src/cmds/runTests.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export async function executeTests(env: Environment, testRunArgs?: testRunArgs)
102102
const options = new VitestOptionsBuilder()
103103
.setReporters(env.reporters || ["default"])
104104
.setOutputFile(env.reportFile)
105+
.setName(env.name)
105106
.setTimeout(env.timeout || globalConfig.defaultTestTimeout)
106107
.setInclude(env.include || ["**/*{test,spec,test_,test-}*{ts,mts,cts}"])
107108
.addThreadConfig(env.multiThreads)
@@ -150,6 +151,7 @@ class VitestOptionsBuilder {
150151
optimizer: { ssr: { enabled: false }, web: { enabled: false } },
151152
},
152153
include: ["**/*{test,spec,test_,test-}*{ts,mts,cts}"],
154+
153155
onConsoleLog(log) {
154156
if (filterList.includes(log.trim())) return false;
155157
if (log.includes("has multiple versions, ensure that there is only one installed.")) {
@@ -158,6 +160,11 @@ class VitestOptionsBuilder {
158160
},
159161
};
160162

163+
setName(name: string): this {
164+
this.options.name = name;
165+
return this;
166+
}
167+
161168
setReporters(reporters: string[]): this {
162169
this.options.reporters = reporters;
163170
return this;

packages/cli/src/internal/cmdFunctions/downloader.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ export async function downloader(url: string, outputPath: string): Promise<void>
1717
console.log("You've passed a WebSocket URL to fetch. Is this intended?");
1818
}
1919

20-
const response = await fetch(url);
20+
const headers: any = {};
21+
if (process.env.GITHUB_TOKEN) {
22+
headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
23+
}
24+
const response = await fetch(url, { headers });
2125

2226
if (!response.body) {
2327
throw new Error("No response body");

packages/types/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@
5959
"@polkadot/types": "12.1.1",
6060
"@polkadot/util": "12.6.2",
6161
"@polkadot/util-crypto": "12.6.2",
62-
"@types/node": "20.14.9",
62+
"@types/node": "20.14.10",
6363
"@zombienet/utils": "0.0.25",
6464
"bottleneck": "2.19.5",
6565
"debug": "4.3.5",
6666
"ethers": "6.13.1",
67-
"viem": "2.17.0",
67+
"viem": "2.17.3",
6868
"web3": "4.10.0"
6969
},
7070
"peerDependencies": {

packages/util/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
"inquirer-press-to-continue": "1.2.0",
7676
"rlp": "3.0.0",
7777
"semver": "7.6.2",
78-
"viem": "2.17.0",
79-
"vitest": "1.6.0",
78+
"viem": "2.17.3",
79+
"vitest": "2.0.1",
8080
"web3": "4.10.0",
8181
"ws": "8.18.0",
8282
"yaml": "2.4.5",
@@ -89,7 +89,7 @@
8989
"devDependencies": {
9090
"@biomejs/biome": "1.8.3",
9191
"@types/debug": "4.1.12",
92-
"@types/node": "20.14.9",
92+
"@types/node": "20.14.10",
9393
"@types/ws": "^8.5.10",
9494
"@types/yargs": "17.0.32",
9595
"tsup": "8.1.0",

0 commit comments

Comments
 (0)