@centralu/host-linux-arm64 0.1.0-beta.36 → 0.1.0-beta.38

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.
@@ -461,6 +461,24 @@ function atLeast(a, b) {
461
461
 
462
462
  /** A release a dev build can be cut from: a prerelease, since `<base>.local.N` is SemVer only on one (`isLocalBuildVersion`) */
463
463
  const DEV_BASE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*$/
464
+ /**
465
+ * The placeholder a working copy's version files carry since its release version is stamped from the tag at build time
466
+ * (#1501). Never a dev build's base: `0.0.0-dev.local.N` would be older than every release.
467
+ */
468
+ const PLACEHOLDER = /^0\.0\.0-dev(?:\.|$)/
469
+
470
+ /**
471
+ * The release a dev build of the working copy is cut from, as `scripts/app-version.mjs` resolves it for a local build
472
+ * (#1501): the newest release tag reachable from HEAD there. A commit from before the switch, in a clone without tags,
473
+ * still carries its version in the shim's manifest, which is taken then. An empty string when neither says.
474
+ */
475
+ function devBase(repo, shim) {
476
+ const r = spawnSync('git', ['-C', repo, 'describe', '--tags', '--abbrev=0', '--match', 'v[0-9]*'], { cwd: repo, encoding: 'utf8', windowsHide: true })
477
+ const tag = r.status === 0 ? String(r.stdout).trim().replace(/^v/, '') : ''
478
+ if (tag) return tag
479
+ const own = String(shim.version ?? '')
480
+ return PLACEHOLDER.test(own) ? '' : own
481
+ }
464
482
 
465
483
  /** git in the working copy, by name on PATH as the person runs it there; what it printed, or a refusal */
466
484
  function git(repo, args) {
@@ -508,8 +526,8 @@ export function devBuild(p, { dataDir = process.env.CC_DATA_DIR || join(homedir(
508
526
  const changes = git(repo, ['status', '--porcelain']).split('\n').filter((line) => line.trim()).length
509
527
  if (changes > 0 && !p.allowDirty) throw new Refusal('dev_dirty', String(changes))
510
528
  const shim = JSON.parse(readFileSync(join(repo, 'packaging', 'npm', 'centralu', 'package.json'), 'utf8'))
511
- const base = String(shim.version ?? '')
512
- if (!DEV_BASE.test(base) || base.includes('.local.')) throw new Refusal('dev_base', base)
529
+ const base = devBase(repo, shim)
530
+ if (!DEV_BASE.test(base) || base.includes('.local.') || PLACEHOLDER.test(base)) throw new Refusal('dev_base', base)
513
531
  const protocol = Number(/export const PROTOCOL_VERSION = (\d+)/.exec(readFileSync(join(repo, 'packages', 'protocol', 'src', 'envelope.ts'), 'utf8'))?.[1])
514
532
  if (protocol !== p.protocol) throw new Refusal('dev_protocol', `${protocol} ${p.protocol}`)
515
533
  const floor = /(\d+\.\d+\.\d+)/.exec(String(shim.engines?.node ?? ''))?.[1]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centralu/host-linux-arm64",
3
- "version": "0.1.0-beta.36",
3
+ "version": "0.1.0-beta.38",
4
4
  "description": "Centralu's host without the window, for Linux on arm64: what a hub installs on a linked machine",
5
5
  "license": "MIT",
6
6
  "author": "ijun17",