Skip to content

Commit

Permalink
fix various bundling/packaging issues (finos#1256)
Browse files Browse the repository at this point in the history
* fix various bundling/packaging issues

* type issues

* fix url resolution of feature bundles
  • Loading branch information
heswell authored Mar 7, 2024
1 parent c2eef4b commit 59ac37d
Show file tree
Hide file tree
Showing 32 changed files with 92 additions and 63 deletions.
2 changes: 1 addition & 1 deletion vuu-ui/packages/vuu-data-ag-grid/src/FilterDataProvider.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SuggestionFetcher } from "@finos/vuu-data-react";
import { SuggestionFetcher } from "@finos/vuu-data-types";
import { TypeaheadParams, VuuTable } from "@finos/vuu-protocol-types";
import { MutableRefObject } from "react";

Expand Down
7 changes: 5 additions & 2 deletions vuu-ui/packages/vuu-data-ag-grid/src/useViewportRowModel.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import {
MenuActionConfig,
SuggestionFetcher,
useTypeaheadSuggestions,
useVuuMenuActions,
VuuMenuActionHandler,
VuuServerMenuOptions,
} from "@finos/vuu-data-react";
import { VuuDataSource } from "@finos/vuu-data-remote";

import { RpcResponseHandler, VuuFeatureMessage } from "@finos/vuu-data-types";
import {
RpcResponseHandler,
SuggestionFetcher,
VuuFeatureMessage,
} from "@finos/vuu-data-types";
import { VuuGroupBy, VuuMenu, VuuTable } from "@finos/vuu-protocol-types";
import { ColumnDescriptor } from "@finos/vuu-table-types";
import {
Expand Down
3 changes: 2 additions & 1 deletion vuu-ui/packages/vuu-data-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
},
"dependencies": {
"@finos/vuu-utils": "0.0.26"
}
},
"sideEffects": false
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { makeRpcCall } from "@finos/vuu-data-remote";
import { TableSchemaTable } from "@finos/vuu-data-types";
import { SuggestionFetcher, TableSchemaTable } from "@finos/vuu-data-types";
import {
ClientToServerGetUniqueValues,
ClientToServerGetUniqueValuesStartingWith,
TypeaheadParams,
} from "@finos/vuu-protocol-types";
import { useCallback } from "react";

export type SuggestionFetcher = (params: TypeaheadParams) => Promise<string[]>;

// const SPECIAL_SPACE = "_";
const TYPEAHEAD_MESSAGE_CONSTANTS = {
type: "RPC_CALL",
Expand Down
6 changes: 3 additions & 3 deletions vuu-ui/packages/vuu-data-remote/src/inlined-worker.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion vuu-ui/packages/vuu-data-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
},
"dependencies": {
"@finos/vuu-data-local": "0.0.26",
"@finos/vuu-utils": "0.0.26",
"@thomaschaplin/isin-generator": "1.0.3"
},
"devDependencies": {
"@finos/vuu-protocol-types": "0.0.26",
"@finos/vuu-data-types": "0.0.26",
"@finos/vuu-table-types": "0.0.26"
}
},
"sideEffects": false
}
8 changes: 8 additions & 0 deletions vuu-ui/packages/vuu-data-test/src/basket/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export {
type BasketsTableName,
schemas as basketSchemas,
} from "./basket-schemas";
export {
default as basketModule,
createBasketTradingRow,
} from "./basket-module";
7 changes: 3 additions & 4 deletions vuu-ui/packages/vuu-data-test/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ export * from "./schemas";
export * from "./TickingArrayDataSource";
export * from "./vuu-row-generator";
export * from "./vuu-modules";
export { type BasketsTableName } from "./basket/basket-schemas";
export { createBasketTradingRow } from "./basket/basket-module";
export { type SimulTableName } from "./simul/simul-schemas";
export { type TestTableName } from "./test/test-schemas";
export * from "./basket";
export * from "./simul";
export * from "./test";
export * from "./Table";
2 changes: 2 additions & 0 deletions vuu-ui/packages/vuu-data-test/src/simul/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { type SimulTableName, schemas as simulSchemas } from "./simul-schemas";
export { default as simulModule } from "./simul-module";
2 changes: 1 addition & 1 deletion vuu-ui/packages/vuu-data-test/src/simul/simul-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import pricesTable from "./reference-data/prices";
import { schemas, SimulTableName } from "./simul-schemas";
import { buildDataColumnMap, joinTables, Table } from "../Table";
import { TypeaheadParams } from "@finos/vuu-protocol-types";
import { SuggestionFetcher } from "@finos/vuu-data-react";
import { SuggestionFetcher } from "@finos/vuu-data-types";
import { makeSuggestions } from "../makeSuggestions";

