supabase 1.18.0 → 1.18.2
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 +1 -1
- package/scripts/preinstall.js +18 -5
package/package.json
CHANGED
package/scripts/preinstall.js
CHANGED
|
@@ -24,6 +24,10 @@ const PLATFORM_MAPPING = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
function validateConfiguration(packageJson) {
|
|
27
|
+
if (!packageJson.name) {
|
|
28
|
+
return "'name' property must be specified";
|
|
29
|
+
}
|
|
30
|
+
|
|
27
31
|
if (!packageJson.version) {
|
|
28
32
|
return "'version' property must be specified";
|
|
29
33
|
}
|
|
@@ -59,10 +63,12 @@ async function parsePackageJson() {
|
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
// We have validated the config. It exists in all its glory
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
const pkgName = packageJson.name.toString();
|
|
67
|
+
const bin = packageJson.bin.toString();
|
|
68
|
+
const binName = path.basename(bin);
|
|
69
|
+
const binPath = path.dirname(bin);
|
|
70
|
+
let url = packageJson.url.toString();
|
|
71
|
+
let version = packageJson.version.toString();
|
|
66
72
|
|
|
67
73
|
// strip the 'v' if necessary v0.0.1 => 0.0.1
|
|
68
74
|
if (version[0] === "v") version = version.substr(1);
|
|
@@ -73,7 +79,7 @@ async function parsePackageJson() {
|
|
|
73
79
|
url = url.replace(/{{version}}/g, version);
|
|
74
80
|
url = url.replace(/{{bin_name}}/g, binName);
|
|
75
81
|
|
|
76
|
-
return { binName, binPath, url, version };
|
|
82
|
+
return { pkgName, binName, binPath, url, version };
|
|
77
83
|
}
|
|
78
84
|
|
|
79
85
|
const errGlobal = `Installing Supabase CLI as a global module is not supported.
|
|
@@ -115,6 +121,13 @@ async function main() {
|
|
|
115
121
|
await fs.promises.link(bin + ext, bin);
|
|
116
122
|
}
|
|
117
123
|
|
|
124
|
+
// Copy binary because yarn runs as postinstall
|
|
125
|
+
if (process.env.npm_config_user_agent.startsWith("yarn/")) {
|
|
126
|
+
const src = path.join("..", opts.pkgName, opts.binPath, opts.binName);
|
|
127
|
+
const dst = path.join("..", ".bin", opts.binName);
|
|
128
|
+
await fs.promises.symlink(src, dst);
|
|
129
|
+
}
|
|
130
|
+
|
|
118
131
|
// TODO: verify checksums
|
|
119
132
|
console.info("Installed Supabase CLI successfully");
|
|
120
133
|
}
|