nunmai 0.1.3 → 0.1.4

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/bin/nunmai.js +37 -0
  2. package/package.json +1 -1
package/bin/nunmai.js CHANGED
@@ -230,12 +230,49 @@ function postinstall() {
230
230
  return 0;
231
231
  }
232
232
 
233
+ // Commands that must never trigger an engine install when the engine is
234
+ // absent: a user asking to remove, or merely inspect, Nunmai should not be
235
+ // handed a multi-minute full install first.
236
+ function handleWithoutEngine(argv) {
237
+ const cmd = (argv[0] || "").toLowerCase();
238
+ if (cmd === "uninstall") {
239
+ let removed = false;
240
+ if (IS_WIN) {
241
+ // Drop our own .cmd shim (never a real launcher — those carry no marker).
242
+ const shim = path.join(winBinDir(), "nunmai.cmd");
243
+ if (isWinShim(shim)) { try { fs.unlinkSync(shim); removed = true; } catch (_) { /* best effort */ } }
244
+ }
245
+ console.log("Nunmai Engine is not installed on this machine — nothing to remove." + (removed ? " (Removed the launcher shim.)" : ""));
246
+ console.log("To remove this npm launcher too: npm uninstall -g nunmai (or `npm uninstall nunmai` for a local install)");
247
+ return 0;
248
+ }
249
+ if (cmd === "--version" || cmd === "-v" || cmd === "version") {
250
+ console.log(`nunmai launcher ${require("../package.json").version} (engine not installed — run \`nunmai\` to install)`);
251
+ return 0;
252
+ }
253
+ if (cmd === "--help" || cmd === "-h" || cmd === "help") {
254
+ console.log([
255
+ "Nunmai Engine is not installed on this machine yet.",
256
+ "",
257
+ " nunmai install the engine, then start it",
258
+ " nunmai --version show the launcher version",
259
+ " nunmai uninstall remove the engine (nothing to remove right now)",
260
+ "",
261
+ `Manual install: ${manualHint().trim()}`,
262
+ ].join("\n"));
263
+ return 0;
264
+ }
265
+ return null;
266
+ }
267
+
233
268
  function main() {
234
269
  const argv = process.argv.slice(2);
235
270
  if (argv[0] === "--bootstrap-postinstall") process.exit(postinstall());
236
271
 
237
272
  let launcher = findLauncher();
238
273
  if (!launcher) {
274
+ const handled = handleWithoutEngine(argv);
275
+ if (handled !== null) process.exit(handled);
239
276
  const code = install(false);
240
277
  if (code !== 0) {
241
278
  console.error(`\nnunmai: installer exited with code ${code}. You can retry it manually:\n${manualHint()}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nunmai",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Nunmai Engine — `npm i nunmai` (global or local) installs the engine with all features and dependencies; run `nunmai` to start.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://nunmai.in",