oltc-selector 2.3.0 → 2.3.1

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 (3) hide show
  1. package/README.md +1 -1
  2. package/bin/oltc.js +10 -17
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -64,7 +64,7 @@ oltc --line "220/110/35kV-125MVA 225±8x1,25%/115/35kV YNa0d11"
64
64
  | `--lang en\|zh` | Output language. `OLTC_LANG=en` also works | zh |
65
65
  | `--version` / `-v` | Print the version | |
66
66
  | `--help` / `-h` | The flag list. Also shown when no flag is given | |
67
- | `--no-update-check` | Skip the daily npm check. A newer version only prints a notice on stderr; nothing is installed. `OLTC_NO_UPDATE_CHECK=1` or `CI=1` also skip it. | check on |
67
+ | `--no-update-check` | Skip the npm check made on every run. A newer version only prints a notice on stderr; nothing is installed. `OLTC_NO_UPDATE_CHECK=1` or `CI=1` also skip it. | check on |
68
68
 
69
69
  `--structure auto` and omitting `--octc` match the web first paint: on-load, in-tank vacuum, minimum-adequate ranking.
70
70
 
package/bin/oltc.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // lib/appVersion.ts
4
- var APP_VERSION = "2.3.0";
4
+ var APP_VERSION = "2.3.1";
5
5
 
6
6
  // lib/decimal.ts
7
7
  var GROUPED = /^\d{1,3}([,,]\d{3})+$/;
@@ -2898,19 +2898,19 @@ function deriveDuty(spec) {
2898
2898
  cautionsZh.push("230/121 kV \u81EA\u8026\u53D8\u4E2D\u538B\u51FA\u7EBF\u901A\u5E38\u7528 Um 170 kV\uFF0C\u8BF7\u6309\u5382\u5BB6\u6570\u636E\u6838\u5BF9\u3002");
2899
2899
  cautionsEn.push("230/121 kV autotransformer MV line lead: Um 170 kV is usual; check the maker's data.");
2900
2900
  } else {
2901
- cautionsZh.push(`\u4E2D\u538B\u51FA\u7EBF\u5148\u6309\u4E2D\u538B\u7B49\u7EA7 Um ${umKv} kV \u9009\uFF0C\u4EE5\u8BA2\u8D27\u89C4\u8303\uFF08OS\uFF09\u4E3A\u51C6\u3002`);
2901
+ cautionsZh.push(`\u5F00\u5173\u5BF9\u5730\u7EDD\u7F18\u6682\u6309 ${umKv} kV \u9009\uFF0C\u8BA2\u8D27\u524D\u8BF7\u6309\u8BA2\u8D27\u89C4\u8303\uFF08OS\uFF09\u786E\u8BA4\u3002`);
2902
2902
  cautionsEn.push(`MV line lead sized at the MV class, Um ${umKv} kV; the order specification (OS) decides.`);
2903
2903
  }
2904
2904
  } else if (spec.tapPoint === "auto_junction" && umRule === "auto_hv") {
2905
- cautionsZh.push(`\u81EA\u8026\u53D8\u4E32\u8054-\u516C\u5171\u8FDE\u63A5\u70B9\u5148\u6309\u9AD8\u538B\u7B49\u7EA7 Um ${umKv} kV \u9009\uFF0C\u4EE5\u8BA2\u8D27\u89C4\u8303\uFF08OS\uFF09\u4E3A\u51C6\u3002`);
2905
+ cautionsZh.push(`\u5F00\u5173\u5BF9\u5730\u7EDD\u7F18\u6682\u6309 ${umKv} kV \u9009\uFF0C\u8BA2\u8D27\u524D\u8BF7\u6309\u8BA2\u8D27\u89C4\u8303\uFF08OS\uFF09\u786E\u8BA4\u3002`);
2906
2906
  cautionsEn.push(`Autotransformer junction sized at the HV class, Um ${umKv} kV; the order specification (OS) decides.`);
2907
2907
  }
2908
- cautionsZh.push("\u81EA\u8026\u53D8\u53EA\u7528\u7EC4\u5408\u5F0F\uFF08\u590D\u5408\u5F0F\u8DE8\u8C03\u538B\u7ED5\u7EC4\u51B2\u51FB\u4E0A\u9650 200 kV\uFF09\u3002");
2908
+ cautionsZh.push("\u81EA\u8026\u53D8\u53EA\u80FD\u7528\u7EC4\u5408\u5F0F\u5F00\u5173\u3002");
2909
2909
  cautionsEn.push("Autotransformer: combined types only (compound types stop at 200 kV across the tap winding).");
