Merge pull request #110 from utopia-os/fix-build-process

fix(source): fix build process
This commit is contained in:
antontranelis 2025-02-10 11:41:16 +00:00 committed by GitHub
commit 64397f1a9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
62 changed files with 107 additions and 91 deletions

View File

@ -2,6 +2,7 @@ import path from 'path'
import { fileURLToPath } from 'url'
import alias from '@rollup/plugin-alias'
import resolve from '@rollup/plugin-node-resolve'
import typescript from '@rollup/plugin-typescript'
import { dts } from 'rollup-plugin-dts'
import postcss from 'rollup-plugin-postcss'
@ -20,14 +21,19 @@ export default [
{
file: 'dist/index.esm.js',
format: 'esm',
sourcemap: true,
},
{
file: 'dist/index.cjs',
format: 'cjs',
sourcemap: true,
},
],
plugins: [
aliasConfig,
resolve({
extensions: ['.ts', '.tsx'],
}),
postcss({
plugins: [],
}),
@ -65,12 +71,22 @@ export default [
'react-image-crop/dist/ReactCrop.css',
'react-colorful',
'leaflet.locatecontrol/dist/L.Control.Locate.css',
'yet-another-react-lightbox',
'react-photo-album',
],
},
{
input: 'src/index.tsx',
output: [{ file: 'dist/index.d.ts', format: 'es' }],
plugins: [aliasConfig, dts()],
external: [/\.css$/],
plugins: [
aliasConfig,
dts({
respectExternal: true,
compilerOptions: {
skipLibCheck: true,
},
}),
],
external: [/\.css$/, /\.d\.ts$/], // ✅ `.d.ts` als extern behandeln
},
]

View File

