From eb65dd4a3415036e825d6f6dde49fd7f5872fa8c Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Sat, 20 Jan 2024 16:30:58 +0800 Subject: [PATCH 01/34] chore: add yarn berry to ci check --- .github/workflows/install.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 6b4682e33..5fe39454c 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -64,6 +64,24 @@ jobs: - run: yarn add -D ./supabase-1.28.0.tgz - run: yarn supabase --version + yarn_berry: + needs: pack + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/download-artifact@v4 + with: + name: installer + + # Berry fails to find executable on windows + - run: yarn set version berry + - run: yarn init -y + - run: yarn add -D ./supabase-1.28.0.tgz + - run: yarn supabase --version + pnpm: needs: pack strategy: From c042c78cc19615d0cbc229d04d6fd79c1dc7bcf2 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Sat, 20 Jan 2024 16:52:58 +0800 Subject: [PATCH 02/34] fix: update bin link path for yarn berry --- scripts/postinstall.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index 8c010f71b..3550673aa 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -169,8 +169,9 @@ async function main() { }); // Link the binaries in postinstall to support yarn + console.error(process.env.INIT_CWD) await binLinks({ - path: path.resolve("."), + path: path.join(process.env.INIT_CWD, "node_modules", "supabase"), pkg: { ...pkg, bin: { [pkg.name]: binPath } }, }); From 85fe6978d4522427ced7d6349762a556590bdbbb Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sat, 20 Jan 2024 17:12:25 +0800 Subject: [PATCH 03/34] Update postinstall.js --- scripts/postinstall.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index 3550673aa..4c05edf75 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -171,8 +171,8 @@ async function main() { // Link the binaries in postinstall to support yarn console.error(process.env.INIT_CWD) await binLinks({ - path: path.join(process.env.INIT_CWD, "node_modules", "supabase"), - pkg: { ...pkg, bin: { [pkg.name]: binPath } }, + path: path.resolve("."), + pkg: { ...pkg, bin: { [pkg.name]: path.resolve(binPath) } }, }); console.info("Installed Supabase CLI successfully"); From 69ceef769dee7170b88c1a044dfd2f66ade43c7e Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sat, 20 Jan 2024 17:18:21 +0800 Subject: [PATCH 04/34] Update postinstall.js --- scripts/postinstall.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index 4c05edf75..038faaba2 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -169,10 +169,11 @@ async function main() { }); // Link the binaries in postinstall to support yarn - console.error(process.env.INIT_CWD) + const relPath = path.join("node_modules", "supabase", binPath) + console.error(path.resolve(relPath)) await binLinks({ path: path.resolve("."), - pkg: { ...pkg, bin: { [pkg.name]: path.resolve(binPath) } }, + pkg: { ...pkg, bin: { [pkg.name]: path.resolve(relPath) } }, }); console.info("Installed Supabase CLI successfully"); From 80c1056cc97201569350a61e905c7f35167d5bee Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sat, 20 Jan 2024 17:26:21 +0800 Subject: [PATCH 05/34] Update postinstall.js --- scripts/postinstall.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index 038faaba2..60ede2e82 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -169,11 +169,11 @@ async function main() { }); // Link the binaries in postinstall to support yarn - const relPath = path.join("node_modules", "supabase", binPath) - console.error(path.resolve(relPath)) + const absPath = path.join(process.env.INIT_CWD, "node_modules", "supabase", binPath) + console.error(absPath) await binLinks({ path: path.resolve("."), - pkg: { ...pkg, bin: { [pkg.name]: path.resolve(relPath) } }, + pkg: { ...pkg, bin: { [pkg.name]: absPath } }, }); console.info("Installed Supabase CLI successfully"); From 6851548f2a82718f13592720afbf4650599d33f3 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sat, 20 Jan 2024 17:33:23 +0800 Subject: [PATCH 06/34] Update install.yml --- .github/workflows/install.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 5fe39454c..161e664b5 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -80,6 +80,7 @@ jobs: - run: yarn set version berry - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz + - run: ls -la node_modules/.bin - run: yarn supabase --version pnpm: From 6c3f670ef8ffd8a7478a6ca1b19333a6b50cc06e Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sat, 20 Jan 2024 17:39:34 +0800 Subject: [PATCH 07/34] Update install.yml --- .github/workflows/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 161e664b5..9d5e8256d 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -80,7 +80,7 @@ jobs: - run: yarn set version berry - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - - run: ls -la node_modules/.bin + - run: ls node_modules/.bin - run: yarn supabase --version pnpm: From b211a5dabd1611a13cd8e0be9e1c74e9b3427f73 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sat, 20 Jan 2024 17:41:55 +0800 Subject: [PATCH 08/34] Update install.yml --- .github/workflows/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 9d5e8256d..7ba0481d3 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -80,7 +80,7 @@ jobs: - run: yarn set version berry - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - - run: ls node_modules/.bin + - run: ls node_modules - run: yarn supabase --version pnpm: From cd2489ac7d98d34096fe3938cc358e8980d122f6 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sat, 20 Jan 2024 17:46:48 +0800 Subject: [PATCH 09/34] Update install.yml --- .github/workflows/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 7ba0481d3..50a92a1f1 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -80,7 +80,7 @@ jobs: - run: yarn set version berry - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - - run: ls node_modules + - run: ls . - run: yarn supabase --version pnpm: From f9391ae98c3e46593ba0fa5fdf632733b27c32e9 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sat, 20 Jan 2024 18:12:15 +0800 Subject: [PATCH 10/34] Update install.yml --- .github/workflows/install.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 50a92a1f1..60c9cfed9 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -78,6 +78,7 @@ jobs: # Berry fails to find executable on windows - run: yarn set version berry + - run: echo "nodeLinker: node-modules" > .yarnrc.yml - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - run: ls . From cddee6a804e5a21770d036379af9e32509b2a2c3 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sat, 20 Jan 2024 18:12:51 +0800 Subject: [PATCH 11/34] Update postinstall.js --- scripts/postinstall.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index 60ede2e82..64645e2a7 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -169,11 +169,11 @@ async function main() { }); // Link the binaries in postinstall to support yarn - const absPath = path.join(process.env.INIT_CWD, "node_modules", "supabase", binPath) - console.error(absPath) + // const absPath = path.join(process.env.INIT_CWD, "node_modules", "supabase", binPath) + // console.error(absPath) await binLinks({ path: path.resolve("."), - pkg: { ...pkg, bin: { [pkg.name]: absPath } }, + pkg: { ...pkg, bin: { [pkg.name]: binPath } }, }); console.info("Installed Supabase CLI successfully"); From fbd9b921df0f03e39702877cb7a110e3f6ce385c Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sat, 20 Jan 2024 18:13:39 +0800 Subject: [PATCH 12/34] Update install.yml --- .github/workflows/install.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 60c9cfed9..932f5074b 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -77,8 +77,9 @@ jobs: name: installer # Berry fails to find executable on windows - - run: yarn set version berry - - run: echo "nodeLinker: node-modules" > .yarnrc.yml + - run: | + yarn set version berry + echo "nodeLinker: node-modules" > .yarnrc.yml - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - run: ls . From f078d0f1ca16271825f86ea52756f995624ff7af Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sat, 20 Jan 2024 18:16:47 +0800 Subject: [PATCH 13/34] Update install.yml --- .github/workflows/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 932f5074b..1f9a119f0 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -77,8 +77,8 @@ jobs: name: installer # Berry fails to find executable on windows + - run: yarn set version berry - run: | - yarn set version berry echo "nodeLinker: node-modules" > .yarnrc.yml - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz From df61dad53ac90d472be940ab145a9049c8539456 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sat, 20 Jan 2024 18:20:09 +0800 Subject: [PATCH 14/34] Update install.yml --- .github/workflows/install.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 1f9a119f0..60a9b9e03 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -78,8 +78,7 @@ jobs: # Berry fails to find executable on windows - run: yarn set version berry - - run: | - echo "nodeLinker: node-modules" > .yarnrc.yml + - run: yarn config set node-linker node-modules - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - run: ls . From e7d020db2179ab64e8abb560d9eb11dce5f96f98 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sat, 20 Jan 2024 18:29:06 +0800 Subject: [PATCH 15/34] Update install.yml --- .github/workflows/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 60a9b9e03..4b89b39f9 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -78,7 +78,7 @@ jobs: # Berry fails to find executable on windows - run: yarn set version berry - - run: yarn config set node-linker node-modules + - run: yarn config set nodeLinker node-modules - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - run: ls . From 3b6022840c0b34d800bd47b310b39060d7ef65a8 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sat, 20 Jan 2024 18:31:07 +0800 Subject: [PATCH 16/34] Update install.yml --- .github/workflows/install.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 4b89b39f9..2061a1111 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -77,8 +77,9 @@ jobs: name: installer # Berry fails to find executable on windows + - run: | + echo "nodeLinker: node-modules" > .yarnrc.yml - run: yarn set version berry - - run: yarn config set nodeLinker node-modules - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - run: ls . From 6824320ef61a7a956c9eafec75fa811f9b97cc5e Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Sun, 21 Jan 2024 01:13:19 +0800 Subject: [PATCH 17/34] chore: print out binary path --- scripts/postinstall.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index 64645e2a7..028fb8364 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -170,7 +170,7 @@ async function main() { // Link the binaries in postinstall to support yarn // const absPath = path.join(process.env.INIT_CWD, "node_modules", "supabase", binPath) - // console.error(absPath) + console.error(binPath, process.platform) await binLinks({ path: path.resolve("."), pkg: { ...pkg, bin: { [pkg.name]: binPath } }, From 962d7c4c55828aed2cfaffe86e3a3796a53b0a75 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Sun, 21 Jan 2024 01:22:08 +0800 Subject: [PATCH 18/34] chore: ls bin dir --- .github/workflows/install.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 2061a1111..5b96472c8 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -58,8 +58,6 @@ jobs: with: name: installer - # Berry fails to find executable on windows - # - run: yarn set version berry - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - run: yarn supabase --version @@ -77,12 +75,12 @@ jobs: name: installer # Berry fails to find executable on windows - - run: | - echo "nodeLinker: node-modules" > .yarnrc.yml - run: yarn set version berry + - run: yarn config set nodeLinker node-modules - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - - run: ls . + - run: ls node_modules + - run: ls node_modules\.bin - run: yarn supabase --version pnpm: From 4fcf99140e219097967603f356a799d4be9e0b54 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Sun, 21 Jan 2024 01:43:04 +0800 Subject: [PATCH 19/34] chore: debug command --- .github/workflows/install.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 5b96472c8..cbb7f00e6 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -80,7 +80,8 @@ jobs: - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - run: ls node_modules - - run: ls node_modules\.bin + - run: dir node_modules\.bin\supabase + - run: node_modules\.bin\supabase --version - run: yarn supabase --version pnpm: From b64273f2ed39e6a82b658cf3e635c37f14a1b9e2 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Sun, 21 Jan 2024 02:14:36 +0800 Subject: [PATCH 20/34] chore: copy symlink --- scripts/postinstall.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index 028fb8364..4d3d798fd 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -169,12 +169,20 @@ async function main() { }); // Link the binaries in postinstall to support yarn - // const absPath = path.join(process.env.INIT_CWD, "node_modules", "supabase", binPath) - console.error(binPath, process.platform) await binLinks({ path: path.resolve("."), pkg: { ...pkg, bin: { [pkg.name]: binPath } }, }); + if (platform == "windows") { + const src = path.join( + process.env.INIT_CWD, + "node_modules", + ".bin", + "supabase" + ); + const dst = pkg.bin[pkg.name]; + await fs.promises.cp(src, dst); + } console.info("Installed Supabase CLI successfully"); } From d7df10e310d006552c73f75a143133db1e1ff5a1 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Sun, 21 Jan 2024 02:41:52 +0800 Subject: [PATCH 21/34] chore: update package json for windows --- scripts/postinstall.js | 51 +++++++++++++----------------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index 4d3d798fd..aee533d07 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -28,41 +28,21 @@ const PLATFORM_MAPPING = { }; const arch = ARCH_MAPPING[process.arch]; - const platform = PLATFORM_MAPPING[process.platform]; // TODO: import pkg from "../package.json" assert { type: "json" }; const readPackageJson = async () => { - const packageJsonPath = path.join(".", "package.json"); - const contents = await fs.promises.readFile(packageJsonPath); + const contents = await fs.promises.readFile("package.json"); return JSON.parse(contents); }; -const parsePackageJson = (packageJson) => { - if (!arch) { - throw Error( - "Installation is not supported for this architecture: " + process.arch - ); - } - - if (!platform) { - throw Error( - "Installation is not supported for this platform: " + process.platform - ); - } - - // Build the download url from package.json +// Build the download url from package.json +const getDownloadUrl = (packageJson) => { const pkgName = packageJson.name; const version = packageJson.version; const repo = packageJson.repository; const url = `https://github.com/${repo}/releases/download/v${version}/${pkgName}_${platform}_${arch}.tar.gz`; - - let binPath = path.join("bin", "supabase"); - if (platform == "windows") { - binPath += ".exe"; - } - - return { binPath, url }; + return url; }; const fetchAndParseCheckSumFile = async (packageJson, agent) => { @@ -98,6 +78,7 @@ const errGlobal = `Installing Supabase CLI as a global module is not supported. Please use one of the supported package managers: https://github.com/supabase/cli#install-the-cli `; const errChecksum = "Checksum mismatch. Downloaded data might be corrupted."; +const errUnsupported = `Installation is not supported for ${process.platform} ${process.arch}`; /** * Reads the configuration from application's package.json, @@ -113,9 +94,18 @@ async function main() { if (process.env.npm_config_global || yarnGlobal) { throw errGlobal; } + if (!arch || !platform) { + throw errUnsupported; + } const pkg = await readPackageJson(); - const { binPath, url } = parsePackageJson(pkg); + if (platform == "windows") { + // Update bin path in package.json + pkg.bin[pkg.name] += ".exe"; + await fs.promises.writeFile("package.json", JSON.stringify(pkg)); + } + + const binPath = pkg.bin[pkg.name]; const binDir = path.dirname(binPath); await fs.promises.mkdir(binDir, { recursive: true }); @@ -124,6 +114,7 @@ async function main() { const binName = path.basename(binPath); const untar = tar.x({ cwd: binDir }, [binName]); + const url = getDownloadUrl(pkg); console.info("Downloading", url); const proxyUrl = process.env.npm_config_https_proxy || @@ -173,16 +164,6 @@ async function main() { path: path.resolve("."), pkg: { ...pkg, bin: { [pkg.name]: binPath } }, }); - if (platform == "windows") { - const src = path.join( - process.env.INIT_CWD, - "node_modules", - ".bin", - "supabase" - ); - const dst = pkg.bin[pkg.name]; - await fs.promises.cp(src, dst); - } console.info("Installed Supabase CLI successfully"); } From d52125d09bf71980a051194d7c14bec7a8727f5f Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Sun, 21 Jan 2024 02:45:06 +0800 Subject: [PATCH 22/34] chore: print updated json --- .github/workflows/install.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index cbb7f00e6..9a33f7cef 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -79,9 +79,7 @@ jobs: - run: yarn config set nodeLinker node-modules - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - - run: ls node_modules - - run: dir node_modules\.bin\supabase - - run: node_modules\.bin\supabase --version + - run: cat node_modules\supabase\package.json - run: yarn supabase --version pnpm: From 5bcbc6b12ce9957db946179cc2dd7367673825e1 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Sun, 21 Jan 2024 02:55:43 +0800 Subject: [PATCH 23/34] chore: use exec --- .github/workflows/install.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 9a33f7cef..b0763b733 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -79,8 +79,7 @@ jobs: - run: yarn config set nodeLinker node-modules - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - - run: cat node_modules\supabase\package.json - - run: yarn supabase --version + - run: yarn exec supabase --version pnpm: needs: pack From 3f1cdc3f604f8fb5de8af39b699cbda8ec8cc7ed Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Sun, 21 Jan 2024 03:12:05 +0800 Subject: [PATCH 24/34] chore: use top level flag --- .github/workflows/install.yml | 2 +- scripts/postinstall.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index b0763b733..bc5c9130b 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -79,7 +79,7 @@ jobs: - run: yarn config set nodeLinker node-modules - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - - run: yarn exec supabase --version + - run: yarn run -T supabase --version pnpm: needs: pack diff --git a/scripts/postinstall.js b/scripts/postinstall.js index aee533d07..f131da3a8 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -102,7 +102,6 @@ async function main() { if (platform == "windows") { // Update bin path in package.json pkg.bin[pkg.name] += ".exe"; - await fs.promises.writeFile("package.json", JSON.stringify(pkg)); } const binPath = pkg.bin[pkg.name]; From c32351c0b620ad7945a3048a540098791412d90e Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Sun, 21 Jan 2024 03:19:45 +0800 Subject: [PATCH 25/34] chore: use path to bin --- .github/workflows/install.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index bc5c9130b..edbe9b4ab 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -79,7 +79,8 @@ jobs: - run: yarn config set nodeLinker node-modules - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - - run: yarn run -T supabase --version + # - run: yarn run -T supabase --version + - run: ./node_modules/.bin/supabase --version pnpm: needs: pack From 2add64a3b30ce67a40b547e7e4b11136079f4f5f Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Sun, 21 Jan 2024 12:17:24 +0800 Subject: [PATCH 26/34] chore: test more --- .github/workflows/install.yml | 4 ++-- scripts/postinstall.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index edbe9b4ab..6690ef4df 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -79,8 +79,8 @@ jobs: - run: yarn config set nodeLinker node-modules - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - # - run: yarn run -T supabase --version - - run: ./node_modules/.bin/supabase --version + - run: yarn run -T supabase --version + # - run: ./node_modules/.bin/supabase --version pnpm: needs: pack diff --git a/scripts/postinstall.js b/scripts/postinstall.js index f131da3a8..b660ae3d4 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -99,7 +99,7 @@ async function main() { } const pkg = await readPackageJson(); - if (platform == "windows") { + if (platform === "windows") { // Update bin path in package.json pkg.bin[pkg.name] += ".exe"; } @@ -159,6 +159,7 @@ async function main() { }); // Link the binaries in postinstall to support yarn + console.error(path.resolve(".")); await binLinks({ path: path.resolve("."), pkg: { ...pkg, bin: { [pkg.name]: binPath } }, From 05125699352363476376e44c878ecf717c8cba92 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Sun, 21 Jan 2024 12:25:28 +0800 Subject: [PATCH 27/34] chore: test copy link --- scripts/postinstall.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index b660ae3d4..d5af729cb 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -159,11 +159,20 @@ async function main() { }); // Link the binaries in postinstall to support yarn - console.error(path.resolve(".")); await binLinks({ path: path.resolve("."), pkg: { ...pkg, bin: { [pkg.name]: binPath } }, }); + if (platform === "windows") { + const srcPath = path.join( + process.env.INIT_CWD, + "node_modules", + ".bin", + "supabase" + ); + const dstPath = path.join("node_modules", "supabase", "bin"); + await fs.promises.cp(srcPath, dstPath); + } console.info("Installed Supabase CLI successfully"); } From 64159a0d3747e915773321af14b69ee24d2710bf Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sun, 21 Jan 2024 12:33:50 +0800 Subject: [PATCH 28/34] Update postinstall.js --- scripts/postinstall.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index d5af729cb..cdf9a4417 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -170,7 +170,7 @@ async function main() { ".bin", "supabase" ); - const dstPath = path.join("node_modules", "supabase", "bin"); + const dstPath = "bin"; await fs.promises.cp(srcPath, dstPath); } From 53ef3fe4fc3b8080db1b7740187beb0ca7dd6e41 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sun, 21 Jan 2024 12:36:43 +0800 Subject: [PATCH 29/34] Update postinstall.js --- scripts/postinstall.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index cdf9a4417..57196763f 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -170,7 +170,7 @@ async function main() { ".bin", "supabase" ); - const dstPath = "bin"; + const dstPath = path.join("bin", "supabase"); await fs.promises.cp(srcPath, dstPath); } From 3a32308cde1e28337ffbe3b65110182696615421 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sun, 21 Jan 2024 14:14:43 +0800 Subject: [PATCH 30/34] Update install.yml --- .github/workflows/install.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 6690ef4df..bca28f028 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -79,7 +79,8 @@ jobs: - run: yarn config set nodeLinker node-modules - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - - run: yarn run -T supabase --version + - run: $(yarn link supabase).exe --version + # - run: yarn run -T supabase --version # - run: ./node_modules/.bin/supabase --version pnpm: From ded8f8fd2843bde0730ce972d5dab54c4871b079 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sun, 21 Jan 2024 14:23:31 +0800 Subject: [PATCH 31/34] Update install.yml --- .github/workflows/install.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index bca28f028..e7f0f1ad5 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -79,7 +79,8 @@ jobs: - run: yarn config set nodeLinker node-modules - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - - run: $(yarn link supabase).exe --version + - run: | + & "$(yarn link supabase).exe" --version # - run: yarn run -T supabase --version # - run: ./node_modules/.bin/supabase --version From cf181f5431fb428066d4dee1a0d6840117d1c240 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Sun, 21 Jan 2024 14:25:29 +0800 Subject: [PATCH 32/34] Update install.yml --- .github/workflows/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index e7f0f1ad5..6af762a15 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -80,7 +80,7 @@ jobs: - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - run: | - & "$(yarn link supabase).exe" --version + & "$(yarn bin supabase).exe" --version # - run: yarn run -T supabase --version # - run: ./node_modules/.bin/supabase --version From 10c41977b9eb298a3eddfc3f522da70380d801df Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Thu, 25 Jan 2024 15:12:16 +0800 Subject: [PATCH 33/34] chore: ci patches --- .github/workflows/install.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 6af762a15..aa5f72d9c 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -74,15 +74,16 @@ jobs: with: name: installer - # Berry fails to find executable on windows - run: yarn set version berry - - run: yarn config set nodeLinker node-modules + # - run: yarn config set nodeLinker node-modules - run: yarn init -y - run: yarn add -D ./supabase-1.28.0.tgz - - run: | + - if: ${{ matrix.os != 'windows-latest' }} + run: yarn supabase --version + # Workaround for running extensionless executable on windows + - if: ${{ matrix.os == 'windows-latest' }} + run: | & "$(yarn bin supabase).exe" --version - # - run: yarn run -T supabase --version - # - run: ./node_modules/.bin/supabase --version pnpm: needs: pack From b83e4a6fd26b5993a1f8c25e3517a4acb78a6792 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Thu, 25 Jan 2024 15:16:49 +0800 Subject: [PATCH 34/34] chore: cleanup --- scripts/postinstall.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/scripts/postinstall.js b/scripts/postinstall.js index 57196763f..bd4bb5702 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -163,16 +163,6 @@ async function main() { path: path.resolve("."), pkg: { ...pkg, bin: { [pkg.name]: binPath } }, }); - if (platform === "windows") { - const srcPath = path.join( - process.env.INIT_CWD, - "node_modules", - ".bin", - "supabase" - ); - const dstPath = path.join("bin", "supabase"); - await fs.promises.cp(srcPath, dstPath); - } console.info("Installed Supabase CLI successfully"); }