@centralu/host-linux-arm64 0.1.0-beta.37 → 0.1.0-beta.39

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.
@@ -462,12 +462,24 @@ function atLeast(a, b) {
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
464
  /**
465
- * The placeholder a working copy's version files carry once its release version is stamped from the tag at build time
466
- * (#1501). A dev build of it would say it is `0.0.0-dev.local.N`, older than every release, so it is refused, by hubs
467
- * carrying this from before the switch lands.
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.
468
467
  */
469
468
  const PLACEHOLDER = /^0\.0\.0-dev(?:\.|$)/
470
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
+ }
482
+
471
483
  /** git in the working copy, by name on PATH as the person runs it there; what it printed, or a refusal */
472
484
  function git(repo, args) {
473
485
  const r = spawnSync('git', ['-C', repo, ...args], { cwd: repo, encoding: 'utf8', windowsHide: true, maxBuffer: 16 * 1024 * 1024 })
@@ -514,7 +526,7 @@ export function devBuild(p, { dataDir = process.env.CC_DATA_DIR || join(homedir(
514
526
  const changes = git(repo, ['status', '--porcelain']).split('\n').filter((line) => line.trim()).length
515
527
  if (changes > 0 && !p.allowDirty) throw new Refusal('dev_dirty', String(changes))
516
528
  const shim = JSON.parse(readFileSync(join(repo, 'packaging', 'npm', 'centralu', 'package.json'), 'utf8'))
517
- const base = String(shim.version ?? '')
529
+ const base = devBase(repo, shim)
518
530
  if (!DEV_BASE.test(base) || base.includes('.local.') || PLACEHOLDER.test(base)) throw new Refusal('dev_base', base)
519
531
  const protocol = Number(/export const PROTOCOL_VERSION = (\d+)/.exec(readFileSync(join(repo, 'packages', 'protocol', 'src', 'envelope.ts'), 'utf8'))?.[1])
520
532
  if (protocol !== p.protocol) throw new Refusal('dev_protocol', `${protocol} ${p.protocol}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centralu/host-linux-arm64",
3
- "version": "0.1.0-beta.37",
3
+ "version": "0.1.0-beta.39",
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",