@nikero/updep 0.1.0

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/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # updep
2
+
3
+ Interactive TUI for updating JavaScript dependencies. Works with npm, yarn, pnpm, and bun.
4
+
5
+ ## Installation
6
+
7
+ ### Using npx (no installation needed)
8
+
9
+ ```bash
10
+ npx updep
11
+ ```
12
+
13
+ ### Using other package managers
14
+
15
+ ```bash
16
+ # Bun
17
+ bunx updep
18
+
19
+ # Yarn
20
+ yarn dlx updep
21
+
22
+ # pnpm
23
+ pnpm dlx updep
24
+ ```
25
+
26
+ ### Install globally
27
+
28
+ ```bash
29
+ npm install -g updep
30
+ ```
31
+
32
+ Then run from any project:
33
+
34
+ ```bash
35
+ updep
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ Navigate to your JavaScript project directory and run:
41
+
42
+ ```bash
43
+ npx updep
44
+ ```
45
+
46
+ ### Keybindings
47
+
48
+ - `↑/↓` or `j/k` - Navigate between packages
49
+ - `Space` - Toggle package selection
50
+ - `w` - Select wanted version
51
+ - `l` - Select latest version
52
+ - `q` or `Ctrl+C` - Quit
53
+
54
+ ## Platform Support
55
+
56
+ updep provides pre-built binaries for:
57
+
58
+ - macOS (Apple Silicon & Intel)
59
+ - Linux (ARM64 & x64)
60
+ - Windows (ARM64 & x64)
61
+
62
+ ## Requirements
63
+
64
+ - Node.js 14 or higher
65
+ - npm, yarn, pnpm, or bun installed
66
+ - A JavaScript project with a `package.json` file
67
+
68
+ ## License
69
+
70
+ MIT - see [LICENSE](https://github.com/snikoletopoulos/updep/blob/main/LICENSE)
71
+
72
+ ## Links
73
+
74
+ - [GitHub Repository](https://github.com/snikoletopoulos/updep)
75
+ - [Report Issues](https://github.com/snikoletopoulos/updep/issues)
76
+ - [Discussions](https://github.com/snikoletopoulos/updep/discussions)
package/bin/updep.js ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require("child_process");
4
+ const path = require("path");
5
+ const os = require("os");
6
+
7
+ const binName = os.platform() === "win32" ? "updep.exe" : "updep";
8
+ const binaryPath = path.join(__dirname, binName);
9
+
10
+ // Spawn the binary with all arguments
11
+ const child = spawn(binaryPath, process.argv.slice(2), {
12
+ stdio: "inherit",
13
+ windowsHide: true,
14
+ });
15
+
16
+ child.on("exit", (code, signal) => {
17
+ if (signal) {
18
+ process.kill(process.pid, signal);
19
+ } else {
20
+ process.exit(code);
21
+ }
22
+ });
23
+
24
+ child.on("error", (err) => {
25
+ console.error(`Failed to start updep: ${err.message}`);
26
+ process.exit(1);
27
+ });
package/install.js ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const os = require("os");
6
+
7
+ // Platform mapping
8
+ const PLATFORM_MAP = {
9
+ darwin: {
10
+ arm64: "@updep/darwin-arm64",
11
+ x64: "@updep/darwin-x64",
12
+ },
13
+ linux: {
14
+ arm64: "@updep/linux-arm64",
15
+ x64: "@updep/linux-x64",
16
+ },
17
+ win32: {
18
+ arm64: "@updep/win32-arm64",
19
+ x64: "@updep/win32-x64",
20
+ },
21
+ };
22
+
23
+ function getPlatformPackage() {
24
+ const platform = os.platform();
25
+ const arch = os.arch();
26
+
27
+ // Handle architecture aliases
28
+ const normalizedArch = arch === "aarch64" ? "arm64" : arch;
29
+
30
+ if (!PLATFORM_MAP[platform]) {
31
+ throw new Error(
32
+ `Unsupported platform: ${platform}. updep supports darwin, linux, and win32.`
33
+ );
34
+ }
35
+
36
+ if (!PLATFORM_MAP[platform][normalizedArch]) {
37
+ throw new Error(
38
+ `Unsupported architecture: ${normalizedArch} on ${platform}. updep supports x64 and arm64.`
39
+ );
40
+ }
41
+
42
+ return PLATFORM_MAP[platform][normalizedArch];
43
+ }
44
+
45
+ function install() {
46
+ try {
47
+ const packageName = getPlatformPackage();
48
+ const binName = os.platform() === "win32" ? "updep.exe" : "updep";
49
+
50
+ // Try to find the platform-specific package
51
+ let binaryPath;
52
+ try {
53
+ binaryPath = require.resolve(`${packageName}/${binName}`);
54
+ } catch (e) {
55
+ console.warn(
56
+ `Warning: Could not find platform-specific package ${packageName}.`
57
+ );
58
+ console.warn(
59
+ "This is expected during development. In production, npm will install the correct package."
60
+ );
61
+ return;
62
+ }
63
+
64
+ // Create bin directory
65
+ const binDir = path.join(__dirname, "bin");
66
+ if (!fs.existsSync(binDir)) {
67
+ fs.mkdirSync(binDir, { recursive: true });
68
+ }
69
+
70
+ // Copy binary to bin directory
71
+ const targetPath = path.join(binDir, binName);
72
+ fs.copyFileSync(binaryPath, targetPath);
73
+ fs.chmodSync(targetPath, 0o755);
74
+
75
+ console.log(`✓ updep installed successfully for ${os.platform()}-${os.arch()}`);
76
+ } catch (error) {
77
+ console.error("Error installing updep:", error.message);
78
+ process.exit(1);
79
+ }
80
+ }
81
+
82
+ install();
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@nikero/updep",
3
+ "version": "0.1.0",
4
+ "description": "Interactive TUI for updating JavaScript dependencies",
5
+ "author": "Stavros Nikolopoulos",
6
+ "license": "MIT",
7
+ "repository": "github:snikoletopoulos/updep",
8
+ "keywords": [
9
+ "npm",
10
+ "yarn",
11
+ "pnpm",
12
+ "bun",
13
+ "dependencies",
14
+ "update",
15
+ "cli",
16
+ "tui",
17
+ "package-manager"
18
+ ],
19
+ "bin": {
20
+ "updep": "./bin/updep.js"
21
+ },
22
+ "scripts": {
23
+ "postinstall": "node install.js"
24
+ },
25
+ "optionalDependencies": {
26
+ "@updep/darwin-arm64": "0.1.0",
27
+ "@updep/darwin-x64": "0.1.0",
28
+ "@updep/linux-arm64": "0.1.0",
29
+ "@updep/linux-x64": "0.1.0",
30
+ "@updep/win32-arm64": "0.1.0",
31
+ "@updep/win32-x64": "0.1.0"
32
+ },
33
+ "engines": {
34
+ "node": ">=14"
35
+ },
36
+ "files": [
37
+ "bin",
38
+ "install.js"
39
+ ]
40
+ }