@bobfrankston/msger 0.1.164 ā 0.1.166
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -3
- package/utils/install-latest.ts +42 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/msger",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.166",
|
|
4
4
|
"description": "Fast, lightweight, cross-platform message box - Rust-powered alternative to msgview",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -26,8 +26,7 @@
|
|
|
26
26
|
"preversion": "npm run build:ts && npm run build:native && git add -A",
|
|
27
27
|
"postversion": "git push && git push --tags",
|
|
28
28
|
"release": "npm run prerelease:local && npm version patch && npm publish --quiet",
|
|
29
|
-
"installer": "npm run release && node utils/install-latest.ts"
|
|
30
|
-
"installer:wait": "npm run release && npm cache clean --force && npm install -g @bobfrankston/msger@latest && wsl npm cache clean --force && wsl npm install -g @bobfrankston/msger@latest"
|
|
29
|
+
"installer": "npm run release && node utils/install-latest.ts"
|
|
31
30
|
},
|
|
32
31
|
"keywords": [
|
|
33
32
|
"message-box",
|
package/utils/install-latest.ts
CHANGED
|
@@ -16,22 +16,50 @@ const __dirname = dirname(__filename);
|
|
|
16
16
|
const packagePath = join(__dirname, '..', 'package.json');
|
|
17
17
|
const packageJson = JSON.parse(readFileSync(packagePath, 'utf-8'));
|
|
18
18
|
const version = packageJson.version;
|
|
19
|
+
const packageName = packageJson.name;
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
// Function to wait for package to be available on npm registry
|
|
22
|
+
async function waitForPackage(packageName: string, version: string, maxAttempts = 10): Promise<void> {
|
|
23
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
24
|
+
try {
|
|
25
|
+
console.log(`ā³ Checking npm registry (attempt ${attempt}/${maxAttempts})...`);
|
|
26
|
+
execSync(`npm view ${packageName}@${version} version`, { stdio: 'pipe' });
|
|
27
|
+
console.log(`ā Package ${packageName}@${version} is available on npm\n`);
|
|
28
|
+
return;
|
|
29
|
+
} catch (error) {
|
|
30
|
+
if (attempt < maxAttempts) {
|
|
31
|
+
const waitTime = 3000; // 3 seconds
|
|
32
|
+
console.log(` Waiting ${waitTime/1000}s before retry...`);
|
|
33
|
+
await new Promise(resolve => setTimeout(resolve, waitTime));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
throw new Error(`Package ${packageName}@${version} not available after ${maxAttempts} attempts`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function main() {
|
|
41
|
+
console.log(`\nš¦ Installing ${packageName}@${version}...\n`);
|
|
21
42
|
|
|
22
|
-
try {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
execSync('npm cache clean --force', { stdio: 'inherit' });
|
|
26
|
-
execSync(`npm install -g @bobfrankston/msger@${version}`, { stdio: 'inherit' });
|
|
43
|
+
try {
|
|
44
|
+
// Wait for package to be available on npm registry
|
|
45
|
+
await waitForPackage(packageName, version);
|
|
27
46
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
47
|
+
// Clean and install on Windows
|
|
48
|
+
console.log('šŖ Windows installation:');
|
|
49
|
+
execSync('npm cache clean --force', { stdio: 'inherit' });
|
|
50
|
+
execSync(`npm install -g ${packageName}@${version}`, { stdio: 'inherit' });
|
|
32
51
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
52
|
+
// Clean and install on WSL
|
|
53
|
+
console.log('\nš§ WSL installation:');
|
|
54
|
+
execSync('wsl npm cache clean --force', { stdio: 'inherit' });
|
|
55
|
+
execSync(`wsl npm install -g @bobfrankston/msger@${version}`, { stdio: 'inherit' });
|
|
56
|
+
|
|
57
|
+
console.log(`\nā
Successfully installed version ${version} on Windows and WSL\n`);
|
|
58
|
+
} catch (error: any) {
|
|
59
|
+
console.error(`\nā Installation failed: ${error.message}\n`);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
37
62
|
}
|
|
63
|
+
|
|
64
|
+
// Run the main function
|
|
65
|
+
main();
|