Skip to content

Commit 325ae2e

Browse files
committed
Switch to tsup for package builds + enable noImplicitAny #1018
1 parent 121f416 commit 325ae2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1178
-601
lines changed

browser/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ publish
66
.husky
77
.nohup
88
.swc
9+
.tsup
910
*/lib
1011
*/dist
1112
*/dev-dist
@@ -26,3 +27,9 @@ data-browser/coverage
2627
!.yarn/versions
2728
.DS_Store
2829
**/.trunk/*
30+
31+
**/tomic-lib-**.tgz
32+
**/tomic-react-**.tgz
33+
**/tomic-svelte-**.tgz
34+
**/tomic-cli-**.tgz
35+
**/tomic-create-template-**.tgz

browser/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ This changelog covers all five packages, as they are (for now) updated as a whol
1717
- `resource.props` is now writeable: `resource.props.name = 'New Name'`.
1818
- Added `store.preloadResourceTree()` method, see docs for more info.
1919
- Fix generated ontologies not working in a Next.js server context.
20+
- Fix types masquerading as esm module in cjs build.
21+
22+
### @tomic/react
23+
24+
- Add cjs build.
2025

2126
### @tomic/cli
2227

browser/Earthfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ all:
77
BUILD +build
88
BUILD +test
99
BUILD +lint
10+
BUILD +lint-package
1011
BUILD +typedoc
1112

1213
deps:
@@ -18,6 +19,7 @@ deps:
1819
COPY react/package.json react/.
1920
COPY svelte/package.json svelte/.
2021
COPY cli/package.json cli/.
22+
COPY create-template/package.json create-template/.
2123
RUN pnpm install --frozen-lockfile --shamefully-hoist
2224
COPY . .
2325

@@ -30,6 +32,10 @@ lint:
3032
FROM +deps
3133
RUN pnpm run lint
3234

35+
lint-package:
36+
FROM +deps
37+
RUN pnpm run lint-package
38+
3339
build:
3440
FROM +deps
3541
RUN pnpm run build

