chore: import upstream snapshot with attribution
CI / build (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:09:51 +08:00
commit 0232b4e2bb
3528 changed files with 291404 additions and 0 deletions
@@ -0,0 +1,42 @@
/**
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
* SPDX-License-Identifier: MIT
*/
const { RushConfiguration } = require('@rushstack/rush-sdk')
const getRushConfiguration = (function () {
let rushConfiguration = null
return function () {
// eslint-disable-next-line
return (rushConfiguration ||= RushConfiguration.loadFromDefaultLocation({
startingFolder: process.cwd(),
}))
}
})()
function getChangedPackages(changedFiles) {
const changedPackages = new Set()
try {
const rushConfiguration = getRushConfiguration()
const { rushJsonFolder } = rushConfiguration
const lookup = rushConfiguration.getProjectLookupForRoot(rushJsonFolder)
for (const file of changedFiles) {
const project = lookup.findChildPath(file)
// 如果没找到注册的包信息,则认为是通用文件更改
const packageName = project?.packageName || 'misc'
if (!changedPackages.has(packageName)) {
changedPackages.add(packageName)
}
}
} catch (e) {
console.error(e)
throw e
}
return changedPackages
}
exports.getChangedPackages = getChangedPackages
exports.getRushConfiguration = getRushConfiguration