@emeryld/manager 0.7.9 → 0.8.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/dist/prompts.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // src/prompts.js
2
2
  import readline from 'node:readline/promises';
3
3
  import { stdin as input, stdout as output } from 'node:process';
4
+ import { colors } from './utils/log.js';
4
5
  export const publishCliState = {
5
6
  autoDecision: undefined,
6
7
  };
@@ -70,22 +71,78 @@ export async function promptYesNoAll(question) {
70
71
  console.log(`${question} (auto-${publishCliState.autoDecision} via "all")`);
71
72
  return publishCliState.autoDecision;
72
73
  }
73
- // Allow yes/no + "apply to all" variants: y, ya, n, na
74
- // Use readline-style input to capture multi-character tokens consistently.
74
+ // Allow yes/no + "apply to all" variants: yy, ya, nn, na
75
+ const promptMessage = `${question} (yy/ya/nn/na): `;
76
+ const supportsRawMode = typeof input.setRawMode === 'function' && input.isTTY;
77
+ const readDecisionInput = async () => {
78
+ if (!supportsRawMode) {
79
+ const fallback = await askLine(promptMessage);
80
+ return fallback.trim().toLowerCase();
81
+ }
82
+ return new Promise((resolve) => {
83
+ const wasRaw = input.isRaw;
84
+ if (!wasRaw) {
85
+ input.setRawMode(true);
86
+ input.resume();
87
+ }
88
+ process.stdout.write(promptMessage);
89
+ const cleanup = () => {
90
+ input.off('data', onData);
91
+ if (!wasRaw) {
92
+ input.setRawMode(false);
93
+ input.pause();
94
+ }
95
+ };
96
+ let collected = '';
97
+ const onData = (buffer) => {
98
+ const str = buffer.toString('utf8');
99
+ for (const char of str) {
100
+ if (char === '\u0003') {
101
+ cleanup();
102
+ process.stdout.write('\n');
103
+ process.exit(1);
104
+ }
105
+ if (char === '\u0008' || char === '\u007f') {
106
+ if (collected.length > 0) {
107
+ collected = collected.slice(0, -1);
108
+ process.stdout.write('\b \b');
109
+ }
110
+ continue;
111
+ }
112
+ if (char === '\r' || char === '\n') {
113
+ continue;
114
+ }
115
+ if (!/^[a-zA-Z]$/.test(char)) {
116
+ continue;
117
+ }
118
+ process.stdout.write(char);
119
+ collected += char;
120
+ if (collected.length === 2) {
121
+ cleanup();
122
+ process.stdout.write('\n');
123
+ resolve(collected.toLowerCase());
124
+ return;
125
+ }
126
+ }
127
+ };
128
+ input.on('data', onData);
129
+ });
130
+ };
75
131
  // eslint-disable-next-line no-constant-condition
76
132
  while (true) {
77
- const answer = (await askLine(`${question} (y/ya/n/na): `)).toLowerCase();
78
- if (answer === 'y')
133
+ const answer = await readDecisionInput();
134
+ if (answer === 'yy')
79
135
  return 'yes';
80
136
  if (answer === 'ya') {
81
137
  publishCliState.autoDecision = 'yes';
82
138
  return 'yes';
83
139
  }
84
- if (answer === 'n')
140
+ if (answer === 'nn')
85
141
  return 'no';
86
142
  if (answer === 'na') {
87
143
  publishCliState.autoDecision = 'no';
88
144
  return 'no';
89
145
  }
146
+ console.log(colors.red('Please enter yy, ya, nn, or na.'));
90
147
  }
91
148
  }
package/dist/workspace.js CHANGED
@@ -218,9 +218,10 @@ const TEST_SCENARIO = {
218
218
  allArgs: ['test'],
219
219
  allMessage: 'Running tests for all packages…',
220
220
  singleArgs: (pkg) => [
221
+ 'run',
222
+ '--filter',
223
+ pkg.dirName,
221
224
  'test',
222
- '--',
223
- pkg.relativeDir === '.' ? '.' : pkg.relativeDir,
224
225
  ],
225
226
  singleMessage: 'Running tests…',
226
227
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emeryld/manager",
3
- "version": "0.7.9",
3
+ "version": "0.8.0",
4
4
  "description": "Interactive manager for pnpm monorepos (update/test/build/publish).",
5
5
  "license": "MIT",
6
6
  "type": "module",