@visulima/package 3.4.2 → 3.4.3
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/CHANGELOG.md +12 -0
- package/LICENSE.md +1 -1
- package/dist/error.cjs +9 -1
- package/dist/error.mjs +1 -1
- package/dist/index.cjs +33 -1
- package/dist/index.mjs +5 -1
- package/dist/monorepo.cjs +103 -1
- package/dist/monorepo.mjs +98 -1
- package/dist/package-json.cjs +430 -1
- package/dist/package-json.mjs +413 -1
- package/dist/package-manager.cjs +176 -9
- package/dist/package-manager.mjs +166 -9
- package/dist/package.cjs +67 -1
- package/dist/package.mjs +62 -1
- package/dist/packem_shared/PackageNotFoundError-BQIw1KE1.mjs +51 -0
- package/dist/packem_shared/PackageNotFoundError-CK1uhGFr.cjs +53 -0
- package/package.json +14 -14
- package/dist/packem_shared/PackageNotFoundError-4CX3Vfcu.mjs +0 -1
- package/dist/packem_shared/PackageNotFoundError-CY57YCot.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## @visulima/package [3.4.3](https://github.com/visulima/visulima/compare/@visulima/package@3.4.2...@visulima/package@3.4.3) (2025-01-12)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **package:** updated @antfu/install-pkg to v1, @inquirer/confirm 5.1.2 and all dev deps ([a30e052](https://github.com/visulima/visulima/commit/a30e05260417546889d3ff32bba33075a337472f))
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Dependencies
|
|
9
|
+
|
|
10
|
+
* **@visulima/fs:** upgraded to 2.3.6
|
|
11
|
+
* **@visulima/path:** upgraded to 1.3.2
|
|
12
|
+
|
|
1
13
|
## @visulima/package [3.4.2](https://github.com/visulima/visulima/compare/@visulima/package@3.4.1...@visulima/package@3.4.2) (2025-01-08)
|
|
2
14
|
|
|
3
15
|
|
package/LICENSE.md
CHANGED
|
@@ -56,7 +56,7 @@ License: MIT
|
|
|
56
56
|
By: Simon Boudrias
|
|
57
57
|
Repository: https://github.com/SBoudrias/Inquirer.js.git
|
|
58
58
|
|
|
59
|
-
> Copyright (c)
|
|
59
|
+
> Copyright (c) 2025 Simon Boudrias
|
|
60
60
|
>
|
|
61
61
|
> Permission is hereby granted, free of charge, to any person
|
|
62
62
|
> obtaining a copy of this software and associated documentation
|
package/dist/error.cjs
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
|
|
5
|
+
const PackageNotFoundError = require('./packem_shared/PackageNotFoundError-CK1uhGFr.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.PackageNotFoundError = PackageNotFoundError;
|
package/dist/error.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default as PackageNotFoundError } from './packem_shared/PackageNotFoundError-BQIw1KE1.mjs';
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
|
|
5
|
+
const PackageNotFoundError = require('./packem_shared/PackageNotFoundError-CK1uhGFr.cjs');
|
|
6
|
+
const monorepo = require('./monorepo.cjs');
|
|
7
|
+
const _package = require('./package.cjs');
|
|
8
|
+
const packageJson = require('./package-json.cjs');
|
|
9
|
+
const packageManager = require('./package-manager.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
exports.PackageNotFoundError = PackageNotFoundError;
|
|
14
|
+
exports.findMonorepoRoot = monorepo.findMonorepoRoot;
|
|
15
|
+
exports.findMonorepoRootSync = monorepo.findMonorepoRootSync;
|
|
16
|
+
exports.findPackageRoot = _package.findPackageRoot;
|
|
17
|
+
exports.findPackageRootSync = _package.findPackageRootSync;
|
|
18
|
+
exports.ensurePackages = packageJson.ensurePackages;
|
|
19
|
+
exports.findPackageJson = packageJson.findPackageJson;
|
|
20
|
+
exports.findPackageJsonSync = packageJson.findPackageJsonSync;
|
|
21
|
+
exports.getPackageJsonProperty = packageJson.getPackageJsonProperty;
|
|
22
|
+
exports.hasPackageJsonAnyDependency = packageJson.hasPackageJsonAnyDependency;
|
|
23
|
+
exports.hasPackageJsonProperty = packageJson.hasPackageJsonProperty;
|
|
24
|
+
exports.parsePackageJson = packageJson.parsePackageJson;
|
|
25
|
+
exports.writePackageJson = packageJson.writePackageJson;
|
|
26
|
+
exports.writePackageJsonSync = packageJson.writePackageJsonSync;
|
|
27
|
+
exports.findLockFile = packageManager.findLockFile;
|
|
28
|
+
exports.findLockFileSync = packageManager.findLockFileSync;
|
|
29
|
+
exports.findPackageManager = packageManager.findPackageManager;
|
|
30
|
+
exports.findPackageManagerSync = packageManager.findPackageManagerSync;
|
|
31
|
+
exports.generateMissingPackagesInstallMessage = packageManager.generateMissingPackagesInstallMessage;
|
|
32
|
+
exports.getPackageManagerVersion = packageManager.getPackageManagerVersion;
|
|
33
|
+
exports.identifyInitiatingPackageManager = packageManager.identifyInitiatingPackageManager;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export { default as PackageNotFoundError } from './packem_shared/PackageNotFoundError-BQIw1KE1.mjs';
|
|
2
|
+
export { findMonorepoRoot, findMonorepoRootSync } from './monorepo.mjs';
|
|
3
|
+
export { findPackageRoot, findPackageRootSync } from './package.mjs';
|
|
4
|
+
export { ensurePackages, findPackageJson, findPackageJsonSync, getPackageJsonProperty, hasPackageJsonAnyDependency, hasPackageJsonProperty, parsePackageJson, writePackageJson, writePackageJsonSync } from './package-json.mjs';
|
|
5
|
+
export { findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, generateMissingPackagesInstallMessage, getPackageManagerVersion, identifyInitiatingPackageManager } from './package-manager.mjs';
|
package/dist/monorepo.cjs
CHANGED
|
@@ -1 +1,103 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
|
|
5
|
+
const node_fs = require('node:fs');
|
|
6
|
+
const fs = require('@visulima/fs');
|
|
7
|
+
const error = require('@visulima/fs/error');
|
|
8
|
+
const path = require('@visulima/path');
|
|
9
|
+
const packageManager = require('./package-manager.cjs');
|
|
10
|
+
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
const findMonorepoRoot = /* @__PURE__ */ __name(async (cwd) => {
|
|
14
|
+
const workspaceFilePath = await fs.findUp(["lerna.json", "turbo.json"], {
|
|
15
|
+
type: "file",
|
|
16
|
+
...cwd && { cwd }
|
|
17
|
+
});
|
|
18
|
+
if (workspaceFilePath?.endsWith("lerna.json")) {
|
|
19
|
+
const lerna = await fs.readJson(workspaceFilePath);
|
|
20
|
+
if (lerna.useWorkspaces || lerna.packages) {
|
|
21
|
+
return {
|
|
22
|
+
path: path.dirname(workspaceFilePath),
|
|
23
|
+
strategy: "lerna"
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const isTurbo = workspaceFilePath?.endsWith("turbo.json");
|
|
28
|
+
try {
|
|
29
|
+
const { packageManager: packageManager$1, path: path$1 } = await packageManager.findPackageManager(cwd);
|
|
30
|
+
if (["npm", "yarn"].includes(packageManager$1)) {
|
|
31
|
+
const packageJsonFilePath = path.join(path$1, "package.json");
|
|
32
|
+
if (node_fs.existsSync(packageJsonFilePath)) {
|
|
33
|
+
const packageJson = node_fs.readFileSync(path.join(path$1, "package.json"), "utf8");
|
|
34
|
+
if (packageJson.includes("workspaces")) {
|
|
35
|
+
return {
|
|
36
|
+
path: path$1,
|
|
37
|
+
strategy: isTurbo ? "turbo" : packageManager$1
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
} else if (packageManager$1 === "pnpm") {
|
|
42
|
+
const pnpmWorkspacesFilePath = path.join(path$1, "pnpm-workspace.yaml");
|
|
43
|
+
if (node_fs.existsSync(pnpmWorkspacesFilePath)) {
|
|
44
|
+
return {
|
|
45
|
+
path: path$1,
|
|
46
|
+
strategy: isTurbo ? "turbo" : "pnpm"
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
} catch (error$1) {
|
|
51
|
+
if (!(error$1 instanceof error.NotFoundError)) {
|
|
52
|
+
throw error$1;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
throw new Error(`No monorepo root could be found upwards from the directory ${cwd} using lerna, yarn, pnpm, or npm as indicators.`);
|
|
56
|
+
}, "findMonorepoRoot");
|
|
57
|
+
const findMonorepoRootSync = /* @__PURE__ */ __name((cwd) => {
|
|
58
|
+
const workspaceFilePath = fs.findUpSync(["lerna.json", "turbo.json"], {
|
|
59
|
+
type: "file",
|
|
60
|
+
...cwd && { cwd }
|
|
61
|
+
});
|
|
62
|
+
if (workspaceFilePath?.endsWith("lerna.json")) {
|
|
63
|
+
const lerna = fs.readJsonSync(workspaceFilePath);
|
|
64
|
+
if (lerna.useWorkspaces || lerna.packages) {
|
|
65
|
+
return {
|
|
66
|
+
path: path.dirname(workspaceFilePath),
|
|
67
|
+
strategy: "lerna"
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const isTurbo = workspaceFilePath?.endsWith("turbo.json");
|
|
72
|
+
try {
|
|
73
|
+
const { packageManager: packageManager$1, path: path$1 } = packageManager.findPackageManagerSync(cwd);
|
|
74
|
+
if (["npm", "yarn"].includes(packageManager$1)) {
|
|
75
|
+
const packageJsonFilePath = path.join(path$1, "package.json");
|
|
76
|
+
if (node_fs.existsSync(packageJsonFilePath)) {
|
|
77
|
+
const packageJson = node_fs.readFileSync(path.join(path$1, "package.json"), "utf8");
|
|
78
|
+
if (packageJson.includes("workspaces")) {
|
|
79
|
+
return {
|
|
80
|
+
path: path$1,
|
|
81
|
+
strategy: isTurbo ? "turbo" : packageManager$1
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} else if (packageManager$1 === "pnpm") {
|
|
86
|
+
const pnpmWorkspacesFilePath = path.join(path$1, "pnpm-workspace.yaml");
|
|
87
|
+
if (node_fs.existsSync(pnpmWorkspacesFilePath)) {
|
|
88
|
+
return {
|
|
89
|
+
path: path$1,
|
|
90
|
+
strategy: isTurbo ? "turbo" : "pnpm"
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
} catch (error$1) {
|
|
95
|
+
if (!(error$1 instanceof error.NotFoundError)) {
|
|
96
|
+
throw error$1;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
throw new Error(`No monorepo root could be found upwards from the directory ${cwd} using lerna, yarn, pnpm, or npm as indicators.`);
|
|
100
|
+
}, "findMonorepoRootSync");
|
|
101
|
+
|
|
102
|
+
exports.findMonorepoRoot = findMonorepoRoot;
|
|
103
|
+
exports.findMonorepoRootSync = findMonorepoRootSync;
|
package/dist/monorepo.mjs
CHANGED
|
@@ -1 +1,98 @@
|
|
|
1
|
-
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { findUp, readJson, findUpSync, readJsonSync } from '@visulima/fs';
|
|
3
|
+
import { NotFoundError } from '@visulima/fs/error';
|
|
4
|
+
import { dirname, join } from '@visulima/path';
|
|
5
|
+
import { findPackageManager, findPackageManagerSync } from './package-manager.mjs';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
const findMonorepoRoot = /* @__PURE__ */ __name(async (cwd) => {
|
|
10
|
+
const workspaceFilePath = await findUp(["lerna.json", "turbo.json"], {
|
|
11
|
+
type: "file",
|
|
12
|
+
...cwd && { cwd }
|
|
13
|
+
});
|
|
14
|
+
if (workspaceFilePath?.endsWith("lerna.json")) {
|
|
15
|
+
const lerna = await readJson(workspaceFilePath);
|
|
16
|
+
if (lerna.useWorkspaces || lerna.packages) {
|
|
17
|
+
return {
|
|
18
|
+
path: dirname(workspaceFilePath),
|
|
19
|
+
strategy: "lerna"
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const isTurbo = workspaceFilePath?.endsWith("turbo.json");
|
|
24
|
+
try {
|
|
25
|
+
const { packageManager, path } = await findPackageManager(cwd);
|
|
26
|
+
if (["npm", "yarn"].includes(packageManager)) {
|
|
27
|
+
const packageJsonFilePath = join(path, "package.json");
|
|
28
|
+
if (existsSync(packageJsonFilePath)) {
|
|
29
|
+
const packageJson = readFileSync(join(path, "package.json"), "utf8");
|
|
30
|
+
if (packageJson.includes("workspaces")) {
|
|
31
|
+
return {
|
|
32
|
+
path,
|
|
33
|
+
strategy: isTurbo ? "turbo" : packageManager
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
} else if (packageManager === "pnpm") {
|
|
38
|
+
const pnpmWorkspacesFilePath = join(path, "pnpm-workspace.yaml");
|
|
39
|
+
if (existsSync(pnpmWorkspacesFilePath)) {
|
|
40
|
+
return {
|
|
41
|
+
path,
|
|
42
|
+
strategy: isTurbo ? "turbo" : "pnpm"
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
} catch (error) {
|
|
47
|
+
if (!(error instanceof NotFoundError)) {
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
throw new Error(`No monorepo root could be found upwards from the directory ${cwd} using lerna, yarn, pnpm, or npm as indicators.`);
|
|
52
|
+
}, "findMonorepoRoot");
|
|
53
|
+
const findMonorepoRootSync = /* @__PURE__ */ __name((cwd) => {
|
|
54
|
+
const workspaceFilePath = findUpSync(["lerna.json", "turbo.json"], {
|
|
55
|
+
type: "file",
|
|
56
|
+
...cwd && { cwd }
|
|
57
|
+
});
|
|
58
|
+
if (workspaceFilePath?.endsWith("lerna.json")) {
|
|
59
|
+
const lerna = readJsonSync(workspaceFilePath);
|
|
60
|
+
if (lerna.useWorkspaces || lerna.packages) {
|
|
61
|
+
return {
|
|
62
|
+
path: dirname(workspaceFilePath),
|
|
63
|
+
strategy: "lerna"
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const isTurbo = workspaceFilePath?.endsWith("turbo.json");
|
|
68
|
+
try {
|
|
69
|
+
const { packageManager, path } = findPackageManagerSync(cwd);
|
|
70
|
+
if (["npm", "yarn"].includes(packageManager)) {
|
|
71
|
+
const packageJsonFilePath = join(path, "package.json");
|
|
72
|
+
if (existsSync(packageJsonFilePath)) {
|
|
73
|
+
const packageJson = readFileSync(join(path, "package.json"), "utf8");
|
|
74
|
+
if (packageJson.includes("workspaces")) {
|
|
75
|
+
return {
|
|
76
|
+
path,
|
|
77
|
+
strategy: isTurbo ? "turbo" : packageManager
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
} else if (packageManager === "pnpm") {
|
|
82
|
+
const pnpmWorkspacesFilePath = join(path, "pnpm-workspace.yaml");
|
|
83
|
+
if (existsSync(pnpmWorkspacesFilePath)) {
|
|
84
|
+
return {
|
|
85
|
+
path,
|
|
86
|
+
strategy: isTurbo ? "turbo" : "pnpm"
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
} catch (error) {
|
|
91
|
+
if (!(error instanceof NotFoundError)) {
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
throw new Error(`No monorepo root could be found upwards from the directory ${cwd} using lerna, yarn, pnpm, or npm as indicators.`);
|
|
96
|
+
}, "findMonorepoRootSync");
|
|
97
|
+
|
|
98
|
+
export { findMonorepoRoot, findMonorepoRootSync };
|