2910
- cautionsZh.push("\u8FD8\u6CA1\u6838\uFF1A\u8C03\u538B\u7ED5\u7EC4\u4E24\u7AEF\u7684\u51B2\u51FB\u7535\u538B\uFF08a \u503C\uFF09\uFF0C\u4EE5\u53CA\u8981\u4E0D\u8981\u52A0\u7535\u4F4D\u7535\u963B\u3002");
2910
+ cautionsZh.push("\u8C03\u538B\u7ED5\u7EC4\u4E24\u7AEF\u7684\u51B2\u51FB\u7535\u538B\u3001\u8981\u4E0D\u8981\u52A0\u7535\u4F4D\u7535\u963B\uFF0C\u8FD9\u91CC\u6CA1\u6709\u7B97\uFF0C\u8BF7\u5411\u53D8\u538B\u5668\u5382\u786E\u8BA4\u3002");
2911
2911
  cautionsEn.push("Not checked: impulse across the tap winding (a), tie-in resistor.");
2912
2912
  if (!(statedStepV > 0 && statedStepV >= (derivedStepV ?? 0) - 0.5)) {
2913
- cautionsZh.push("\u53D8\u78C1\u901A\uFF1A\u5404\u6863 Ust \u548C\u7535\u6D41\u4E0D\u540C\uFF0C\u6781\u9650\u6863 Ust \u672A\u6821\u9A8C\u3002\u8BF7\u5411\u5382\u5BB6\u8981\u5206\u63A5\u8868\u3002");
2913
+ cautionsZh.push("\u5404\u6863\u7684\u7EA7\u7535\u538B\u548C\u7535\u6D41\u4E0D\u4E00\u6837\uFF0C\u8FD9\u91CC\u53EA\u6309\u989D\u5B9A\u6863\u7B97\u3002\u8BF7\u5411\u53D8\u538B\u5668\u5382\u8981\u5206\u63A5\u8868\u518D\u6838\u5BF9\u3002");
2914
2914
  cautionsEn.push("Variable flux: Ust and current differ per tap; Ust at the extreme tap is not checked. Get the maker's per-tap table.");
2915
2915
  }
2916
2916
  }
@@ -4577,7 +4577,7 @@ Flags:
4577
4577
  line, basis, umChoices, assumptions, errors. Errors are JSON too.
4578
4578
  --lang en|zh Output language (default zh; OLTC_LANG=en also works).
4579
4579
  --version, -v Print the version.
4580
- --no-update-check Skip the daily check for a newer version. The check only
4580
+ --no-update-check Skip the check for a newer version on each run. The check only
4581
4581
  prints a notice on stderr; it never installs anything.
4582
4582
  OLTC_NO_UPDATE_CHECK=1 or CI=1 also turn it off.
4583
4583
  -h, --help This text. Also shown when no flag is given.
@@ -5244,7 +5244,6 @@ function runCli(argv2, io = {
5244
5244
  import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
5245
5245
  import { homedir } from "node:os";
5246
5246
  import path from "node:path";
5247
- var UPDATE_TTL_MS = 24 * 60 * 60 * 1e3;
5248
5247
  var REGISTRY_LATEST = "https://registry.npmjs.org/oltc-selector/latest";
5249
5248
  function isNewer(latest, current) {
5250
5249
  const parse = (v) => {
@@ -5303,16 +5302,10 @@ function writeCache(file2, c) {
5303
5302
  async function checkForUpdate(opts) {
5304
5303
  const now = opts.now ?? Date.now();
5305
5304
  try {
5306
- let latest;
5307
5305
  const cached = readCache(opts.cacheFile);
5308
- if (cached && now - cached.checkedAt < UPDATE_TTL_MS) {
5309
- latest = cached.latest;
5310
- } else {
5311
- latest = await (opts.fetchLatest ?? fetchLatest)(opts.timeoutMs ?? 1500).catch(
5312
- () => cached?.latest ?? null
5313
- );
5314
- writeCache(opts.cacheFile, { checkedAt: now, latest });
5315
- }
5306
+ const asked = await (opts.fetchLatest ?? fetchLatest)(opts.timeoutMs ?? 1500).catch(() => null);
5307
+ const latest = asked ?? cached?.latest ?? null;
5308
+ if (asked) writeCache(opts.cacheFile, { checkedAt: now, latest: asked });
5316
5309
  return latest && isNewer(latest, opts.current) ? updateNotice(latest, opts.current) : null;
5317
5310
  } catch {
5318
5311
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oltc-selector",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "OLTC/OCTC type selection CLI. No prices. Same engine as the web app.",
5
5
  "bin": {
6
6
  "oltc": "bin/oltc.js"