pgpm 4.39.0 → 4.40.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.
@@ -9,10 +9,15 @@ Install Command:
9
9
 
10
10
  pgpm install [package]...
11
11
 
12
- Install pgpm modules into current module.
12
+ Install pgpm modules into the workspace extensions/ directory.
13
13
 
14
- When called without arguments, installs any missing modules that are
15
- listed in the module's .control file but not yet installed in the workspace.
14
+ Inside a module, installing without arguments installs any missing modules
15
+ listed in the module's .control file, and explicit installs are recorded in
16
+ the module's package.json and .control file.
17
+
18
+ With -W (--workspace-root), installs target the workspace root: no-arg
19
+ installs read the modules pinned in the workspace pgpm.json \`dependencies\`
20
+ field, and explicit installs are recorded there.
16
21
 
17
22
  Arguments:
18
23
  package One or more package names to install (optional)
@@ -20,10 +25,15 @@ Arguments:
20
25
  Options:
21
26
  --help, -h Show this help message
22
27
  --cwd <directory> Working directory (default: current directory)
28
+ --force Reinstall modules even if already installed
29
+ -W, --workspace-root Install at the workspace root (pgpm.json dependencies)
23
30
 
24
31
  Examples:
25
- pgpm install Install missing modules from .control file
32
+ pgpm install Install missing modules from the module's .control
33
+ pgpm install -W Install modules pinned in the workspace pgpm.json
34
+ pgpm install -W --force Reinstall all pinned workspace modules
26
35
  pgpm install @pgpm/base32 Install single package
36
+ pgpm install @pgpm/base32@latest Install the latest published version
27
37
  pgpm install @pgpm/base32 @pgpm/utils Install multiple packages
28
38
  `;