const tables: Record<SimulTableName, Table> = {
Expand Down
1 change: 1 addition & 0 deletions vuu-ui/packages/vuu-data-test/src/test/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { type TestTableName } from "./test-schemas";
4 changes: 2 additions & 2 deletions vuu-ui/packages/vuu-data-test/src/test/test-module.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { TickingArrayDataSource } from "../TickingArrayDataSource";
import { schemas, TestTableName } from "./test-schemas";
import { buildDataColumnMap, Table } from "../Table";
import type { SuggestionFetcher } from "@finos/vuu-data-react";
import { TypeaheadParams } from "packages/vuu-protocol-types";
import type { SuggestionFetcher } from "@finos/vuu-data-types";
import { TypeaheadParams } from "@finos/vuu-protocol-types";
import { makeSuggestions } from "../makeSuggestions";
import { VuuModule } from "../vuu-modules";
import { defaultGenerators } from "../vuu-row-generator";
Expand Down
5 changes: 3 additions & 2 deletions vuu-ui/packages/vuu-data-test/src/vuu-modules.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { DataSource } from "@finos/vuu-data-types";
import { SuggestionFetcher } from "@finos/vuu-data-react";
import { DataSource, SuggestionFetcher } from "@finos/vuu-data-types";
import basketModule from "./basket/basket-module";
import { BasketsTableName } from "./basket/basket-schemas";
import simulModule from "./simul/simul-module";
Expand All @@ -25,6 +24,8 @@ const vuuModules: Record<
TEST: testModule,
};

// Note, this is useful but be aware that all modules will be bundled if this is imported.
// If only a single module is required, better to import it directly.
export const vuuModule = <T extends string = string>(
moduleName: VuuModuleName
) => vuuModules[moduleName] as VuuModule<T>;
2 changes: 2 additions & 0 deletions vuu-ui/packages/vuu-data-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ export type DataSourceStatus =
| "suspended"
| "unsubscribed";

export type SuggestionFetcher = (params: TypeaheadParams) => Promise<string[]>;

