pgpm 4.12.0 → 4.13.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/commands/env.js CHANGED
@@ -7,12 +7,15 @@ Environment Command:
7
7
 
8
8
  pgpm env [OPTIONS] [COMMAND...]
9
9
 
10
- Manage PostgreSQL environment variables with profile support.
10
+ Manage environment variables for local development with profile support.
11
11
 
12
- Profiles:
12
+ Database Profiles:
13
13
  (default) Use local Postgres development profile
14
14
  --supabase Use Supabase local development profile
15
15
 
16
+ Additional Services:
17
+ --minio Include MinIO/S3 environment variables
18
+
16
19
  Modes:
17
20
  No command Print export statements for shell evaluation
18
21
  With command Execute command with environment variables applied
@@ -20,16 +23,18 @@ Modes:
20
23
  Options:
21
24
  --help, -h Show this help message
22
25
  --supabase Use Supabase profile instead of default Postgres
26
+ --minio Include CDN_ENDPOINT, AWS_ACCESS_KEY, AWS_SECRET_KEY, AWS_REGION
23
27
 
24
28
  Examples:
25
29
  pgpm env Print default Postgres env exports
26
30
  pgpm env --supabase Print Supabase env exports
31
+ pgpm env --minio Print Postgres + MinIO env exports
32
+ pgpm env --supabase --minio Print Supabase + MinIO env exports
27
33
  eval "$(pgpm env)" Load default Postgres env into shell
28
- eval "$(pgpm env --supabase)" Load Supabase env into shell
34
+ eval "$(pgpm env --minio)" Load Postgres + MinIO env into shell
35
+ eval "$(pgpm env --supabase --minio)" Load Supabase + MinIO env into shell
29
36
  pgpm env pgpm deploy --database db1 Run command with default Postgres env
