@shopify/cli-hydrogen 3.39.0 → 4.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/hydrogen/build.js +106 -0
- package/dist/commands/hydrogen/check.js +34 -0
- package/dist/commands/hydrogen/dev.js +110 -0
- package/dist/commands/hydrogen/generate/route.js +174 -0
- package/dist/commands/hydrogen/generate/route.test.js +121 -0
- package/dist/commands/hydrogen/init.js +42 -0
- package/dist/commands/hydrogen/preview.js +34 -0
- package/dist/hooks/init.js +18 -0
- package/dist/templates/[robots.txt].tsx +41 -0
- package/dist/templates/[sitemap.xml].tsx +200 -0
- package/dist/templates/account/login.tsx +74 -0
- package/dist/templates/account/register.tsx +74 -0
- package/dist/templates/cart.tsx +43 -0
- package/dist/templates/collections/$collectionHandle.tsx +65 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/02/76/13bbea15bb42b81a204b0dc5f14726e0bfa8d012a7b284f887cc2e3c92195d6b07a78f199f990b311ca5fafa9079563503cdd81808cd9b7e496d86c72732 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/04/98/0e81e9c8b9ebe79605df3bf2476728954d7ad01229239c4acbaaefe8e2aa6558b7a08b14cd245365258a7ef2191a7b1d656ae081cc1d129662476f547e96 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/0d/2c/9c0b3f348e40c09b984fbb9d08a1e983e86b4ee155baf87d0fd2428689357600b1f0d71d1edcc0b7381c27eaa024e58b2b76f5a3ed14f836f0f17b0a9b0c +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/18/ed/a944ad29223f60420de387c0325270e1a26f7826a52c813bf5dd319660be2c1cf779dbd9be17aae3c9cd24baa75ddd411fd0674a0e4664b69e6115bf73ed +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/19/32/725ad9da4e9155ebe89c04ce462b0ced1a34e836fa4d0b8829baaf369979e173477fc3468eb1fc91562fbc7abef2a51dda6398a65dd490111a668d460647 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/1e/24/595da822fb6e0d70b7a478b35192c23348911f81396b562a4c5d5ed52cf28ec3e9253496dc0e307da724bf0572b1e4c490b3c922af5b5c3ee13642b050ce +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/42/8e/b848de3b458a3ae29197f58d73db1dcd110d272982471001e4c049af15058851abe97b8671671c36918d87c97adde4c188df8648dc2f71128213dfc72dc2 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/44/52/5bdf014389259b65ea3cf4ef77cbecdc3fe3f95487a53633fccd9dcf29e0eefcccc3a985ba720febd74aeb96e51259a3ccefc51c1c6d91f23fe362ad2bc9 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/5c/12/8d5330d3dea4de70c4b434403ffd5c5083d7f2c2c68a2fc149bd066bc6cde6a75fcb5ab2b59772c72c108f42af3338ba95b69ab4248e1d1a7046e51607b7 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/63/3a/fb02a5e332b2f3a90f634a25f88555704bfeaf5e371631306fcb0d0d548e3d2efd6b525bf62d54f8f0548b73cccabaa34ebb0d51e624bf67de37afb78c8c +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/73/40/c822831f11f08a9ceea944d0145b072ba6164a3e2e75f98fda5437cda6dfddf9ca9450445c1f3236228d6259ac95e4cde9bb6e5996490ed00b7b13b06121 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/76/07/e5a2affb0d722624b151277bfa2c3cd26f1e5c0d3a11d5bb3ba745631b2e8fd1ade94990b19a6acb2805de34048a34c035406d4829bcf3f41a061b270d60 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/86/ba/0dd1289bc16f8dda9cb229b7ffa7aa59c4bdba95e1352a0b61de02fccd726c0269d8cabeae04ffddf408f42491354e24866fe5801ee4bb1ea4b98cce482c +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/8e/7e/005894d7690ac4cc4f3301702083a6d900a8971af9f9f1b38dc4821809c3b6ed302521bfce7460c8673d38875c4187e3b9f59b5d4f4a399cc3869f5b0f55 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/93/6b/e60098157f6bff8ba570cab2ffd97a14983109006f7fa87e4432728366f96dfb19e957d28754daa45f1b6cb2421d26ab59bbd5ce5a448d6102e8e662403d +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/95/3c/ad893b35be316318d41d6141e282cddf5d214b4c335d86498cea48f1ecf32c108a2d58f7aa4a51bdb309da5762afda4204a0551d1a203cf4e642f9669317 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/9b/2b/829beb6526ccc7e54cfa51951fce87e756d17a2096b57011a441b2f9eb4f546e2a6cc650a872f033c5d38bb7b704b862e033212258ee5496c2c0c1cef0c8 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/ae/9a/84c86ca2189f308cb995b8289870f41e4692da806538c67dbe3f4849718a6a7e712fa105aff5ceb5135d0eececf75ab7281e171975bf8ae1ace932046621 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/ae/d9/a6fed1d3e4f1cd165a5a4dc633dbf277ea6cb6089b239cde32fef7d5d041590c05216207b5d6ad6b81d02865ce06b41670751940fd49c43b6bc80efc0076 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/b1/56/584dd264cd440a690eaaaef18f8837dd5a32415fad319adbb289121c1812bcd34dfed87f66cd6ba3b4bf26bc988de0b19c32a593609e5656c9d8cfbc1b2c +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/b5/32/0a7d091d5e19d604dfc1702a81918fb1e21a5263eec2c443e1b0cc3b51d95dc894883dd5bf6851e27dfaf8566a9752d9fc24698cf77fbd692897eb0fb189 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/bc/33/6e26ece5ac53d9eac9ac8a192ef39faf2a587a5808253c659fb1d371c477fc8074d428c8d1929b0d85dd1fec66fc79ea6b9fcb01507e2efec75fb7fbc2cc +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/d8/b5/26061c660a6fb2a2cabd1f7dcf701c984788ed6329891d8d540fa01b9b8ad4cda43fc436b61c0d76b687f1600ad46b59ea52da003b1e7edb4472f74399cb +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/e2/ab/e085c7b7942344631033fca463b3da5f58bb80e3a7f9e52140bb4ef3a46e1f10bb8aa1dbc401bec8718939075060c8acaf7a6e0b6e082f9b83f5a4590296 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/e5/41/1521ee52031bdb29b551344ea7b79161701bfd506f12776bd0aca74255c38adae35405e44958ce8c6807f0a290e48aac6e28eb540dad3e62ae59dc487a8b +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/e8/ae/9b467e1d23913d4584d9417875b3cdc25f6dfed8b228f3a0c818129010b778aae1af1eb200b015ab428e79afe0ef1061262392fbdb96ed7da95efbe7f758 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/ea/40/1c04ae276d1792713cf3118f13f0d73df08b3604b039412073447f7410c95a2a6567aca59d31b263cb9119085fba85d208f25b71b3c96ef151f418b7cd48 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/ec/9a/4e2483d9a13faadd1cbcfe0ab70cdf87a838fe1cf04d11c56c478472e08f5b9e785654654d9b338c051fd762d20e23f14f2c1e110664815f1012c3ab8a08 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/f0/62/eca4034f805cff0ae6d9c9f08128afa5e9bc40f2177b2ff2e8625187e02b6219e9b049300d2a90c7fe947873483161a8b2b040c1cd376d908a7e3e4cb8bf +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/f2/5f/9ccdef519bdb0a99e4f88d4c2c5a2acd4bf79507c81e4403263a875f093ad8d04dd863c4d610426a2974a4f95713c0cd9f29d06b294a6960c2cabffa6c42 +1 -0
- package/dist/templates/demo-store/.cache/content-v2/sha512/f4/ca/0f5ba83b2d5596d6f5917cab8ecedc1a457d62bf4988914f35161e4a4bd39a85030d1f69e2da82d9c2652985f7ca7c8ec2e79fe0235d534911543090b3c5 +1 -0
- package/dist/templates/demo-store/.cache/index-v5/05/44/bebd201ef5e9e9a7c41bd789ff110691a32c7f7fbbbdd630f33d96667cd1 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/26/b5/113aeb17f9f4ef406a1f8b143895199ca545fd0cc1e7972435a092910963 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/2c/09/e60b5cd818510e0cbec908aae3b74175e35e446f4383e87c21489433a11e +2 -0
- package/dist/templates/demo-store/.cache/index-v5/38/21/c3fb7841590b85142018ba88a01045ef1249ac34211342579f0129eae294 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/3a/98/8858fe7de4bf85d37c71adc322cc95335b498bef9a4ae41db324bf5696cc +2 -0
- package/dist/templates/demo-store/.cache/index-v5/3e/40/7021422a7cae2c05484b491fb5b85edd82b325e598ac9e5c6afb858049da +2 -0
- package/dist/templates/demo-store/.cache/index-v5/47/2f/8e9ec62247eca3464d07de774855bb30a56145adc6525b907490e0c1bda0 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/5e/83/14bed234cd143eaf4043de721fcf4250a5adc7008e76d663365e8a322c88 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/5f/87/f79366b4aab5423acdda7930c6c989c49dd1c6607885df3afaa5e6873c9f +2 -0
- package/dist/templates/demo-store/.cache/index-v5/6e/9e/dc622ea9b5c66089a08f3e8b7a0e62a29e85bab337da0a3b28d6126185ec +2 -0
- package/dist/templates/demo-store/.cache/index-v5/71/4c/401eb7f3b2db5e56857a3ddd90e61181e636a5d01cc569ff8671ddf7f14b +2 -0
- package/dist/templates/demo-store/.cache/index-v5/79/2e/b0dd8fcd37a11ecb71cfd33184651560cabda672e55e0b244fc6f825190c +2 -0
- package/dist/templates/demo-store/.cache/index-v5/7b/e1/807e64f6a84e568bf9163283e9d49b77b24ff24bd8eed751d9fd94ea404a +2 -0
- package/dist/templates/demo-store/.cache/index-v5/85/07/e0c4be5b8442583f11be2d0b6f09171d22721437456b745eb2c977294995 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/87/4d/89bc172664efe0dc7f86d8e67559073b2900ae079bd42ae9e3c015d38ab0 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/8c/0d/a633a8771437b330d83eef0fdd99a81c41356b2bdc81f80ec9277f92b060 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/a3/fc/e2e503290d165b9b0e20c6880bc23ff8ec39a440482418b5103c36be66b9 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/a5/bc/d87ab9468457cb872d6c360f8acecd05e0f88b7239b50754f120706fabd4 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/a5/c0/8e6e4f498a17b6198e54f204247ba544e6404b282d4ce3065d85fa69a8a4 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/af/65/89b0c9eb41779c1658ace443604fea125c524bc95cfc71c9b6300da2dc81 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/b2/75/51549baf010c977c70017db497fd9bd20e1efa9b658a6d52761c559f9c0b +2 -0
- package/dist/templates/demo-store/.cache/index-v5/bb/db/9dc2cbdcdc6ff352f9a34463a02e198aa2123a4c2e4ef37fea8b8ccae413 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/c8/52/09bfbca72b45aec745fc339c27986edefa85e40bd69113275a6ecd6495e9 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/d0/c4/d960260ece228d28f70e317741b3f3f3df05c53956d870235837ae2b73b4 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/d3/ca/ff5860148f0bedafb91dab72b54462de81a32a21210324c45a051b197b48 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/d4/55/296e80e87e2652f4cf1aebd5419fe73ef16c94ab20cd0400166d44ea1746 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/da/7a/4b6977be684885e550a0d8fd21c955d0195371ffc3a9535a5a7b950a5ac9 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/dd/aa/599a1cd855476ba058c63ae75a9c006ca11f7fbc2efc00b361d7f1b95cb4 +2 -0
- package/dist/templates/demo-store/.cache/index-v5/df/d2/bcfa3853e61309abab85dbd561dbc632ad0ea79b24f1b77c95f861eead5f +2 -0
- package/dist/templates/demo-store/.cache/index-v5/df/f5/cc3a1197c607eac768ab1b1cdb7b53a7f87b67c23c92da957d45a5bd0bda +2 -0
- package/dist/templates/demo-store/.cache/index-v5/e4/bd/743967c269ef70a14ba6b5dd223d26759eae9295d79f165c66f514b7d8d3 +2 -0
- package/dist/templates/demo-store/.editorconfig +8 -0
- package/dist/templates/demo-store/.eslintignore +4 -0
- package/dist/templates/demo-store/.eslintrc.js +16 -0
- package/dist/templates/demo-store/.graphqlrc.yml +1 -0
- package/dist/templates/demo-store/.prettierignore +2 -0
- package/dist/templates/demo-store/_env +6 -0
- package/dist/templates/demo-store/_gitignore +9 -0
- package/dist/templates/demo-store/app/components/AccountAddressBook.tsx +97 -0
- package/dist/templates/demo-store/app/components/AccountDetails.tsx +41 -0
- package/dist/templates/demo-store/app/components/AddToCartButton.tsx +42 -0
- package/dist/templates/demo-store/app/components/Breadcrumbs.tsx +36 -0
- package/dist/templates/demo-store/app/components/Button.tsx +56 -0
- package/dist/templates/demo-store/app/components/Cart.tsx +431 -0
- package/dist/templates/demo-store/app/components/CartLoading.tsx +50 -0
- package/dist/templates/demo-store/app/components/CountrySelector.tsx +180 -0
- package/dist/templates/demo-store/app/components/Drawer.tsx +115 -0
- package/dist/templates/demo-store/app/components/FeaturedCollections.tsx +54 -0
- package/dist/templates/demo-store/app/components/FeaturedProducts.tsx +116 -0
- package/dist/templates/demo-store/app/components/FeaturedSection.tsx +36 -0
- package/dist/templates/demo-store/app/components/GenericError.tsx +58 -0
- package/dist/templates/demo-store/app/components/Grid.tsx +44 -0
- package/dist/templates/demo-store/app/components/Hero.tsx +129 -0
- package/dist/templates/demo-store/app/components/Icon.tsx +253 -0
- package/dist/templates/demo-store/app/components/Input.tsx +24 -0
- package/dist/templates/demo-store/app/components/Layout.tsx +499 -0
- package/dist/templates/demo-store/app/components/Link.tsx +46 -0
- package/dist/templates/demo-store/app/components/Modal.tsx +46 -0
- package/dist/templates/demo-store/app/components/NotFound.tsx +22 -0
- package/dist/templates/demo-store/app/components/OrderCard.tsx +82 -0
- package/dist/templates/demo-store/app/components/Pagination.tsx +277 -0
- package/dist/templates/demo-store/app/components/ProductCard.tsx +132 -0
- package/dist/templates/demo-store/app/components/ProductGallery.tsx +114 -0
- package/dist/templates/demo-store/app/components/ProductGrid.tsx +90 -0
- package/dist/templates/demo-store/app/components/ProductSwimlane.tsx +30 -0
- package/dist/templates/demo-store/app/components/Skeleton.tsx +24 -0
- package/dist/templates/demo-store/app/components/SortFilter.tsx +414 -0
- package/dist/templates/demo-store/app/components/Text.tsx +192 -0
- package/dist/templates/demo-store/app/components/index.ts +28 -0
- package/dist/templates/demo-store/app/data/countries.ts +194 -0
- package/dist/templates/demo-store/app/data/fragments.ts +73 -0
- package/dist/templates/demo-store/app/entry.client.tsx +4 -0
- package/dist/templates/demo-store/app/entry.server.tsx +26 -0
- package/dist/templates/demo-store/app/hooks/useCartFetchers.tsx +14 -0
- package/dist/templates/demo-store/app/hooks/useIsHydrated.tsx +12 -0
- package/dist/templates/demo-store/app/lib/const.ts +10 -0
- package/dist/templates/demo-store/app/lib/placeholders.ts +244 -0
- package/dist/templates/demo-store/app/lib/session.server.ts +57 -0
- package/dist/templates/demo-store/app/lib/type.ts +21 -0
- package/dist/templates/demo-store/app/lib/utils.ts +310 -0
- package/dist/templates/demo-store/app/root.tsx +360 -0
- package/dist/templates/demo-store/app/routes/($lang)/$.tsx +7 -0
- package/dist/templates/demo-store/app/routes/($lang)/[sitemap.xml].tsx +198 -0
- package/dist/templates/demo-store/app/routes/($lang)/account/__private/address/$id.tsx +417 -0
- package/dist/templates/demo-store/app/routes/($lang)/account/__private/edit.tsx +295 -0
- package/dist/templates/demo-store/app/routes/($lang)/account/__private/logout.ts +25 -0
- package/dist/templates/demo-store/app/routes/($lang)/account/__private/orders.$id.tsx +442 -0
- package/dist/templates/demo-store/app/routes/($lang)/account/__public/activate.$id.$activationToken.tsx +249 -0
- package/dist/templates/demo-store/app/routes/($lang)/account/__public/login.tsx +247 -0
- package/dist/templates/demo-store/app/routes/($lang)/account/__public/recover.tsx +160 -0
- package/dist/templates/demo-store/app/routes/($lang)/account/__public/register.tsx +214 -0
- package/dist/templates/demo-store/app/routes/($lang)/account/__public/reset.$id.$resetToken.tsx +246 -0
- package/dist/templates/demo-store/app/routes/($lang)/account.tsx +300 -0
- package/dist/templates/demo-store/app/routes/($lang)/api/countries.tsx +22 -0
- package/dist/templates/demo-store/app/routes/($lang)/api/products.tsx +85 -0
- package/dist/templates/demo-store/app/routes/($lang)/cart.tsx +510 -0
- package/dist/templates/demo-store/app/routes/($lang)/collections/$collectionHandle.tsx +303 -0
- package/dist/templates/demo-store/app/routes/($lang)/collections/all.tsx +5 -0
- package/dist/templates/demo-store/app/routes/($lang)/collections/index.tsx +194 -0
- package/dist/templates/demo-store/app/routes/($lang)/discounts.$code.tsx +60 -0
- package/dist/templates/demo-store/app/routes/($lang)/featured-products.tsx +58 -0
- package/dist/templates/demo-store/app/routes/($lang)/index.tsx +270 -0
- package/dist/templates/demo-store/app/routes/($lang)/journal/$journalHandle.tsx +145 -0
- package/dist/templates/demo-store/app/routes/($lang)/journal/index.tsx +149 -0
- package/dist/templates/demo-store/app/routes/($lang)/pages/$pageHandle.tsx +74 -0
- package/dist/templates/demo-store/app/routes/($lang)/policies/$policyHandle.tsx +116 -0
- package/dist/templates/demo-store/app/routes/($lang)/policies/index.tsx +92 -0
- package/dist/templates/demo-store/app/routes/($lang)/products/$productHandle.tsx +594 -0
- package/dist/templates/demo-store/app/routes/($lang)/products/index.tsx +146 -0
- package/dist/templates/demo-store/app/routes/($lang)/search.tsx +198 -0
- package/dist/templates/demo-store/app/routes/[robots.txt].tsx +40 -0
- package/dist/templates/demo-store/app/styles/app.css +4117 -0
- package/dist/templates/demo-store/app/styles/custom-font.css +13 -0
- package/dist/templates/demo-store/app/styles/fonts/IBMPlexSerif-Text.woff2 +0 -0
- package/dist/templates/demo-store/app/styles/fonts/IBMPlexSerif-TextItalic.woff2 +0 -0
- package/dist/templates/demo-store/dist/client/build/_assets/IBMPlexSerif-Text-YFMZNZW6.woff2 +0 -0
- package/dist/templates/demo-store/dist/client/build/_assets/IBMPlexSerif-TextItalic-CS6L5H7S.woff2 +0 -0
- package/dist/templates/demo-store/dist/client/build/_assets/app-5V46SKC6.css +1 -0
- package/dist/templates/demo-store/dist/client/build/_assets/custom-font-WVPOFKHF.css +1 -0
- package/dist/templates/demo-store/dist/client/build/_assets/favicon-5FIZBM2K.svg +28 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-2JM6VWTP.js +2 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-2JM6VWTP.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-3RDIRS72.js +9 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-3RDIRS72.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-AYHDHSL7.js +2 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-AYHDHSL7.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-E5DM2WN5.js +2 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-E5DM2WN5.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-EGF7BKAH.js +31 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-EGF7BKAH.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-MEPKJ2VW.js +2 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-MEPKJ2VW.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-N73MA4O3.js +72 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-N73MA4O3.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-S5VPOIXA.js +2 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-S5VPOIXA.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-SJXYTHYC.js +7 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-SJXYTHYC.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-W7NVY25S.js +25 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-W7NVY25S.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-YU4DAQHP.js +2 -0
- package/dist/templates/demo-store/dist/client/build/_shared/chunk-YU4DAQHP.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/_shared/log-seo-tags-3MQL2PTY-EVG3H53P.js +2 -0
- package/dist/templates/demo-store/dist/client/build/_shared/log-seo-tags-3MQL2PTY-EVG3H53P.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/entry.client-OO4LDNWK.js +2 -0
- package/dist/templates/demo-store/dist/client/build/entry.client-OO4LDNWK.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/manifest-1AF0BBA5.js +1 -0
- package/dist/templates/demo-store/dist/client/build/root-FV6LPUDT.js +3 -0
- package/dist/templates/demo-store/dist/client/build/root-FV6LPUDT.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/$-HDBACFGJ.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/$-HDBACFGJ.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/[sitemap.xml]-AAQRJL2R.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/[sitemap.xml]-AAQRJL2R.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/address/$id-EQYOPKPY.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/address/$id-EQYOPKPY.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/edit-YM3NVGDL.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/edit-YM3NVGDL.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/logout-7KXWFBCX.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/logout-7KXWFBCX.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/orders.$id-QODJFNZS.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/orders.$id-QODJFNZS.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/activate.$id.$activationToken-VQ76BWT7.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/activate.$id.$activationToken-VQ76BWT7.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/login-IRZTYHQF.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/login-IRZTYHQF.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/recover-4VLNDEUK.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/recover-4VLNDEUK.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/register-6GG4XAMH.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/register-6GG4XAMH.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/reset.$id.$resetToken-SIXY5J2S.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/reset.$id.$resetToken-SIXY5J2S.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account-G7FQFZFP.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/account-G7FQFZFP.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/api/countries-UD6BGYL2.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/api/countries-UD6BGYL2.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/api/products-Y2SK2JNE.js +18 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/api/products-Y2SK2JNE.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/cart-TFONAIOG.js +55 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/cart-TFONAIOG.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/$collectionHandle-HSKYTXMD.js +83 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/$collectionHandle-HSKYTXMD.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/all-IXDFOKCK.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/all-IXDFOKCK.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/index-RXXMMLNQ.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/index-RXXMMLNQ.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/discounts.$code-GYKQBNLQ.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/discounts.$code-GYKQBNLQ.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/featured-products-KNUST6DD.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/featured-products-KNUST6DD.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/index-DZYZ23DT.js +59 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/index-DZYZ23DT.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/journal/$journalHandle-BFPXMHRY.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/journal/$journalHandle-BFPXMHRY.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/journal/index-TVV6RNDT.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/journal/index-TVV6RNDT.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/pages/$pageHandle-2JU4FDNU.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/pages/$pageHandle-2JU4FDNU.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/policies/$policyHandle-B2JUECEA.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/policies/$policyHandle-B2JUECEA.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/policies/index-DKYSL4RX.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/policies/index-DKYSL4RX.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/products/$productHandle-CSUUFYMX.js +102 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/products/$productHandle-CSUUFYMX.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/products/index-VAQVPD22.js +24 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/products/index-VAQVPD22.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/search-UVGUQAJG.js +54 -0
- package/dist/templates/demo-store/dist/client/build/routes/($lang)/search-UVGUQAJG.js.map +7 -0
- package/dist/templates/demo-store/dist/client/build/routes/[robots.txt]-YG62MDLB.js +2 -0
- package/dist/templates/demo-store/dist/client/build/routes/[robots.txt]-YG62MDLB.js.map +7 -0
- package/dist/templates/demo-store/dist/client/favicon.svg +28 -0
- package/dist/templates/demo-store/dist/worker/_assets/IBMPlexSerif-Text-YFMZNZW6.woff2 +0 -0
- package/dist/templates/demo-store/dist/worker/_assets/IBMPlexSerif-TextItalic-CS6L5H7S.woff2 +0 -0
- package/dist/templates/demo-store/dist/worker/index.js +1352 -0
- package/dist/templates/demo-store/dist/worker/index.js.map +7 -0
- package/dist/templates/demo-store/package.json +64 -0
- package/dist/templates/demo-store/postcss.config.js +10 -0
- package/dist/templates/demo-store/public/favicon.svg +28 -0
- package/dist/templates/demo-store/remix.env.d.ts +40 -0
- package/dist/templates/demo-store/remix.init/index.js +25 -0
- package/dist/templates/demo-store/remix.init/package.json +7 -0
- package/dist/templates/demo-store/server.ts +73 -0
- package/dist/templates/demo-store/styles/app.css +182 -0
- package/dist/templates/demo-store/tailwind.config.js +70 -0
- package/dist/templates/demo-store/tsconfig.json +25 -0
- package/dist/templates/graphiql.tsx +10 -0
- package/dist/templates/hello-world/.cache/content-v2/sha512/13/4d/016017e6bcf9be61273229516bd898b7df8dad06121807f9b80f1e2acca7e9790dcc476d08b81a899d8d29d38331b4a459d66f3c7f9dc4303ca2fcc167b7 +1 -0
- package/dist/templates/hello-world/.cache/content-v2/sha512/99/79/957d59c381e42c01e473b69a7befabebff88d7ae53269b038a7aca4993e3e773e6a1144223532f089df44c4d866af69317389a969681566e3e71ef5e023c +1 -0
- package/dist/templates/hello-world/.cache/index-v5/09/f6/fe4b05c4157320b8b59b3f84116195be0437d87357d743d21acd638a4606 +2 -0
- package/dist/templates/hello-world/.cache/index-v5/d0/c4/d960260ece228d28f70e317741b3f3f3df05c53956d870235837ae2b73b4 +2 -0
- package/dist/templates/hello-world/.eslintignore +4 -0
- package/dist/templates/hello-world/.eslintrc.js +6 -0
- package/dist/templates/hello-world/.graphqlrc.yml +1 -0
- package/dist/templates/hello-world/README.md +20 -0
- package/dist/templates/hello-world/_env +6 -0
- package/dist/templates/hello-world/_gitignore +8 -0
- package/dist/templates/hello-world/app/components/Layout.tsx +43 -0
- package/dist/templates/hello-world/app/components/index.ts +1 -0
- package/dist/templates/hello-world/app/entry.client.tsx +4 -0
- package/dist/templates/hello-world/app/entry.server.tsx +21 -0
- package/dist/templates/hello-world/app/root.tsx +104 -0
- package/dist/templates/hello-world/app/routes/index.tsx +16 -0
- package/dist/templates/hello-world/app/styles/app.css +38 -0
- package/dist/templates/hello-world/dist/client/build/_assets/app-NBPUE4H5.css +1 -0
- package/dist/templates/hello-world/dist/client/build/_assets/favicon-5FIZBM2K.svg +28 -0
- package/dist/templates/hello-world/dist/client/build/_shared/chunk-AEML26BQ.js +31 -0
- package/dist/templates/hello-world/dist/client/build/_shared/chunk-AEML26BQ.js.map +7 -0
- package/dist/templates/hello-world/dist/client/build/_shared/chunk-RKJPHUBS.js +2 -0
- package/dist/templates/hello-world/dist/client/build/_shared/chunk-RKJPHUBS.js.map +7 -0
- package/dist/templates/hello-world/dist/client/build/entry.client-ZGMV2YX5.js +9 -0
- package/dist/templates/hello-world/dist/client/build/entry.client-ZGMV2YX5.js.map +7 -0
- package/dist/templates/hello-world/dist/client/build/manifest-8ABA8B0B.js +1 -0
- package/dist/templates/hello-world/dist/client/build/root-HK7BXYY5.js +2 -0
- package/dist/templates/hello-world/dist/client/build/root-HK7BXYY5.js.map +7 -0
- package/dist/templates/hello-world/dist/client/build/routes/index-YNIEU6B3.js +2 -0
- package/dist/templates/hello-world/dist/client/build/routes/index-YNIEU6B3.js.map +7 -0
- package/dist/templates/hello-world/dist/client/favicon.svg +28 -0
- package/dist/templates/hello-world/dist/worker/index.js +68 -0
- package/dist/templates/hello-world/dist/worker/index.js.map +7 -0
- package/dist/templates/hello-world/package.json +42 -0
- package/dist/templates/hello-world/public/favicon.svg +28 -0
- package/dist/templates/hello-world/remix.env.d.ts +35 -0
- package/dist/templates/hello-world/remix.init/index.js +25 -0
- package/dist/templates/hello-world/remix.init/package.json +7 -0
- package/dist/templates/hello-world/server.ts +129 -0
- package/dist/templates/hello-world/tsconfig.json +25 -0
- package/dist/templates/index.tsx +7 -0
- package/dist/templates/pages/$pageHandle.tsx +74 -0
- package/dist/templates/policies/$policyHandle.tsx +87 -0
- package/dist/templates/policies/index.tsx +65 -0
- package/dist/templates/products/$productHandle.tsx +57 -0
- package/dist/tmp-create-app.js +33 -0
- package/dist/utils/check-lockfile.js +75 -0
- package/dist/utils/check-version.js +50 -0
- package/dist/utils/config.js +63 -0
- package/dist/utils/flags.js +15 -0
- package/dist/utils/log.js +20 -0
- package/dist/utils/mini-oxygen.js +70 -0
- package/dist/utils/missing-routes.js +68 -0
- package/dist/utils/virtual-routes.js +47 -0
- package/dist/utils/virtual-routes.test.js +46 -0
- package/dist/virtual-routes/assets/dummy.js +1 -0
- package/dist/virtual-routes/assets/dummy.ts +1 -0
- package/dist/virtual-routes/assets/favicon.svg +28 -0
- package/dist/virtual-routes/assets/styles.css +5 -0
- package/dist/virtual-routes/components/Layout.jsx +6 -0
- package/dist/virtual-routes/routes/graphiql.jsx +5 -0
- package/dist/virtual-routes/routes/index.jsx +12 -0
- package/dist/virtual-routes/virtual-root.jsx +38 -0
- package/oclif.manifest.json +1 -1
- package/package.json +40 -68
- package/LICENSE +0 -8
- package/README.md +0 -63
- package/dist/cli/commands/hydrogen/add/eslint.d.ts +0 -11
- package/dist/cli/commands/hydrogen/add/eslint.js +0 -27
- package/dist/cli/commands/hydrogen/add/eslint.js.map +0 -1
- package/dist/cli/commands/hydrogen/add/tailwind.d.ts +0 -11
- package/dist/cli/commands/hydrogen/add/tailwind.js +0 -27
- package/dist/cli/commands/hydrogen/add/tailwind.js.map +0 -1
- package/dist/cli/commands/hydrogen/build.d.ts +0 -14
- package/dist/cli/commands/hydrogen/build.js +0 -50
- package/dist/cli/commands/hydrogen/build.js.map +0 -1
- package/dist/cli/commands/hydrogen/deploy.d.ts +0 -19
- package/dist/cli/commands/hydrogen/deploy.js +0 -61
- package/dist/cli/commands/hydrogen/deploy.js.map +0 -1
- package/dist/cli/commands/hydrogen/dev.d.ts +0 -13
- package/dist/cli/commands/hydrogen/dev.js +0 -32
- package/dist/cli/commands/hydrogen/dev.js.map +0 -1
- package/dist/cli/commands/hydrogen/info.d.ts +0 -12
- package/dist/cli/commands/hydrogen/info.js +0 -30
- package/dist/cli/commands/hydrogen/info.js.map +0 -1
- package/dist/cli/commands/hydrogen/preview.d.ts +0 -13
- package/dist/cli/commands/hydrogen/preview.js +0 -47
- package/dist/cli/commands/hydrogen/preview.js.map +0 -1
- package/dist/cli/constants.d.ts +0 -15
- package/dist/cli/constants.js +0 -16
- package/dist/cli/constants.js.map +0 -1
- package/dist/cli/flags.d.ts +0 -4
- package/dist/cli/flags.js +0 -16
- package/dist/cli/flags.js.map +0 -1
- package/dist/cli/models/hydrogen.d.ts +0 -22
- package/dist/cli/models/hydrogen.js +0 -84
- package/dist/cli/models/hydrogen.js.map +0 -1
- package/dist/cli/prompts/git-init.d.ts +0 -1
- package/dist/cli/prompts/git-init.js +0 -16
- package/dist/cli/prompts/git-init.js.map +0 -1
- package/dist/cli/services/build/check-lockfile.d.ts +0 -3
- package/dist/cli/services/build/check-lockfile.js +0 -81
- package/dist/cli/services/build/check-lockfile.js.map +0 -1
- package/dist/cli/services/build.d.ts +0 -16
- package/dist/cli/services/build.js +0 -43
- package/dist/cli/services/build.js.map +0 -1
- package/dist/cli/services/deploy/config.d.ts +0 -4
- package/dist/cli/services/deploy/config.js +0 -54
- package/dist/cli/services/deploy/config.js.map +0 -1
- package/dist/cli/services/deploy/graphql/create_deployment.d.ts +0 -10
- package/dist/cli/services/deploy/graphql/create_deployment.js +0 -15
- package/dist/cli/services/deploy/graphql/create_deployment.js.map +0 -1
- package/dist/cli/services/deploy/graphql/upload_deployment.d.ts +0 -1
- package/dist/cli/services/deploy/graphql/upload_deployment.js +0 -16
- package/dist/cli/services/deploy/graphql/upload_deployment.js.map +0 -1
- package/dist/cli/services/deploy/types.d.ts +0 -37
- package/dist/cli/services/deploy/types.js +0 -2
- package/dist/cli/services/deploy/types.js.map +0 -1
- package/dist/cli/services/deploy/upload.d.ts +0 -5
- package/dist/cli/services/deploy/upload.js +0 -86
- package/dist/cli/services/deploy/upload.js.map +0 -1
- package/dist/cli/services/deploy.d.ts +0 -2
- package/dist/cli/services/deploy.js +0 -99
- package/dist/cli/services/deploy.js.map +0 -1
- package/dist/cli/services/dev/check-version.d.ts +0 -1
- package/dist/cli/services/dev/check-version.js +0 -30
- package/dist/cli/services/dev/check-version.js.map +0 -1
- package/dist/cli/services/dev.d.ts +0 -10
- package/dist/cli/services/dev.js +0 -37
- package/dist/cli/services/dev.js.map +0 -1
- package/dist/cli/services/eslint.d.ts +0 -8
- package/dist/cli/services/eslint.js +0 -63
- package/dist/cli/services/eslint.js.map +0 -1
- package/dist/cli/services/info.d.ts +0 -7
- package/dist/cli/services/info.js +0 -115
- package/dist/cli/services/info.js.map +0 -1
- package/dist/cli/services/preview.d.ts +0 -12
- package/dist/cli/services/preview.js +0 -71
- package/dist/cli/services/preview.js.map +0 -1
- package/dist/cli/services/tailwind.d.ts +0 -9
- package/dist/cli/services/tailwind.js +0 -87
- package/dist/cli/services/tailwind.js.map +0 -1
- package/dist/cli/utilities/load-config.d.ts +0 -5
- package/dist/cli/utilities/load-config.js +0 -6
- package/dist/cli/utilities/load-config.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { output } from '@shopify/cli-kit';
|
|
3
|
+
import colors from '@shopify/cli-kit/node/colors';
|
|
4
|
+
import { getProjectPaths, getRemixConfig } from '../../utils/config.js';
|
|
5
|
+
import { commonFlags } from '../../utils/flags.js';
|
|
6
|
+
import Command from '@shopify/cli-kit/node/base-command';
|
|
7
|
+
import Flags from '@oclif/core/lib/flags.js';
|
|
8
|
+
import { checkLockfileStatus } from '../../utils/check-lockfile.js';
|
|
9
|
+
import { findMissingRoutes } from '../../utils/missing-routes.js';
|
|
10
|
+
|
|
11
|
+
const LOG_WORKER_BUILT = "\u{1F4E6} Worker built";
|
|
12
|
+
class Build extends Command {
|
|
13
|
+
static description = "Builds a Hydrogen storefront for production";
|
|
14
|
+
static flags = {
|
|
15
|
+
...commonFlags,
|
|
16
|
+
sourcemap: Flags.boolean({
|
|
17
|
+
env: "SHOPIFY_HYDROGEN_FLAG_SOURCEMAP"
|
|
18
|
+
}),
|
|
19
|
+
entry: Flags.string({
|
|
20
|
+
env: "SHOPIFY_HYDROGEN_FLAG_SOURCEMAP",
|
|
21
|
+
required: true
|
|
22
|
+
}),
|
|
23
|
+
disableRouteWarning: Flags.boolean({
|
|
24
|
+
description: "Disable warning about missing standard routes",
|
|
25
|
+
env: "SHOPIFY_HYDROGEN_FLAG_DISABLE_ROUTE_WARNING"
|
|
26
|
+
})
|
|
27
|
+
};
|
|
28
|
+
async run() {
|
|
29
|
+
const { flags } = await this.parse(Build);
|
|
30
|
+
const directory = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
31
|
+
await runBuild({ ...flags, path: directory });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function runBuild({
|
|
35
|
+
entry,
|
|
36
|
+
path: appPath,
|
|
37
|
+
sourcemap = true,
|
|
38
|
+
disableRouteWarning = false
|
|
39
|
+
}) {
|
|
40
|
+
if (!process.env.NODE_ENV) {
|
|
41
|
+
process.env.NODE_ENV = "production";
|
|
42
|
+
}
|
|
43
|
+
const {
|
|
44
|
+
root,
|
|
45
|
+
entryFile,
|
|
46
|
+
buildPath,
|
|
47
|
+
buildPathClient,
|
|
48
|
+
buildPathWorkerFile,
|
|
49
|
+
publicPath
|
|
50
|
+
} = getProjectPaths(appPath, entry);
|
|
51
|
+
await checkLockfileStatus(root);
|
|
52
|
+
console.time(LOG_WORKER_BUILT);
|
|
53
|
+
const { default: fsExtra } = await import('fs-extra');
|
|
54
|
+
const [remixConfig] = await Promise.all([
|
|
55
|
+
getRemixConfig(root, entryFile, publicPath),
|
|
56
|
+
fsExtra.rm(buildPath, { force: true, recursive: true })
|
|
57
|
+
]);
|
|
58
|
+
output.info(`
|
|
59
|
+
\u{1F3D7}\uFE0F Building in ${process.env.NODE_ENV} mode...`);
|
|
60
|
+
const { build } = await import('@remix-run/dev/dist/compiler/build.js');
|
|
61
|
+
const { logCompileFailure } = await import('@remix-run/dev/dist/compiler/onCompileFailure.js');
|
|
62
|
+
await Promise.all([
|
|
63
|
+
copyPublicFiles(publicPath, buildPathClient),
|
|
64
|
+
build(remixConfig, {
|
|
65
|
+
mode: process.env.NODE_ENV,
|
|
66
|
+
sourcemap,
|
|
67
|
+
onCompileFailure: (failure) => {
|
|
68
|
+
logCompileFailure(failure);
|
|
69
|
+
throw Error();
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
]);
|
|
73
|
+
if (process.env.NODE_ENV !== "development") {
|
|
74
|
+
console.timeEnd(LOG_WORKER_BUILT);
|
|
75
|
+
const { size } = await fsExtra.stat(buildPathWorkerFile);
|
|
76
|
+
const sizeMB = size / (1024 * 1024);
|
|
77
|
+
output.info(
|
|
78
|
+
output.content` ${colors.dim(
|
|
79
|
+
path.relative(root, buildPathWorkerFile)
|
|
80
|
+
)} ${output.token.yellow(sizeMB.toFixed(2))} MB\n`
|
|
81
|
+
);
|
|
82
|
+
if (sizeMB >= 1) {
|
|
83
|
+
output.warn(
|
|
84
|
+
"\u{1F6A8} Worker bundle exceeds 1 MB! This can delay your worker response.\n"
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (!disableRouteWarning) {
|
|
89
|
+
const missingRoutes = findMissingRoutes(remixConfig);
|
|
90
|
+
if (missingRoutes.length) {
|
|
91
|
+
output.warn(
|
|
92
|
+
"\u{1F6A8} Standard Shopify routes missing; run `shopify hydrogen check routes` for more details."
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
process.exit(0);
|
|
97
|
+
}
|
|
98
|
+
async function copyPublicFiles(publicPath, buildPathClient) {
|
|
99
|
+
const { default: fsExtra } = await import('fs-extra');
|
|
100
|
+
return fsExtra.copy(publicPath, buildPathClient, {
|
|
101
|
+
recursive: true,
|
|
102
|
+
overwrite: true
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { copyPublicFiles, Build as default, runBuild };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Command from '@shopify/cli-kit/node/base-command';
|
|
2
|
+
import { path } from '@shopify/cli-kit';
|
|
3
|
+
import { commonFlags } from '../../utils/flags.js';
|
|
4
|
+
import { getRemixConfig } from '../../utils/config.js';
|
|
5
|
+
import { logMissingRoutes, findMissingRoutes } from '../../utils/missing-routes.js';
|
|
6
|
+
|
|
7
|
+
class GenerateRoute extends Command {
|
|
8
|
+
static flags = {
|
|
9
|
+
path: commonFlags.path
|
|
10
|
+
};
|
|
11
|
+
static args = [
|
|
12
|
+
{
|
|
13
|
+
name: "resource",
|
|
14
|
+
description: `The resource to check. Currently only 'routes' is supported.`,
|
|
15
|
+
required: true,
|
|
16
|
+
options: ["routes"]
|
|
17
|
+
}
|
|
18
|
+
];
|
|
19
|
+
async run() {
|
|
20
|
+
const { flags, args } = await this.parse(GenerateRoute);
|
|
21
|
+
const directory = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
22
|
+
if (args.resource === "routes") {
|
|
23
|
+
await runCheckRoutes({ directory });
|
|
24
|
+
} else {
|
|
25
|
+
throw new Error("Invalid command argument.");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async function runCheckRoutes({ directory }) {
|
|
30
|
+
const remixConfig = await getRemixConfig(directory, "", "");
|
|
31
|
+
logMissingRoutes(findMissingRoutes(remixConfig));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { GenerateRoute as default };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs/promises';
|
|
3
|
+
import { output } from '@shopify/cli-kit';
|
|
4
|
+
import { copyPublicFiles } from './build.js';
|
|
5
|
+
import { getProjectPaths, getRemixConfig } from '../../utils/config.js';
|
|
6
|
+
import { muteDevLogs } from '../../utils/log.js';
|
|
7
|
+
import { commonFlags } from '../../utils/flags.js';
|
|
8
|
+
import Command from '@shopify/cli-kit/node/base-command';
|
|
9
|
+
import Flags from '@oclif/core/lib/flags.js';
|
|
10
|
+
import { startMiniOxygen } from '../../utils/mini-oxygen.js';
|
|
11
|
+
import { checkHydrogenVersion } from '../../utils/check-version.js';
|
|
12
|
+
import { addVirtualRoutes } from '../../utils/virtual-routes.js';
|
|
13
|
+
|
|
14
|
+
const LOG_INITIAL_BUILD = "\n\u{1F3C1} Initial build";
|
|
15
|
+
const LOG_REBUILDING = "\u{1F9F1} Rebuilding...";
|
|
16
|
+
const LOG_REBUILT = "\u{1F680} Rebuilt";
|
|
17
|
+
class Dev extends Command {
|
|
18
|
+
static description = "Runs Hydrogen storefront in a MiniOxygen worker in development";
|
|
19
|
+
static flags = {
|
|
20
|
+
...commonFlags,
|
|
21
|
+
port: Flags.integer({
|
|
22
|
+
description: "Port to run the preview server on",
|
|
23
|
+
env: "SHOPIFY_HYDROGEN_FLAG_PORT",
|
|
24
|
+
default: 3e3
|
|
25
|
+
}),
|
|
26
|
+
entry: Flags.string({
|
|
27
|
+
env: "SHOPIFY_HYDROGEN_FLAG_ENTRY",
|
|
28
|
+
required: true
|
|
29
|
+
}),
|
|
30
|
+
disableVirtualRoutes: Flags.boolean({
|
|
31
|
+
env: "SHOPIFY_HYDROGEN_FLAG_DISABLE_VIRTUAL_ROUTES",
|
|
32
|
+
default: false
|
|
33
|
+
})
|
|
34
|
+
};
|
|
35
|
+
async run() {
|
|
36
|
+
const { flags } = await this.parse(Dev);
|
|
37
|
+
const directory = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
38
|
+
await runDev({ ...flags, path: directory });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function runDev({
|
|
42
|
+
entry,
|
|
43
|
+
port,
|
|
44
|
+
path: appPath,
|
|
45
|
+
disableVirtualRoutes
|
|
46
|
+
}) {
|
|
47
|
+
if (!process.env.NODE_ENV)
|
|
48
|
+
process.env.NODE_ENV = "development";
|
|
49
|
+
muteDevLogs();
|
|
50
|
+
await compileAndWatch(entry, appPath, port, disableVirtualRoutes);
|
|
51
|
+
}
|
|
52
|
+
async function compileAndWatch(entry, appPath, port, disableVirtualRoutes = false) {
|
|
53
|
+
console.time(LOG_INITIAL_BUILD);
|
|
54
|
+
const { root, entryFile, publicPath, buildPathClient, buildPathWorkerFile } = getProjectPaths(appPath, entry);
|
|
55
|
+
const checkingHydrogenVersion = checkHydrogenVersion(root);
|
|
56
|
+
const copyingFiles = copyPublicFiles(publicPath, buildPathClient);
|
|
57
|
+
const reloadConfig = async () => {
|
|
58
|
+
const config = await getRemixConfig(root, entryFile, publicPath);
|
|
59
|
+
return disableVirtualRoutes ? config : addVirtualRoutes(config);
|
|
60
|
+
};
|
|
61
|
+
const { watch } = await import('@remix-run/dev/dist/compiler/watch.js');
|
|
62
|
+
await watch(await reloadConfig(), {
|
|
63
|
+
reloadConfig,
|
|
64
|
+
mode: process.env.NODE_ENV,
|
|
65
|
+
async onInitialBuild() {
|
|
66
|
+
await copyingFiles;
|
|
67
|
+
console.timeEnd(LOG_INITIAL_BUILD);
|
|
68
|
+
await startMiniOxygen({
|
|
69
|
+
root,
|
|
70
|
+
port,
|
|
71
|
+
watch: true,
|
|
72
|
+
buildPathWorkerFile,
|
|
73
|
+
buildPathClient
|
|
74
|
+
});
|
|
75
|
+
const showUpgrade = await checkingHydrogenVersion;
|
|
76
|
+
if (showUpgrade)
|
|
77
|
+
showUpgrade();
|
|
78
|
+
},
|
|
79
|
+
async onFileCreated(file) {
|
|
80
|
+
output.info(`
|
|
81
|
+
\u{1F4C4} File created: ${path.relative(root, file)}`);
|
|
82
|
+
if (file.startsWith(publicPath)) {
|
|
83
|
+
await copyPublicFiles(file, file.replace(publicPath, buildPathClient));
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
async onFileChanged(file) {
|
|
87
|
+
output.info(`
|
|
88
|
+
\u{1F4C4} File changed: ${path.relative(root, file)}`);
|
|
89
|
+
if (file.startsWith(publicPath)) {
|
|
90
|
+
await copyPublicFiles(file, file.replace(publicPath, buildPathClient));
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
async onFileDeleted(file) {
|
|
94
|
+
output.info(`
|
|
95
|
+
\u{1F4C4} File deleted: ${path.relative(root, file)}`);
|
|
96
|
+
if (file.startsWith(publicPath)) {
|
|
97
|
+
await fs.unlink(file.replace(publicPath, buildPathClient));
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
onRebuildStart() {
|
|
101
|
+
output.info(LOG_REBUILDING);
|
|
102
|
+
console.time(LOG_REBUILT);
|
|
103
|
+
},
|
|
104
|
+
async onRebuildFinish() {
|
|
105
|
+
console.timeEnd(LOG_REBUILT);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { Dev as default, runDev };
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import Command from '@shopify/cli-kit/node/base-command';
|
|
2
|
+
import { path, error, file, ui } from '@shopify/cli-kit';
|
|
3
|
+
import { renderSuccess } from '@shopify/cli-kit/node/ui';
|
|
4
|
+
import { commonFlags } from '../../../utils/flags.js';
|
|
5
|
+
import Flags from '@oclif/core/lib/flags.js';
|
|
6
|
+
import ts from 'typescript';
|
|
7
|
+
import prettier from 'prettier';
|
|
8
|
+
|
|
9
|
+
const ROUTE_MAP = {
|
|
10
|
+
page: "/pages/$pageHandle",
|
|
11
|
+
cart: "/cart",
|
|
12
|
+
products: "/products/$productHandle",
|
|
13
|
+
collections: "/collections/$collectionHandle",
|
|
14
|
+
policies: ["/policies/index", "/policies/$policyHandle"],
|
|
15
|
+
robots: "/[robots.txt]",
|
|
16
|
+
sitemap: "/[sitemap.xml]",
|
|
17
|
+
account: ["/account/login", "/account/register"]
|
|
18
|
+
};
|
|
19
|
+
const ROUTES = [...Object.keys(ROUTE_MAP), "all"];
|
|
20
|
+
class GenerateRoute extends Command {
|
|
21
|
+
static flags = {
|
|
22
|
+
path: commonFlags.path,
|
|
23
|
+
adapter: Flags.string({
|
|
24
|
+
description: "The Remix adapter for imports in the template (default: @shopify/remix-oxygen)",
|
|
25
|
+
env: "SHOPIFY_HYDROGEN_FLAG_ADAPTER"
|
|
26
|
+
}),
|
|
27
|
+
force: Flags.boolean({
|
|
28
|
+
char: "f",
|
|
29
|
+
description: "Overwrite existing files",
|
|
30
|
+
env: "SHOPIFY_HYDROGEN_FLAG_FORCE"
|
|
31
|
+
})
|
|
32
|
+
};
|
|
33
|
+
static args = [
|
|
34
|
+
{
|
|
35
|
+
name: "route",
|
|
36
|
+
description: `The route to generate a route for.`,
|
|
37
|
+
required: true,
|
|
38
|
+
options: ROUTES,
|
|
39
|
+
env: "SHOPIFY_HYDROGEN_ARG_ROUTE"
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
async run() {
|
|
43
|
+
const result = /* @__PURE__ */ new Map();
|
|
44
|
+
const { flags, args } = await this.parse(GenerateRoute);
|
|
45
|
+
const directory = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
46
|
+
const { route } = args;
|
|
47
|
+
const routePath = route === "all" ? Object.values(ROUTE_MAP).flat() : ROUTE_MAP[route];
|
|
48
|
+
if (!routePath) {
|
|
49
|
+
throw new error.Abort(
|
|
50
|
+
`No template generator found for ${route}. Try one of ${ROUTES.join()}`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
const isTypescript = await file.exists(
|
|
54
|
+
path.join(directory, "tsconfig.json")
|
|
55
|
+
);
|
|
56
|
+
const routesArray = Array.isArray(routePath) ? routePath : [routePath];
|
|
57
|
+
try {
|
|
58
|
+
for (const item of routesArray) {
|
|
59
|
+
result.set(
|
|
60
|
+
item,
|
|
61
|
+
await runGenerate(item, {
|
|
62
|
+
directory,
|
|
63
|
+
typescript: isTypescript,
|
|
64
|
+
force: flags.force,
|
|
65
|
+
adapter: flags.adapter
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
} catch (err) {
|
|
70
|
+
throw new error.Abort(err.message);
|
|
71
|
+
}
|
|
72
|
+
const extension = isTypescript ? ".tsx" : ".jsx";
|
|
73
|
+
const success = Array.from(result.values()).filter(
|
|
74
|
+
(result2) => result2.operation !== "skipped"
|
|
75
|
+
);
|
|
76
|
+
renderSuccess({
|
|
77
|
+
headline: `${success.length} of ${result.size} route${result.size > 1 ? "s" : ""} generated`,
|
|
78
|
+
body: Array.from(result.entries()).map(([path2, result2]) => {
|
|
79
|
+
const { operation } = result2;
|
|
80
|
+
return `\u2022 [${operation}] app/routes${path2}${extension}`;
|
|
81
|
+
}).join("\n")
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async function runGenerate(route, {
|
|
86
|
+
directory,
|
|
87
|
+
typescript,
|
|
88
|
+
force,
|
|
89
|
+
adapter,
|
|
90
|
+
templatesRoot = new URL("../../../", import.meta.url).pathname
|
|
91
|
+
}) {
|
|
92
|
+
const extension = typescript ? ".tsx" : ".jsx";
|
|
93
|
+
const templatePath = path.join(templatesRoot, "templates", `${route}.tsx`);
|
|
94
|
+
const destinationPath = path.join(
|
|
95
|
+
directory,
|
|
96
|
+
"app",
|
|
97
|
+
"routes",
|
|
98
|
+
`${route}${extension}`
|
|
99
|
+
);
|
|
100
|
+
const relativeDestinationPath = path.relative(directory, destinationPath);
|
|
101
|
+
if (!force && await file.exists(destinationPath)) {
|
|
102
|
+
const options = [
|
|
103
|
+
{ name: "No", value: "skip" },
|
|
104
|
+
{ name: `Yes`, value: "overwrite" }
|
|
105
|
+
];
|
|
106
|
+
const choice = await ui.prompt([
|
|
107
|
+
{
|
|
108
|
+
type: "select",
|
|
109
|
+
name: "value",
|
|
110
|
+
message: `The file ${path.relativize(
|
|
111
|
+
relativeDestinationPath
|
|
112
|
+
)} already exists. Do you want to overwrite it?`,
|
|
113
|
+
choices: options
|
|
114
|
+
}
|
|
115
|
+
]);
|
|
116
|
+
return {
|
|
117
|
+
operation: choice.value === "skip" ? "skipped" : "overwritten"
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
let templateContent = await file.read(templatePath);
|
|
121
|
+
if (!typescript) {
|
|
122
|
+
const config = await file.exists(path.join(directory, "jsconfig.json")) ? await import(path.join(directory, "jsconfig.json")) : {
|
|
123
|
+
lib: ["DOM", "DOM.Iterable", "ES2022"],
|
|
124
|
+
isolatedModules: true,
|
|
125
|
+
esModuleInterop: true,
|
|
126
|
+
resolveJsonModule: true,
|
|
127
|
+
target: "ES2022",
|
|
128
|
+
strict: true,
|
|
129
|
+
allowJs: true,
|
|
130
|
+
forceConsistentCasingInFileNames: true,
|
|
131
|
+
skipLibCheck: true
|
|
132
|
+
};
|
|
133
|
+
const withArtificialNewLines = escapeNewLines(templateContent);
|
|
134
|
+
const compiled = compile(withArtificialNewLines, config);
|
|
135
|
+
templateContent = restoreNewLines(compiled.outputText);
|
|
136
|
+
}
|
|
137
|
+
if (adapter) {
|
|
138
|
+
templateContent = templateContent.replace(
|
|
139
|
+
/@shopify\/remix-oxygen/g,
|
|
140
|
+
adapter
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
templateContent = await format(templateContent, destinationPath);
|
|
144
|
+
if (!await file.exists(path.dirname(destinationPath))) {
|
|
145
|
+
await file.mkdir(path.dirname(destinationPath));
|
|
146
|
+
}
|
|
147
|
+
await file.write(destinationPath, templateContent);
|
|
148
|
+
return {
|
|
149
|
+
operation: "generated"
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
const escapeNewLines = (code) => code.replace(/\n\n/g, "\n/* :newline: */");
|
|
153
|
+
const restoreNewLines = (code) => code.replace(/\/\* :newline: \*\//g, "\n");
|
|
154
|
+
function compile(code, options = {}) {
|
|
155
|
+
return ts.transpileModule(code, {
|
|
156
|
+
reportDiagnostics: false,
|
|
157
|
+
compilerOptions: {
|
|
158
|
+
...options,
|
|
159
|
+
jsx: 1,
|
|
160
|
+
removeComments: false
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
async function format(content, filePath) {
|
|
165
|
+
const config = await prettier.resolveConfig(filePath) || {};
|
|
166
|
+
const ext = path.extname(filePath);
|
|
167
|
+
const formattedContent = await prettier.format(content, {
|
|
168
|
+
parser: ext === ".tsx" || ext === ".ts" ? "typescript" : "babel",
|
|
169
|
+
...config
|
|
170
|
+
});
|
|
171
|
+
return formattedContent;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export { GenerateRoute as default, runGenerate };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { describe, beforeEach, vi, it, expect } from 'vitest';
|
|
2
|
+
import { temporaryDirectoryTask } from 'tempy';
|
|
3
|
+
import { runGenerate } from './route.js';
|
|
4
|
+
import { file, path, ui } from '@shopify/cli-kit';
|
|
5
|
+
|
|
6
|
+
describe("generate/route", () => {
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
vi.resetAllMocks();
|
|
9
|
+
vi.mock("@shopify/cli-kit", async () => {
|
|
10
|
+
const cliKit = await vi.importActual("@shopify/cli-kit");
|
|
11
|
+
return {
|
|
12
|
+
...cliKit,
|
|
13
|
+
output: {
|
|
14
|
+
...cliKit.output,
|
|
15
|
+
success: vi.fn()
|
|
16
|
+
},
|
|
17
|
+
ui: {
|
|
18
|
+
prompt: vi.fn()
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
it("generates a route file", async () => {
|
|
24
|
+
await temporaryDirectoryTask(async (tmpDir) => {
|
|
25
|
+
const route = "pages/$pageHandle";
|
|
26
|
+
const { appRoot, templatesRoot } = await createHydrogen(tmpDir, {
|
|
27
|
+
files: [],
|
|
28
|
+
templates: [[route, 'const str = "hello world"']]
|
|
29
|
+
});
|
|
30
|
+
await runGenerate(route, {
|
|
31
|
+
directory: appRoot,
|
|
32
|
+
templatesRoot
|
|
33
|
+
});
|
|
34
|
+
expect(
|
|
35
|
+
await file.read(path.join(appRoot, "app/routes", `${route}.jsx`))
|
|
36
|
+
).toContain('const str = "hello world"');
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
it("produces a typescript file when typescript argument is true", async () => {
|
|
40
|
+
await temporaryDirectoryTask(async (tmpDir) => {
|
|
41
|
+
const route = "pages/$pageHandle";
|
|
42
|
+
const { appRoot, templatesRoot } = await createHydrogen(tmpDir, {
|
|
43
|
+
files: [],
|
|
44
|
+
templates: [[route, 'const str = "hello typescript"']]
|
|
45
|
+
});
|
|
46
|
+
await runGenerate(route, {
|
|
47
|
+
directory: appRoot,
|
|
48
|
+
templatesRoot,
|
|
49
|
+
typescript: true
|
|
50
|
+
});
|
|
51
|
+
expect(
|
|
52
|
+
await file.read(path.join(appRoot, "app/routes", `${route}.tsx`))
|
|
53
|
+
).toContain('const str = "hello typescript"');
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
it("prompts the user if there the file already exists", async () => {
|
|
57
|
+
await temporaryDirectoryTask(async (tmpDir) => {
|
|
58
|
+
vi.mocked(ui.prompt).mockImplementationOnce(async () => {
|
|
59
|
+
return { value: "overwrite" };
|
|
60
|
+
});
|
|
61
|
+
const route = "page/$pageHandle";
|
|
62
|
+
const { appRoot, templatesRoot } = await createHydrogen(tmpDir, {
|
|
63
|
+
files: [[`app/routes/${route}.jsx`, 'const str = "I exist"']],
|
|
64
|
+
templates: [[route, 'const str = "hello world"']]
|
|
65
|
+
});
|
|
66
|
+
await runGenerate(route, {
|
|
67
|
+
directory: appRoot,
|
|
68
|
+
templatesRoot
|
|
69
|
+
});
|
|
70
|
+
expect(ui.prompt).toHaveBeenCalledWith(
|
|
71
|
+
expect.arrayContaining([
|
|
72
|
+
expect.objectContaining({
|
|
73
|
+
message: expect.stringContaining("already exists")
|
|
74
|
+
})
|
|
75
|
+
])
|
|
76
|
+
);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
it("does not prompt the user if the force property is true", async () => {
|
|
80
|
+
await temporaryDirectoryTask(async (tmpDir) => {
|
|
81
|
+
vi.mocked(ui.prompt).mockImplementationOnce(async () => {
|
|
82
|
+
return { value: "overwrite" };
|
|
83
|
+
});
|
|
84
|
+
const route = "page/$pageHandle";
|
|
85
|
+
const { appRoot, templatesRoot } = await createHydrogen(tmpDir, {
|
|
86
|
+
files: [[`app/routes/${route}.jsx`, 'const str = "I exist"']],
|
|
87
|
+
templates: [[route, 'const str = "hello world"']]
|
|
88
|
+
});
|
|
89
|
+
await runGenerate(route, {
|
|
90
|
+
directory: appRoot,
|
|
91
|
+
templatesRoot,
|
|
92
|
+
force: true
|
|
93
|
+
});
|
|
94
|
+
expect(ui.prompt).not.toHaveBeenCalled();
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
async function createHydrogen(directory, {
|
|
99
|
+
files,
|
|
100
|
+
templates
|
|
101
|
+
} = {
|
|
102
|
+
files: [],
|
|
103
|
+
templates: []
|
|
104
|
+
}) {
|
|
105
|
+
for (const item of files) {
|
|
106
|
+
const [filePath, fileContent] = item;
|
|
107
|
+
const fullFilePath = path.join(directory, "app", filePath);
|
|
108
|
+
await file.mkdir(path.dirname(fullFilePath));
|
|
109
|
+
await file.write(fullFilePath, fileContent);
|
|
110
|
+
}
|
|
111
|
+
for (const item of templates) {
|
|
112
|
+
const [filePath, fileContent] = item;
|
|
113
|
+
const fullFilePath = path.join(directory, "templates", `${filePath}.tsx`);
|
|
114
|
+
await file.mkdir(path.dirname(fullFilePath));
|
|
115
|
+
await file.write(fullFilePath, fileContent);
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
appRoot: path.join(directory, "app"),
|
|
119
|
+
templatesRoot: directory
|
|
120
|
+
};
|
|
121
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import Command from '@shopify/cli-kit/node/base-command';
|
|
2
|
+
import Flags from '@oclif/core/lib/flags.js';
|
|
3
|
+
|
|
4
|
+
class Init extends Command {
|
|
5
|
+
static description = "Creates a new Hydrogen storefront project";
|
|
6
|
+
static flags = {
|
|
7
|
+
typescript: Flags.boolean({
|
|
8
|
+
description: "Use TypeScript",
|
|
9
|
+
env: "SHOPIFY_HYDROGEN_FLAG_TYPESCRIPT"
|
|
10
|
+
}),
|
|
11
|
+
template: Flags.string({
|
|
12
|
+
description: "The template to use",
|
|
13
|
+
env: "SHOPIFY_HYDROGEN_FLAG_TEMPLATE",
|
|
14
|
+
default: "../../templates/demo-store",
|
|
15
|
+
required: true
|
|
16
|
+
}),
|
|
17
|
+
token: Flags.string({
|
|
18
|
+
description: "A GitHub token used to access access private repository templates"
|
|
19
|
+
})
|
|
20
|
+
};
|
|
21
|
+
async run() {
|
|
22
|
+
const { flags } = await this.parse(Init);
|
|
23
|
+
await runInit({ ...flags });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function runInit({
|
|
27
|
+
template,
|
|
28
|
+
typescript,
|
|
29
|
+
token
|
|
30
|
+
}) {
|
|
31
|
+
const defaults = [
|
|
32
|
+
"--template",
|
|
33
|
+
template,
|
|
34
|
+
"--install",
|
|
35
|
+
typescript ? "--typescript" : "--no-typescript",
|
|
36
|
+
token ? `--token ${token}` : ""
|
|
37
|
+
];
|
|
38
|
+
const { cli } = await import('@remix-run/dev');
|
|
39
|
+
cli.run(["create", ...defaults]);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { Init as default, runInit };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Command from '@shopify/cli-kit/node/base-command';
|
|
2
|
+
import { muteDevLogs } from '../../utils/log.js';
|
|
3
|
+
import { getProjectPaths } from '../../utils/config.js';
|
|
4
|
+
import { commonFlags } from '../../utils/flags.js';
|
|
5
|
+
import { startMiniOxygen } from '../../utils/mini-oxygen.js';
|
|
6
|
+
|
|
7
|
+
class Preview extends Command {
|
|
8
|
+
static description = "Runs an existing Hydrogen storefront build in a MiniOxygen worker";
|
|
9
|
+
static flags = {
|
|
10
|
+
paths: commonFlags.path,
|
|
11
|
+
port: commonFlags.port
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { flags } = await this.parse(Preview);
|
|
15
|
+
await runPreview({ ...flags });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
async function runPreview({
|
|
19
|
+
port,
|
|
20
|
+
path: appPath
|
|
21
|
+
}) {
|
|
22
|
+
if (!process.env.NODE_ENV)
|
|
23
|
+
process.env.NODE_ENV = "production";
|
|
24
|
+
muteDevLogs({ workerReload: false });
|
|
25
|
+
const { root, buildPathWorkerFile, buildPathClient } = getProjectPaths(appPath);
|
|
26
|
+
await startMiniOxygen({
|
|
27
|
+
root,
|
|
28
|
+
port,
|
|
29
|
+
buildPathClient,
|
|
30
|
+
buildPathWorkerFile
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { Preview as default, runPreview };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { spawnSync } from 'child_process';
|
|
2
|
+
import { output } from '@shopify/cli-kit';
|
|
3
|
+
|
|
4
|
+
const EXPERIMENTAL_VM_MODULES_FLAG = "--experimental-vm-modules";
|
|
5
|
+
const hook = async function(options) {
|
|
6
|
+
if (options.id && ["hydrogen:dev", "hydrogen:preview"].includes(options.id) && !process.execArgv.includes(EXPERIMENTAL_VM_MODULES_FLAG) && !(process.env.NODE_OPTIONS ?? "").includes(EXPERIMENTAL_VM_MODULES_FLAG)) {
|
|
7
|
+
output.debug(
|
|
8
|
+
`Restarting CLI process with ${EXPERIMENTAL_VM_MODULES_FLAG} flag.`
|
|
9
|
+
);
|
|
10
|
+
const [command, ...args] = process.argv;
|
|
11
|
+
args.unshift(EXPERIMENTAL_VM_MODULES_FLAG);
|
|
12
|
+
spawnSync(command, args, { stdio: "inherit" });
|
|
13
|
+
process.exit(0);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var init_default = hook;
|
|
17
|
+
|
|
18
|
+
export { init_default as default };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {type LoaderArgs} from '@shopify/remix-oxygen';
|
|
2
|
+
|
|
3
|
+
export const loader = ({request}: LoaderArgs) => {
|
|
4
|
+
const url = new URL(request.url);
|
|
5
|
+
|
|
6
|
+
return new Response(robotsTxtData({url: url.origin}), {
|
|
7
|
+
status: 200,
|
|
8
|
+
headers: {
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
|
+
'content-type': 'text/plain',
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
12
|
+
'cache-control': `max-age=${60 * 60 * 24}`,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function robotsTxtData({url}: {url: string}) {
|
|
18
|
+
const sitemapUrl = url ? `${url}/sitemap.xml` : undefined;
|
|
19
|
+
|
|
20
|
+
return `
|
|
21
|
+
User-agent: *
|
|
22
|
+
Disallow: /admin
|
|
23
|
+
Disallow: /cart
|
|
24
|
+
Disallow: /orders
|
|
25
|
+
Disallow: /checkouts/
|
|
26
|
+
Disallow: /checkout
|
|
27
|
+
Disallow: /carts
|
|
28
|
+
Disallow: /account
|
|
29
|
+
${sitemapUrl ? `Sitemap: ${sitemapUrl}` : ''}
|
|
30
|
+
|
|
31
|
+
# Google adsbot ignores robots.txt unless specifically named!
|
|
32
|
+
User-agent: adsbot-google
|
|
33
|
+
Disallow: /checkouts/
|
|
34
|
+
Disallow: /checkout
|
|
35
|
+
Disallow: /carts
|
|
36
|
+
Disallow: /orders
|
|
37
|
+
|
|
38
|
+
User-agent: Pinterest
|
|
39
|
+
Crawl-delay: 1
|
|
40
|
+
`.trim();
|
|
41
|
+
}
|