Skip to content

Commit

Permalink
chore: Migrate CJS to ESM (ant-design#41809)
Browse files Browse the repository at this point in the history
* add devDependencies

* rerun ci

* rerun ci

* update

* update

* fix

* chore: update

* fix

* fix

---------

Co-authored-by: MadCcc <[email protected]>
  • Loading branch information
li-jia-nan and MadCcc authored Apr 28, 2023
1 parent 78e9d58 commit c9bac13
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 256 deletions.
2 changes: 1 addition & 1 deletion components/tabs/demo/position.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import type { RadioChangeEvent } from 'antd';
import { Radio, Space, Tabs } from 'antd';
import React, { useState } from 'react';

type TabPosition = 'left' | 'right' | 'top' | 'bottom';

Expand Down
File renamed without changes.
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
"clean-lockfiles": "rm -rf package-lock.json yarn.lock",
"collect-token-statistic": "ts-node --project tsconfig.node.json scripts/collect-token-statistic.js",
"token-meta": "node scripts/generate-token-meta.js",
"prestart": "npm run version & npm run collect-token-statistic & npm run token-meta",
"precompile": "npm run version & npm run collect-token-statistic & npm run token-meta",
"prestart": "npm run version && npm run collect-token-statistic && npm run token-meta",
"precompile": "npm run prestart",
"pretest": "npm run version",
"predist": "npm run version",
"presite": "npm run version & npm run collect-token-statistic & npm run token-meta",
"presite": "npm run prestart",
"compile": "npm run clean && antd-tools run compile",
"changelog": "git fetch origin && node ./scripts/print-changelog",
"predeploy": "antd-tools run clean && npm run site && cp CNAME _site && npm run site:test",
Expand Down Expand Up @@ -95,7 +95,7 @@
"site:test": "jest --config .jest.site.js --no-cache --force-exit",
"test-image": "jest --config .jest.image.js --no-cache -i -u",
"argos": "node ./scripts/argos-upload.js",
"version": "node ./scripts/generate-version",
"version": "ts-node --esm --project tsconfig.node.json scripts/generate-version.ts",
"install-react-16": "npm i --no-save --legacy-peer-deps react@16 react-dom@16 @testing-library/react@12",
"install-react-17": "npm i --no-save --legacy-peer-deps react@17 react-dom@17 @testing-library/react@12",
"install-react-18": "npm i --no-save --legacy-peer-deps react@18 react-dom@18"
Expand Down Expand Up @@ -169,19 +169,24 @@
"@qixian.cs/github-contributors-list": "^1.1.0",
"@size-limit/file": "^8.1.0",
"@stackblitz/sdk": "^1.3.0",
"@swc/core": "^1.3.50",
"@swc/helpers": "^0.5.0",
"@testing-library/dom": "^9.0.0",
"@testing-library/jest-dom": "^5.16.3",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.2",
"@types/gtag.js": "^0.0.12",
"@types/isomorphic-fetch": "^0.0.36",
"@types/jest": "^29.0.0",
"@types/jest-axe": "^3.5.3",
"@types/jest-environment-puppeteer": "^5.0.0",
"@types/jest-image-snapshot": "^6.1.0",
"@types/jquery": "^3.5.14",
"@types/lodash": "^4.14.139",
"@types/lz-string": "^1.3.34",
"@types/node": "^18.15.11",
"@types/prismjs": "^1.26.0",
"@types/progress": "^2.0.5",
"@types/puppeteer": "^7.0.4",
"@types/qs": "^6.9.7",
"@types/react": "^18.0.0",
Expand Down Expand Up @@ -269,6 +274,7 @@
"react-router-dom": "^6.0.2",
"react-sticky-box": "^2.0.0",
"react-window": "^1.8.5",
"regenerator-runtime": "^0.13.11",
"remark": "^14.0.1",
"remark-cli": "^11.0.0",
"remark-lint": "^9.0.0",
Expand Down
224 changes: 0 additions & 224 deletions scripts/css-variable-sync.js

This file was deleted.

7 changes: 4 additions & 3 deletions scripts/generate-version.js → scripts/generate-version.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const fs = require('fs-extra');
const path = require('path');
import fs from 'fs';
import path from 'path';
import localPackage from '../package.json';

const { version } = require('../package.json');
const { version } = localPackage;

fs.writeFileSync(
path.join(__dirname, '..', 'components', 'version', 'version.ts'),
Expand Down
23 changes: 0 additions & 23 deletions scripts/tmp-mv-dumi-site.js

This file was deleted.

6 changes: 5 additions & 1 deletion tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"extends": "./tsconfig.json",
"ts-node": {
"swc": true
},
"compilerOptions": {
"module": "CommonJS",
"types": ["node"]
"types": ["node"],
"resolveJsonModule": true
}
}

0 comments on commit c9bac13

Please sign in to comment.