Jan2026 fixes (#1077)

* fix release script
* fix svgcanvas edge cases
* Update path-actions.js
* add modern js
* update deps
* Update CHANGES.md
This commit is contained in:
JFH
2026-01-10 20:57:06 -03:00
committed by GitHub
parent 9dd1349599
commit 97386d20b5
76 changed files with 11654 additions and 2416 deletions

View File

@@ -138,8 +138,11 @@ async function main () {
}
run(`git tag ${quoteArg(releaseName)}`)
console.log('\nPublishing packages to npm...')
run('npm publish --workspaces --include-workspace-root')
console.log('\nPublishing workspace packages to npm...')
run('npm publish --workspaces')
console.log('\nPublishing root package to npm...')
run('npm publish')
console.log(`\nDone. Published ${releaseName}.`)
}

View File

@@ -1,5 +1,5 @@
import { spawn } from 'node:child_process'
import { copyFile, mkdir } from 'node:fs/promises'
import { copyFile, mkdir, readdir, readFile, stat } from 'node:fs/promises'
import { join } from 'node:path'
import { existsSync } from 'node:fs'
@@ -37,12 +37,57 @@ const ensureBrowser = async () => {
}
}
const getLatestMtime = async (root) => {
let latest = 0
const entries = await readdir(root, { withFileTypes: true })
for (const entry of entries) {
const fullPath = join(root, entry.name)
if (entry.isDirectory()) {
const childLatest = await getLatestMtime(fullPath)
if (childLatest > latest) latest = childLatest
} else {
const fileStat = await stat(fullPath)
if (fileStat.mtimeMs > latest) latest = fileStat.mtimeMs
}
}
return latest
}
const ensureBuild = async () => {
const distIndex = join(process.cwd(), 'dist', 'editor', 'index.html')
if (existsSync(distIndex)) return
const distEditor = join(process.cwd(), 'dist', 'editor', 'Editor.js')
console.log('Building dist/editor for Playwright preview (missing build output)...')
await run('npm', ['run', 'build'])
// Check if build exists and has coverage instrumentation
let needsBuild = !existsSync(distIndex)
if (!needsBuild && existsSync(distEditor)) {
// Check if build has coverage instrumentation
const editorContent = await readFile(distEditor, 'utf-8')
const hasCoverage = editorContent.includes('__coverage__')
if (!hasCoverage) {
console.log('Existing build lacks coverage instrumentation, rebuilding...')
needsBuild = true
}
}
if (!needsBuild) {
const distStat = await stat(distIndex)
const roots = [
join(process.cwd(), 'packages', 'svgcanvas', 'core'),
join(process.cwd(), 'src')
]
const latestSource = Math.max(
...(await Promise.all(roots.map(getLatestMtime)))
)
if (latestSource > distStat.mtimeMs) {
needsBuild = true
}
}
if (needsBuild) {
console.log('Building dist/editor for Playwright preview...')
await run('npm', ['run', 'build'])
}
}
const seedNycFromVitest = async () => {

View File

@@ -31,6 +31,18 @@ function bumpVersion (version, type) {
throw new Error(`Unknown bump type: ${type}`)
}
function updateWorkspaceDependencyVersions (pkg, workspaceNames, newVersion) {
const dependencyFields = ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']
for (const field of dependencyFields) {
const dependencies = pkg[field]
if (!dependencies) continue
for (const dependencyName of Object.keys(dependencies)) {
if (!workspaceNames.has(dependencyName)) continue
dependencies[dependencyName] = newVersion
}
}
}
function isGreaterVersion (a, b) {
const pa = parseSemver(a)
const pb = parseSemver(b)
@@ -121,6 +133,7 @@ async function chooseVersion (current) {
async function main () {
const { rootPackage, workspaces } = loadPackages()
const workspaceNames = new Set(workspaces.map(({ pkg }) => pkg.name))
console.log('Current versions:')
console.log(`- ${rootPackage.name} (root): ${rootPackage.version}`)
for (const ws of workspaces) {
@@ -131,9 +144,11 @@ async function main () {
console.log(`\nUpdating all packages to ${newVersion}...`)
rootPackage.version = newVersion
updateWorkspaceDependencyVersions(rootPackage, workspaceNames, newVersion)
writeJson(rootPackagePath, rootPackage)
for (const ws of workspaces) {
ws.pkg.version = newVersion
updateWorkspaceDependencyVersions(ws.pkg, workspaceNames, newVersion)
writeJson(ws.packagePath, ws.pkg)
}