diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..cc23192 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +* text=auto eol=lf +*.bat text eol=crlf diff --git a/Jenkinsfile b/Jenkinsfile index b78d11f..ba814af 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -83,8 +83,13 @@ pipeline { def newVer if (params.SNAPSHOT) { - // SNAPSHOT:查询 registry 上最新的 alpha 版本,自动递增 - def alphaNum = 1 + // SNAPSHOT:源码与 registry 都可能领先,必须取二者最大序号再递增。 + def localAlphaNum = 0 + def localMatcher = (currentVer =~ /-alpha\.(\d+)$/) + if (localMatcher.find()) { + localAlphaNum = localMatcher.group(1).toInteger() + } + def remoteAlphaNum = 0 try { def remoteVer = bat( script: "@npm view ${pkg} dist-tags.alpha --registry %NEXUS_REGISTRY% 2>nul", @@ -93,12 +98,13 @@ pipeline { if (remoteVer && remoteVer.matches(/.*-alpha\.\d+$/)) { def matcher = (remoteVer =~ /-alpha\.(\d+)$/) if (matcher.find()) { - alphaNum = matcher.group(1).toInteger() + 1 + remoteAlphaNum = matcher.group(1).toInteger() } } } catch (Exception e) { - echo "Could not query remote version for ${pkg}, using alpha.1" + echo "Could not query remote version for ${pkg}; advancing from source version" } + def alphaNum = Math.max(localAlphaNum, remoteAlphaNum) + 1 newVer = baseVer + "-alpha.${alphaNum}" echo "SNAPSHOT publish: ${pkg} → ${newVer} (tag: alpha)" // 临时写入 package.json 供 npm publish 读取(不 commit) diff --git a/docs/IMPLEMENTATION_HANDOFF.md b/docs/IMPLEMENTATION_HANDOFF.md index 1603032..b912ad2 100644 --- a/docs/IMPLEMENTATION_HANDOFF.md +++ b/docs/IMPLEMENTATION_HANDOFF.md @@ -101,6 +101,12 @@ pnpm --dir packages/update test ## 7. 本轮变更记录 +### 2026-07-17 / Jenkins #48 失败修复 + +- `sdk-rn-publish #48` 在 Windows 棡出后因 8 个文件换行不一致被 Prettier 正确阻断,未发布任何包。 +- 新增 `.gitattributes`,源码统一以 LF 检出;仅 `.bat` 保持 CRLF。 +- alpha 版本号改为取源码现有序号与 Nexus 远端序号的最大值后加一,禁止版本倒退和重复发布。 + ### 2026-07-17 / common 第一轮 - 引入 `semver@7.8.5` 与 `@types/semver@7.7.1`,不自行重复实现版本算法。