From ad9c30d304e342b5fc66f018af2e8897f0e0e9df Mon Sep 17 00:00:00 2001 From: WDEP Date: Tue, 22 Jul 2025 11:06:06 +0800 Subject: [PATCH] chore: modify the script to be compatible with windows --- package.json | 17 ++++++++++------- tsconfig.build.json | 3 ++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 84ce1ec2..74b15db7 100644 --- a/package.json +++ b/package.json @@ -13,16 +13,16 @@ "lib" ], "scripts": { - "clean": "rm -rf dist && rm -rf es && rm -rf lib", + "clean": "rimraf dist es lib", "prebuild": "npm run clean", - "prefix": "NODE_ENV=production postcss dist/index.css -o dist/index.css", + "prefix": "cross-env NODE_ENV=production postcss dist/index.css -o dist/index.css", "copy:less": "copyfiles -u 1 src/**/*.less src/**/**/*.less es", - "js:cjs": "BABEL_ENV=cjs babel src -d lib --extensions '.ts,.tsx'", - "js:esm": "BABEL_ENV=esm babel src -d es --extensions '.ts,.tsx'", + "js:cjs": "cross-env BABEL_ENV=cjs babel src -d lib --extensions '.ts,.tsx'", + "js:esm": "cross-env BABEL_ENV=esm babel src -d es --extensions '.ts,.tsx'", "build:types": "tsc -p tsconfig.build.json", - "build": "npm run js:cjs && npm run js:esm && npm run build:types", + "build": "npm run js:cjs && npm run js:esm && npm run build:types && npm run build:css", "build:css": "lessc src/styles/index.less dist/index.css && npm run prefix && npm run copy:less", - "build:umd": "BABEL_ENV=umd rollup -c && npm run build:css", + "build:umd": "cross-env BABEL_ENV=umd rollup -c && npm run build:css", "prepublishOnly": "npm run build && npm run build:umd", "test": "jest", "test:watch": "jest --watch", @@ -55,6 +55,7 @@ "@testing-library/react": "^12.1.5", "@types/dompurify": "^2.4.0", "@types/jest": "^29.5.2", + "@types/node": "^24.0.14", "@types/react": "^17.0.62", "@types/react-dom": "^17.0.20", "@types/resize-observer-browser": "^0.1.7", @@ -82,7 +83,9 @@ "react-dom": "17.0.2", "rollup": "^2.79.1", "ts-jest": "^29.1.1", - "typescript": "^5.1.6" + "typescript": "^5.1.6", + "rimraf": "^6.0.1", + "cross-env": "^7.0.3" }, "peerDependencies": { "react": ">=16.8.0", diff --git a/tsconfig.build.json b/tsconfig.build.json index c72cdee1..3f861c6a 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -4,7 +4,8 @@ "rootDir": "src", "declaration": true, "declarationDir": "lib", - "emitDeclarationOnly": true + "emitDeclarationOnly": true, + "types": ["node"] }, "exclude": [ "node_modules",