@ -2,7 +2,7 @@ import { ContextWrapper } from './ContextWrapper'
import NavBar from './NavBar'
import { SetAppState } from './SetAppState'
import type { AssetsApi } from '#src/types/AssetsApi'
import type { AssetsApi } from '#types/AssetsApi'
export function AppShell({
appName,

View File

@ -6,7 +6,7 @@ import { toast } from 'react-toastify'
import { useAuth } from '#components/Auth'
import { useItems } from '#components/Map/hooks/useItems'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export default function NavBar({ appName, userType }: { appName: string; userType: string }) {
const { isAuthenticated, user, logout } = useAuth()

View File

@ -2,7 +2,7 @@ import { useEffect } from 'react'
import { useSetAppState } from './hooks/useAppState'
import type { AssetsApi } from '#src/types/AssetsApi'
import type { AssetsApi } from '#types/AssetsApi'
export const SetAppState = ({
assetsApi,

View File

@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-empty-function */
import { useCallback, useState, createContext, useContext } from 'react'
import type { AssetsApi } from '#src/types/AssetsApi'
import type { AssetsApi } from '#types/AssetsApi'
interface AppState {
assetsApi: AssetsApi

View File

@ -3,7 +3,7 @@
/* eslint-disable @typescript-eslint/no-empty-function */
import { useCallback, useState, createContext, useContext } from 'react'
import type { AssetsApi } from '#src/types/AssetsApi'
import type { AssetsApi } from '#types/AssetsApi'
type UseAssetManagerResult = ReturnType<typeof useAssetsManager>

View File

@ -5,8 +5,8 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { createContext, useState, useContext, useEffect } from 'react'
import type { UserApi } from '#src/types/UserApi'
import type { UserItem } from '#src/types/UserItem'
import type { UserApi } from '#types/UserApi'
import type { UserItem } from '#types/UserItem'
interface AuthProviderProps {
userApi: UserApi

View File

@ -5,7 +5,7 @@ import { useItems } from '#components/Map/hooks/useItems'
import { useQuestsOpen, useSetQuestOpen } from './hooks/useQuests'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export function Quests() {
const questsOpen = useQuestsOpen()

View File

@ -1,7 +1,7 @@
import { node, string } from 'prop-types'
import { Children, cloneElement, isValidElement, useEffect } from 'react'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const ItemForm = ({
children,

View File

@ -1,7 +1,7 @@
import { node, string } from 'prop-types'
import { Children, cloneElement, isValidElement } from 'react'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const ItemView = ({ children, item }: { children?: React.ReactNode; item?: Item }) => {
return (

View File

@ -28,9 +28,9 @@ import { useAddTag, useAllTagsLoaded, useGetItemTags, useTags } from './hooks/us
import { ItemFormPopup } from './Subcomponents/ItemFormPopup'
import { ItemViewPopup } from './Subcomponents/ItemViewPopup'
import type { Item } from '#src/types/Item'
import type { LayerProps } from '#src/types/LayerProps'
import type { Tag } from '#src/types/Tag'
import type { Item } from '#types/Item'
import type { LayerProps } from '#types/LayerProps'
import type { Tag } from '#types/Tag'
import type { Popup } from 'leaflet'
export const Layer = ({

View File

@ -4,8 +4,8 @@ import { useAuth } from '#components/Auth'
import { useSetPermissionData, useSetPermissionApi, useSetAdminRole } from './hooks/usePermissions'
import type { ItemsApi } from '#src/types/ItemsApi'
import type { Permission } from '#src/types/Permission'
import type { ItemsApi } from '#types/ItemsApi'
import type { Permission } from '#types/Permission'
export function Permissions({
data,

View File

@ -29,7 +29,7 @@ import MarkerIconFactory from '#utils/MarkerIconFactory'
import { LocateControl } from './LocateControl'
import { SidebarControl } from './SidebarControl'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const SearchControl = () => {
const windowDimensions = useWindowDimensions()

View File

@ -19,8 +19,8 @@ import { useAddTag, useTags } from '#components/Map/hooks/useTags'
import { hashTagRegex } from '#utils/HashTagRegex'
import { randomColor } from '#utils/RandomColor'
import type { Item } from '#src/types/Item'
import type { ItemFormPopupProps } from '#src/types/ItemFormPopupProps'
import type { Item } from '#types/Item'
import type { ItemFormPopupProps } from '#types/ItemFormPopupProps'
export function ItemFormPopup(props: ItemFormPopupProps) {
const [spinner, setSpinner] = useState(false)

View File

@ -17,8 +17,8 @@ import { useHasUserPermission } from '#components/Map/hooks/usePermissions'
import DialogModal from '#components/Templates/DialogModal'
import { getValue } from '#utils/GetValue'
import type { Item } from '#src/types/Item'
import type { ItemsApi } from '#src/types/ItemsApi'
import type { Item } from '#types/Item'
import type { ItemsApi } from '#types/ItemsApi'
export function HeaderView({
item,

View File

@ -5,7 +5,7 @@ import { Link } from 'react-router-dom'
import { useGetItemTags } from '#components/Map/hooks/useTags'
import { getValue } from '#utils/GetValue'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const PopupButton = ({
url,

View File

@ -1,4 +1,4 @@
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const PopupCheckboxInput = ({
dataField,

View File

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/prefer-optional-chain */
import { TextInput } from '#components/Input'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
interface StartEndInputProps {
item?: Item

View File

@ -1,6 +1,6 @@
import { TextAreaInput } from '#components/Input'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const PopupTextAreaInput = ({
dataField,

View File

@ -1,6 +1,6 @@
import { TextInput } from '#components/Input'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const PopupTextInput = ({
dataField,

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/prefer-optional-chain */
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const StartEndView = ({ item }: { item?: Item }) => {
return (

View File

@ -16,8 +16,8 @@ import { getValue } from '#utils/GetValue'
import { hashTagRegex } from '#utils/HashTagRegex'
import { fixUrls, mailRegex } from '#utils/ReplaceURLs'
import type { Item } from '#src/types/Item'
import type { Tag } from '#src/types/Tag'
import type { Item } from '#types/Item'
import type { Tag } from '#types/Tag'
export const TextView = ({
item,

View File

@ -20,8 +20,8 @@ import { timeAgo } from '#utils/TimeAgo'
import { HeaderView } from './ItemPopupComponents/HeaderView'
import { TextView } from './ItemPopupComponents/TextView'
import type { Item } from '#src/types/Item'
import type { ItemFormPopupProps } from '#src/types/ItemFormPopupProps'
import type { Item } from '#types/Item'
import type { ItemFormPopupProps } from '#types/ItemFormPopupProps'
export interface ItemViewPopupProps {
item: Item

View File

@ -4,8 +4,8 @@ import { useLocation } from 'react-router-dom'
import { useAddFilterTag, useFilterTags, useResetFilterTags } from './hooks/useFilter'
import { useSetTagData, useSetTagApi, useTags } from './hooks/useTags'
import type { ItemsApi } from '#src/types/ItemsApi'
import type { Tag } from '#src/types/Tag'
import type { ItemsApi } from '#types/ItemsApi'
import type { Tag } from '#types/Tag'
export function Tags({ data, api }: { data?: Tag[]; api?: ItemsApi<Tag> }) {
const setTagData = useSetTagData()

View File

@ -5,7 +5,7 @@ import { ContextWrapper } from '#components/AppShell/ContextWrapper'
import { UtopiaMapInner } from './UtopiaMapInner'
import type { UtopiaMapProps } from '#src/types/UtopiaMapProps'
import type { UtopiaMapProps } from '#types/UtopiaMapProps'
import 'react-toastify/dist/ReactToastify.css'
function UtopiaMap({

View File

@ -36,8 +36,8 @@ import { TagsControl } from './Subcomponents/Controls/TagsControl'
import { TextView } from './Subcomponents/ItemPopupComponents/TextView'
import { SelectPosition } from './Subcomponents/SelectPosition'
import type { ItemFormPopupProps } from '#src/types/ItemFormPopupProps'
import type { UtopiaMapProps } from '#src/types/UtopiaMapProps'
import type { ItemFormPopupProps } from '#types/ItemFormPopupProps'
import type { UtopiaMapProps } from '#types/UtopiaMapProps'
import type { Feature, Geometry as GeoJSONGeometry } from 'geojson'
export function UtopiaMapInner({

View File

@ -10,8 +10,8 @@ import { useNavigate } from 'react-router-dom'
import { useLayers } from './useLayers'
import useWindowDimensions from './useWindowDimension'
import type { LayerProps } from '#src/types/LayerProps'
import type { Tag } from '#src/types/Tag'
import type { LayerProps } from '#types/LayerProps'
import type { Tag } from '#types/Tag'
type ActionType =
| { type: 'ADD_TAG'; tag: Tag }

View File

@ -10,8 +10,8 @@ import { toast } from 'react-toastify'
import { useAddLayer } from './useLayers'
import type { Item } from '#src/types/Item'
import type { LayerProps } from '#src/types/LayerProps'
import type { Item } from '#types/Item'
import type { LayerProps } from '#types/LayerProps'
type ActionType =
| { type: 'ADD'; item: Item }

View File

@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-empty-function */
import { useCallback, useReducer, createContext, useContext } from 'react'
import type { LayerProps } from '#src/types/LayerProps'
import type { LayerProps } from '#types/LayerProps'
interface ActionType {
type: 'ADD LAYER'

View File

@ -3,7 +3,7 @@
/* eslint-disable @typescript-eslint/no-empty-function */
import { useCallback, useReducer, createContext, useContext } from 'react'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
import type { Marker, Popup } from 'leaflet'
interface LeafletRef {

View File

@ -10,11 +10,11 @@ import { useCallback, useReducer, createContext, useContext, useState } from 're
import { useAuth } from '#components/Auth/useAuth'
import type { Item } from '#src/types/Item'
import type { ItemsApi } from '#src/types/ItemsApi'
import type { LayerProps } from '#src/types/LayerProps'
import type { Permission } from '#src/types/Permission'
import type { PermissionAction } from '#src/types/PermissionAction'
import type { Item } from '#types/Item'
import type { ItemsApi } from '#types/ItemsApi'
import type { LayerProps } from '#types/LayerProps'
import type { Permission } from '#types/Permission'
import type { PermissionAction } from '#types/PermissionAction'
type ActionType = { type: 'ADD'; permission: Permission } | { type: 'REMOVE'; id: string }

View File

@ -14,9 +14,9 @@ import { toast } from 'react-toastify'
import { useUpdateItem } from './useItems'
import { useHasUserPermission } from './usePermissions'
import type { Item } from '#src/types/Item'
import type { ItemFormPopupProps } from '#src/types/ItemFormPopupProps'
import type { LayerProps } from '#src/types/LayerProps'
import type { Item } from '#types/Item'
import type { ItemFormPopupProps } from '#types/ItemFormPopupProps'
import type { LayerProps } from '#types/LayerProps'
import type { Point } from 'geojson'
import type { LatLng } from 'leaflet'

View File

@ -13,9 +13,9 @@ import { useCallback, useReducer, createContext, useContext, useState } from 're
import { getValue } from '#utils/GetValue'
import { hashTagRegex } from '#utils/HashTagRegex'
import type { Item } from '#src/types/Item'
import type { ItemsApi } from '#src/types/ItemsApi'
import type { Tag } from '#src/types/Tag'
import type { Item } from '#types/Item'
import type { ItemsApi } from '#types/ItemsApi'
import type { Tag } from '#types/Tag'
type ActionType = { type: 'ADD'; tag: Tag } | { type: 'REMOVE'; id: string }

View File

@ -23,8 +23,8 @@ import { OnepagerForm } from './Templates/OnepagerForm'
import { SimpleForm } from './Templates/SimpleForm'
import { TabsForm } from './Templates/TabsForm'
import type { Item } from '#src/types/Item'
import type { Tag } from '#src/types/Tag'
import type { Item } from '#types/Item'
import type { Tag } from '#types/Tag'
export function ProfileForm() {
const [state, setState] = useState({

View File

@ -29,9 +29,9 @@ import { OnepagerView } from './Templates/OnepagerView'
import { SimpleView } from './Templates/SimpleView'
import { TabsView } from './Templates/TabsView'
import type { Item } from '#src/types/Item'
import type { ItemsApi } from '#src/types/ItemsApi'
import type { Tag } from '#src/types/Tag'
import type { Item } from '#types/Item'
import type { ItemsApi } from '#types/ItemsApi'
import type { Tag } from '#types/Tag'
export function ProfileView({ attestationApi }: { attestationApi?: ItemsApi<any> }) {
const [item, setItem] = useState<Item>()

View File

@ -12,7 +12,7 @@ import { HeaderView } from '#components/Map/Subcomponents/ItemPopupComponents/He
import DialogModal from '#components/Templates/DialogModal'
import { getValue } from '#utils/GetValue'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export function ActionButton({
item,

View File

@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-return */
import { TextInput } from '#components/Input'
import type { FormState } from '#src/types/FormState'
import type { FormState } from '#types/FormState'
export const ContactInfoForm = ({
state,

View File

@ -8,7 +8,7 @@ import { Link } from 'react-router-dom'
import { useAppState } from '#components/AppShell/hooks/useAppState'
import { useItems } from '#components/Map/hooks/useItems'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const ContactInfoView = ({ item, heading }: { item: Item; heading: string }) => {
const appState = useAppState()

View File

@ -10,7 +10,7 @@ import 'react-photo-album/rows.css'
import { useAppState } from '#components/AppShell/hooks/useAppState'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const GalleryView = ({ item }: { item: Item }) => {
const [index, setIndex] = useState(-1)

View File

@ -1,6 +1,6 @@
import SocialShareBar from './SocialShareBar'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const GroupSubHeaderView = ({
item,

View File

@ -5,8 +5,8 @@ import { useEffect } from 'react'
import ComboBoxInput from '#components/Input/ComboBoxInput'
import type { FormState } from '#src/types/FormState'
import type { Item } from '#src/types/Item'
import type { FormState } from '#types/FormState'
import type { Item } from '#types/Item'
interface groupType {
groupTypes_id: {

View File

@ -10,7 +10,7 @@ import { useEffect } from 'react'
import { useAppState } from '#components/AppShell/hooks/useAppState'
import { getValue } from '#utils/GetValue'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export function LinkedItemsHeaderView({
item,

View File

@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
import { useHasUserPermission } from '#components/Map/hooks/usePermissions'
import type { LayerProps } from '#src/types/LayerProps'
import type { LayerProps } from '#types/LayerProps'
export function PlusButton({
layer,

View File

@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-return */
import { PopupStartEndInput } from '#components/Map'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const ProfileStartEndForm = ({
item,

View File

@ -1,6 +1,6 @@
import { StartEndView } from '#components/Map'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const ProfileStartEndView = ({ item }: { item: Item }) => {
return (

View File

@ -9,7 +9,7 @@ import { getValue } from '#utils/GetValue'
import { MarkdownHint } from './MarkdownHint'
import type { FormState } from '#src/types/FormState'
import type { FormState } from '#types/FormState'
export const ProfileTextForm = ({
state,

View File

@ -2,7 +2,7 @@
import { TextView } from '#components/Map'
import { getValue } from '#utils/GetValue'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const ProfileTextView = ({
item,

View File

@ -11,7 +11,7 @@ import { useTags } from '#components/Map/hooks/useTags'
import { decodeTag, encodeTag } from '#utils/FormatTags'
import { randomColor } from '#utils/RandomColor'
import type { Tag } from '#src/types/Tag'
import type { Tag } from '#types/Tag'
// eslint-disable-next-line react/prop-types
export const TagsWidget = ({ placeholder, containerStyle, defaultTags, onUpdate }) => {

View File

@ -8,8 +8,8 @@ import { GroupSubheaderForm } from '#components/Profile/Subcomponents/GroupSubhe
import { ProfileStartEndForm } from '#components/Profile/Subcomponents/ProfileStartEndForm'
import { ProfileTextForm } from '#components/Profile/Subcomponents/ProfileTextForm'
import type { FormState } from '#src/types/FormState'
import type { Item } from '#src/types/Item'
import type { FormState } from '#types/FormState'
import type { Item } from '#types/Item'
const componentMap = {
groupSubheaders: GroupSubheaderForm,

View File

@ -8,7 +8,7 @@ import { GroupSubHeaderView } from '#components/Profile/Subcomponents/GroupSubHe
import { ProfileStartEndView } from '#components/Profile/Subcomponents/ProfileStartEndView'
import { ProfileTextView } from '#components/Profile/Subcomponents/ProfileTextView'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
const componentMap = {
groupSubheaders: GroupSubHeaderView,

View File

@ -4,8 +4,8 @@ import { TextAreaInput } from '#components/Input'
import { ContactInfoForm } from '#components/Profile/Subcomponents/ContactInfoForm'
import { GroupSubheaderForm } from '#components/Profile/Subcomponents/GroupSubheaderForm'
import type { FormState } from '#src/types/FormState'
import type { Item } from '#src/types/Item'
import type { FormState } from '#types/FormState'
import type { Item } from '#types/Item'
export const OnepagerForm = ({
item,

View File

@ -4,7 +4,7 @@ import { TextView } from '#components/Map'
import { ContactInfoView } from '#components/Profile/Subcomponents/ContactInfoView'
import { GroupSubHeaderView } from '#components/Profile/Subcomponents/GroupSubHeaderView'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const OnepagerView = ({ item }: { item: Item }) => {
return (

View File

@ -1,6 +1,6 @@
import { TextView } from '#components/Map'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const SimpleView = ({ item }: { item: Item }) => {
return (

View File

@ -18,8 +18,8 @@ import { LinkedItemsHeaderView } from '#components/Profile/Subcomponents/LinkedI
import { TagView } from '#components/Templates/TagView'
import { timeAgo } from '#utils/TimeAgo'
import type { Item } from '#src/types/Item'
import type { Tag } from '#src/types/Tag'
import type { Item } from '#types/Item'
import type { Tag } from '#types/Tag'
export const TabsView = ({
attestations,

View File

@ -8,7 +8,7 @@ import { useAuth } from '#components/Auth'
import { TextInput } from '#components/Input'
import { MapOverlayPage } from '#components/Templates'
import type { UserItem } from '#src/types/UserItem'
import type { UserItem } from '#types/UserItem'
export function UserSettings() {
const { user, updateUser, loading /* token */ } = useAuth()

View File

@ -15,7 +15,7 @@ import { encodeTag } from '#utils/FormatTags'
import { hashTagRegex } from '#utils/HashTagRegex'
import { randomColor } from '#utils/RandomColor'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
// eslint-disable-next-line promise/avoid-new
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))

View File

@ -8,8 +8,8 @@ import { useItems } from '#components/Map/hooks/useItems'
import { EmojiPicker } from './EmojiPicker'
import { MapOverlayPage } from './MapOverlayPage'
import type { Item } from '#src/types/Item'
import type { ItemsApi } from '#src/types/ItemsApi'
import type { Item } from '#types/Item'
import type { ItemsApi } from '#types/ItemsApi'
export const AttestationForm = ({ api }: { api?: ItemsApi<unknown> }) => {
const items = useItems()

View File

@ -5,7 +5,7 @@ import { useState } from 'react'
import { timeAgo } from '#utils/TimeAgo'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const DateUserInfo = ({ item }: { item: Item }) => {
const [infoExpanded, setInfoExpanded] = useState<boolean>(false)

View File

@ -13,7 +13,7 @@ import { getValue } from '#utils/GetValue'
import { DateUserInfo } from './DateUserInfo'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const ItemCard = ({
i,

View File

@ -13,7 +13,7 @@ import { getValue } from '#utils/GetValue'
import { MapOverlayPage } from './MapOverlayPage'
import { TagView } from './TagView'
import type { Tag } from '#src/types/Tag'
import type { Tag } from '#types/Tag'
function groupAndCount(arr) {
const grouped = arr.reduce((acc, obj) => {

View File

@ -25,7 +25,7 @@ import { randomColor } from '#utils/RandomColor'
import { ItemCard } from './ItemCard'
import { MapOverlayPage } from './MapOverlayPage'
import type { Item } from '#src/types/Item'
import type { Item } from '#types/Item'
export const OverlayItemsIndexPage = ({
url,

View File

@ -2,7 +2,7 @@
import { decodeTag } from '#utils/FormatTags'
import type { Tag } from '#src/types/Tag'
import type { Tag } from '#types/Tag'
export const TagView = ({
tag,