29
39
  exports.default = async (argv, prompter, _options) => {
@@ -34,15 +44,41 @@ exports.default = async (argv, prompter, _options) => {
34
44
  }
35
45
  const { cwd = process.cwd() } = argv;
36
46
  const project = new core_1.PgpmPackage(cwd);
37
- if (!project.isInModule()) {
38
- throw new Error('You must run this command inside a PGPM module.');
47
+ const force = Boolean(argv.force);
48
+ const workspaceRoot = Boolean(argv.W || argv['workspace-root'] || argv.workspaceRoot);
49
+ if (!project.isInModule() && !project.isInWorkspace()) {
50
+ throw new Error('You must run this command inside a PGPM module or workspace.');
51
+ }
52
+ if (!project.isInModule() && !workspaceRoot) {
53
+ throw new Error('Not inside a PGPM module. To install at the workspace root (pinned in pgpm.json `dependencies`), pass -W / --workspace-root.');
54
+ }
55
+ // Workspace root: install pinned dependencies from pgpm.json
56
+ if (workspaceRoot) {
57
+ if (project.isInModule()) {
58
+ throw new Error('-W / --workspace-root must be run from the workspace root, not inside a module.');
59
+ }
60
+ const installSpinner = (0, inquirerer_1.createSpinner)('Installing workspace dependencies...');
61
+ installSpinner.start();
62
+ if (argv._.length > 0) {
63
+ await project.installModules(...argv._);
64
+ installSpinner.succeed(`Installed ${argv._.length} module(s) successfully.`);
65
+ return;
66
+ }
67
+ const installed = await project.installWorkspaceDependencies({ force });
68
+ if (installed.length === 0) {
69
+ installSpinner.succeed('All workspace dependencies are already installed.');
70
+ }
71
+ else {
72
+ installSpinner.succeed(`Installed ${installed.length} module(s): ${installed.join(', ')}`);
73
+ }
74
+ return;
39
75
  }
40
76
  // If no packages specified, install missing modules from .control file
41
77
  if (argv._.length === 0) {
42
78
  const checkSpinner = (0, inquirerer_1.createSpinner)('Checking for missing modules...');
43
79
  checkSpinner.start();
44
80
  const requiredExtensions = project.getRequiredModules();
45
- const installedModules = project.getWorkspaceInstalledModules();
81
+ const installedModules = force ? [] : project.getWorkspaceInstalledModules();
46
82
  const missingModules = (0, core_1.getMissingInstallableModules)(requiredExtensions, installedModules);
47
83
  if (missingModules.length === 0) {
48
84
  checkSpinner.succeed('All modules are already installed.');
@@ -7,10 +7,15 @@ Install Command:
7
7
 
8
8
  pgpm install [package]...
9
9
 
10
- Install pgpm modules into current module.
10
+ Install pgpm modules into the workspace extensions/ directory.
11
11
 
12
- When called without arguments, installs any missing modules that are
13
- listed in the module's .control file but not yet installed in the workspace.
12
+ Inside a module, installing without arguments installs any missing modules
13
+ listed in the module's .control file, and explicit installs are recorded in
14
+ the module's package.json and .control file.
15
+
16
+ With -W (--workspace-root), installs target the workspace root: no-arg
17
+ installs read the modules pinned in the workspace pgpm.json \`dependencies\`
18
+ field, and explicit installs are recorded there.
14
19
 
15
20
  Arguments:
16
21
  package One or more package names to install (optional)
@@ -18,10 +23,15 @@ Arguments:
18
23
  Options:
19
24
  --help, -h Show this help message
20
25
  --cwd <directory> Working directory (default: current directory)
26
+ --force Reinstall modules even if already installed
27
+ -W, --workspace-root Install at the workspace root (pgpm.json dependencies)
21
28
 
22
29
  Examples:
23
- pgpm install Install missing modules from .control file
30
+ pgpm install Install missing modules from the module's .control
31
+ pgpm install -W Install modules pinned in the workspace pgpm.json
32
+ pgpm install -W --force Reinstall all pinned workspace modules
24
33
  pgpm install @pgpm/base32 Install single package
34
+ pgpm install @pgpm/base32@latest Install the latest published version
25
35
  pgpm install @pgpm/base32 @pgpm/utils Install multiple packages
26
36
  `;
27
37
  export default async (argv, prompter, _options) => {
@@ -32,15 +42,41 @@ export default async (argv, prompter, _options) => {
32
42
  }
33
43
  const { cwd = process.cwd() } = argv;
34
44
  const project = new PgpmPackage(cwd);
35
- if (!project.isInModule()) {
36
- throw new Error('You must run this command inside a PGPM module.');
45
+ const force = Boolean(argv.force);
46
+ const workspaceRoot = Boolean(argv.W || argv['workspace-root'] || argv.workspaceRoot);
47
+ if (!project.isInModule() && !project.isInWorkspace()) {
48
+ throw new Error('You must run this command inside a PGPM module or workspace.');
49
+ }
50
+ if (!project.isInModule() && !workspaceRoot) {
51
+ throw new Error('Not inside a PGPM module. To install at the workspace root (pinned in pgpm.json `dependencies`), pass -W / --workspace-root.');
52
+ }
53
+ // Workspace root: install pinned dependencies from pgpm.json
54
+ if (workspaceRoot) {
55
+ if (project.isInModule()) {
56
+ throw new Error('-W / --workspace-root must be run from the workspace root, not inside a module.');
57
+ }
58
+ const installSpinner = createSpinner('Installing workspace dependencies...');
59
+ installSpinner.start();
60
+ if (argv._.length > 0) {
61
+ await project.installModules(...argv._);
62
+ installSpinner.succeed(`Installed ${argv._.length} module(s) successfully.`);
63
+ return;
64
+ }
65
+ const installed = await project.installWorkspaceDependencies({ force });
66
+ if (installed.length === 0) {
67
+ installSpinner.succeed('All workspace dependencies are already installed.');
68
+ }
69
+ else {
70
+ installSpinner.succeed(`Installed ${installed.length} module(s): ${installed.join(', ')}`);
71
+ }
72
+ return;
37
73
  }
38
74
  // If no packages specified, install missing modules from .control file
39
75
  if (argv._.length === 0) {
40
76
  const checkSpinner = createSpinner('Checking for missing modules...');
41
77
  checkSpinner.start();
42
78
  const requiredExtensions = project.getRequiredModules();
43
- const installedModules = project.getWorkspaceInstalledModules();
79
+ const installedModules = force ? [] : project.getWorkspaceInstalledModules();
44
80
  const missingModules = getMissingInstallableModules(requiredExtensions, installedModules);
45
81
  if (missingModules.length === 0) {
46
82
  checkSpinner.succeed('All modules are already installed.');
package/esm/index.js CHANGED
@@ -36,7 +36,10 @@ export const options = {
36
36
  t: 'template',
37
37
  // -w for --create-workspace flag
38
38
  w: 'createWorkspace',
39
- 'create-workspace': 'createWorkspace'
39
+ 'create-workspace': 'createWorkspace',
40
+ // -W for --workspace-root (pgpm install -W)
41
+ W: 'workspaceRoot',
42
+ 'workspace-root': 'workspaceRoot'
40
43
  }
41
44
  }
42
45
  };
package/index.js CHANGED
@@ -79,7 +79,10 @@ exports.options = {
79
79
  t: 'template',
80
80
  // -w for --create-workspace flag
81
81
  w: 'createWorkspace',
82
- 'create-workspace': 'createWorkspace'
82
+ 'create-workspace': 'createWorkspace',
83
+ // -W for --workspace-root (pgpm install -W)
84
+ W: 'workspaceRoot',
85
+ 'workspace-root': 'workspaceRoot'
83
86
  }
84
87
  }
85
88
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgpm",
3
- "version": "4.39.0",
3
+ "version": "4.40.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",
@@ -46,18 +46,18 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@inquirerer/utils": "^3.3.9",
49
- "@pgpmjs/core": "^6.31.0",
50
- "@pgpmjs/env": "^2.28.0",
51
- "@pgpmjs/export": "^0.32.0",
49
+ "@pgpmjs/core": "^6.32.0",
50
+ "@pgpmjs/env": "^2.28.1",
51
+ "@pgpmjs/export": "^0.32.1",
52
52
  "@pgpmjs/logger": "^2.14.0",
53
- "@pgpmjs/types": "^2.34.0",
53
+ "@pgpmjs/types": "^2.35.0",
54
54
  "@pgsql/quotes": "^17.1.0",
55
55
  "appstash": "^0.7.0",
56
56
  "find-and-require-package-json": "^0.9.1",
57
57
  "genomic": "^5.6.2",
58
58
  "inquirerer": "^4.9.1",
59
59
  "js-yaml": "^4.1.0",
60
- "pg-cache": "^3.15.0",
60
+ "pg-cache": "^3.15.1",
61
61
  "pg-env": "^1.18.0",
62
62
  "pgsql-deparser": "^17.18.3",
63
63
  "semver": "^7.8.1",
@@ -76,5 +76,5 @@
76
76
  "pg",
77
77
  "pgsql"
78
78
  ],
79
- "gitHead": "ff6c442b789cbe8803f33036110f6e09124e65df"
79
+ "gitHead": "dd2accb683fe20c7278a0d58fd36a04a3b07ac63"
80
80
  }