@meistrari/mise-en-place 2.4.7 → 2.4.9
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/dist/cli/cli.mjs +43 -19
- package/package.json +3 -2
package/dist/cli/cli.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { argv } from 'node:process';
|
|
3
|
-
import { existsSync, writeFileSync,
|
|
3
|
+
import { existsSync, writeFileSync, globSync, readFileSync } from 'node:fs';
|
|
4
4
|
import { execSync } from 'node:child_process';
|
|
5
5
|
import { dirname } from 'node:path';
|
|
6
|
+
import { parse } from 'yaml';
|
|
6
7
|
|
|
7
8
|
function readPackageJson(path) {
|
|
8
9
|
return JSON.parse(readFileSync(path, "utf-8"));
|
|
@@ -80,6 +81,30 @@ function detectPackageManager() {
|
|
|
80
81
|
}
|
|
81
82
|
return null;
|
|
82
83
|
}
|
|
84
|
+
function readPnpmWorkspaces() {
|
|
85
|
+
const workspaceFile = "pnpm-workspace.yaml";
|
|
86
|
+
if (!existsSync(workspaceFile)) {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const content = readFileSync(workspaceFile, "utf-8");
|
|
91
|
+
const parsed = parse(content);
|
|
92
|
+
return parsed.packages || [];
|
|
93
|
+
} catch (error) {
|
|
94
|
+
console.warn(`Failed to parse ${workspaceFile}:`, error);
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function getWorkspaces(packageManager) {
|
|
99
|
+
if (packageManager === "pnpm") {
|
|
100
|
+
return readPnpmWorkspaces();
|
|
101
|
+
}
|
|
102
|
+
if (!existsSync("package.json")) {
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
const rootPackageJson = readPackageJson("package.json");
|
|
106
|
+
return rootPackageJson.workspaces || [];
|
|
107
|
+
}
|
|
83
108
|
function updateLibraries(packageManager, libs, cwd) {
|
|
84
109
|
const libsStr = libs.join(" ");
|
|
85
110
|
const options = {
|
|
@@ -107,7 +132,7 @@ function handleMakefileInitialSetup() {
|
|
|
107
132
|
return;
|
|
108
133
|
}
|
|
109
134
|
console.log("No Makefile found. Generating one that includes mise-en-place Makefile.");
|
|
110
|
-
writeFileSync("Makefile", "include ./node_modules/@meistrari/mise-en-place/Makefile\n");
|
|
135
|
+
writeFileSync("Makefile", "-include ./node_modules/@meistrari/mise-en-place/Makefile\n");
|
|
111
136
|
execSync("make mise-en-place", { stdio: "inherit" });
|
|
112
137
|
}
|
|
113
138
|
function updateMeistrariLibraries(packageManagerOverride) {
|
|
@@ -115,8 +140,22 @@ function updateMeistrariLibraries(packageManagerOverride) {
|
|
|
115
140
|
console.log("No package.json found. Skipping @meistrari/* updates.");
|
|
116
141
|
return;
|
|
117
142
|
}
|
|
118
|
-
const
|
|
119
|
-
|
|
143
|
+
const selectPackageManager = () => {
|
|
144
|
+
if (packageManagerOverride) {
|
|
145
|
+
console.log(`Using overridden package manager: ${packageManagerOverride}`);
|
|
146
|
+
return packageManagerOverride;
|
|
147
|
+
}
|
|
148
|
+
const detectedPackageManager = detectPackageManager();
|
|
149
|
+
if (!detectedPackageManager) {
|
|
150
|
+
console.log("No recognized lock file found (pnpm-lock.yaml, yarn.lock, package-lock.json)");
|
|
151
|
+
process.exit(1);
|
|
152
|
+
}
|
|
153
|
+
const { packageManager: packageManager2, file } = detectedPackageManager;
|
|
154
|
+
console.log(`Detected ${packageManager2} due to the presence of the file '${file}'. Updating @meistrari/* libraries...`);
|
|
155
|
+
return packageManager2;
|
|
156
|
+
};
|
|
157
|
+
const packageManager = selectPackageManager();
|
|
158
|
+
const workspaces = getWorkspaces(packageManager);
|
|
120
159
|
const packageJsonPaths = ["./package.json"];
|
|
121
160
|
if (workspaces.length > 0) {
|
|
122
161
|
const workspacePackageJsons = findWorkspacePackageJsons(workspaces);
|
|
@@ -153,21 +192,6 @@ function updateMeistrariLibraries(packageManagerOverride) {
|
|
|
153
192
|
const libsList = Array.from(allMeistrariLibs).sort();
|
|
154
193
|
console.log(`Found ${libsList.length} @meistrari/* libraries to update:`);
|
|
155
194
|
console.log(libsList.join("\n"));
|
|
156
|
-
const selectPackageManager = () => {
|
|
157
|
-
if (packageManagerOverride) {
|
|
158
|
-
console.log(`Using overridden package manager: ${packageManagerOverride}`);
|
|
159
|
-
return packageManagerOverride;
|
|
160
|
-
}
|
|
161
|
-
const detectedPackageManager = detectPackageManager();
|
|
162
|
-
if (!detectedPackageManager) {
|
|
163
|
-
console.log("No recognized lock file found (pnpm-lock.yaml, yarn.lock, package-lock.json)");
|
|
164
|
-
process.exit(1);
|
|
165
|
-
}
|
|
166
|
-
const { packageManager: packageManager2, file } = detectedPackageManager;
|
|
167
|
-
console.log(`Detected ${packageManager2} due to the presence of the file '${file}'. Updating @meistrari/* libraries...`);
|
|
168
|
-
return packageManager2;
|
|
169
|
-
};
|
|
170
|
-
const packageManager = selectPackageManager();
|
|
171
195
|
if (packageManager === "bun") {
|
|
172
196
|
for (const pkgJsonPath of packageJsonPaths) {
|
|
173
197
|
if (!existsSync(pkgJsonPath))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meistrari/mise-en-place",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"@antfu/eslint-config": "6.2.0",
|
|
38
38
|
"eslint": "9.39.1",
|
|
39
39
|
"eslint-plugin-diff": "2.0.3",
|
|
40
|
-
"eslint-plugin-drizzle": "0.2.3"
|
|
40
|
+
"eslint-plugin-drizzle": "0.2.3",
|
|
41
|
+
"yaml": "^2.7.0"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@types/node": "24.10.1",
|