diff --git a/package.json b/package.json index 98c80c838..785abd899 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "@wangeditor-team/wangeditor", "private": true, "scripts": { + "scripts": "better-scripts", "test": "cross-env NODE_OPTIONS=--unhandled-rejections=warn jest --detectOpenHandles --passWithNoTests", "test-c": "cross-env NODE_OPTIONS=--unhandled-rejections=warn jest --coverage", "dev": "sh build/build-all.sh dev", @@ -65,6 +66,7 @@ "babel-core": "^7.0.0-bridge.0", "babel-jest": "^27.0.6", "babel-plugin-istanbul": "^6.0.0", + "better-scripts": "^0.1.1", "commitlint": "^11.0.0", "commitlint-config-cz": "^0.13.2", "concurrently": "^6.2.0", diff --git a/scripts.json b/scripts.json new file mode 100644 index 000000000..3187357da --- /dev/null +++ b/scripts.json @@ -0,0 +1,68 @@ +{ + "$schema": "https://raw.githubusercontent.com/iamyoki/better-scripts/main/lib/schema.json", + "bootstrap": { + "alias": "๐Ÿ”Œ Bootstrap", + "command": "lerna bootstrap --use-workspaces" + }, + "tests": { + "alias": "๐Ÿงช Tests", + "desc": "Select a test script to run", + "scripts": { + "test": ["cross-env NODE_OPTIONS=--unhandled-rejections=warn jest --detectOpenHandles --passWithNoTests", "Run jest"], + "test-c": ["cross-env NODE_OPTIONS=--unhandled-rejections=warn jest --coverage", "Run jest coverage"], + "cypress:open": "cypress open", + "cypress:run": "cypress run", + "e2e:dev": "concurrently \"yarn scripts run example\" \"yarn scripts run tests.cypress:open\"", + "e2e": "concurrently \"yarn scripts run example\" \"yarn scripts run tests.cypress:run\"" + } + }, + "builds": { + "alias": "๐Ÿ“ฆ Builds", + "desc": "Select a build script to run", + "scripts": { + "dev": ["sh build/build-all.sh dev", "Build dev"], + "build": "sh build/build-all.sh" + } + }, + "releases": { + "alias": "๐Ÿš€ Releases", + "desc": "Run prerelease before release", + "command": "yarn scripts run builds.build", + "scripts": { + "release:version": { + "alias": "Version", + "command": "git pull origin master && lerna version --conventional-commits && node ./scripts/release-tag.js" + }, + "release:publish:experimental": { + "alias": "Publish Experimental", + "command": "lerna publish --dist-tag experimental" + }, + "release:publish:canary": { + "alias": "Publish Canary", + "command": "lerna publish --canary" + }, + "release:next": { + "alias": "Next", + "command": "yarn prerelease && lerna publish --dist-tag next" + }, + "release:publish": { + "alias": "Publish", + "command": "lerna publish from-git --yes" + }, + "release:package": { + "alias": "Package", + "command": "lerna publish from-package --yes" + } + } + }, + "lints": { + "alias": "๐Ÿ”Ž Lints", + "desc": "Select a lint script to run", + "scripts": { + "format": "yarn prettier --write", + "lint": "eslint \"packages/*/+(src|__tests__)/**/*.+(ts|tsx)\"", + "prettier": "prettier --ignore-path .gitignore \"packages/*/+(src|__tests__)/**/*.+(ts|tsx)\"" + } + }, + "example": "lerna exec --scope @wangeditor/editor -- yarn run example" +} diff --git a/yarn.lock b/yarn.lock index bc79119fe..be7986e3e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -947,6 +947,11 @@ resolved "https://registry.npm.taobao.org/@bcoe/v8-coverage/download/@bcoe/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha1-daLotRy3WKdVPWgEpZMteqznXDk= +"@colors/colors@1.5.0": + version "1.5.0" + resolved "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" + integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== + "@commitlint/cli@^11.0.0": version "11.0.0" resolved "https://registry.npmmirror.com/@commitlint/cli/download/@commitlint/cli-11.0.0.tgz#698199bc52afed50aa28169237758fa14a67b5d3" @@ -3332,6 +3337,18 @@ before-after-hook@^2.0.0, before-after-hook@^2.2.0: resolved "https://registry.nlark.com/before-after-hook/download/before-after-hook-2.2.2.tgz#a6e8ca41028d90ee2c24222f201c90956091613e" integrity sha1-pujKQQKNkO4sJCIvIByQlWCRYT4= +better-scripts@^0.1.1: + version "0.1.1" + resolved "https://registry.npmjs.org/better-scripts/-/better-scripts-0.1.1.tgz#30ea8bf0a5c5dcd40a8baf32d20dcac58ee54b7c" + integrity sha512-m+U2Zw1EzkQ6Kx6PyWkAUozP1ttcahb12BYJ8whiAra3MwURh6ULZO80Dcw2tVEzoMl7xrsOgz6eQ2F8TV+m0w== + dependencies: + chalk "^5.0.1" + cli-table3 "^0.6.2" + cosmiconfig "^7.0.1" + pkg-dir "^6.0.1" + prompts "^2.4.2" + yargs "^17.5.1" + big.js@^5.2.2: version "5.2.2" resolved "https://registry.npmmirror.com/big.js/download/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" @@ -3717,6 +3734,11 @@ chalk@^3.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" +chalk@^5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz#ca57d71e82bb534a296df63bbacc4a1c22b2a4b6" + integrity sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w== + char-regex@^1.0.2: version "1.0.2" resolved "https://registry.nlark.com/char-regex/download/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" @@ -3823,6 +3845,15 @@ cli-spinners@^2.5.0: resolved "https://registry.npmmirror.com/cli-spinners/download/cli-spinners-2.6.1.tgz?cache=0&sync_timestamp=1633109759784&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fcli-spinners%2Fdownload%2Fcli-spinners-2.6.1.tgz#adc954ebe281c37a6319bfa401e6dd2488ffb70d" integrity sha1-rclU6+KBw3pjGb+kAebdJIj/tw0= +cli-table3@^0.6.2: + version "0.6.2" + resolved "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.2.tgz#aaf5df9d8b5bf12634dc8b3040806a0c07120d2a" + integrity sha512-QyavHCaIC80cMivimWu4aWHilIpiDpfm3hGmqAmXVL1UsnbLuBSMd21hTX6VY4ZSDSM73ESLeF8TOYId3rBTbw== + dependencies: + string-width "^4.2.0" + optionalDependencies: + "@colors/colors" "1.5.0" + cli-table3@~0.6.0: version "0.6.0" resolved "https://registry.npm.taobao.org/cli-table3/download/cli-table3-0.6.0.tgz#b7b1bc65ca8e7b5cef9124e13dc2b21e2ce4faee" @@ -4377,7 +4408,7 @@ corser@^2.0.1: resolved "https://registry.nlark.com/corser/download/corser-2.0.1.tgz#8eda252ecaab5840dcd975ceb90d9370c819ff87" integrity sha1-jtolLsqrWEDc2XXOuQ2TcMgZ/4c= -cosmiconfig@7.0.1, cosmiconfig@^7.0.0: +cosmiconfig@7.0.1, cosmiconfig@^7.0.0, cosmiconfig@^7.0.1: version "7.0.1" resolved "https://registry.nlark.com/cosmiconfig/download/cosmiconfig-7.0.1.tgz#714d756522cace867867ccb4474c5d01bbae5d6d" integrity sha1-cU11ZSLKzoZ4Z8y0R0xdAbuuXW0= @@ -5690,6 +5721,14 @@ find-up@^5.0.0: locate-path "^6.0.0" path-exists "^4.0.0" +find-up@^6.1.0: + version "6.3.0" + resolved "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz#2abab3d3280b2dc7ac10199ef324c4e002c8c790" + integrity sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw== + dependencies: + locate-path "^7.1.0" + path-exists "^5.0.0" + find-versions@^4.0.0: version "4.0.0" resolved "https://registry.nlark.com/find-versions/download/find-versions-4.0.0.tgz?cache=0&sync_timestamp=1619599628493&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffind-versions%2Fdownload%2Ffind-versions-4.0.0.tgz#3c57e573bf97769b8cb8df16934b627915da4965" @@ -8086,6 +8125,13 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" +locate-path@^7.1.0: + version "7.1.1" + resolved "https://registry.npmjs.org/locate-path/-/locate-path-7.1.1.tgz#8e1e5a75c7343770cef02ff93c4bf1f0aa666374" + integrity sha512-vJXaRMJgRVD3+cUZs3Mncj2mxpt5mP0EmNOsxRSZRMlbqjvxzDEOIUWXGmavo0ZC9+tNZCBLQ66reA11nbpHZg== + dependencies: + p-locate "^6.0.0" + lodash._reinterpolate@^3.0.0: version "3.0.0" resolved "https://registry.nlark.com/lodash._reinterpolate/download/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" @@ -9206,6 +9252,13 @@ p-limit@^3.0.2: dependencies: yocto-queue "^0.1.0" +p-limit@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz#914af6544ed32bfa54670b061cafcbd04984b644" + integrity sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ== + dependencies: + yocto-queue "^1.0.0" + p-locate@^2.0.0: version "2.0.0" resolved "https://registry.nlark.com/p-locate/download/p-locate-2.0.0.tgz?cache=0&sync_timestamp=1629892708584&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fp-locate%2Fdownload%2Fp-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" @@ -9234,6 +9287,13 @@ p-locate@^5.0.0: dependencies: p-limit "^3.0.2" +p-locate@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz#3da9a49d4934b901089dca3302fa65dc5a05c04f" + integrity sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw== + dependencies: + p-limit "^4.0.0" + p-map-series@^1.0.0: version "1.0.0" resolved "https://registry.npm.taobao.org/p-map-series/download/p-map-series-1.0.0.tgz#bf98fe575705658a9e1351befb85ae4c1f07bdca" @@ -9429,6 +9489,11 @@ path-exists@^4.0.0: resolved "https://registry.nlark.com/path-exists/download/path-exists-4.0.0.tgz?cache=0&sync_timestamp=1628765027018&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fpath-exists%2Fdownload%2Fpath-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" integrity sha1-UTvb4tO5XXdi6METfvoZXGxhtbM= +path-exists@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz#a6aad9489200b21fab31e49cf09277e5116fb9e7" + integrity sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ== + path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.nlark.com/path-is-absolute/download/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" @@ -9553,6 +9618,13 @@ pkg-dir@^5.0.0: dependencies: find-up "^5.0.0" +pkg-dir@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/pkg-dir/-/pkg-dir-6.0.1.tgz#8ec964cecaef98a2bdb9c164733f90a5bcd2352d" + integrity sha512-C9R+PTCKGA32HG0n5I4JMYkdLL58ZpayVuncQHQrGeKa8o26A4o2x0u6BKekHG+Au0jv5ZW7Xfq1Cj6lm9Ag4w== + dependencies: + find-up "^6.1.0" + please-upgrade-node@^3.2.0: version "3.2.0" resolved "https://registry.npm.taobao.org/please-upgrade-node/download/please-upgrade-node-3.2.0.tgz#aeddd3f994c933e4ad98b99d9a556efa0e2fe942" @@ -9941,7 +10013,7 @@ promise.series@^0.2.0: resolved "https://registry.npm.taobao.org/promise.series/download/promise.series-0.2.0.tgz#2cc7ebe959fc3a6619c04ab4dbdc9e452d864bbd" integrity sha1-LMfr6Vn8OmYZwEq029yeRS2GS70= -prompts@^2.0.1: +prompts@^2.0.1, prompts@^2.4.2: version "2.4.2" resolved "https://registry.npmmirror.com/prompts/download/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" integrity sha1-e1fnOzpIAprRDr1E90sBcipMsGk= @@ -12468,6 +12540,11 @@ yargs-parser@^18.1.2: camelcase "^5.0.0" decamelize "^1.2.0" +yargs-parser@^21.0.0: + version "21.1.1" + resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== + yargs@^13.0.0: version "13.3.2" resolved "https://registry.npmmirror.com/yargs/download/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" @@ -12531,6 +12608,19 @@ yargs@^16.0.0, yargs@^16.2.0: y18n "^5.0.5" yargs-parser "^20.2.2" +yargs@^17.5.1: + version "17.5.1" + resolved "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz#e109900cab6fcb7fd44b1d8249166feb0b36e58e" + integrity sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.0.0" + yauzl@^2.10.0: version "2.10.0" resolved "https://registry.npm.taobao.org/yauzl/download/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9" @@ -12543,3 +12633,8 @@ yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.nlark.com/yocto-queue/download/yocto-queue-0.1.0.tgz?cache=0&sync_timestamp=1628812679256&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fyocto-queue%2Fdownload%2Fyocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha1-ApTrPe4FAo0x7hpfosVWpqrxChs= + +yocto-queue@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251" + integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==