From 624ec3365267b9b5e25ca9bdda34b27958e5f2a7 Mon Sep 17 00:00:00 2001 From: lynn <41491154+lynnshaoyu@users.noreply.github.com> Date: Tue, 23 Aug 2022 12:02:27 -0400 Subject: [PATCH] build: patch vanilla extract to speed up build time (#4447) patch ve to build Co-authored-by: Connor McEwen --- package.json | 5 ++- patches/@vanilla-extract+css+1.7.2.patch | 22 ++++++++++ yarn.lock | 54 ++++++++++++++++++++++-- 3 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 patches/@vanilla-extract+css+1.7.2.patch diff --git a/package.json b/package.json index 4ec6d9696d..ff4f10ef78 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "lint": "yarn eslint .", "test": "craco test --coverage", "cypress:open": "cypress open --browser chrome --e2e", - "cypress:run": "cypress run --browser chrome --e2e" + "cypress:run": "cypress run --browser chrome --e2e", + "postinstall": "patch-package" }, "jest": { "collectCoverageFrom": [ @@ -104,6 +105,8 @@ "eslint-plugin-unused-imports": "^2.0.0", "jest-styled-components": "^7.0.8", "ms.macro": "^2.0.0", + "patch-package": "^6.4.7", + "postinstall-postinstall": "^2.1.0", "prettier": "^2.7.1", "react-scripts": "^4.0.3", "relay-compiler": "^14.1.0", diff --git a/patches/@vanilla-extract+css+1.7.2.patch b/patches/@vanilla-extract+css+1.7.2.patch new file mode 100644 index 0000000000..b77ee5c1e2 --- /dev/null +++ b/patches/@vanilla-extract+css+1.7.2.patch @@ -0,0 +1,22 @@ +diff --git a/node_modules/@vanilla-extract/css/dist/vanilla-extract-css.cjs.dev.js b/node_modules/@vanilla-extract/css/dist/vanilla-extract-css.cjs.dev.js +index 6e40061..10283a2 100644 +--- a/node_modules/@vanilla-extract/css/dist/vanilla-extract-css.cjs.dev.js ++++ b/node_modules/@vanilla-extract/css/dist/vanilla-extract-css.cjs.dev.js +@@ -177,11 +177,13 @@ function generateIdentifier(debugId) { + var fileScopeHash = hash__default["default"](packageName ? "".concat(packageName).concat(filePath) : filePath); + var identifier = "".concat(fileScopeHash).concat(refCount); + +- if (adapter_dist_vanillaExtractCssAdapter.getIdentOption() === 'debug') { +- var devPrefix = getDevPrefix(debugId); ++ if (process.env.VANILLA_EXTRACT_DEV_PREFIX) { ++ if (adapter_dist_vanillaExtractCssAdapter.getIdentOption() === 'debug') { ++ var devPrefix = getDevPrefix(debugId); + +- if (devPrefix) { +- identifier = "".concat(devPrefix, "__").concat(identifier); ++ if (devPrefix) { ++ identifier = "".concat(devPrefix, "__").concat(identifier); ++ } + } + } + diff --git a/yarn.lock b/yarn.lock index 5e24ed3145..0a928028ec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4968,6 +4968,11 @@ resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== +"@yarnpkg/lockfile@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" + integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== + "@zeit/schemas@2.6.0": version "2.6.0" resolved "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.6.0.tgz" @@ -7071,7 +7076,7 @@ cross-spawn@^5.0.1: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^6.0.0: +cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== @@ -9412,6 +9417,13 @@ find-up@^5.0.0: locate-path "^6.0.0" path-exists "^4.0.0" +find-yarn-workspace-root@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz#f47fb8d239c900eb78179aa81b66673eac88f7bd" + integrity sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ== + dependencies: + micromatch "^4.0.2" + firebase@^9.1.3: version "9.1.3" resolved "https://registry.yarnpkg.com/firebase/-/firebase-9.1.3.tgz#11557f812f53edab5053ed0bd4dd344f2ae7fb5f" @@ -9560,7 +9572,7 @@ from2@^2.1.0: inherits "^2.0.1" readable-stream "^2.0.0" -fs-extra@^7.0.0: +fs-extra@^7.0.0, fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== @@ -11754,6 +11766,13 @@ kind-of@^6.0.0, kind-of@^6.0.2: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== +klaw-sync@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c" + integrity sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ== + dependencies: + graceful-fs "^4.1.11" + kleur@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" @@ -12985,7 +13004,7 @@ onetime@^5.1.0: dependencies: mimic-fn "^2.1.0" -open@^7.0.2: +open@^7.0.2, open@^7.4.2: version "7.4.2" resolved "https://registry.yarnpkg.com/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321" integrity sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q== @@ -13288,6 +13307,25 @@ pascalcase@^0.1.1: resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= +patch-package@^6.4.7: + version "6.4.7" + resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-6.4.7.tgz#2282d53c397909a0d9ef92dae3fdeb558382b148" + integrity sha512-S0vh/ZEafZ17hbhgqdnpunKDfzHQibQizx9g8yEf5dcVk3KOflOfdufRXQX8CSEkyOQwuM/bNz1GwKvFj54kaQ== + dependencies: + "@yarnpkg/lockfile" "^1.1.0" + chalk "^2.4.2" + cross-spawn "^6.0.5" + find-yarn-workspace-root "^2.0.0" + fs-extra "^7.0.1" + is-ci "^2.0.0" + klaw-sync "^6.0.0" + minimist "^1.2.0" + open "^7.4.2" + rimraf "^2.6.3" + semver "^5.6.0" + slash "^2.0.0" + tmp "^0.0.33" + path-browserify@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a" @@ -14188,6 +14226,11 @@ postcss@^8.1.0: nanoid "^3.1.25" source-map-js "^0.6.2" +postinstall-postinstall@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/postinstall-postinstall/-/postinstall-postinstall-2.1.0.tgz#4f7f77441ef539d1512c40bd04c71b06a4704ca3" + integrity sha512-7hQX6ZlZXIoRiWNrbMQaLzUUfH+sSx39u8EJ9HYuDc1kLo9IXKWjM5RSquZN1ad5GnH8CGFM78fsAAQi3OKEEQ== + preact@10.4.1: version "10.4.1" resolved "https://registry.npmjs.org/preact/-/preact-10.4.1.tgz" @@ -15868,6 +15911,11 @@ sisteransi@^1.0.5: resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== +slash@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== + slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"