30
- pgpm env createdb mydb Run command with default Postgres env
31
- pgpm env --supabase pgpm deploy --database db1 Run command with Supabase env
32
- pgpm env --supabase createdb mydb Run command with Supabase env
37
+ pgpm env --minio pgpm deploy --database db1 Run command with Postgres + MinIO env
33
38
  `;
34
39
  const SUPABASE_PROFILE = {
35
40
  host: 'localhost',
@@ -41,24 +46,37 @@ const SUPABASE_PROFILE = {
41
46
  const DEFAULT_PROFILE = {
42
47
  ...pg_env_1.defaultPgConfig
43
48
  };
44
- function configToEnvVars(config) {
45
- return {
49
+ const MINIO_PROFILE = {
50
+ endpoint: 'http://localhost:9000',
51
+ accessKey: 'minioadmin',
52
+ secretKey: 'minioadmin',
53
+ region: 'us-east-1',
54
+ };
55
+ function configToEnvVars(config, minio) {
56
+ const vars = {
46
57
  PGHOST: config.host,
47
58
  PGPORT: String(config.port),
48
59
  PGUSER: config.user,
49
60
  PGPASSWORD: config.password,
50
61
  PGDATABASE: config.database
51
62
  };
63
+ if (minio) {
64
+ vars.CDN_ENDPOINT = minio.endpoint;
65
+ vars.AWS_ACCESS_KEY = minio.accessKey;
66
+ vars.AWS_SECRET_KEY = minio.secretKey;
67
+ vars.AWS_REGION = minio.region;
68
+ }
69
+ return vars;
52
70
  }
53
- function printExports(config) {
54
- const envVars = configToEnvVars(config);
71
+ function printExports(config, minio) {
72
+ const envVars = configToEnvVars(config, minio);
55
73
  for (const [key, value] of Object.entries(envVars)) {
56
74
  console.log(`export ${key}=${value}`);
57
75
  }
58
76
  }
59
- function executeCommand(config, command, args) {
77
+ function executeCommand(config, command, args, minio) {
60
78
  return new Promise((resolve, reject) => {
61
- const envVars = configToEnvVars(config);
79
+ const envVars = configToEnvVars(config, minio);
62
80
  const env = {
63
81
  ...process.env,
64
82
  ...envVars
@@ -82,33 +100,29 @@ exports.default = async (argv, _prompter) => {
82
100
  process.exit(0);
83
101
  }
84
102
  const useSupabase = argv.supabase === true || typeof argv.supabase === 'string';
103
+ const useMinio = argv.minio === true || typeof argv.minio === 'string';
85
104
  const profile = useSupabase ? SUPABASE_PROFILE : DEFAULT_PROFILE;
105
+ const minioProfile = useMinio ? MINIO_PROFILE : undefined;
106
+ const knownFlags = ['--supabase', '--minio'];
86
107
  const rawArgs = process.argv.slice(2);
87
108
  let envIndex = rawArgs.findIndex(arg => arg === 'env');
88
109
  if (envIndex === -1) {
89
110
  envIndex = 0;
90
111
  }
91
112
  const argsAfterEnv = rawArgs.slice(envIndex + 1);
92
- const supabaseIndex = argsAfterEnv.findIndex(arg => arg === '--supabase');
93
- let commandArgs;
94
- if (supabaseIndex !== -1) {
95
- commandArgs = argsAfterEnv.slice(supabaseIndex + 1);
96
- }
97
- else {
98
- commandArgs = argsAfterEnv;
99
- }
113
+ let commandArgs = argsAfterEnv.filter(arg => !knownFlags.includes(arg));
100
114
  commandArgs = commandArgs.filter(arg => arg !== '--cwd' && !arg.startsWith('--cwd='));
101
115
  const cwdIndex = commandArgs.findIndex(arg => arg === '--cwd');
102
116
  if (cwdIndex !== -1 && cwdIndex + 1 < commandArgs.length) {
103
117
  commandArgs.splice(cwdIndex, 2);
104
118
  }
105
119
  if (commandArgs.length === 0) {
106
- printExports(profile);
120
+ printExports(profile, minioProfile);
107
121
  return;
108
122
  }
109
123
  const [command, ...args] = commandArgs;
110
124
  try {
111
- const exitCode = await executeCommand(profile, command, args);
125
+ const exitCode = await executeCommand(profile, command, args, minioProfile);
112
126
  process.exit(exitCode);
113
127
  }
114
128
  catch (error) {
@@ -5,12 +5,15 @@ Environment Command:
5
5
 
6
6
  pgpm env [OPTIONS] [COMMAND...]
7
7
 
8
- Manage PostgreSQL environment variables with profile support.
8
+ Manage environment variables for local development with profile support.
9
9
 
10
- Profiles:
10
+ Database Profiles:
11
11
  (default) Use local Postgres development profile
12
12
  --supabase Use Supabase local development profile
13
13
 
14
+ Additional Services:
15
+ --minio Include MinIO/S3 environment variables
16
+
14
17
  Modes:
15
18
  No command Print export statements for shell evaluation
16
19
  With command Execute command with environment variables applied
@@ -18,16 +21,18 @@ Modes:
18
21
  Options:
19
22
  --help, -h Show this help message
20
23
  --supabase Use Supabase profile instead of default Postgres
24
+ --minio Include CDN_ENDPOINT, AWS_ACCESS_KEY, AWS_SECRET_KEY, AWS_REGION
21
25
 
22
26
  Examples:
23
27
  pgpm env Print default Postgres env exports
24
28
  pgpm env --supabase Print Supabase env exports
29
+ pgpm env --minio Print Postgres + MinIO env exports
30
+ pgpm env --supabase --minio Print Supabase + MinIO env exports
25
31
  eval "$(pgpm env)" Load default Postgres env into shell
26
- eval "$(pgpm env --supabase)" Load Supabase env into shell
32
+ eval "$(pgpm env --minio)" Load Postgres + MinIO env into shell
33
+ eval "$(pgpm env --supabase --minio)" Load Supabase + MinIO env into shell
27
34
  pgpm env pgpm deploy --database db1 Run command with default Postgres env
28
- pgpm env createdb mydb Run command with default Postgres env
29
- pgpm env --supabase pgpm deploy --database db1 Run command with Supabase env
30
- pgpm env --supabase createdb mydb Run command with Supabase env
35
+ pgpm env --minio pgpm deploy --database db1 Run command with Postgres + MinIO env
31
36
  `;
