Skip to content

Commit

Permalink
Update all packages to use ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
gausie committed Nov 22, 2024
1 parent bf9ec50 commit 09f60b2
Show file tree
Hide file tree
Showing 68 changed files with 201 additions and 202 deletions.
2 changes: 1 addition & 1 deletion packages/greenbox-data/data/iotms.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { KnownProperty } from "libram";
import { type KnownProperty } from "libram";

interface BaseIotM {
id: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-data/data/paths.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PathDef } from "../lib/types";
import { PathDef } from "../lib/types.js";

const enum ItemId {
// Softcore Standard 2024
Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-data/data/tattoos.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TattooDef } from "../lib/types";
import { TattooDef } from "../lib/types.js";

export default [
{ name: "8-Bit Finery", image: "swordtat", outfit: 15 },
Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-data/data/trophies.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TrophyDef } from "../lib/types";
import { TrophyDef } from "../lib/types.js";

export default [
{ id: 1, name: "Little Boat", image: "gonna_need_a_smaller_boat" },
Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-data/lib/familiars.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { tuple } from "./utils";
import { tuple } from "./utils.js";

export const enum FamiliarStatus {
NONE = 0,
Expand Down
36 changes: 18 additions & 18 deletions packages/greenbox-data/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import jsoncrush from "jsoncrush";

import { compressFamiliars, expandFamiliars, RawFamiliar } from "./familiars";
import { compressIotMs, expandIotMs, RawIotM } from "./iotms";
import { compressItems, expandItems, RawItem } from "./items";
import { compressMeta, expandMeta, Meta } from "./meta";
import { compressPaths, expandPaths, RawPath } from "./paths";
import { compressSkills, expandSkills, RawSkill } from "./skills";
import { compressTattoos, expandTattoos, RawTattoo } from "./tattoos";
import { compressTrophies, expandTrophies, RawTrophy } from "./trophies";
import { compressFamiliars, expandFamiliars, RawFamiliar } from "./familiars.js";
import { compressIotMs, expandIotMs, RawIotM } from "./iotms.js";
import { compressItems, expandItems, RawItem } from "./items.js";
import { compressMeta, expandMeta, Meta } from "./meta.js";
import { compressPaths, expandPaths, RawPath } from "./paths.js";
import { compressSkills, expandSkills, RawSkill } from "./skills.js";
import { compressTattoos, expandTattoos, RawTattoo } from "./tattoos.js";
import { compressTrophies, expandTrophies, RawTrophy } from "./trophies.js";

export { isSkillPermable } from "data-of-loathing";
export * from "./familiars";
export * from "./items";
export * from "./paths";
export * from "./skills";
export type { RawTattoo } from "./tattoos";
export * from "./familiars.js";
export * from "./items.js";
export * from "./paths.js";
export * from "./skills.js";
export type { RawTattoo } from "./tattoos.js";
export {
loadTattoos,
getMiscTattoos,
Expand All @@ -23,13 +23,13 @@ export {
isOutfitTattoo,
isMiscTattoo,
OutfitTattooStatus,
} from "./tattoos";
export * from "./trophies";
export * from "./iotms";
} from "./tattoos.js";
export * from "./trophies.js";
export * from "./iotms.js";

export * from "./types";
export * from "./types.js";

export { arrayOf, tuple } from "./utils";
export { arrayOf, tuple } from "./utils.js";

/**
* Major version number for the snapshot data
Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-data/lib/iotms.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import iotms, { IotMDef } from "../data/iotms";
import iotms, { IotMDef } from "../data/iotms.js";

export const enum IotMStatus {
NONE = 0,
Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-data/lib/items.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { specialItems } from "../data/items";
import { specialItems } from "../data/items.js";

export const enum ItemStatus {
NONE = 0,
Expand Down
6 changes: 3 additions & 3 deletions packages/greenbox-data/lib/paths.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import paths, { HARDCORE, SOFTCORE } from "../data/paths";
import paths, { HARDCORE, SOFTCORE } from "../data/paths.js";

import { ItemStatus } from "./items";
import { tuple } from "./utils";
import { ItemStatus } from "./items.js";
import { tuple } from "./utils.js";

export { SOFTCORE, HARDCORE };

Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-data/lib/skills.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { tuple } from "./utils";
import { tuple } from "./utils.js";

export const enum SkillStatus {
NONE = 0,
Expand Down
6 changes: 3 additions & 3 deletions packages/greenbox-data/lib/tattoos.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import tattoos from "../data/tattoos";
import tattoos from "../data/tattoos.js";

import { MiscTattooDef, OutfitTattooDef, TattooDef } from "./types";
import { arrayOf } from "./utils";
import { MiscTattooDef, OutfitTattooDef, TattooDef } from "./types.js";
import { arrayOf } from "./utils.js";

export const enum OutfitTattooStatus {
NONE = 0,
Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-data/lib/trophies.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import trophies from "../data/trophies";
import trophies from "../data/trophies.js";

export const enum TrophyStatus {
NONE = 0,
Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-data/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "greenbox-data",
"version": "0.0.1",
"version": "0.0.2",
"description": "> TODO: description",
"author": "Sam Gaus <[email protected]>",
"homepage": "https://github.com/loathers/greenbox#readme",
Expand Down
4 changes: 2 additions & 2 deletions packages/greenbox-data/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "node",
"module": "NodeNext",
"moduleResolution": "nodenext",
"resolveJsonModule": true,
"noEmit": true
},
Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-script/src/greenbox.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from "fs/promises";
import { loadTattoos, OutfitTattooStatus } from "greenbox-data";
import { describe, expect, it, vi } from "vitest";

import { getTattooStatus } from "./greenbox";
import { getTattooStatus } from "./greenbox.js";

vi.mock("libram", () => ({
property: {
Expand Down
4 changes: 2 additions & 2 deletions packages/greenbox-script/src/greenbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ import {
} from "kolmafia";
import { Kmail, property } from "libram";

import { getIotMStatus, IotMOptions } from "./iotms";
import { haveItem } from "./utils";
import { getIotMStatus, IotMOptions } from "./iotms.js";
import { haveItem } from "./utils.js";

const { getBoolean, getNumber } = property;

Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-script/src/iotms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from "kolmafia";
import { flat, getFoldGroup, haveInCampground, property } from "libram";

import { haveItem } from "./utils";
import { haveItem } from "./utils.js";

export type IotMOptions = Partial<{
force: number[];
Expand Down
3 changes: 2 additions & 1 deletion packages/greenbox-script/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"declaration": false,
"forceConsistentCasingInFileNames": true,
"lib": ["es2018"],
"module": "commonjs",
"module": "NodeNext",
"moduleResolution": "nodenext",
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-web/src/components/AlphaImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SystemStyleObject } from "@chakra-ui/react";
import Color from "color";
import { useEffect, useMemo, useState } from "react";

import Image from "./Image";
import Image from "./Image.js";

function getEraserStartPoints(
src: string,
Expand Down
6 changes: 3 additions & 3 deletions packages/greenbox-web/src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { PersistGate } from "redux-persist/integration/react";
import { QueryParamProvider } from "use-query-params";
import { WindowHistoryAdapter } from "use-query-params/adapters/window";

import { persistor, store } from "../store";
import { theme } from "../theme";
import { persistor, store } from "../store/index.js";
import { theme } from "../theme.js";

import MainPage from "./MainPage";
import MainPage from "./MainPage.js";

export default function App() {
return (
Expand Down
6 changes: 3 additions & 3 deletions packages/greenbox-web/src/components/ClanDungeons.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Accordion } from "@chakra-ui/react";

import DreadsylvaniaSection from "./DreadsylvaniaSection";
import HobopoliSection from "./HobopolisSection";
import SlimeTubeSection from "./SlimeTubeSection";
import DreadsylvaniaSection from "./DreadsylvaniaSection.js";
import HobopoliSection from "./HobopolisSection.js";
import SlimeTubeSection from "./SlimeTubeSection.js";

export default function ClanDungeons() {
return (
Expand Down
12 changes: 6 additions & 6 deletions packages/greenbox-web/src/components/DreadsylvaniaSection.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useAppSelector } from "../hooks";
import { selectIdToPlayerItems } from "../store";
import { useAppSelector } from "../hooks.js";
import { selectIdToPlayerItems } from "../store/index.js";

import DreadsylvaniaSkills from "./DreadsylvaniaSkills";
import ItemGrid from "./ItemGrid";
import Section from "./Section";
import Subsection from "./Subsection";
import DreadsylvaniaSkills from "./DreadsylvaniaSkills.js";
import ItemGrid from "./ItemGrid.js";
import Section from "./Section.js";
import Subsection from "./Subsection.js";

const THE_TERRIFIED_EAGLE_INN = [
6423, // Tales of Dread
Expand Down
6 changes: 3 additions & 3 deletions packages/greenbox-web/src/components/DreadsylvaniaSkills.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
Tr,
} from "@chakra-ui/react";

import AlphaImage from "./AlphaImage";
import Skill from "./Skill";
import Subsection from "./Subsection";
import AlphaImage from "./AlphaImage.js";
import Skill from "./Skill.js";
import Subsection from "./Subsection.js";

function BlankCell() {
return <Td bg="chakra-border-color"></Td>;
Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-web/src/components/Familiar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FamiliarType } from "data-of-loathing";
import { FamiliarStatus } from "greenbox-data";

import Medal from "./Medal.js";
import Thing from "./Thing";
import Thing from "./Thing.js";

type Props = {
familiar: FamiliarType;
Expand Down
12 changes: 6 additions & 6 deletions packages/greenbox-web/src/components/Familiars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { isFamiliarOwnable } from "data-of-loathing";
import { FamiliarStatus } from "greenbox-data";
import { useMemo, useState } from "react";

import { useAppSelector } from "../hooks";
import { createPlayerDataSelector } from "../store";
import { useAppSelector } from "../hooks.js";
import { createPlayerDataSelector } from "../store/index.js";

import Familiar from "./Familiar";
import HundredPercentedUnownableFamiliars from "./HundredPercentedUnownableFamiliars";
import Section from "./Section";
import { SortOrderSelect, sortByKey } from "./SortOrderSelect";
import Familiar from "./Familiar.js";
import HundredPercentedUnownableFamiliars from "./HundredPercentedUnownableFamiliars.js";
import Section from "./Section.js";
import { SortOrderSelect, sortByKey } from "./SortOrderSelect.js";

const selectPlayerFamiliars = createPlayerDataSelector("familiars");

Expand Down
6 changes: 3 additions & 3 deletions packages/greenbox-web/src/components/FavouriteButton.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { IconButton } from "@chakra-ui/react";
import { useCallback } from "react";

import { useAppDispatch, useAppSelector } from "../hooks";
import { updateFavouritePlayerId } from "../store";
import { useAppDispatch, useAppSelector } from "../hooks.js";
import { updateFavouritePlayerId } from "../store/index.js";

import Image from "./Image";
import Image from "./Image.js";

export function FavouriteButton() {
const playerId = useAppSelector((state) => state.playerId);
Expand Down
12 changes: 6 additions & 6 deletions packages/greenbox-web/src/components/General.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Accordion } from "@chakra-ui/react";

import Familiars from "./Familiars";
import IotMs from "./IotMs";
import Paths from "./Paths";
import Skills from "./Skills";
import Tattoos from "./Tattoos";
import Trophies from "./Trophies";
import Familiars from "./Familiars.js";
import IotMs from "./IotMs.js";
import Paths from "./Paths.js";
import Skills from "./Skills.js";
import Tattoos from "./Tattoos.js";
import Trophies from "./Trophies.js";

export default function General() {
return (
Expand Down
10 changes: 5 additions & 5 deletions packages/greenbox-web/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import {
import { RawSnapshotData } from "greenbox-data";
import { useCallback } from "react";

import { useAppDispatch } from "../hooks";
import { fetchAll } from "../store";
import { useAppDispatch } from "../hooks.js";
import { fetchAll } from "../store/index.js";

import MetaInfo from "./MetaInfo";
import Spinner from "./Spinner";
import SwitchButton from "./SwitchButton";
import MetaInfo from "./MetaInfo.js";
import Spinner from "./Spinner.js";
import SwitchButton from "./SwitchButton.js";

type Props = {
meta?: RawSnapshotData["meta"];
Expand Down
12 changes: 6 additions & 6 deletions packages/greenbox-web/src/components/HobopolisSection.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { SimpleGrid } from "@chakra-ui/react";

import { useAppSelector } from "../hooks";
import { selectIdToPlayerItems } from "../store";
import { useAppSelector } from "../hooks.js";
import { selectIdToPlayerItems } from "../store/index.js";

import ItemGrid from "./ItemGrid";
import Section from "./Section";
import Skill from "./Skill";
import Subsection from "./Subsection";
import ItemGrid from "./ItemGrid.js";
import Section from "./Section.js";
import Skill from "./Skill.js";
import Subsection from "./Subsection.js";

const JOURNAL_SKILLS = [
38, // Natural Born Scrabbler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { SimpleGrid, Text } from "@chakra-ui/react";
import type { FamiliarType } from "data-of-loathing";
import { Fragment } from "react";

import AlphaImage from "./AlphaImage";
import Medal from "./Medal";
import AlphaImage from "./AlphaImage.js";
import Medal from "./Medal.js";

type Props = {
familiars: FamiliarType[];
Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-web/src/components/Image.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Image as ChakraImage, ImageProps } from "@chakra-ui/react";

import { useColorModeFilter } from "../theme";
import { useColorModeFilter } from "../theme.js";

export default function Image(props: ImageProps) {
const filter = useColorModeFilter();
Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-web/src/components/ImageParty.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Box } from "@chakra-ui/react";
import he from "he";

import AlphaImage from "./AlphaImage";
import AlphaImage from "./AlphaImage.js";

type Props = {
titles: string[];
Expand Down
2 changes: 1 addition & 1 deletion packages/greenbox-web/src/components/IotM.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ItemType } from "data-of-loathing";
import { IotMDef, IotMStatus } from "greenbox-data";

import Thing from "./Thing";
import Thing from "./Thing.js";

type Props = {
item: ItemType;
Expand Down
Loading

0 comments on commit 09f60b2

Please sign in to comment.