@meistrari/mise-en-place 2.4.10 → 2.5.1
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/Makefile +4 -0
- package/dist/cli/cli.mjs +37 -22
- package/package.json +2 -1
package/Makefile
CHANGED
|
@@ -8,6 +8,10 @@ _MISE_EN_PLACE_PACKAGE_NAME = @meistrari/mise-en-place
|
|
|
8
8
|
.editorconfig: ./node_modules/$(_MISE_EN_PLACE_PACKAGE_NAME)/.editorconfig ## Copy/update .editorconfig file from @meistrari/mise-en-place package
|
|
9
9
|
@cp ./node_modules/$(_MISE_EN_PLACE_PACKAGE_NAME)/.editorconfig .editorconfig
|
|
10
10
|
|
|
11
|
+
.PHONY: update-meistrari-libs
|
|
12
|
+
update-meistrari-libs: ## Update @meistrari/* packages recursively in the workspace
|
|
13
|
+
@npx exec mise-en-place update-meistrari-libraries
|
|
14
|
+
|
|
11
15
|
.PHONY: mise-en-place
|
|
12
16
|
mise-en-place: .editorconfig ## Setup the mise en place to start cooking
|
|
13
17
|
@echo "export { default } from '$(_MISE_EN_PLACE_PACKAGE_NAME)/eslint'" > eslint.config.mjs
|
package/dist/cli/cli.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { argv } from 'node:process';
|
|
3
|
-
import { existsSync,
|
|
3
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import { execSync } from 'node:child_process';
|
|
5
|
+
import { globSync } from 'glob';
|
|
5
6
|
import { dirname } from 'node:path';
|
|
6
7
|
import { parse } from 'yaml';
|
|
7
8
|
|
|
@@ -33,13 +34,18 @@ function getMeistrariLibs(packageJson) {
|
|
|
33
34
|
function addCaretToMeistrariDeps(deps) {
|
|
34
35
|
if (!deps)
|
|
35
36
|
return deps;
|
|
36
|
-
const result = {};
|
|
37
|
+
const result = { ...deps };
|
|
37
38
|
for (const [key, value] of Object.entries(deps)) {
|
|
38
|
-
if (key.startsWith("@meistrari/")
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
39
|
+
if (!key.startsWith("@meistrari/")) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (value.startsWith("workspace:")) {
|
|
43
|
+
continue;
|
|
42
44
|
}
|
|
45
|
+
if (value.startsWith("^")) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
result[key] = `^${value}`;
|
|
43
49
|
}
|
|
44
50
|
return result;
|
|
45
51
|
}
|
|
@@ -126,20 +132,12 @@ function updateLibraries(packageManager, libs, cwd) {
|
|
|
126
132
|
break;
|
|
127
133
|
}
|
|
128
134
|
}
|
|
129
|
-
function
|
|
130
|
-
if (existsSync("Makefile")) {
|
|
131
|
-
console.log("Makefile already exists. Skipping initial setup");
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
console.log("No Makefile found. Generating one that includes mise-en-place Makefile.");
|
|
135
|
-
writeFileSync("Makefile", "-include ./node_modules/@meistrari/mise-en-place/Makefile\n");
|
|
136
|
-
execSync("make mise-en-place", { stdio: "inherit" });
|
|
137
|
-
}
|
|
138
|
-
function updateMeistrariLibraries(packageManagerOverride) {
|
|
135
|
+
function updateMeistrariLibraries(args) {
|
|
139
136
|
if (!existsSync("package.json")) {
|
|
140
137
|
console.log("No package.json found. Skipping @meistrari/* updates.");
|
|
141
138
|
return;
|
|
142
139
|
}
|
|
140
|
+
const { packageManager: packageManagerOverride } = args;
|
|
143
141
|
const selectPackageManager = () => {
|
|
144
142
|
if (packageManagerOverride) {
|
|
145
143
|
console.log(`Using overridden package manager: ${packageManagerOverride}`);
|
|
@@ -210,9 +208,19 @@ function updateMeistrariLibraries(packageManagerOverride) {
|
|
|
210
208
|
updateLibraries(packageManager, libsList);
|
|
211
209
|
}
|
|
212
210
|
}
|
|
211
|
+
|
|
212
|
+
function handleMakefileInitialSetup() {
|
|
213
|
+
if (existsSync("Makefile")) {
|
|
214
|
+
console.log("Makefile already exists. Skipping initial setup");
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
console.log("No Makefile found. Generating one that includes mise-en-place Makefile.");
|
|
218
|
+
writeFileSync("Makefile", "-include ./node_modules/@meistrari/mise-en-place/Makefile\n");
|
|
219
|
+
execSync("make mise-en-place", { stdio: "inherit" });
|
|
220
|
+
}
|
|
213
221
|
function postinstall(args) {
|
|
214
222
|
handleMakefileInitialSetup();
|
|
215
|
-
updateMeistrariLibraries(args
|
|
223
|
+
updateMeistrariLibraries(args);
|
|
216
224
|
}
|
|
217
225
|
|
|
218
226
|
function parseArgs(args2) {
|
|
@@ -242,9 +250,16 @@ function parseArgs(args2) {
|
|
|
242
250
|
}
|
|
243
251
|
const [command, ...args] = argv.slice(2);
|
|
244
252
|
const parsedArgs = parseArgs(args);
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
253
|
+
if (!command) {
|
|
254
|
+
throw new Error("No command provided.");
|
|
255
|
+
}
|
|
256
|
+
const commands = {
|
|
257
|
+
postinstall,
|
|
258
|
+
"update-meistrari-libraries": updateMeistrariLibraries
|
|
259
|
+
};
|
|
260
|
+
const commandFunction = commands[command];
|
|
261
|
+
if (!commandFunction) {
|
|
262
|
+
const validCommands = Object.keys(commands).map((cmd) => `"${cmd}"`).join(", ");
|
|
263
|
+
throw new Error(`Unknown command: ${command}. Valid commands are: ${validCommands}.`);
|
|
249
264
|
}
|
|
250
|
-
|
|
265
|
+
commandFunction(parsedArgs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meistrari/mise-en-place",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"eslint": "9.39.1",
|
|
39
39
|
"eslint-plugin-diff": "2.0.3",
|
|
40
40
|
"eslint-plugin-drizzle": "0.2.3",
|
|
41
|
+
"glob": "13.0.0",
|
|
41
42
|
"yaml": "^2.7.0"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|