Browse Source

revert: revert #42060 (#42082)

pull/42085/head
lijianan 2 years ago
committed by GitHub
parent
commit
c3d02f8212
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      package.json
  2. 27
      scripts/post-script.js

2
package.json

@ -82,7 +82,7 @@
"pub": "npm run version && npm run collect-token-statistic && npm run token-meta && antd-tools run pub",
"rome:format": "rome format --write .",
"prepublishOnly": "antd-tools run guard",
"postpublish": "ts-node --esm --project tsconfig.node.json scripts/post-script.ts",
"postpublish": "node ./scripts/post-script.js",
"site": "dumi build && cp .surgeignore _site",
"sort": "npx sort-package-json",
"sort-api": "antd-tools run sort-api-table",

27
scripts/post-script.ts → scripts/post-script.js

@ -1,10 +1,10 @@
/* eslint-disable no-console */
import chalk from 'chalk';
import { spawnSync } from 'child_process';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import fetch from 'isomorphic-fetch';
import semver from 'semver';
const fetch = require('isomorphic-fetch');
const semver = require('semver');
const dayjs = require('dayjs');
const chalk = require('chalk');
const { spawnSync } = require('child_process');
const relativeTime = require('dayjs/plugin/relativeTime');
dayjs.extend(relativeTime);
@ -39,12 +39,12 @@ const DEPRECIATED_VERSION = {
],
};
function matchDeprecated(version: string) {
function matchDeprecated(version) {
const match = Object.keys(DEPRECIATED_VERSION).find((depreciated) =>
semver.satisfies(version, depreciated),
);
const reason = DEPRECIATED_VERSION[match as keyof typeof DEPRECIATED_VERSION] || [];
const reason = DEPRECIATED_VERSION[match] || [];
return {
match,
@ -98,13 +98,12 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be
const startDefaultVersionIndex = filteredLatestVersions.findIndex(
({ timeDiff }) => timeDiff >= SAFE_DAYS_START,
);
const defaultVersionList = filteredLatestVersions
.slice(0, startDefaultVersionIndex + 1)
.reverse();
// Find safe version
let defaultVersionObj: any;
let defaultVersionObj;
for (let i = 0; i < defaultVersionList.length - 1; i += 1) {
defaultVersionObj = defaultVersionList[i];
const nextVersionObj = defaultVersionList[i + 1];
@ -126,7 +125,6 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be
}
const { default: inquirer } = await import('inquirer');
// Selection
let { conchVersion } = await inquirer.prompt([
{
@ -138,6 +136,8 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be
const { value, publishTime, depreciated } = info;
const desc = dayjs(publishTime).fromNow();
//
return {
...info,
name: [
@ -188,6 +188,9 @@ const SAFE_DAYS_DIFF = 1000 * 60 * 60 * 24 * 3; // 3 days not update seems to be
console.log(`🎃 Conch Version not change. Safe to ${chalk.green('ignore')}.`);
} else {
console.log('💾 Tagging Conch Version:', chalk.green(conchVersion));
spawnSync('npm', ['dist-tag', 'add', `antd@${conchVersion}`, CONCH_TAG], { stdio: 'inherit' });
spawnSync('npm', ['dist-tag', 'add', `antd@${conchVersion}`, CONCH_TAG], {
stdio: 'inherit',
stdin: 'inherit',
});
}
})();
Loading…
Cancel
Save