|
|
@ -18,10 +18,11 @@ const DEPRECIATED_VERSION = { |
|
|
|
'https://github.com/ant-design/ant-design/issues/37931', |
|
|
|
], |
|
|
|
'4.24.0': ['https://github.com/ant-design/ant-design/issues/38371'], |
|
|
|
'4.24.11': ['https://github.com/react-component/field-form/pull/593'], |
|
|
|
}; |
|
|
|
|
|
|
|
function matchDeprecated(version) { |
|
|
|
const match = Object.keys(DEPRECIATED_VERSION).find(depreciated => |
|
|
|
const match = Object.keys(DEPRECIATED_VERSION).find((depreciated) => |
|
|
|
semver.satisfies(version, depreciated), |
|
|
|
); |
|
|
|
|
|
|
@ -38,15 +39,15 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be |
|
|
|
|
|
|
|
(async function process() { |
|
|
|
console.log(chalk.cyan('🤖 Post Publish Scripting...\n')); |
|
|
|
const { time, 'dist-tags': distTags } = await fetch('http://registry.npmjs.org/antd').then(res => |
|
|
|
res.json(), |
|
|
|
const { time, 'dist-tags': distTags } = await fetch('http://registry.npmjs.org/antd').then( |
|
|
|
(res) => res.json(), |
|
|
|
); |
|
|
|
|
|
|
|
console.log('🐚 Latest Conch Version:', chalk.green(distTags.conch || 'null'), '\n'); |
|
|
|
|
|
|
|
// Sort and get the latest versions
|
|
|
|
const versionList = Object.keys(time) |
|
|
|
.filter(version => semver.valid(version) && !semver.prerelease(version)) |
|
|
|
.filter((version) => semver.valid(version) && !semver.prerelease(version)) |
|
|
|
.sort((v1, v2) => { |
|
|
|
const time1 = moment(time[v1]).valueOf(); |
|
|
|
const time2 = moment(time[v2]).valueOf(); |
|
|
@ -59,7 +60,7 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be |
|
|
|
// Cut off
|
|
|
|
.slice(0, 30) |
|
|
|
// Formatter
|
|
|
|
.map(version => ({ |
|
|
|
.map((version) => ({ |
|
|
|
publishTime: time[version], |
|
|
|
timeDiff: moment().diff(moment(time[version])), |
|
|
|
value: version, |
|
|
@ -107,7 +108,7 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be |
|
|
|
name: 'conchVersion', |
|
|
|
default: defaultVersion, |
|
|
|
message: 'Please select Conch Version:', |
|
|
|
choices: latestVersions.map(info => { |
|
|
|
choices: latestVersions.map((info) => { |
|
|
|
const { value, publishTime, depreciated } = info; |
|
|
|
const desc = moment(publishTime).fromNow(); |
|
|
|
|
|
|
@ -127,7 +128,7 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be |
|
|
|
// Current Mark
|
|
|
|
value === distTags.conch ? chalk.gray('- current') : '', |
|
|
|
] |
|
|
|
.filter(str => String(str).trim()) |
|
|
|
.filter((str) => String(str).trim()) |
|
|
|
.join(' '), |
|
|
|
}; |
|
|
|
}), |
|
|
@ -139,7 +140,7 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be |
|
|
|
if (deprecatedObj.match) { |
|
|
|
console.log('\n'); |
|
|
|
console.log(chalk.red('Deprecated For:')); |
|
|
|
deprecatedObj.reason.forEach(reason => { |
|
|
|
deprecatedObj.reason.forEach((reason) => { |
|
|
|
console.log(chalk.yellow(` * ${reason}`)); |
|
|
|
}); |
|
|
|
console.log('\n'); |
|
|
|