browser/cli/package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
{
22
"version": "0.40.0",
33
"author": "Polle Pas",
4+
"homepage": "https://docs.atomicdata.dev/js-cli",
5+
"repository": {
6+
"type": "git",
7+
"url": "git+https://github.com/atomicdata-dev/atomic-server.git"
8+
},
9+
"bugs": {
10+
"url": "https://github.com/atomicdata-dev/atomic-server/issues"
11+
},
412
"dependencies": {
513
"@tomic/lib": "workspace:*",
614
"chalk": "^5.3.0",
@@ -9,7 +17,7 @@
917
"devDependencies": {
1018
"typescript": "^5.6.3"
1119
},
12-
"description": "",
20+
"description": "Generate types from Atomic Data ontologies",
1321
"license": "MIT",
1422
"name": "@tomic/cli",
1523
"publishConfig": {
@@ -19,7 +27,8 @@
1927
"build": "tsc",
2028
"lint": "eslint ./src --ext .js,.ts",
2129
"lint-fix": "eslint ./src --ext .js,.ts --fix",
22-
"prepublishOnly": "pnpm run build && pnpm run lint-fix",
30+
"prepublishOnly": "pnpm run build && pnpm run lint && pnpm run lint-package",
31+
"lint-package": "pnpm dlx publint",
2332
"watch": "tsc --build --watch",
2433
"start": "pnpm watch",
2534
"tsc": "pnpm exec tsc --build",

browser/create-template/package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
{
22
"version": "0.40.0",
33
"author": "Polle Pas",
4+
"homepage": "https://docs.atomicdata.dev/create-template/atomic-template",
5+
"repository": {
6+
"type": "git",
7+
"url": "git+https://github.com/atomicdata-dev/atomic-server.git"
8+
},
9+
"bugs": {
10+
"url": "https://github.com/atomicdata-dev/atomic-server/issues"
11+
},
412
"dependencies": {
513
"@tomic/lib": "workspace:*",
614
"chalk": "^5.3.0",
@@ -20,7 +28,8 @@
2028
"build": "tsc",
2129
"lint": "eslint ./src --ext .js,.ts",
2230
"lint-fix": "eslint ./src --ext .js,.ts --fix",
23-
"prepublishOnly": "pnpm run build && pnpm run lint-fix",
31+
"prepublishOnly": "pnpm run build && pnpm run lint && pnpm run lint-package",
32+
"lint-package": "pnpm dlx publint",
2433
"watch": "tsc --build --watch",
2534
"start": "pnpm exec tsc --build --watch",
2635
"tsc": "pnpm exec tsc --build",

browser/data-browser/src/App.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BrowserRouter } from 'react-router-dom';
22
import { HelmetProvider } from 'react-helmet-async';
33
import { StoreContext, Store } from '@tomic/react';
4-
import { StyleSheetManager } from 'styled-components';
4+
import { StyleSheetManager, type ShouldForwardProp } from 'styled-components';
55

66
import { GlobalStyle, ThemeWrapper } from './styling';
77
import { AppRoutes } from './routes/Routes';
@@ -75,15 +75,15 @@ if (isDev()) {
7575
}
7676

7777
// This implements the default behavior from styled-components v5
78-
function shouldForwardProp(propName, target) {
78+
const shouldForwardProp: ShouldForwardProp<'web'> = (propName, target) => {
7979
if (typeof target === 'string') {
8080
// For HTML elements, forward the prop if it is a valid HTML attribute
8181
return isPropValid(propName);
8282
}
8383

8484
// For other elements, forward all props
8585
return true;
86-
}
86+
};
8787

8888
/** Entrypoint of the application. This is where providers go. */
8989
function App(): JSX.Element {
@@ -97,11 +97,10 @@ function App(): JSX.Element {
9797
<HotKeysWrapper>
9898
<StyleSheetManager shouldForwardProp={shouldForwardProp}>
9999
<ThemeWrapper>
100-
{/* @ts-ignore TODO: Check if types are fixed or upgrade styled-components to 6.0.0 */}
101100
<GlobalStyle />
102101
{/* @ts-ignore fallback component type too strict */}
103102
<ErrBoundary FallbackComponent={CrashPage}>
104-
{/* Default form validation provider. Does not do anyting on its own but will make sure useValidation works without context*/}
103+
{/* Default form validation provider. Does not do anything on its own but will make sure useValidation works without context*/}
105104
<FormValidationContextProvider
106105
onValidationChange={() => undefined}
107106
>

browser/data-browser/src/chunks/CurrencyPicker/processCurrencyFile.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const processCurrencyFile = (xmlStr: string): string => {
1010
const parser = new DOMParser();
1111
const xmlDoc = parser.parseFromString(xmlStr, 'text/xml');
1212
const currencyNodes = xmlDoc.getElementsByTagName('CcyNtry');
13-
const currencyMap = {};
13+
const currencyMap: Record<string, string> = {};
1414

1515
for (let i = 0; i < currencyNodes.length; i++) {
1616
const currencyNode = currencyNodes[i];
@@ -22,7 +22,10 @@ export const processCurrencyFile = (xmlStr: string): string => {
2222

2323
const currencyName =
2424
currencyNode.getElementsByTagName('CcyNm')[0]?.textContent;
25-
currencyMap[code] = currencyName;
25+
26+
if (currencyName) {
27+
currencyMap[code] = currencyName;
28+
}
2629
}
2730

2831
return JSON.stringify(currencyMap);

browser/data-browser/src/chunks/MarkdownEditor/SlashMenu/CommandsExtension.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const SlashCommands = Extension.create({
2222
return {
2323
suggestion: {
2424
char: '/',
25+
// @ts-expect-error Tiptap typing is not very good or clear so they're just any.
2526
command: ({ editor, range, props }) => {
2627
props.command({ editor, range });
2728
},
@@ -46,7 +47,7 @@ export const suggestion: Partial<SuggestionOptions> = {
4647
icon: FaListUl,
4748
command: ({ editor, range }) =>
4849
editor.chain().focus().deleteRange(range).toggleBulletList().run(),
49-
},
50+
} as CommandItem,
5051
{
5152
title: 'Codeblock',
5253
icon: FaCode,

browser/data-browser/src/components/Dropdown/DefaultTrigger.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { useId } from 'react';
22
import { IconButton } from '../IconButton/IconButton';
3-
import { DropdownTriggerRenderFunction } from './DropdownTrigger';
3+
import {
4+
DropdownTriggerRenderFunction,
5+
type DropdownTriggerProps,
6+
} from './DropdownTrigger';
47

58
/** Builds a default trigger for a dropdown menu using an IconButton.
69
* Make sure the component stays mounted when the menu is open in order to have proper focus management.
@@ -11,7 +14,7 @@ export const buildDefaultTrigger = (
1114
ButtonComp: typeof IconButton = IconButton,
1215
): DropdownTriggerRenderFunction => {
1316
const Comp = (
14-
{ onClick, menuId, isActive },
17+
{ onClick, menuId, isActive }: DropdownTriggerProps,
1518
ref: React.Ref<HTMLButtonElement>,
1619
) => {
1720
const id = useId();

browser/data-browser/src/components/SearchFilter.tsx

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)