From e3b8fc4714e898d3ca5b193c662f259b3d305598 Mon Sep 17 00:00:00 2001 From: Jeremy Kahn Date: Sat, 31 Aug 2024 17:55:14 -0500 Subject: [PATCH] fix(project): [wip] use fully resolved import paths fix fix fix fix --- api-etc/templates.js | 2 +- api-etc/utils.js | 6 +- api/get-market-data.js | 4 +- api/post-day-results.js | 10 +- ...publish-global-market-values-to-discord.js | 10 +- src/common/services/randomNumber.js | 2 +- src/common/services/randomNumber.test.js | 2 +- src/common/utils.js | 4 +- src/common/utils.test.js | 6 +- .../AccountingView/AccountingView.js | 20 +-- .../AccountingView/AccountingView.test.js | 6 +- src/components/AccountingView/index.js | 2 +- src/components/Achievement/Achievement.js | 12 +- .../Achievement/Achievement.test.js | 4 +- src/components/Achievement/index.js | 2 +- .../AchievementsView/AchievementsView.js | 18 +-- .../AchievementsView/AchievementsView.test.js | 2 +- src/components/AchievementsView/index.js | 2 +- .../AnimatedNumber/AnimatedNumber.test.js | 2 +- src/components/AnimatedNumber/index.js | 2 +- src/components/AppBar/AppBar.js | 12 +- src/components/AppBar/AppBar.test.js | 4 +- src/components/AppBar/index.js | 2 +- .../BailOutErrorBoundary.test.js | 2 +- src/components/BailOutErrorBoundary/index.js | 2 +- src/components/Cellar/Cellar.js | 12 +- .../Cellar/CellarInventoryTabPanel.js | 16 +- src/components/Cellar/FermentationTabPanel.js | 10 +- src/components/Cellar/Keg.js | 30 ++-- src/components/Cellar/WinemakingTabPanel.js | 10 +- src/components/Cellar/index.js | 2 +- src/components/ChatRoom/ChatRoom.js | 12 +- src/components/ChatRoom/index.js | 2 +- src/components/ContextPane/ContextPane.js | 8 +- .../ContextPane/ContextPane.test.js | 4 +- src/components/ContextPane/index.js | 2 +- src/components/CowCard/Bloodline/Bloodline.js | 4 +- .../CowCard/Bloodline/Bloodline.test.js | 2 +- src/components/CowCard/Bloodline/index.js | 2 +- src/components/CowCard/CowCard.js | 33 ++-- src/components/CowCard/CowCard.test.js | 10 +- src/components/CowCard/Subheader/Subheader.js | 22 +-- .../CowCard/Subheader/Subheader.test.js | 6 +- src/components/CowCard/Subheader/index.js | 2 +- src/components/CowCard/index.js | 2 +- src/components/CowPen/CowPen.js | 14 +- src/components/CowPen/CowPen.test.js | 10 +- src/components/CowPen/index.js | 2 +- .../CowPenContextMenu/CowPenContextMenu.js | 30 ++-- .../CowPenContextMenu.test.js | 6 +- src/components/CowPenContextMenu/index.js | 2 +- src/components/DebugMenu/DebugMenu.js | 12 +- src/components/DebugMenu/DebugMenu.test.js | 4 +- src/components/DebugMenu/index.js | 2 +- src/components/Elements/index.js | 2 +- src/components/Farmhand/Farmhand.context.js | 4 +- src/components/Farmhand/Farmhand.js | 79 ++++----- src/components/Farmhand/Farmhand.test.js | 8 +- src/components/Farmhand/FarmhandReducers.js | 6 +- .../helpers/getInventoryQuantities.js | 2 +- .../helpers/getInventoryQuantities.test.js | 6 +- src/components/Farmhand/index.js | 2 +- .../FermentationRecipe.js | 32 ++-- .../FermentationRecipeList.js | 8 +- .../FermentationRecipeList.test.js | 12 +- src/components/Field/Field.js | 36 ++--- src/components/Field/Field.test.js | 20 +-- src/components/Field/index.js | 2 +- src/components/Forest/index.js | 2 +- src/components/Home/Home.js | 42 ++--- src/components/Home/Home.test.js | 4 +- src/components/Home/SnowBackground.js | 4 +- src/components/Home/index.js | 2 +- .../IngredientsList/IngredientsList.js | 6 +- .../IngredientsList/IngredientsList.test.js | 2 +- src/components/IngredientsList/index.js | 2 +- src/components/Inventory/Inventory.js | 12 +- src/components/Inventory/Inventory.test.js | 12 +- src/components/Inventory/index.js | 2 +- src/components/Item/Item.js | 40 ++--- src/components/Item/Item.test.js | 8 +- src/components/Item/index.js | 2 +- .../KeybindingsView/KeybindingsView.js | 12 +- .../KeybindingsView/KeybindingsView.test.js | 2 +- src/components/KeybindingsView/index.js | 2 +- src/components/LogView/LogView.js | 6 +- src/components/LogView/LogView.test.js | 4 +- src/components/LogView/index.js | 2 +- .../Navigation/DayAndProgressContainer.js | 14 +- src/components/Navigation/Navigation.js | 68 ++++---- src/components/Navigation/Navigation.test.js | 10 +- src/components/Navigation/index.js | 2 +- .../NotificationSystem/NotificationSystem.js | 6 +- .../NotificationSystem.test.js | 2 +- src/components/NotificationSystem/index.js | 2 +- .../OnlinePeersView/OnlinePeer/OnlinePeer.js | 14 +- .../OnlinePeer/OnlinePeer.test.js | 2 +- .../OnlinePeersView/OnlinePeer/index.js | 2 +- .../OnlinePeersView/OnlinePeersView.js | 20 +-- .../OnlinePeersView/OnlinePeersView.test.js | 2 +- src/components/OnlinePeersView/index.js | 2 +- src/components/Plot/Plot.js | 22 +-- src/components/Plot/Plot.rtl.test.js | 14 +- src/components/Plot/Plot.test.js | 28 ++-- src/components/Plot/index.js | 2 +- .../PriceEventView/PriceEventView.js | 8 +- .../PriceEventView/PriceEventView.test.js | 2 +- src/components/PriceEventView/index.js | 2 +- .../ProgressBar/ProgressBar.test.js | 2 +- src/components/ProgressBar/index.js | 2 +- src/components/QuantityInput/QuantityInput.js | 14 +- .../QuantityInput/QuantityInput.test.js | 4 +- src/components/QuantityInput/index.js | 2 +- src/components/QuickSelect/QuickSelect.js | 20 +-- .../QuickSelect/QuickSelect.test.js | 4 +- src/components/QuickSelect/index.js | 2 +- src/components/Recipe/Recipe.js | 28 ++-- src/components/Recipe/Recipe.test.js | 4 +- src/components/Recipe/index.js | 2 +- src/components/RecipeList/RecipeList.js | 2 +- .../SettingsView/RandomSeedInput.js | 6 +- .../SettingsView/RandomSeedInput.test.js | 4 +- src/components/SettingsView/SettingsView.js | 28 ++-- .../SettingsView/SettingsView.test.js | 4 +- src/components/SettingsView/index.js | 2 +- src/components/Shop/Shop.js | 38 ++--- src/components/Shop/Shop.test.js | 8 +- src/components/Shop/index.js | 2 +- src/components/Stage/Stage.js | 20 +-- src/components/Stage/Stage.test.js | 10 +- src/components/Stage/index.js | 2 +- src/components/StatsView/StatsView.js | 30 ++-- src/components/StatsView/StatsView.test.js | 2 +- src/components/StatsView/index.js | 2 +- src/components/TierPurchase/TierPurchase.js | 18 +-- .../TierPurchase/TierPurchase.test.js | 2 +- src/components/TierPurchase/index.js | 2 +- src/components/Toolbelt/Toolbelt.js | 18 +-- src/components/Toolbelt/Toolbelt.test.js | 6 +- src/components/Toolbelt/index.js | 2 +- .../UpdateNotifier/UpdateNotifier.js | 2 +- src/components/UpdateNotifier/index.js | 2 +- .../UpgradePurchase/UpgradePurchase.js | 20 +-- .../UpgradePurchase/UpgradePurchase.test.js | 4 +- src/components/UpgradePurchase/index.js | 2 +- src/components/WineRecipeList/WineRecipe.js | 37 +++-- .../WineRecipeList/WineRecipe.test.js | 24 +-- .../WineRecipeList/WineRecipeList.js | 8 +- src/components/Workshop/ForgeTabPanel.js | 18 +-- src/components/Workshop/KitchenTabPanel.js | 14 +- src/components/Workshop/RecyclingTabPanel.js | 14 +- src/components/Workshop/Workshop.js | 18 +-- src/components/Workshop/Workshop.test.js | 10 +- .../Workshop/getUpgradesAvailable.js | 4 +- .../Workshop/getUpgradesAvailable.test.js | 4 +- src/components/Workshop/index.js | 2 +- src/config.js | 2 +- src/constants.js | 4 +- src/data/__mocks__/items.js | 6 +- src/data/__mocks__/maps.js | 8 +- src/data/__mocks__/recipes.js | 6 +- src/data/achievements.js | 16 +- src/data/achievements.test.js | 12 +- src/data/crop.js | 4 +- src/data/crops/asparagus.js | 4 +- src/data/crops/carrot.js | 4 +- src/data/crops/corn.js | 4 +- src/data/crops/garlic.js | 4 +- src/data/crops/grape.js | 4 +- src/data/crops/index.js | 38 ++--- src/data/crops/jalapeno.js | 4 +- src/data/crops/olive.js | 4 +- src/data/crops/onion.js | 4 +- src/data/crops/pea.js | 4 +- src/data/crops/potato.js | 4 +- src/data/crops/pumpkin.js | 4 +- src/data/crops/soybean.js | 4 +- src/data/crops/spinach.js | 4 +- src/data/crops/strawberry.js | 4 +- src/data/crops/sunflower.js | 4 +- src/data/crops/sweet-potato.js | 4 +- src/data/crops/tomato.js | 4 +- src/data/crops/watermelon.js | 4 +- src/data/crops/wheat.js | 4 +- src/data/items-map.js | 2 +- src/data/items.js | 8 +- src/data/levels.js | 8 +- src/data/maps.js | 10 +- src/data/ores/bronzeOre.js | 4 +- src/data/ores/coal.js | 4 +- src/data/ores/goldOre.js | 4 +- src/data/ores/index.js | 14 +- src/data/ores/ironOre.js | 4 +- src/data/ores/saltRock.js | 4 +- src/data/ores/silverOre.js | 4 +- src/data/ores/stone.js | 4 +- src/data/recipes.js | 12 +- src/data/shop-inventory-cow.js | 2 +- src/data/shop-inventory.js | 4 +- src/data/tools.js | 4 +- src/data/upgrades.js | 6 +- src/factories/CoalFactory.js | 6 +- src/factories/CoalFactory.test.js | 6 +- src/factories/OreFactory.js | 6 +- src/factories/OreFactory.test.js | 4 +- src/factories/ResourceFactory.js | 16 +- src/factories/ResourceFactory.test.js | 18 +-- src/factories/StoneFactory.js | 8 +- src/factories/StoneFactory.test.js | 6 +- src/factories/index.js | 2 +- src/game-logic/cows/cow-selection.test.js | 8 +- src/game-logic/field-purchase.test.js | 6 +- src/game-logic/item-purchase.test.js | 4 +- src/game-logic/item-sell.test.js | 4 +- src/game-logic/reducers/addExperience.js | 4 +- src/game-logic/reducers/addExperience.test.js | 4 +- src/game-logic/reducers/addItemToInventory.js | 2 +- .../reducers/addItemToInventory.test.js | 4 +- src/game-logic/reducers/addRevenue.js | 2 +- src/game-logic/reducers/adjustLoan.js | 6 +- src/game-logic/reducers/adjustLoan.test.js | 4 +- src/game-logic/reducers/applyCrows.js | 14 +- src/game-logic/reducers/applyCrows.test.js | 8 +- src/game-logic/reducers/applyLoanInterest.js | 6 +- .../reducers/applyLoanInterest.test.js | 2 +- src/game-logic/reducers/applyPrecipitation.js | 14 +- .../reducers/applyPrecipitation.test.js | 16 +- .../reducers/changeCowAutomaticHugState.js | 12 +- .../changeCowAutomaticHugState.test.js | 8 +- .../reducers/changeCowBreedingPenResident.js | 2 +- .../changeCowBreedingPenResident.test.js | 6 +- src/game-logic/reducers/changeCowName.js | 4 +- src/game-logic/reducers/changeCowName.test.js | 6 +- src/game-logic/reducers/clearPlot.js | 14 +- src/game-logic/reducers/clearPlot.test.js | 14 +- .../reducers/computeCowInventoryForNextDay.js | 2 +- .../computeCowInventoryForNextDay.test.js | 4 +- .../reducers/computeStateForNextDay.js | 42 ++--- .../reducers/computeStateForNextDay.test.js | 10 +- .../reducers/createPriceEvent.test.js | 6 +- .../decrementItemFromInventory.test.js | 4 +- src/game-logic/reducers/fertilizePlot.js | 10 +- src/game-logic/reducers/fertilizePlot.test.js | 10 +- src/game-logic/reducers/forRange.test.js | 8 +- .../reducers/generatePriceEvents.js | 14 +- .../reducers/generatePriceEvents.test.js | 14 +- src/game-logic/reducers/harvestPlot.js | 16 +- src/game-logic/reducers/harvestPlot.test.js | 14 +- src/game-logic/reducers/helpers.js | 8 +- src/game-logic/reducers/hugCow.js | 4 +- src/game-logic/reducers/hugCow.test.js | 6 +- .../reducers/incrementPlotContentAge.js | 6 +- .../reducers/incrementPlotContentAge.test.js | 12 +- src/game-logic/reducers/index.js | 152 +++++++++--------- .../reducers/makeFermentationRecipe.js | 16 +- .../reducers/makeFermentationRecipe.test.js | 6 +- src/game-logic/reducers/makeRecipe.js | 12 +- src/game-logic/reducers/makeRecipe.test.js | 10 +- src/game-logic/reducers/makeWine.js | 16 +- src/game-logic/reducers/makeWine.test.js | 12 +- src/game-logic/reducers/minePlot.js | 16 +- src/game-logic/reducers/minePlot.test.js | 10 +- src/game-logic/reducers/offerCow.test.js | 2 +- src/game-logic/reducers/plantInPlot.js | 10 +- src/game-logic/reducers/plantInPlot.test.js | 8 +- .../reducers/prependPendingPeerMessage.js | 2 +- .../prependPendingPeerMessage.test.js | 4 +- src/game-logic/reducers/processCellar.js | 2 +- src/game-logic/reducers/processCellar.test.js | 4 +- .../reducers/processCellarSpoilage.js | 12 +- .../reducers/processCellarSpoilage.test.js | 10 +- .../reducers/processCowAttrition.js | 6 +- .../reducers/processCowAttrition.test.js | 10 +- src/game-logic/reducers/processCowBreeding.js | 10 +- .../reducers/processCowBreeding.test.js | 8 +- .../processCowFertilizerProduction.js | 6 +- .../processCowFertilizerProduction.test.js | 10 +- src/game-logic/reducers/processFeedingCows.js | 8 +- .../reducers/processFeedingCows.test.js | 8 +- src/game-logic/reducers/processField.js | 8 +- src/game-logic/reducers/processLevelUp.js | 18 +-- .../reducers/processLevelUp.test.js | 8 +- src/game-logic/reducers/processMilkingCows.js | 6 +- .../reducers/processMilkingCows.test.js | 10 +- src/game-logic/reducers/processNerfs.js | 4 +- src/game-logic/reducers/processNerfs.test.js | 6 +- src/game-logic/reducers/processSprinklers.js | 12 +- .../reducers/processSprinklers.test.js | 8 +- src/game-logic/reducers/processWeather.js | 6 +- .../reducers/processWeather.test.js | 12 +- src/game-logic/reducers/purchaseCellar.js | 10 +- .../reducers/purchaseCellar.test.js | 4 +- src/game-logic/reducers/purchaseCombine.js | 4 +- .../reducers/purchaseCombine.test.js | 4 +- src/game-logic/reducers/purchaseComposter.js | 12 +- .../reducers/purchaseComposter.test.js | 6 +- src/game-logic/reducers/purchaseCow.js | 6 +- src/game-logic/reducers/purchaseCow.test.js | 8 +- src/game-logic/reducers/purchaseCowPen.js | 10 +- .../reducers/purchaseCowPen.test.js | 4 +- src/game-logic/reducers/purchaseField.js | 6 +- src/game-logic/reducers/purchaseField.test.js | 6 +- src/game-logic/reducers/purchaseForest.js | 12 +- .../reducers/purchaseForest.test.js | 6 +- src/game-logic/reducers/purchaseItem.js | 8 +- src/game-logic/reducers/purchaseItem.test.js | 6 +- src/game-logic/reducers/purchaseSmelter.js | 12 +- .../reducers/purchaseSmelter.test.js | 6 +- .../reducers/purchaseStorageExpansion.js | 4 +- .../reducers/purchaseStorageExpansion.test.js | 6 +- .../reducers/removeCowFromInventory.js | 8 +- src/game-logic/reducers/removeFieldPlotAt.js | 2 +- .../reducers/rotateNotificationLogs.js | 2 +- .../reducers/rotateNotificationLogs.test.js | 4 +- src/game-logic/reducers/selectCow.test.js | 2 +- src/game-logic/reducers/sellCow.js | 6 +- src/game-logic/reducers/sellCow.test.js | 10 +- src/game-logic/reducers/sellItem.js | 22 +-- src/game-logic/reducers/sellItem.test.js | 12 +- src/game-logic/reducers/sellKeg.js | 30 ++-- src/game-logic/reducers/sellKeg.test.js | 12 +- src/game-logic/reducers/setScarecrow.js | 10 +- src/game-logic/reducers/setScarecrow.test.js | 10 +- src/game-logic/reducers/setSprinkler.js | 12 +- src/game-logic/reducers/setSprinkler.test.js | 10 +- .../reducers/showNotification.test.js | 2 +- src/game-logic/reducers/spawnWeeds.js | 8 +- src/game-logic/reducers/spawnWeeds.test.js | 4 +- src/game-logic/reducers/unlockTool.js | 2 +- src/game-logic/reducers/unlockTool.test.js | 4 +- src/game-logic/reducers/updateAchievements.js | 6 +- .../reducers/updateAchievements.test.js | 6 +- .../reducers/updateFinancialRecords.js | 4 +- .../reducers/updateFinancialRecords.test.js | 2 +- .../updateInventoryRecordsForNextDay.test.js | 2 +- .../reducers/updateLearnedRecipes.js | 2 +- .../reducers/updateLearnedRecipes.test.js | 2 +- src/game-logic/reducers/updatePeer.js | 8 +- src/game-logic/reducers/updatePeer.test.js | 12 +- .../reducers/updatePlotShoveledState.test.js | 2 +- .../reducers/updatePriceEvents.test.js | 2 +- src/game-logic/reducers/upgradeTool.js | 8 +- src/game-logic/reducers/waterAllPlots.js | 2 +- src/game-logic/reducers/waterAllPlots.test.js | 8 +- src/game-logic/reducers/waterField.js | 2 +- src/game-logic/reducers/waterPlot.js | 6 +- src/game-logic/reducers/waterPlot.test.js | 8 +- src/game-logic/reducers/withdrawCow.test.js | 2 +- src/handlers/peer-events.js | 14 +- src/handlers/ui-events.js | 14 +- src/handlers/ui-events.test.js | 8 +- src/hooks/useMountState/index.js | 1 + src/hooks/useMountState/index.ts | 1 - .../{useMountState.ts => useMountState.js} | 0 src/img/index.js | 2 +- src/index.js | 8 +- src/mui-theme.js | 2 +- src/react-app-env.d.ts | 4 +- src/scripts/generate-crop-table.js | 2 +- src/services/cellar.js | 10 +- src/services/cellar.test.js | 8 +- src/services/wine.js | 14 +- src/services/wine.test.js | 12 +- src/shell/bootup.test.js | 6 +- src/shell/field.test.js | 12 +- src/shell/game-saving.test.js | 6 +- src/shell/navigation.test.js | 6 +- src/shell/notifications.test.js | 6 +- src/shell/pending-notifications.test.js | 10 +- src/strings.js | 2 +- src/templates.js | 12 +- src/test-utils/index.js | 2 +- src/test-utils/stubs/cowStub.js | 2 +- src/test-utils/stubs/farmhandStub.js | 2 +- src/test-utils/stubs/getKegStub.js | 2 +- src/test-utils/stubs/saveDataStubFactory.js | 2 +- src/utils/farmProductsSold.js | 6 +- src/utils/findInField.js | 4 +- src/utils/findInField.test.js | 4 +- src/utils/getCropLifecycleDuration.js | 2 +- src/utils/getCropLifecycleDuration.test.js | 4 +- src/utils/getCropsAvailableToFerment.js | 4 +- src/utils/getCropsAvailableToFerment.test.js | 6 +- src/utils/getInventoryQuantityMap.js | 2 +- src/utils/getItemBaseValue.js | 2 +- src/utils/getKegSpoilageRate.js | 4 +- src/utils/getKegSpoilageRate.test.js | 8 +- src/utils/getKegValue.js | 8 +- src/utils/getKegValue.test.js | 8 +- src/utils/getLevelEntitlements.js | 6 +- src/utils/getLevelEntitlements.test.js | 2 +- src/utils/getMaxYieldOfFermentationRecipe.js | 6 +- .../getMaxYieldOfFermentationRecipe.test.js | 6 +- src/utils/getWineVarietiesAvailableToMake.js | 6 +- .../getWineVarietiesAvailableToMake.test.js | 6 +- src/utils/getYeastRequiredForWine.js | 6 +- src/utils/index.js | 34 ++-- src/utils/index.test.js | 20 +-- src/utils/isItemAFarmProduct.js | 4 +- src/utils/isItemAGrownCrop.js | 2 +- src/utils/memoize.js | 2 +- src/utils/moneyString.test.js | 4 +- src/utils/totalIngredientsInRecipe.test.js | 2 +- vite.config.js | 2 +- 404 files changed, 1711 insertions(+), 1698 deletions(-) create mode 100644 src/hooks/useMountState/index.js delete mode 100644 src/hooks/useMountState/index.ts rename src/hooks/useMountState/{useMountState.ts => useMountState.js} (100%) diff --git a/api-etc/templates.js b/api-etc/templates.js index 2aefc9db4..046fbdfd6 100644 --- a/api-etc/templates.js +++ b/api-etc/templates.js @@ -1,4 +1,4 @@ -import { itemsMap } from '../src/data/maps' +import { itemsMap } from '../src/data/maps.js' export const MARKET_SUMMARY_FOR_DISCORD = (_, room, valueAdjustments) => { let string = `Current market values for the **${room}** room:\n` diff --git a/api-etc/utils.js b/api-etc/utils.js index de2462d9a..adeb39388 100644 --- a/api-etc/utils.js +++ b/api-etc/utils.js @@ -1,9 +1,9 @@ const redis = require('redis') -const { generateValueAdjustments } = require('../src/common/utils') -const { MAX_ROOM_NAME_LENGTH } = require('../src/common/constants') +const { generateValueAdjustments } = require('../src/common/utils.js') +const { MAX_ROOM_NAME_LENGTH } = require('../src/common/constants.js') -const { GLOBAL_ROOM_KEY, ACCEPTED_ORIGINS } = require('./constants') +const { GLOBAL_ROOM_KEY, ACCEPTED_ORIGINS } = require('./constants.js') module.exports.getRedisClient = () => { const client = redis.createClient({ diff --git a/api/get-market-data.js b/api/get-market-data.js index c538fb679..a05e0eaf2 100644 --- a/api/get-market-data.js +++ b/api/get-market-data.js @@ -4,7 +4,7 @@ import { promisify } from 'util' import 'redis' -import '../src/common/utils' +import '../src/common/utils.js' // End explicit requires for serverless builds import { @@ -12,7 +12,7 @@ import { getRedisClient, getRoomData, getRoomName, -} from '../api-etc/utils' +} from '../api-etc/utils.js' const client = getRedisClient() diff --git a/api/post-day-results.js b/api/post-day-results.js index d781d3c31..bfcd28ff4 100644 --- a/api/post-day-results.js +++ b/api/post-day-results.js @@ -2,9 +2,9 @@ // here to ensure that that they are included in serverless builds. Do NOT // remove them unless they are not needed by any upstream modules. import 'redis' -import '../src/common/utils' -import '../src/common/constants' -import '../api-etc/constants' +import '../src/common/utils.js' +import '../src/common/constants.js' +import '../api-etc/constants.js' // End explicit requires for serverless builds import { promisify } from 'util' @@ -14,8 +14,8 @@ import { getRedisClient, getRoomData, getRoomName, -} from '../api-etc/utils' -import { random } from '../src/common/utils' +} from '../api-etc/utils.js' +import { random } from '../src/common/utils.js' const client = getRedisClient() diff --git a/api/publish-global-market-values-to-discord.js b/api/publish-global-market-values-to-discord.js index b32ff0795..c40d4392a 100644 --- a/api/publish-global-market-values-to-discord.js +++ b/api/publish-global-market-values-to-discord.js @@ -2,17 +2,17 @@ // here to ensure that that they are included in serverless builds. Do NOT // remove them unless they are not needed by any upstream modules. import 'redis' -import '../src/common/utils' -import '../src/common/constants' -import '../api-etc/constants' +import '../src/common/utils.js' +import '../src/common/constants.js' +import '../api-etc/constants.js' // End explicit requires for serverless builds import { promisify } from 'util' import axios from 'axios' -import { MARKET_SUMMARY_FOR_DISCORD } from '../api-etc/templates' -import { allowCors, getRedisClient, getRoomData } from '../api-etc/utils' +import { MARKET_SUMMARY_FOR_DISCORD } from '../api-etc/templates.js' +import { allowCors, getRedisClient, getRoomData } from '../api-etc/utils.js' const client = getRedisClient() diff --git a/src/common/services/randomNumber.js b/src/common/services/randomNumber.js index 3c2baf4bb..0656276e3 100644 --- a/src/common/services/randomNumber.js +++ b/src/common/services/randomNumber.js @@ -1,5 +1,5 @@ import seedrandom from 'seedrandom' -import globalWindow from 'global/window' +import globalWindow from 'global/window.js' export class RandomNumberService { /** diff --git a/src/common/services/randomNumber.test.js b/src/common/services/randomNumber.test.js index 85a0f81f8..2a632c3f2 100644 --- a/src/common/services/randomNumber.test.js +++ b/src/common/services/randomNumber.test.js @@ -1,4 +1,4 @@ -import { randomNumberService } from './randomNumber' +import { randomNumberService } from './randomNumber.js' describe('RandomNumberService', () => { describe('isRandomNumberLessThan', () => { diff --git a/src/common/utils.js b/src/common/utils.js index 2cc3534c3..1c2568fc1 100644 --- a/src/common/utils.js +++ b/src/common/utils.js @@ -1,7 +1,7 @@ /** @typedef {import("../index").farmhand.priceEvent} farmhand.priceEvent */ -import { itemsMap } from '../data/maps' +import { itemsMap } from '../data/maps.js' -import { randomNumberService } from './services/randomNumber' +import { randomNumberService } from './services/randomNumber.js' export const random = () => { return randomNumberService.generateRandomNumber() diff --git a/src/common/utils.test.js b/src/common/utils.test.js index c7817f83f..b324dc86d 100644 --- a/src/common/utils.test.js +++ b/src/common/utils.test.js @@ -1,7 +1,7 @@ -import { generateValueAdjustments } from './utils' +import { generateValueAdjustments } from './utils.js' -vitest.mock('../data/maps') -vitest.mock('../data/items') +vitest.mock('../data/maps.js') +vitest.mock('../data/items.js') describe('generateValueAdjustments', () => { let valueAdjustments diff --git a/src/components/AccountingView/AccountingView.js b/src/components/AccountingView/AccountingView.js index e6c5c7fac..1ca446bfb 100644 --- a/src/components/AccountingView/AccountingView.js +++ b/src/components/AccountingView/AccountingView.js @@ -1,21 +1,21 @@ import React, { useEffect, useState, forwardRef } from 'react' -import Card from '@mui/material/Card' -import CardHeader from '@mui/material/CardHeader' -import CardContent from '@mui/material/CardContent' -import Button from '@mui/material/Button' -import TextField from '@mui/material/TextField' -import AccountBalanceIcon from '@mui/icons-material/AccountBalance' +import Card from '@mui/material/Card/index.js' +import CardHeader from '@mui/material/CardHeader/index.js' +import CardContent from '@mui/material/CardContent/index.js' +import Button from '@mui/material/Button/index.js' +import TextField from '@mui/material/TextField/index.js' +import AccountBalanceIcon from '@mui/icons-material/AccountBalance.js' import NumberFormat from 'react-number-format' import { func, number } from 'prop-types' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { moneyString } from '../../utils/moneyString' -import { dollarString, moneyTotal } from '../../utils' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { moneyString } from '../../utils/moneyString.js' +import { dollarString, moneyTotal } from '../../utils/index.js' import { STANDARD_LOAN_AMOUNT, LOAN_INTEREST_RATE, LOAN_GARNISHMENT_RATE, -} from '../../constants' +} from '../../constants.js' import './AccountingView.sass' diff --git a/src/components/AccountingView/AccountingView.test.js b/src/components/AccountingView/AccountingView.test.js index 1042396fc..713ef0314 100644 --- a/src/components/AccountingView/AccountingView.test.js +++ b/src/components/AccountingView/AccountingView.test.js @@ -2,11 +2,11 @@ import React from 'react' import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' -import { STANDARD_LOAN_AMOUNT } from '../../constants' +import { STANDARD_LOAN_AMOUNT } from '../../constants.js' -import AccountingView from './AccountingView' +import AccountingView from './AccountingView.js' describe('', () => { let handleClickLoanPaydownButton, handleClickTakeOutLoanButton diff --git a/src/components/AccountingView/index.js b/src/components/AccountingView/index.js index 6262b8d3c..88af4ad0b 100644 --- a/src/components/AccountingView/index.js +++ b/src/components/AccountingView/index.js @@ -1 +1 @@ -export { default } from './AccountingView' +export { default } from './AccountingView.js' diff --git a/src/components/Achievement/Achievement.js b/src/components/Achievement/Achievement.js index 624755149..d66a40804 100644 --- a/src/components/Achievement/Achievement.js +++ b/src/components/Achievement/Achievement.js @@ -1,14 +1,14 @@ import React from 'react' import classNames from 'classnames' -import AssignmentLateIcon from '@mui/icons-material/AssignmentLate' -import Card from '@mui/material/Card' -import CardHeader from '@mui/material/CardHeader' -import CardContent from '@mui/material/CardContent' -import BeenhereIcon from '@mui/icons-material/Beenhere' +import AssignmentLateIcon from '@mui/icons-material/AssignmentLate.js' +import Card from '@mui/material/Card/index.js' +import CardHeader from '@mui/material/CardHeader/index.js' +import CardContent from '@mui/material/CardContent/index.js' +import BeenhereIcon from '@mui/icons-material/Beenhere.js' import { bool, object, shape, string } from 'prop-types' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' import './Achievement.sass' diff --git a/src/components/Achievement/Achievement.test.js b/src/components/Achievement/Achievement.test.js index 498649577..36f8f28c3 100644 --- a/src/components/Achievement/Achievement.test.js +++ b/src/components/Achievement/Achievement.test.js @@ -1,9 +1,9 @@ import React from 'react' import { render, screen } from '@testing-library/react' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' -import Achievement from './Achievement' +import Achievement from './Achievement.js' describe('', () => { let achievementObject diff --git a/src/components/Achievement/index.js b/src/components/Achievement/index.js index e0b21e91b..df39d334b 100644 --- a/src/components/Achievement/index.js +++ b/src/components/Achievement/index.js @@ -1 +1 @@ -export { default } from './Achievement' +export { default } from './Achievement.js' diff --git a/src/components/AchievementsView/AchievementsView.js b/src/components/AchievementsView/AchievementsView.js index e31791183..99ea8d9f2 100644 --- a/src/components/AchievementsView/AchievementsView.js +++ b/src/components/AchievementsView/AchievementsView.js @@ -1,15 +1,15 @@ import React from 'react' -import Accordion from '@mui/material/Accordion' -import AccordionSummary from '@mui/material/AccordionSummary' -import AccordionDetails from '@mui/material/AccordionDetails' +import Accordion from '@mui/material/Accordion/index.js' +import AccordionSummary from '@mui/material/AccordionSummary/index.js' +import AccordionDetails from '@mui/material/AccordionDetails/index.js' import { object } from 'prop-types' -import Divider from '@mui/material/Divider' +import Divider from '@mui/material/Divider/index.js' -import FarmhandContext from '../Farmhand/Farmhand.context' -import ProgressBar from '../ProgressBar' -import Achievement from '../Achievement' -import achievements from '../../data/achievements' -import { memoize } from '../../utils/memoize' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import ProgressBar from '../ProgressBar/index.js' +import Achievement from '../Achievement/index.js' +import achievements from '../../data/achievements.js' +import { memoize } from '../../utils/memoize.js' import './AchievementsView.sass' diff --git a/src/components/AchievementsView/AchievementsView.test.js b/src/components/AchievementsView/AchievementsView.test.js index 37fcbed79..18144bbdf 100644 --- a/src/components/AchievementsView/AchievementsView.test.js +++ b/src/components/AchievementsView/AchievementsView.test.js @@ -1,7 +1,7 @@ import React from 'react' import { shallow } from 'enzyme' -import AchievementsView from './AchievementsView' +import AchievementsView from './AchievementsView.js' let component diff --git a/src/components/AchievementsView/index.js b/src/components/AchievementsView/index.js index 9006b450d..1cf2daebb 100644 --- a/src/components/AchievementsView/index.js +++ b/src/components/AchievementsView/index.js @@ -1 +1 @@ -export { default } from './AchievementsView' +export { default } from './AchievementsView.js' diff --git a/src/components/AnimatedNumber/AnimatedNumber.test.js b/src/components/AnimatedNumber/AnimatedNumber.test.js index e8ab3dd9c..fdb97969f 100644 --- a/src/components/AnimatedNumber/AnimatedNumber.test.js +++ b/src/components/AnimatedNumber/AnimatedNumber.test.js @@ -1,7 +1,7 @@ import React from 'react' import { shallow } from 'enzyme' -import AnimatedNumber from './AnimatedNumber' +import AnimatedNumber from './AnimatedNumber.js' let component diff --git a/src/components/AnimatedNumber/index.js b/src/components/AnimatedNumber/index.js index 07710c783..bc1ef5fd2 100644 --- a/src/components/AnimatedNumber/index.js +++ b/src/components/AnimatedNumber/index.js @@ -1 +1 @@ -export { default } from './AnimatedNumber' +export { default } from './AnimatedNumber.js' diff --git a/src/components/AppBar/AppBar.js b/src/components/AppBar/AppBar.js index 1ced20024..27bbe8e50 100644 --- a/src/components/AppBar/AppBar.js +++ b/src/components/AppBar/AppBar.js @@ -2,13 +2,13 @@ import React, { useEffect, useState } from 'react' import { tween } from 'shifty' import { array, bool, func, number, string } from 'prop-types' -import { default as MuiAppBar } from '@mui/material/AppBar' -import Toolbar from '@mui/material/Toolbar' -import Typography from '@mui/material/Typography' -import StepIcon from '@mui/material/StepIcon' +import { default as MuiAppBar } from '@mui/material/AppBar/index.js' +import Toolbar from '@mui/material/Toolbar/index.js' +import Typography from '@mui/material/Typography/index.js' +import StepIcon from '@mui/material/StepIcon/index.js' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { moneyString } from '../../utils/moneyString' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { moneyString } from '../../utils/moneyString.js' import './AppBar.sass' const MoneyDisplay = ({ money }) => { diff --git a/src/components/AppBar/AppBar.test.js b/src/components/AppBar/AppBar.test.js index 70330f1ac..c0b92ac2e 100644 --- a/src/components/AppBar/AppBar.test.js +++ b/src/components/AppBar/AppBar.test.js @@ -1,9 +1,9 @@ import React from 'react' import { shallow } from 'enzyme' -import { noop } from '../../utils/noop' +import { noop } from '../../utils/noop.js' -import AppBar from './AppBar' +import AppBar from './AppBar.js' let component diff --git a/src/components/AppBar/index.js b/src/components/AppBar/index.js index 1eb1831e6..f14fc2976 100644 --- a/src/components/AppBar/index.js +++ b/src/components/AppBar/index.js @@ -1 +1 @@ -export { default } from './AppBar' +export { default } from './AppBar.js' diff --git a/src/components/BailOutErrorBoundary/BailOutErrorBoundary.test.js b/src/components/BailOutErrorBoundary/BailOutErrorBoundary.test.js index 3f94be12e..feacbaa65 100644 --- a/src/components/BailOutErrorBoundary/BailOutErrorBoundary.test.js +++ b/src/components/BailOutErrorBoundary/BailOutErrorBoundary.test.js @@ -1,7 +1,7 @@ import React from 'react' import { shallow } from 'enzyme' -import BailOutErrorBoundary from './BailOutErrorBoundary' +import BailOutErrorBoundary from './BailOutErrorBoundary.js' let component diff --git a/src/components/BailOutErrorBoundary/index.js b/src/components/BailOutErrorBoundary/index.js index c78983088..8cca22663 100644 --- a/src/components/BailOutErrorBoundary/index.js +++ b/src/components/BailOutErrorBoundary/index.js @@ -1 +1 @@ -export { default } from './BailOutErrorBoundary' +export { default } from './BailOutErrorBoundary.js' diff --git a/src/components/Cellar/Cellar.js b/src/components/Cellar/Cellar.js index 2ba5f963c..1c09d0503 100644 --- a/src/components/Cellar/Cellar.js +++ b/src/components/Cellar/Cellar.js @@ -1,11 +1,11 @@ import React, { useState } from 'react' -import Tab from '@mui/material/Tab' -import Tabs from '@mui/material/Tabs' +import Tab from '@mui/material/Tab/index.js' +import Tabs from '@mui/material/Tabs/index.js' -import { CellarInventoryTabPanel } from './CellarInventoryTabPanel' -import { FermentationTabPanel } from './FermentationTabPanel' -import { WinemakingTabPanel } from './WinemakingTabPanel' -import { a11yProps } from './TabPanel' +import { CellarInventoryTabPanel } from './CellarInventoryTabPanel.js' +import { FermentationTabPanel } from './FermentationTabPanel.js' +import { WinemakingTabPanel } from './WinemakingTabPanel.js' +import { a11yProps } from './TabPanel/index.js' import './Cellar.sass' diff --git a/src/components/Cellar/CellarInventoryTabPanel.js b/src/components/Cellar/CellarInventoryTabPanel.js index df4895331..999bb0507 100644 --- a/src/components/Cellar/CellarInventoryTabPanel.js +++ b/src/components/Cellar/CellarInventoryTabPanel.js @@ -1,23 +1,23 @@ /** @typedef {import("../../index").farmhand.keg} keg */ import React, { useContext } from 'react' import { number } from 'prop-types' -import Divider from '@mui/material/Divider' -import Card from '@mui/material/Card' -import CardContent from '@mui/material/CardContent' +import Divider from '@mui/material/Divider/index.js' +import Card from '@mui/material/Card/index.js' +import CardContent from '@mui/material/CardContent/index.js' import ReactMarkdown from 'react-markdown' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' import { KEG_INTEREST_RATE, PURCHASEABLE_CELLARS, WINE_GROWTH_TIMELINE_CAP, WINE_INTEREST_RATE, -} from '../../constants' +} from '../../constants.js' -import { integerString } from '../../utils' +import { integerString } from '../../utils/index.js' -import { TabPanel } from './TabPanel' -import { Keg } from './Keg' +import { TabPanel } from './TabPanel/index.js' +import { Keg } from './Keg.js' /** * @param {Object} props diff --git a/src/components/Cellar/FermentationTabPanel.js b/src/components/Cellar/FermentationTabPanel.js index 9a960e5f9..f434ac88d 100644 --- a/src/components/Cellar/FermentationTabPanel.js +++ b/src/components/Cellar/FermentationTabPanel.js @@ -1,13 +1,13 @@ import React from 'react' import { number } from 'prop-types' -import Divider from '@mui/material/Divider' -import Card from '@mui/material/Card' -import CardContent from '@mui/material/CardContent' +import Divider from '@mui/material/Divider/index.js' +import Card from '@mui/material/Card/index.js' +import CardContent from '@mui/material/CardContent/index.js' import ReactMarkdown from 'react-markdown' -import { FermentationRecipeList } from '../FermentationRecipeList/FermentationRecipeList' +import { FermentationRecipeList } from '../FermentationRecipeList/FermentationRecipeList.js' -import { TabPanel } from './TabPanel' +import { TabPanel } from './TabPanel/index.js' export const FermentationTabPanel = ({ index, currentTab }) => ( diff --git a/src/components/Cellar/Keg.js b/src/components/Cellar/Keg.js index 4b0b88ce2..9a25d0b07 100644 --- a/src/components/Cellar/Keg.js +++ b/src/components/Cellar/Keg.js @@ -1,25 +1,25 @@ /** @typedef {import("../../index").farmhand.keg} keg */ import React, { useContext } from 'react' import { object } from 'prop-types' -import Card from '@mui/material/Card' -import CardHeader from '@mui/material/CardHeader' -import CardActions from '@mui/material/CardActions' -import Button from '@mui/material/Button' +import Card from '@mui/material/Card/index.js' +import CardHeader from '@mui/material/CardHeader/index.js' +import CardActions from '@mui/material/CardActions/index.js' +import Button from '@mui/material/Button/index.js' -import { itemsMap } from '../../data/maps' -import { items, wines } from '../../img' +import { itemsMap } from '../../data/maps.js' +import { items, wines } from '../../img/index.js' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { getKegValue } from '../../utils/getKegValue' -import { moneyString } from '../../utils/moneyString' -import { getSalePriceMultiplier } from '../../utils' -import { FERMENTED_CROP_NAME } from '../../templates' -import AnimatedNumber from '../AnimatedNumber' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { getKegValue } from '../../utils/getKegValue.js' +import { moneyString } from '../../utils/moneyString.js' +import { getSalePriceMultiplier } from '../../utils/index.js' +import { FERMENTED_CROP_NAME } from '../../templates.js' +import AnimatedNumber from '../AnimatedNumber/index.js' import './Keg.sass' -import { getKegSpoilageRate } from '../../utils/getKegSpoilageRate' -import { wineService } from '../../services/wine' -import { cellarService } from '../../services/cellar' +import { getKegSpoilageRate } from '../../utils/getKegSpoilageRate.js' +import { wineService } from '../../services/wine.js' +import { cellarService } from '../../services/cellar.js' /** * @param {Object} props diff --git a/src/components/Cellar/WinemakingTabPanel.js b/src/components/Cellar/WinemakingTabPanel.js index 75172e974..56ed586aa 100644 --- a/src/components/Cellar/WinemakingTabPanel.js +++ b/src/components/Cellar/WinemakingTabPanel.js @@ -1,13 +1,13 @@ import React from 'react' import { number } from 'prop-types' -import Divider from '@mui/material/Divider' -import Card from '@mui/material/Card' -import CardContent from '@mui/material/CardContent' +import Divider from '@mui/material/Divider/index.js' +import Card from '@mui/material/Card/index.js' +import CardContent from '@mui/material/CardContent/index.js' import ReactMarkdown from 'react-markdown' -import { WineRecipeList } from '../WineRecipeList/WineRecipeList' +import { WineRecipeList } from '../WineRecipeList/WineRecipeList.js' -import { TabPanel } from './TabPanel' +import { TabPanel } from './TabPanel/index.js' export const WinemakingTabPanel = ({ index, currentTab }) => ( diff --git a/src/components/Cellar/index.js b/src/components/Cellar/index.js index 393761e43..1274071d3 100644 --- a/src/components/Cellar/index.js +++ b/src/components/Cellar/index.js @@ -1 +1 @@ -export * from './Cellar' +export * from './Cellar.js' diff --git a/src/components/ChatRoom/ChatRoom.js b/src/components/ChatRoom/ChatRoom.js index bee20d0ca..8c4dd759e 100644 --- a/src/components/ChatRoom/ChatRoom.js +++ b/src/components/ChatRoom/ChatRoom.js @@ -1,13 +1,13 @@ import React, { useContext } from 'react' import { Helmet } from 'react-helmet' import classNames from 'classnames' -import Button from '@mui/material/Button' -import Dialog from '@mui/material/Dialog' -import DialogTitle from '@mui/material/DialogTitle' -import DialogContent from '@mui/material/DialogContent' -import DialogActions from '@mui/material/DialogActions' +import Button from '@mui/material/Button/index.js' +import Dialog from '@mui/material/Dialog/index.js' +import DialogTitle from '@mui/material/DialogTitle/index.js' +import DialogContent from '@mui/material/DialogContent/index.js' +import DialogActions from '@mui/material/DialogActions/index.js' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' import './ChatRoom.sass' diff --git a/src/components/ChatRoom/index.js b/src/components/ChatRoom/index.js index ed1ce9d5d..6f1b77341 100644 --- a/src/components/ChatRoom/index.js +++ b/src/components/ChatRoom/index.js @@ -1 +1 @@ -export * from './ChatRoom' +export * from './ChatRoom.js' diff --git a/src/components/ContextPane/ContextPane.js b/src/components/ContextPane/ContextPane.js index 86c9845e6..db69b23c6 100644 --- a/src/components/ContextPane/ContextPane.js +++ b/src/components/ContextPane/ContextPane.js @@ -1,10 +1,10 @@ import React, { memo } from 'react' import { array, string } from 'prop-types' -import FarmhandContext from '../Farmhand/Farmhand.context' -import Inventory from '../Inventory' -import CowPenContextMenu from '../CowPenContextMenu' -import { stageFocusType } from '../../enums' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import Inventory from '../Inventory/index.js' +import CowPenContextMenu from '../CowPenContextMenu/index.js' +import { stageFocusType } from '../../enums.js' import './ContextPane.sass' diff --git a/src/components/ContextPane/ContextPane.test.js b/src/components/ContextPane/ContextPane.test.js index df7035bee..90ff5fe60 100644 --- a/src/components/ContextPane/ContextPane.test.js +++ b/src/components/ContextPane/ContextPane.test.js @@ -1,9 +1,9 @@ import React from 'react' import { shallow } from 'enzyme' -import { stageFocusType } from '../../../src/enums' +import { stageFocusType } from '../../../src/enums.js' -import { ContextPane, PlayerInventory } from './ContextPane' +import { ContextPane, PlayerInventory } from './ContextPane.js' let component diff --git a/src/components/ContextPane/index.js b/src/components/ContextPane/index.js index fc1644ce1..74c763558 100644 --- a/src/components/ContextPane/index.js +++ b/src/components/ContextPane/index.js @@ -1 +1 @@ -export { default } from './ContextPane' +export { default } from './ContextPane.js' diff --git a/src/components/CowCard/Bloodline/Bloodline.js b/src/components/CowCard/Bloodline/Bloodline.js index 1b185e869..11e0d51db 100644 --- a/src/components/CowCard/Bloodline/Bloodline.js +++ b/src/components/CowCard/Bloodline/Bloodline.js @@ -1,8 +1,8 @@ import React, { memo } from 'react' import { object } from 'prop-types' -import Tooltip from '@mui/material/Tooltip' +import Tooltip from '@mui/material/Tooltip/index.js' -import { COW_COLOR_NAMES } from '../../../strings' +import { COW_COLOR_NAMES } from '../../../strings.js' import './Bloodline.sass' diff --git a/src/components/CowCard/Bloodline/Bloodline.test.js b/src/components/CowCard/Bloodline/Bloodline.test.js index 02e569852..2c7513c44 100644 --- a/src/components/CowCard/Bloodline/Bloodline.test.js +++ b/src/components/CowCard/Bloodline/Bloodline.test.js @@ -1,7 +1,7 @@ import React from 'react' import { shallow } from 'enzyme' -import Bloodline from './Bloodline' +import Bloodline from './Bloodline.js' let component diff --git a/src/components/CowCard/Bloodline/index.js b/src/components/CowCard/Bloodline/index.js index 5f5571a43..8c523db30 100644 --- a/src/components/CowCard/Bloodline/index.js +++ b/src/components/CowCard/Bloodline/index.js @@ -1 +1 @@ -export { default } from './Bloodline' +export { default } from './Bloodline.js' diff --git a/src/components/CowCard/CowCard.js b/src/components/CowCard/CowCard.js index 89ce5d2ab..748bc16ef 100644 --- a/src/components/CowCard/CowCard.js +++ b/src/components/CowCard/CowCard.js @@ -6,21 +6,21 @@ import React, { useEffect, useRef, useState } from 'react' import { array, bool, func, number, object, string } from 'prop-types' -import Button from '@mui/material/Button' -import Card from '@mui/material/Card' -import CardActions from '@mui/material/CardActions' -import CardHeader from '@mui/material/CardHeader' -import TextField from '@mui/material/TextField' -import Tooltip from '@mui/material/Tooltip' -import Typography from '@mui/material/Typography' +import Button from '@mui/material/Button/index.js' +import Card from '@mui/material/Card/index.js' +import CardActions from '@mui/material/CardActions/index.js' +import CardHeader from '@mui/material/CardHeader/index.js' +import TextField from '@mui/material/TextField/index.js' +import Tooltip from '@mui/material/Tooltip/index.js' +import Typography from '@mui/material/Typography/index.js' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import classNames from 'classnames' import { faMars, faVenus } from '@fortawesome/free-solid-svg-icons' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' -import { pixel } from '../../img' -import { genders } from '../../enums' +import { pixel } from '../../img/index.js' +import { genders } from '../../enums.js' import { areHuggingMachinesInInventory, getCowDisplayName, @@ -28,12 +28,15 @@ import { getCowValue, isCowInBreedingPen, isInViewport, -} from '../../utils' -import { PURCHASEABLE_COW_PENS } from '../../constants' -import { OFFER_COW_FOR_TRADE, WITHDRAW_COW_FROM_TRADE } from '../../templates' -import { useMountState } from '../../hooks/useMountState' +} from '../../utils/index.js' +import { PURCHASEABLE_COW_PENS } from '../../constants.js' +import { + OFFER_COW_FOR_TRADE, + WITHDRAW_COW_FROM_TRADE, +} from '../../templates.js' +import { useMountState } from '../../hooks/useMountState/index.js' -import Subheader from './Subheader' +import Subheader from './Subheader/index.js' import './CowCard.sass' diff --git a/src/components/CowCard/CowCard.test.js b/src/components/CowCard/CowCard.test.js index 9aef44ce8..e7e85e4f1 100644 --- a/src/components/CowCard/CowCard.test.js +++ b/src/components/CowCard/CowCard.test.js @@ -1,12 +1,12 @@ import React from 'react' import { render, screen } from '@testing-library/react' -import { generateCow } from '../../utils' -import { noop } from '../../utils/noop' -import { PURCHASEABLE_COW_PENS } from '../../constants' -import { cowColors, genders } from '../../enums' +import { generateCow } from '../../utils/index.js' +import { noop } from '../../utils/noop.js' +import { PURCHASEABLE_COW_PENS } from '../../constants.js' +import { cowColors, genders } from '../../enums.js' -import { CowCard } from './CowCard' +import { CowCard } from './CowCard.js' describe('CowCard', () => { const cow = generateCow({ diff --git a/src/components/CowCard/Subheader/Subheader.js b/src/components/CowCard/Subheader/Subheader.js index 4827f6937..96a4dfa93 100644 --- a/src/components/CowCard/Subheader/Subheader.js +++ b/src/components/CowCard/Subheader/Subheader.js @@ -3,28 +3,28 @@ /** @typedef {import('../CowCard').CowCardProps} CowCardProps */ import React from 'react' import { array, bool, func, object, string } from 'prop-types' -import Checkbox from '@mui/material/Checkbox' -import FormControlLabel from '@mui/material/FormControlLabel' -import Tooltip from '@mui/material/Tooltip' -import Typography from '@mui/material/Typography' +import Checkbox from '@mui/material/Checkbox/index.js' +import FormControlLabel from '@mui/material/FormControlLabel/index.js' +import Tooltip from '@mui/material/Tooltip/index.js' +import Typography from '@mui/material/Typography/index.js' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import classNames from 'classnames' import { faHeart as faFullHeart } from '@fortawesome/free-solid-svg-icons' import { faHeart as faEmptyHeart } from '@fortawesome/free-regular-svg-icons' -import { COW_COLOR_NAMES } from '../../../strings' -import { genders } from '../../../enums' -import { moneyString } from '../../../utils/moneyString' +import { COW_COLOR_NAMES } from '../../../strings.js' +import { genders } from '../../../enums.js' +import { moneyString } from '../../../utils/moneyString.js' import { getCowWeight, getPlayerName, integerString, isCowInBreedingPen, nullArray, -} from '../../../utils' -import { memoize } from '../../../utils/memoize' -import { huggingMachine } from '../../../data/items' -import Bloodline from '../Bloodline' +} from '../../../utils/index.js' +import { memoize } from '../../../utils/memoize.js' +import { huggingMachine } from '../../../data/items.js' +import Bloodline from '../Bloodline/index.js' import './Subheader.sass' diff --git a/src/components/CowCard/Subheader/Subheader.test.js b/src/components/CowCard/Subheader/Subheader.test.js index 35043f6e4..fedd3649d 100644 --- a/src/components/CowCard/Subheader/Subheader.test.js +++ b/src/components/CowCard/Subheader/Subheader.test.js @@ -1,10 +1,10 @@ import React from 'react' import { render, screen } from '@testing-library/react' -import { getCowStub } from '../../../test-utils/stubs/cowStub' -import { moneyString } from '../../../utils/moneyString' +import { getCowStub } from '../../../test-utils/stubs/cowStub.js' +import { moneyString } from '../../../utils/moneyString.js' -import Subheader from './Subheader' +import Subheader from './Subheader.js' const COW_VALUE = 1000 diff --git a/src/components/CowCard/Subheader/index.js b/src/components/CowCard/Subheader/index.js index 9a8bd6a94..b9fb673d2 100644 --- a/src/components/CowCard/Subheader/index.js +++ b/src/components/CowCard/Subheader/index.js @@ -1 +1 @@ -export { default } from './Subheader' +export { default } from './Subheader.js' diff --git a/src/components/CowCard/index.js b/src/components/CowCard/index.js index a176f2669..eb8a3e340 100644 --- a/src/components/CowCard/index.js +++ b/src/components/CowCard/index.js @@ -1 +1 @@ -export { default } from './CowCard' +export { default } from './CowCard.js' diff --git a/src/components/CowPen/CowPen.js b/src/components/CowPen/CowPen.js index 4d5f31730..c29fbd998 100644 --- a/src/components/CowPen/CowPen.js +++ b/src/components/CowPen/CowPen.js @@ -2,19 +2,19 @@ import React, { Component, useEffect } from 'react' import { array, bool, func, object, string } from 'prop-types' import classNames from 'classnames' import { Tweenable } from 'shifty' -import Tooltip from '@mui/material/Tooltip' -import Typography from '@mui/material/Typography' +import Tooltip from '@mui/material/Tooltip/index.js' +import Typography from '@mui/material/Typography/index.js' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faHeart } from '@fortawesome/free-solid-svg-icons' -import { LEFT, RIGHT } from '../../constants' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { pixel } from '../../img' +import { LEFT, RIGHT } from '../../constants.js' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { pixel } from '../../img/index.js' -import { getCowDisplayName, getCowImage } from '../../utils' +import { getCowDisplayName, getCowImage } from '../../utils/index.js' import './CowPen.sass' -import { random } from '../../common/utils' +import { random } from '../../common/utils.js' // Only moves the cow within the middle 80% of the pen const randomPosition = () => 10 + random() * 80 diff --git a/src/components/CowPen/CowPen.test.js b/src/components/CowPen/CowPen.test.js index 00bec45f2..16d6cf761 100644 --- a/src/components/CowPen/CowPen.test.js +++ b/src/components/CowPen/CowPen.test.js @@ -1,12 +1,12 @@ import React from 'react' import { shallow } from 'enzyme' -import { generateCow } from '../../utils' -import { cowColors } from '../../enums' -import { pixel } from '../../img' -import { noop } from '../../utils/noop' +import { generateCow } from '../../utils/index.js' +import { cowColors } from '../../enums.js' +import { pixel } from '../../img/index.js' +import { noop } from '../../utils/noop.js' -import { Cow } from './CowPen' +import { Cow } from './CowPen.js' let component diff --git a/src/components/CowPen/index.js b/src/components/CowPen/index.js index 89d8190fa..c78603502 100644 --- a/src/components/CowPen/index.js +++ b/src/components/CowPen/index.js @@ -1 +1 @@ -export { default } from './CowPen' +export { default } from './CowPen.js' diff --git a/src/components/CowPenContextMenu/CowPenContextMenu.js b/src/components/CowPenContextMenu/CowPenContextMenu.js index ca542e735..53add0ba1 100644 --- a/src/components/CowPenContextMenu/CowPenContextMenu.js +++ b/src/components/CowPenContextMenu/CowPenContextMenu.js @@ -1,30 +1,30 @@ import React, { useState } from 'react' import { array, func, number, object, string } from 'prop-types' -import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward' -import ArrowUpwardIcon from '@mui/icons-material/ArrowUpward' -import Fab from '@mui/material/Fab' -import MenuItem from '@mui/material/MenuItem' -import Select from '@mui/material/Select' -import Tab from '@mui/material/Tab' -import Tabs from '@mui/material/Tabs' +import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward.js' +import ArrowUpwardIcon from '@mui/icons-material/ArrowUpward.js' +import Fab from '@mui/material/Fab/index.js' +import MenuItem from '@mui/material/MenuItem/index.js' +import Select from '@mui/material/Select/index.js' +import Tab from '@mui/material/Tab/index.js' +import Tabs from '@mui/material/Tabs/index.js' import sortBy from 'lodash.sortby' -import Item from '../Item' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { enumify } from '../../enums' +import Item from '../Item/index.js' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { enumify } from '../../enums.js' import { findCowById, getCowSellValue, getCowWeight, isCowInBreedingPen, nullArray, -} from '../../utils' -import { PURCHASEABLE_COW_PENS } from '../../constants' -import cowShopInventory from '../../data/shop-inventory-cow' +} from '../../utils/index.js' +import { PURCHASEABLE_COW_PENS } from '../../constants.js' +import cowShopInventory from '../../data/shop-inventory-cow.js' -import CowCard from '../CowCard' +import CowCard from '../CowCard/index.js' -import { TabPanel, a11yProps } from './TabPanel' +import { TabPanel, a11yProps } from './TabPanel/index.js' import './CowPenContextMenu.sass' diff --git a/src/components/CowPenContextMenu/CowPenContextMenu.test.js b/src/components/CowPenContextMenu/CowPenContextMenu.test.js index 255f4fe83..7764aca9a 100644 --- a/src/components/CowPenContextMenu/CowPenContextMenu.test.js +++ b/src/components/CowPenContextMenu/CowPenContextMenu.test.js @@ -1,10 +1,10 @@ import React from 'react' import { render, screen } from '@testing-library/react' -import { generateCow } from '../../utils' -import { noop } from '../../utils/noop' +import { generateCow } from '../../utils/index.js' +import { noop } from '../../utils/noop.js' -import { CowPenContextMenu } from './CowPenContextMenu' +import { CowPenContextMenu } from './CowPenContextMenu.js' vitest.mock('../CowCard', () => ({ __esModule: true, diff --git a/src/components/CowPenContextMenu/index.js b/src/components/CowPenContextMenu/index.js index 6b619b2d9..18bb2e299 100644 --- a/src/components/CowPenContextMenu/index.js +++ b/src/components/CowPenContextMenu/index.js @@ -1 +1 @@ -export { default } from './CowPenContextMenu' +export { default } from './CowPenContextMenu.js' diff --git a/src/components/DebugMenu/DebugMenu.js b/src/components/DebugMenu/DebugMenu.js index ad0f75e42..ac524290b 100644 --- a/src/components/DebugMenu/DebugMenu.js +++ b/src/components/DebugMenu/DebugMenu.js @@ -1,13 +1,13 @@ import React from 'react' import { func } from 'prop-types' -import Accordion from '@mui/material/Accordion' -import AccordionSummary from '@mui/material/AccordionSummary' -import AccordionDetails from '@mui/material/AccordionDetails' -import Button from '@mui/material/Button' +import Accordion from '@mui/material/Accordion/index.js' +import AccordionSummary from '@mui/material/AccordionSummary/index.js' +import AccordionDetails from '@mui/material/AccordionDetails/index.js' +import Button from '@mui/material/Button/index.js' -import { carrot } from '../../data/items' +import { carrot } from '../../data/items.js' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' import './DebugMenu.sass' diff --git a/src/components/DebugMenu/DebugMenu.test.js b/src/components/DebugMenu/DebugMenu.test.js index 3d23e6225..332109627 100644 --- a/src/components/DebugMenu/DebugMenu.test.js +++ b/src/components/DebugMenu/DebugMenu.test.js @@ -1,9 +1,9 @@ import React from 'react' import { shallow } from 'enzyme' -import { noop } from '../../utils/noop' +import { noop } from '../../utils/noop.js' -import { DebugMenu } from './DebugMenu' +import { DebugMenu } from './DebugMenu.js' let component diff --git a/src/components/DebugMenu/index.js b/src/components/DebugMenu/index.js index 4a9e67f0a..044c81eca 100644 --- a/src/components/DebugMenu/index.js +++ b/src/components/DebugMenu/index.js @@ -1 +1 @@ -export { default } from './DebugMenu' +export { default } from './DebugMenu.js' diff --git a/src/components/Elements/index.js b/src/components/Elements/index.js index 729922f25..cd7c66444 100644 --- a/src/components/Elements/index.js +++ b/src/components/Elements/index.js @@ -1,4 +1,4 @@ -import styled from '@mui/material/styles/styled' +import styled from '@mui/material/styles/styled.js' // NOTE: Elements in this file are intended to make standard DOM elements easy // to style with MUI's sx prop. diff --git a/src/components/Farmhand/Farmhand.context.js b/src/components/Farmhand/Farmhand.context.js index 87986b748..2e3701d0f 100644 --- a/src/components/Farmhand/Farmhand.context.js +++ b/src/components/Farmhand/Farmhand.context.js @@ -1,12 +1,12 @@ /** * @typedef {import('../../').farmhand.item} farmhand.item * @typedef {import('../../').farmhand.levelEntitlements} farmhand.levelEntitlements - * @typedef {import('./Farmhand').farmhand.state} farmhand.state + * @typedef {import('./Farmhand.js').farmhand.state} farmhand.state */ import { createContext } from 'react' // eslint-disable-next-line no-unused-vars -import uiEventHandlers from '../../handlers/ui-events' +import uiEventHandlers from '../../handlers/ui-events.js' /** * @type {import('react').Context<{ diff --git a/src/components/Farmhand/Farmhand.js b/src/components/Farmhand/Farmhand.js index 45bd74d03..d2a41822b 100644 --- a/src/components/Farmhand/Farmhand.js +++ b/src/components/Farmhand/Farmhand.js @@ -17,20 +17,23 @@ * @typedef {import("../../enums").stageFocusType} farmhand.stageFocusType */ import React from 'react' -import window from 'global/window' +import window from 'global/window.js' import { Redirect } from 'react-router-dom' import { GlobalHotKeys } from 'react-hotkeys' import localforage from 'localforage' import { v4 as uuid } from 'uuid' -import { ThemeProvider, StyledEngineProvider } from '@mui/material/styles' -import Drawer from '@mui/material/Drawer' -import Fab from '@mui/material/Fab' -import MenuIcon from '@mui/icons-material/Menu' -import HotelIcon from '@mui/icons-material/Hotel' -import KeyboardArrowLeft from '@mui/icons-material/KeyboardArrowLeft' -import KeyboardArrowRight from '@mui/icons-material/KeyboardArrowRight' -import Tooltip from '@mui/material/Tooltip' -import MobileStepper from '@mui/material/MobileStepper' +import { + ThemeProvider, + StyledEngineProvider, +} from '@mui/material/styles/index.js' +import Drawer from '@mui/material/Drawer/index.js' +import Fab from '@mui/material/Fab/index.js' +import MenuIcon from '@mui/icons-material/Menu.js' +import HotelIcon from '@mui/icons-material/Hotel.js' +import KeyboardArrowLeft from '@mui/icons-material/KeyboardArrowLeft.js' +import KeyboardArrowRight from '@mui/icons-material/KeyboardArrowRight.js' +import Tooltip from '@mui/material/Tooltip/index.js' +import MobileStepper from '@mui/material/MobileStepper/index.js' import { joinRoom } from 'trystero' import { SnackbarProvider } from 'notistack' import debounce from 'lodash.debounce' @@ -38,28 +41,28 @@ import throttle from 'lodash.throttle' import classNames from 'classnames' import { object } from 'prop-types' -import eventHandlers from '../../handlers/ui-events' +import eventHandlers from '../../handlers/ui-events.js' import { handlePeerMetadataRequest, handleCowTradeRequest, handleCowTradeRequestAccept, handleCowTradeRequestReject, -} from '../../handlers/peer-events' -import * as reducers from '../../game-logic/reducers' +} from '../../handlers/peer-events.js' +import * as reducers from '../../game-logic/reducers/index.js' // This must be imported here so that it can be overridden by component styles. import './Farmhand.sass' -import AppBar from '../AppBar' -import Navigation from '../Navigation' -import ContextPane from '../ContextPane' -import Stage from '../Stage' +import AppBar from '../AppBar/index.js' +import Navigation from '../Navigation/index.js' +import ContextPane from '../ContextPane/index.js' +import Stage from '../Stage/index.js' import NotificationSystem, { snackbarProviderContentCallback, -} from '../NotificationSystem' -import DebugMenu from '../DebugMenu' -import UpdateNotifier from '../UpdateNotifier' -import theme from '../../mui-theme' -import { levelAchieved } from '../../utils/levelAchieved' +} from '../NotificationSystem/index.js' +import DebugMenu from '../DebugMenu/index.js' +import UpdateNotifier from '../UpdateNotifier/index.js' +import theme from '../../mui-theme.js' +import { levelAchieved } from '../../utils/levelAchieved.js' import { computeMarketPositions, createNewField, @@ -75,19 +78,19 @@ import { reduceByPersistedKeys, sleep, transformStateDataForImport, -} from '../../utils' -import { noop } from '../../utils/noop' -import { getLevelEntitlements } from '../../utils/getLevelEntitlements' -import { memoize } from '../../utils/memoize' -import { getData, postData } from '../../fetch-utils' -import { itemsMap, recipesMap } from '../../data/maps' +} from '../../utils/index.js' +import { noop } from '../../utils/noop.js' +import { getLevelEntitlements } from '../../utils/getLevelEntitlements.js' +import { memoize } from '../../utils/memoize.js' +import { getData, postData } from '../../fetch-utils.js' +import { itemsMap, recipesMap } from '../../data/maps.js' import { dialogView, fieldMode, stageFocusType, toolLevel, toolType, -} from '../../enums' +} from '../../enums.js' import { COW_TRADE_TIMEOUT, DEFAULT_ROOM, @@ -97,14 +100,14 @@ import { STANDARD_LOAN_AMOUNT, Z_INDEX, STANDARD_VIEW_LIST, -} from '../../constants' +} from '../../constants.js' import { CONNECTED_TO_ROOM, LOAN_INCREASED, POSITIONS_POSTED_NOTIFICATION, RECIPE_LEARNED, RECIPES_LEARNED, -} from '../../templates' +} from '../../templates.js' import { CONNECTING_TO_SERVER, COW_ALREADY_OWNED, @@ -114,16 +117,16 @@ import { PROGRESS_SAVED_MESSAGE, REQUESTED_COW_TRADE_UNAVAILABLE, SERVER_ERROR, -} from '../../strings' -import { endpoints, features, rtcConfig, trackerUrls } from '../../config' +} from '../../strings.js' +import { endpoints, features, rtcConfig, trackerUrls } from '../../config.js' -import { scarecrow } from '../../data/items' +import { scarecrow } from '../../data/items.js' -import { ChatRoom } from '../ChatRoom' +import { ChatRoom } from '../ChatRoom/index.js' -import { getInventoryQuantities } from './helpers/getInventoryQuantities' -import FarmhandContext from './Farmhand.context' -import { FarmhandReducers } from './FarmhandReducers' +import { getInventoryQuantities } from './helpers/getInventoryQuantities.js' +import FarmhandContext from './Farmhand.context.js' +import { FarmhandReducers } from './FarmhandReducers.js' const { CLEANUP, HARVEST, MINE, OBSERVE, WATER, PLANT } = fieldMode diff --git a/src/components/Farmhand/Farmhand.test.js b/src/components/Farmhand/Farmhand.test.js index eb97109bf..93795abab 100644 --- a/src/components/Farmhand/Farmhand.test.js +++ b/src/components/Farmhand/Farmhand.test.js @@ -2,16 +2,16 @@ import { sampleItem1, sampleFieldTool1, sampleCropSeedsItem1, -} from '../../data/items' +} from '../../data/items.js' import { computePlayerInventory, getFieldToolInventory, getPlantableCropInventory, -} from './Farmhand' +} from './Farmhand.js' -vitest.mock('../../data/maps') -vitest.mock('../../data/items') +vitest.mock('../../data/maps.js') +vitest.mock('../../data/items.js') describe('private helpers', () => { describe('computePlayerInventory', () => { diff --git a/src/components/Farmhand/FarmhandReducers.js b/src/components/Farmhand/FarmhandReducers.js index a4c858e9a..5c3c374c8 100644 --- a/src/components/Farmhand/FarmhandReducers.js +++ b/src/components/Farmhand/FarmhandReducers.js @@ -1,8 +1,8 @@ -/** @typedef {typeof import('./Farmhand').default.defaultProps} farmhand.props */ -/** @typedef {import('./Farmhand').farmhand.state} farmhand.state */ +/** @typedef {typeof import('./Farmhand.js').default.defaultProps} farmhand.props */ +/** @typedef {import('./Farmhand.js').farmhand.state} farmhand.state */ import { Component } from 'react' -import * as reducers from '../../game-logic/reducers' +import * as reducers from '../../game-logic/reducers/index.js' /** * @callback BoundReducer diff --git a/src/components/Farmhand/helpers/getInventoryQuantities.js b/src/components/Farmhand/helpers/getInventoryQuantities.js index fe99cd995..9242b59a0 100644 --- a/src/components/Farmhand/helpers/getInventoryQuantities.js +++ b/src/components/Farmhand/helpers/getInventoryQuantities.js @@ -1,7 +1,7 @@ /** * @typedef {import('../../../').farmhand.item} farmhand.item */ -import { itemsMap } from '../../../data/maps' +import { itemsMap } from '../../../data/maps.js' const itemIds = Object.keys(itemsMap) diff --git a/src/components/Farmhand/helpers/getInventoryQuantities.test.js b/src/components/Farmhand/helpers/getInventoryQuantities.test.js index ef7cbaf7a..21f337452 100644 --- a/src/components/Farmhand/helpers/getInventoryQuantities.test.js +++ b/src/components/Farmhand/helpers/getInventoryQuantities.test.js @@ -1,8 +1,8 @@ -import { testItem } from '../../../test-utils' +import { testItem } from '../../../test-utils/index.js' -import { getInventoryQuantities } from './getInventoryQuantities' +import { getInventoryQuantities } from './getInventoryQuantities.js' -vitest.mock('../../../data/maps') +vitest.mock('../../../data/maps.js') describe('playerInventoryQuantities', () => { test('computes a map of item IDs to their quantity in the inventory', () => { diff --git a/src/components/Farmhand/index.js b/src/components/Farmhand/index.js index efb7fca35..76f8705ca 100644 --- a/src/components/Farmhand/index.js +++ b/src/components/Farmhand/index.js @@ -1 +1 @@ -export { default } from './Farmhand' +export { default } from './Farmhand.js' diff --git a/src/components/FermentationRecipeList/FermentationRecipe.js b/src/components/FermentationRecipeList/FermentationRecipe.js index c97661bd6..d2feb6cbf 100644 --- a/src/components/FermentationRecipeList/FermentationRecipe.js +++ b/src/components/FermentationRecipeList/FermentationRecipe.js @@ -5,23 +5,23 @@ import React, { useContext, useEffect, useState } from 'react' import { object } from 'prop-types' -import Card from '@mui/material/Card' -import CardHeader from '@mui/material/CardHeader' -import CardActions from '@mui/material/CardActions' -import Button from '@mui/material/Button' +import Card from '@mui/material/Card/index.js' +import CardHeader from '@mui/material/CardHeader/index.js' +import CardActions from '@mui/material/CardActions/index.js' +import Button from '@mui/material/Button/index.js' -import { PURCHASEABLE_CELLARS } from '../../constants' -import { items } from '../../img' -import { getMaxYieldOfFermentationRecipe } from '../../utils/getMaxYieldOfFermentationRecipe' -import { getSaltRequirementsForFermentationRecipe } from '../../utils/getSaltRequirementsForFermentationRecipe' -import { FERMENTED_CROP_NAME } from '../../templates' -import QuantityInput from '../QuantityInput' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { itemsMap } from '../../data/maps' -import { cellarService } from '../../services/cellar' -import { getInventoryQuantityMap } from '../../utils/getInventoryQuantityMap' -import { integerString } from '../../utils' -import AnimatedNumber from '../AnimatedNumber' +import { PURCHASEABLE_CELLARS } from '../../constants.js' +import { items } from '../../img/index.js' +import { getMaxYieldOfFermentationRecipe } from '../../utils/getMaxYieldOfFermentationRecipe.js' +import { getSaltRequirementsForFermentationRecipe } from '../../utils/getSaltRequirementsForFermentationRecipe.js' +import { FERMENTED_CROP_NAME } from '../../templates.js' +import QuantityInput from '../QuantityInput/index.js' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { itemsMap } from '../../data/maps.js' +import { cellarService } from '../../services/cellar.js' +import { getInventoryQuantityMap } from '../../utils/getInventoryQuantityMap.js' +import { integerString } from '../../utils/index.js' +import AnimatedNumber from '../AnimatedNumber/index.js' import './FermentationRecipe.sass' diff --git a/src/components/FermentationRecipeList/FermentationRecipeList.js b/src/components/FermentationRecipeList/FermentationRecipeList.js index 37455ff43..0e2ea856f 100644 --- a/src/components/FermentationRecipeList/FermentationRecipeList.js +++ b/src/components/FermentationRecipeList/FermentationRecipeList.js @@ -1,10 +1,10 @@ import React, { useContext } from 'react' -import { fermentableItemsMap } from '../../data/maps' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { getCropsAvailableToFerment } from '../../utils/getCropsAvailableToFerment' +import { fermentableItemsMap } from '../../data/maps.js' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { getCropsAvailableToFerment } from '../../utils/getCropsAvailableToFerment.js' -import { FermentationRecipe } from './FermentationRecipe' +import { FermentationRecipe } from './FermentationRecipe.js' const totalFermentableItems = Object.keys(fermentableItemsMap).length diff --git a/src/components/FermentationRecipeList/FermentationRecipeList.test.js b/src/components/FermentationRecipeList/FermentationRecipeList.test.js index 956d67be8..0dd4d5072 100644 --- a/src/components/FermentationRecipeList/FermentationRecipeList.test.js +++ b/src/components/FermentationRecipeList/FermentationRecipeList.test.js @@ -5,16 +5,16 @@ import React from 'react' import { screen } from '@testing-library/dom' import { render } from '@testing-library/react' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { getLevelEntitlements } from '../../utils/getLevelEntitlements' -import { getCropsAvailableToFerment } from '../../utils/getCropsAvailableToFerment' -import { fermentableItemsMap } from '../../data/maps' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { getLevelEntitlements } from '../../utils/getLevelEntitlements.js' +import { getCropsAvailableToFerment } from '../../utils/getCropsAvailableToFerment.js' +import { fermentableItemsMap } from '../../data/maps.js' -import { FermentationRecipeList } from './FermentationRecipeList' +import { FermentationRecipeList } from './FermentationRecipeList.js' const totalFermentableItems = Object.keys(fermentableItemsMap).length -vitest.mock('./FermentationRecipe', () => ({ +vitest.mock('./FermentationRecipe.js', () => ({ FermentationRecipe: () => <>, })) diff --git a/src/components/Field/Field.js b/src/components/Field/Field.js index ded931e2a..089cf71b7 100644 --- a/src/components/Field/Field.js +++ b/src/components/Field/Field.js @@ -1,27 +1,27 @@ import React, { memo, useEffect, useState } from 'react' import { array, bool, element, func, number, object, string } from 'prop-types' -import Fab from '@mui/material/Fab' -import FormControl from '@mui/material/FormControl' -import FormControlLabel from '@mui/material/FormControlLabel' -import FormGroup from '@mui/material/FormGroup' -import Switch from '@mui/material/Switch' -import Slider from '@mui/material/Slider' -import ZoomInIcon from '@mui/icons-material/ZoomIn' -import ZoomOutIcon from '@mui/icons-material/ZoomOut' -import Tooltip from '@mui/material/Tooltip' -import Typography from '@mui/material/Typography' +import Fab from '@mui/material/Fab/index.js' +import FormControl from '@mui/material/FormControl/index.js' +import FormControlLabel from '@mui/material/FormControlLabel/index.js' +import FormGroup from '@mui/material/FormGroup/index.js' +import Switch from '@mui/material/Switch/index.js' +import Slider from '@mui/material/Slider/index.js' +import ZoomInIcon from '@mui/icons-material/ZoomIn.js' +import ZoomOutIcon from '@mui/icons-material/ZoomOut.js' +import Tooltip from '@mui/material/Tooltip/index.js' +import Typography from '@mui/material/Typography/index.js' import { TransformWrapper, TransformComponent } from 'react-zoom-pan-pinch' import { GlobalHotKeys } from 'react-hotkeys' import classNames from 'classnames' -import FarmhandContext from '../Farmhand/Farmhand.context' -import Plot from '../Plot' -import QuickSelect from '../QuickSelect' -import { fieldMode } from '../../enums' -import tools from '../../data/tools' -import { levelAchieved } from '../../utils/levelAchieved' -import { doesInventorySpaceRemain, nullArray } from '../../utils' -import { getLevelEntitlements } from '../../utils/getLevelEntitlements' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import Plot from '../Plot/index.js' +import QuickSelect from '../QuickSelect/index.js' +import { fieldMode } from '../../enums.js' +import tools from '../../data/tools.js' +import { levelAchieved } from '../../utils/levelAchieved.js' +import { doesInventorySpaceRemain, nullArray } from '../../utils/index.js' +import { getLevelEntitlements } from '../../utils/getLevelEntitlements.js' import './Field.sass' diff --git a/src/components/Field/Field.test.js b/src/components/Field/Field.test.js index b05f7b82e..f0fe7c48a 100644 --- a/src/components/Field/Field.test.js +++ b/src/components/Field/Field.test.js @@ -1,19 +1,19 @@ import React from 'react' import { shallow } from 'enzyme' -import { fieldMode } from '../../enums' -import { testItem } from '../../test-utils' +import { fieldMode } from '../../enums.js' +import { testItem } from '../../test-utils/index.js' -import { INFINITE_STORAGE_LIMIT } from '../../constants' -import { noop } from '../../utils/noop' +import { INFINITE_STORAGE_LIMIT } from '../../constants.js' +import { noop } from '../../utils/noop.js' -import { Field, FieldContent, isInHoverRange, MemoPlot } from './Field' +import { Field, FieldContent, isInHoverRange, MemoPlot } from './Field.js' -vitest.mock('../../data/maps') -vitest.mock('../../data/items') -vitest.mock('../../data/levels', () => ({ levels: [] })) -vitest.mock('../../data/shop-inventory') -vitest.mock('../../img') +vitest.mock('../../data/maps.js') +vitest.mock('../../data/items.js') +vitest.mock('../../data/levels.js', () => ({ levels: [] })) +vitest.mock('../../data/shop-inventory.js') +vitest.mock('../../img/index.js') let component diff --git a/src/components/Field/index.js b/src/components/Field/index.js index 90f019ef3..baa59ce61 100644 --- a/src/components/Field/index.js +++ b/src/components/Field/index.js @@ -1 +1 @@ -export { default } from './Field' +export { default } from './Field.js' diff --git a/src/components/Forest/index.js b/src/components/Forest/index.js index f8db3e650..762bc06e4 100644 --- a/src/components/Forest/index.js +++ b/src/components/Forest/index.js @@ -1 +1 @@ -export { Forest } from './Forest' +export { Forest } from './Forest.js' diff --git a/src/components/Home/Home.js b/src/components/Home/Home.js index a937633b0..bef16a52f 100644 --- a/src/components/Home/Home.js +++ b/src/components/Home/Home.js @@ -2,27 +2,27 @@ import React from 'react' import { func, object } from 'prop-types' import ReactMarkdown from 'react-markdown' -import globalWindow from 'global/window' -import Button from '@mui/material/Button' -import Divider from '@mui/material/Divider' -import Accordion from '@mui/material/Accordion' -import AccordionSummary from '@mui/material/AccordionSummary' -import AccordionDetails from '@mui/material/AccordionDetails' -import ExpandMoreIcon from '@mui/icons-material/ExpandMore' -import Card from '@mui/material/Card' -import CardContent from '@mui/material/CardContent' - -import { items } from '../../img' - -import { achievementsMap } from '../../data/achievements' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { STANDARD_LOAN_AMOUNT } from '../../constants' -import { stageFocusType } from '../../enums' -import { isDecember } from '../../utils' -import { memoize } from '../../utils/memoize' -import Achievement from '../Achievement' - -import { SnowBackground } from './SnowBackground' +import globalWindow from 'global/window.js' +import Button from '@mui/material/Button/index.js' +import Divider from '@mui/material/Divider/index.js' +import Accordion from '@mui/material/Accordion/index.js' +import AccordionSummary from '@mui/material/AccordionSummary/index.js' +import AccordionDetails from '@mui/material/AccordionDetails/index.js' +import ExpandMoreIcon from '@mui/icons-material/ExpandMore.js' +import Card from '@mui/material/Card/index.js' +import CardContent from '@mui/material/CardContent/index.js' + +import { items } from '../../img/index.js' + +import { achievementsMap } from '../../data/achievements.js' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { STANDARD_LOAN_AMOUNT } from '../../constants.js' +import { stageFocusType } from '../../enums.js' +import { isDecember } from '../../utils/index.js' +import { memoize } from '../../utils/memoize.js' +import Achievement from '../Achievement/index.js' + +import { SnowBackground } from './SnowBackground.js' import './Home.sass' const onboardingAchievements = [ diff --git a/src/components/Home/Home.test.js b/src/components/Home/Home.test.js index 7bca45abe..e0e574c0c 100644 --- a/src/components/Home/Home.test.js +++ b/src/components/Home/Home.test.js @@ -3,9 +3,9 @@ import React from 'react' import { screen, render } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' -import Home from './Home' +import Home from './Home.js' describe('', () => { let handleViewChangeButtonClick diff --git a/src/components/Home/SnowBackground.js b/src/components/Home/SnowBackground.js index cea506ead..e5bcb32a2 100644 --- a/src/components/Home/SnowBackground.js +++ b/src/components/Home/SnowBackground.js @@ -1,8 +1,8 @@ import React from 'react' -import useWindowSize from 'react-use/lib/useWindowSize' +import useWindowSize from 'react-use/lib/useWindowSize.js' import Confetti from 'react-confetti' -import { random } from '../../common/utils' +import { random } from '../../common/utils.js' const randomInt = (min, max) => { return Math.floor(min + random() * (max - min + 1)) diff --git a/src/components/Home/index.js b/src/components/Home/index.js index 435f759b6..70db6b272 100644 --- a/src/components/Home/index.js +++ b/src/components/Home/index.js @@ -1 +1 @@ -export { default } from './Home' +export { default } from './Home.js' diff --git a/src/components/IngredientsList/IngredientsList.js b/src/components/IngredientsList/IngredientsList.js index 9c23fcfb5..417adb728 100644 --- a/src/components/IngredientsList/IngredientsList.js +++ b/src/components/IngredientsList/IngredientsList.js @@ -2,10 +2,10 @@ import React from 'react' import classNames from 'classnames' import { object, shape, string } from 'prop-types' -import { INGREDIENTS_LIST_ITEM } from '../../templates' +import { INGREDIENTS_LIST_ITEM } from '../../templates.js' -import { integerString } from '../../utils' -import { itemsMap } from '../../data/maps' +import { integerString } from '../../utils/index.js' +import { itemsMap } from '../../data/maps.js' export default function IngredientsList({ playerInventoryQuantities, diff --git a/src/components/IngredientsList/IngredientsList.test.js b/src/components/IngredientsList/IngredientsList.test.js index aa172469c..e6b2f08f6 100644 --- a/src/components/IngredientsList/IngredientsList.test.js +++ b/src/components/IngredientsList/IngredientsList.test.js @@ -1,7 +1,7 @@ import React from 'react' import { render, screen } from '@testing-library/react' -import IngredientsList from './IngredientsList' +import IngredientsList from './IngredientsList.js' describe('', () => { let ingredientsString = '' diff --git a/src/components/IngredientsList/index.js b/src/components/IngredientsList/index.js index 8306d08c8..013fbd6b1 100644 --- a/src/components/IngredientsList/index.js +++ b/src/components/IngredientsList/index.js @@ -1 +1 @@ -export { default } from './IngredientsList' +export { default } from './IngredientsList.js' diff --git a/src/components/Inventory/Inventory.js b/src/components/Inventory/Inventory.js index de6db9fe4..16bfc972a 100644 --- a/src/components/Inventory/Inventory.js +++ b/src/components/Inventory/Inventory.js @@ -1,12 +1,12 @@ import React, { Fragment } from 'react' import { array } from 'prop-types' -import Divider from '@mui/material/Divider' +import Divider from '@mui/material/Divider/index.js' -import FarmhandContext from '../Farmhand/Farmhand.context' -import Item from '../Item' -import { itemsMap } from '../../data/maps' -import { enumify, itemType } from '../../enums' -import { sortItems } from '../../utils' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import Item from '../Item/index.js' +import { itemsMap } from '../../data/maps.js' +import { enumify, itemType } from '../../enums.js' +import { sortItems } from '../../utils/index.js' const { COW_FEED, diff --git a/src/components/Inventory/Inventory.test.js b/src/components/Inventory/Inventory.test.js index 8bd082eb2..957c2e6cb 100644 --- a/src/components/Inventory/Inventory.test.js +++ b/src/components/Inventory/Inventory.test.js @@ -1,17 +1,17 @@ import React from 'react' import { shallow } from 'enzyme' -import Item from '../Item' -import { testItem } from '../../test-utils' -import { sortItems } from '../../utils' -import { carrot, carrotSeed, pumpkinSeed } from '../../data/crops' -import { carrotSoup } from '../../data/recipes' +import Item from '../Item/index.js' +import { testItem } from '../../test-utils/index.js' +import { sortItems } from '../../utils/index.js' +import { carrot, carrotSeed, pumpkinSeed } from '../../data/crops/index.js' +import { carrotSoup } from '../../data/recipes.js' import { Inventory, categoryIds, separateItemsIntoCategories, -} from './Inventory' +} from './Inventory.js' let component diff --git a/src/components/Inventory/index.js b/src/components/Inventory/index.js index 28fa6a4ea..7ae5dfa29 100644 --- a/src/components/Inventory/index.js +++ b/src/components/Inventory/index.js @@ -1 +1 @@ -export { default } from './Inventory' +export { default } from './Inventory.js' diff --git a/src/components/Item/Item.js b/src/components/Item/Item.js index b3ed3086f..6e14f4c93 100644 --- a/src/components/Item/Item.js +++ b/src/components/Item/Item.js @@ -1,23 +1,23 @@ import React, { useEffect, useState } from 'react' -import KeyboardArrowUp from '@mui/icons-material/KeyboardArrowUp' -import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown' -import Button from '@mui/material/Button' -import Box from '@mui/material/Box' -import Card from '@mui/material/Card' -import CardHeader from '@mui/material/CardHeader' -import CardContent from '@mui/material/CardContent' -import CardActions from '@mui/material/CardActions' -import Tooltip from '@mui/material/Tooltip' -import Typography from '@mui/material/Typography' +import KeyboardArrowUp from '@mui/icons-material/KeyboardArrowUp.js' +import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown.js' +import Button from '@mui/material/Button/index.js' +import Box from '@mui/material/Box/index.js' +import Card from '@mui/material/Card/index.js' +import CardHeader from '@mui/material/CardHeader/index.js' +import CardContent from '@mui/material/CardContent/index.js' +import CardActions from '@mui/material/CardActions/index.js' +import Tooltip from '@mui/material/Tooltip/index.js' +import Typography from '@mui/material/Typography/index.js' import { array, bool, func, number, object } from 'prop-types' import classNames from 'classnames' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { items } from '../../img' -import { itemsMap } from '../../data/maps' -import { itemIds as shopItemIds } from '../../data/shop-inventory' -import { noop } from '../../utils/noop' -import { moneyString } from '../../utils/moneyString' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { items } from '../../img/index.js' +import { itemsMap } from '../../data/maps.js' +import { itemIds as shopItemIds } from '../../data/shop-inventory.js' +import { noop } from '../../utils/noop.js' +import { moneyString } from '../../utils/moneyString.js' import { inventorySpaceRemaining, isItemSoldInShop, @@ -26,10 +26,10 @@ import { getResaleValue, getSalePriceMultiplier, integerString, -} from '../../utils' -import { getCropLifecycleDuration } from '../../utils/getCropLifecycleDuration' -import QuantityInput from '../QuantityInput' -import AnimatedNumber from '../AnimatedNumber' +} from '../../utils/index.js' +import { getCropLifecycleDuration } from '../../utils/getCropLifecycleDuration.js' +import QuantityInput from '../QuantityInput/index.js' +import AnimatedNumber from '../AnimatedNumber/index.js' import './Item.sass' diff --git a/src/components/Item/Item.test.js b/src/components/Item/Item.test.js index 915f46c58..b06d40d75 100644 --- a/src/components/Item/Item.test.js +++ b/src/components/Item/Item.test.js @@ -2,13 +2,13 @@ import React from 'react' import { render, screen, waitFor, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import { testItem } from '../../test-utils' +import { testItem } from '../../test-utils/index.js' -import { INFINITE_STORAGE_LIMIT } from '../../constants' +import { INFINITE_STORAGE_LIMIT } from '../../constants.js' -import { Item } from './Item' +import { Item } from './Item.js' -vitest.mock('../../data/maps') +vitest.mock('../../data/maps.js') describe('Item', () => { const baseProps = { diff --git a/src/components/Item/index.js b/src/components/Item/index.js index 748b336b1..66856a2f2 100644 --- a/src/components/Item/index.js +++ b/src/components/Item/index.js @@ -1 +1 @@ -export { default } from './Item' +export { default } from './Item.js' diff --git a/src/components/KeybindingsView/KeybindingsView.js b/src/components/KeybindingsView/KeybindingsView.js index 91da94aef..147be4807 100644 --- a/src/components/KeybindingsView/KeybindingsView.js +++ b/src/components/KeybindingsView/KeybindingsView.js @@ -1,10 +1,10 @@ import React from 'react' -import Paper from '@mui/material/Paper' -import Table from '@mui/material/Table' -import TableBody from '@mui/material/TableBody' -import TableCell from '@mui/material/TableCell' -import TableContainer from '@mui/material/TableContainer' -import TableRow from '@mui/material/TableRow' +import Paper from '@mui/material/Paper/index.js' +import Table from '@mui/material/Table/index.js' +import TableBody from '@mui/material/TableBody/index.js' +import TableCell from '@mui/material/TableCell/index.js' +import TableContainer from '@mui/material/TableContainer/index.js' +import TableRow from '@mui/material/TableRow/index.js' const ElevatedPaper = props => ( {props.children} diff --git a/src/components/KeybindingsView/KeybindingsView.test.js b/src/components/KeybindingsView/KeybindingsView.test.js index f0930462d..23e657a98 100644 --- a/src/components/KeybindingsView/KeybindingsView.test.js +++ b/src/components/KeybindingsView/KeybindingsView.test.js @@ -1,7 +1,7 @@ import React from 'react' import { shallow } from 'enzyme' -import KeybindingsView from './KeybindingsView' +import KeybindingsView from './KeybindingsView.js' let component diff --git a/src/components/KeybindingsView/index.js b/src/components/KeybindingsView/index.js index 2750bb42a..3b62570cb 100644 --- a/src/components/KeybindingsView/index.js +++ b/src/components/KeybindingsView/index.js @@ -1 +1 @@ -export { default } from './KeybindingsView' +export { default } from './KeybindingsView.js' diff --git a/src/components/LogView/LogView.js b/src/components/LogView/LogView.js index 85c789759..32500c7df 100644 --- a/src/components/LogView/LogView.js +++ b/src/components/LogView/LogView.js @@ -1,10 +1,10 @@ import React from 'react' import { array } from 'prop-types' -import Alert from '@mui/material/Alert' +import Alert from '@mui/material/Alert/index.js' import ReactMarkdown from 'react-markdown' -import Divider from '@mui/material/Divider' +import Divider from '@mui/material/Divider/index.js' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' import './LogView.sass' diff --git a/src/components/LogView/LogView.test.js b/src/components/LogView/LogView.test.js index e56acdd7d..08769bdc8 100644 --- a/src/components/LogView/LogView.test.js +++ b/src/components/LogView/LogView.test.js @@ -1,9 +1,9 @@ import React from 'react' import { shallow } from 'enzyme' -import Alert from '@mui/material/Alert' +import Alert from '@mui/material/Alert/index.js' import ReactMarkdown from 'react-markdown' -import { LogView } from './LogView' +import { LogView } from './LogView.js' let component diff --git a/src/components/LogView/index.js b/src/components/LogView/index.js index 1228b7671..b3d95ba99 100644 --- a/src/components/LogView/index.js +++ b/src/components/LogView/index.js @@ -1 +1 @@ -export { default } from './LogView' +export { default } from './LogView.js' diff --git a/src/components/Navigation/DayAndProgressContainer.js b/src/components/Navigation/DayAndProgressContainer.js index 48e27190e..4c452db67 100644 --- a/src/components/Navigation/DayAndProgressContainer.js +++ b/src/components/Navigation/DayAndProgressContainer.js @@ -1,19 +1,19 @@ import React from 'react' import { number, object } from 'prop-types' -import Box from '@mui/material/Box' -import CircularProgress from '@mui/material/CircularProgress' -import Tooltip from '@mui/material/Tooltip' +import Box from '@mui/material/Box/index.js' +import CircularProgress from '@mui/material/CircularProgress/index.js' +import Tooltip from '@mui/material/Tooltip/index.js' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' -import { levelAchieved } from '../../utils/levelAchieved' +import { levelAchieved } from '../../utils/levelAchieved.js' import { experienceNeededForLevel, integerString, scaleNumber, -} from '../../utils' -import { EXPERIENCE_GAUGE_TOOLTIP_LABEL } from '../../templates' +} from '../../utils/index.js' +import { EXPERIENCE_GAUGE_TOOLTIP_LABEL } from '../../templates.js' export function DayAndProgressContainer({ dayCount, experience, itemsSold }) { const currentLevel = levelAchieved(experience) diff --git a/src/components/Navigation/Navigation.js b/src/components/Navigation/Navigation.js index 7154971db..6a153b349 100644 --- a/src/components/Navigation/Navigation.js +++ b/src/components/Navigation/Navigation.js @@ -1,53 +1,53 @@ import React, { useState, useEffect } from 'react' import classNames from 'classnames' -import AccountBalanceIcon from '@mui/icons-material/AccountBalance' -import AssessmentIcon from '@mui/icons-material/Assessment' +import AccountBalanceIcon from '@mui/icons-material/AccountBalance.js' +import AssessmentIcon from '@mui/icons-material/Assessment.js' import BeenhereIcon from '@mui/icons-material/Beenhere.js' -import BookIcon from '@mui/icons-material/Book' -import Button from '@mui/material/Button' -import Dialog from '@mui/material/Dialog' -import DialogActions from '@mui/material/DialogActions' -import DialogContent from '@mui/material/DialogContent' -import DialogTitle from '@mui/material/DialogTitle' -import Fab from '@mui/material/Fab' -import FlashOnIcon from '@mui/icons-material/FlashOn' -import FormControl from '@mui/material/FormControl' -import FormControlLabel from '@mui/material/FormControlLabel' -import FormGroup from '@mui/material/FormGroup' -import MenuItem from '@mui/material/MenuItem' -import Select from '@mui/material/Select' -import SettingsIcon from '@mui/icons-material/Settings' -import Switch from '@mui/material/Switch' -import TextField from '@mui/material/TextField' -import Tooltip from '@mui/material/Tooltip' -import Typography from '@mui/material/Typography' +import BookIcon from '@mui/icons-material/Book.js' +import Button from '@mui/material/Button/index.js' +import Dialog from '@mui/material/Dialog/index.js' +import DialogActions from '@mui/material/DialogActions/index.js' +import DialogContent from '@mui/material/DialogContent/index.js' +import DialogTitle from '@mui/material/DialogTitle/index.js' +import Fab from '@mui/material/Fab/index.js' +import FlashOnIcon from '@mui/icons-material/FlashOn.js' +import FormControl from '@mui/material/FormControl/index.js' +import FormControlLabel from '@mui/material/FormControlLabel/index.js' +import FormGroup from '@mui/material/FormGroup/index.js' +import MenuItem from '@mui/material/MenuItem/index.js' +import Select from '@mui/material/Select/index.js' +import SettingsIcon from '@mui/icons-material/Settings.js' +import Switch from '@mui/material/Switch/index.js' +import TextField from '@mui/material/TextField/index.js' +import Tooltip from '@mui/material/Tooltip/index.js' +import Typography from '@mui/material/Typography/index.js' import { array, bool, func, number, string } from 'prop-types' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' import { doesInventorySpaceRemain, integerString, inventorySpaceConsumed, -} from '../../utils' -import { dialogView } from '../../enums' +} from '../../utils/index.js' +import { dialogView } from '../../enums.js' import { DEFAULT_ROOM, INFINITE_STORAGE_LIMIT, STAGE_TITLE_MAP, -} from '../../constants' -import { MAX_ROOM_NAME_LENGTH } from '../../common/constants' +} from '../../constants.js' +import { MAX_ROOM_NAME_LENGTH } from '../../common/constants.js' -import AccountingView from '../AccountingView' -import AchievementsView from '../AchievementsView' -import LogView from '../LogView' -import OnlinePeersView from '../OnlinePeersView' -import PriceEventView from '../PriceEventView' -import SettingsView from '../SettingsView' -import StatsView from '../StatsView' -import KeybindingsView from '../KeybindingsView' +import AccountingView from '../AccountingView/index.js' +import AchievementsView from '../AchievementsView/index.js' +import LogView from '../LogView/index.js' +import OnlinePeersView from '../OnlinePeersView/index.js' +import PriceEventView from '../PriceEventView/index.js' +import SettingsView from '../SettingsView/index.js' +import StatsView from '../StatsView/index.js' +import KeybindingsView from '../KeybindingsView/index.js' -import DayAndProgressContainer from './DayAndProgressContainer' +import DayAndProgressContainer from './DayAndProgressContainer.js' import './Navigation.sass' diff --git a/src/components/Navigation/Navigation.test.js b/src/components/Navigation/Navigation.test.js index 808fffefe..c7352c5ca 100644 --- a/src/components/Navigation/Navigation.test.js +++ b/src/components/Navigation/Navigation.test.js @@ -1,12 +1,12 @@ import React from 'react' import { shallow } from 'enzyme' -import MenuItem from '@mui/material/MenuItem' +import MenuItem from '@mui/material/MenuItem/index.js' -import { dialogView, stageFocusType } from '../../enums' -import { INFINITE_STORAGE_LIMIT } from '../../constants' -import { noop } from '../../utils/noop' +import { dialogView, stageFocusType } from '../../enums.js' +import { INFINITE_STORAGE_LIMIT } from '../../constants.js' +import { noop } from '../../utils/noop.js' -import { Navigation } from './Navigation' +import { Navigation } from './Navigation.js' let component diff --git a/src/components/Navigation/index.js b/src/components/Navigation/index.js index e09ebadfe..4bf86a9e8 100644 --- a/src/components/Navigation/index.js +++ b/src/components/Navigation/index.js @@ -1 +1 @@ -export { default } from './Navigation' +export { default } from './Navigation.js' diff --git a/src/components/NotificationSystem/NotificationSystem.js b/src/components/NotificationSystem/NotificationSystem.js index 97974b2b3..a50f1aeb7 100644 --- a/src/components/NotificationSystem/NotificationSystem.js +++ b/src/components/NotificationSystem/NotificationSystem.js @@ -1,11 +1,11 @@ import React, { useEffect } from 'react' import { func, shape, string } from 'prop-types' -import Alert from '@mui/material/Alert' +import Alert from '@mui/material/Alert/index.js' import ReactMarkdown from 'react-markdown' import { withSnackbar } from 'notistack' -import { NOTIFICATION_DURATION } from '../../constants' -import FarmhandContext from '../Farmhand/Farmhand.context' +import { NOTIFICATION_DURATION } from '../../constants.js' +import FarmhandContext from '../Farmhand/Farmhand.context.js' import './NotificationSystem.sass' export const snackbarProviderContentCallback = ( diff --git a/src/components/NotificationSystem/NotificationSystem.test.js b/src/components/NotificationSystem/NotificationSystem.test.js index 99c03d7b3..522e0311c 100644 --- a/src/components/NotificationSystem/NotificationSystem.test.js +++ b/src/components/NotificationSystem/NotificationSystem.test.js @@ -1,7 +1,7 @@ import React from 'react' import { shallow } from 'enzyme' -import { NotificationSystem } from './NotificationSystem' +import { NotificationSystem } from './NotificationSystem.js' let component diff --git a/src/components/NotificationSystem/index.js b/src/components/NotificationSystem/index.js index c128f2f8f..1cfb3208d 100644 --- a/src/components/NotificationSystem/index.js +++ b/src/components/NotificationSystem/index.js @@ -1 +1 @@ -export { default, snackbarProviderContentCallback } from './NotificationSystem' +export { default, snackbarProviderContentCallback } from './NotificationSystem.js' diff --git a/src/components/OnlinePeersView/OnlinePeer/OnlinePeer.js b/src/components/OnlinePeersView/OnlinePeer/OnlinePeer.js index 3809a688f..2a6f855b8 100644 --- a/src/components/OnlinePeersView/OnlinePeer/OnlinePeer.js +++ b/src/components/OnlinePeersView/OnlinePeer/OnlinePeer.js @@ -1,14 +1,14 @@ import React from 'react' import { number, object, shape, string } from 'prop-types' -import Card from '@mui/material/Card' -import CardContent from '@mui/material/CardContent' -import CardHeader from '@mui/material/CardHeader' +import Card from '@mui/material/Card/index.js' +import CardContent from '@mui/material/CardContent/index.js' +import CardHeader from '@mui/material/CardHeader/index.js' -import CowCard from '../../CowCard' +import CowCard from '../../CowCard/index.js' -import { moneyString } from '../../../utils/moneyString' -import { levelAchieved } from '../../../utils/levelAchieved' -import { getPlayerName, integerString } from '../../../utils' +import { moneyString } from '../../../utils/moneyString.js' +import { levelAchieved } from '../../../utils/levelAchieved.js' +import { getPlayerName, integerString } from '../../../utils/index.js' const OnlinePeer = ({ peer: { cowOfferedForTrade, dayCount, id, experience, money }, diff --git a/src/components/OnlinePeersView/OnlinePeer/OnlinePeer.test.js b/src/components/OnlinePeersView/OnlinePeer/OnlinePeer.test.js index 978ed5558..1ffb1e60e 100644 --- a/src/components/OnlinePeersView/OnlinePeer/OnlinePeer.test.js +++ b/src/components/OnlinePeersView/OnlinePeer/OnlinePeer.test.js @@ -1,7 +1,7 @@ import React from 'react' import { shallow } from 'enzyme' -import OnlinePeer from './OnlinePeer' +import OnlinePeer from './OnlinePeer.js' let component diff --git a/src/components/OnlinePeersView/OnlinePeer/index.js b/src/components/OnlinePeersView/OnlinePeer/index.js index b555cf975..4ee5f8c6a 100644 --- a/src/components/OnlinePeersView/OnlinePeer/index.js +++ b/src/components/OnlinePeersView/OnlinePeer/index.js @@ -1 +1 @@ -export { default } from './OnlinePeer' +export { default } from './OnlinePeer.js' diff --git a/src/components/OnlinePeersView/OnlinePeersView.js b/src/components/OnlinePeersView/OnlinePeersView.js index 93e784952..33e71e13b 100644 --- a/src/components/OnlinePeersView/OnlinePeersView.js +++ b/src/components/OnlinePeersView/OnlinePeersView.js @@ -1,21 +1,21 @@ import React from 'react' import ReactMarkdown from 'react-markdown' -import Alert from '@mui/material/Alert' -import Divider from '@mui/material/Divider' -import Card from '@mui/material/Card' -import CardContent from '@mui/material/CardContent' +import Alert from '@mui/material/Alert/index.js' +import Divider from '@mui/material/Divider/index.js' +import Card from '@mui/material/Card/index.js' +import CardContent from '@mui/material/CardContent/index.js' import sortBy from 'lodash.sortby' import { array, number, object, string } from 'prop-types' -import BailOutErrorBoundary from '../BailOutErrorBoundary' +import BailOutErrorBoundary from '../BailOutErrorBoundary/index.js' -import { levelAchieved } from '../../utils/levelAchieved' -import { getPlayerName } from '../../utils' -import FarmhandContext from '../Farmhand/Farmhand.context' +import { levelAchieved } from '../../utils/levelAchieved.js' +import { getPlayerName } from '../../utils/index.js' +import FarmhandContext from '../Farmhand/Farmhand.context.js' -import CowCard from '../CowCard' +import CowCard from '../CowCard/index.js' -import OnlinePeer from './OnlinePeer' +import OnlinePeer from './OnlinePeer/index.js' const OnlinePeersView = ({ activePlayers, diff --git a/src/components/OnlinePeersView/OnlinePeersView.test.js b/src/components/OnlinePeersView/OnlinePeersView.test.js index 8bfd3fa0c..3705aef52 100644 --- a/src/components/OnlinePeersView/OnlinePeersView.test.js +++ b/src/components/OnlinePeersView/OnlinePeersView.test.js @@ -1,7 +1,7 @@ import React from 'react' import { shallow } from 'enzyme' -import OnlinePeersView from './OnlinePeersView' +import OnlinePeersView from './OnlinePeersView.js' let component diff --git a/src/components/OnlinePeersView/index.js b/src/components/OnlinePeersView/index.js index 55b65f409..a83905607 100644 --- a/src/components/OnlinePeersView/index.js +++ b/src/components/OnlinePeersView/index.js @@ -1 +1 @@ -export { default } from './OnlinePeersView' +export { default } from './OnlinePeersView.js' diff --git a/src/components/Plot/Plot.js b/src/components/Plot/Plot.js index bbd03eb0a..124ca5cf9 100644 --- a/src/components/Plot/Plot.js +++ b/src/components/Plot/Plot.js @@ -3,22 +3,22 @@ import React, { useEffect, useState } from 'react' import { bool, func, number, object, string } from 'prop-types' -import Tooltip from '@mui/material/Tooltip' -import Typography from '@mui/material/Typography' +import Tooltip from '@mui/material/Tooltip/index.js' +import Typography from '@mui/material/Typography/index.js' import classNames from 'classnames' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { getCropLifeStage, getPlotContentType, getPlotImage } from '../../utils' -import { getCropLifecycleDuration } from '../../utils/getCropLifecycleDuration' -import { itemsMap, cropItemIdToSeedItemMap } from '../../data/maps' -import { pixel, plotStates } from '../../img' -import { cropLifeStage, fertilizerType, itemType } from '../../enums' -import { FERTILIZER_BONUS } from '../../constants' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { getCropLifeStage, getPlotContentType, getPlotImage } from '../../utils/index.js' +import { getCropLifecycleDuration } from '../../utils/getCropLifecycleDuration.js' +import { itemsMap, cropItemIdToSeedItemMap } from '../../data/maps.js' +import { pixel, plotStates } from '../../img/index.js' +import { cropLifeStage, fertilizerType, itemType } from '../../enums.js' +import { FERTILIZER_BONUS } from '../../constants.js' -import { SHOVELED } from '../../strings' +import { SHOVELED } from '../../strings.js' import './Plot.sass' -import { SHOVELED_PLOT } from '../../templates' +import { SHOVELED_PLOT } from '../../templates.js' /** * @param {farmhand.plotContent?} plotContent diff --git a/src/components/Plot/Plot.rtl.test.js b/src/components/Plot/Plot.rtl.test.js index 389ab786a..7ccff6efc 100644 --- a/src/components/Plot/Plot.rtl.test.js +++ b/src/components/Plot/Plot.rtl.test.js @@ -2,15 +2,15 @@ import React, { useState } from 'react' import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import { cropLifeStage } from '../../enums' -import { testCrop, testShoveledPlot } from '../../test-utils' -import { getCropFromItemId, getPlotContentFromItemId } from '../../utils' -import { noop } from '../../utils/noop' -import { items } from '../../img' +import { cropLifeStage } from '../../enums.js' +import { testCrop, testShoveledPlot } from '../../test-utils/index.js' +import { getCropFromItemId, getPlotContentFromItemId } from '../../utils/index.js' +import { noop } from '../../utils/noop.js' +import { items } from '../../img/index.js' -import { Plot } from './Plot' +import { Plot } from './Plot.js' -vitest.mock('../../img') +vitest.mock('../../img/index.js') describe('class states', () => { beforeEach(() => { diff --git a/src/components/Plot/Plot.test.js b/src/components/Plot/Plot.test.js index 934cf9873..fcd445cf4 100644 --- a/src/components/Plot/Plot.test.js +++ b/src/components/Plot/Plot.test.js @@ -1,20 +1,20 @@ import React from 'react' import { shallow } from 'enzyme' -import { getPlotContentFromItemId } from '../../utils' -import { noop } from '../../utils/noop' -import { testCrop } from '../../test-utils' -import { pixel, plotStates } from '../../img' -import { cropLifeStage, fertilizerType } from '../../enums' -import { FERTILIZER_BONUS } from '../../constants' - -import { Plot, getBackgroundStyles, getDaysLeftToMature } from './Plot' - -vitest.mock('../../data/maps') -vitest.mock('../../data/items') -vitest.mock('../../data/levels', () => ({ levels: [] })) -vitest.mock('../../data/shop-inventory') -vitest.mock('../../img') +import { getPlotContentFromItemId } from '../../utils/index.js' +import { noop } from '../../utils/noop.js' +import { testCrop } from '../../test-utils/index.js' +import { pixel, plotStates } from '../../img/index.js' +import { cropLifeStage, fertilizerType } from '../../enums.js' +import { FERTILIZER_BONUS } from '../../constants.js' + +import { Plot, getBackgroundStyles, getDaysLeftToMature } from './Plot.js' + +vitest.mock('../../data/maps.js') +vitest.mock('../../data/items.js') +vitest.mock('../../data/levels.js', () => ({ levels: [] })) +vitest.mock('../../data/shop-inventory.js') +vitest.mock('../../img/index.js') let component diff --git a/src/components/Plot/index.js b/src/components/Plot/index.js index bcd6f630b..d60d352de 100644 --- a/src/components/Plot/index.js +++ b/src/components/Plot/index.js @@ -1 +1 @@ -export { default } from './Plot' +export { default } from './Plot.js' diff --git a/src/components/PriceEventView/PriceEventView.js b/src/components/PriceEventView/PriceEventView.js index 22a5cfd92..c7c941332 100644 --- a/src/components/PriceEventView/PriceEventView.js +++ b/src/components/PriceEventView/PriceEventView.js @@ -1,10 +1,10 @@ import React from 'react' import { object } from 'prop-types' -import Divider from '@mui/material/Divider' +import Divider from '@mui/material/Divider/index.js' -import { itemsMap } from '../../data/maps' -import FarmhandContext from '../Farmhand/Farmhand.context' -import Item from '../Item' +import { itemsMap } from '../../data/maps.js' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import Item from '../Item/index.js' const PriceEventView = ({ priceCrashes, priceSurges }) => (
diff --git a/src/components/PriceEventView/PriceEventView.test.js b/src/components/PriceEventView/PriceEventView.test.js index c17d9a313..4faacf3aa 100644 --- a/src/components/PriceEventView/PriceEventView.test.js +++ b/src/components/PriceEventView/PriceEventView.test.js @@ -1,7 +1,7 @@ import React from 'react' import { shallow } from 'enzyme' -import PriceEventView from './PriceEventView' +import PriceEventView from './PriceEventView.js' let component diff --git a/src/components/PriceEventView/index.js b/src/components/PriceEventView/index.js index b25bda84e..d9e5b5ebe 100644 --- a/src/components/PriceEventView/index.js +++ b/src/components/PriceEventView/index.js @@ -1 +1 @@ -export { default } from './PriceEventView' +export { default } from './PriceEventView.js' diff --git a/src/components/ProgressBar/ProgressBar.test.js b/src/components/ProgressBar/ProgressBar.test.js index 00e4ae347..027184757 100644 --- a/src/components/ProgressBar/ProgressBar.test.js +++ b/src/components/ProgressBar/ProgressBar.test.js @@ -1,7 +1,7 @@ import React from 'react' import { shallow } from 'enzyme' -import ProgressBar from './ProgressBar' +import ProgressBar from './ProgressBar.js' let component diff --git a/src/components/ProgressBar/index.js b/src/components/ProgressBar/index.js index 4b3cd0c90..7ed7f11ae 100644 --- a/src/components/ProgressBar/index.js +++ b/src/components/ProgressBar/index.js @@ -1 +1 @@ -export { default } from './ProgressBar' +export { default } from './ProgressBar.js' diff --git a/src/components/QuantityInput/QuantityInput.js b/src/components/QuantityInput/QuantityInput.js index d68ddb1b0..6de452bc3 100644 --- a/src/components/QuantityInput/QuantityInput.js +++ b/src/components/QuantityInput/QuantityInput.js @@ -1,14 +1,14 @@ import React, { forwardRef } from 'react' import { func, number } from 'prop-types' -import Fab from '@mui/material/Fab' -import KeyboardArrowUp from '@mui/icons-material/KeyboardArrowUp' -import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown' +import Fab from '@mui/material/Fab/index.js' +import KeyboardArrowUp from '@mui/icons-material/KeyboardArrowUp.js' +import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown.js' import NumberFormat from 'react-number-format' -import TextField from '@mui/material/TextField' +import TextField from '@mui/material/TextField/index.js' -import { integerString } from '../../utils' -import AnimatedNumber from '../AnimatedNumber' -import { Span } from '../Elements' +import { integerString } from '../../utils/index.js' +import AnimatedNumber from '../AnimatedNumber/index.js' +import { Span } from '../Elements/index.js' import './QuantityInput.sass' diff --git a/src/components/QuantityInput/QuantityInput.test.js b/src/components/QuantityInput/QuantityInput.test.js index e38431d5c..c3c26d884 100644 --- a/src/components/QuantityInput/QuantityInput.test.js +++ b/src/components/QuantityInput/QuantityInput.test.js @@ -1,9 +1,9 @@ import React from 'react' import { shallow } from 'enzyme' -import { noop } from '../../utils/noop' +import { noop } from '../../utils/noop.js' -import QuantityInput from './QuantityInput' +import QuantityInput from './QuantityInput.js' let component diff --git a/src/components/QuantityInput/index.js b/src/components/QuantityInput/index.js index d0fc64993..c609fb51e 100644 --- a/src/components/QuantityInput/index.js +++ b/src/components/QuantityInput/index.js @@ -1 +1 @@ -export { default } from './QuantityInput' +export { default } from './QuantityInput.js' diff --git a/src/components/QuickSelect/QuickSelect.js b/src/components/QuickSelect/QuickSelect.js index 8f57bb22c..328ca6d13 100644 --- a/src/components/QuickSelect/QuickSelect.js +++ b/src/components/QuickSelect/QuickSelect.js @@ -1,17 +1,17 @@ import React from 'react' import { array, func, object, string } from 'prop-types' -import Button from '@mui/material/Button' -import Divider from '@mui/material/Divider' -import Grid from '@mui/material/Grid' -import Paper from '@mui/material/Paper' -import Tooltip from '@mui/material/Tooltip' -import Typography from '@mui/material/Typography' +import Button from '@mui/material/Button/index.js' +import Divider from '@mui/material/Divider/index.js' +import Grid from '@mui/material/Grid/index.js' +import Paper from '@mui/material/Paper/index.js' +import Tooltip from '@mui/material/Tooltip/index.js' +import Typography from '@mui/material/Typography/index.js' import classNames from 'classnames' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { items as itemImages, pixel } from '../../img' -import { integerString, sortItems } from '../../utils' -import Toolbelt from '../Toolbelt' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { items as itemImages, pixel } from '../../img/index.js' +import { integerString, sortItems } from '../../utils/index.js' +import Toolbelt from '../Toolbelt/index.js' import './QuickSelect.sass' diff --git a/src/components/QuickSelect/QuickSelect.test.js b/src/components/QuickSelect/QuickSelect.test.js index 9c4bbce80..cadea4d51 100644 --- a/src/components/QuickSelect/QuickSelect.test.js +++ b/src/components/QuickSelect/QuickSelect.test.js @@ -1,9 +1,9 @@ import React from 'react' import { shallow } from 'enzyme' -import { noop } from '../../utils/noop' +import { noop } from '../../utils/noop.js' -import QuickSelect from './QuickSelect' +import QuickSelect from './QuickSelect.js' let component diff --git a/src/components/QuickSelect/index.js b/src/components/QuickSelect/index.js index aa71d2c2d..e3600f79a 100644 --- a/src/components/QuickSelect/index.js +++ b/src/components/QuickSelect/index.js @@ -1 +1 @@ -export { default } from './QuickSelect' +export { default } from './QuickSelect.js' diff --git a/src/components/Recipe/Recipe.js b/src/components/Recipe/Recipe.js index cb8cede36..d1d7f7457 100644 --- a/src/components/Recipe/Recipe.js +++ b/src/components/Recipe/Recipe.js @@ -1,30 +1,30 @@ import React, { useEffect, useState } from 'react' import classNames from 'classnames' -import Button from '@mui/material/Button' -import Card from '@mui/material/Card' -import CardHeader from '@mui/material/CardHeader' -import CardContent from '@mui/material/CardContent' -import CardActions from '@mui/material/CardActions' -import Typography from '@mui/material/Typography' +import Button from '@mui/material/Button/index.js' +import Card from '@mui/material/Card/index.js' +import CardHeader from '@mui/material/CardHeader/index.js' +import CardContent from '@mui/material/CardContent/index.js' +import CardActions from '@mui/material/CardActions/index.js' +import Typography from '@mui/material/Typography/index.js' import { array, func, number, object } from 'prop-types' -import { totalIngredientsInRecipe } from '../../utils/totalIngredientsInRecipe' +import { totalIngredientsInRecipe } from '../../utils/totalIngredientsInRecipe.js' import { canMakeRecipe, doesInventorySpaceRemain, dollarString, maxYieldOfRecipe, integerString, -} from '../../utils' -import { itemsMap } from '../../data/maps' -import { craftedItems } from '../../img' -import QuantityInput from '../QuantityInput' -import IngredientsList from '../IngredientsList' +} from '../../utils/index.js' +import { itemsMap } from '../../data/maps.js' +import { craftedItems } from '../../img/index.js' +import QuantityInput from '../QuantityInput/index.js' +import IngredientsList from '../IngredientsList/index.js' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' import './Recipe.sass' -import { INFINITE_STORAGE_LIMIT } from '../../constants' +import { INFINITE_STORAGE_LIMIT } from '../../constants.js' const Recipe = ({ handleMakeRecipeClick, diff --git a/src/components/Recipe/Recipe.test.js b/src/components/Recipe/Recipe.test.js index 7a3e4259d..76996e1e9 100644 --- a/src/components/Recipe/Recipe.test.js +++ b/src/components/Recipe/Recipe.test.js @@ -1,9 +1,9 @@ import React from 'react' import { shallow } from 'enzyme' -import { INFINITE_STORAGE_LIMIT } from '../../constants' +import { INFINITE_STORAGE_LIMIT } from '../../constants.js' -import Recipe from './Recipe' +import Recipe from './Recipe.js' let component diff --git a/src/components/Recipe/index.js b/src/components/Recipe/index.js index e2ee89cda..ce55c20c8 100644 --- a/src/components/Recipe/index.js +++ b/src/components/Recipe/index.js @@ -1 +1 @@ -export { default } from './Recipe' +export { default } from './Recipe.js' diff --git a/src/components/RecipeList/RecipeList.js b/src/components/RecipeList/RecipeList.js index 66d287401..43c991f0e 100644 --- a/src/components/RecipeList/RecipeList.js +++ b/src/components/RecipeList/RecipeList.js @@ -1,7 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' -import Recipe from '../Recipe' +import Recipe from '../Recipe/index.js' export function RecipeList({ allRecipes, learnedRecipes }) { const numLearnedRecipes = learnedRecipes.length diff --git a/src/components/SettingsView/RandomSeedInput.js b/src/components/SettingsView/RandomSeedInput.js index 8f52db493..b4af1d0c5 100644 --- a/src/components/SettingsView/RandomSeedInput.js +++ b/src/components/SettingsView/RandomSeedInput.js @@ -1,9 +1,9 @@ import React, { useContext, useState } from 'react' import { string } from 'prop-types' -import globalWindow from 'global/window' -import TextField from '@mui/material/TextField' +import globalWindow from 'global/window.js' +import TextField from '@mui/material/TextField/index.js' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' import './RandomSeedInput.sass' diff --git a/src/components/SettingsView/RandomSeedInput.test.js b/src/components/SettingsView/RandomSeedInput.test.js index e0fc4cebf..67929a66c 100644 --- a/src/components/SettingsView/RandomSeedInput.test.js +++ b/src/components/SettingsView/RandomSeedInput.test.js @@ -2,9 +2,9 @@ import React from 'react' import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' -import { RandomSeedInput } from './RandomSeedInput' +import { RandomSeedInput } from './RandomSeedInput.js' const mockHandleRNGSeedChange = vitest.fn() diff --git a/src/components/SettingsView/SettingsView.js b/src/components/SettingsView/SettingsView.js index 6fef5dc8c..0d9269296 100644 --- a/src/components/SettingsView/SettingsView.js +++ b/src/components/SettingsView/SettingsView.js @@ -1,22 +1,22 @@ import React, { useState } from 'react' import { bool, func } from 'prop-types' -import Button from '@mui/material/Button' -import Dialog from '@mui/material/Dialog' -import DialogActions from '@mui/material/DialogActions' -import DialogContent from '@mui/material/DialogContent' -import DialogTitle from '@mui/material/DialogTitle' -import Divider from '@mui/material/Divider' -import FormControl from '@mui/material/FormControl' -import FormControlLabel from '@mui/material/FormControlLabel' -import FormGroup from '@mui/material/FormGroup' -import FormLabel from '@mui/material/FormLabel' -import Switch from '@mui/material/Switch' -import Tooltip from '@mui/material/Tooltip' +import Button from '@mui/material/Button/index.js' +import Dialog from '@mui/material/Dialog/index.js' +import DialogActions from '@mui/material/DialogActions/index.js' +import DialogContent from '@mui/material/DialogContent/index.js' +import DialogTitle from '@mui/material/DialogTitle/index.js' +import Divider from '@mui/material/Divider/index.js' +import FormControl from '@mui/material/FormControl/index.js' +import FormControlLabel from '@mui/material/FormControlLabel/index.js' +import FormGroup from '@mui/material/FormGroup/index.js' +import FormLabel from '@mui/material/FormLabel/index.js' +import Switch from '@mui/material/Switch/index.js' +import Tooltip from '@mui/material/Tooltip/index.js' import FileReaderInput from 'react-file-reader-input' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' -import { RandomSeedInput } from './RandomSeedInput' +import { RandomSeedInput } from './RandomSeedInput.js' import './SettingsView.sass' const SettingsView = ({ diff --git a/src/components/SettingsView/SettingsView.test.js b/src/components/SettingsView/SettingsView.test.js index 576e28723..3913004c1 100644 --- a/src/components/SettingsView/SettingsView.test.js +++ b/src/components/SettingsView/SettingsView.test.js @@ -1,9 +1,9 @@ import React from 'react' import { shallow } from 'enzyme' -import { noop } from '../../utils/noop' +import { noop } from '../../utils/noop.js' -import SettingsView from './SettingsView' +import SettingsView from './SettingsView.js' let component diff --git a/src/components/SettingsView/index.js b/src/components/SettingsView/index.js index d31af1a4b..81cc926e1 100644 --- a/src/components/SettingsView/index.js +++ b/src/components/SettingsView/index.js @@ -1 +1 @@ -export { default } from './SettingsView' +export { default } from './SettingsView.js' diff --git a/src/components/Shop/Shop.js b/src/components/Shop/Shop.js index 54cdb11e3..c7f08ff41 100644 --- a/src/components/Shop/Shop.js +++ b/src/components/Shop/Shop.js @@ -1,25 +1,25 @@ import React, { useState } from 'react' import { array, func, number, object } from 'prop-types' -import Button from '@mui/material/Button' -import Card from '@mui/material/Card' -import CardActions from '@mui/material/CardActions' -import CardContent from '@mui/material/CardContent' -import CardHeader from '@mui/material/CardHeader' -import Tab from '@mui/material/Tab' -import Tabs from '@mui/material/Tabs' -import Typography from '@mui/material/Typography' +import Button from '@mui/material/Button/index.js' +import Card from '@mui/material/Card/index.js' +import CardActions from '@mui/material/CardActions/index.js' +import CardContent from '@mui/material/CardContent/index.js' +import CardHeader from '@mui/material/CardHeader/index.js' +import Tab from '@mui/material/Tab/index.js' +import Tabs from '@mui/material/Tabs/index.js' +import Typography from '@mui/material/Typography/index.js' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { features } from '../../config' -import { moneyString } from '../../utils/moneyString' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { features } from '../../config.js' +import { moneyString } from '../../utils/moneyString.js' import { dollarString, getCostOfNextStorageExpansion, integerString, -} from '../../utils' -import { memoize } from '../../utils/memoize' -import { items } from '../../img' -import { itemType, stageFocusType, toolType } from '../../enums' +} from '../../utils/index.js' +import { memoize } from '../../utils/memoize.js' +import { items } from '../../img/index.js' +import { itemType, stageFocusType, toolType } from '../../enums.js' import { INFINITE_STORAGE_LIMIT, PURCHASEABLE_CELLARS, @@ -30,11 +30,11 @@ import { PURCHASABLE_FOREST_SIZES, PURCHASEABLE_SMELTERS, STORAGE_EXPANSION_AMOUNT, -} from '../../constants' -import Inventory from '../Inventory' -import TierPurchase from '../TierPurchase' +} from '../../constants.js' +import Inventory from '../Inventory/index.js' +import TierPurchase from '../TierPurchase/index.js' -import { TabPanel, a11yProps } from './TabPanel' +import { TabPanel, a11yProps } from './TabPanel/index.js' import './Shop.sass' diff --git a/src/components/Shop/Shop.test.js b/src/components/Shop/Shop.test.js index 7992e5a14..fb0014ed4 100644 --- a/src/components/Shop/Shop.test.js +++ b/src/components/Shop/Shop.test.js @@ -1,12 +1,12 @@ import React from 'react' import { render, screen } from '@testing-library/react' -import { INFINITE_STORAGE_LIMIT } from '../../constants' -import { noop } from '../../utils/noop' +import { INFINITE_STORAGE_LIMIT } from '../../constants.js' +import { noop } from '../../utils/noop.js' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' -import Shop from './Shop' +import Shop from './Shop.js' beforeEach(() => { const gameState = { diff --git a/src/components/Shop/index.js b/src/components/Shop/index.js index 344e1b9ca..3da0a25df 100644 --- a/src/components/Shop/index.js +++ b/src/components/Shop/index.js @@ -1 +1 @@ -export { default } from './Shop' +export { default } from './Shop.js' diff --git a/src/components/Stage/Stage.js b/src/components/Stage/Stage.js index 88ef48da5..7a459332a 100644 --- a/src/components/Stage/Stage.js +++ b/src/components/Stage/Stage.js @@ -2,16 +2,16 @@ import React, { useEffect, useRef } from 'react' import classNames from 'classnames' import { array, arrayOf, string } from 'prop-types' -import FarmhandContext from '../Farmhand/Farmhand.context' -import Field from '../Field' -import { Forest } from '../Forest' -import Home from '../Home' -import CowPen from '../CowPen' -import Shop from '../Shop' -import Workshop from '../Workshop' -import { Cellar } from '../Cellar' -import { stageFocusType } from '../../enums' -import { isOctober, isDecember } from '../../utils' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import Field from '../Field/index.js' +import { Forest } from '../Forest/index.js' +import Home from '../Home/index.js' +import CowPen from '../CowPen/index.js' +import Shop from '../Shop/index.js' +import Workshop from '../Workshop/index.js' +import { Cellar } from '../Cellar/index.js' +import { stageFocusType } from '../../enums.js' +import { isOctober, isDecember } from '../../utils/index.js' import './Stage.sass' diff --git a/src/components/Stage/Stage.test.js b/src/components/Stage/Stage.test.js index 91f1a4a9a..8e4a06b6e 100644 --- a/src/components/Stage/Stage.test.js +++ b/src/components/Stage/Stage.test.js @@ -1,12 +1,12 @@ import React from 'react' import { shallow } from 'enzyme' -import Field from '../Field' -import CowPen from '../CowPen' -import Shop from '../Shop' -import { stageFocusType } from '../../../src/enums' +import Field from '../Field/index.js' +import CowPen from '../CowPen/index.js' +import Shop from '../Shop/index.js' +import { stageFocusType } from '../../../src/enums.js' -import { Stage } from './Stage' +import { Stage } from './Stage.js' let component diff --git a/src/components/Stage/index.js b/src/components/Stage/index.js index c48f1bad3..16c201a02 100644 --- a/src/components/Stage/index.js +++ b/src/components/Stage/index.js @@ -1 +1 @@ -export { default } from './Stage' +export { default } from './Stage.js' diff --git a/src/components/StatsView/StatsView.js b/src/components/StatsView/StatsView.js index f701a49fa..a82c4aada 100644 --- a/src/components/StatsView/StatsView.js +++ b/src/components/StatsView/StatsView.js @@ -4,20 +4,20 @@ import React from 'react' import { array, object, number, string } from 'prop-types' import classNames from 'classnames' -import Table from '@mui/material/Table' -import TableBody from '@mui/material/TableBody' -import TableCell from '@mui/material/TableCell' -import TableContainer from '@mui/material/TableContainer' -import TableRow from '@mui/material/TableRow' -import Tooltip from '@mui/material/Tooltip' -import Paper from '@mui/material/Paper' +import Table from '@mui/material/Table/index.js' +import TableBody from '@mui/material/TableBody/index.js' +import TableCell from '@mui/material/TableCell/index.js' +import TableContainer from '@mui/material/TableContainer/index.js' +import TableRow from '@mui/material/TableRow/index.js' +import Tooltip from '@mui/material/Tooltip/index.js' +import Paper from '@mui/material/Paper/index.js' import sortBy from 'lodash.sortby' -import { itemsMap } from '../../data/maps' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { moneyString } from '../../utils/moneyString' -import { farmProductsSold } from '../../utils/farmProductsSold' -import { levelAchieved } from '../../utils/levelAchieved' +import { itemsMap } from '../../data/maps.js' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { moneyString } from '../../utils/moneyString.js' +import { farmProductsSold } from '../../utils/farmProductsSold.js' +import { levelAchieved } from '../../utils/levelAchieved.js' import { experienceNeededForLevel, get7DayAverage, @@ -25,12 +25,12 @@ import { getProfitRecord, integerString, moneyTotal, -} from '../../utils' +} from '../../utils/index.js' import { COW_SOLD_TOOLTIP_TEXT, FARM_PRODUCTS_TOOLTIP_TEXT, -} from '../../strings' -import { DAILY_FINANCIAL_HISTORY_RECORD_LENGTH } from '../../constants' +} from '../../strings.js' +import { DAILY_FINANCIAL_HISTORY_RECORD_LENGTH } from '../../constants.js' import './StatsView.sass' diff --git a/src/components/StatsView/StatsView.test.js b/src/components/StatsView/StatsView.test.js index 02d6a97e7..a1a64d235 100644 --- a/src/components/StatsView/StatsView.test.js +++ b/src/components/StatsView/StatsView.test.js @@ -1,7 +1,7 @@ import React from 'react' import { shallow } from 'enzyme' -import StatsView from './StatsView' +import StatsView from './StatsView.js' let component diff --git a/src/components/StatsView/index.js b/src/components/StatsView/index.js index 3d6babdac..acac560b3 100644 --- a/src/components/StatsView/index.js +++ b/src/components/StatsView/index.js @@ -1 +1 @@ -export { default } from './StatsView' +export { default } from './StatsView.js' diff --git a/src/components/TierPurchase/TierPurchase.js b/src/components/TierPurchase/TierPurchase.js index d1c789c72..c7a79e31d 100644 --- a/src/components/TierPurchase/TierPurchase.js +++ b/src/components/TierPurchase/TierPurchase.js @@ -1,15 +1,15 @@ import React, { useState } from 'react' -import Button from '@mui/material/Button' -import Select from '@mui/material/Select' -import MenuItem from '@mui/material/MenuItem' -import Card from '@mui/material/Card' -import CardContent from '@mui/material/CardContent' -import CardHeader from '@mui/material/CardHeader' -import CardActions from '@mui/material/CardActions' -import Typography from '@mui/material/Typography' +import Button from '@mui/material/Button/index.js' +import Select from '@mui/material/Select/index.js' +import MenuItem from '@mui/material/MenuItem/index.js' +import Card from '@mui/material/Card/index.js' +import CardContent from '@mui/material/CardContent/index.js' +import CardHeader from '@mui/material/CardHeader/index.js' +import CardActions from '@mui/material/CardActions/index.js' +import Typography from '@mui/material/Typography/index.js' import { func, instanceOf, node, number, string } from 'prop-types' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' export function TierPurchase({ description, diff --git a/src/components/TierPurchase/TierPurchase.test.js b/src/components/TierPurchase/TierPurchase.test.js index cc7d2cb29..931090754 100644 --- a/src/components/TierPurchase/TierPurchase.test.js +++ b/src/components/TierPurchase/TierPurchase.test.js @@ -2,7 +2,7 @@ import React from 'react' import { screen, render } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import { TierPurchase } from './TierPurchase' +import { TierPurchase } from './TierPurchase.js' describe('', () => { let onBuyClick, props diff --git a/src/components/TierPurchase/index.js b/src/components/TierPurchase/index.js index 70737a5a8..6f841ff0f 100644 --- a/src/components/TierPurchase/index.js +++ b/src/components/TierPurchase/index.js @@ -1 +1 @@ -export { default } from './TierPurchase' +export { default } from './TierPurchase.js' diff --git a/src/components/Toolbelt/Toolbelt.js b/src/components/Toolbelt/Toolbelt.js index 3364ec545..7180a9cda 100644 --- a/src/components/Toolbelt/Toolbelt.js +++ b/src/components/Toolbelt/Toolbelt.js @@ -3,17 +3,17 @@ import PropTypes from 'prop-types' import classNames from 'classnames' import ReactMarkdown from 'react-markdown' -import Button from '@mui/material/Button' -import Tooltip from '@mui/material/Tooltip' -import Typography from '@mui/material/Typography' +import Button from '@mui/material/Button/index.js' +import Tooltip from '@mui/material/Tooltip/index.js' +import Typography from '@mui/material/Typography/index.js' -import { toolLevel } from '../../enums' -import { memoize } from '../../utils/memoize' -import { noop } from '../../utils/noop' -import FarmhandContext from '../Farmhand/Farmhand.context' -import toolsData from '../../data/tools' +import { toolLevel } from '../../enums.js' +import { memoize } from '../../utils/memoize.js' +import { noop } from '../../utils/noop.js' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import toolsData from '../../data/tools.js' -import { tools as toolImages, craftedItems, pixel } from '../../img' +import { tools as toolImages, craftedItems, pixel } from '../../img/index.js' import './Toolbelt.sass' diff --git a/src/components/Toolbelt/Toolbelt.test.js b/src/components/Toolbelt/Toolbelt.test.js index 431b312a4..3de0e4862 100644 --- a/src/components/Toolbelt/Toolbelt.test.js +++ b/src/components/Toolbelt/Toolbelt.test.js @@ -1,11 +1,11 @@ import React from 'react' import { render, screen } from '@testing-library/react' -import { fieldMode, toolLevel, toolType } from '../../enums' +import { fieldMode, toolLevel, toolType } from '../../enums.js' -import { Toolbelt } from './Toolbelt' +import { Toolbelt } from './Toolbelt.js' -vitest.mock('../../utils/memoize', () => ({ +vitest.mock('../../utils/memoize.js', () => ({ memoize: vitest.fn(callback => { return (...args) => { return callback(...args) diff --git a/src/components/Toolbelt/index.js b/src/components/Toolbelt/index.js index 579b42ad5..b081e398a 100644 --- a/src/components/Toolbelt/index.js +++ b/src/components/Toolbelt/index.js @@ -1 +1 @@ -export { default } from './Toolbelt' +export { default } from './Toolbelt.js' diff --git a/src/components/UpdateNotifier/UpdateNotifier.js b/src/components/UpdateNotifier/UpdateNotifier.js index 639f0465f..8fbfdc25a 100644 --- a/src/components/UpdateNotifier/UpdateNotifier.js +++ b/src/components/UpdateNotifier/UpdateNotifier.js @@ -1,7 +1,7 @@ import { useContext, useEffect } from 'react' import { useRegisterSW } from 'virtual:pwa-register/react' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' const UpdateNotifier = () => { const { diff --git a/src/components/UpdateNotifier/index.js b/src/components/UpdateNotifier/index.js index f624c84c0..301f3705b 100644 --- a/src/components/UpdateNotifier/index.js +++ b/src/components/UpdateNotifier/index.js @@ -1 +1 @@ -export { default } from './UpdateNotifier' +export { default } from './UpdateNotifier.js' diff --git a/src/components/UpgradePurchase/UpgradePurchase.js b/src/components/UpgradePurchase/UpgradePurchase.js index d2a1f049d..2cf6ddf9f 100644 --- a/src/components/UpgradePurchase/UpgradePurchase.js +++ b/src/components/UpgradePurchase/UpgradePurchase.js @@ -1,21 +1,21 @@ import React from 'react' import classNames from 'classnames' -import Button from '@mui/material/Button' -import Card from '@mui/material/Card' -import CardHeader from '@mui/material/CardHeader' -import CardActions from '@mui/material/CardActions' +import Button from '@mui/material/Button/index.js' +import Card from '@mui/material/Card/index.js' +import CardHeader from '@mui/material/CardHeader/index.js' +import CardActions from '@mui/material/CardActions/index.js' import { array, func, number, object } from 'prop-types' -import IngredientsList from '../IngredientsList' +import IngredientsList from '../IngredientsList/index.js' -import { totalIngredientsInRecipe } from '../../utils/totalIngredientsInRecipe' -import { canMakeRecipe, doesInventorySpaceRemain } from '../../utils' +import { totalIngredientsInRecipe } from '../../utils/totalIngredientsInRecipe.js' +import { canMakeRecipe, doesInventorySpaceRemain } from '../../utils/index.js' -import { craftedItems } from '../../img' +import { craftedItems } from '../../img/index.js' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' import './UpgradePurchase.sass' -import { INFINITE_STORAGE_LIMIT } from '../../constants' +import { INFINITE_STORAGE_LIMIT } from '../../constants.js' export function UpgradePurchase({ handleUpgradeTool, diff --git a/src/components/UpgradePurchase/UpgradePurchase.test.js b/src/components/UpgradePurchase/UpgradePurchase.test.js index e184d9ebe..64345d102 100644 --- a/src/components/UpgradePurchase/UpgradePurchase.test.js +++ b/src/components/UpgradePurchase/UpgradePurchase.test.js @@ -2,9 +2,9 @@ import React from 'react' import { render, screen } from '@testing-library/react' -import { toolLevel, toolType } from '../../enums' +import { toolLevel, toolType } from '../../enums.js' -import { UpgradePurchase } from './UpgradePurchase' +import { UpgradePurchase } from './UpgradePurchase.js' describe('', () => { let upgrade, props, toolLevels diff --git a/src/components/UpgradePurchase/index.js b/src/components/UpgradePurchase/index.js index 8a06cb4e8..89e70a3dd 100644 --- a/src/components/UpgradePurchase/index.js +++ b/src/components/UpgradePurchase/index.js @@ -1 +1 @@ -export { default } from './UpgradePurchase' +export { default } from './UpgradePurchase.js' diff --git a/src/components/WineRecipeList/WineRecipe.js b/src/components/WineRecipeList/WineRecipe.js index 419408ecb..55883e76a 100644 --- a/src/components/WineRecipeList/WineRecipe.js +++ b/src/components/WineRecipeList/WineRecipe.js @@ -1,26 +1,29 @@ import React, { useContext, useEffect, useState } from 'react' import { oneOf } from 'prop-types' -import Card from '@mui/material/Card' -import CardHeader from '@mui/material/CardHeader' -import CardActions from '@mui/material/CardActions' -import Button from '@mui/material/Button' +import Card from '@mui/material/Card/index.js' +import CardHeader from '@mui/material/CardHeader/index.js' +import CardActions from '@mui/material/CardActions/index.js' +import Button from '@mui/material/Button/index.js' import { grapeVarietyNameMap, grapeVarietyToGrapeItemMap, -} from '../../data/crops/grape' -import { itemsMap } from '../../data/maps' -import { wineService } from '../../services/wine' -import { grapeVariety } from '../../enums' -import { wines } from '../../img' -import { integerString } from '../../utils' -import { getInventoryQuantityMap } from '../../utils/getInventoryQuantityMap' -import { getYeastRequiredForWine } from '../../utils/getYeastRequiredForWine' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { GRAPES_REQUIRED_FOR_WINE, PURCHASEABLE_CELLARS } from '../../constants' -import { cellarService } from '../../services/cellar' -import QuantityInput from '../QuantityInput' -import { yeast } from '../../data/recipes' +} from '../../data/crops/grape.js' +import { itemsMap } from '../../data/maps.js' +import { wineService } from '../../services/wine.js' +import { grapeVariety } from '../../enums.js' +import { wines } from '../../img/index.js' +import { integerString } from '../../utils/index.js' +import { getInventoryQuantityMap } from '../../utils/getInventoryQuantityMap.js' +import { getYeastRequiredForWine } from '../../utils/getYeastRequiredForWine.js' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { + GRAPES_REQUIRED_FOR_WINE, + PURCHASEABLE_CELLARS, +} from '../../constants.js' +import { cellarService } from '../../services/cellar.js' +import QuantityInput from '../QuantityInput/index.js' +import { yeast } from '../../data/recipes.js' /** * @typedef {{ diff --git a/src/components/WineRecipeList/WineRecipe.test.js b/src/components/WineRecipeList/WineRecipe.test.js index b8aa3b49c..ec6a3b882 100644 --- a/src/components/WineRecipeList/WineRecipe.test.js +++ b/src/components/WineRecipeList/WineRecipe.test.js @@ -1,6 +1,6 @@ /** * @typedef {import('../Farmhand/Farmhand').farmhand.state} farmhand.state - * @typedef {import('./WineRecipe').WineRecipeProps} WineRecipeProps + * @typedef {import('./WineRecipe.js').WineRecipeProps} WineRecipeProps */ import React from 'react' @@ -8,25 +8,25 @@ import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' // eslint-disable-next-line no-unused-vars -import uiHandlers from '../../handlers/ui-events' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { wineService } from '../../services/wine' +import uiHandlers from '../../handlers/ui-events.js' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { wineService } from '../../services/wine.js' import { grapeChardonnay, grapeNebbiolo, grapeSauvignonBlanc, -} from '../../data/crops' -import { yeast } from '../../data/recipes' -import { GRAPES_REQUIRED_FOR_WINE } from '../../constants' -import { integerString } from '../../utils' -import { getYeastRequiredForWine } from '../../utils/getYeastRequiredForWine' +} from '../../data/crops/index.js' +import { yeast } from '../../data/recipes.js' +import { GRAPES_REQUIRED_FOR_WINE } from '../../constants.js' +import { integerString } from '../../utils/index.js' +import { getYeastRequiredForWine } from '../../utils/getYeastRequiredForWine.js' -import { getKegStub } from '../../test-utils/stubs/getKegStub' +import { getKegStub } from '../../test-utils/stubs/getKegStub.js' -import { QUANTITY_INPUT_PLACEHOLDER_TEXT } from '../QuantityInput/QuantityInput' +import { QUANTITY_INPUT_PLACEHOLDER_TEXT } from '../QuantityInput/QuantityInput.js' -import { WineRecipe } from './WineRecipe' +import { WineRecipe } from './WineRecipe.js' /** @type {Pick} */ const stubGameState = { diff --git a/src/components/WineRecipeList/WineRecipeList.js b/src/components/WineRecipeList/WineRecipeList.js index 77f782bec..9867b60b4 100644 --- a/src/components/WineRecipeList/WineRecipeList.js +++ b/src/components/WineRecipeList/WineRecipeList.js @@ -1,10 +1,10 @@ import React, { useContext } from 'react' -import { getWineVarietiesAvailableToMake } from '../../utils/getWineVarietiesAvailableToMake' -import FarmhandContext from '../Farmhand/Farmhand.context' -import { grapeVariety } from '../../enums' +import { getWineVarietiesAvailableToMake } from '../../utils/getWineVarietiesAvailableToMake.js' +import FarmhandContext from '../Farmhand/Farmhand.context.js' +import { grapeVariety } from '../../enums.js' -import { WineRecipe } from './WineRecipe' +import { WineRecipe } from './WineRecipe.js' const totalGrapeVarieties = Object.keys(grapeVariety).length diff --git a/src/components/Workshop/ForgeTabPanel.js b/src/components/Workshop/ForgeTabPanel.js index 925f7fec2..aaf342355 100644 --- a/src/components/Workshop/ForgeTabPanel.js +++ b/src/components/Workshop/ForgeTabPanel.js @@ -1,19 +1,19 @@ import React from 'react' import { number, array, object } from 'prop-types' -import Card from '@mui/material/Card' -import CardContent from '@mui/material/CardContent' -import Divider from '@mui/material/Divider' +import Card from '@mui/material/Card/index.js' +import CardContent from '@mui/material/CardContent/index.js' +import Divider from '@mui/material/Divider/index.js' import ReactMarkdown from 'react-markdown' -import { recipeType } from '../../enums' -import { recipeCategories } from '../../data/maps' -import UpgradePurchase from '../UpgradePurchase' -import { RecipeList } from '../RecipeList/RecipeList' +import { recipeType } from '../../enums.js' +import { recipeCategories } from '../../data/maps.js' +import UpgradePurchase from '../UpgradePurchase/index.js' +import { RecipeList } from '../RecipeList/RecipeList.js' -import { TabPanel } from './TabPanel' +import { TabPanel } from './TabPanel/index.js' -import { getUpgradesAvailable } from './getUpgradesAvailable' +import { getUpgradesAvailable } from './getUpgradesAvailable.js' export function ForgeTabPanel({ currentTab, diff --git a/src/components/Workshop/KitchenTabPanel.js b/src/components/Workshop/KitchenTabPanel.js index 4fe25330d..5923e4271 100644 --- a/src/components/Workshop/KitchenTabPanel.js +++ b/src/components/Workshop/KitchenTabPanel.js @@ -1,16 +1,16 @@ import React from 'react' import { number, array } from 'prop-types' -import Card from '@mui/material/Card' -import CardContent from '@mui/material/CardContent' -import Divider from '@mui/material/Divider' +import Card from '@mui/material/Card/index.js' +import CardContent from '@mui/material/CardContent/index.js' +import Divider from '@mui/material/Divider/index.js' import ReactMarkdown from 'react-markdown' -import { recipeType } from '../../enums' -import { recipeCategories } from '../../data/maps' -import { RecipeList } from '../RecipeList/RecipeList' +import { recipeType } from '../../enums.js' +import { recipeCategories } from '../../data/maps.js' +import { RecipeList } from '../RecipeList/RecipeList.js' -import { TabPanel } from './TabPanel' +import { TabPanel } from './TabPanel/index.js' export function KitchenTabPanel({ currentTab, index, learnedKitchenRecipes }) { return ( diff --git a/src/components/Workshop/RecyclingTabPanel.js b/src/components/Workshop/RecyclingTabPanel.js index 1ba80efc1..522526178 100644 --- a/src/components/Workshop/RecyclingTabPanel.js +++ b/src/components/Workshop/RecyclingTabPanel.js @@ -1,16 +1,16 @@ import React from 'react' import { number, array } from 'prop-types' -import Card from '@mui/material/Card' -import CardContent from '@mui/material/CardContent' -import Divider from '@mui/material/Divider' +import Card from '@mui/material/Card/index.js' +import CardContent from '@mui/material/CardContent/index.js' +import Divider from '@mui/material/Divider/index.js' import ReactMarkdown from 'react-markdown' -import { recipeType } from '../../enums' -import { recipeCategories } from '../../data/maps' -import { RecipeList } from '../RecipeList/RecipeList' +import { recipeType } from '../../enums.js' +import { recipeCategories } from '../../data/maps.js' +import { RecipeList } from '../RecipeList/RecipeList.js' -import { TabPanel } from './TabPanel' +import { TabPanel } from './TabPanel/index.js' export function RecyclingTabPanel({ currentTab, index, learnedRecipes }) { return ( diff --git a/src/components/Workshop/Workshop.js b/src/components/Workshop/Workshop.js index 002505fd6..b977c3da1 100644 --- a/src/components/Workshop/Workshop.js +++ b/src/components/Workshop/Workshop.js @@ -1,19 +1,19 @@ import React, { useState } from 'react' import { number, object } from 'prop-types' -import Tab from '@mui/material/Tab' -import Tabs from '@mui/material/Tabs' +import Tab from '@mui/material/Tab/index.js' +import Tabs from '@mui/material/Tabs/index.js' -import { recipeType } from '../../enums' +import { recipeType } from '../../enums.js' -import { recipesMap } from '../../data/maps' +import { recipesMap } from '../../data/maps.js' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' -import { a11yProps } from './TabPanel' +import { a11yProps } from './TabPanel/index.js' -import { ForgeTabPanel } from './ForgeTabPanel' -import { KitchenTabPanel } from './KitchenTabPanel' -import { RecyclingTabPanel } from './RecyclingTabPanel' +import { ForgeTabPanel } from './ForgeTabPanel.js' +import { KitchenTabPanel } from './KitchenTabPanel.js' +import { RecyclingTabPanel } from './RecyclingTabPanel.js' import './Workshop.sass' diff --git a/src/components/Workshop/Workshop.test.js b/src/components/Workshop/Workshop.test.js index f903acb5e..2f4388cf8 100644 --- a/src/components/Workshop/Workshop.test.js +++ b/src/components/Workshop/Workshop.test.js @@ -2,15 +2,15 @@ import React from 'react' import { screen, render } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import FarmhandContext from '../Farmhand/Farmhand.context' +import FarmhandContext from '../Farmhand/Farmhand.context.js' -import { getUpgradesAvailable } from './getUpgradesAvailable' +import { getUpgradesAvailable } from './getUpgradesAvailable.js' -import Workshop from './Workshop' +import Workshop from './Workshop.js' -vitest.mock('./getUpgradesAvailable') +vitest.mock('./getUpgradesAvailable.js') -vitest.mock('../../data/maps', async importOriginal => ({ +vitest.mock('../../data/maps.js', async importOriginal => ({ ...(await importOriginal()), recipesMap: { 'kitchen-recipe-1': { diff --git a/src/components/Workshop/getUpgradesAvailable.js b/src/components/Workshop/getUpgradesAvailable.js index f39d1ba6a..813509929 100644 --- a/src/components/Workshop/getUpgradesAvailable.js +++ b/src/components/Workshop/getUpgradesAvailable.js @@ -1,5 +1,5 @@ -import toolUpgrades from '../../data/upgrades' -import { recipesMap } from '../../data/maps' +import toolUpgrades from '../../data/upgrades.js' +import { recipesMap } from '../../data/maps.js' /** * Get available upgrades based on current tool levels and unlocked recipes diff --git a/src/components/Workshop/getUpgradesAvailable.test.js b/src/components/Workshop/getUpgradesAvailable.test.js index 88e794186..0f10ed842 100644 --- a/src/components/Workshop/getUpgradesAvailable.test.js +++ b/src/components/Workshop/getUpgradesAvailable.test.js @@ -1,6 +1,6 @@ -import { toolLevel, toolType } from '../../enums' +import { toolLevel, toolType } from '../../enums.js' -import { getUpgradesAvailable } from './getUpgradesAvailable' +import { getUpgradesAvailable } from './getUpgradesAvailable.js' describe('getUpgradesAvailable', () => { const toolLevels = { diff --git a/src/components/Workshop/index.js b/src/components/Workshop/index.js index 59b89f835..2c24b2542 100644 --- a/src/components/Workshop/index.js +++ b/src/components/Workshop/index.js @@ -1 +1 @@ -export { default } from './Workshop' +export { default } from './Workshop.js' diff --git a/src/config.js b/src/config.js index a093850fc..ef43962f8 100644 --- a/src/config.js +++ b/src/config.js @@ -1,4 +1,4 @@ -import globalWindow from 'global/window' +import globalWindow from 'global/window.js' export const endpoints = { getMarketData: `${import.meta.env.VITE_API_ROOT}api/get-market-data`, diff --git a/src/constants.js b/src/constants.js index 318853b83..2a6b4704c 100644 --- a/src/constants.js +++ b/src/constants.js @@ -4,10 +4,10 @@ */ /** - * @typedef {import('./index').farmhand.purchaseableFieldSize} farmhand.purchaseableFieldSize +* @typedef {import('./index.js').farmhand.purchaseableFieldSize} farmhand.purchaseableFieldSize */ -import { cowColors, fieldMode, stageFocusType, toolLevel } from './enums' +import { cowColors, fieldMode, stageFocusType, toolLevel } from './enums.js' const { freeze } = Object diff --git a/src/data/__mocks__/items.js b/src/data/__mocks__/items.js index a2be75007..b8239332e 100644 --- a/src/data/__mocks__/items.js +++ b/src/data/__mocks__/items.js @@ -1,6 +1,6 @@ -import { testItem } from '../../test-utils' -import { itemType } from '../../enums' -import * as actualItems from '../items' +import { testItem } from '../../test-utils/index.js' +import { itemType } from '../../enums.js' +import * as actualItems from '../items.js' // Patch the original items data into the mock. This has the potential to break // with future versions of Webpack (keep an eye on diff --git a/src/data/__mocks__/maps.js b/src/data/__mocks__/maps.js index 879fe4914..25ae301fa 100644 --- a/src/data/__mocks__/maps.js +++ b/src/data/__mocks__/maps.js @@ -1,10 +1,10 @@ /** @typedef {import("../../index").farmhand.item} farmhand.item */ -import { recipeType } from '../../enums' -import * as actualMaps from '../maps' +import { recipeType } from '../../enums.js' +import * as actualMaps from '../maps.js' -import * as items from './items' -import * as recipes from './recipes' +import * as items from './items.js' +import * as recipes from './recipes.js' export const recipeCategories = { [recipeType.KITCHEN]: {}, diff --git a/src/data/__mocks__/recipes.js b/src/data/__mocks__/recipes.js index ef1937641..6a3b104da 100644 --- a/src/data/__mocks__/recipes.js +++ b/src/data/__mocks__/recipes.js @@ -1,7 +1,7 @@ -import { itemType, recipeType } from '../../enums' -import * as actualRecipes from '../recipes' +import { itemType, recipeType } from '../../enums.js' +import * as actualRecipes from '../recipes.js' -import * as items from './items' +import * as items from './items.js' Object.assign(module.exports, { ...actualRecipes }) diff --git a/src/data/achievements.js b/src/data/achievements.js index ac2a78c10..d4d02a5c2 100644 --- a/src/data/achievements.js +++ b/src/data/achievements.js @@ -1,4 +1,4 @@ -import { addItemToInventory } from '../game-logic/reducers/' +import { addItemToInventory } from '../game-logic/reducers/index.js' import { doesPlotContainCrop, dollarString, @@ -8,18 +8,18 @@ import { isOctober, moneyTotal, percentageString, -} from '../utils' -import { memoize } from '../utils/memoize' -import { findInField } from '../utils/findInField' -import { addExperience } from '../game-logic/reducers' -import { cropLifeStage, standardCowColors } from '../enums' +} from '../utils/index.js' +import { memoize } from '../utils/memoize.js' +import { findInField } from '../utils/findInField.js' +import { addExperience } from '../game-logic/reducers/index.js' +import { cropLifeStage, standardCowColors } from '../enums.js' import { COW_FEED_ITEM_ID, EXPERIENCE_VALUES, I_AM_RICH_BONUSES, -} from '../constants' +} from '../constants.js' -import { itemsMap } from './maps' +import { itemsMap } from './maps.js' const { SEED } = cropLifeStage diff --git a/src/data/achievements.test.js b/src/data/achievements.test.js index 70c171e1d..e7478ea9f 100644 --- a/src/data/achievements.test.js +++ b/src/data/achievements.test.js @@ -1,12 +1,12 @@ -import * as reducers from '../game-logic/reducers' -import { testCrop } from '../test-utils' +import * as reducers from '../game-logic/reducers/index.js' +import { testCrop } from '../test-utils/index.js' -import { toolLevel, toolType } from '../enums' +import { toolLevel, toolType } from '../enums.js' -import { INFINITE_STORAGE_LIMIT } from '../constants' +import { INFINITE_STORAGE_LIMIT } from '../constants.js' -import { achievementsMap } from './achievements' -import { carrot } from './crops' +import { achievementsMap } from './achievements.js' +import { carrot } from './crops/index.js' describe('harvest-crop', () => { describe('condition', () => { diff --git a/src/data/crop.js b/src/data/crop.js index b09cf81bf..0212a09d5 100644 --- a/src/data/crop.js +++ b/src/data/crop.js @@ -3,8 +3,8 @@ * @typedef {import("../index").farmhand.cropVariety} farmhand.cropVariety */ -import { fieldMode, itemType } from '../enums' -import { getCropLifecycleDuration } from '../utils/getCropLifecycleDuration' +import { fieldMode, itemType } from '../enums.js' +import { getCropLifecycleDuration } from '../utils/getCropLifecycleDuration.js' const { freeze } = Object diff --git a/src/data/crops/asparagus.js b/src/data/crops/asparagus.js index a43f482fb..8f51f0386 100644 --- a/src/data/crops/asparagus.js +++ b/src/data/crops/asparagus.js @@ -1,7 +1,7 @@ /** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.asparagusSeed diff --git a/src/data/crops/carrot.js b/src/data/crops/carrot.js index cb585bcd4..a492b7d91 100644 --- a/src/data/crops/carrot.js +++ b/src/data/crops/carrot.js @@ -1,7 +1,7 @@ /** @typedef {import("../../index").farmhand.item} item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.carrotSeed diff --git a/src/data/crops/corn.js b/src/data/crops/corn.js index 00d1ed3b7..cb2e67beb 100644 --- a/src/data/crops/corn.js +++ b/src/data/crops/corn.js @@ -1,7 +1,7 @@ /** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.cornSeed diff --git a/src/data/crops/garlic.js b/src/data/crops/garlic.js index db5f90924..5d39721fd 100644 --- a/src/data/crops/garlic.js +++ b/src/data/crops/garlic.js @@ -1,7 +1,7 @@ /** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.garlicSeed diff --git a/src/data/crops/grape.js b/src/data/crops/grape.js index 05c1a474f..e30f0d82c 100644 --- a/src/data/crops/grape.js +++ b/src/data/crops/grape.js @@ -2,8 +2,8 @@ /** @typedef {import("../../index").farmhand.grape} farmhand.grape */ /** @typedef {import("../../index").farmhand.cropVariety} farmhand.cropVariety */ -import { crop, fromSeed, cropVariety } from '../crop' -import { cropFamily, cropType, grapeVariety } from '../../enums' +import { crop, fromSeed, cropVariety } from '../crop.js' +import { cropFamily, cropType, grapeVariety } from '../../enums.js' /** * @param {farmhand.item | farmhand.cropVariety} item diff --git a/src/data/crops/index.js b/src/data/crops/index.js index c484d3094..43cd6b89e 100644 --- a/src/data/crops/index.js +++ b/src/data/crops/index.js @@ -1,6 +1,6 @@ -export { asparagus, asparagusSeed } from './asparagus' -export { carrot, carrotSeed } from './carrot' -export { corn, cornSeed } from './corn' +export { asparagus, asparagusSeed } from './asparagus.js' +export { carrot, carrotSeed } from './carrot.js' +export { corn, cornSeed } from './corn.js' export { grapeSeed, grapeChardonnay, @@ -13,19 +13,19 @@ export { // grapeSyrah, grapeTempranillo, grapeNebbiolo, -} from './grape' -export { garlic, garlicSeed } from './garlic' -export { jalapeno, jalapenoSeed } from './jalapeno' -export { olive, oliveSeed } from './olive' -export { onion, onionSeed } from './onion' -export { pea, peaSeed } from './pea' -export { potato, potatoSeed } from './potato' -export { pumpkin, pumpkinSeed } from './pumpkin' -export { soybean, soybeanSeed } from './soybean' -export { spinach, spinachSeed } from './spinach' -export { sunflower, sunflowerSeed } from './sunflower' -export { strawberry, strawberrySeed } from './strawberry' -export { sweetPotato, sweetPotatoSeed } from './sweet-potato' -export { tomato, tomatoSeed } from './tomato' -export { watermelon, watermelonSeed } from './watermelon' -export { wheat, wheatSeed } from './wheat' +} from './grape.js' +export { garlic, garlicSeed } from './garlic.js' +export { jalapeno, jalapenoSeed } from './jalapeno.js' +export { olive, oliveSeed } from './olive.js' +export { onion, onionSeed } from './onion.js' +export { pea, peaSeed } from './pea.js' +export { potato, potatoSeed } from './potato.js' +export { pumpkin, pumpkinSeed } from './pumpkin.js' +export { soybean, soybeanSeed } from './soybean.js' +export { spinach, spinachSeed } from './spinach.js' +export { sunflower, sunflowerSeed } from './sunflower.js' +export { strawberry, strawberrySeed } from './strawberry.js' +export { sweetPotato, sweetPotatoSeed } from './sweet-potato.js' +export { tomato, tomatoSeed } from './tomato.js' +export { watermelon, watermelonSeed } from './watermelon.js' +export { wheat, wheatSeed } from './wheat.js' diff --git a/src/data/crops/jalapeno.js b/src/data/crops/jalapeno.js index 28f6e9b6e..1ac4363a8 100644 --- a/src/data/crops/jalapeno.js +++ b/src/data/crops/jalapeno.js @@ -1,7 +1,7 @@ /** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.jalapenoSeed diff --git a/src/data/crops/olive.js b/src/data/crops/olive.js index 6e30f5f87..54713d551 100644 --- a/src/data/crops/olive.js +++ b/src/data/crops/olive.js @@ -1,7 +1,7 @@ /** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.oliveSeed diff --git a/src/data/crops/onion.js b/src/data/crops/onion.js index a1afebd21..3c5a1ea93 100644 --- a/src/data/crops/onion.js +++ b/src/data/crops/onion.js @@ -1,7 +1,7 @@ /** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.onionSeed diff --git a/src/data/crops/pea.js b/src/data/crops/pea.js index 767f3b67c..285bb1939 100644 --- a/src/data/crops/pea.js +++ b/src/data/crops/pea.js @@ -1,7 +1,7 @@ /** @typedef {import("../../index").farmhand.item} farmhand.item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.peaSeed diff --git a/src/data/crops/potato.js b/src/data/crops/potato.js index 39db04548..aef9d45b0 100644 --- a/src/data/crops/potato.js +++ b/src/data/crops/potato.js @@ -1,7 +1,7 @@ /** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.potatoSeed diff --git a/src/data/crops/pumpkin.js b/src/data/crops/pumpkin.js index 883e6d1ba..631317e18 100644 --- a/src/data/crops/pumpkin.js +++ b/src/data/crops/pumpkin.js @@ -1,7 +1,7 @@ /** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.pumpkinSeed diff --git a/src/data/crops/soybean.js b/src/data/crops/soybean.js index b7645969d..14f515598 100644 --- a/src/data/crops/soybean.js +++ b/src/data/crops/soybean.js @@ -1,7 +1,7 @@ /** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.soybeanSeed diff --git a/src/data/crops/spinach.js b/src/data/crops/spinach.js index 804d266ba..d9c0e2070 100644 --- a/src/data/crops/spinach.js +++ b/src/data/crops/spinach.js @@ -1,7 +1,7 @@ /** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.spinachSeed diff --git a/src/data/crops/strawberry.js b/src/data/crops/strawberry.js index 6c6daf08b..302e191b2 100644 --- a/src/data/crops/strawberry.js +++ b/src/data/crops/strawberry.js @@ -1,7 +1,7 @@ /** @typedef {import("../../index").farmhand.item} item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.strawberrySeed diff --git a/src/data/crops/sunflower.js b/src/data/crops/sunflower.js index 69d2eccff..1ac2803af 100644 --- a/src/data/crops/sunflower.js +++ b/src/data/crops/sunflower.js @@ -1,7 +1,7 @@ /** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.sunflowerSeed diff --git a/src/data/crops/sweet-potato.js b/src/data/crops/sweet-potato.js index a879da993..389358db8 100644 --- a/src/data/crops/sweet-potato.js +++ b/src/data/crops/sweet-potato.js @@ -1,7 +1,7 @@ /** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.sweetPotatoSeed diff --git a/src/data/crops/tomato.js b/src/data/crops/tomato.js index b95b7c9e1..87b00bafa 100644 --- a/src/data/crops/tomato.js +++ b/src/data/crops/tomato.js @@ -1,7 +1,7 @@ /** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.tomatoSeed diff --git a/src/data/crops/watermelon.js b/src/data/crops/watermelon.js index 8fa194060..394164cf5 100644 --- a/src/data/crops/watermelon.js +++ b/src/data/crops/watermelon.js @@ -1,7 +1,7 @@ /** @typedef {import("../../index").farmhand.item} item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.watermelonSeed diff --git a/src/data/crops/wheat.js b/src/data/crops/wheat.js index 3b79fd9dc..59790332f 100644 --- a/src/data/crops/wheat.js +++ b/src/data/crops/wheat.js @@ -1,7 +1,7 @@ /** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */ -import { crop, fromSeed } from '../crop' -import { cropType } from '../../enums' +import { crop, fromSeed } from '../crop.js' +import { cropType } from '../../enums.js' /** * @property farmhand.module:items.wheatSeed diff --git a/src/data/items-map.js b/src/data/items-map.js index 6762ccddc..dd9c27b44 100644 --- a/src/data/items-map.js +++ b/src/data/items-map.js @@ -1,6 +1,6 @@ /** @typedef {import("../index").farmhand.item} farmhand.item */ -import * as items from '../data/items' +import * as items from '../data/items.js' /** * ⚠️⚠️⚠️ This is a low-level object that is UNSAFE to use directly outside of diff --git a/src/data/items.js b/src/data/items.js index e841c21e6..7b6dfa0b4 100644 --- a/src/data/items.js +++ b/src/data/items.js @@ -2,12 +2,12 @@ * @module farmhand.items */ -import { fieldMode, itemType } from '../enums' +import { fieldMode, itemType } from '../enums.js' import { COW_FEED_ITEM_ID, HUGGING_MACHINE_ITEM_ID, INITIAL_SPRINKLER_RANGE, -} from '../constants' +} from '../constants.js' const { freeze } = Object const { @@ -72,7 +72,7 @@ export { watermelonSeed, wheat, wheatSeed, -} from './crops' +} from './crops/index.js' export const weed = freeze({ id: 'weed', @@ -90,7 +90,7 @@ export { silverOre, stone, saltRock, -} from './ores' +} from './ores/index.js' //////////////////////////////////////// // diff --git a/src/data/levels.js b/src/data/levels.js index 6b4bf518c..7bf2d9637 100644 --- a/src/data/levels.js +++ b/src/data/levels.js @@ -1,8 +1,8 @@ -import { stageFocusType, toolType } from '../enums' -import { features } from '../config' +import { stageFocusType, toolType } from '../enums.js' +import { features } from '../config.js' -import * as items from './items' -import * as recipes from './recipes' +import * as items from './items.js' +import * as recipes from './recipes.js' export const levels = [] diff --git a/src/data/maps.js b/src/data/maps.js index 3cd7c7e0d..fd4e4944d 100644 --- a/src/data/maps.js +++ b/src/data/maps.js @@ -1,13 +1,13 @@ /** @typedef {import("../index").farmhand.item} farmhand.item */ -import { cropType, recipeType } from '../enums' +import { cropType, recipeType } from '../enums.js' -import * as recipes from './recipes' -import upgrades from './upgrades' +import * as recipes from './recipes.js' +import upgrades from './upgrades.js' -import baseItemsMap from './items-map' +import baseItemsMap from './items-map.js' -import { grapeSeed } from './crops' +import { grapeSeed } from './crops/index.js' const { ASPARAGUS, diff --git a/src/data/ores/bronzeOre.js b/src/data/ores/bronzeOre.js index 57410a89c..e3229e160 100644 --- a/src/data/ores/bronzeOre.js +++ b/src/data/ores/bronzeOre.js @@ -1,6 +1,6 @@ /** @typedef {import("../../index").farmhand.item} farmhand.item */ -import { itemType } from '../../enums' -import { BRONZE_SPAWN_CHANCE } from '../../constants' +import { itemType } from '../../enums.js' +import { BRONZE_SPAWN_CHANCE } from '../../constants.js' const { freeze } = Object diff --git a/src/data/ores/coal.js b/src/data/ores/coal.js index aaa75394c..d785c91b3 100644 --- a/src/data/ores/coal.js +++ b/src/data/ores/coal.js @@ -1,6 +1,6 @@ /** @typedef {import("../../index").farmhand.item} farmhand.item */ -import { itemType } from '../../enums' -import { COAL_SPAWN_CHANCE } from '../../constants' +import { itemType } from '../../enums.js' +import { COAL_SPAWN_CHANCE } from '../../constants.js' const { freeze } = Object diff --git a/src/data/ores/goldOre.js b/src/data/ores/goldOre.js index dead2506e..d5a686b4f 100644 --- a/src/data/ores/goldOre.js +++ b/src/data/ores/goldOre.js @@ -1,6 +1,6 @@ /** @typedef {import("../../index").farmhand.item} farmhand.item */ -import { itemType } from '../../enums' -import { GOLD_SPAWN_CHANCE } from '../../constants' +import { itemType } from '../../enums.js' +import { GOLD_SPAWN_CHANCE } from '../../constants.js' const { freeze } = Object diff --git a/src/data/ores/index.js b/src/data/ores/index.js index c2a77635a..e0d79e40a 100644 --- a/src/data/ores/index.js +++ b/src/data/ores/index.js @@ -1,7 +1,7 @@ -export { bronzeOre } from './bronzeOre' -export { coal } from './coal' -export { goldOre } from './goldOre' -export { ironOre } from './ironOre' -export { silverOre } from './silverOre' -export { stone } from './stone' -export { saltRock } from './saltRock' +export { bronzeOre } from './bronzeOre.js' +export { coal } from './coal.js' +export { goldOre } from './goldOre.js' +export { ironOre } from './ironOre.js' +export { silverOre } from './silverOre.js' +export { stone } from './stone.js' +export { saltRock } from './saltRock.js' diff --git a/src/data/ores/ironOre.js b/src/data/ores/ironOre.js index d3f54ccc8..fab9a9b75 100644 --- a/src/data/ores/ironOre.js +++ b/src/data/ores/ironOre.js @@ -1,6 +1,6 @@ /** @typedef {import("../../index").farmhand.item} farmhand.item */ -import { itemType } from '../../enums' -import { IRON_SPAWN_CHANCE } from '../../constants' +import { itemType } from '../../enums.js' +import { IRON_SPAWN_CHANCE } from '../../constants.js' const { freeze } = Object diff --git a/src/data/ores/saltRock.js b/src/data/ores/saltRock.js index 2b07c4a5a..cf690d791 100644 --- a/src/data/ores/saltRock.js +++ b/src/data/ores/saltRock.js @@ -1,6 +1,6 @@ /** @typedef {import("../../index").farmhand.item} farmhand.item */ -import { itemType } from '../../enums' -import { SALT_ROCK_SPAWN_CHANCE } from '../../constants' +import { itemType } from '../../enums.js' +import { SALT_ROCK_SPAWN_CHANCE } from '../../constants.js' const { freeze } = Object diff --git a/src/data/ores/silverOre.js b/src/data/ores/silverOre.js index b329b2cd9..da6d2e516 100644 --- a/src/data/ores/silverOre.js +++ b/src/data/ores/silverOre.js @@ -1,6 +1,6 @@ /** @typedef {import("../../index").farmhand.item} farmhand.item */ -import { itemType } from '../../enums' -import { SILVER_SPAWN_CHANCE } from '../../constants' +import { itemType } from '../../enums.js' +import { SILVER_SPAWN_CHANCE } from '../../constants.js' const { freeze } = Object diff --git a/src/data/ores/stone.js b/src/data/ores/stone.js index 9636613b2..a345a2f52 100644 --- a/src/data/ores/stone.js +++ b/src/data/ores/stone.js @@ -1,6 +1,6 @@ /** @typedef {import("../../index").farmhand.item} farmhand.item */ -import { itemType } from '../../enums' -import { STONE_SPAWN_CHANCE } from '../../constants' +import { itemType } from '../../enums.js' +import { STONE_SPAWN_CHANCE } from '../../constants.js' const { freeze } = Object diff --git a/src/data/recipes.js b/src/data/recipes.js index 43073f21c..507699859 100644 --- a/src/data/recipes.js +++ b/src/data/recipes.js @@ -5,16 +5,16 @@ * @typedef {import('../index').farmhand.grape} farmhand.grape * @typedef {import('../index').farmhand.wine} farmhand.wine */ -import { itemType, fieldMode, recipeType } from '../enums' +import { itemType, fieldMode, recipeType } from '../enums.js' import { GRAPES_REQUIRED_FOR_WINE, RECIPE_INGREDIENT_VALUE_MULTIPLIER, -} from '../constants' -import { getYeastRequiredForWine } from '../utils/getYeastRequiredForWine' +} from '../constants.js' +import { getYeastRequiredForWine } from '../utils/getYeastRequiredForWine.js' -import * as items from './items' -import baseItemsMap from './items-map' -import { grapeVarietyNameMap } from './crops/grape' +import * as items from './items.js' +import baseItemsMap from './items-map.js' +import { grapeVarietyNameMap } from './crops/grape.js' const itemsMap = { ...baseItemsMap } diff --git a/src/data/shop-inventory-cow.js b/src/data/shop-inventory-cow.js index bef2a28b0..80f229693 100644 --- a/src/data/shop-inventory-cow.js +++ b/src/data/shop-inventory-cow.js @@ -1,4 +1,4 @@ -import { cowFeed, huggingMachine } from './items' +import { cowFeed, huggingMachine } from './items.js' const inventory = [cowFeed, huggingMachine] diff --git a/src/data/shop-inventory.js b/src/data/shop-inventory.js index 7803907b7..e22c856e6 100644 --- a/src/data/shop-inventory.js +++ b/src/data/shop-inventory.js @@ -27,9 +27,9 @@ import { // Field items scarecrow, sprinkler, -} from './items' +} from './items.js' -import { fertilizer } from './recipes' +import { fertilizer } from './recipes.js' /** @type {farmhand.item[]} */ const inventory = [ diff --git a/src/data/tools.js b/src/data/tools.js index f3eb75a96..f4c7e974f 100644 --- a/src/data/tools.js +++ b/src/data/tools.js @@ -1,4 +1,4 @@ -import { fieldMode, toolType } from '../enums' +import { fieldMode, toolType } from '../enums.js' import { HOE_ALT_TEXT, @@ -10,7 +10,7 @@ import { TOOL_LEVEL_INFO, WATERING_CAN_ALT_TEXT, WATERING_CAN_HIDDEN_TEXT, -} from '../strings' +} from '../strings.js' const { CLEANUP, HARVEST, MINE, WATER } = fieldMode diff --git a/src/data/upgrades.js b/src/data/upgrades.js index 5d2119cd4..7681458d9 100644 --- a/src/data/upgrades.js +++ b/src/data/upgrades.js @@ -1,7 +1,7 @@ -import { itemType, toolType, toolLevel } from '../enums' +import { itemType, toolType, toolLevel } from '../enums.js' -import * as items from './items' -import * as recipes from './recipes' +import * as items from './items.js' +import * as recipes from './recipes.js' const coalNeededForIngots = (ingotId, amount = 1) => { switch (ingotId) { diff --git a/src/factories/CoalFactory.js b/src/factories/CoalFactory.js index dbc451051..5a02f9ef7 100644 --- a/src/factories/CoalFactory.js +++ b/src/factories/CoalFactory.js @@ -1,7 +1,7 @@ /** @typedef {import("../index").farmhand.item} farmhand.item */ -import { coal, stone } from '../data/ores' -import { Factory } from '../interfaces/Factory' -import { chooseRandom } from '../utils' +import { coal, stone } from '../data/ores/index.js' +import { Factory } from '../interfaces/Factory.js' +import { chooseRandom } from '../utils/index.js' /** * Resource factory used for spawning coal diff --git a/src/factories/CoalFactory.test.js b/src/factories/CoalFactory.test.js index f2eb4bf9b..af7537839 100644 --- a/src/factories/CoalFactory.test.js +++ b/src/factories/CoalFactory.test.js @@ -1,7 +1,7 @@ -import * as utils from '../utils' -import { coal, stone } from '../data/ores' +import * as utils from '../utils/index.js' +import { coal, stone } from '../data/ores/index.js' -import CoalFactory from './CoalFactory' +import CoalFactory from './CoalFactory.js' describe('CoalFactory', () => { beforeEach(() => { diff --git a/src/factories/OreFactory.js b/src/factories/OreFactory.js index 1dc0fce5c..9930988ea 100644 --- a/src/factories/OreFactory.js +++ b/src/factories/OreFactory.js @@ -1,7 +1,7 @@ /** @typedef {import("../index").farmhand.item} farmhand.item */ -import { goldOre, ironOre, bronzeOre, silverOre } from '../data/ores' -import { Factory } from '../interfaces/Factory' -import { randomChoice } from '../utils' +import { goldOre, ironOre, bronzeOre, silverOre } from '../data/ores/index.js' +import { Factory } from '../interfaces/Factory.js' +import { randomChoice } from '../utils/index.js' const SPAWNABLE_ORES = [goldOre, ironOre, bronzeOre, silverOre] diff --git a/src/factories/OreFactory.test.js b/src/factories/OreFactory.test.js index a5529a50e..4daf9c2e0 100644 --- a/src/factories/OreFactory.test.js +++ b/src/factories/OreFactory.test.js @@ -1,6 +1,6 @@ -import { itemType } from '../enums' +import { itemType } from '../enums.js' -import OreFactory from './OreFactory' +import OreFactory from './OreFactory.js' describe('OreFactory', () => { beforeEach(() => { diff --git a/src/factories/ResourceFactory.js b/src/factories/ResourceFactory.js index 39a003008..c4de15874 100644 --- a/src/factories/ResourceFactory.js +++ b/src/factories/ResourceFactory.js @@ -1,20 +1,20 @@ /** @typedef {import("../index").farmhand.item} farmhand.item */ /** @typedef {import("../enums").itemType} farmhand.itemType */ -import { itemType, toolLevel } from '../enums' +import { itemType, toolLevel } from '../enums.js' import { RESOURCE_SPAWN_CHANCE, ORE_SPAWN_CHANCE, COAL_SPAWN_CHANCE, STONE_SPAWN_CHANCE, -} from '../constants' -import { randomChoice } from '../utils' -import { randomNumberService } from '../common/services/randomNumber' +} from '../constants.js' +import { randomChoice } from '../utils/index.js' +import { randomNumberService } from '../common/services/randomNumber.js' // eslint-disable-next-line no-unused-vars -import { Factory } from '../interfaces/Factory' +import { Factory } from '../interfaces/Factory.js' -import OreFactory from './OreFactory' -import CoalFactory from './CoalFactory' -import StoneFactory from './StoneFactory' +import OreFactory from './OreFactory.js' +import CoalFactory from './CoalFactory.js' +import StoneFactory from './StoneFactory.js' /** * Object for private cache of factory instances diff --git a/src/factories/ResourceFactory.test.js b/src/factories/ResourceFactory.test.js index f7cfbfa30..2cf4a8f4f 100644 --- a/src/factories/ResourceFactory.test.js +++ b/src/factories/ResourceFactory.test.js @@ -1,15 +1,15 @@ -import { randomNumberService } from '../common/services/randomNumber' -import { itemType, toolLevel } from '../enums' -import { randomChoice } from '../utils' +import { randomNumberService } from '../common/services/randomNumber.js' +import { itemType, toolLevel } from '../enums.js' +import { randomChoice } from '../utils/index.js' -import ResourceFactory from './ResourceFactory' +import ResourceFactory from './ResourceFactory.js' -vitest.mock('./CoalFactory') -vitest.mock('./OreFactory') -vitest.mock('./StoneFactory') +vitest.mock('./CoalFactory.js') +vitest.mock('./OreFactory.js') +vitest.mock('./StoneFactory.js') -vitest.mock('../utils', async () => ({ - ...(await vitest.importActual('../utils')), +vitest.mock('../utils/index.js', async () => ({ + ...(await vitest.importActual('../utils/index.js')), randomChoice: vitest.fn(), })) diff --git a/src/factories/StoneFactory.js b/src/factories/StoneFactory.js index b862fc509..37e3e4f27 100644 --- a/src/factories/StoneFactory.js +++ b/src/factories/StoneFactory.js @@ -1,12 +1,12 @@ /** @typedef {import("../index").farmhand.item} farmhand.item */ -import { randomNumberService } from '../common/services/randomNumber' -import { Factory } from '../interfaces/Factory' -import { coal, saltRock, stone } from '../data/ores' +import { randomNumberService } from '../common/services/randomNumber.js' +import { Factory } from '../interfaces/Factory.js' +import { coal, saltRock, stone } from '../data/ores/index.js' import { COAL_SPAWN_CHANCE, SALT_ROCK_SPAWN_CHANCE, STONE_SPAWN_CHANCE, -} from '../constants' +} from '../constants.js' const spawnableResources = [ [stone, STONE_SPAWN_CHANCE], diff --git a/src/factories/StoneFactory.test.js b/src/factories/StoneFactory.test.js index 4d23eaadc..d2bee9c80 100644 --- a/src/factories/StoneFactory.test.js +++ b/src/factories/StoneFactory.test.js @@ -1,7 +1,7 @@ -import { randomNumberService } from '../common/services/randomNumber' -import { coal, stone, saltRock } from '../data/ores' +import { randomNumberService } from '../common/services/randomNumber.js' +import { coal, stone, saltRock } from '../data/ores/index.js' -import StoneFactory from './StoneFactory' +import StoneFactory from './StoneFactory.js' beforeEach(() => { vitest.spyOn(randomNumberService, 'isRandomNumberLessThan') diff --git a/src/factories/index.js b/src/factories/index.js index bc33e7489..cf0de672c 100644 --- a/src/factories/index.js +++ b/src/factories/index.js @@ -1 +1 @@ -export { default as ResourceFactory } from './ResourceFactory' +export { default as ResourceFactory } from './ResourceFactory.js' diff --git a/src/game-logic/cows/cow-selection.test.js b/src/game-logic/cows/cow-selection.test.js index ff25d47ad..5e2562434 100644 --- a/src/game-logic/cows/cow-selection.test.js +++ b/src/game-logic/cows/cow-selection.test.js @@ -1,10 +1,10 @@ import { act, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import { farmhandStub } from '../../test-utils/stubs/farmhandStub' -import { saveDataStubFactory } from '../../test-utils/stubs/saveDataStubFactory' -import { previousView } from '../../test-utils/ui' -import { generateCow, getCowDisplayName } from '../../utils' +import { farmhandStub } from '../../test-utils/stubs/farmhandStub.js' +import { saveDataStubFactory } from '../../test-utils/stubs/saveDataStubFactory.js' +import { previousView } from '../../test-utils/ui.js' +import { generateCow, getCowDisplayName } from '../../utils/index.js' describe('cow selection', () => { let cowDisplayName1 = null diff --git a/src/game-logic/field-purchase.test.js b/src/game-logic/field-purchase.test.js index 21e89a528..016cb4cf9 100644 --- a/src/game-logic/field-purchase.test.js +++ b/src/game-logic/field-purchase.test.js @@ -2,9 +2,9 @@ import { screen } from '@testing-library/react' import { within } from '@testing-library/dom' import userEvent from '@testing-library/user-event' -import { farmhandStub } from '../test-utils/stubs/farmhandStub' -import { saveDataStubFactory } from '../test-utils/stubs/saveDataStubFactory' -import { nextView } from '../test-utils/ui' +import { farmhandStub } from '../test-utils/stubs/farmhandStub.js' +import { saveDataStubFactory } from '../test-utils/stubs/saveDataStubFactory.js' +import { nextView } from '../test-utils/ui.js' describe('field expansion purchasing', () => { test('field expansion can be purchased', async () => { diff --git a/src/game-logic/item-purchase.test.js b/src/game-logic/item-purchase.test.js index f0fa20685..470f0a8c5 100644 --- a/src/game-logic/item-purchase.test.js +++ b/src/game-logic/item-purchase.test.js @@ -2,8 +2,8 @@ import { screen } from '@testing-library/react' import { within } from '@testing-library/dom' import userEvent from '@testing-library/user-event' -import { farmhandStub } from '../test-utils/stubs/farmhandStub' -import { nextView } from '../test-utils/ui' +import { farmhandStub } from '../test-utils/stubs/farmhandStub.js' +import { nextView } from '../test-utils/ui.js' describe('item purchasing', () => { test('item can be purchased and added to the inventory', async () => { diff --git a/src/game-logic/item-sell.test.js b/src/game-logic/item-sell.test.js index f9afcf04a..e0581f484 100644 --- a/src/game-logic/item-sell.test.js +++ b/src/game-logic/item-sell.test.js @@ -2,8 +2,8 @@ import { screen } from '@testing-library/react' import { within } from '@testing-library/dom' import userEvent from '@testing-library/user-event' -import { farmhandStub } from '../test-utils/stubs/farmhandStub' -import { saveDataStubFactory } from '../test-utils/stubs/saveDataStubFactory' +import { farmhandStub } from '../test-utils/stubs/farmhandStub.js' +import { saveDataStubFactory } from '../test-utils/stubs/saveDataStubFactory.js' describe('item selling', () => { test('item in inventory can be sold', async () => { diff --git a/src/game-logic/reducers/addExperience.js b/src/game-logic/reducers/addExperience.js index 4a2ae853b..8e6e2e032 100644 --- a/src/game-logic/reducers/addExperience.js +++ b/src/game-logic/reducers/addExperience.js @@ -1,6 +1,6 @@ -import { levelAchieved } from '../../utils/levelAchieved' +import { levelAchieved } from '../../utils/levelAchieved.js' -import { processLevelUp } from './processLevelUp' +import { processLevelUp } from './processLevelUp.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/addExperience.test.js b/src/game-logic/reducers/addExperience.test.js index a948cd222..3e1d73bb1 100644 --- a/src/game-logic/reducers/addExperience.test.js +++ b/src/game-logic/reducers/addExperience.test.js @@ -1,6 +1,6 @@ -import { experienceNeededForLevel } from '../../utils' +import { experienceNeededForLevel } from '../../utils/index.js' -import { addExperience } from './addExperience' +import { addExperience } from './addExperience.js' describe('addExperience', () => { let gameState diff --git a/src/game-logic/reducers/addItemToInventory.js b/src/game-logic/reducers/addItemToInventory.js index b9839c7fc..796763853 100644 --- a/src/game-logic/reducers/addItemToInventory.js +++ b/src/game-logic/reducers/addItemToInventory.js @@ -1,4 +1,4 @@ -import { inventorySpaceRemaining } from '../../utils' +import { inventorySpaceRemaining } from '../../utils/index.js' /** * Only adds as many items as there is room in the inventory for unless diff --git a/src/game-logic/reducers/addItemToInventory.test.js b/src/game-logic/reducers/addItemToInventory.test.js index 341dc6686..8139d6f7e 100644 --- a/src/game-logic/reducers/addItemToInventory.test.js +++ b/src/game-logic/reducers/addItemToInventory.test.js @@ -1,6 +1,6 @@ -import { INFINITE_STORAGE_LIMIT } from '../../constants' +import { INFINITE_STORAGE_LIMIT } from '../../constants.js' -import { addItemToInventory } from './addItemToInventory' +import { addItemToInventory } from './addItemToInventory.js' describe('addItemToInventory', () => { test('creates a new item in the inventory', () => { diff --git a/src/game-logic/reducers/addRevenue.js b/src/game-logic/reducers/addRevenue.js index 7c621ca84..4eefa01a5 100644 --- a/src/game-logic/reducers/addRevenue.js +++ b/src/game-logic/reducers/addRevenue.js @@ -1,4 +1,4 @@ -import { moneyTotal } from '../../utils' +import { moneyTotal } from '../../utils/index.js' // TODO: Add tests for this reducer /** diff --git a/src/game-logic/reducers/adjustLoan.js b/src/game-logic/reducers/adjustLoan.js index 8fa9aead8..6f0e28c2d 100644 --- a/src/game-logic/reducers/adjustLoan.js +++ b/src/game-logic/reducers/adjustLoan.js @@ -1,7 +1,7 @@ -import { moneyTotal } from '../../utils' -import { LOAN_INCREASED, LOAN_PAYOFF } from '../../templates' +import { moneyTotal } from '../../utils/index.js' +import { LOAN_INCREASED, LOAN_PAYOFF } from '../../templates.js' -import { showNotification } from './showNotification' +import { showNotification } from './showNotification.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/adjustLoan.test.js b/src/game-logic/reducers/adjustLoan.test.js index b669a34f0..e9181f613 100644 --- a/src/game-logic/reducers/adjustLoan.test.js +++ b/src/game-logic/reducers/adjustLoan.test.js @@ -1,6 +1,6 @@ -import { LOAN_INCREASED, LOAN_PAYOFF } from '../../templates' +import { LOAN_INCREASED, LOAN_PAYOFF } from '../../templates.js' -import { adjustLoan } from './adjustLoan' +import { adjustLoan } from './adjustLoan.js' describe('adjustLoan', () => { test('updates state', () => { diff --git a/src/game-logic/reducers/applyCrows.js b/src/game-logic/reducers/applyCrows.js index 2d16e94db..19d8c5a2b 100644 --- a/src/game-logic/reducers/applyCrows.js +++ b/src/game-logic/reducers/applyCrows.js @@ -1,12 +1,12 @@ -import { random } from '../../common/utils' -import { doesPlotContainCrop } from '../../utils' -import { CROW_CHANCE, MAX_CROWS } from '../../constants' -import { CROWS_DESTROYED } from '../../templates' +import { random } from '../../common/utils.js' +import { doesPlotContainCrop } from '../../utils/index.js' +import { CROW_CHANCE, MAX_CROWS } from '../../constants.js' +import { CROWS_DESTROYED } from '../../templates.js' -import { randomNumberService } from '../../common/services/randomNumber' +import { randomNumberService } from '../../common/services/randomNumber.js' -import { modifyFieldPlotAt } from './modifyFieldPlotAt' -import { fieldHasScarecrow } from './helpers' +import { modifyFieldPlotAt } from './modifyFieldPlotAt.js' +import { fieldHasScarecrow } from './helpers.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/applyCrows.test.js b/src/game-logic/reducers/applyCrows.test.js index d2058c59a..a086f908c 100644 --- a/src/game-logic/reducers/applyCrows.test.js +++ b/src/game-logic/reducers/applyCrows.test.js @@ -1,9 +1,9 @@ -import { MAX_CROWS, SCARECROW_ITEM_ID } from '../../constants' -import { findInField } from '../../utils/findInField' +import { MAX_CROWS, SCARECROW_ITEM_ID } from '../../constants.js' +import { findInField } from '../../utils/findInField.js' -import { randomNumberService } from '../../common/services/randomNumber' +import { randomNumberService } from '../../common/services/randomNumber.js' -import { applyCrows, forEachPlot } from './applyCrows' +import { applyCrows, forEachPlot } from './applyCrows.js' const CARROT = 'carrot' diff --git a/src/game-logic/reducers/applyLoanInterest.js b/src/game-logic/reducers/applyLoanInterest.js index 02e9ec634..d990b3c8c 100644 --- a/src/game-logic/reducers/applyLoanInterest.js +++ b/src/game-logic/reducers/applyLoanInterest.js @@ -1,6 +1,6 @@ -import { castToMoney, moneyTotal } from '../../utils' -import { LOAN_INTEREST_RATE } from '../../constants' -import { LOAN_BALANCE_NOTIFICATION } from '../../templates' +import { castToMoney, moneyTotal } from '../../utils/index.js' +import { LOAN_INTEREST_RATE } from '../../constants.js' +import { LOAN_BALANCE_NOTIFICATION } from '../../templates.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/applyLoanInterest.test.js b/src/game-logic/reducers/applyLoanInterest.test.js index 313455f9f..80e6cb008 100644 --- a/src/game-logic/reducers/applyLoanInterest.test.js +++ b/src/game-logic/reducers/applyLoanInterest.test.js @@ -1,4 +1,4 @@ -import { applyLoanInterest } from './applyLoanInterest' +import { applyLoanInterest } from './applyLoanInterest.js' describe('applyLoanInterest', () => { test('applies loan interest', () => { diff --git a/src/game-logic/reducers/applyPrecipitation.js b/src/game-logic/reducers/applyPrecipitation.js index 854b3120f..04c0299dc 100644 --- a/src/game-logic/reducers/applyPrecipitation.js +++ b/src/game-logic/reducers/applyPrecipitation.js @@ -1,19 +1,19 @@ -import { fertilizerType } from '../../enums' -import { getInventoryQuantityMap } from '../../utils/getInventoryQuantityMap' +import { fertilizerType } from '../../enums.js' +import { getInventoryQuantityMap } from '../../utils/getInventoryQuantityMap.js' import { RAIN_MESSAGE, STORM_MESSAGE, STORM_DESTROYS_SCARECROWS_MESSAGE, -} from '../../strings' -import { shouldStormToday } from '../../utils' +} from '../../strings.js' +import { shouldStormToday } from '../../utils/index.js' import { fieldHasScarecrow, plotContainsScarecrow, updateField, -} from './helpers' -import { decrementItemFromInventory } from './decrementItemFromInventory' -import { waterField } from './waterField' +} from './helpers.js' +import { decrementItemFromInventory } from './decrementItemFromInventory.js' +import { waterField } from './waterField.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/applyPrecipitation.test.js b/src/game-logic/reducers/applyPrecipitation.test.js index 0e5562aea..8e5397d66 100644 --- a/src/game-logic/reducers/applyPrecipitation.test.js +++ b/src/game-logic/reducers/applyPrecipitation.test.js @@ -1,17 +1,17 @@ -import { testCrop } from '../../test-utils' +import { testCrop } from '../../test-utils/index.js' import { RAIN_MESSAGE, STORM_MESSAGE, STORM_DESTROYS_SCARECROWS_MESSAGE, -} from '../../strings' -import { SCARECROW_ITEM_ID } from '../../constants' -import { fertilizerType } from '../../enums' -import { getPlotContentFromItemId } from '../../utils' +} from '../../strings.js' +import { SCARECROW_ITEM_ID } from '../../constants.js' +import { fertilizerType } from '../../enums.js' +import { getPlotContentFromItemId } from '../../utils/index.js' -import { applyPrecipitation } from './applyPrecipitation' +import { applyPrecipitation } from './applyPrecipitation.js' -vitest.mock('../../data/maps') -vitest.mock('../../data/items') +vitest.mock('../../data/maps.js') +vitest.mock('../../data/items.js') describe('applyPrecipitation', () => { test('waters all plots', () => { diff --git a/src/game-logic/reducers/changeCowAutomaticHugState.js b/src/game-logic/reducers/changeCowAutomaticHugState.js index 0c8bab927..40bb90016 100644 --- a/src/game-logic/reducers/changeCowAutomaticHugState.js +++ b/src/game-logic/reducers/changeCowAutomaticHugState.js @@ -1,10 +1,10 @@ -import { itemsMap } from '../../data/maps' -import { areHuggingMachinesInInventory } from '../../utils' -import { HUGGING_MACHINE_ITEM_ID } from '../../constants' +import { itemsMap } from '../../data/maps.js' +import { areHuggingMachinesInInventory } from '../../utils/index.js' +import { HUGGING_MACHINE_ITEM_ID } from '../../constants.js' -import { addItemToInventory } from './addItemToInventory' -import { decrementItemFromInventory } from './decrementItemFromInventory' -import { modifyCow } from './modifyCow' +import { addItemToInventory } from './addItemToInventory.js' +import { decrementItemFromInventory } from './decrementItemFromInventory.js' +import { modifyCow } from './modifyCow.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/changeCowAutomaticHugState.test.js b/src/game-logic/reducers/changeCowAutomaticHugState.test.js index 65cc6365f..b387ef88f 100644 --- a/src/game-logic/reducers/changeCowAutomaticHugState.test.js +++ b/src/game-logic/reducers/changeCowAutomaticHugState.test.js @@ -1,9 +1,9 @@ -import { huggingMachine } from '../../data/items' -import { generateCow } from '../../utils' +import { huggingMachine } from '../../data/items.js' +import { generateCow } from '../../utils/index.js' -import { INFINITE_STORAGE_LIMIT } from '../../constants' +import { INFINITE_STORAGE_LIMIT } from '../../constants.js' -import { changeCowAutomaticHugState } from './changeCowAutomaticHugState' +import { changeCowAutomaticHugState } from './changeCowAutomaticHugState.js' describe('changeCowAutomaticHugState', () => { describe('setting isUsingHuggingMachine to true', () => { diff --git a/src/game-logic/reducers/changeCowBreedingPenResident.js b/src/game-logic/reducers/changeCowBreedingPenResident.js index 17d3d3fcd..f2ab4d0ab 100644 --- a/src/game-logic/reducers/changeCowBreedingPenResident.js +++ b/src/game-logic/reducers/changeCowBreedingPenResident.js @@ -1,4 +1,4 @@ -import { COW_GESTATION_PERIOD_DAYS } from '../../constants' +import { COW_GESTATION_PERIOD_DAYS } from '../../constants.js' /** * @param {farmhand.cow} cow diff --git a/src/game-logic/reducers/changeCowBreedingPenResident.test.js b/src/game-logic/reducers/changeCowBreedingPenResident.test.js index 6fe87bd88..7da2bb2b2 100644 --- a/src/game-logic/reducers/changeCowBreedingPenResident.test.js +++ b/src/game-logic/reducers/changeCowBreedingPenResident.test.js @@ -1,7 +1,7 @@ -import { COW_GESTATION_PERIOD_DAYS } from '../../constants' -import { generateCow } from '../../utils' +import { COW_GESTATION_PERIOD_DAYS } from '../../constants.js' +import { generateCow } from '../../utils/index.js' -import { changeCowBreedingPenResident } from './changeCowBreedingPenResident' +import { changeCowBreedingPenResident } from './changeCowBreedingPenResident.js' const cowA = generateCow({ id: 'cow-a' }) const cowB = generateCow({ id: 'cow-b' }) diff --git a/src/game-logic/reducers/changeCowName.js b/src/game-logic/reducers/changeCowName.js index d2f4a7146..0e84c8475 100644 --- a/src/game-logic/reducers/changeCowName.js +++ b/src/game-logic/reducers/changeCowName.js @@ -1,6 +1,6 @@ -import { MAX_ANIMAL_NAME_LENGTH } from '../../constants' +import { MAX_ANIMAL_NAME_LENGTH } from '../../constants.js' -import { modifyCow } from './modifyCow' +import { modifyCow } from './modifyCow.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/changeCowName.test.js b/src/game-logic/reducers/changeCowName.test.js index 02cef1b70..d483f869a 100644 --- a/src/game-logic/reducers/changeCowName.test.js +++ b/src/game-logic/reducers/changeCowName.test.js @@ -1,7 +1,7 @@ -import { MAX_ANIMAL_NAME_LENGTH } from '../../constants' -import { generateCow } from '../../utils' +import { MAX_ANIMAL_NAME_LENGTH } from '../../constants.js' +import { generateCow } from '../../utils/index.js' -import { changeCowName } from './changeCowName' +import { changeCowName } from './changeCowName.js' describe('changeCowName', () => { test('updates cow name', () => { diff --git a/src/game-logic/reducers/clearPlot.js b/src/game-logic/reducers/clearPlot.js index c026397fd..3834c4202 100644 --- a/src/game-logic/reducers/clearPlot.js +++ b/src/game-logic/reducers/clearPlot.js @@ -1,16 +1,16 @@ -import { cropLifeStage, itemType, toolType } from '../../enums' -import { itemsMap } from '../../data/maps' +import { cropLifeStage, itemType, toolType } from '../../enums.js' +import { itemsMap } from '../../data/maps.js' import { doesInventorySpaceRemain, getCropLifeStage, getPlotContentType, getSeedItemIdFromFinalStageCropItemId, -} from '../../utils' -import { HOE_LEVEL_TO_SEED_RECLAIM_RATE } from '../../constants' -import { randomNumberService } from '../../common/services/randomNumber' +} from '../../utils/index.js' +import { HOE_LEVEL_TO_SEED_RECLAIM_RATE } from '../../constants.js' +import { randomNumberService } from '../../common/services/randomNumber.js' -import { addItemToInventory } from './addItemToInventory' -import { removeFieldPlotAt } from './removeFieldPlotAt' +import { addItemToInventory } from './addItemToInventory.js' +import { removeFieldPlotAt } from './removeFieldPlotAt.js' const { GROWN } = cropLifeStage diff --git a/src/game-logic/reducers/clearPlot.test.js b/src/game-logic/reducers/clearPlot.test.js index 2cb8b03d0..5cb6ee6bd 100644 --- a/src/game-logic/reducers/clearPlot.test.js +++ b/src/game-logic/reducers/clearPlot.test.js @@ -1,12 +1,12 @@ -import { testCrop } from '../../test-utils' -import { toolType, toolLevel } from '../../enums' -import { getPlotContentFromItemId } from '../../utils' -import { INFINITE_STORAGE_LIMIT } from '../../constants' -import { randomNumberService } from '../../common/services/randomNumber' +import { testCrop } from '../../test-utils/index.js' +import { toolType, toolLevel } from '../../enums.js' +import { getPlotContentFromItemId } from '../../utils/index.js' +import { INFINITE_STORAGE_LIMIT } from '../../constants.js' +import { randomNumberService } from '../../common/services/randomNumber.js' -import { clearPlot } from './clearPlot' +import { clearPlot } from './clearPlot.js' -vitest.mock('../../data/maps') +vitest.mock('../../data/maps.js') describe('clearPlot', () => { describe('plotContent is a crop', () => { diff --git a/src/game-logic/reducers/computeCowInventoryForNextDay.js b/src/game-logic/reducers/computeCowInventoryForNextDay.js index 6ff8a5eb2..85fe9bbf5 100644 --- a/src/game-logic/reducers/computeCowInventoryForNextDay.js +++ b/src/game-logic/reducers/computeCowInventoryForNextDay.js @@ -1,4 +1,4 @@ -import { COW_HUG_BENEFIT, MAX_DAILY_COW_HUG_BENEFITS } from '../../constants' +import { COW_HUG_BENEFIT, MAX_DAILY_COW_HUG_BENEFITS } from '../../constants.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/computeCowInventoryForNextDay.test.js b/src/game-logic/reducers/computeCowInventoryForNextDay.test.js index 2f41b20bc..8ca265d6c 100644 --- a/src/game-logic/reducers/computeCowInventoryForNextDay.test.js +++ b/src/game-logic/reducers/computeCowInventoryForNextDay.test.js @@ -1,6 +1,6 @@ -import { COW_HUG_BENEFIT, MAX_DAILY_COW_HUG_BENEFITS } from '../../constants' +import { COW_HUG_BENEFIT, MAX_DAILY_COW_HUG_BENEFITS } from '../../constants.js' -import { computeCowInventoryForNextDay } from './computeCowInventoryForNextDay' +import { computeCowInventoryForNextDay } from './computeCowInventoryForNextDay.js' describe('computeCowInventoryForNextDay', () => { test('ages cows', () => { diff --git a/src/game-logic/reducers/computeStateForNextDay.js b/src/game-logic/reducers/computeStateForNextDay.js index 13e97235f..b906a91cb 100644 --- a/src/game-logic/reducers/computeStateForNextDay.js +++ b/src/game-logic/reducers/computeStateForNextDay.js @@ -1,25 +1,25 @@ -import { generateCow } from '../../utils' -import { generateValueAdjustments } from '../../common/utils' -import { EXPERIENCE_VALUES } from '../../constants' +import { generateCow } from '../../utils/index.js' +import { generateValueAdjustments } from '../../common/utils.js' +import { EXPERIENCE_VALUES } from '../../constants.js' -import { addExperience } from './addExperience' -import { applyLoanInterest } from './applyLoanInterest' -import { computeCowInventoryForNextDay } from './computeCowInventoryForNextDay' -import { generatePriceEvents } from './generatePriceEvents' -import { processCellar } from './processCellar' -import { processCowAttrition } from './processCowAttrition' -import { processCowBreeding } from './processCowBreeding' -import { processCowFertilizerProduction } from './processCowFertilizerProduction' -import { processFeedingCows } from './processFeedingCows' -import { processField } from './processField' -import { processMilkingCows } from './processMilkingCows' -import { processNerfs } from './processNerfs' -import { processSprinklers } from './processSprinklers' -import { processWeather } from './processWeather' -import { rotateNotificationLogs } from './rotateNotificationLogs' -import { updateFinancialRecords } from './updateFinancialRecords' -import { updateInventoryRecordsForNextDay } from './updateInventoryRecordsForNextDay' -import { updatePriceEvents } from './updatePriceEvents' +import { addExperience } from './addExperience.js' +import { applyLoanInterest } from './applyLoanInterest.js' +import { computeCowInventoryForNextDay } from './computeCowInventoryForNextDay.js' +import { generatePriceEvents } from './generatePriceEvents.js' +import { processCellar } from './processCellar.js' +import { processCowAttrition } from './processCowAttrition.js' +import { processCowBreeding } from './processCowBreeding.js' +import { processCowFertilizerProduction } from './processCowFertilizerProduction.js' +import { processFeedingCows } from './processFeedingCows.js' +import { processField } from './processField.js' +import { processMilkingCows } from './processMilkingCows.js' +import { processNerfs } from './processNerfs.js' +import { processSprinklers } from './processSprinklers.js' +import { processWeather } from './processWeather.js' +import { rotateNotificationLogs } from './rotateNotificationLogs.js' +import { updateFinancialRecords } from './updateFinancialRecords.js' +import { updateInventoryRecordsForNextDay } from './updateInventoryRecordsForNextDay.js' +import { updatePriceEvents } from './updatePriceEvents.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/computeStateForNextDay.test.js b/src/game-logic/reducers/computeStateForNextDay.test.js index 1d2bc8d87..420559b4b 100644 --- a/src/game-logic/reducers/computeStateForNextDay.test.js +++ b/src/game-logic/reducers/computeStateForNextDay.test.js @@ -1,10 +1,10 @@ -import { shapeOf, testCrop } from '../../test-utils' -import { generateCow } from '../../utils' -import { EXPERIENCE_VALUES } from '../../constants' +import { shapeOf, testCrop } from '../../test-utils/index.js' +import { generateCow } from '../../utils/index.js' +import { EXPERIENCE_VALUES } from '../../constants.js' -import { computeStateForNextDay } from './computeStateForNextDay' +import { computeStateForNextDay } from './computeStateForNextDay.js' -vitest.mock('../../data/maps') +vitest.mock('../../data/maps.js') describe('computeStateForNextDay', () => { let state diff --git a/src/game-logic/reducers/createPriceEvent.test.js b/src/game-logic/reducers/createPriceEvent.test.js index a5494c9fe..a2d47f4fc 100644 --- a/src/game-logic/reducers/createPriceEvent.test.js +++ b/src/game-logic/reducers/createPriceEvent.test.js @@ -1,8 +1,8 @@ -import { sampleCropItem1 } from '../../data/items' +import { sampleCropItem1 } from '../../data/items.js' -import { createPriceEvent } from './createPriceEvent' +import { createPriceEvent } from './createPriceEvent.js' -vitest.mock('../../data/items') +vitest.mock('../../data/items.js') describe('createPriceEvent', () => { test('creates priceCrashes data', () => { diff --git a/src/game-logic/reducers/decrementItemFromInventory.test.js b/src/game-logic/reducers/decrementItemFromInventory.test.js index 681f927e9..c767f4146 100644 --- a/src/game-logic/reducers/decrementItemFromInventory.test.js +++ b/src/game-logic/reducers/decrementItemFromInventory.test.js @@ -1,6 +1,6 @@ -import { testItem } from '../../test-utils' +import { testItem } from '../../test-utils/index.js' -import { decrementItemFromInventory } from './decrementItemFromInventory' +import { decrementItemFromInventory } from './decrementItemFromInventory.js' describe('decrementItemFromInventory', () => { let updatedState diff --git a/src/game-logic/reducers/fertilizePlot.js b/src/game-logic/reducers/fertilizePlot.js index 84e34c390..a8675c76b 100644 --- a/src/game-logic/reducers/fertilizePlot.js +++ b/src/game-logic/reducers/fertilizePlot.js @@ -1,9 +1,9 @@ -import { fieldMode, fertilizerType, itemType } from '../../enums' -import { itemsMap } from '../../data/maps' -import { getPlotContentType } from '../../utils' +import { fieldMode, fertilizerType, itemType } from '../../enums.js' +import { itemsMap } from '../../data/maps.js' +import { getPlotContentType } from '../../utils/index.js' -import { decrementItemFromInventory } from './decrementItemFromInventory' -import { modifyFieldPlotAt } from './modifyFieldPlotAt' +import { decrementItemFromInventory } from './decrementItemFromInventory.js' +import { modifyFieldPlotAt } from './modifyFieldPlotAt.js' const { FERTILIZE, OBSERVE } = fieldMode diff --git a/src/game-logic/reducers/fertilizePlot.test.js b/src/game-logic/reducers/fertilizePlot.test.js index 1f5006957..f7b278af1 100644 --- a/src/game-logic/reducers/fertilizePlot.test.js +++ b/src/game-logic/reducers/fertilizePlot.test.js @@ -1,10 +1,10 @@ -import { testCrop, testItem } from '../../test-utils' -import { fertilizerType, fieldMode } from '../../enums' -import { getPlotContentFromItemId } from '../../utils' +import { testCrop, testItem } from '../../test-utils/index.js' +import { fertilizerType, fieldMode } from '../../enums.js' +import { getPlotContentFromItemId } from '../../utils/index.js' -import { fertilizePlot } from './fertilizePlot' +import { fertilizePlot } from './fertilizePlot.js' -vitest.mock('../../data/maps') +vitest.mock('../../data/maps.js') describe('fertilizePlot', () => { describe('no fertilizer in inventory', () => { diff --git a/src/game-logic/reducers/forRange.test.js b/src/game-logic/reducers/forRange.test.js index 2f0b7565e..2aba4adc0 100644 --- a/src/game-logic/reducers/forRange.test.js +++ b/src/game-logic/reducers/forRange.test.js @@ -1,9 +1,9 @@ -import { testCrop } from '../../test-utils' +import { testCrop } from '../../test-utils/index.js' -import { waterPlot } from './waterPlot' -import { forRange } from './forRange' +import { waterPlot } from './waterPlot.js' +import { forRange } from './forRange.js' -vitest.mock('../../data/maps') +vitest.mock('../../data/maps.js') describe('forRange', () => { test('calls given reducer on range of plots', () => { diff --git a/src/game-logic/reducers/generatePriceEvents.js b/src/game-logic/reducers/generatePriceEvents.js index b3b40f803..dea623da1 100644 --- a/src/game-logic/reducers/generatePriceEvents.js +++ b/src/game-logic/reducers/generatePriceEvents.js @@ -1,15 +1,15 @@ -import { levelAchieved } from '../../utils/levelAchieved' +import { levelAchieved } from '../../utils/levelAchieved.js' import { filterItemIdsToSeeds, getPriceEventForCrop, getRandomUnlockedCrop, -} from '../../utils' -import { getLevelEntitlements } from '../../utils/getLevelEntitlements' -import { PRICE_EVENT_CHANCE } from '../../constants' -import { PRICE_CRASH, PRICE_SURGE } from '../../templates' -import { random } from '../../common/utils' +} from '../../utils/index.js' +import { getLevelEntitlements } from '../../utils/getLevelEntitlements.js' +import { PRICE_EVENT_CHANCE } from '../../constants.js' +import { PRICE_CRASH, PRICE_SURGE } from '../../templates.js' +import { random } from '../../common/utils.js' -import { createPriceEvent } from './createPriceEvent' +import { createPriceEvent } from './createPriceEvent.js' const TYPE_CRASH = 'priceCrashes' const TYPE_SURGE = 'priceSurges' diff --git a/src/game-logic/reducers/generatePriceEvents.test.js b/src/game-logic/reducers/generatePriceEvents.test.js index aa67a10f1..7fed13676 100644 --- a/src/game-logic/reducers/generatePriceEvents.test.js +++ b/src/game-logic/reducers/generatePriceEvents.test.js @@ -1,11 +1,11 @@ -import { PRICE_CRASH, PRICE_SURGE } from '../../templates' -import { sampleCropItem1 } from '../../data/items' -import { getPriceEventForCrop } from '../../utils' +import { PRICE_CRASH, PRICE_SURGE } from '../../templates.js' +import { sampleCropItem1 } from '../../data/items.js' +import { getPriceEventForCrop } from '../../utils/index.js' -import { generatePriceEvents } from './generatePriceEvents' +import { generatePriceEvents } from './generatePriceEvents.js' -vitest.mock('../../data/levels', () => ({ levels: [], itemUnlockLevels: {} })) -vitest.mock('../../data/items') +vitest.mock('../../data/levels.js', () => ({ levels: [], itemUnlockLevels: {} })) +vitest.mock('../../data/items.js') describe('generatePriceEvents', () => { describe('price event already exists', () => { @@ -35,7 +35,7 @@ describe('generatePriceEvents', () => { vitest.spyOn(Math, 'random').mockReturnValue(0) vitest.resetModules() - vitest.mock('../../data/levels', () => ({ + vitest.mock('../../data/levels.js', () => ({ levels: [ { id: 0, diff --git a/src/game-logic/reducers/harvestPlot.js b/src/game-logic/reducers/harvestPlot.js index f80e0b375..daed7149d 100644 --- a/src/game-logic/reducers/harvestPlot.js +++ b/src/game-logic/reducers/harvestPlot.js @@ -4,20 +4,20 @@ import { itemType, toolLevel, toolType, -} from '../../enums' -import { itemsMap } from '../../data/maps' +} from '../../enums.js' +import { itemsMap } from '../../data/maps.js' import { doesInventorySpaceRemain, getCropLifeStage, getPlotContentType, getSeedItemIdFromFinalStageCropItemId, -} from '../../utils' -import { getInventoryQuantityMap } from '../../utils/getInventoryQuantityMap' +} from '../../utils/index.js' +import { getInventoryQuantityMap } from '../../utils/getInventoryQuantityMap.js' -import { addItemToInventory } from './addItemToInventory' -import { modifyFieldPlotAt } from './modifyFieldPlotAt' -import { removeFieldPlotAt } from './removeFieldPlotAt' -import { plantInPlot } from './plantInPlot' +import { addItemToInventory } from './addItemToInventory.js' +import { modifyFieldPlotAt } from './modifyFieldPlotAt.js' +import { removeFieldPlotAt } from './removeFieldPlotAt.js' +import { plantInPlot } from './plantInPlot.js' const { GROWN } = cropLifeStage diff --git a/src/game-logic/reducers/harvestPlot.test.js b/src/game-logic/reducers/harvestPlot.test.js index debf4c17d..866f0e395 100644 --- a/src/game-logic/reducers/harvestPlot.test.js +++ b/src/game-logic/reducers/harvestPlot.test.js @@ -1,13 +1,13 @@ -import { testCrop, testItem } from '../../test-utils' -import { fertilizerType, toolType, toolLevel } from '../../enums' -import { getPlotContentFromItemId } from '../../utils' +import { testCrop, testItem } from '../../test-utils/index.js' +import { fertilizerType, toolType, toolLevel } from '../../enums.js' +import { getPlotContentFromItemId } from '../../utils/index.js' -import { INFINITE_STORAGE_LIMIT } from '../../constants' -import { itemType } from '../../enums' +import { INFINITE_STORAGE_LIMIT } from '../../constants.js' +import { itemType } from '../../enums.js' -import { harvestPlot } from './harvestPlot' +import { harvestPlot } from './harvestPlot.js' -vitest.mock('../../data/maps') +vitest.mock('../../data/maps.js') describe('harvestPlot', () => { const toolLevelsDefault = { diff --git a/src/game-logic/reducers/helpers.js b/src/game-logic/reducers/helpers.js index 845f6cafc..f0dea6d97 100644 --- a/src/game-logic/reducers/helpers.js +++ b/src/game-logic/reducers/helpers.js @@ -1,8 +1,8 @@ -import { itemType } from '../../enums' +import { itemType } from '../../enums.js' -import { SCARECROW_ITEM_ID } from '../../constants' -import { getPlotContentType } from '../../utils' -import { findInField } from '../../utils/findInField' +import { SCARECROW_ITEM_ID } from '../../constants.js' +import { getPlotContentType } from '../../utils/index.js' +import { findInField } from '../../utils/findInField.js' // This file is designed to contain common logic that is needed across multiple // reducers. diff --git a/src/game-logic/reducers/hugCow.js b/src/game-logic/reducers/hugCow.js index 4a72fcd08..90f292a07 100644 --- a/src/game-logic/reducers/hugCow.js +++ b/src/game-logic/reducers/hugCow.js @@ -1,6 +1,6 @@ -import { COW_HUG_BENEFIT, MAX_DAILY_COW_HUG_BENEFITS } from '../../constants' +import { COW_HUG_BENEFIT, MAX_DAILY_COW_HUG_BENEFITS } from '../../constants.js' -import { modifyCow } from './modifyCow' +import { modifyCow } from './modifyCow.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/hugCow.test.js b/src/game-logic/reducers/hugCow.test.js index 43c741e6c..11e60ca5a 100644 --- a/src/game-logic/reducers/hugCow.test.js +++ b/src/game-logic/reducers/hugCow.test.js @@ -1,7 +1,7 @@ -import { COW_HUG_BENEFIT } from '../../constants' -import { generateCow } from '../../utils' +import { COW_HUG_BENEFIT } from '../../constants.js' +import { generateCow } from '../../utils/index.js' -import { hugCow } from './hugCow' +import { hugCow } from './hugCow.js' describe('hugCow', () => { describe('cow has not hit daily hug benefit limit', () => { diff --git a/src/game-logic/reducers/incrementPlotContentAge.js b/src/game-logic/reducers/incrementPlotContentAge.js index 395d8d338..fa6b4f841 100644 --- a/src/game-logic/reducers/incrementPlotContentAge.js +++ b/src/game-logic/reducers/incrementPlotContentAge.js @@ -1,6 +1,6 @@ -import { fertilizerType, itemType } from '../../enums' -import { getPlotContentType } from '../../utils' -import { FERTILIZER_BONUS } from '../../constants' +import { fertilizerType, itemType } from '../../enums.js' +import { getPlotContentType } from '../../utils/index.js' +import { FERTILIZER_BONUS } from '../../constants.js' /** * @param {?farmhand.crop} crop diff --git a/src/game-logic/reducers/incrementPlotContentAge.test.js b/src/game-logic/reducers/incrementPlotContentAge.test.js index 7ed8da5e4..8f3d46bcd 100644 --- a/src/game-logic/reducers/incrementPlotContentAge.test.js +++ b/src/game-logic/reducers/incrementPlotContentAge.test.js @@ -1,11 +1,11 @@ -import { testCrop } from '../../test-utils' -import { FERTILIZER_BONUS } from '../../constants' -import { fertilizerType } from '../../enums' +import { testCrop } from '../../test-utils/index.js' +import { FERTILIZER_BONUS } from '../../constants.js' +import { fertilizerType } from '../../enums.js' -import { incrementPlotContentAge } from './incrementPlotContentAge' +import { incrementPlotContentAge } from './incrementPlotContentAge.js' -vitest.mock('../../data/maps') -vitest.mock('../../data/items') +vitest.mock('../../data/maps.js') +vitest.mock('../../data/items.js') describe('incrementPlotContentAge', () => { describe('plot contains a crop', () => { diff --git a/src/game-logic/reducers/index.js b/src/game-logic/reducers/index.js index b65484425..127beb408 100644 --- a/src/game-logic/reducers/index.js +++ b/src/game-logic/reducers/index.js @@ -3,79 +3,79 @@ * @ignore */ -export * from './addCowToInventory' -export * from './addExperience' -export * from './addItemToInventory' -export * from './addPeer' -export * from './addRevenue' -export * from './adjustLoan' -export * from './applyPrecipitation' -export * from './changeCowAutomaticHugState' -export * from './changeCowBreedingPenResident' -export * from './changeCowName' -export * from './clearPlot' -export * from './computeCowInventoryForNextDay' -export * from './computeStateForNextDay' -export * from './createPriceEvent' -export * from './decrementItemFromInventory' -export * from './fertilizePlot' -export * from './forRange' -export * from './generatePriceEvents' -export * from './harvestPlot' -export * from './hugCow' -export * from './incrementPlotContentAge' -export * from './makeRecipe' -export * from './makeFermentationRecipe' -export * from './makeWine' -export * from './minePlot' -export * from './modifyCow' -export * from './modifyFieldPlotAt' -export * from './offerCow' -export * from './plantInPlot' -export * from './prependPendingPeerMessage' -export * from './processCowAttrition' -export * from './processCowBreeding' -export * from './processCowFertilizerProduction' -export * from './processFeedingCows' -export * from './processField' -export * from './processLevelUp' -export * from './processMilkingCows' -export * from './processNerfs' -export * from './processSprinklers' -export * from './processWeather' -export * from './purchaseCombine' -export * from './purchaseComposter' -export * from './purchaseCow' -export * from './purchaseCowPen' -export * from './purchaseCellar' -export * from './purchaseField' -export * from './purchaseForest' -export * from './purchaseItem' -export * from './purchaseSmelter' -export * from './purchaseStorageExpansion' -export * from './removeCowFromInventory' -export * from './removeFieldPlotAt' -export * from './removeKegFromCellar' -export * from './removePeer' -export * from './rotateNotificationLogs' -export * from './selectCow' -export * from './sellCow' -export * from './sellItem' -export * from './sellKeg' -export * from './setScarecrow' -export * from './setSprinkler' -export * from './showNotification' -export * from './spawnWeeds' -export * from './unlockTool' -export * from './updateAchievements' -export * from './updateFinancialRecords' -export * from './updateInventoryRecordsForNextDay' -export * from './updateLearnedRecipes' -export * from './updatePeer' -export * from './updatePlotShoveledState' -export * from './updatePriceEvents' -export * from './upgradeTool' -export * from './waterAllPlots' -export * from './waterField' -export * from './waterPlot' -export * from './withdrawCow' +export * from './addCowToInventory.js' +export * from './addExperience.js' +export * from './addItemToInventory.js' +export * from './addPeer.js' +export * from './addRevenue.js' +export * from './adjustLoan.js' +export * from './applyPrecipitation.js' +export * from './changeCowAutomaticHugState.js' +export * from './changeCowBreedingPenResident.js' +export * from './changeCowName.js' +export * from './clearPlot.js' +export * from './computeCowInventoryForNextDay.js' +export * from './computeStateForNextDay.js' +export * from './createPriceEvent.js' +export * from './decrementItemFromInventory.js' +export * from './fertilizePlot.js' +export * from './forRange.js' +export * from './generatePriceEvents.js' +export * from './harvestPlot.js' +export * from './hugCow.js' +export * from './incrementPlotContentAge.js' +export * from './makeRecipe.js' +export * from './makeFermentationRecipe.js' +export * from './makeWine.js' +export * from './minePlot.js' +export * from './modifyCow.js' +export * from './modifyFieldPlotAt.js' +export * from './offerCow.js' +export * from './plantInPlot.js' +export * from './prependPendingPeerMessage.js' +export * from './processCowAttrition.js' +export * from './processCowBreeding.js' +export * from './processCowFertilizerProduction.js' +export * from './processFeedingCows.js' +export * from './processField.js' +export * from './processLevelUp.js' +export * from './processMilkingCows.js' +export * from './processNerfs.js' +export * from './processSprinklers.js' +export * from './processWeather.js' +export * from './purchaseCombine.js' +export * from './purchaseComposter.js' +export * from './purchaseCow.js' +export * from './purchaseCowPen.js' +export * from './purchaseCellar.js' +export * from './purchaseField.js' +export * from './purchaseForest.js' +export * from './purchaseItem.js' +export * from './purchaseSmelter.js' +export * from './purchaseStorageExpansion.js' +export * from './removeCowFromInventory.js' +export * from './removeFieldPlotAt.js' +export * from './removeKegFromCellar.js' +export * from './removePeer.js' +export * from './rotateNotificationLogs.js' +export * from './selectCow.js' +export * from './sellCow.js' +export * from './sellItem.js' +export * from './sellKeg.js' +export * from './setScarecrow.js' +export * from './setSprinkler.js' +export * from './showNotification.js' +export * from './spawnWeeds.js' +export * from './unlockTool.js' +export * from './updateAchievements.js' +export * from './updateFinancialRecords.js' +export * from './updateInventoryRecordsForNextDay.js' +export * from './updateLearnedRecipes.js' +export * from './updatePeer.js' +export * from './updatePlotShoveledState.js' +export * from './updatePriceEvents.js' +export * from './upgradeTool.js' +export * from './waterAllPlots.js' +export * from './waterField.js' +export * from './waterPlot.js' +export * from './withdrawCow.js' diff --git a/src/game-logic/reducers/makeFermentationRecipe.js b/src/game-logic/reducers/makeFermentationRecipe.js index ae01ef37b..5768c4d1a 100644 --- a/src/game-logic/reducers/makeFermentationRecipe.js +++ b/src/game-logic/reducers/makeFermentationRecipe.js @@ -4,14 +4,14 @@ * @typedef {import("../../components/Farmhand/Farmhand").farmhand.state} state */ -import { PURCHASEABLE_CELLARS } from '../../constants' -import { itemsMap } from '../../data/maps' -import { getSaltRequirementsForFermentationRecipe } from '../../utils/getSaltRequirementsForFermentationRecipe' -import { getMaxYieldOfFermentationRecipe } from '../../utils/getMaxYieldOfFermentationRecipe' -import { cellarService } from '../../services/cellar' - -import { addKegToCellarInventory } from './addKegToCellarInventory' -import { decrementItemFromInventory } from './decrementItemFromInventory' +import { PURCHASEABLE_CELLARS } from '../../constants.js' +import { itemsMap } from '../../data/maps.js' +import { getSaltRequirementsForFermentationRecipe } from '../../utils/getSaltRequirementsForFermentationRecipe.js' +import { getMaxYieldOfFermentationRecipe } from '../../utils/getMaxYieldOfFermentationRecipe.js' +import { cellarService } from '../../services/cellar.js' + +import { addKegToCellarInventory } from './addKegToCellarInventory.js' +import { decrementItemFromInventory } from './decrementItemFromInventory.js' /** * @param {state} state diff --git a/src/game-logic/reducers/makeFermentationRecipe.test.js b/src/game-logic/reducers/makeFermentationRecipe.test.js index cb31765c8..113aff0f3 100644 --- a/src/game-logic/reducers/makeFermentationRecipe.test.js +++ b/src/game-logic/reducers/makeFermentationRecipe.test.js @@ -1,7 +1,7 @@ -import { carrot } from '../../data/crops' -import { salt } from '../../data/recipes' +import { carrot } from '../../data/crops/index.js' +import { salt } from '../../data/recipes.js' -import { makeFermentationRecipe } from './makeFermentationRecipe' +import { makeFermentationRecipe } from './makeFermentationRecipe.js' describe('makeFermentationRecipe', () => { test.each([ diff --git a/src/game-logic/reducers/makeRecipe.js b/src/game-logic/reducers/makeRecipe.js index aa8e6b4f3..afd40892d 100644 --- a/src/game-logic/reducers/makeRecipe.js +++ b/src/game-logic/reducers/makeRecipe.js @@ -1,12 +1,12 @@ -import { canMakeRecipe } from '../../utils' +import { canMakeRecipe } from '../../utils/index.js' -import { recipeType } from '../../enums' +import { recipeType } from '../../enums.js' -import { EXPERIENCE_VALUES } from '../../constants' +import { EXPERIENCE_VALUES } from '../../constants.js' -import { addItemToInventory } from './addItemToInventory' -import { addExperience } from './addExperience' -import { decrementItemFromInventory } from './decrementItemFromInventory' +import { addItemToInventory } from './addItemToInventory.js' +import { addExperience } from './addExperience.js' +import { decrementItemFromInventory } from './decrementItemFromInventory.js' const EXPERIENCE_FOR_RECIPE = { [recipeType.FERMENTATION]: EXPERIENCE_VALUES.FERMENTATION_RECIPE_MADE, diff --git a/src/game-logic/reducers/makeRecipe.test.js b/src/game-logic/reducers/makeRecipe.test.js index 4e73ded7c..3c165f9bc 100644 --- a/src/game-logic/reducers/makeRecipe.test.js +++ b/src/game-logic/reducers/makeRecipe.test.js @@ -1,11 +1,11 @@ -import { carrotSoup } from '../../data/recipes' -import { carrot } from '../../data/crops' +import { carrotSoup } from '../../data/recipes.js' +import { carrot } from '../../data/crops/index.js' -import { EXPERIENCE_VALUES, INFINITE_STORAGE_LIMIT } from '../../constants' +import { EXPERIENCE_VALUES, INFINITE_STORAGE_LIMIT } from '../../constants.js' -import { recipeType } from '../../enums' +import { recipeType } from '../../enums.js' -import { makeRecipe } from './makeRecipe' +import { makeRecipe } from './makeRecipe.js' describe('makeRecipe', () => { describe('there are insufficient ingredients for recipe', () => { diff --git a/src/game-logic/reducers/makeWine.js b/src/game-logic/reducers/makeWine.js index c8460d9a9..2751b9ab3 100644 --- a/src/game-logic/reducers/makeWine.js +++ b/src/game-logic/reducers/makeWine.js @@ -5,14 +5,14 @@ * @typedef {import("../../components/Farmhand/Farmhand").farmhand.state} state */ -import { GRAPES_REQUIRED_FOR_WINE, PURCHASEABLE_CELLARS } from '../../constants' -import { itemsMap } from '../../data/maps' -import { cellarService } from '../../services/cellar' -import { wineService } from '../../services/wine' -import { getYeastRequiredForWine } from '../../utils/getYeastRequiredForWine' - -import { addKegToCellarInventory } from './addKegToCellarInventory' -import { decrementItemFromInventory } from './decrementItemFromInventory' +import { GRAPES_REQUIRED_FOR_WINE, PURCHASEABLE_CELLARS } from '../../constants.js' +import { itemsMap } from '../../data/maps.js' +import { cellarService } from '../../services/cellar.js' +import { wineService } from '../../services/wine.js' +import { getYeastRequiredForWine } from '../../utils/getYeastRequiredForWine.js' + +import { addKegToCellarInventory } from './addKegToCellarInventory.js' +import { decrementItemFromInventory } from './decrementItemFromInventory.js' /** * @param {state} state diff --git a/src/game-logic/reducers/makeWine.test.js b/src/game-logic/reducers/makeWine.test.js index 0d068b209..e357f8768 100644 --- a/src/game-logic/reducers/makeWine.test.js +++ b/src/game-logic/reducers/makeWine.test.js @@ -2,13 +2,13 @@ * @typedef {import("../../components/Farmhand/Farmhand").farmhand.state} state */ -import { GRAPES_REQUIRED_FOR_WINE } from '../../constants' -import { grapeChardonnay } from '../../data/crops' -import { yeast, wineChardonnay } from '../../data/recipes' -import { cellarService } from '../../services/cellar' -import { getYeastRequiredForWine } from '../../utils/getYeastRequiredForWine' +import { GRAPES_REQUIRED_FOR_WINE } from '../../constants.js' +import { grapeChardonnay } from '../../data/crops/index.js' +import { yeast, wineChardonnay } from '../../data/recipes.js' +import { cellarService } from '../../services/cellar.js' +import { getYeastRequiredForWine } from '../../utils/getYeastRequiredForWine.js' -import { makeWine } from './makeWine' +import { makeWine } from './makeWine.js' const stubKegUuid = 'abc123' diff --git a/src/game-logic/reducers/minePlot.js b/src/game-logic/reducers/minePlot.js index dc2cdcfe1..1faf8b88e 100644 --- a/src/game-logic/reducers/minePlot.js +++ b/src/game-logic/reducers/minePlot.js @@ -1,12 +1,12 @@ -import { toolType } from '../../enums' -import { chooseRandom, doesInventorySpaceRemain } from '../../utils' -import { INVENTORY_FULL_NOTIFICATION } from '../../strings' -import { ResourceFactory } from '../../factories' -import { random } from '../../common/utils' +import { toolType } from '../../enums.js' +import { chooseRandom, doesInventorySpaceRemain } from '../../utils/index.js' +import { INVENTORY_FULL_NOTIFICATION } from '../../strings.js' +import { ResourceFactory } from '../../factories/index.js' +import { random } from '../../common/utils.js' -import { addItemToInventory } from './addItemToInventory' -import { showNotification } from './showNotification' -import { modifyFieldPlotAt } from './modifyFieldPlotAt' +import { addItemToInventory } from './addItemToInventory.js' +import { showNotification } from './showNotification.js' +import { modifyFieldPlotAt } from './modifyFieldPlotAt.js' const daysUntilClearPeriods = [1, 2, 2, 3] diff --git a/src/game-logic/reducers/minePlot.test.js b/src/game-logic/reducers/minePlot.test.js index 61f7bb120..bf0a7f462 100644 --- a/src/game-logic/reducers/minePlot.test.js +++ b/src/game-logic/reducers/minePlot.test.js @@ -1,9 +1,9 @@ -import { randomNumberService } from '../../common/services/randomNumber' -import { goldOre } from '../../data/ores' -import { ResourceFactory } from '../../factories' -import { toolType, toolLevel } from '../../enums' +import { randomNumberService } from '../../common/services/randomNumber.js' +import { goldOre } from '../../data/ores/index.js' +import { ResourceFactory } from '../../factories/index.js' +import { toolType, toolLevel } from '../../enums.js' -import { minePlot } from './minePlot' +import { minePlot } from './minePlot.js' describe('minePlot', () => { let gameState diff --git a/src/game-logic/reducers/offerCow.test.js b/src/game-logic/reducers/offerCow.test.js index 37609abda..86403a349 100644 --- a/src/game-logic/reducers/offerCow.test.js +++ b/src/game-logic/reducers/offerCow.test.js @@ -1,4 +1,4 @@ -import { offerCow } from './offerCow' +import { offerCow } from './offerCow.js' describe('offerCow', () => { test('makes specified cow available for trade', () => { diff --git a/src/game-logic/reducers/plantInPlot.js b/src/game-logic/reducers/plantInPlot.js index f57d8eb87..312361232 100644 --- a/src/game-logic/reducers/plantInPlot.js +++ b/src/game-logic/reducers/plantInPlot.js @@ -4,12 +4,12 @@ import { chooseRandomIndex, getCropFromItemId, getFinalCropItemIdFromSeedItemId, -} from '../../utils' -import { itemsMap } from '../../data/maps' +} from '../../utils/index.js' +import { itemsMap } from '../../data/maps.js' -import { decrementItemFromInventory } from './decrementItemFromInventory' -import { processSprinklers } from './processSprinklers' -import { modifyFieldPlotAt } from './modifyFieldPlotAt' +import { decrementItemFromInventory } from './decrementItemFromInventory.js' +import { processSprinklers } from './processSprinklers.js' +import { modifyFieldPlotAt } from './modifyFieldPlotAt.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/plantInPlot.test.js b/src/game-logic/reducers/plantInPlot.test.js index a88f7d18a..fdcca91e8 100644 --- a/src/game-logic/reducers/plantInPlot.test.js +++ b/src/game-logic/reducers/plantInPlot.test.js @@ -1,9 +1,9 @@ -import { testItem } from '../../test-utils' -import { getCropFromItemId } from '../../utils' +import { testItem } from '../../test-utils/index.js' +import { getCropFromItemId } from '../../utils/index.js' -import { plantInPlot } from './plantInPlot' +import { plantInPlot } from './plantInPlot.js' -vitest.mock('../../data/items') +vitest.mock('../../data/items.js') describe('plantInPlot', () => { describe('crop quantity > 1', () => { diff --git a/src/game-logic/reducers/prependPendingPeerMessage.js b/src/game-logic/reducers/prependPendingPeerMessage.js index 1c986c404..76f0c4de2 100644 --- a/src/game-logic/reducers/prependPendingPeerMessage.js +++ b/src/game-logic/reducers/prependPendingPeerMessage.js @@ -1,4 +1,4 @@ -import { MAX_PENDING_PEER_MESSAGES } from '../../constants' +import { MAX_PENDING_PEER_MESSAGES } from '../../constants.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/prependPendingPeerMessage.test.js b/src/game-logic/reducers/prependPendingPeerMessage.test.js index 0d63fe869..62c8f5ec2 100644 --- a/src/game-logic/reducers/prependPendingPeerMessage.test.js +++ b/src/game-logic/reducers/prependPendingPeerMessage.test.js @@ -1,6 +1,6 @@ -import { MAX_PENDING_PEER_MESSAGES } from '../../constants' +import { MAX_PENDING_PEER_MESSAGES } from '../../constants.js' -import { prependPendingPeerMessage } from './prependPendingPeerMessage' +import { prependPendingPeerMessage } from './prependPendingPeerMessage.js' describe('prependPendingPeerMessage', () => { test('prepends a message', () => { diff --git a/src/game-logic/reducers/processCellar.js b/src/game-logic/reducers/processCellar.js index 04c85ec92..92a94db27 100644 --- a/src/game-logic/reducers/processCellar.js +++ b/src/game-logic/reducers/processCellar.js @@ -1,6 +1,6 @@ /** @typedef {import("../../components/Farmhand/Farmhand").farmhand.state} state */ -import { processCellarSpoilage } from './processCellarSpoilage' +import { processCellarSpoilage } from './processCellarSpoilage.js' /** * @param {state} state diff --git a/src/game-logic/reducers/processCellar.test.js b/src/game-logic/reducers/processCellar.test.js index c84a507d9..da5d19445 100644 --- a/src/game-logic/reducers/processCellar.test.js +++ b/src/game-logic/reducers/processCellar.test.js @@ -1,6 +1,6 @@ -import { carrot, garlic } from '../../data/items' +import { carrot, garlic } from '../../data/items.js' -import { processCellar } from './processCellar' +import { processCellar } from './processCellar.js' describe('processCellar', () => { test('kegs are updated', () => { diff --git a/src/game-logic/reducers/processCellarSpoilage.js b/src/game-logic/reducers/processCellarSpoilage.js index 3e4f6d5c4..6a8ea11dc 100644 --- a/src/game-logic/reducers/processCellarSpoilage.js +++ b/src/game-logic/reducers/processCellarSpoilage.js @@ -1,12 +1,12 @@ /** @typedef {import("../../components/Farmhand/Farmhand").farmhand.state} state */ -import { randomNumberService } from '../../common/services/randomNumber' -import { itemsMap } from '../../data/maps' -import { wineService } from '../../services/wine' -import { KEG_SPOILED_MESSAGE } from '../../templates' -import { getKegSpoilageRate } from '../../utils/getKegSpoilageRate' +import { randomNumberService } from '../../common/services/randomNumber.js' +import { itemsMap } from '../../data/maps.js' +import { wineService } from '../../services/wine.js' +import { KEG_SPOILED_MESSAGE } from '../../templates.js' +import { getKegSpoilageRate } from '../../utils/getKegSpoilageRate.js' -import { removeKegFromCellar } from './removeKegFromCellar' +import { removeKegFromCellar } from './removeKegFromCellar.js' /** * @param {state} state diff --git a/src/game-logic/reducers/processCellarSpoilage.test.js b/src/game-logic/reducers/processCellarSpoilage.test.js index 6f85799ab..04d93e9ed 100644 --- a/src/game-logic/reducers/processCellarSpoilage.test.js +++ b/src/game-logic/reducers/processCellarSpoilage.test.js @@ -1,9 +1,9 @@ -import { randomNumberService } from '../../common/services/randomNumber' -import { wineTempranillo } from '../../data/recipes' -import { KEG_SPOILED_MESSAGE } from '../../templates' -import { getKegStub } from '../../test-utils/stubs/getKegStub' +import { randomNumberService } from '../../common/services/randomNumber.js' +import { wineTempranillo } from '../../data/recipes.js' +import { KEG_SPOILED_MESSAGE } from '../../templates.js' +import { getKegStub } from '../../test-utils/stubs/getKegStub.js' -import { processCellarSpoilage } from './processCellarSpoilage' +import { processCellarSpoilage } from './processCellarSpoilage.js' describe('processCellarSpoilage', () => { test('does not remove kegs that have not spoiled', () => { diff --git a/src/game-logic/reducers/processCowAttrition.js b/src/game-logic/reducers/processCowAttrition.js index 57c45628d..eb72aae37 100644 --- a/src/game-logic/reducers/processCowAttrition.js +++ b/src/game-logic/reducers/processCowAttrition.js @@ -1,7 +1,7 @@ -import { COW_WEIGHT_MULTIPLIER_MINIMUM } from '../../constants' -import { COW_ATTRITION_MESSAGE } from '../../templates' +import { COW_WEIGHT_MULTIPLIER_MINIMUM } from '../../constants.js' +import { COW_ATTRITION_MESSAGE } from '../../templates.js' -import { removeCowFromInventory } from './removeCowFromInventory' +import { removeCowFromInventory } from './removeCowFromInventory.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/processCowAttrition.test.js b/src/game-logic/reducers/processCowAttrition.test.js index babb6256c..b79bd939a 100644 --- a/src/game-logic/reducers/processCowAttrition.test.js +++ b/src/game-logic/reducers/processCowAttrition.test.js @@ -1,12 +1,12 @@ -import { COW_ATTRITION_MESSAGE } from '../../templates' +import { COW_ATTRITION_MESSAGE } from '../../templates.js' import { COW_WEIGHT_MULTIPLIER_MINIMUM, INFINITE_STORAGE_LIMIT, -} from '../../constants' -import { huggingMachine } from '../../data/items' -import { generateCow } from '../../utils' +} from '../../constants.js' +import { huggingMachine } from '../../data/items.js' +import { generateCow } from '../../utils/index.js' -import { processCowAttrition } from './processCowAttrition' +import { processCowAttrition } from './processCowAttrition.js' describe('processCowAttrition', () => { test('unfed cows leave', () => { diff --git a/src/game-logic/reducers/processCowBreeding.js b/src/game-logic/reducers/processCowBreeding.js index 4440994be..7a38dbfd9 100644 --- a/src/game-logic/reducers/processCowBreeding.js +++ b/src/game-logic/reducers/processCowBreeding.js @@ -1,14 +1,14 @@ -import { findCowById, generateOffspringCow } from '../../utils' -import { cowColors } from '../../enums' +import { findCowById, generateOffspringCow } from '../../utils/index.js' +import { cowColors } from '../../enums.js' import { EXPERIENCE_VALUES, COW_GESTATION_PERIOD_DAYS, COW_MINIMUM_HAPPINESS_TO_BREED, PURCHASEABLE_COW_PENS, -} from '../../constants' -import { COW_BORN_MESSAGE } from '../../templates' +} from '../../constants.js' +import { COW_BORN_MESSAGE } from '../../templates.js' -import { addExperience } from './addExperience' +import { addExperience } from './addExperience.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/processCowBreeding.test.js b/src/game-logic/reducers/processCowBreeding.test.js index 162199e7c..8adef90b6 100644 --- a/src/game-logic/reducers/processCowBreeding.test.js +++ b/src/game-logic/reducers/processCowBreeding.test.js @@ -2,11 +2,11 @@ import { EXPERIENCE_VALUES, COW_GESTATION_PERIOD_DAYS, PURCHASEABLE_COW_PENS, -} from '../../constants' -import { genders } from '../../enums' -import { generateCow } from '../../utils' +} from '../../constants.js' +import { genders } from '../../enums.js' +import { generateCow } from '../../utils/index.js' -import { processCowBreeding } from './processCowBreeding' +import { processCowBreeding } from './processCowBreeding.js' describe('processCowBreeding', () => { const maleCow1 = generateCow({ gender: genders.MALE, happiness: 1 }) diff --git a/src/game-logic/reducers/processCowFertilizerProduction.js b/src/game-logic/reducers/processCowFertilizerProduction.js index 4dc12fa11..56b22d7db 100644 --- a/src/game-logic/reducers/processCowFertilizerProduction.js +++ b/src/game-logic/reducers/processCowFertilizerProduction.js @@ -2,10 +2,10 @@ import { doesInventorySpaceRemain, getCowFertilizerItem, getCowFertilizerProductionRate, -} from '../../utils' -import { FERTILIZERS_PRODUCED } from '../../templates' +} from '../../utils/index.js' +import { FERTILIZERS_PRODUCED } from '../../templates.js' -import { addItemToInventory } from './addItemToInventory' +import { addItemToInventory } from './addItemToInventory.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/processCowFertilizerProduction.test.js b/src/game-logic/reducers/processCowFertilizerProduction.test.js index 0dae8db34..69723d6b5 100644 --- a/src/game-logic/reducers/processCowFertilizerProduction.test.js +++ b/src/game-logic/reducers/processCowFertilizerProduction.test.js @@ -1,12 +1,12 @@ -import { FERTILIZERS_PRODUCED } from '../../templates' +import { FERTILIZERS_PRODUCED } from '../../templates.js' import { COW_FERTILIZER_PRODUCTION_RATE_SLOWEST, INFINITE_STORAGE_LIMIT, -} from '../../constants' -import { genders, standardCowColors } from '../../enums' -import { generateCow, getCowFertilizerItem } from '../../utils' +} from '../../constants.js' +import { genders, standardCowColors } from '../../enums.js' +import { generateCow, getCowFertilizerItem } from '../../utils/index.js' -import { processCowFertilizerProduction } from './processCowFertilizerProduction' +import { processCowFertilizerProduction } from './processCowFertilizerProduction.js' describe('processCowFertilizerProduction', () => { let state diff --git a/src/game-logic/reducers/processFeedingCows.js b/src/game-logic/reducers/processFeedingCows.js index bbf8f94e6..b07dd2643 100644 --- a/src/game-logic/reducers/processFeedingCows.js +++ b/src/game-logic/reducers/processFeedingCows.js @@ -1,13 +1,13 @@ -import { clampNumber } from '../../utils' +import { clampNumber } from '../../utils/index.js' import { COW_FEED_ITEM_ID, COW_WEIGHT_MULTIPLIER_FEED_BENEFIT, COW_WEIGHT_MULTIPLIER_MAXIMUM, COW_WEIGHT_MULTIPLIER_MINIMUM, -} from '../../constants' -import { OUT_OF_COW_FEED_NOTIFICATION } from '../../strings' +} from '../../constants.js' +import { OUT_OF_COW_FEED_NOTIFICATION } from '../../strings.js' -import { decrementItemFromInventory } from './decrementItemFromInventory' +import { decrementItemFromInventory } from './decrementItemFromInventory.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/processFeedingCows.test.js b/src/game-logic/reducers/processFeedingCows.test.js index 07ab61084..e9a921a09 100644 --- a/src/game-logic/reducers/processFeedingCows.test.js +++ b/src/game-logic/reducers/processFeedingCows.test.js @@ -1,13 +1,13 @@ -import { OUT_OF_COW_FEED_NOTIFICATION } from '../../strings' +import { OUT_OF_COW_FEED_NOTIFICATION } from '../../strings.js' import { COW_FEED_ITEM_ID, COW_WEIGHT_MULTIPLIER_MAXIMUM, COW_WEIGHT_MULTIPLIER_FEED_BENEFIT, -} from '../../constants' +} from '../../constants.js' -import { generateCow } from '../../utils' +import { generateCow } from '../../utils/index.js' -import { processFeedingCows } from './processFeedingCows' +import { processFeedingCows } from './processFeedingCows.js' describe('processFeedingCows', () => { let state diff --git a/src/game-logic/reducers/processField.js b/src/game-logic/reducers/processField.js index f214a97a1..6247cca6e 100644 --- a/src/game-logic/reducers/processField.js +++ b/src/game-logic/reducers/processField.js @@ -1,7 +1,7 @@ -import { updateField, setWasWateredProperty } from './helpers' -import { incrementPlotContentAge } from './incrementPlotContentAge' -import { updatePlotShoveledState } from './updatePlotShoveledState' -import { spawnWeeds } from './spawnWeeds' +import { updateField, setWasWateredProperty } from './helpers.js' +import { incrementPlotContentAge } from './incrementPlotContentAge.js' +import { updatePlotShoveledState } from './updatePlotShoveledState.js' +import { spawnWeeds } from './spawnWeeds.js' const fieldReducer = (acc, fn) => fn(acc) diff --git a/src/game-logic/reducers/processLevelUp.js b/src/game-logic/reducers/processLevelUp.js index 7592028ae..1ee7c8139 100644 --- a/src/game-logic/reducers/processLevelUp.js +++ b/src/game-logic/reducers/processLevelUp.js @@ -1,16 +1,16 @@ -import { levels } from '../../data/levels' -import { levelAchieved } from '../../utils/levelAchieved' +import { levels } from '../../data/levels.js' +import { levelAchieved } from '../../utils/levelAchieved.js' import { getRandomLevelUpReward, getRandomLevelUpRewardQuantity, -} from '../../utils' -import { getLevelEntitlements } from '../../utils/getLevelEntitlements' -import { SPRINKLER_ITEM_ID } from '../../constants' -import { LEVEL_GAINED_NOTIFICATION } from '../../templates' +} from '../../utils/index.js' +import { getLevelEntitlements } from '../../utils/getLevelEntitlements.js' +import { SPRINKLER_ITEM_ID } from '../../constants.js' +import { LEVEL_GAINED_NOTIFICATION } from '../../templates.js' -import { addItemToInventory } from './addItemToInventory' -import { showNotification } from './showNotification' -import { unlockTool } from './unlockTool' +import { addItemToInventory } from './addItemToInventory.js' +import { showNotification } from './showNotification.js' +import { unlockTool } from './unlockTool.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/processLevelUp.test.js b/src/game-logic/reducers/processLevelUp.test.js index ed898fd26..96ebfd574 100644 --- a/src/game-logic/reducers/processLevelUp.test.js +++ b/src/game-logic/reducers/processLevelUp.test.js @@ -1,8 +1,8 @@ -import { LEVEL_GAINED_NOTIFICATION } from '../../templates' -import { toolLevel } from '../../enums' -import { experienceNeededForLevel } from '../../utils' +import { LEVEL_GAINED_NOTIFICATION } from '../../templates.js' +import { toolLevel } from '../../enums.js' +import { experienceNeededForLevel } from '../../utils/index.js' -import { processLevelUp } from './processLevelUp' +import { processLevelUp } from './processLevelUp.js' describe('processLevelUp', () => { test('shows notifications for each level gained in the sale', async () => { diff --git a/src/game-logic/reducers/processMilkingCows.js b/src/game-logic/reducers/processMilkingCows.js index a93789d83..5dd226222 100644 --- a/src/game-logic/reducers/processMilkingCows.js +++ b/src/game-logic/reducers/processMilkingCows.js @@ -2,10 +2,10 @@ import { doesInventorySpaceRemain, getCowMilkItem, getCowMilkRate, -} from '../../utils' -import { MILKS_PRODUCED } from '../../templates' +} from '../../utils/index.js' +import { MILKS_PRODUCED } from '../../templates.js' -import { addItemToInventory } from './addItemToInventory' +import { addItemToInventory } from './addItemToInventory.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/processMilkingCows.test.js b/src/game-logic/reducers/processMilkingCows.test.js index 111aa7fed..5ce0cf0e5 100644 --- a/src/game-logic/reducers/processMilkingCows.test.js +++ b/src/game-logic/reducers/processMilkingCows.test.js @@ -1,9 +1,9 @@ -import { MILKS_PRODUCED } from '../../templates' -import { COW_MILK_RATE_SLOWEST, INFINITE_STORAGE_LIMIT } from '../../constants' -import { genders, standardCowColors } from '../../enums' -import { generateCow, getCowMilkItem } from '../../utils' +import { MILKS_PRODUCED } from '../../templates.js' +import { COW_MILK_RATE_SLOWEST, INFINITE_STORAGE_LIMIT } from '../../constants.js' +import { genders, standardCowColors } from '../../enums.js' +import { generateCow, getCowMilkItem } from '../../utils/index.js' -import { processMilkingCows } from './processMilkingCows' +import { processMilkingCows } from './processMilkingCows.js' describe('processMilkingCows', () => { let state diff --git a/src/game-logic/reducers/processNerfs.js b/src/game-logic/reducers/processNerfs.js index e3a9c2263..5c8b98e5f 100644 --- a/src/game-logic/reducers/processNerfs.js +++ b/src/game-logic/reducers/processNerfs.js @@ -1,5 +1,5 @@ -import { applyChanceEvent } from './helpers' -import { applyCrows } from './applyCrows' +import { applyChanceEvent } from './helpers.js' +import { applyCrows } from './applyCrows.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/processNerfs.test.js b/src/game-logic/reducers/processNerfs.test.js index 5ad8f11bf..fbba1ba79 100644 --- a/src/game-logic/reducers/processNerfs.test.js +++ b/src/game-logic/reducers/processNerfs.test.js @@ -1,8 +1,8 @@ -import { applyCrows } from './applyCrows' +import { applyCrows } from './applyCrows.js' -import { processNerfs } from './processNerfs' +import { processNerfs } from './processNerfs.js' -vitest.mock('./applyCrows') +vitest.mock('./applyCrows.js') describe('processNerfs', () => { it('invokes applyCrows', () => { diff --git a/src/game-logic/reducers/processSprinklers.js b/src/game-logic/reducers/processSprinklers.js index db4522b47..cb9b391c9 100644 --- a/src/game-logic/reducers/processSprinklers.js +++ b/src/game-logic/reducers/processSprinklers.js @@ -1,10 +1,10 @@ -import { itemType } from '../../enums' -import { levelAchieved } from '../../utils/levelAchieved' -import { getPlotContentType, getRangeCoords } from '../../utils' -import { getLevelEntitlements } from '../../utils/getLevelEntitlements' +import { itemType } from '../../enums.js' +import { levelAchieved } from '../../utils/levelAchieved.js' +import { getPlotContentType, getRangeCoords } from '../../utils/index.js' +import { getLevelEntitlements } from '../../utils/getLevelEntitlements.js' -import { setWasWatered } from './helpers' -import { modifyFieldPlotAt } from './modifyFieldPlotAt' +import { setWasWatered } from './helpers.js' +import { modifyFieldPlotAt } from './modifyFieldPlotAt.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/processSprinklers.test.js b/src/game-logic/reducers/processSprinklers.test.js index cb4c0d170..6dc303ec9 100644 --- a/src/game-logic/reducers/processSprinklers.test.js +++ b/src/game-logic/reducers/processSprinklers.test.js @@ -1,9 +1,9 @@ -import { testCrop } from '../../test-utils' -import { getPlotContentFromItemId } from '../../utils' +import { testCrop } from '../../test-utils/index.js' +import { getPlotContentFromItemId } from '../../utils/index.js' -import { processSprinklers } from './processSprinklers' +import { processSprinklers } from './processSprinklers.js' -vitest.mock('../../data/items') +vitest.mock('../../data/items.js') describe('processSprinklers', () => { let computedState diff --git a/src/game-logic/reducers/processWeather.js b/src/game-logic/reducers/processWeather.js index 568f2960a..5af9dffdb 100644 --- a/src/game-logic/reducers/processWeather.js +++ b/src/game-logic/reducers/processWeather.js @@ -1,7 +1,7 @@ -import { shouldPrecipitateToday } from '../../utils' +import { shouldPrecipitateToday } from '../../utils/index.js' -import { applyChanceEvent } from './helpers' -import { applyPrecipitation } from './applyPrecipitation' +import { applyChanceEvent } from './helpers.js' +import { applyPrecipitation } from './applyPrecipitation.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/processWeather.test.js b/src/game-logic/reducers/processWeather.test.js index 63c947fb9..172ed9ddb 100644 --- a/src/game-logic/reducers/processWeather.test.js +++ b/src/game-logic/reducers/processWeather.test.js @@ -1,12 +1,12 @@ -import { testCrop } from '../../test-utils' +import { testCrop } from '../../test-utils/index.js' -import { shouldPrecipitateToday } from '../../utils' +import { shouldPrecipitateToday } from '../../utils/index.js' -import { processWeather } from './processWeather' +import { processWeather } from './processWeather.js' -vitest.mock('../../data/maps') -vitest.mock('../../utils', async () => ({ - ...(await vitest.importActual('../../utils')), +vitest.mock('../../data/maps.js') +vitest.mock('../../utils/index.js', async () => ({ + ...(await vitest.importActual('../../utils/index.js')), shouldPrecipitateToday: vitest.fn(), })) diff --git a/src/game-logic/reducers/purchaseCellar.js b/src/game-logic/reducers/purchaseCellar.js index b28464abb..daae8a0bd 100644 --- a/src/game-logic/reducers/purchaseCellar.js +++ b/src/game-logic/reducers/purchaseCellar.js @@ -1,10 +1,10 @@ -import { moneyTotal } from '../../utils' -import { EXPERIENCE_VALUES, PURCHASEABLE_CELLARS } from '../../constants' +import { moneyTotal } from '../../utils/index.js' +import { EXPERIENCE_VALUES, PURCHASEABLE_CELLARS } from '../../constants.js' -import { CELLAR_PURCHASED } from '../../templates' +import { CELLAR_PURCHASED } from '../../templates.js' -import { addExperience } from './addExperience' -import { showNotification } from './showNotification' +import { addExperience } from './addExperience.js' +import { showNotification } from './showNotification.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/purchaseCellar.test.js b/src/game-logic/reducers/purchaseCellar.test.js index e614991a7..a28d474fd 100644 --- a/src/game-logic/reducers/purchaseCellar.test.js +++ b/src/game-logic/reducers/purchaseCellar.test.js @@ -1,6 +1,6 @@ -import { EXPERIENCE_VALUES, PURCHASEABLE_CELLARS } from '../../constants' +import { EXPERIENCE_VALUES, PURCHASEABLE_CELLARS } from '../../constants.js' -import { purchaseCellar } from './purchaseCellar' +import { purchaseCellar } from './purchaseCellar.js' describe('purchaseCellar', () => { test('updates purchasedCellar', () => { diff --git a/src/game-logic/reducers/purchaseCombine.js b/src/game-logic/reducers/purchaseCombine.js index 2fd55bd64..68db623af 100644 --- a/src/game-logic/reducers/purchaseCombine.js +++ b/src/game-logic/reducers/purchaseCombine.js @@ -1,5 +1,5 @@ -import { moneyTotal } from '../../utils' -import { PURCHASEABLE_COMBINES } from '../../constants' +import { moneyTotal } from '../../utils/index.js' +import { PURCHASEABLE_COMBINES } from '../../constants.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/purchaseCombine.test.js b/src/game-logic/reducers/purchaseCombine.test.js index b0dfe2095..0af94ec25 100644 --- a/src/game-logic/reducers/purchaseCombine.test.js +++ b/src/game-logic/reducers/purchaseCombine.test.js @@ -1,6 +1,6 @@ -import { PURCHASEABLE_COMBINES } from '../../constants' +import { PURCHASEABLE_COMBINES } from '../../constants.js' -import { purchaseCombine } from './purchaseCombine' +import { purchaseCombine } from './purchaseCombine.js' describe('purchaseCombine', () => { test('updates purchasedCombine', () => { diff --git a/src/game-logic/reducers/purchaseComposter.js b/src/game-logic/reducers/purchaseComposter.js index bdf899bda..4a644beea 100644 --- a/src/game-logic/reducers/purchaseComposter.js +++ b/src/game-logic/reducers/purchaseComposter.js @@ -1,10 +1,10 @@ -import { moneyTotal } from '../../utils' -import { EXPERIENCE_VALUES, PURCHASEABLE_COMPOSTERS } from '../../constants' -import { RECYCLING_AVAILABLE_NOTIFICATION } from '../../strings' +import { moneyTotal } from '../../utils/index.js' +import { EXPERIENCE_VALUES, PURCHASEABLE_COMPOSTERS } from '../../constants.js' +import { RECYCLING_AVAILABLE_NOTIFICATION } from '../../strings.js' -import { addExperience } from './addExperience' -import { showNotification } from './showNotification' -import { updateLearnedRecipes } from './updateLearnedRecipes' +import { addExperience } from './addExperience.js' +import { showNotification } from './showNotification.js' +import { updateLearnedRecipes } from './updateLearnedRecipes.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/purchaseComposter.test.js b/src/game-logic/reducers/purchaseComposter.test.js index ba7f68f09..54ce0a69b 100644 --- a/src/game-logic/reducers/purchaseComposter.test.js +++ b/src/game-logic/reducers/purchaseComposter.test.js @@ -1,7 +1,7 @@ -import { EXPERIENCE_VALUES, PURCHASEABLE_COMPOSTERS } from '../../constants' -import { RECYCLING_AVAILABLE_NOTIFICATION } from '../../strings' +import { EXPERIENCE_VALUES, PURCHASEABLE_COMPOSTERS } from '../../constants.js' +import { RECYCLING_AVAILABLE_NOTIFICATION } from '../../strings.js' -import { purchaseComposter } from './purchaseComposter' +import { purchaseComposter } from './purchaseComposter.js' describe('purchaseComposter', () => { let gameState, newState diff --git a/src/game-logic/reducers/purchaseCow.js b/src/game-logic/reducers/purchaseCow.js index f9f129bd1..693e33531 100644 --- a/src/game-logic/reducers/purchaseCow.js +++ b/src/game-logic/reducers/purchaseCow.js @@ -1,7 +1,7 @@ -import { generateCow, getCowValue, moneyTotal } from '../../utils' -import { PURCHASEABLE_COW_PENS } from '../../constants' +import { generateCow, getCowValue, moneyTotal } from '../../utils/index.js' +import { PURCHASEABLE_COW_PENS } from '../../constants.js' -import { addCowToInventory } from './addCowToInventory' +import { addCowToInventory } from './addCowToInventory.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/purchaseCow.test.js b/src/game-logic/reducers/purchaseCow.test.js index ee607311b..257c94537 100644 --- a/src/game-logic/reducers/purchaseCow.test.js +++ b/src/game-logic/reducers/purchaseCow.test.js @@ -1,8 +1,8 @@ -import { PURCHASEABLE_COW_PENS } from '../../constants' -import { genders, standardCowColors } from '../../enums' -import { generateCow, getCowValue } from '../../utils' +import { PURCHASEABLE_COW_PENS } from '../../constants.js' +import { genders, standardCowColors } from '../../enums.js' +import { generateCow, getCowValue } from '../../utils/index.js' -import { purchaseCow } from './purchaseCow' +import { purchaseCow } from './purchaseCow.js' describe('purchaseCow', () => { const cow = Object.freeze( diff --git a/src/game-logic/reducers/purchaseCowPen.js b/src/game-logic/reducers/purchaseCowPen.js index 2c7426d05..4065cee23 100644 --- a/src/game-logic/reducers/purchaseCowPen.js +++ b/src/game-logic/reducers/purchaseCowPen.js @@ -1,12 +1,12 @@ /** * @typedef {import("../../components/Farmhand/Farmhand").farmhand.state} state */ -import { moneyTotal } from '../../utils' -import { EXPERIENCE_VALUES, PURCHASEABLE_COW_PENS } from '../../constants' -import { COW_PEN_PURCHASED } from '../../templates' +import { moneyTotal } from '../../utils/index.js' +import { EXPERIENCE_VALUES, PURCHASEABLE_COW_PENS } from '../../constants.js' +import { COW_PEN_PURCHASED } from '../../templates.js' -import { addExperience } from './addExperience' -import { showNotification } from './showNotification' +import { addExperience } from './addExperience.js' +import { showNotification } from './showNotification.js' /** * @param {state} state diff --git a/src/game-logic/reducers/purchaseCowPen.test.js b/src/game-logic/reducers/purchaseCowPen.test.js index 594c19258..71b55352a 100644 --- a/src/game-logic/reducers/purchaseCowPen.test.js +++ b/src/game-logic/reducers/purchaseCowPen.test.js @@ -1,6 +1,6 @@ -import { EXPERIENCE_VALUES, PURCHASEABLE_COW_PENS } from '../../constants' +import { EXPERIENCE_VALUES, PURCHASEABLE_COW_PENS } from '../../constants.js' -import { purchaseCowPen } from './purchaseCowPen' +import { purchaseCowPen } from './purchaseCowPen.js' describe('purchaseCowPen', () => { test('updates purchasedCowPen', () => { diff --git a/src/game-logic/reducers/purchaseField.js b/src/game-logic/reducers/purchaseField.js index 33cf01914..3ab92aa1e 100644 --- a/src/game-logic/reducers/purchaseField.js +++ b/src/game-logic/reducers/purchaseField.js @@ -1,7 +1,7 @@ -import { moneyTotal, nullArray } from '../../utils' -import { EXPERIENCE_VALUES, PURCHASEABLE_FIELD_SIZES } from '../../constants' +import { moneyTotal, nullArray } from '../../utils/index.js' +import { EXPERIENCE_VALUES, PURCHASEABLE_FIELD_SIZES } from '../../constants.js' -import { addExperience } from './addExperience' +import { addExperience } from './addExperience.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/purchaseField.test.js b/src/game-logic/reducers/purchaseField.test.js index eee0eac5d..5c9cebe66 100644 --- a/src/game-logic/reducers/purchaseField.test.js +++ b/src/game-logic/reducers/purchaseField.test.js @@ -1,7 +1,7 @@ -import { testCrop } from '../../test-utils' -import { EXPERIENCE_VALUES, PURCHASEABLE_FIELD_SIZES } from '../../constants' +import { testCrop } from '../../test-utils/index.js' +import { EXPERIENCE_VALUES, PURCHASEABLE_FIELD_SIZES } from '../../constants.js' -import { purchaseField } from './purchaseField' +import { purchaseField } from './purchaseField.js' describe('purchaseField', () => { test('updates purchasedField', () => { diff --git a/src/game-logic/reducers/purchaseForest.js b/src/game-logic/reducers/purchaseForest.js index 38378a213..c729876b9 100644 --- a/src/game-logic/reducers/purchaseForest.js +++ b/src/game-logic/reducers/purchaseForest.js @@ -1,10 +1,10 @@ -import { moneyTotal, nullArray } from '../../utils' -import { EXPERIENCE_VALUES, PURCHASABLE_FOREST_SIZES } from '../../constants' -import { FOREST_EXPANDED } from '../../templates' -import { FOREST_AVAILABLE_NOTIFICATION } from '../../strings' +import { moneyTotal, nullArray } from '../../utils/index.js' +import { EXPERIENCE_VALUES, PURCHASABLE_FOREST_SIZES } from '../../constants.js' +import { FOREST_EXPANDED } from '../../templates.js' +import { FOREST_AVAILABLE_NOTIFICATION } from '../../strings.js' -import { addExperience } from './addExperience' -import { showNotification } from './showNotification' +import { addExperience } from './addExperience.js' +import { showNotification } from './showNotification.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/purchaseForest.test.js b/src/game-logic/reducers/purchaseForest.test.js index 0905246ae..1184f0d6d 100644 --- a/src/game-logic/reducers/purchaseForest.test.js +++ b/src/game-logic/reducers/purchaseForest.test.js @@ -1,7 +1,7 @@ -import { EXPERIENCE_VALUES, PURCHASABLE_FOREST_SIZES } from '../../constants' -import { FOREST_AVAILABLE_NOTIFICATION } from '../../strings' +import { EXPERIENCE_VALUES, PURCHASABLE_FOREST_SIZES } from '../../constants.js' +import { FOREST_AVAILABLE_NOTIFICATION } from '../../strings.js' -import { purchaseForest } from './purchaseForest' +import { purchaseForest } from './purchaseForest.js' const tree = () => { return { diff --git a/src/game-logic/reducers/purchaseItem.js b/src/game-logic/reducers/purchaseItem.js index 9933f4d29..bf6af0f7a 100644 --- a/src/game-logic/reducers/purchaseItem.js +++ b/src/game-logic/reducers/purchaseItem.js @@ -2,12 +2,12 @@ import { getAdjustedItemValue, inventorySpaceRemaining, moneyTotal, -} from '../../utils' -import { PURCHASED_ITEM_PEER_NOTIFICATION } from '../../templates' +} from '../../utils/index.js' +import { PURCHASED_ITEM_PEER_NOTIFICATION } from '../../templates.js' -import { addItemToInventory } from './addItemToInventory' +import { addItemToInventory } from './addItemToInventory.js' -import { prependPendingPeerMessage } from './index' +import { prependPendingPeerMessage } from './index.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/purchaseItem.test.js b/src/game-logic/reducers/purchaseItem.test.js index a53310a6e..09cf1f9b2 100644 --- a/src/game-logic/reducers/purchaseItem.test.js +++ b/src/game-logic/reducers/purchaseItem.test.js @@ -1,8 +1,8 @@ -import { INFINITE_STORAGE_LIMIT } from '../../constants' +import { INFINITE_STORAGE_LIMIT } from '../../constants.js' -import { purchaseItem } from './purchaseItem' +import { purchaseItem } from './purchaseItem.js' -vitest.mock('../../data/maps') +vitest.mock('../../data/maps.js') describe('purchaseItem', () => { describe('howMany === 0', () => { diff --git a/src/game-logic/reducers/purchaseSmelter.js b/src/game-logic/reducers/purchaseSmelter.js index e0813cfe5..4729df381 100644 --- a/src/game-logic/reducers/purchaseSmelter.js +++ b/src/game-logic/reducers/purchaseSmelter.js @@ -1,10 +1,10 @@ -import { moneyTotal } from '../../utils' -import { EXPERIENCE_VALUES, PURCHASEABLE_SMELTERS } from '../../constants' -import { FORGE_AVAILABLE_NOTIFICATION } from '../../strings' +import { moneyTotal } from '../../utils/index.js' +import { EXPERIENCE_VALUES, PURCHASEABLE_SMELTERS } from '../../constants.js' +import { FORGE_AVAILABLE_NOTIFICATION } from '../../strings.js' -import { addExperience } from './addExperience' -import { showNotification } from './showNotification' -import { updateLearnedRecipes } from './updateLearnedRecipes' +import { addExperience } from './addExperience.js' +import { showNotification } from './showNotification.js' +import { updateLearnedRecipes } from './updateLearnedRecipes.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/purchaseSmelter.test.js b/src/game-logic/reducers/purchaseSmelter.test.js index 2706bbf65..a2f85c2a5 100644 --- a/src/game-logic/reducers/purchaseSmelter.test.js +++ b/src/game-logic/reducers/purchaseSmelter.test.js @@ -1,7 +1,7 @@ -import { EXPERIENCE_VALUES, PURCHASEABLE_SMELTERS } from '../../constants' -import { FORGE_AVAILABLE_NOTIFICATION } from '../../strings' +import { EXPERIENCE_VALUES, PURCHASEABLE_SMELTERS } from '../../constants.js' +import { FORGE_AVAILABLE_NOTIFICATION } from '../../strings.js' -import { purchaseSmelter } from './purchaseSmelter' +import { purchaseSmelter } from './purchaseSmelter.js' describe('purchaseSmelter', () => { let gameState, newState diff --git a/src/game-logic/reducers/purchaseStorageExpansion.js b/src/game-logic/reducers/purchaseStorageExpansion.js index ff1187184..ce884d6b7 100644 --- a/src/game-logic/reducers/purchaseStorageExpansion.js +++ b/src/game-logic/reducers/purchaseStorageExpansion.js @@ -1,8 +1,8 @@ -import { getCostOfNextStorageExpansion, moneyTotal } from '../../utils' +import { getCostOfNextStorageExpansion, moneyTotal } from '../../utils/index.js' import { INFINITE_STORAGE_LIMIT, STORAGE_EXPANSION_AMOUNT, -} from '../../constants' +} from '../../constants.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/purchaseStorageExpansion.test.js b/src/game-logic/reducers/purchaseStorageExpansion.test.js index c547a636d..f477a2cdd 100644 --- a/src/game-logic/reducers/purchaseStorageExpansion.test.js +++ b/src/game-logic/reducers/purchaseStorageExpansion.test.js @@ -1,7 +1,7 @@ -import { STORAGE_EXPANSION_AMOUNT } from '../../constants' -import { getCostOfNextStorageExpansion } from '../../utils' +import { STORAGE_EXPANSION_AMOUNT } from '../../constants.js' +import { getCostOfNextStorageExpansion } from '../../utils/index.js' -import { purchaseStorageExpansion } from './purchaseStorageExpansion' +import { purchaseStorageExpansion } from './purchaseStorageExpansion.js' describe('purchaseStorageExpansion', () => { describe('player does not have enough money', () => { diff --git a/src/game-logic/reducers/removeCowFromInventory.js b/src/game-logic/reducers/removeCowFromInventory.js index 5f7aff0c2..a60063fa4 100644 --- a/src/game-logic/reducers/removeCowFromInventory.js +++ b/src/game-logic/reducers/removeCowFromInventory.js @@ -1,9 +1,9 @@ -import { itemsMap } from '../../data/maps' -import { HUGGING_MACHINE_ITEM_ID } from '../../constants' +import { itemsMap } from '../../data/maps.js' +import { HUGGING_MACHINE_ITEM_ID } from '../../constants.js' -import { addItemToInventory } from './addItemToInventory' +import { addItemToInventory } from './addItemToInventory.js' -import { changeCowBreedingPenResident } from './changeCowBreedingPenResident' +import { changeCowBreedingPenResident } from './changeCowBreedingPenResident.js' // TODO: Add tests for this reducer /** diff --git a/src/game-logic/reducers/removeFieldPlotAt.js b/src/game-logic/reducers/removeFieldPlotAt.js index 6a00338b9..2b0fd2ba9 100644 --- a/src/game-logic/reducers/removeFieldPlotAt.js +++ b/src/game-logic/reducers/removeFieldPlotAt.js @@ -1,4 +1,4 @@ -import { modifyFieldPlotAt } from './modifyFieldPlotAt' +import { modifyFieldPlotAt } from './modifyFieldPlotAt.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/rotateNotificationLogs.js b/src/game-logic/reducers/rotateNotificationLogs.js index 86bd364e5..569fe17cc 100644 --- a/src/game-logic/reducers/rotateNotificationLogs.js +++ b/src/game-logic/reducers/rotateNotificationLogs.js @@ -1,4 +1,4 @@ -import { NOTIFICATION_LOG_SIZE } from '../../constants' +import { NOTIFICATION_LOG_SIZE } from '../../constants.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/rotateNotificationLogs.test.js b/src/game-logic/reducers/rotateNotificationLogs.test.js index 0351861c1..06ac713f6 100644 --- a/src/game-logic/reducers/rotateNotificationLogs.test.js +++ b/src/game-logic/reducers/rotateNotificationLogs.test.js @@ -1,6 +1,6 @@ -import { NOTIFICATION_LOG_SIZE } from '../../constants' +import { NOTIFICATION_LOG_SIZE } from '../../constants.js' -import { rotateNotificationLogs } from './rotateNotificationLogs' +import { rotateNotificationLogs } from './rotateNotificationLogs.js' describe('rotateNotificationLogs', () => { test('rotates logs', () => { diff --git a/src/game-logic/reducers/selectCow.test.js b/src/game-logic/reducers/selectCow.test.js index 934f37038..e5a388020 100644 --- a/src/game-logic/reducers/selectCow.test.js +++ b/src/game-logic/reducers/selectCow.test.js @@ -1,4 +1,4 @@ -import { selectCow } from './selectCow' +import { selectCow } from './selectCow.js' describe('selectCow', () => { test('updates selectedCowId', () => { diff --git a/src/game-logic/reducers/sellCow.js b/src/game-logic/reducers/sellCow.js index 22404f09f..f31b44a0e 100644 --- a/src/game-logic/reducers/sellCow.js +++ b/src/game-logic/reducers/sellCow.js @@ -1,8 +1,8 @@ -import { getCowColorId, getCowValue } from '../../utils' +import { getCowColorId, getCowValue } from '../../utils/index.js' -import { addRevenue } from './addRevenue' +import { addRevenue } from './addRevenue.js' -import { removeCowFromInventory } from './removeCowFromInventory' +import { removeCowFromInventory } from './removeCowFromInventory.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/sellCow.test.js b/src/game-logic/reducers/sellCow.test.js index 2239ed58f..6c0049706 100644 --- a/src/game-logic/reducers/sellCow.test.js +++ b/src/game-logic/reducers/sellCow.test.js @@ -1,10 +1,10 @@ -import { huggingMachine } from '../../data/items' -import { genders, standardCowColors } from '../../enums' -import { getCowValue } from '../../utils' +import { huggingMachine } from '../../data/items.js' +import { genders, standardCowColors } from '../../enums.js' +import { getCowValue } from '../../utils/index.js' -import { INFINITE_STORAGE_LIMIT } from '../../constants' +import { INFINITE_STORAGE_LIMIT } from '../../constants.js' -import { sellCow } from './sellCow' +import { sellCow } from './sellCow.js' describe('sellCow', () => { let cow diff --git a/src/game-logic/reducers/sellItem.js b/src/game-logic/reducers/sellItem.js index 78d027093..6907b9496 100644 --- a/src/game-logic/reducers/sellItem.js +++ b/src/game-logic/reducers/sellItem.js @@ -3,8 +3,8 @@ * @typedef {import("../../").farmhand.item} farmhand.item */ -import { itemsMap } from '../../data/maps' -import { isItemAFarmProduct } from '../../utils/isItemAFarmProduct' +import { itemsMap } from '../../data/maps.js' +import { isItemAFarmProduct } from '../../utils/isItemAFarmProduct.js' import { castToMoney, getAdjustedItemValue, @@ -12,17 +12,17 @@ import { getSalePriceMultiplier, isItemSoldInShop, moneyTotal, -} from '../../utils' -import { LOAN_GARNISHMENT_RATE, EXPERIENCE_VALUES } from '../../constants' -import { SOLD_ITEM_PEER_NOTIFICATION } from '../../templates' +} from '../../utils/index.js' +import { LOAN_GARNISHMENT_RATE, EXPERIENCE_VALUES } from '../../constants.js' +import { SOLD_ITEM_PEER_NOTIFICATION } from '../../templates.js' -import { decrementItemFromInventory } from './decrementItemFromInventory' -import { addExperience } from './addExperience' -import { addRevenue } from './addRevenue' -import { updateLearnedRecipes } from './updateLearnedRecipes' -import { adjustLoan } from './adjustLoan' +import { decrementItemFromInventory } from './decrementItemFromInventory.js' +import { addExperience } from './addExperience.js' +import { addRevenue } from './addRevenue.js' +import { updateLearnedRecipes } from './updateLearnedRecipes.js' +import { adjustLoan } from './adjustLoan.js' -import { prependPendingPeerMessage } from './index' +import { prependPendingPeerMessage } from './index.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/sellItem.test.js b/src/game-logic/reducers/sellItem.test.js index 38cbf6a17..c024699ac 100644 --- a/src/game-logic/reducers/sellItem.test.js +++ b/src/game-logic/reducers/sellItem.test.js @@ -1,10 +1,10 @@ -import { testItem } from '../../test-utils' -import { LOAN_PAYOFF } from '../../templates' -import { carrot, carrotSeed } from '../../data/crops' -import { bronzeOre, coal, milk1, saltRock } from '../../data/items' -import { carrotSoup } from '../../data/recipes' +import { testItem } from '../../test-utils/index.js' +import { LOAN_PAYOFF } from '../../templates.js' +import { carrot, carrotSeed } from '../../data/crops/index.js' +import { bronzeOre, coal, milk1, saltRock } from '../../data/items.js' +import { carrotSoup } from '../../data/recipes.js' -import { sellItem } from './sellItem' +import { sellItem } from './sellItem.js' describe('sellItem', () => { test('sells item', () => { diff --git a/src/game-logic/reducers/sellKeg.js b/src/game-logic/reducers/sellKeg.js index b05c137c9..b9b492095 100644 --- a/src/game-logic/reducers/sellKeg.js +++ b/src/game-logic/reducers/sellKeg.js @@ -4,19 +4,23 @@ * @typedef {import("../../components/Farmhand/Farmhand").farmhand.state} state */ -import { itemsMap } from '../../data/maps' -import { castToMoney, getSalePriceMultiplier, moneyTotal } from '../../utils' -import { EXPERIENCE_VALUES, LOAN_GARNISHMENT_RATE } from '../../constants' -import { SOLD_FERMENTED_ITEM_PEER_NOTIFICATION } from '../../templates' -import { getKegValue } from '../../utils/getKegValue' - -import { addExperience } from './addExperience' -import { addRevenue } from './addRevenue' -import { adjustLoan } from './adjustLoan' -import { removeKegFromCellar } from './removeKegFromCellar' -import { updateLearnedRecipes } from './updateLearnedRecipes' - -import { prependPendingPeerMessage } from './index' +import { itemsMap } from '../../data/maps.js' +import { + castToMoney, + getSalePriceMultiplier, + moneyTotal, +} from '../../utils/index.js' +import { EXPERIENCE_VALUES, LOAN_GARNISHMENT_RATE } from '../../constants.js' +import { SOLD_FERMENTED_ITEM_PEER_NOTIFICATION } from '../../templates.js' +import { getKegValue } from '../../utils/getKegValue.js' + +import { addExperience } from './addExperience.js' +import { addRevenue } from './addRevenue.js' +import { adjustLoan } from './adjustLoan.js' +import { removeKegFromCellar } from './removeKegFromCellar.js' +import { updateLearnedRecipes } from './updateLearnedRecipes.js' + +import { prependPendingPeerMessage } from './index.js' /** * @param {state} state diff --git a/src/game-logic/reducers/sellKeg.test.js b/src/game-logic/reducers/sellKeg.test.js index 79fec80ac..cbf78b7ff 100644 --- a/src/game-logic/reducers/sellKeg.test.js +++ b/src/game-logic/reducers/sellKeg.test.js @@ -1,13 +1,13 @@ /** * @typedef {import("../../index").farmhand.keg} keg */ -import { LOAN_GARNISHMENT_RATE } from '../../constants' -import { carrot } from '../../data/crops' -import { LOAN_PAYOFF } from '../../templates' -import { castToMoney } from '../../utils' -import { getKegValue } from '../../utils/getKegValue' +import { LOAN_GARNISHMENT_RATE } from '../../constants.js' +import { carrot } from '../../data/crops/index.js' +import { LOAN_PAYOFF } from '../../templates.js' +import { castToMoney } from '../../utils/index.js' +import { getKegValue } from '../../utils/getKegValue.js' -import { sellKeg } from './sellKeg' +import { sellKeg } from './sellKeg.js' /** @type keg */ const stubKeg = { id: 'stub-keg', daysUntilMature: -4, itemId: carrot.id } diff --git a/src/game-logic/reducers/setScarecrow.js b/src/game-logic/reducers/setScarecrow.js index cab1fa357..aa15f320a 100644 --- a/src/game-logic/reducers/setScarecrow.js +++ b/src/game-logic/reducers/setScarecrow.js @@ -1,9 +1,9 @@ -import { fieldMode } from '../../enums' -import { getPlotContentFromItemId } from '../../utils' -import { SCARECROW_ITEM_ID } from '../../constants' +import { fieldMode } from '../../enums.js' +import { getPlotContentFromItemId } from '../../utils/index.js' +import { SCARECROW_ITEM_ID } from '../../constants.js' -import { decrementItemFromInventory } from './decrementItemFromInventory' -import { modifyFieldPlotAt } from './modifyFieldPlotAt' +import { decrementItemFromInventory } from './decrementItemFromInventory.js' +import { modifyFieldPlotAt } from './modifyFieldPlotAt.js' const { OBSERVE, SET_SCARECROW } = fieldMode diff --git a/src/game-logic/reducers/setScarecrow.test.js b/src/game-logic/reducers/setScarecrow.test.js index 008dc4152..b42e6ff07 100644 --- a/src/game-logic/reducers/setScarecrow.test.js +++ b/src/game-logic/reducers/setScarecrow.test.js @@ -1,9 +1,9 @@ -import { testCrop, testItem } from '../../test-utils' -import { SCARECROW_ITEM_ID } from '../../constants' -import { fieldMode } from '../../enums' -import { getPlotContentFromItemId } from '../../utils' +import { testCrop, testItem } from '../../test-utils/index.js' +import { SCARECROW_ITEM_ID } from '../../constants.js' +import { fieldMode } from '../../enums.js' +import { getPlotContentFromItemId } from '../../utils/index.js' -import { setScarecrow } from './setScarecrow' +import { setScarecrow } from './setScarecrow.js' describe('setScarecrow', () => { let state diff --git a/src/game-logic/reducers/setSprinkler.js b/src/game-logic/reducers/setSprinkler.js index 6c6918aa0..fbad1c30a 100644 --- a/src/game-logic/reducers/setSprinkler.js +++ b/src/game-logic/reducers/setSprinkler.js @@ -1,10 +1,10 @@ -import { fieldMode } from '../../enums' -import { getPlotContentFromItemId } from '../../utils' -import { SPRINKLER_ITEM_ID } from '../../constants' +import { fieldMode } from '../../enums.js' +import { getPlotContentFromItemId } from '../../utils/index.js' +import { SPRINKLER_ITEM_ID } from '../../constants.js' -import { decrementItemFromInventory } from './decrementItemFromInventory' -import { processSprinklers } from './processSprinklers' -import { modifyFieldPlotAt } from './modifyFieldPlotAt' +import { decrementItemFromInventory } from './decrementItemFromInventory.js' +import { processSprinklers } from './processSprinklers.js' +import { modifyFieldPlotAt } from './modifyFieldPlotAt.js' const { OBSERVE, SET_SPRINKLER } = fieldMode diff --git a/src/game-logic/reducers/setSprinkler.test.js b/src/game-logic/reducers/setSprinkler.test.js index 142855fc9..d99bf2558 100644 --- a/src/game-logic/reducers/setSprinkler.test.js +++ b/src/game-logic/reducers/setSprinkler.test.js @@ -1,9 +1,9 @@ -import { testCrop, testItem } from '../../test-utils' -import { SPRINKLER_ITEM_ID } from '../../constants' -import { fieldMode } from '../../enums' -import { getPlotContentFromItemId } from '../../utils' +import { testCrop, testItem } from '../../test-utils/index.js' +import { SPRINKLER_ITEM_ID } from '../../constants.js' +import { fieldMode } from '../../enums.js' +import { getPlotContentFromItemId } from '../../utils/index.js' -import { setSprinkler } from './setSprinkler' +import { setSprinkler } from './setSprinkler.js' describe('setSprinkler', () => { let state diff --git a/src/game-logic/reducers/showNotification.test.js b/src/game-logic/reducers/showNotification.test.js index fcafe3c4e..a5ebd823f 100644 --- a/src/game-logic/reducers/showNotification.test.js +++ b/src/game-logic/reducers/showNotification.test.js @@ -1,4 +1,4 @@ -import { showNotification } from './showNotification' +import { showNotification } from './showNotification.js' describe('showNotification', () => { test('sets notification state', () => { diff --git a/src/game-logic/reducers/spawnWeeds.js b/src/game-logic/reducers/spawnWeeds.js index 717fdcde2..8d19f02ef 100644 --- a/src/game-logic/reducers/spawnWeeds.js +++ b/src/game-logic/reducers/spawnWeeds.js @@ -1,8 +1,8 @@ -import { WEEDS_SPAWN_CHANCE } from '../../constants' +import { WEEDS_SPAWN_CHANCE } from '../../constants.js' -import { randomNumberService } from '../../common/services/randomNumber' -import { weed } from '../../data/items' -import { getPlotContentFromItemId } from '../../utils' +import { randomNumberService } from '../../common/services/randomNumber.js' +import { weed } from '../../data/items.js' +import { getPlotContentFromItemId } from '../../utils/index.js' /** * @param {?farmhand.plotContent} plotContent diff --git a/src/game-logic/reducers/spawnWeeds.test.js b/src/game-logic/reducers/spawnWeeds.test.js index dddd0d692..a51b66866 100644 --- a/src/game-logic/reducers/spawnWeeds.test.js +++ b/src/game-logic/reducers/spawnWeeds.test.js @@ -1,6 +1,6 @@ -import { randomNumberService } from '../../common/services/randomNumber' +import { randomNumberService } from '../../common/services/randomNumber.js' -import { spawnWeeds } from './spawnWeeds' +import { spawnWeeds } from './spawnWeeds.js' beforeEach(() => { vitest.spyOn(randomNumberService, 'isRandomNumberLessThan') diff --git a/src/game-logic/reducers/unlockTool.js b/src/game-logic/reducers/unlockTool.js index 933504d20..8f8f4f6fd 100644 --- a/src/game-logic/reducers/unlockTool.js +++ b/src/game-logic/reducers/unlockTool.js @@ -2,7 +2,7 @@ /** @typedef {import("../../enums").toolType} farmhand.toolType */ /** @typedef {import("../../components/Farmhand/Farmhand").farmhand.state} farmhand.state */ -import { toolLevel } from '../../enums' +import { toolLevel } from '../../enums.js' /** * @param {Object.} toolLevels diff --git a/src/game-logic/reducers/unlockTool.test.js b/src/game-logic/reducers/unlockTool.test.js index c5bcc77a3..0976fc5ca 100644 --- a/src/game-logic/reducers/unlockTool.test.js +++ b/src/game-logic/reducers/unlockTool.test.js @@ -1,6 +1,6 @@ -import { toolLevel, toolType } from '../../enums' +import { toolLevel, toolType } from '../../enums.js' -import { unlockTool } from './unlockTool' +import { unlockTool } from './unlockTool.js' describe('unlockTool', () => { it('unlocks the specified tool', () => { diff --git a/src/game-logic/reducers/updateAchievements.js b/src/game-logic/reducers/updateAchievements.js index c3a5ee802..60ecc60c0 100644 --- a/src/game-logic/reducers/updateAchievements.js +++ b/src/game-logic/reducers/updateAchievements.js @@ -1,7 +1,7 @@ -import achievements from '../../data/achievements' -import { ACHIEVEMENT_COMPLETED } from '../../templates' +import achievements from '../../data/achievements.js' +import { ACHIEVEMENT_COMPLETED } from '../../templates.js' -import { showNotification } from './showNotification' +import { showNotification } from './showNotification.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/updateAchievements.test.js b/src/game-logic/reducers/updateAchievements.test.js index b3fa08aa5..06dfdf514 100644 --- a/src/game-logic/reducers/updateAchievements.test.js +++ b/src/game-logic/reducers/updateAchievements.test.js @@ -1,11 +1,11 @@ -import { ACHIEVEMENT_COMPLETED } from '../../templates' +import { ACHIEVEMENT_COMPLETED } from '../../templates.js' describe('updateAchievements', () => { let updateAchievements beforeAll(async () => { vitest.resetModules() - vitest.mock('../../data/achievements', () => { + vitest.mock('../../data/achievements.js', () => { return { default: [ { @@ -20,7 +20,7 @@ describe('updateAchievements', () => { } }) - updateAchievements = (await vitest.importActual('./updateAchievements')) + updateAchievements = (await vitest.importActual('./updateAchievements.js')) .updateAchievements }) diff --git a/src/game-logic/reducers/updateFinancialRecords.js b/src/game-logic/reducers/updateFinancialRecords.js index 0d6fe9dac..d8a878407 100644 --- a/src/game-logic/reducers/updateFinancialRecords.js +++ b/src/game-logic/reducers/updateFinancialRecords.js @@ -1,5 +1,5 @@ -import { get7DayAverage, getProfit, moneyTotal } from '../../utils' -import { DAILY_FINANCIAL_HISTORY_RECORD_LENGTH } from '../../constants' +import { get7DayAverage, getProfit, moneyTotal } from '../../utils/index.js' +import { DAILY_FINANCIAL_HISTORY_RECORD_LENGTH } from '../../constants.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/updateFinancialRecords.test.js b/src/game-logic/reducers/updateFinancialRecords.test.js index 6ce369c9f..85fd2f5d4 100644 --- a/src/game-logic/reducers/updateFinancialRecords.test.js +++ b/src/game-logic/reducers/updateFinancialRecords.test.js @@ -1,4 +1,4 @@ -import { updateFinancialRecords } from './updateFinancialRecords' +import { updateFinancialRecords } from './updateFinancialRecords.js' describe('updateFinancialRecords', () => { test('updates financial records', () => { diff --git a/src/game-logic/reducers/updateInventoryRecordsForNextDay.test.js b/src/game-logic/reducers/updateInventoryRecordsForNextDay.test.js index ae13945ab..6041a9aed 100644 --- a/src/game-logic/reducers/updateInventoryRecordsForNextDay.test.js +++ b/src/game-logic/reducers/updateInventoryRecordsForNextDay.test.js @@ -1,4 +1,4 @@ -import { updateInventoryRecordsForNextDay } from './updateInventoryRecordsForNextDay' +import { updateInventoryRecordsForNextDay } from './updateInventoryRecordsForNextDay.js' describe('updateInventoryRecordsForNextDay', () => { test('records inventory records for next day', () => { diff --git a/src/game-logic/reducers/updateLearnedRecipes.js b/src/game-logic/reducers/updateLearnedRecipes.js index 88f39cfe8..de9d568a7 100644 --- a/src/game-logic/reducers/updateLearnedRecipes.js +++ b/src/game-logic/reducers/updateLearnedRecipes.js @@ -1,4 +1,4 @@ -import { recipesMap } from '../../data/maps' +import { recipesMap } from '../../data/maps.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/updateLearnedRecipes.test.js b/src/game-logic/reducers/updateLearnedRecipes.test.js index 434d62e18..a4f73e8a1 100644 --- a/src/game-logic/reducers/updateLearnedRecipes.test.js +++ b/src/game-logic/reducers/updateLearnedRecipes.test.js @@ -1,4 +1,4 @@ -import { updateLearnedRecipes } from './updateLearnedRecipes' +import { updateLearnedRecipes } from './updateLearnedRecipes.js' describe('updateLearnedRecipes', () => { describe('recipe condition is not met', () => { diff --git a/src/game-logic/reducers/updatePeer.js b/src/game-logic/reducers/updatePeer.js index a9b0f8e0d..e41ada96d 100644 --- a/src/game-logic/reducers/updatePeer.js +++ b/src/game-logic/reducers/updatePeer.js @@ -3,11 +3,11 @@ * @typedef {import('../../components/Farmhand/Farmhand').farmhand.state} farmhand.state * @typedef {import('../../index').farmhand.peerMetadata} farmhand.peerMetadata */ -import { MAX_LATEST_PEER_MESSAGES } from '../../constants' -import { NEW_COW_OFFERED_FOR_TRADE } from '../../templates' -import { dialogView } from '../../enums' +import { MAX_LATEST_PEER_MESSAGES } from '../../constants.js' +import { NEW_COW_OFFERED_FOR_TRADE } from '../../templates.js' +import { dialogView } from '../../enums.js' -import { showNotification } from './showNotification' +import { showNotification } from './showNotification.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/updatePeer.test.js b/src/game-logic/reducers/updatePeer.test.js index ea2c518c0..22a7f5b6d 100644 --- a/src/game-logic/reducers/updatePeer.test.js +++ b/src/game-logic/reducers/updatePeer.test.js @@ -1,13 +1,13 @@ /** * @typedef {import('../../index').farmhand.peerMetadata} farmhand.peerMetadata */ -import Farmhand from '../../components/Farmhand' -import { MAX_LATEST_PEER_MESSAGES } from '../../constants' -import { NEW_COW_OFFERED_FOR_TRADE } from '../../templates' -import { getCowStub } from '../../test-utils/stubs/cowStub' -import { getPeerMetadataStub } from '../../test-utils/stubs/peerMetadataStub' +import Farmhand from '../../components/Farmhand/index.js' +import { MAX_LATEST_PEER_MESSAGES } from '../../constants.js' +import { NEW_COW_OFFERED_FOR_TRADE } from '../../templates.js' +import { getCowStub } from '../../test-utils/stubs/cowStub.js' +import { getPeerMetadataStub } from '../../test-utils/stubs/peerMetadataStub.js' -import { updatePeer } from './updatePeer' +import { updatePeer } from './updatePeer.js' const stubPeerMetadata = getPeerMetadataStub() diff --git a/src/game-logic/reducers/updatePlotShoveledState.test.js b/src/game-logic/reducers/updatePlotShoveledState.test.js index 0cae09178..77fec89c5 100644 --- a/src/game-logic/reducers/updatePlotShoveledState.test.js +++ b/src/game-logic/reducers/updatePlotShoveledState.test.js @@ -1,4 +1,4 @@ -import { updatePlotShoveledState } from './updatePlotShoveledState' +import { updatePlotShoveledState } from './updatePlotShoveledState.js' describe('updatePlotShoveledState', () => { test('it decrements daysUntilClear if value is above 1', () => { diff --git a/src/game-logic/reducers/updatePriceEvents.test.js b/src/game-logic/reducers/updatePriceEvents.test.js index 9d5dc93f6..1afbd4b6b 100644 --- a/src/game-logic/reducers/updatePriceEvents.test.js +++ b/src/game-logic/reducers/updatePriceEvents.test.js @@ -1,4 +1,4 @@ -import { updatePriceEvents } from './updatePriceEvents' +import { updatePriceEvents } from './updatePriceEvents.js' describe('updatePriceEvents', () => { test('updates price events', () => { diff --git a/src/game-logic/reducers/upgradeTool.js b/src/game-logic/reducers/upgradeTool.js index 994cdeb24..da688231c 100644 --- a/src/game-logic/reducers/upgradeTool.js +++ b/src/game-logic/reducers/upgradeTool.js @@ -1,8 +1,8 @@ -import upgrades from '../../data/upgrades' -import { TOOL_UPGRADED_NOTIFICATION } from '../../templates' +import upgrades from '../../data/upgrades.js' +import { TOOL_UPGRADED_NOTIFICATION } from '../../templates.js' -import { showNotification } from './showNotification' -import { makeRecipe } from './makeRecipe' +import { showNotification } from './showNotification.js' +import { makeRecipe } from './makeRecipe.js' // TODO: Add tests for this reducer /** diff --git a/src/game-logic/reducers/waterAllPlots.js b/src/game-logic/reducers/waterAllPlots.js index 6aa0a0096..982a6136c 100644 --- a/src/game-logic/reducers/waterAllPlots.js +++ b/src/game-logic/reducers/waterAllPlots.js @@ -1,4 +1,4 @@ -import { waterField } from './waterField' +import { waterField } from './waterField.js' // TODO: Remove this and just use waterField directly. /** diff --git a/src/game-logic/reducers/waterAllPlots.test.js b/src/game-logic/reducers/waterAllPlots.test.js index 702f6fcbf..c7c0076da 100644 --- a/src/game-logic/reducers/waterAllPlots.test.js +++ b/src/game-logic/reducers/waterAllPlots.test.js @@ -1,9 +1,9 @@ -import { testCrop } from '../../test-utils' +import { testCrop } from '../../test-utils/index.js' -import { waterAllPlots } from './waterAllPlots' +import { waterAllPlots } from './waterAllPlots.js' -vitest.mock('../../data/maps') -vitest.mock('../../data/items') +vitest.mock('../../data/maps.js') +vitest.mock('../../data/items.js') describe('waterAllPlots', () => { test('sets wasWateredToday to true for all plots', () => { diff --git a/src/game-logic/reducers/waterField.js b/src/game-logic/reducers/waterField.js index b5dbc97a6..94b3a0bf3 100644 --- a/src/game-logic/reducers/waterField.js +++ b/src/game-logic/reducers/waterField.js @@ -1,4 +1,4 @@ -import { setWasWatered, updateField } from './helpers' +import { setWasWatered, updateField } from './helpers.js' // TODO: Add tests for this reducer /** diff --git a/src/game-logic/reducers/waterPlot.js b/src/game-logic/reducers/waterPlot.js index e86ba9f58..b4c3c6bb4 100644 --- a/src/game-logic/reducers/waterPlot.js +++ b/src/game-logic/reducers/waterPlot.js @@ -1,7 +1,7 @@ -import { getPlotContentType } from '../../utils' -import { itemType } from '../../enums' +import { getPlotContentType } from '../../utils/index.js' +import { itemType } from '../../enums.js' -import { modifyFieldPlotAt } from './modifyFieldPlotAt' +import { modifyFieldPlotAt } from './modifyFieldPlotAt.js' /** * @param {farmhand.state} state diff --git a/src/game-logic/reducers/waterPlot.test.js b/src/game-logic/reducers/waterPlot.test.js index 1b334e491..62f2466cd 100644 --- a/src/game-logic/reducers/waterPlot.test.js +++ b/src/game-logic/reducers/waterPlot.test.js @@ -1,9 +1,9 @@ -import { testCrop } from '../../test-utils' -import { getPlotContentFromItemId } from '../../utils' +import { testCrop } from '../../test-utils/index.js' +import { getPlotContentFromItemId } from '../../utils/index.js' -import { waterPlot } from './waterPlot' +import { waterPlot } from './waterPlot.js' -vitest.mock('../../data/maps') +vitest.mock('../../data/maps.js') describe('waterPlot', () => { describe('non-crop plotContent', () => { diff --git a/src/game-logic/reducers/withdrawCow.test.js b/src/game-logic/reducers/withdrawCow.test.js index 2ad78743b..794e3b9fd 100644 --- a/src/game-logic/reducers/withdrawCow.test.js +++ b/src/game-logic/reducers/withdrawCow.test.js @@ -1,4 +1,4 @@ -import { withdrawCow } from './withdrawCow' +import { withdrawCow } from './withdrawCow.js' describe('withdrawCow', () => { test('makes specified cow unavailable for trade', () => { diff --git a/src/handlers/peer-events.js b/src/handlers/peer-events.js index d1b529d34..ce7b8ffa7 100644 --- a/src/handlers/peer-events.js +++ b/src/handlers/peer-events.js @@ -1,23 +1,23 @@ /** @typedef {import('../components/Farmhand/Farmhand').default} Farmhand */ /** @typedef {import('../index').farmhand.peerMetadata} farmhand.peerMetadata */ -import { cowTradeRejectionReason } from '../enums' -import { EXPERIENCE_VALUES } from '../constants' -import { COW_TRADED_NOTIFICATION } from '../templates' +import { cowTradeRejectionReason } from '../enums.js' +import { EXPERIENCE_VALUES } from '../constants.js' +import { COW_TRADED_NOTIFICATION } from '../templates.js' import { PROGRESS_SAVED_MESSAGE, REQUESTED_COW_TRADE_UNAVAILABLE, UNKNOWN_COW_TRADE_FAILURE, -} from '../strings' -import { sleep } from '../utils' +} from '../strings.js' +import { sleep } from '../utils/index.js' import { addCowToInventory, changeCowAutomaticHugState, removeCowFromInventory, showNotification, -} from '../game-logic/reducers' +} from '../game-logic/reducers/index.js' -import { addExperience } from '../game-logic/reducers/addExperience' +import { addExperience } from '../game-logic/reducers/addExperience.js' /** * @param {Farmhand} farmhand diff --git a/src/handlers/ui-events.js b/src/handlers/ui-events.js index a3cd5f84d..acf3b424a 100644 --- a/src/handlers/ui-events.js +++ b/src/handlers/ui-events.js @@ -6,27 +6,27 @@ * @typedef {import("../index").farmhand.grape} grape */ import { saveAs } from 'file-saver' -import globalWindow from 'global/window' +import globalWindow from 'global/window.js' import { moneyTotal, reduceByPersistedKeys, transformStateDataForImport, -} from '../utils' -import { DEFAULT_ROOM, TOOLBELT_FIELD_MODES } from '../constants' +} from '../utils/index.js' +import { DEFAULT_ROOM, TOOLBELT_FIELD_MODES } from '../constants.js' import { dialogView, fieldMode, // eslint-disable-next-line no-unused-vars grapeVariety, stageFocusType, -} from '../enums' +} from '../enums.js' import { DISCONNECTING_FROM_SERVER, INVALID_DATA_PROVIDED, PROGRESS_SAVED_MESSAGE, UPDATE_AVAILABLE, -} from '../strings' +} from '../strings.js' import { clearPlot, @@ -35,8 +35,8 @@ import { minePlot, plantInPlot, waterPlot, -} from '../game-logic/reducers' -import { randomNumberService } from '../common/services/randomNumber' +} from '../game-logic/reducers/index.js' +import { randomNumberService } from '../common/services/randomNumber.js' const { CLEANUP, diff --git a/src/handlers/ui-events.test.js b/src/handlers/ui-events.test.js index 707d68a2f..72274e45c 100644 --- a/src/handlers/ui-events.test.js +++ b/src/handlers/ui-events.test.js @@ -1,10 +1,10 @@ import React from 'react' import { shallow } from 'enzyme' -import window from 'global/window' +import window from 'global/window.js' -import Farmhand from '../components/Farmhand' -import { stageFocusType, fieldMode } from '../enums' -import { randomNumberService } from '../common/services/randomNumber' +import Farmhand from '../components/Farmhand/index.js' +import { stageFocusType, fieldMode } from '../enums.js' +import { randomNumberService } from '../common/services/randomNumber.js' let component diff --git a/src/hooks/useMountState/index.js b/src/hooks/useMountState/index.js new file mode 100644 index 000000000..6ee724ea8 --- /dev/null +++ b/src/hooks/useMountState/index.js @@ -0,0 +1 @@ +export * from './useMountState.js' diff --git a/src/hooks/useMountState/index.ts b/src/hooks/useMountState/index.ts deleted file mode 100644 index b43ae1328..000000000 --- a/src/hooks/useMountState/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './useMountState' diff --git a/src/hooks/useMountState/useMountState.ts b/src/hooks/useMountState/useMountState.js similarity index 100% rename from src/hooks/useMountState/useMountState.ts rename to src/hooks/useMountState/useMountState.js diff --git a/src/img/index.js b/src/img/index.js index c0e005796..60eeef025 100644 --- a/src/img/index.js +++ b/src/img/index.js @@ -1,4 +1,4 @@ -import { grapeVariety } from '../enums' +import { grapeVariety } from '../enums.js' // Plot states import wateredPlot from './plot-states/watered-plot.png' diff --git a/src/index.js b/src/index.js index 27ce6b56a..dc5325e6b 100644 --- a/src/index.js +++ b/src/index.js @@ -2,19 +2,19 @@ * @namespace farmhand */ -import './polyfills' +import './polyfills.js' import React from 'react' import ReactDOM from 'react-dom' import { HashRouter as Router, Route } from 'react-router-dom' import './index.sass' -import Farmhand from './components/Farmhand' -import { features } from './config' +import Farmhand from './components/Farmhand/index.js' +import { features } from './config.js' import 'typeface-francois-one' import 'typeface-public-sans' // eslint-disable-next-line no-unused-vars -import { cropFamily, grapeVariety } from './enums' +import { cropFamily, grapeVariety } from './enums.js' /** * @typedef {import("./components/Farmhand/Farmhand").farmhand.state} farmhand.state diff --git a/src/mui-theme.js b/src/mui-theme.js index 4df64a359..d79f9fcea 100644 --- a/src/mui-theme.js +++ b/src/mui-theme.js @@ -1,4 +1,4 @@ -import createTheme from '@mui/material/styles/createTheme' +import createTheme from '@mui/material/styles/createTheme.js' export default createTheme({ palette: { diff --git a/src/react-app-env.d.ts b/src/react-app-env.d.ts index 938a6e16b..a29c00368 100644 --- a/src/react-app-env.d.ts +++ b/src/react-app-env.d.ts @@ -1,9 +1,9 @@ -import Farmhand from './components/Farmhand' +import Farmhand from './components/Farmhand/index.js' // TODO: Contribute type definitions for 'global' package to // https://github.com/DefinitelyTyped/DefinitelyTyped // @see https://github.com/jeremyckahn/farmhand/issues/399 -declare module 'global/window' { +declare module 'global/window.js' { export default window as Window } diff --git a/src/scripts/generate-crop-table.js b/src/scripts/generate-crop-table.js index d45a41615..cc663ca34 100755 --- a/src/scripts/generate-crop-table.js +++ b/src/scripts/generate-crop-table.js @@ -5,7 +5,7 @@ import markdownTable from 'markdown-table' import { levels } from '../data/levels.js' -import { itemsMap } from '../data/maps' +import { itemsMap } from '../data/maps.js' import { moneyString } from '../utils/moneyString.js' const getDaysToMature = seedItem => { diff --git a/src/services/cellar.js b/src/services/cellar.js index c58177cc4..262fe6415 100644 --- a/src/services/cellar.js +++ b/src/services/cellar.js @@ -5,13 +5,13 @@ import { v4 as uuid } from 'uuid' -import { fermentableItemsMap, itemsMap } from '../data/maps' -import { memoize } from '../utils/memoize' -import { getYeastRequiredForWine } from '../utils/getYeastRequiredForWine' +import { fermentableItemsMap, itemsMap } from '../data/maps.js' +import { memoize } from '../utils/memoize.js' +import { getYeastRequiredForWine } from '../utils/getYeastRequiredForWine.js' -import { PURCHASEABLE_CELLARS } from '../constants' +import { PURCHASEABLE_CELLARS } from '../constants.js' -import { wineService } from './wine' +import { wineService } from './wine.js' export class CellarService { /** diff --git a/src/services/cellar.test.js b/src/services/cellar.test.js index d995d251d..7b6f33af1 100644 --- a/src/services/cellar.test.js +++ b/src/services/cellar.test.js @@ -1,9 +1,9 @@ -import { wineChardonnay } from '../data/recipes' -import { pumpkin } from '../data/crops' +import { wineChardonnay } from '../data/recipes.js' +import { pumpkin } from '../data/crops/index.js' -import { getYeastRequiredForWine } from '../utils/getYeastRequiredForWine' +import { getYeastRequiredForWine } from '../utils/getYeastRequiredForWine.js' -import { cellarService } from './cellar' +import { cellarService } from './cellar.js' const mockUuid = 'abc123' diff --git a/src/services/wine.js b/src/services/wine.js index a284a417d..1d77c89ba 100644 --- a/src/services/wine.js +++ b/src/services/wine.js @@ -3,16 +3,16 @@ * @typedef {import('../').farmhand.recipe} recipe * @typedef {import('../').farmhand.wine} wine * @typedef {import('../').farmhand.grape} grape - * @typedef {import('../enums').grapeVariety} grapeVarietyEnum + * @typedef {import('../enums.js').grapeVariety} grapeVarietyEnum * @typedef {import('../').farmhand.keg} keg */ -import { GRAPES_REQUIRED_FOR_WINE } from '../constants' -import { wineVarietyValueMap } from '../data/crops/grape' -import { itemsMap } from '../data/maps' -import { recipeType } from '../enums' -import { getInventoryQuantityMap } from '../utils/getInventoryQuantityMap' -import { getYeastRequiredForWine } from '../utils/getYeastRequiredForWine' +import { GRAPES_REQUIRED_FOR_WINE } from '../constants.js' +import { wineVarietyValueMap } from '../data/crops/grape.js' +import { itemsMap } from '../data/maps.js' +import { recipeType } from '../enums.js' +import { getInventoryQuantityMap } from '../utils/getInventoryQuantityMap.js' +import { getYeastRequiredForWine } from '../utils/getYeastRequiredForWine.js' export class WineService { /** diff --git a/src/services/wine.test.js b/src/services/wine.test.js index 3368b1ca8..527a69bb2 100644 --- a/src/services/wine.test.js +++ b/src/services/wine.test.js @@ -1,10 +1,10 @@ -import { GRAPES_REQUIRED_FOR_WINE } from '../constants' -import { grapeChardonnay, grapeNebbiolo } from '../data/crops' -import { yeast } from '../data/recipes' -import { getKegStub } from '../test-utils/stubs/getKegStub' -import { getYeastRequiredForWine } from '../utils/getYeastRequiredForWine' +import { GRAPES_REQUIRED_FOR_WINE } from '../constants.js' +import { grapeChardonnay, grapeNebbiolo } from '../data/crops/index.js' +import { yeast } from '../data/recipes.js' +import { getKegStub } from '../test-utils/stubs/getKegStub.js' +import { getYeastRequiredForWine } from '../utils/getYeastRequiredForWine.js' -import { wineService } from './wine' +import { wineService } from './wine.js' describe('WineService', () => { describe('getMaxWineYield', () => { diff --git a/src/shell/bootup.test.js b/src/shell/bootup.test.js index 47603229e..b5d2d0952 100644 --- a/src/shell/bootup.test.js +++ b/src/shell/bootup.test.js @@ -1,8 +1,8 @@ import { screen, waitFor } from '@testing-library/react' -import { saveDataStubFactory } from '../test-utils/stubs/saveDataStubFactory' -import { farmhandStub } from '../test-utils/stubs/farmhandStub' -import { endDay } from '../test-utils/ui' +import { saveDataStubFactory } from '../test-utils/stubs/saveDataStubFactory.js' +import { farmhandStub } from '../test-utils/stubs/farmhandStub.js' +import { endDay } from '../test-utils/ui.js' describe('bootup', () => { test('boots a fresh game when there is no save file', async () => { diff --git a/src/shell/field.test.js b/src/shell/field.test.js index f729f8c60..e84101d41 100644 --- a/src/shell/field.test.js +++ b/src/shell/field.test.js @@ -1,16 +1,16 @@ import { screen } from '@testing-library/dom' import userEvent from '@testing-library/user-event' -import { saveDataStubFactory } from '../test-utils/stubs/saveDataStubFactory' -import { farmhandStub } from '../test-utils/stubs/farmhandStub' -import { nextView } from '../test-utils/ui' +import { saveDataStubFactory } from '../test-utils/stubs/saveDataStubFactory.js' +import { farmhandStub } from '../test-utils/stubs/farmhandStub.js' +import { nextView } from '../test-utils/ui.js' import { HOE_ALT_TEXT, SCYTHE_ALT_TEXT, WATERING_CAN_ALT_TEXT, -} from '../strings' -import { carrotSeed } from '../data/crops' -import { fertilizer } from '../data/recipes' +} from '../strings.js' +import { carrotSeed } from '../data/crops/index.js' +import { fertilizer } from '../data/recipes.js' describe('field interaction', () => { beforeEach(async () => { diff --git a/src/shell/game-saving.test.js b/src/shell/game-saving.test.js index 290aebb7b..c5bbcb62a 100644 --- a/src/shell/game-saving.test.js +++ b/src/shell/game-saving.test.js @@ -1,8 +1,8 @@ import { screen } from '@testing-library/react' -import { endDay } from '../test-utils/ui' -import { PROGRESS_SAVED_MESSAGE } from '../strings' -import { farmhandStub } from '../test-utils/stubs/farmhandStub' +import { endDay } from '../test-utils/ui.js' +import { PROGRESS_SAVED_MESSAGE } from '../strings.js' +import { farmhandStub } from '../test-utils/stubs/farmhandStub.js' describe('game saving', () => { test('saves the game when the day is ended', async () => { diff --git a/src/shell/navigation.test.js b/src/shell/navigation.test.js index 3694fb626..b8816ff1d 100644 --- a/src/shell/navigation.test.js +++ b/src/shell/navigation.test.js @@ -1,8 +1,8 @@ import { within } from '@testing-library/dom' -import { saveDataStubFactory } from '../test-utils/stubs/saveDataStubFactory' -import { farmhandStub } from '../test-utils/stubs/farmhandStub' -import { nextView, previousView } from '../test-utils/ui' +import { saveDataStubFactory } from '../test-utils/stubs/saveDataStubFactory.js' +import { farmhandStub } from '../test-utils/stubs/farmhandStub.js' +import { nextView, previousView } from '../test-utils/ui.js' describe('navigation', () => { test('cycles forwards through the standard views', async () => { diff --git a/src/shell/notifications.test.js b/src/shell/notifications.test.js index 539aac0be..9f0dee4ed 100644 --- a/src/shell/notifications.test.js +++ b/src/shell/notifications.test.js @@ -2,9 +2,9 @@ import { screen } from '@testing-library/react' import { within } from '@testing-library/dom' import userEvent from '@testing-library/user-event' -import { getItemByName } from '../test-utils/ui' -import { farmhandStub } from '../test-utils/stubs/farmhandStub' -import { saveDataStubFactory } from '../test-utils/stubs/saveDataStubFactory' +import { getItemByName } from '../test-utils/ui.js' +import { farmhandStub } from '../test-utils/stubs/farmhandStub.js' +import { saveDataStubFactory } from '../test-utils/stubs/saveDataStubFactory.js' describe('notifications', () => { test('notification is shown when recipe is learned', async () => { diff --git a/src/shell/pending-notifications.test.js b/src/shell/pending-notifications.test.js index a41971a24..91c92fbf9 100644 --- a/src/shell/pending-notifications.test.js +++ b/src/shell/pending-notifications.test.js @@ -1,15 +1,15 @@ import { screen } from '@testing-library/react' -import { endDay } from '../test-utils/ui' -import { STORM_MESSAGE } from '../strings' -import { farmhandStub } from '../test-utils/stubs/farmhandStub' +import { endDay } from '../test-utils/ui.js' +import { STORM_MESSAGE } from '../strings.js' +import { farmhandStub } from '../test-utils/stubs/farmhandStub.js' // This test is in its own file as a workaround for the fact that the utils // module mocking does not seem to work correctly when mixed with other tests. // This seems to be due to: https://github.com/facebook/jest/issues/8987 -vitest.mock('../utils', async () => ({ - ...(await vitest.importActual('../utils')), +vitest.mock('../utils/index.js', async () => ({ + ...(await vitest.importActual('../utils/index.js')), shouldStormToday: () => true, shouldPrecipitateToday: () => true, })) diff --git a/src/strings.js b/src/strings.js index c335567d3..62dc9b562 100644 --- a/src/strings.js +++ b/src/strings.js @@ -1,4 +1,4 @@ -import { cowColors } from './enums' +import { cowColors } from './enums.js' export const PROGRESS_SAVED_MESSAGE = 'Progress saved!' export const RAIN_MESSAGE = 'It rained in the night!' diff --git a/src/templates.js b/src/templates.js index a083283f9..1eeb44f87 100644 --- a/src/templates.js +++ b/src/templates.js @@ -10,17 +10,17 @@ * @ignore */ -import { FOREST_AVAILABLE_NOTIFICATION, SHOVEL_UNLOCKED } from './strings' -import { itemUnlockLevels, levels } from './data/levels' -import { itemsMap } from './data/maps' -import { moneyString } from './utils/moneyString' -import { stageFocusType, toolType } from './enums' +import { FOREST_AVAILABLE_NOTIFICATION, SHOVEL_UNLOCKED } from './strings.js' +import { itemUnlockLevels, levels } from './data/levels.js' +import { itemsMap } from './data/maps.js' +import { moneyString } from './utils/moneyString.js' +import { stageFocusType, toolType } from './enums.js' import { getCowDisplayName, getPlayerName, getRandomLevelUpRewardQuantity, integerString, -} from './utils' +} from './utils/index.js' /** * @param {farmhand.crop} crop diff --git a/src/test-utils/index.js b/src/test-utils/index.js index e0b02002a..d0b8074d9 100644 --- a/src/test-utils/index.js +++ b/src/test-utils/index.js @@ -1,4 +1,4 @@ -import { fertilizerType } from '../enums' +import { fertilizerType } from '../enums.js' export const shapeOf = object => Object.keys(object).reduce((acc, key) => { diff --git a/src/test-utils/stubs/cowStub.js b/src/test-utils/stubs/cowStub.js index ae999f352..3a4fbf6d2 100644 --- a/src/test-utils/stubs/cowStub.js +++ b/src/test-utils/stubs/cowStub.js @@ -1,6 +1,6 @@ /** @typedef {import('../../index').farmhand.cow} farmhand.cow */ -import { generateCow } from '../../utils' +import { generateCow } from '../../utils/index.js' /** * @param {Partial?} overrides diff --git a/src/test-utils/stubs/farmhandStub.js b/src/test-utils/stubs/farmhandStub.js index 2bb4f3e7a..7283cf58e 100644 --- a/src/test-utils/stubs/farmhandStub.js +++ b/src/test-utils/stubs/farmhandStub.js @@ -2,7 +2,7 @@ import React from 'react' import { render } from '@testing-library/react' import { MemoryRouter, Route } from 'react-router-dom' -import Farmhand from '../../components/Farmhand' +import Farmhand from '../../components/Farmhand/index.js' /** * @param {Object} [props] props to start the Farmhand instance with for diff --git a/src/test-utils/stubs/getKegStub.js b/src/test-utils/stubs/getKegStub.js index 4ded04387..cb4b119cb 100644 --- a/src/test-utils/stubs/getKegStub.js +++ b/src/test-utils/stubs/getKegStub.js @@ -2,7 +2,7 @@ import { v4 as uuid } from 'uuid' -import { carrot } from '../../data/crops' +import { carrot } from '../../data/crops/index.js' /** * @param {Partial} overrides diff --git a/src/test-utils/stubs/saveDataStubFactory.js b/src/test-utils/stubs/saveDataStubFactory.js index f1180598b..9f9d58bbd 100644 --- a/src/test-utils/stubs/saveDataStubFactory.js +++ b/src/test-utils/stubs/saveDataStubFactory.js @@ -1,4 +1,4 @@ -import { computeStateForNextDay } from '../../game-logic/reducers' +import { computeStateForNextDay } from '../../game-logic/reducers/index.js' /** * @param {Partial} state diff --git a/src/utils/farmProductsSold.js b/src/utils/farmProductsSold.js index ad44d7c19..181756f16 100644 --- a/src/utils/farmProductsSold.js +++ b/src/utils/farmProductsSold.js @@ -1,7 +1,7 @@ -import { itemsMap } from '../data/maps' +import { itemsMap } from '../data/maps.js' -import { memoize } from './memoize' -import { isItemAFarmProduct } from './isItemAFarmProduct' +import { memoize } from './memoize.js' +import { isItemAFarmProduct } from './isItemAFarmProduct.js' export const farmProductsSold = memoize( /** diff --git a/src/utils/findInField.js b/src/utils/findInField.js index 7cdeb6943..c980e6676 100644 --- a/src/utils/findInField.js +++ b/src/utils/findInField.js @@ -1,7 +1,7 @@ /** @typedef {import("../index").farmhand.plotContent} farmhand.plotContent */ -import { memoize } from './memoize' +import { memoize } from './memoize.js' -import { memoizationSerializer } from './' +import { memoizationSerializer } from './index.js' export const findInField = memoize( /** diff --git a/src/utils/findInField.test.js b/src/utils/findInField.test.js index 2bab29cdb..f0a5fdbc9 100644 --- a/src/utils/findInField.test.js +++ b/src/utils/findInField.test.js @@ -2,9 +2,9 @@ * @typedef {import("../components/Farmhand/Farmhand").farmhand.state['field']} farmhand.state.field */ -import { carrot, pumpkin } from '../data/crops' +import { carrot, pumpkin } from '../data/crops/index.js' -import { findInField } from './findInField' +import { findInField } from './findInField.js' const carrotPlot = { itemId: carrot.id, diff --git a/src/utils/getCropLifecycleDuration.js b/src/utils/getCropLifecycleDuration.js index 78b2236a7..5df549e8d 100644 --- a/src/utils/getCropLifecycleDuration.js +++ b/src/utils/getCropLifecycleDuration.js @@ -1,4 +1,4 @@ -import { memoize } from './memoize' +import { memoize } from './memoize.js' /** * @param {{ cropTimeline: number[] }} crop diff --git a/src/utils/getCropLifecycleDuration.test.js b/src/utils/getCropLifecycleDuration.test.js index 9199cde51..14935ce2b 100644 --- a/src/utils/getCropLifecycleDuration.test.js +++ b/src/utils/getCropLifecycleDuration.test.js @@ -1,6 +1,6 @@ -import { carrot } from '../data/items' +import { carrot } from '../data/items.js' -import { getCropLifecycleDuration } from './getCropLifecycleDuration' +import { getCropLifecycleDuration } from './getCropLifecycleDuration.js' describe('getCropLifecycleDuration', () => { test('computes lifecycle duration', () => { diff --git a/src/utils/getCropsAvailableToFerment.js b/src/utils/getCropsAvailableToFerment.js index 86fd56a6a..57eff067b 100644 --- a/src/utils/getCropsAvailableToFerment.js +++ b/src/utils/getCropsAvailableToFerment.js @@ -2,9 +2,9 @@ * @typedef {import('../index').farmhand.levelEntitlements} levelEntitlements * @typedef {import('../index').farmhand.item} item */ -import { itemsMap } from '../data/maps' +import { itemsMap } from '../data/maps.js' -import { getFinalCropItemFromSeedItem } from '.' +import { getFinalCropItemFromSeedItem } from './index.js' /** * @param {levelEntitlements} levelEntitlements diff --git a/src/utils/getCropsAvailableToFerment.test.js b/src/utils/getCropsAvailableToFerment.test.js index b01046c23..004844d63 100644 --- a/src/utils/getCropsAvailableToFerment.test.js +++ b/src/utils/getCropsAvailableToFerment.test.js @@ -1,7 +1,7 @@ -import { carrot, pumpkin, spinach } from '../data/crops' +import { carrot, pumpkin, spinach } from '../data/crops/index.js' -import { getCropsAvailableToFerment } from './getCropsAvailableToFerment' -import { getLevelEntitlements } from './getLevelEntitlements' +import { getCropsAvailableToFerment } from './getCropsAvailableToFerment.js' +import { getLevelEntitlements } from './getLevelEntitlements.js' describe('getCropsAvailableToFerment', () => { test.each([ diff --git a/src/utils/getInventoryQuantityMap.js b/src/utils/getInventoryQuantityMap.js index ec0d810dd..a95cfea2b 100644 --- a/src/utils/getInventoryQuantityMap.js +++ b/src/utils/getInventoryQuantityMap.js @@ -1,7 +1,7 @@ /** * @typedef {import("../index").farmhand.item} item */ -import { memoize } from './memoize' +import { memoize } from './memoize.js' export const getInventoryQuantityMap = memoize( /** diff --git a/src/utils/getItemBaseValue.js b/src/utils/getItemBaseValue.js index e6e7c9f7f..3a6ad821c 100644 --- a/src/utils/getItemBaseValue.js +++ b/src/utils/getItemBaseValue.js @@ -1,4 +1,4 @@ -import { itemsMap } from '../data/maps' +import { itemsMap } from '../data/maps.js' /** * @param {string} itemId diff --git a/src/utils/getKegSpoilageRate.js b/src/utils/getKegSpoilageRate.js index d790b55cc..9c5540afd 100644 --- a/src/utils/getKegSpoilageRate.js +++ b/src/utils/getKegSpoilageRate.js @@ -1,7 +1,7 @@ /** @typedef {import("../index").farmhand.keg} keg */ -import { KEG_SPOILAGE_RATE_MULTIPLIER } from '../constants' -import { cellarService } from '../services/cellar' +import { KEG_SPOILAGE_RATE_MULTIPLIER } from '../constants.js' +import { cellarService } from '../services/cellar.js' /** * @param {keg} keg diff --git a/src/utils/getKegSpoilageRate.test.js b/src/utils/getKegSpoilageRate.test.js index 629e18ea9..1f72c6876 100644 --- a/src/utils/getKegSpoilageRate.test.js +++ b/src/utils/getKegSpoilageRate.test.js @@ -1,8 +1,8 @@ -import { carrot } from '../data/crops' -import { wineChardonnay } from '../data/recipes' -import { getKegStub } from '../test-utils/stubs/getKegStub' +import { carrot } from '../data/crops/index.js' +import { wineChardonnay } from '../data/recipes.js' +import { getKegStub } from '../test-utils/stubs/getKegStub.js' -import { getKegSpoilageRate } from './getKegSpoilageRate' +import { getKegSpoilageRate } from './getKegSpoilageRate.js' describe('getKegSpoilageRate', () => { test('handles kegs that are not mature', () => { diff --git a/src/utils/getKegValue.js b/src/utils/getKegValue.js index 82cdf5a09..0f93640c9 100644 --- a/src/utils/getKegValue.js +++ b/src/utils/getKegValue.js @@ -4,11 +4,11 @@ import { KEG_INTEREST_RATE, WINE_GROWTH_TIMELINE_CAP, WINE_INTEREST_RATE, -} from '../constants' -import { itemsMap } from '../data/maps' -import { wineService } from '../services/wine' +} from '../constants.js' +import { itemsMap } from '../data/maps.js' +import { wineService } from '../services/wine.js' -import { getItemBaseValue } from './getItemBaseValue' +import { getItemBaseValue } from './getItemBaseValue.js' /** * @param {keg} keg diff --git a/src/utils/getKegValue.test.js b/src/utils/getKegValue.test.js index a7bb68ac5..5353f831b 100644 --- a/src/utils/getKegValue.test.js +++ b/src/utils/getKegValue.test.js @@ -1,8 +1,8 @@ -import { carrot, sunflower } from '../data/crops' -import { wineChardonnay, wineNebbiolo } from '../data/recipes' -import { getKegStub } from '../test-utils/stubs/getKegStub' +import { carrot, sunflower } from '../data/crops/index.js' +import { wineChardonnay, wineNebbiolo } from '../data/recipes.js' +import { getKegStub } from '../test-utils/stubs/getKegStub.js' -import { getKegValue } from './getKegValue' +import { getKegValue } from './getKegValue.js' describe('getKegValue', () => { test.each([ diff --git a/src/utils/getLevelEntitlements.js b/src/utils/getLevelEntitlements.js index e998ba5ab..6f893c21e 100644 --- a/src/utils/getLevelEntitlements.js +++ b/src/utils/getLevelEntitlements.js @@ -1,8 +1,8 @@ /** @typedef {import("../index").farmhand.levelEntitlements} levelEntitlements */ -import { levels } from '../data/levels' -import { INITIAL_SPRINKLER_RANGE } from '../constants' +import { levels } from '../data/levels.js' +import { INITIAL_SPRINKLER_RANGE } from '../constants.js' -import { memoize } from './memoize' +import { memoize } from './memoize.js' /** * @param {number} levelNumber diff --git a/src/utils/getLevelEntitlements.test.js b/src/utils/getLevelEntitlements.test.js index 2fb3e2b74..c2cef3d24 100644 --- a/src/utils/getLevelEntitlements.test.js +++ b/src/utils/getLevelEntitlements.test.js @@ -1,4 +1,4 @@ -import { getLevelEntitlements } from './getLevelEntitlements' +import { getLevelEntitlements } from './getLevelEntitlements.js' describe('getLevelEntitlements', () => { test('calculates level entitlements', () => { diff --git a/src/utils/getMaxYieldOfFermentationRecipe.js b/src/utils/getMaxYieldOfFermentationRecipe.js index 2284517f5..a7262a88e 100644 --- a/src/utils/getMaxYieldOfFermentationRecipe.js +++ b/src/utils/getMaxYieldOfFermentationRecipe.js @@ -1,11 +1,11 @@ /** @typedef {import("../index").farmhand.item} item */ /** @typedef {import("../index").farmhand.keg} keg */ -import { itemsMap } from '../data/maps' +import { itemsMap } from '../data/maps.js' -import { getInventoryQuantityMap } from './getInventoryQuantityMap' +import { getInventoryQuantityMap } from './getInventoryQuantityMap.js' -import { getSaltRequirementsForFermentationRecipe } from './getSaltRequirementsForFermentationRecipe' +import { getSaltRequirementsForFermentationRecipe } from './getSaltRequirementsForFermentationRecipe.js' /** * @param {item} fermentationRecipe diff --git a/src/utils/getMaxYieldOfFermentationRecipe.test.js b/src/utils/getMaxYieldOfFermentationRecipe.test.js index 8dde826bb..cd4c1d314 100644 --- a/src/utils/getMaxYieldOfFermentationRecipe.test.js +++ b/src/utils/getMaxYieldOfFermentationRecipe.test.js @@ -1,9 +1,9 @@ import { v4 as uuid } from 'uuid' -import { carrot } from '../data/crops' -import { salt } from '../data/recipes' +import { carrot } from '../data/crops/index.js' +import { salt } from '../data/recipes.js' -import { getMaxYieldOfFermentationRecipe } from './getMaxYieldOfFermentationRecipe' +import { getMaxYieldOfFermentationRecipe } from './getMaxYieldOfFermentationRecipe.js' describe('getMaxYieldOfFermentationRecipe', () => { test.each([ diff --git a/src/utils/getWineVarietiesAvailableToMake.js b/src/utils/getWineVarietiesAvailableToMake.js index 550a4accf..455b1c5e3 100644 --- a/src/utils/getWineVarietiesAvailableToMake.js +++ b/src/utils/getWineVarietiesAvailableToMake.js @@ -3,10 +3,10 @@ * @typedef {import('../index').farmhand.item} item * @typedef {import('../index').farmhand.cropVariety} cropVariety * @typedef {import('../index').farmhand.grape} grape - * @typedef {import('../enums').grapeVariety} grapeVariety + * @typedef {import('../enums.js').grapeVariety} grapeVariety */ -import { isGrape } from '../data/crops/grape' -import { itemsMap } from '../data/maps' +import { isGrape } from '../data/crops/grape.js' +import { itemsMap } from '../data/maps.js' /** * @param {itemsSold} itemsSold diff --git a/src/utils/getWineVarietiesAvailableToMake.test.js b/src/utils/getWineVarietiesAvailableToMake.test.js index ea304ee79..53e1632be 100644 --- a/src/utils/getWineVarietiesAvailableToMake.test.js +++ b/src/utils/getWineVarietiesAvailableToMake.test.js @@ -1,7 +1,7 @@ -import { carrot, grapeChardonnay, grapeTempranillo } from '../data/crops' -import { grapeVariety } from '../enums' +import { carrot, grapeChardonnay, grapeTempranillo } from '../data/crops/index.js' +import { grapeVariety } from '../enums.js' -import { getWineVarietiesAvailableToMake } from './getWineVarietiesAvailableToMake' +import { getWineVarietiesAvailableToMake } from './getWineVarietiesAvailableToMake.js' describe('getWineVarietiesAvailableToMake', () => { test.each([ diff --git a/src/utils/getYeastRequiredForWine.js b/src/utils/getYeastRequiredForWine.js index af2ea961b..889c848d0 100644 --- a/src/utils/getYeastRequiredForWine.js +++ b/src/utils/getYeastRequiredForWine.js @@ -1,7 +1,7 @@ -import { wineVarietyValueMap } from '../data/crops/grape' -import { YEAST_REQUIREMENT_FOR_WINE_MULTIPLIER } from '../constants' +import { wineVarietyValueMap } from '../data/crops/grape.js' +import { YEAST_REQUIREMENT_FOR_WINE_MULTIPLIER } from '../constants.js' // eslint-disable-next-line no-unused-vars -import { grapeVariety as grapeVarietyEnum } from '../enums' +import { grapeVariety as grapeVarietyEnum } from '../enums.js' /** * @param {grapeVarietyEnum} grapeVariety diff --git a/src/utils/index.js b/src/utils/index.js index dc72967c3..ae0c09b7b 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -24,10 +24,10 @@ import sortBy from 'lodash.sortby' import { v4 as uuid } from 'uuid' import { funAnimalName } from 'fun-animal-names' -import cowShopInventory from '../data/shop-inventory-cow' -import shopInventory from '../data/shop-inventory' -import fruitNames from '../data/fruit-names' -import { cropItemIdToSeedItemMap, itemsMap } from '../data/maps' +import cowShopInventory from '../data/shop-inventory-cow.js' +import shopInventory from '../data/shop-inventory.js' +import fruitNames from '../data/fruit-names.js' +import { cropItemIdToSeedItemMap, itemsMap } from '../data/maps.js' import { chocolateMilk, milk1, @@ -36,9 +36,9 @@ import { rainbowMilk1, rainbowMilk2, rainbowMilk3, -} from '../data/items' -import { unlockableItems } from '../data/levels' -import { items as itemImages, animals, pixel } from '../img' +} from '../data/items.js' +import { unlockableItems } from '../data/levels.js' +import { items as itemImages, animals, pixel } from '../img/index.js' import { cowColors, cropLifeStage, @@ -47,7 +47,7 @@ import { itemType, stageFocusType, standardCowColors, -} from '../enums' +} from '../enums.js' import { BREAKPOINTS, COW_COLORS_HEX_MAP, @@ -82,15 +82,15 @@ import { STORM_CHANCE, STORAGE_EXPANSION_SCALE_PREMIUM, STANDARD_VIEW_LIST, -} from '../constants' -import { random } from '../common/utils' - -import { farmProductsSold } from './farmProductsSold' -import { getCropLifecycleDuration } from './getCropLifecycleDuration' -import { getInventoryQuantityMap } from './getInventoryQuantityMap' -import { getItemBaseValue } from './getItemBaseValue' -import { getLevelEntitlements } from './getLevelEntitlements' -import { memoize } from './memoize' +} from '../constants.js' +import { random } from '../common/utils.js' + +import { farmProductsSold } from './farmProductsSold.js' +import { getCropLifecycleDuration } from './getCropLifecycleDuration.js' +import { getInventoryQuantityMap } from './getInventoryQuantityMap.js' +import { getItemBaseValue } from './getItemBaseValue.js' +import { getLevelEntitlements } from './getLevelEntitlements.js' +import { memoize } from './memoize.js' const Jimp = configureJimp({ types: [jimpPng], diff --git a/src/utils/index.test.js b/src/utils/index.test.js index bea11d5ba..85c3eb8cf 100644 --- a/src/utils/index.test.js +++ b/src/utils/index.test.js @@ -1,6 +1,6 @@ -import { testCrop } from '../test-utils' -import { items as itemImages, animals } from '../img' -import { cowColors, cropLifeStage, genders, standardCowColors } from '../enums' +import { testCrop } from '../test-utils/index.js' +import { items as itemImages, animals } from '../img/index.js' +import { cowColors, cropLifeStage, genders, standardCowColors } from '../enums.js' import { rainbowFertilizer, carrot, @@ -13,8 +13,8 @@ import { wheat, scarecrow, silverOre, -} from '../data/items' -import { carrotSoup } from '../data/recipes' +} from '../data/items.js' +import { carrotSoup } from '../data/recipes.js' import { COW_FERTILIZER_PRODUCTION_RATE_FASTEST, COW_FERTILIZER_PRODUCTION_RATE_SLOWEST, @@ -29,11 +29,11 @@ import { COW_WEIGHT_MULTIPLIER_MINIMUM, I_AM_RICH_BONUSES, MALE_COW_WEIGHT_MULTIPLIER, -} from '../constants' +} from '../constants.js' -import { levelAchieved } from './levelAchieved' -import { farmProductsSold } from './farmProductsSold' -import { isItemAFarmProduct } from './isItemAFarmProduct' +import { levelAchieved } from './levelAchieved.js' +import { farmProductsSold } from './farmProductsSold.js' +import { isItemAFarmProduct } from './isItemAFarmProduct.js' import { canMakeRecipe, @@ -70,7 +70,7 @@ import { transformStateDataForImport, getAvailableShopInventory, getRandomLevelUpReward, -} from './index' +} from './index.js' const { SEED, GROWING, GROWN } = cropLifeStage diff --git a/src/utils/isItemAFarmProduct.js b/src/utils/isItemAFarmProduct.js index 87fc6a799..8089f33a2 100644 --- a/src/utils/isItemAFarmProduct.js +++ b/src/utils/isItemAFarmProduct.js @@ -1,7 +1,7 @@ /** @typedef {import('../index').farmhand.item} farmhand.item */ -import { itemType } from '../enums' +import { itemType } from '../enums.js' -import { isItemAGrownCrop } from './isItemAGrownCrop' +import { isItemAGrownCrop } from './isItemAGrownCrop.js' const FARM_PRODUCT_TYPES = [ itemType.CRAFTED_ITEM, diff --git a/src/utils/isItemAGrownCrop.js b/src/utils/isItemAGrownCrop.js index 990f8144c..1d4470ddd 100644 --- a/src/utils/isItemAGrownCrop.js +++ b/src/utils/isItemAGrownCrop.js @@ -1,4 +1,4 @@ -import { itemType } from '../enums' +import { itemType } from '../enums.js' /** * @param {farmhand.item} item diff --git a/src/utils/memoize.js b/src/utils/memoize.js index d748da507..8ef1be425 100644 --- a/src/utils/memoize.js +++ b/src/utils/memoize.js @@ -2,7 +2,7 @@ import fastMemoize from 'fast-memoize' -import { MEMOIZE_CACHE_CLEAR_THRESHOLD } from '../constants' +import { MEMOIZE_CACHE_CLEAR_THRESHOLD } from '../constants.js' // This is basically the same as fast-memoize's default cache, except that it // clears the cache once the size exceeds MEMOIZE_CACHE_CLEAR_THRESHOLD to diff --git a/src/utils/moneyString.test.js b/src/utils/moneyString.test.js index c6350e9de..db79103cf 100644 --- a/src/utils/moneyString.test.js +++ b/src/utils/moneyString.test.js @@ -1,6 +1,6 @@ -import { moneyString } from './moneyString' +import { moneyString } from './moneyString.js' -describe('moneyString', () => { +describe('moneyString.js', () => { test('formats number to dollar string', () => { expect(moneyString(1234.567)).toEqual('$1,234.57') }) diff --git a/src/utils/totalIngredientsInRecipe.test.js b/src/utils/totalIngredientsInRecipe.test.js index 6d1050168..f1f93aeb6 100644 --- a/src/utils/totalIngredientsInRecipe.test.js +++ b/src/utils/totalIngredientsInRecipe.test.js @@ -1,4 +1,4 @@ -import { totalIngredientsInRecipe } from './totalIngredientsInRecipe' +import { totalIngredientsInRecipe } from './totalIngredientsInRecipe.js' describe('totalIngredientsInRecipe', () => { test('it can total a single ingredient upgrade', () => { diff --git a/vite.config.js b/vite.config.js index 58c5bd761..dad865b36 100644 --- a/vite.config.js +++ b/vite.config.js @@ -5,7 +5,7 @@ import { defineConfig as vitestDefineConfig } from 'vitest/config' import react from '@vitejs/plugin-react' import { VitePWA } from 'vite-plugin-pwa' -import { manifest } from './manifest' +import { manifest } from './manifest.js' // NOTE: See: // - https://stackoverflow.com/a/78012267/470685