@vercel/vc-native 0.0.0 → 54.2.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.
Files changed (3) hide show
  1. package/bin/vercel +81 -0
  2. package/package.json +26 -2
  3. package/README.md +0 -3
package/bin/vercel ADDED
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+
3
+ const childProcess = require('node:child_process');
4
+ const fs = require('node:fs');
5
+ const os = require('node:os');
6
+ const path = require('node:path');
7
+
8
+ const platformPackages = {
9
+ darwin: {
10
+ arm64: '@vercel/vc-native-darwin-arm64',
11
+ x64: '@vercel/vc-native-darwin-x64',
12
+ },
13
+ linux: {
14
+ arm64: '@vercel/vc-native-linux-arm64',
15
+ x64: '@vercel/vc-native-linux-x64',
16
+ },
17
+ win32: {
18
+ x64: '@vercel/vc-native-win32-x64',
19
+ },
20
+ };
21
+
22
+ const platform = os.platform();
23
+ const arch = os.arch();
24
+ const packageName = platformPackages[platform]?.[arch];
25
+
26
+ if (!packageName) {
27
+ console.error(
28
+ `The native Vercel CLI does not support ${platform}-${arch}. Use \`npm i -g vercel\` for the Node.js-based CLI.`
29
+ );
30
+ process.exit(1);
31
+ }
32
+
33
+ const binaryName = platform === 'win32' ? 'vercel.exe' : 'vercel';
34
+ const binaryPath = findBinary(path.dirname(fs.realpathSync(__filename)));
35
+
36
+ if (!binaryPath) {
37
+ console.error(
38
+ `Could not find ${packageName}. Your package manager may have skipped optional dependencies. Try reinstalling with \`npm i -g @vercel/vc-native --force\`.`
39
+ );
40
+ process.exit(1);
41
+ }
42
+
43
+ const result = childProcess.spawnSync(binaryPath, process.argv.slice(2), {
44
+ stdio: 'inherit',
45
+ windowsHide: false,
46
+ });
47
+
48
+ if (result.error) {
49
+ console.error(result.error.message);
50
+ process.exit(1);
51
+ }
52
+
53
+ if (result.signal) {
54
+ process.kill(process.pid, result.signal);
55
+ }
56
+
57
+ process.exit(typeof result.status === 'number' ? result.status : 1);
58
+
59
+ function findBinary(startDir) {
60
+ let current = startDir;
61
+
62
+ for (;;) {
63
+ const candidate = path.join(
64
+ current,
65
+ 'node_modules',
66
+ ...packageName.split('/'),
67
+ 'bin',
68
+ binaryName
69
+ );
70
+
71
+ if (fs.existsSync(candidate)) {
72
+ return candidate;
73
+ }
74
+
75
+ const parent = path.dirname(current);
76
+ if (parent === current) {
77
+ return undefined;
78
+ }
79
+ current = parent;
80
+ }
81
+ }
package/package.json CHANGED
@@ -1,5 +1,29 @@
1
1
  {
2
2
  "name": "@vercel/vc-native",
3
- "version": "0.0.0",
4
- "license": "ISC"
3
+ "version": "54.2.0",
4
+ "description": "Native Vercel CLI installer for npm",
5
+ "license": "Apache-2.0",
6
+ "homepage": "https://vercel.com",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/vercel/vercel.git",
10
+ "directory": "packages/vc-native"
11
+ },
12
+ "bin": {
13
+ "vercel": "./bin/vercel",
14
+ "vc": "./bin/vercel"
15
+ },
16
+ "optionalDependencies": {
17
+ "@vercel/vc-native-darwin-arm64": "54.2.0",
18
+ "@vercel/vc-native-darwin-x64": "54.2.0",
19
+ "@vercel/vc-native-linux-arm64": "54.2.0",
20
+ "@vercel/vc-native-linux-x64": "54.2.0",
21
+ "@vercel/vc-native-win32-x64": "54.2.0"
22
+ },
23
+ "files": [
24
+ "bin"
25
+ ],
26
+ "publishConfig": {
27
+ "access": "public"
28
+ }
5
29
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # @vercel/vc-native
2
-
3
- Placeholder package.