32
37
  const SUPABASE_PROFILE = {
33
38
  host: 'localhost',
@@ -39,24 +44,37 @@ const SUPABASE_PROFILE = {
39
44
  const DEFAULT_PROFILE = {
40
45
  ...defaultPgConfig
41
46
  };
42
- function configToEnvVars(config) {
43
- return {
47
+ const MINIO_PROFILE = {
48
+ endpoint: 'http://localhost:9000',
49
+ accessKey: 'minioadmin',
50
+ secretKey: 'minioadmin',
51
+ region: 'us-east-1',
52
+ };
53
+ function configToEnvVars(config, minio) {
54
+ const vars = {
44
55
  PGHOST: config.host,
45
56
  PGPORT: String(config.port),
46
57
  PGUSER: config.user,
47
58
  PGPASSWORD: config.password,
48
59
  PGDATABASE: config.database
49
60
  };
61
+ if (minio) {
62
+ vars.CDN_ENDPOINT = minio.endpoint;
63
+ vars.AWS_ACCESS_KEY = minio.accessKey;
64
+ vars.AWS_SECRET_KEY = minio.secretKey;
65
+ vars.AWS_REGION = minio.region;
66
+ }
67
+ return vars;
50
68
  }
51
- function printExports(config) {
52
- const envVars = configToEnvVars(config);
69
+ function printExports(config, minio) {
70
+ const envVars = configToEnvVars(config, minio);
53
71
  for (const [key, value] of Object.entries(envVars)) {
54
72
  console.log(`export ${key}=${value}`);
55
73
  }
56
74
  }
57
- function executeCommand(config, command, args) {
75
+ function executeCommand(config, command, args, minio) {
58
76
  return new Promise((resolve, reject) => {
59
- const envVars = configToEnvVars(config);
77
+ const envVars = configToEnvVars(config, minio);
60
78
  const env = {
61
79
  ...process.env,
62
80
  ...envVars
@@ -80,33 +98,29 @@ export default async (argv, _prompter) => {
80
98
  process.exit(0);
81
99
  }
82
100
  const useSupabase = argv.supabase === true || typeof argv.supabase === 'string';
101
+ const useMinio = argv.minio === true || typeof argv.minio === 'string';
83
102
  const profile = useSupabase ? SUPABASE_PROFILE : DEFAULT_PROFILE;
103
+ const minioProfile = useMinio ? MINIO_PROFILE : undefined;
104
+ const knownFlags = ['--supabase', '--minio'];
84
105
  const rawArgs = process.argv.slice(2);
85
106
  let envIndex = rawArgs.findIndex(arg => arg === 'env');
86
107
  if (envIndex === -1) {
87
108
  envIndex = 0;
88
109
  }
89
110
  const argsAfterEnv = rawArgs.slice(envIndex + 1);
90
- const supabaseIndex = argsAfterEnv.findIndex(arg => arg === '--supabase');
91
- let commandArgs;
92
- if (supabaseIndex !== -1) {
93
- commandArgs = argsAfterEnv.slice(supabaseIndex + 1);
94
- }
95
- else {
96
- commandArgs = argsAfterEnv;
97
- }
111
+ let commandArgs = argsAfterEnv.filter(arg => !knownFlags.includes(arg));
98
112
  commandArgs = commandArgs.filter(arg => arg !== '--cwd' && !arg.startsWith('--cwd='));
99
113
  const cwdIndex = commandArgs.findIndex(arg => arg === '--cwd');
100
114
  if (cwdIndex !== -1 && cwdIndex + 1 < commandArgs.length) {
101
115
  commandArgs.splice(cwdIndex, 2);
102
116
  }
103
117
  if (commandArgs.length === 0) {
104
- printExports(profile);
118
+ printExports(profile, minioProfile);
105
119
  return;
106
120
  }
107
121
  const [command, ...args] = commandArgs;
108
122
  try {
109
- const exitCode = await executeCommand(profile, command, args);
123
+ const exitCode = await executeCommand(profile, command, args, minioProfile);
110
124
  process.exit(exitCode);
111
125
  }
112
126
  catch (error) {
@@ -40,7 +40,7 @@ export const usageText = `
40
40
 
41
41
  Development Tools:
42
42
  docker Manage Docker containers (start/stop/ls, --include for additional services)
43
- env Manage PostgreSQL environment variables
43
+ env Manage environment variables (--supabase, --minio)
44
44
  test-packages Run integration tests on workspace packages
45
45
 
46
46
  Global Options:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgpm",
3
- "version": "4.12.0",
3
+ "version": "4.13.0",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "PostgreSQL Package Manager - Database migration and package management CLI",
6
6
  "main": "index.js",
@@ -76,5 +76,5 @@
76
76
  "pg",
77
77
  "pgsql"
78
78
  ],
79
- "gitHead": "2bedc6e29e8d2bfd1edd97d151696deb6b278a7a"
79
+ "gitHead": "0409a02b8af8c76fe607910a23cdb1a8e2d859d7"
80
80
  }
@@ -1 +1 @@
1
- export declare const usageText = "\n Usage: pgpm <command> [options]\n\n Core Database Operations:\n add Add database changes to plans and create SQL files\n deploy Deploy database changes and migrations\n verify Verify database state and migrations\n revert Revert database changes and migrations\n\n Project Management:\n init Initialize workspace or module\n extension Manage module dependencies\n plan Generate module deployment plans\n package Package module for distribution\n export Export database migrations from existing databases\n update Update pgpm to the latest version\n cache Manage cached templates (clean)\n upgrade Upgrade installed pgpm modules to latest versions (alias: up)\n\n Database Administration:\n dump Dump a database to a sql file\n kill Terminate database connections and optionally drop databases\n install Install database modules\n tag Add tags to changes for versioning\n clear Clear database state\n remove Remove database changes\n analyze Analyze database structure\n rename Rename database changes\n admin-users Manage admin users\n\n Testing:\n test-packages Run integration tests on all workspace packages\n\n Migration Tools:\n migrate Migration management subcommands\n init Initialize migration tracking\n status Show migration status\n list List all changes\n deps Show change dependencies\n \n Development Tools:\n docker Manage Docker containers (start/stop/ls, --include for additional services)\n env Manage PostgreSQL environment variables\n test-packages Run integration tests on workspace packages\n \n Global Options:\n -h, --help Display this help information\n -v, --version Display version information\n --cwd <directory> Working directory (default: current directory)\n\n Individual Command Help:\n pgpm <command> --help Display detailed help for specific command\n pgpm <command> -h Display detailed help for specific command\n\n Examples:\n pgpm deploy --help Show deploy command options\n pgpm init workspace Initialize new workspace\n pgpm install @pgpm/base32 Install a database module\n ";
1
+ export declare const usageText = "\n Usage: pgpm <command> [options]\n\n Core Database Operations:\n add Add database changes to plans and create SQL files\n deploy Deploy database changes and migrations\n verify Verify database state and migrations\n revert Revert database changes and migrations\n\n Project Management:\n init Initialize workspace or module\n extension Manage module dependencies\n plan Generate module deployment plans\n package Package module for distribution\n export Export database migrations from existing databases\n update Update pgpm to the latest version\n cache Manage cached templates (clean)\n upgrade Upgrade installed pgpm modules to latest versions (alias: up)\n\n Database Administration:\n dump Dump a database to a sql file\n kill Terminate database connections and optionally drop databases\n install Install database modules\n tag Add tags to changes for versioning\n clear Clear database state\n remove Remove database changes\n analyze Analyze database structure\n rename Rename database changes\n admin-users Manage admin users\n\n Testing:\n test-packages Run integration tests on all workspace packages\n\n Migration Tools:\n migrate Migration management subcommands\n init Initialize migration tracking\n status Show migration status\n list List all changes\n deps Show change dependencies\n \n Development Tools:\n docker Manage Docker containers (start/stop/ls, --include for additional services)\n env Manage environment variables (--supabase, --minio)\n test-packages Run integration tests on workspace packages\n \n Global Options:\n -h, --help Display this help information\n -v, --version Display version information\n --cwd <directory> Working directory (default: current directory)\n\n Individual Command Help:\n pgpm <command> --help Display detailed help for specific command\n pgpm <command> -h Display detailed help for specific command\n\n Examples:\n pgpm deploy --help Show deploy command options\n pgpm init workspace Initialize new workspace\n pgpm install @pgpm/base32 Install a database module\n ";
package/utils/display.js CHANGED
@@ -43,7 +43,7 @@ exports.usageText = `
43
43
 
44
44
  Development Tools:
45
45
  docker Manage Docker containers (start/stop/ls, --include for additional services)
46
- env Manage PostgreSQL environment variables
46
+ env Manage environment variables (--supabase, --minio)
47
47
  test-packages Run integration tests on workspace packages
48
48
 
49
49
  Global Options: