@emeryld/manager 0.7.1 → 0.7.3
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/helper-cli/prompts.js +2 -5
- package/dist/helper-cli/runner.js +3 -2
- package/dist/menu/script-helpers.js +13 -2
- package/dist/menu.js +13 -12
- package/dist/packages/manifest-utils.js +0 -11
- package/dist/packages.js +2 -5
- package/dist/utils/log.js +2 -3
- package/dist/workspace.js +1 -1
- package/package.json +1 -1
|
@@ -58,10 +58,7 @@ function formatInteractiveLines(state, selectedIndex, title, searchState) {
|
|
|
58
58
|
const lines = [heading];
|
|
59
59
|
if (searchState?.active) {
|
|
60
60
|
const queryLabel = searchState.query || '(type to filter)';
|
|
61
|
-
|
|
62
|
-
? '(enter to run top match)'
|
|
63
|
-
: '(no matches yet)';
|
|
64
|
-
lines.push(colors.dim(`Search: ${queryLabel} ${statusLabel}`));
|
|
61
|
+
lines.push(colors.dim(`Search: ${queryLabel}`));
|
|
65
62
|
}
|
|
66
63
|
state.options.forEach((option, index) => {
|
|
67
64
|
const isSelected = index === selectedIndex;
|
|
@@ -78,7 +75,7 @@ function formatInteractiveLines(state, selectedIndex, title, searchState) {
|
|
|
78
75
|
: option.entry.displayName;
|
|
79
76
|
const runHint = searchState?.active &&
|
|
80
77
|
searchState.hasResults &&
|
|
81
|
-
index ===
|
|
78
|
+
index === selectedIndex
|
|
82
79
|
? colors.dim(' (enter to run)')
|
|
83
80
|
: '';
|
|
84
81
|
lines.push(`${pointer}${numberLabel}. ${option.entry.emoji} ${label} ${colors.dim(option.entry.metaLabel)}${runHint}`);
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import { colors } from './colors.js';
|
|
5
4
|
import { managerRoot, rootDir } from './env.js';
|
|
6
5
|
import { buildTsNodeRegisterImport } from './ts-node.js';
|
|
7
6
|
export function runEntry(entry, forwardedArgs) {
|
|
8
7
|
const detail = entry.script
|
|
9
8
|
? path.relative(rootDir, entry.absoluteScript ?? entry.script)
|
|
10
9
|
: (entry.metaLabel ?? '[callback]');
|
|
11
|
-
console.log(
|
|
10
|
+
// console.log(
|
|
11
|
+
// `${entry.emoji} ${colors.green(`Running "${entry.displayName}"`)} ${colors.dim(detail)}`,
|
|
12
|
+
// )
|
|
12
13
|
if (entry.handler) {
|
|
13
14
|
return Promise.resolve(entry.handler({ args: forwardedArgs, entry, rootDir }));
|
|
14
15
|
}
|
|
@@ -210,6 +210,18 @@ export function makeBaseScriptEntries(pkg) {
|
|
|
210
210
|
return entries;
|
|
211
211
|
}, []);
|
|
212
212
|
}
|
|
213
|
+
export function getPackageModule(pkg, dependencies = collectDependencies(pkg)) {
|
|
214
|
+
const pkgType = pkg.json?.type?.toLowerCase();
|
|
215
|
+
const isModule = pkgType === 'module';
|
|
216
|
+
const label = isModule ? 'ESM' : 'Node';
|
|
217
|
+
const labelColorizer = isModule ? colors.yellow : colors.cyan;
|
|
218
|
+
return {
|
|
219
|
+
label,
|
|
220
|
+
colorize: labelColorizer,
|
|
221
|
+
kind: 'library',
|
|
222
|
+
kindColorize: KIND_COLOR_MAP.library,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
213
225
|
export function getPackageMarker(pkg, dependencies = collectDependencies(pkg)) {
|
|
214
226
|
const normalizedDeps = new Set([...dependencies].map((dep) => String(dep).toLowerCase().trim()));
|
|
215
227
|
function findIndicator(indicators) {
|
|
@@ -272,10 +284,9 @@ export function getPackageMarker(pkg, dependencies = collectDependencies(pkg)) {
|
|
|
272
284
|
};
|
|
273
285
|
}
|
|
274
286
|
const isModule = pkgType === 'module';
|
|
275
|
-
const label = isModule ? 'ESM' : 'Node';
|
|
276
287
|
const labelColorizer = isModule ? colors.yellow : colors.cyan;
|
|
277
288
|
return {
|
|
278
|
-
label,
|
|
289
|
+
label: 'Library',
|
|
279
290
|
colorize: labelColorizer,
|
|
280
291
|
kind: 'library',
|
|
281
292
|
kindColorize: KIND_COLOR_MAP.library,
|
package/dist/menu.js
CHANGED
|
@@ -8,7 +8,7 @@ import { runHelperCli } from './helper-cli.js';
|
|
|
8
8
|
import { ensureWorkingTreeCommitted } from './preflight.js';
|
|
9
9
|
import { openDockerHelper } from './docker.js';
|
|
10
10
|
import { run } from './utils/run.js';
|
|
11
|
-
import { makeBaseScriptEntries, getPackageMarker } from './menu/script-helpers.js';
|
|
11
|
+
import { makeBaseScriptEntries, getPackageMarker, getPackageModule } from './menu/script-helpers.js';
|
|
12
12
|
function formatKindLabel(kind) {
|
|
13
13
|
if (kind === 'cli')
|
|
14
14
|
return 'CLI';
|
|
@@ -145,7 +145,8 @@ export function buildPackageSelectionMenu(packages, onStepComplete) {
|
|
|
145
145
|
const ordered = getOrderedPackages(packages);
|
|
146
146
|
const entries = ordered.map((pkg) => {
|
|
147
147
|
const marker = getPackageMarker(pkg);
|
|
148
|
-
const
|
|
148
|
+
const module = getPackageModule(pkg);
|
|
149
|
+
const primaryName = pkg.name ?? pkg.dirName;
|
|
149
150
|
const packageColorizer = colors[pkg.color ?? 'cyan'] ?? colors.cyan;
|
|
150
151
|
const highlightedName = packageColorizer(primaryName);
|
|
151
152
|
const tagParts = [];
|
|
@@ -154,22 +155,22 @@ export function buildPackageSelectionMenu(packages, onStepComplete) {
|
|
|
154
155
|
return;
|
|
155
156
|
tagParts.push(colorizer(`[${value}]`));
|
|
156
157
|
};
|
|
157
|
-
const relativePath = pkg.relativeDir ?? pkg.dirName
|
|
158
|
-
if (relativePath && relativePath !== '.') {
|
|
159
|
-
|
|
160
|
-
}
|
|
158
|
+
// const relativePath = pkg.relativeDir ?? pkg.dirName
|
|
159
|
+
// if (relativePath && relativePath !== '.') {
|
|
160
|
+
// addTag(relativePath, colors.gray)
|
|
161
|
+
// }
|
|
162
|
+
addTag(pkg.path, colors.gray);
|
|
161
163
|
if (pkg.version) {
|
|
162
164
|
addTag(`v${pkg.version}`, colors.yellow);
|
|
163
165
|
}
|
|
164
|
-
if (pkg.substitute && pkg.substitute !== primaryName) {
|
|
165
|
-
const aliasTag = pkg.name ? `alias:${pkg.substitute}` : pkg.substitute;
|
|
166
|
-
addTag(aliasTag, colors.magenta);
|
|
167
|
-
}
|
|
168
166
|
if (pkg.dockerfilePath) {
|
|
169
167
|
addTag('docker', colors.green);
|
|
170
168
|
}
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
if (marker) {
|
|
170
|
+
const kindLabel = formatKindLabel(marker.kind);
|
|
171
|
+
addTag(kindLabel, marker.kindColorize);
|
|
172
|
+
}
|
|
173
|
+
addTag(module.label, marker.kindColorize);
|
|
173
174
|
const labelWord = marker.label ? ` ${marker.colorize(marker.label)}` : '';
|
|
174
175
|
const tags = tagParts.length ? ` ${tagParts.join(' ')}` : '';
|
|
175
176
|
return {
|
|
@@ -125,17 +125,6 @@ export function colorFromSeed(seed) {
|
|
|
125
125
|
}
|
|
126
126
|
return DEFAULT_COLOR_PALETTE[hash % DEFAULT_COLOR_PALETTE.length];
|
|
127
127
|
}
|
|
128
|
-
export function deriveSubstitute(name) {
|
|
129
|
-
const trimmed = (name || '').trim();
|
|
130
|
-
if (!trimmed)
|
|
131
|
-
return '';
|
|
132
|
-
const segments = trimmed.split(/[@\/\-]/).filter(Boolean);
|
|
133
|
-
const transformed = segments
|
|
134
|
-
.map((segment) => segment)
|
|
135
|
-
.filter(Boolean)
|
|
136
|
-
.join(' ');
|
|
137
|
-
return transformed || trimmed;
|
|
138
|
-
}
|
|
139
128
|
function isManifestMissing(error) {
|
|
140
129
|
if (typeof error !== 'object' || error === null)
|
|
141
130
|
return false;
|
package/dist/packages.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/packages.js
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { readFile, stat } from 'node:fs/promises';
|
|
4
|
-
import { colorFromSeed,
|
|
4
|
+
import { colorFromSeed, inferManifestFromWorkspace, loadWorkspaceManifest, mergeManifestEntries, normalizeManifestPath, } from './packages/manifest-utils.js';
|
|
5
5
|
const rootDir = process.cwd();
|
|
6
6
|
let manifestState;
|
|
7
7
|
async function ensureManifestState(forceReload = false) {
|
|
@@ -35,7 +35,6 @@ export async function loadPackages() {
|
|
|
35
35
|
const relativePath = normalizeManifestPath(path.relative(rootDir, pkgDir));
|
|
36
36
|
const meta = byPath.get(relativePath.toLowerCase()) ??
|
|
37
37
|
byName.get((pkgName ?? '').toLowerCase());
|
|
38
|
-
const substitute = meta?.substitute ?? deriveSubstitute(pkgName) ?? path.basename(pkgDir);
|
|
39
38
|
const color = (meta?.color ?? colorFromSeed(pkgName));
|
|
40
39
|
let dockerfilePath;
|
|
41
40
|
try {
|
|
@@ -55,7 +54,6 @@ export async function loadPackages() {
|
|
|
55
54
|
json,
|
|
56
55
|
version: json.version,
|
|
57
56
|
name: pkgName ?? path.basename(pkgDir),
|
|
58
|
-
substitute,
|
|
59
57
|
color,
|
|
60
58
|
dockerfilePath,
|
|
61
59
|
});
|
|
@@ -74,10 +72,9 @@ export function resolvePackage(packages, key) {
|
|
|
74
72
|
const dirMatch = pkg.dirName.toLowerCase() === normalized;
|
|
75
73
|
const pathMatch = pkg.relativeDir.toLowerCase() === normalized;
|
|
76
74
|
const nameMatch = (pkg.name ?? '').toLowerCase() === normalized;
|
|
77
|
-
const aliasMatch = (pkg.substitute ?? '').toLowerCase() === normalized;
|
|
78
75
|
const fuzzyMatch = (pkg.name ?? '').toLowerCase().includes(normalized) ||
|
|
79
76
|
pkg.relativeDir.toLowerCase().includes(normalized);
|
|
80
|
-
return dirMatch || pathMatch || nameMatch ||
|
|
77
|
+
return dirMatch || pathMatch || nameMatch || fuzzyMatch;
|
|
81
78
|
});
|
|
82
79
|
}
|
|
83
80
|
/**
|
package/dist/utils/log.js
CHANGED
|
@@ -3,14 +3,13 @@ import { colors } from './colors.js';
|
|
|
3
3
|
export const defaultPackageColor = 'cyan';
|
|
4
4
|
export const globalEmoji = '🚀';
|
|
5
5
|
export const formatPkgName = (pkg) => {
|
|
6
|
-
const primary = pkg.substitute;
|
|
7
6
|
const displayName = pkg.name ?? pkg.dirName;
|
|
8
7
|
const fileLabel = pkg.relativeDir || pkg.dirName;
|
|
9
8
|
const colorizer = colors[pkg.color ?? defaultPackageColor];
|
|
10
|
-
return `${colorizer(colors.bold(
|
|
9
|
+
return `${colorizer(colors.bold(displayName))} ${colors.dim(`[${fileLabel}]`)}`;
|
|
11
10
|
};
|
|
12
11
|
export const logPkg = (pkg, message, colorizer = colors.cyan) => {
|
|
13
|
-
const label = colors[pkg.color ?? defaultPackageColor](pkg.
|
|
12
|
+
const label = colors[pkg.color ?? defaultPackageColor](pkg.name ?? pkg.dirName);
|
|
14
13
|
console.log(`${label} ${colorizer(message)}`);
|
|
15
14
|
};
|
|
16
15
|
export const logGlobal = (message, colorizer = colors.magenta) => {
|
package/dist/workspace.js
CHANGED