-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release v0.2.0 [optimizations and bugfixes] (GH-43)
- Loading branch information
Showing
16 changed files
with
256 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "0.1.8", | ||
"version": "0.2.0", | ||
"name": "antd-phone-input", | ||
"description": "Advanced, highly customizable phone input component for Ant Design.", | ||
"keywords": [ | ||
|
@@ -26,34 +26,44 @@ | |
}, | ||
"exports": { | ||
".": { | ||
"import": "./index.esm.js", | ||
"import": "./index.js", | ||
"require": "./index.cjs.js", | ||
"types": { | ||
"default": "./index.d.ts" | ||
} | ||
}, | ||
"./legacy": { | ||
"import": "./legacy/index.esm.js", | ||
"import": "./legacy/index.js", | ||
"require": "./legacy/index.cjs.js", | ||
"types": { | ||
"default": "./legacy/index.d.ts" | ||
} | ||
}, | ||
"./types": { | ||
"import": "./types.js", | ||
"require": "./types.cjs.js", | ||
"types": { | ||
"default": "./types.d.ts" | ||
} | ||
}, | ||
"./legacy/style": { | ||
"default": "./legacy/style.less" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"files": [ | ||
"index*", | ||
"style*", | ||
"types*", | ||
"legacy", | ||
"LICENSE", | ||
"README.md" | ||
], | ||
"scripts": { | ||
"build": "npm run build:clean && npm run build:rollup && cp src/legacy/*.less legacy", | ||
"build:rollup": "rollup -c --configPlugin @rollup/plugin-typescript", | ||
"build:clean": "rm -r legacy index* || true", | ||
"rename": "bash -c 'for file in $1*.js; do if [[ \"${file%.js}\" =~ ^[^.]*$ ]]; then mv \"$file\" \"${file%.js}.$0.js\"; fi; done'", | ||
"compile": "tsc --module commonjs && npm run rename -- cjs && npm run rename -- cjs legacy/ && tsc --declaration", | ||
"build": "npm run compile && tsx scripts/prepare-styles.ts", | ||
"prebuild": "rm -r legacy index* style* types* || true", | ||
"test": "jest --config jestconfig.json" | ||
}, | ||
"license": "MIT", | ||
|
@@ -62,28 +72,19 @@ | |
"react": ">=16" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-alias": "^4.0.3", | ||
"@rollup/plugin-json": "^6.0.0", | ||
"@rollup/plugin-typescript": "^11.0.0", | ||
"@testing-library/react": "^14.0.0", | ||
"@testing-library/user-event": "^14.4.3", | ||
"@types/jest": "^29.4.0", | ||
"@types/node": "^18.14.1", | ||
"@types/react": "^18.0.28", | ||
"antd": "npm:antd@^5.3.2", | ||
"@testing-library/user-event": "^14.5.1", | ||
"@types/jest": "^29.5.5", | ||
"@types/react": "^18.2.21", | ||
"antd": "npm:[email protected]", | ||
"antd4": "npm:antd@^4.24.8", | ||
"identity-obj-proxy": "^3.0.0", | ||
"jest": "^29.4.3", | ||
"jest-environment-jsdom": "^29.4.3", | ||
"postcss": "^8.4.21", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"rollup": "3.17.2", | ||
"rollup-plugin-dts": "^5.2.0", | ||
"rollup-plugin-postcss": "^4.0.2", | ||
"ts-jest": "^29.0.5", | ||
"tslib": "^2.5.0", | ||
"typescript": "^4.9.5" | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"ts-jest": "^29.1.1", | ||
"tslib": "^2.6.2", | ||
"tsx": "^3.12.10", | ||
"typescript": "^5.2.2" | ||
}, | ||
"dependencies": { | ||
"react-phone-input-2": "^2.15.1" | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import fs from "fs"; | ||
import util from "node:util"; | ||
import process from "node:child_process"; | ||
|
||
const exec = (command: string) => util.promisify(process.exec)(command); | ||
|
||
(async () => { | ||
await exec("bash -c 'cp src/legacy/*.{le,c}ss legacy'"); | ||
|
||
const style = fs.readFileSync("node_modules/react-phone-input-2/lib/style.css"); | ||
const regex = /(\.react-tel-input)\s\.flag.+\1\s*\.\w{2}\b\s*\{[^{}]*}/; | ||
const flags = "\n" + (style.toString().match(regex) || [""])[0]; | ||
|
||
let styles = fs.readFileSync("./legacy/style5.css", "utf8") + flags; | ||
styles = styles.replaceAll(/\/\*\*.*?\*\/[\n\s]*/gs, ""); | ||
styles = styles.replaceAll(/\B[^{}]*?\{[\s\n]}/g, ""); | ||
styles = styles.replaceAll(/\//g, "\\\/"); | ||
styles = styles.replaceAll(/\n\s*/g, ""); | ||
|
||
await exec(`find legacy -maxdepth 1 -name '*.js' -type f -exec sed -i 's/style5.css/${styles}/g' {} +`); | ||
await exec("find . legacy -maxdepth 1 \\( -name '*.ts' -o -name '*.js' \\) -type f -exec sed -i 's/antd\\/lib/antd\\/es/g' {} +"); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"esModuleInterop": true, | ||
"lib": [ | ||
"esnext" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.