grg-kit-cli 0.6.0 → 0.6.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.
Files changed (2) hide show
  1. package/commands/init.js +22 -3
  2. package/package.json +1 -1
package/commands/init.js CHANGED
@@ -129,13 +129,29 @@ async function init(options) {
129
129
  });
130
130
 
131
131
  let output = '';
132
+ let promptHandled = false;
133
+
134
+ // Handle stdin errors gracefully (EPIPE if process exits early)
135
+ child.stdin.on('error', (err) => {
136
+ if (err.code !== 'EPIPE') {
137
+ console.error(chalk.gray(`stdin error: ${err.message}`));
138
+ }
139
+ });
140
+
141
+ const safeWrite = (data) => {
142
+ if (child.stdin.writable && !child.stdin.destroyed) {
143
+ child.stdin.write(data);
144
+ }
145
+ };
146
+
132
147
  child.stdout.on('data', (data) => {
133
148
  output += data.toString();
134
149
  // When we see the prompt, send 'a' to select all, then Enter
135
- if (output.includes('Choose which primitives')) {
136
- child.stdin.write('a');
150
+ if (!promptHandled && output.includes('Choose which primitives')) {
151
+ promptHandled = true;
152
+ safeWrite('a');
137
153
  setTimeout(() => {
138
- child.stdin.write('\n');
154
+ safeWrite('\n');
139
155
  }, 100);
140
156
  }
141
157
  });
@@ -253,6 +269,9 @@ async function init(options) {
253
269
  console.log(chalk.gray(' 2. Run'), chalk.cyan('grg list blocks'), chalk.gray('to see available blocks'));
254
270
  console.log(chalk.gray(' 3. Add blocks with'), chalk.cyan('grg add block --auth'));
255
271
  console.log();
272
+
273
+ // Explicitly exit to close any lingering handles (e.g., from degit)
274
+ process.exit(0);
256
275
  }
257
276
 
258
277
  module.exports = { init };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grg-kit-cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "CLI tool for pulling GRG Kit resources into your Angular project",
5
5
  "main": "index.js",
6
6
  "bin": {