@meistrari/mise-en-place 2.4.9 → 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/.editorconfig +3 -0
- package/Makefile +4 -0
- package/dist/cli/cli.mjs +26 -17
- package/dist/eslint.mjs +5 -1
- package/package.json +1 -1
package/.editorconfig
CHANGED
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,
|
|
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
|
|
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
|
|
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
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
-
|
|
259
|
+
commandFunction(parsedArgs);
|
package/dist/eslint.mjs
CHANGED
|
@@ -64,7 +64,11 @@ const eslintConfig = antfu(
|
|
|
64
64
|
"jsonc/sort-keys": "off",
|
|
65
65
|
// This rule conflicts with eslint-plugin-diff and report false positives
|
|
66
66
|
// https://github.com/paleite/eslint-plugin-diff/issues/46
|
|
67
|
-
"vue/comment-directive": "off"
|
|
67
|
+
"vue/comment-directive": "off",
|
|
68
|
+
// The default rule sets indent to 4 spaces, following the stylistic.indent setting.
|
|
69
|
+
// However, for YAML files we want to use 2 spaces, because it's the standard for YAML.
|
|
70
|
+
// Also because 4 spaces in YAML files can make files harder to read.
|
|
71
|
+
"yaml/indent": ["error", 2]
|
|
68
72
|
}
|
|
69
73
|
},
|
|
70
74
|
{
|