Merge pull request #18 from andrei0x309/dev/10

Dev/10
This commit is contained in:
Andrei O. 2025-01-20 02:06:08 +02:00 committed by GitHub
commit 6494686d83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 126 additions and 39 deletions

View File

@ -1,5 +1,13 @@
# Changelog # Changelog
## Manifest Version 1.4.10
- changed release script to automatically take the changes from the CHANGELOG.md
- bumped all dependencies to the latest versions
- improved network selection UI and UX ( network selection view )
- minor UI change to main view of the wallet
- fixed release script to work with `bun` package manager
## Manifest Version 1.4.9 ## Manifest Version 1.4.9
- updated dependencies and Vite to 6 - updated dependencies and Vite to 6

BIN
bun.lockb

Binary file not shown.

View File

@ -20,8 +20,8 @@
"dependencies": { "dependencies": {
"@ionic/vue": "^8.4.1", "@ionic/vue": "^8.4.1",
"@ionic/vue-router": "^8.4.1", "@ionic/vue-router": "^8.4.1",
"core-js": "^3.39.0", "core-js": "^3.40.0",
"ethers": "^6.13.4", "ethers": "^6.13.5",
"qr-scanner": "^1.4.2", "qr-scanner": "^1.4.2",
"vue": "^3.5.13", "vue": "^3.5.13",
"vue-router": "^4.5.0" "vue-router": "^4.5.0"
@ -29,26 +29,26 @@
"devDependencies": { "devDependencies": {
"@crxjs/vite-plugin": "2.0.0-beta.28", "@crxjs/vite-plugin": "2.0.0-beta.28",
"@types/archiver": "^6.0.3", "@types/archiver": "^6.0.3",
"@types/chrome": "^0.0.287", "@types/chrome": "^0.0.297",
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"@types/node": "^22.10.2", "@types/node": "^22.10.7",
"@typescript-eslint/eslint-plugin": "^8.18.2", "@typescript-eslint/eslint-plugin": "^8.20.0",
"@typescript-eslint/parser": "^8.18.2", "@typescript-eslint/parser": "^8.20.0",
"@vitejs/plugin-vue": "^5.2.1", "@vitejs/plugin-vue": "^5.2.1",
"@vue/eslint-config-typescript": "^14.2.0", "@vue/eslint-config-typescript": "^14.3.0",
"archiver": "^7.0.1", "archiver": "^7.0.1",
"eslint": "^9.17.0", "eslint": "^9.18.0",
"eslint-plugin-vue": "^9.32.0", "eslint-plugin-vue": "^9.32.0",
"http-browserify": "^1.7.0", "http-browserify": "^1.7.0",
"https-browserify": "^1.0.0", "https-browserify": "^1.0.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"sass": "^1.83.0", "sass": "^1.83.4",
"stream-browserify": "^3.0.0", "stream-browserify": "^3.0.0",
"ts-jest": "^29.2.5", "ts-jest": "^29.2.5",
"tsx": "^4.19.2", "tsx": "^4.19.2",
"typescript": "^5.7.2", "typescript": "^5.7.3",
"util": "^0.12.5", "util": "^0.12.5",
"vite": "^6.0.5", "vite": "^6.0.7",
"vue-tsc": "^2.2.0" "vue-tsc": "^2.2.0"
}, },
"disabledNativeDependencies": { "disabledNativeDependencies": {

View File

@ -1,7 +1,65 @@
const pFs = import('fs') const pFs = import('fs')
const pCps = import('child_process') const pCps = import('child_process')
async function ghRelease (changes: string[], isRebuild: boolean) {
async function readFirst2000Characters(filePath: string): Promise<string> {
const fs = (await pFs).default
try {
const fileStream = fs.createReadStream(filePath, { encoding: 'utf8' });
let data = '';
for await (const chunk of fileStream) {
data += chunk;
if (data.length >= 2000) {
break;
}
}
return data.substring(0, 2000);
} catch (err) {
console.error(`Error reading file: ${err}`);
throw err;
}
}
function limitedSplit(str: string, delimiter: string, limit: number): string[] {
if (limit <= 0) {
throw new Error("Limit must be greater than 0");
}
const result: string[] = [];
let current = 0;
let found;
do {
found = str.indexOf(delimiter, current);
if (found === -1 || result.length === limit - 1) {
result.push(str.substring(current));
break;
}
result.push(str.substring(current, found));
current = found + delimiter.length;
} while (true);
return result;
}
const getLastChangeLog = async () => {
const mainChainLogPath = 'CHANGELOG.md';
const fs = (await pFs).default
if (!fs.existsSync(mainChainLogPath)) {
return '';
}
const mainChainLog = await readFirst2000Characters(mainChainLogPath)
const manifestVersions = limitedSplit(mainChainLog, '## ', 2)[1]
const changesText = '## ' + manifestVersions
return changesText
}
async function ghRelease (isRebuild: boolean) {
const fs = (await pFs).default const fs = (await pFs).default
if (!fs.existsSync('releases')) { if (!fs.existsSync('releases')) {
@ -38,14 +96,12 @@ async function ghRelease (changes: string[], isRebuild: boolean) {
fs.writeFileSync( fs.writeFileSync(
changeLogPath, changeLogPath,
`# ${pkg.version} \n `# ${pkg.version} \n
${changes.reduce((acc: string, change: string) => { ${await getLastChangeLog()}`,
return acc + `- ${change}\n`;
}, '')}`,
); );
const cps = (await pCps) const cps = (await pCps)
console.log( console.log(
await new Promise((resolve) => { await new Promise((resolve) => {
const p = cps.spawn('gh', ['release', 'create', `v${pkg.version}`, `./${outputPath}`, '-F', `./${changeLogPath}`], { const p = cps.spawn('gh', ['release', 'create', `v${pkg.version}`, `./${outputPath}`, '-F', `./${changeLogPath}`, '--target', 'main'], {
shell: true, shell: true,
}); });
let result = ''; let result = '';
@ -60,14 +116,9 @@ async function ghRelease (changes: string[], isRebuild: boolean) {
} }
(async () => { (async () => {
if (!process.argv[2]) {
console.log('No changes provided');
return;
}
const changes = process.argv[2].split(',');
const isRebuild = changes.includes('rebuild'); const isRebuild = process.argv[2] === 'rebuild';
await ghRelease(changes, isRebuild); await ghRelease(isRebuild);
console.log('Release created', changes); console.log('Release created');
})(); })();

View File

@ -3,8 +3,8 @@
"name": "__MSG_appName__", "name": "__MSG_appName__",
"description": "__MSG_appDesc__", "description": "__MSG_appDesc__",
"default_locale": "en", "default_locale": "en",
"version": "1.4.9", "version": "1.4.10",
"version_name": "1.4.9", "version_name": "1.4.10",
"icons": { "icons": {
"16": "assets/extension-icon/wallet_16.png", "16": "assets/extension-icon/wallet_16.png",
"32": "assets/extension-icon/wallet_32.png", "32": "assets/extension-icon/wallet_32.png",

View File

@ -106,11 +106,14 @@
button button
@click="copyText(String(selectedNetwork?.chainId), getToastRef())" @click="copyText(String(selectedNetwork?.chainId), getToastRef())"
style="cursor: pointer" style="cursor: pointer"
>Selected Network ID: >Selected Network ID:&nbsp;
<span style="color: #645285; font-weight: bold">{{ <span style="color: #645285; font-weight: bold">{{
selectedNetwork?.chainId selectedNetwork?.chainId
}}</span> }}</span>
<ion-icon style="margin-left: 0.5rem" :icon="copyOutline"></ion-icon> <ion-icon
style="margin-left: 0.5rem; top: 2px; position: relative"
:icon="copyOutline"
></ion-icon>
</ion-label> </ion-label>
<ion-button <ion-button
@click=" @click="
@ -230,14 +233,13 @@
<ion-buttons slot="start"> <ion-buttons slot="start">
<ion-button @click="networksModal = false">Close</ion-button> <ion-button @click="networksModal = false">Close</ion-button>
</ion-buttons> </ion-buttons>
<ion-title>Select</ion-title> <ion-title>Select Network</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content class="ion-padding"> <ion-content class="ion-padding">
<ion-list style="margin-bottom: 4rem"> <ion-list style="margin-bottom: 4rem">
<ion-radio-group :value="selectedNetwork.chainId"> <ion-radio-group :value="selectedNetwork.chainId">
<ion-list-header> <ion-list-header>
<ion-label>Networks</ion-label>
<ion-searchbar <ion-searchbar
autocomplete="off" autocomplete="off"
autocorrect="off" autocorrect="off"
@ -262,18 +264,44 @@
slot="start" slot="start"
:value="network.chainId" :value="network.chainId"
:aria-label="network.name" :aria-label="network.name"
labelPlacement="start"
mode="ios"
justify="space-between"
> >
<span style="opacity: 0.7; font-size: 0.8rem"> <div>
ID: {{ network.chainId }} -> <ion-avatar
</span> v-if="(allTemplateNets as any)[network.chainId]?.icon"
{{ network.name }} style="
margin-right: 0.5rem;
width: 1.4rem;
height: 1.4rem;
margin-bottom: 0.5rem;
"
>
<img
:alt="selectedNetwork?.name"
:src="getUrl('assets/chain-icons/' + (allTemplateNets as any)[network.chainId]?.icon)"
/>
</ion-avatar>
{{
(network.name?.length || 0) > 18
? (network.name || "").slice(0, 15) + "..."
: network.name
}}&nbsp;
<span style="opacity: 0.7; font-size: 0.7rem">
({{ network.chainId }})
</span>
</div>
<div>
<ion-text style="opacity: 0.9; font-size: 0.85rem"
>RPC:&nbsp;</ion-text
>
<ion-text style="opacity: 0.8; font-size: 0.75rem">{{
network.rpc.replace("https://", "").replace("http://", "")
}}</ion-text>
</div>
</ion-radio> </ion-radio>
</ion-item> </ion-item>
<ion-item>
<ion-text style="opacity: 0.8; font-size: 0.85rem">{{
network.rpc
}}</ion-text>
</ion-item>
</ion-list> </ion-list>
</ion-radio-group> </ion-radio-group>
</ion-list> </ion-list>