@meistrari/mise-en-place 2.4.10 → 2.5.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/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,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { argv } from 'node:process';
3
- import { existsSync, writeFileSync, globSync, readFileSync } from 'node:fs';
3
+ import { existsSync, globSync, readFileSync, writeFileSync } from 'node:fs';
4
4
  import { execSync } from 'node:child_process';
5
5
  import { dirname } from 'node:path';
6
6
  import { parse } from 'yaml';
@@ -126,20 +126,12 @@ function updateLibraries(packageManager, libs, cwd) {
126
126
  break;
127
127
  }
128
128
  }
129
- function handleMakefileInitialSetup() {
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) {
129
+ function updateMeistrariLibraries(args) {
139
130
  if (!existsSync("package.json")) {
140
131
  console.log("No package.json found. Skipping @meistrari/* updates.");
141
132
  return;
142
133
  }
134
+ const { packageManager: packageManagerOverride } = args;
143
135
  const selectPackageManager = () => {
144
136
  if (packageManagerOverride) {
145
137
  console.log(`Using overridden package manager: ${packageManagerOverride}`);
@@ -210,9 +202,19 @@ function updateMeistrariLibraries(packageManagerOverride) {
210
202
  updateLibraries(packageManager, libsList);
211
203
  }
212
204
  }
205
+
206
+ function handleMakefileInitialSetup() {
207
+ if (existsSync("Makefile")) {
208
+ console.log("Makefile already exists. Skipping initial setup");
209
+ return;
210
+ }
211
+ console.log("No Makefile found. Generating one that includes mise-en-place Makefile.");
212
+ writeFileSync("Makefile", "-include ./node_modules/@meistrari/mise-en-place/Makefile\n");
213
+ execSync("make mise-en-place", { stdio: "inherit" });
214
+ }
213
215
  function postinstall(args) {
214
216
  handleMakefileInitialSetup();
215
- updateMeistrariLibraries(args.packageManager);
217
+ updateMeistrariLibraries(args);
216
218
  }
217
219
 
218
220
  function parseArgs(args2) {
@@ -242,9 +244,16 @@ function parseArgs(args2) {
242
244
  }
243
245
  const [command, ...args] = argv.slice(2);
244
246
  const parsedArgs = parseArgs(args);
245
- console.log(parsedArgs);
246
- if (command === "postinstall") {
247
- postinstall(parsedArgs);
248
- process.exit(0);
247
+ if (!command) {
248
+ throw new Error("No command provided.");
249
+ }
250
+ const commands = {
251
+ postinstall,
252
+ "update-meistrari-libraries": updateMeistrariLibraries
253
+ };
254
+ const commandFunction = commands[command];
255
+ if (!commandFunction) {
256
+ const validCommands = Object.keys(commands).map((cmd) => `"${cmd}"`).join(", ");
257
+ throw new Error(`Unknown command: ${command}. Valid commands are: ${validCommands}.`);
249
258
  }
250
- throw new Error(`Unknown command: ${command}`);
259
+ commandFunction(parsedArgs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/mise-en-place",
3
- "version": "2.4.10",
3
+ "version": "2.5.0",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",