@joystick.js/cli-canary 0.0.0-canary.1439 → 0.0.0-canary.1440
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{promisify as
|
|
1
|
+
import{promisify as o}from"util";import{execFile as g}from"child_process";import r from"fs";import m from"os";import e from"path";const a=o(g),d=o(r.mkdir),y=o(r.symlink),l=o(r.access),_=async()=>{try{const s="16",p=`/usr/lib/postgresql/${s}/bin`,i=e.join(m.homedir(),".joystick","databases","postgresql","bin"),n=e.join(i,"bin"),c=e.join(n,"postgres");try{await l(c,r.constants.X_OK);return}catch{}process.loader.print("PostgreSQL not found. Installing... (this may take a few minutes)"),await a("sudo",["sh","-c",'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list']),await a("sudo",["apt-get","update"]),await a("sudo",["apt-get","install","-y",`postgresql-${s}`,`postgresql-client-${s}`,`postgresql-server-dev-${s}`]),await d(i,{recursive:!0});try{await y(p,n)}catch(t){if(t.code!=="EEXIST")throw console.error("Error creating symlink:",t),t}try{await l(c,r.constants.X_OK)}catch(t){throw console.error("Error accessing PostgreSQL executable:",t),t}process.loader.print("PostgreSQL installed!")}catch(s){throw console.error("Error installing PostgreSQL:",s),s}};var k=_;export{k as default};
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joystick.js/cli-canary",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-canary.
|
|
5
|
-
"canary_version": "0.0.0-canary.
|
|
4
|
+
"version": "0.0.0-canary.1440",
|
|
5
|
+
"canary_version": "0.0.0-canary.1439",
|
|
6
6
|
"description": "The CLI for Joystick.",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"bin": {
|
|
@@ -29,11 +29,10 @@ const download_postgresql_linux = async () => {
|
|
|
29
29
|
|
|
30
30
|
// Add PostgreSQL 16 repository
|
|
31
31
|
await exec_file_async('sudo', ['sh', '-c', 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list']);
|
|
32
|
-
await exec_file_async('wget', ['--quiet', '-O', '-', 'https://www.postgresql.org/media/keys/ACCC4CF8.asc', '|', 'sudo', 'apt-key', 'add', '-']);
|
|
33
32
|
|
|
34
33
|
// Update package list and install PostgreSQL 16
|
|
35
34
|
await exec_file_async('sudo', ['apt-get', 'update']);
|
|
36
|
-
await exec_file_async('sudo', ['apt-get', 'install', '-y',
|
|
35
|
+
await exec_file_async('sudo', ['apt-get', 'install', '-y', `postgresql-${postgresql_version}`, `postgresql-client-${postgresql_version}`, `postgresql-server-dev-${postgresql_version}`]);
|
|
37
36
|
|
|
38
37
|
await mkdir_async(joystick_bin_path, { recursive: true });
|
|
39
38
|
|