@meistrari/mise-en-place 2.15.0 → 2.15.2
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/README.md +3 -1
- package/dist/cli/cli.mjs +18 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ bunx mise-en-place postinstall
|
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
It will also setup the initial _mise-en-place_ in your project. Which includes:
|
|
25
|
-
-
|
|
25
|
+
- Updating an existing `Makefile`, when present, to include useful commands.
|
|
26
26
|
- Adding an `.editorconfig` file.
|
|
27
27
|
- Adding ESLint configuration.
|
|
28
28
|
- Adding TypeScript configuration.
|
|
@@ -36,6 +36,8 @@ By adding the `postinstall` script to run `mise-en-place postinstall`, every tim
|
|
|
36
36
|
This process will add a leading caret (`^`) to the version range if it is not already present. Which means that it will update to the latest minor and patch versions automatically but never the major version.
|
|
37
37
|
|
|
38
38
|
## Makefile
|
|
39
|
+
The postinstall script does not create a `Makefile` automatically. To use the shared Makefile commands, create a `Makefile` and include this package's `Makefile`.
|
|
40
|
+
|
|
39
41
|
Commands with `##` after the target are 'public' commands and are intended to be used by developers and will show up in the help message.
|
|
40
42
|
|
|
41
43
|
The other commands are 'hidden' and are intended to be used by automations or by other 'public' commands.
|
package/dist/cli/cli.mjs
CHANGED
|
@@ -23,35 +23,28 @@ function findWorkspacePackageJsons(workspaces) {
|
|
|
23
23
|
}
|
|
24
24
|
return packageJsons;
|
|
25
25
|
}
|
|
26
|
+
function isRegistryVersion(value) {
|
|
27
|
+
return !value.includes(":") && !value.includes("/");
|
|
28
|
+
}
|
|
26
29
|
function getMeistrariLibs(packageJson) {
|
|
27
30
|
const libs = /* @__PURE__ */ new Set();
|
|
28
31
|
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
29
|
-
for (const dep of Object.
|
|
30
|
-
if (dep.startsWith("@meistrari/")) {
|
|
31
|
-
libs.add(dep);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return Array.from(libs).sort();
|
|
35
|
-
}
|
|
36
|
-
function addCaretToMeistrariDeps(deps) {
|
|
37
|
-
if (!deps)
|
|
38
|
-
return deps;
|
|
39
|
-
const result = { ...deps };
|
|
40
|
-
for (const [key, value] of Object.entries(deps)) {
|
|
41
|
-
if (!key.startsWith("@meistrari/")) {
|
|
32
|
+
for (const [dep, version] of Object.entries(deps)) {
|
|
33
|
+
if (!dep.startsWith("@meistrari/")) {
|
|
42
34
|
continue;
|
|
43
35
|
}
|
|
44
|
-
if (
|
|
36
|
+
if (!isRegistryVersion(version)) {
|
|
45
37
|
continue;
|
|
46
38
|
}
|
|
47
|
-
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
result[key] = `^${value}`;
|
|
39
|
+
libs.add(dep);
|
|
51
40
|
}
|
|
52
|
-
return
|
|
41
|
+
return Array.from(libs).sort();
|
|
42
|
+
}
|
|
43
|
+
const bareSemverPattern = /^\d+\.\d+\.\d+(?:-[0-9a-z-.]+)?(?:\+[0-9a-z-.]+)?$/i;
|
|
44
|
+
function isBareSemver(value) {
|
|
45
|
+
return bareSemverPattern.test(value);
|
|
53
46
|
}
|
|
54
|
-
function
|
|
47
|
+
function addCaretToMeistrariDeps(deps) {
|
|
55
48
|
if (!deps)
|
|
56
49
|
return deps;
|
|
57
50
|
const result = { ...deps };
|
|
@@ -59,10 +52,7 @@ function removeCaretFromMeistrariDeps(deps) {
|
|
|
59
52
|
if (!key.startsWith("@meistrari/")) {
|
|
60
53
|
continue;
|
|
61
54
|
}
|
|
62
|
-
if (value
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
if (value.startsWith("^")) {
|
|
55
|
+
if (!isBareSemver(value)) {
|
|
66
56
|
continue;
|
|
67
57
|
}
|
|
68
58
|
result[key] = `^${value}`;
|
|
@@ -236,11 +226,11 @@ function updateMeistrariLibraries(args) {
|
|
|
236
226
|
continue;
|
|
237
227
|
const pkgJson = readPackageJson(pkgJsonPath);
|
|
238
228
|
if (pkgJson.dependencies) {
|
|
239
|
-
const updated =
|
|
229
|
+
const updated = addCaretToMeistrariDeps(pkgJson.dependencies);
|
|
240
230
|
pkgJson.dependencies = updated;
|
|
241
231
|
}
|
|
242
232
|
if (pkgJson.devDependencies) {
|
|
243
|
-
const updated =
|
|
233
|
+
const updated = addCaretToMeistrariDeps(pkgJson.devDependencies);
|
|
244
234
|
pkgJson.devDependencies = updated;
|
|
245
235
|
}
|
|
246
236
|
writePackageJson(pkgJsonPath, pkgJson);
|
|
@@ -256,11 +246,8 @@ const {
|
|
|
256
246
|
} = packageJson;
|
|
257
247
|
const oldMakefileIncludeLine = "include ./node_modules/@meistrari/mise-en-place/Makefile";
|
|
258
248
|
const makeFileIncludeLine = "-include ./node_modules/@meistrari/mise-en-place/Makefile";
|
|
259
|
-
function
|
|
249
|
+
function handleMakefileInclude() {
|
|
260
250
|
if (!existsSync("Makefile")) {
|
|
261
|
-
console.log("No Makefile found. Generating one that includes mise-en-place Makefile.");
|
|
262
|
-
writeFileSync("Makefile", `${makeFileIncludeLine}
|
|
263
|
-
`);
|
|
264
251
|
return;
|
|
265
252
|
}
|
|
266
253
|
const makefileContent = readFileSync("Makefile", "utf-8");
|
|
@@ -382,7 +369,7 @@ function postinstall(args) {
|
|
|
382
369
|
if (process.env.CI) {
|
|
383
370
|
return;
|
|
384
371
|
}
|
|
385
|
-
|
|
372
|
+
handleMakefileInclude();
|
|
386
373
|
handleTsConfig();
|
|
387
374
|
handleEslintConfigFile();
|
|
388
375
|
handleEditorconfigFile();
|