mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
chore: Migrate CJS to ESM (#42060)
This commit is contained in:
parent
f34f4d485f
commit
9258e0bb24
@ -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": "node ./scripts/post-script.js",
|
||||
"postpublish": "ts-node --esm --project tsconfig.node.json scripts/post-script.ts",
|
||||
"site": "dumi build && cp .surgeignore _site",
|
||||
"sort": "npx sort-package-json",
|
||||
"sort-api": "antd-tools run sort-api-table",
|
||||
@ -177,6 +177,7 @@
|
||||
"@testing-library/user-event": "^14.4.2",
|
||||
"@types/fs-extra": "^11.0.1",
|
||||
"@types/gtag.js": "^0.0.12",
|
||||
"@types/inquirer": "^9.0.3",
|
||||
"@types/isomorphic-fetch": "^0.0.36",
|
||||
"@types/jest": "^29.0.0",
|
||||
"@types/jest-axe": "^3.5.3",
|
||||
|
@ -1,13 +1,13 @@
|
||||
/* eslint-disable no-console */
|
||||
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');
|
||||
// const packageJson = require('../package.json');
|
||||
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';
|
||||
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
const CONCH_TAG = 'conch-v5';
|
||||
|
||||
const DEPRECIATED_VERSION = {
|
||||
@ -39,12 +39,12 @@ const DEPRECIATED_VERSION = {
|
||||
],
|
||||
};
|
||||
|
||||
function matchDeprecated(version) {
|
||||
function matchDeprecated(version: string) {
|
||||
const match = Object.keys(DEPRECIATED_VERSION).find((depreciated) =>
|
||||
semver.satisfies(version, depreciated),
|
||||
);
|
||||
|
||||
const reason = DEPRECIATED_VERSION[match] || [];
|
||||
const reason = DEPRECIATED_VERSION[match as keyof typeof DEPRECIATED_VERSION] || [];
|
||||
|
||||
return {
|
||||
match,
|
||||
@ -98,12 +98,13 @@ 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;
|
||||
let defaultVersionObj: any;
|
||||
for (let i = 0; i < defaultVersionList.length - 1; i += 1) {
|
||||
defaultVersionObj = defaultVersionList[i];
|
||||
const nextVersionObj = defaultVersionList[i + 1];
|
||||
@ -125,6 +126,7 @@ 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([
|
||||
{
|
||||
@ -136,8 +138,6 @@ 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,9 +188,6 @@ 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',
|
||||
stdin: 'inherit',
|
||||
});
|
||||
spawnSync('npm', ['dist-tag', 'add', `antd@${conchVersion}`, CONCH_TAG], { stdio: 'inherit' });
|
||||
}
|
||||
})();
|
Loading…
Reference in New Issue
Block a user