export interface TypeaheadSuggestionProvider {
getTypeaheadSuggestions: (
columnName: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { SuggestionFetcher } from "@finos/vuu-data-react";
import { TableSchema } from "@finos/vuu-data-types";
import { SuggestionFetcher, TableSchema } from "@finos/vuu-data-types";
import { ColumnDescriptorsByName, FilterClause } from "@finos/vuu-filter-types";
import { ColumnDescriptor } from "@finos/vuu-table-types";
import { CloseReason } from "@finos/vuu-ui-controls";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,15 @@ import {
useState,
} from "react";
import { TypeaheadParams, VuuTable } from "@finos/vuu-protocol-types";
import {
SuggestionFetcher,
useTypeaheadSuggestions,
} from "@finos/vuu-data-react";
import { useTypeaheadSuggestions } from "@finos/vuu-data-react";
import {
ExpandoInput,
MultiSelectionHandler,
SingleSelectionHandler,
} from "@finos/vuu-ui-controls";
import { ExpandoCombobox } from "./ExpandoCombobox";
import { FilterClauseValueEditor } from "./filterClauseTypes";
import { TableSchemaTable } from "@finos/vuu-data-types";
import { SuggestionFetcher, TableSchemaTable } from "@finos/vuu-data-types";

const selectionKeys = ["Enter", " "];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import {
} from "@finos/vuu-codemirror";
import {
getTypeaheadParams,
SuggestionFetcher,
useTypeaheadSuggestions,
} from "@finos/vuu-data-react";
import { ColumnDescriptor } from "@finos/vuu-table-types";
import { SuggestionFetcher } from "@finos/vuu-data-types";
import { Filter } from "@finos/vuu-filter-types";
import { VuuTable } from "@finos/vuu-protocol-types";
import { ColumnDescriptor } from "@finos/vuu-table-types";
// import { isMappedValueTypeRenderer, isTypeDescriptor } from "@finos/vuu-utils";
import { useCallback, useRef } from "react";
import { filterInfo } from "./filterInfo";
Expand Down
3 changes: 2 additions & 1 deletion vuu-ui/packages/vuu-shell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
"clsx": "^2.0.0",
"react": ">=17.0.2",
"react-dom": ">=17.0.2"
}
},
"sideEffects": false
}
10 changes: 5 additions & 5 deletions vuu-ui/packages/vuu-shell/src/shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
StackLayout,
} from "@finos/vuu-layout";
import { LayoutChangeHandler } from "@finos/vuu-layout/src/layout-reducer";
import { ContextMenuProvider, useDialog } from "@finos/vuu-popups";
import {
logger,
ThemeMode,
Expand All @@ -22,15 +23,14 @@ import {
} from "react";
import { AppHeader } from "./app-header";
import { useLayoutManager } from "./layout-management";
import { SidePanelProps, useShellLayout } from "./shell-layouts";
import { SaveLocation } from "./shellTypes";

import { ContextMenuProvider, useDialog } from "@finos/vuu-popups";
import "./shell.css";
import {
loadingApplicationJson,
useLayoutContextMenuItems,
} from "./persistence-management";
import { SidePanelProps, useShellLayout } from "./shell-layouts";
import { SaveLocation } from "./shellTypes";

import "./shell.css";

if (typeof StackLayout !== "function") {
console.warn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
getCalculatedColumnType,
} from "@finos/vuu-utils";
import { FormField, FormFieldLabel, Input } from "@salt-ds/core";
import { VuuColumnDataType } from "packages/vuu-protocol-types";
import { VuuColumnDataType } from "@finos/vuu-protocol-types";
import { HTMLAttributes, useCallback, useRef } from "react";
import {
ColumnExpressionInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
updateColumnType,
queryClosest,
} from "@finos/vuu-utils";
import { VuuColumnDataType } from "packages/vuu-protocol-types";
import { VuuColumnDataType } from "@finos/vuu-protocol-types";
import {
FormEventHandler,
useCallback,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
subscribedOnly,
useLayoutEffectSkipFirst,
} from "@finos/vuu-utils";
import { Commithandler } from "packages/vuu-ui-controls/src";
import { Commithandler } from "@finos/vuu-ui-controls/src";
import {
MouseEvent,
SyntheticEvent,
Expand Down
2 changes: 1 addition & 1 deletion vuu-ui/packages/vuu-table-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
import type { VuuDataRow } from "@finos/vuu-protocol-types";
import type { ClientSideValidationChecker } from "@finos/vuu-ui-controls";
import type { DateTimePattern } from "@finos/vuu-utils";
import { DataSourceRow } from "packages/vuu-data-types";
import { DataSourceRow } from "@finos/vuu-data-types";
import type { FunctionComponent, MouseEvent } from "react";
import type { HTMLAttributes } from "react";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VuuRange } from "packages/vuu-protocol-types";
import { VuuRange } from "@finos/vuu-protocol-types";

export const withAriaRowIndex = (index: number) => ({
name: (_: string, el: Element) => el.ariaRowIndex === `${index}`,
Expand Down
2 changes: 1 addition & 1 deletion vuu-ui/sample-apps/app-vuu-example/scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async function writeFeatureEntriesToConfigJson(featureBundles) {
fileName.endsWith(matchPattern)
);
if (file) {
return `./feature-${featureName}/${file.fileName}`;
return `/feature-${featureName}/${file.fileName}`;
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import {
MenuActionConfig,
SuggestionFetcher,
useVuuMenuActions,
} from "@finos/vuu-data-react";
import { MenuActionConfig, useVuuMenuActions } from "@finos/vuu-data-react";
import {
ContextMenuItemDescriptor,
DataSourceFilter,
DataSourceVisualLinkCreatedMessage,
MenuActionHandler,
MenuBuilder,
SchemaColumn,
SuggestionFetcher,
TypeaheadSuggestionProvider,
VuuFeatureInvocationMessage,
} from "@finos/vuu-data-types";
Expand Down
5 changes: 5 additions & 0 deletions vuu-ui/sample-apps/standalone-table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
"devDependencies": {},
"dependencies": {
"@fontsource/open-sans": "^4.5.13",
"@finos/vuu-icons": "0.0.26",
"@finos/vuu-layout": "0.0.26",
"@finos/vuu-shell": "0.0.26",
"@finos/vuu-table": "0.0.26",
"@finos/vuu-theme": "0.0.26",
"@finos/vuu-utils": "0.0.26",
"clsx": "^2.0.0",
"react": ">=17.0.2",
"react-dom": ">=17.0.2"
Expand Down
32 changes: 23 additions & 9 deletions vuu-ui/sample-apps/standalone-table/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
import { Flexbox, View } from "@finos/vuu-layout";
import { Table } from "@finos/vuu-table";
import { getSchema, SimulTableName, vuuModule } from "@finos/vuu-data-test";
import { simulSchemas, simulModule } from "@finos/vuu-data-test";
import { ThemeProvider } from "@finos/vuu-utils";
import { ContextPanel } from "@finos/vuu-shell";

// import "@finos/vuu-icons/index.css";
// import "@finos/vuu-theme/index.css";
import "@finos/vuu-icons/index.css";
import "@finos/vuu-theme/index.css";

import "./App.css";
// import { ThemeProvider } from "@finos/vuu-utils";

console.log({ ContextPanel });

export const App = () => {
const schema = getSchema("instruments");
const dataSource =
vuuModule<SimulTableName>("SIMUL").createDataSource("instruments");
const schema = simulSchemas.instruments;
const dataSource1 = simulModule.createDataSource("instruments");
const dataSource2 = simulModule.createDataSource("instruments");

const tableConfig = {
columns: schema.columns,
};

return (
// <ThemeProvider applyThemeClasses>
<Table config={tableConfig} dataSource={dataSource} renderBufferSize={30} />
// </ThemeProvider>
<ThemeProvider applyThemeClasses>
<Flexbox
style={{ flexDirection: "column", height: "100vh", width: "100vw" }}
>
<View style={{ flex: 1 }}>
<Table config={tableConfig} dataSource={dataSource1} />
</View>
<View style={{ flex: 1 }}>
<Table config={tableConfig} dataSource={dataSource2} />
</View>
</Flexbox>
</ThemeProvider>
);
};
2 changes: 1 addition & 1 deletion vuu-ui/scripts/esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function build(config) {
jsx,
loader: {
".woff": "file",
".woff2": "dataurl",
".woff2": "file",
".ttf": "file",
},
mainFields: ["module", "main"],
Expand Down
3 changes: 0 additions & 3 deletions vuu-ui/scripts/launch-table.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import { execWait } from "./utils.mjs";

export const launchApp = async () => {
const appName = "standalone-table";

execWait(`serve -p 3010 ./deployed_apps/${appName}`);
// await execWait("npm run --silent build");
// await execWait(`npm run --silent build:${buildTarget}${url}`);
};

await launchApp();
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DataSourceRow } from "packages/vuu-data-types";
import { ColumnMap, RowClassGenerator } from "packages/vuu-utils/src";
import { DataSourceRow } from "@finos/vuu-data-types";
import { ColumnMap, RowClassGenerator } from "@finos/vuu-utils";
import { registerComponent } from "@finos/vuu-utils";

import "./buy-sell.css";
Expand Down
4 changes: 2 additions & 2 deletions vuu-ui/showcase/src/examples/Table/TEST.examples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { useMemo } from "react";
import { TestTableName, getSchema, vuuModule } from "@finos/vuu-data-test";
import { useVuuMenuActions } from "@finos/vuu-data-react";
import { ContextMenuProvider } from "@finos/vuu-popups";
import { SchemaColumn } from "packages/vuu-data-types";
import { ColumnDescriptor } from "packages/vuu-table-types";
import { SchemaColumn } from "@finos/vuu-data-types";
import { ColumnDescriptor } from "@finos/vuu-table-types";
import { DemoTableContainer } from "./DemoTableContainer";

let displaySequence = 1;
Expand Down

0 comments on commit 59ac37d

Please sign in to comment.