diff --git a/package.json b/package.json index 738dc08..2d80712 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "cleanup": "prettier --write src --parser typescript", "test": "jest --silent --runInBand", "release": "sh scripts/release.sh", + "preinstall": "sh scripts/yarn.sh", "prepare": "husky install" }, "repository": { @@ -76,6 +77,7 @@ "rollup-plugin-terser": "^7.0.2", "rollup-plugin-typescript2": "^0.30.0", "ts-jest": "^26.4.2", - "typescript": "next" + "tslib": "^2.2.0", + "typescript": "^4.2.4" } } diff --git a/scripts/release.sh b/scripts/release.sh index ed9e885..b9fedf6 100644 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,4 +1,12 @@ #!/bin/sh +YELLOW_COLOR="\u001b[33m" +GREEN_COLOR="\033[0;32m" +RESET_COLOR="\u001b[39m" + +printf "${YELLOW_COLOR}Checking for errors...${RESET_COLOR}\n" source scripts/check.sh +printf "${GREEN_COLOR}No errors found.${RESET_COLOR}\n" +printf "${YELLOW_COLOR}Building distribution bundles...${RESET_COLOR}\n" source scripts/build.sh -printf "\n\n\033[1;31m[!] \033[0;33mPlease run \033[0m\`\033[1;36mnp\033[0m\`\n\n" +printf "${GREEN_COLOR}Built distribution bundles.${RESET_COLOR}\n" +printf "${YELLOW_COLOR}Please run \`np\` manually to publish the package.${RESET_COLOR}" diff --git a/scripts/yarn.sh b/scripts/yarn.sh new file mode 100644 index 0000000..2f0ff5a --- /dev/null +++ b/scripts/yarn.sh @@ -0,0 +1,8 @@ +#!/bin/sh +YELLOW_COLOR="\u001b[33m" +RESET_COLOR="\u001b[39m" + +if [[ $npm_execpath != *"yarn"* ]]; then + printf "${YELLOW_COLOR}This repository requires Yarn 1.x for scripts to work properly.${RESET_COLOR}\n\n" + exit 1 +fi diff --git a/yarn.lock b/yarn.lock index 91d7569..fec5e36 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6465,6 +6465,11 @@ tslib@^1.8.1, tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== +tslib@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c" + integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w== + tsutils@^3.17.1: version "3.21.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" @@ -6545,10 +6550,10 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -typescript@next: - version "4.3.0-dev.20210506" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.0-dev.20210506.tgz#65279fe5746ae4d82397f8ee82c16024e78e1e8c" - integrity sha512-91ypOFD5hHQrmldSns8/oIq9VZ0rpA/t5NC6M9b5ZLcUz6tSF66wDqIBs6fu/yOwvOd7oozYEEC5nuBfItMAsQ== +typescript@^4.2.4: + version "4.2.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.4.tgz#8610b59747de028fda898a8aef0e103f156d0961" + integrity sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg== unicode-canonical-property-names-ecmascript@^1.0.4: version "1.0.4"