Skip to content

Commit

Permalink
Fix app build
Browse files Browse the repository at this point in the history
  • Loading branch information
nukeop committed Oct 17, 2023
1 parent 6aada06 commit f49db74
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 17 deletions.
45 changes: 43 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"classnames": "^2.2.6",
"d3-drag": "^1.2.3",
"d3-selection": "^1.4.0",
"deasync": "^0.1.28",
"dotenv": "^8.2.0",
"electron": "^12.1.0",
"electron-timber": "^0.5.1",
Expand Down
14 changes: 10 additions & 4 deletions packages/app/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ const UI_DIR = path.resolve(__dirname, 'node_modules', '@nuclear', 'ui');
const VENDOR_DIR = path.resolve(__dirname, '..', '..', 'node_modules');

const buildIncludedPaths = () => {
const paths = [];
const paths: string[] = [];
const modules = ['core', 'i18n', 'ui'];
const srcs = ['src', 'lib', 'index.js', 'index.ts'];
modules.forEach((module) => {
srcs.forEach((src) => {
paths.push(
path.resolve(__dirname, 'node_modules', '@nuclear', module, src)
path.resolve(
__dirname,
'..', '..',
'node_modules', '@nuclear', module, src
)
);
});
});
Expand Down Expand Up @@ -120,7 +124,9 @@ module.exports = (env) => {

if (IS_PROD) {
jsxRule.loader = 'ts-loader';
jsxRule.options = {};
jsxRule.options = {
allowTsInNodeModules: true
};
jsxRule.include = [APP_DIR, ...NUCLEAR_MODULES];
jsxRule.exclude = [
/node_modules\/electron-timber\/preload\.js/,
Expand Down Expand Up @@ -153,7 +159,7 @@ module.exports = (env) => {
mode: IS_PROD ? 'production' : 'development',
optimization,
resolve: {
extensions: ['*', '.js', '.ts', '.jsx', '.tsx', '.json'],
extensions: ['.*', '.js', '.ts', '.jsx', '.tsx', '.json'],
alias: {
react: path.resolve(__dirname, '..', '..', 'node_modules', 'react'),
'styled-component': path.resolve(
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/plugins/transform.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-function-return-type */
import { createConfigItem, transform, transformFile } from '@babel/core';
import presetEnv from '@babel/preset-env';
import presetReact from '@babel/preset-react';
Expand All @@ -16,7 +14,7 @@ interface TransformResult {
}

type Cb = (err: Error, result: TransformResult) => void;
type Transformer = (input: string, babelConfig: BabelConfig, cb: Cb) => void;
type Transformer = typeof transform | typeof transformFile;

const transformGeneric = (transformer: Transformer) =>
(input: string) =>
Expand Down
1 change: 0 additions & 1 deletion packages/core/typings/babel.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
declare module '@babel/core';
declare module '@babel/preset-env';
declare module '@babel/preset-react';
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import { ColumnInstance } from 'react-table';
import { ColumnInstance, UseSortByColumnProps } from 'react-table';
import { Icon } from 'semantic-ui-react';

import { Track } from '../../../types';

import styles from '../styles.scss';

type ColumnHeaderProps = {
column: ColumnInstance<Track>;
column: ColumnInstance<Track> & UseSortByColumnProps<Track>;
header: string | React.ReactNode;
'data-testid'?: string;
};
Expand All @@ -18,7 +18,7 @@ const ColumnHeader: React.FC<ColumnHeaderProps> = ({
'data-testid': dataTestId
}) => {
const { isSorted, isSortedDesc } = column;
const name = column.isSortedDesc
const name = isSortedDesc
? 'sort content descending' : 'sort content ascending';

return (
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/lib/components/TrackTable/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable react/jsx-key */
import React, { TableHTMLAttributes, useMemo } from 'react';
import cx from 'classnames';
import { useTable, Column, useRowSelect, useSortBy } from 'react-table';
import { useTable, Column, useRowSelect, useSortBy, HeaderGroup, UseSortByColumnProps, TableState, UseSortByState } from 'react-table';
import { isNumber, isString } from 'lodash';
import { DragDropContext, Droppable, Draggable, DragDropContextProps } from 'react-beautiful-dnd';

Expand Down Expand Up @@ -129,7 +129,7 @@ function TrackTable<T extends Track>({
].filter(Boolean) as Column<T>[], [displayDeleteButton, displayPosition, displayThumbnail, displayFavorite, isTrackFavorite, titleHeader, displayArtist, artistHeader, displayAlbum, albumHeader, shouldDisplayDuration, durationHeader, selectable, positionHeader, thumbnailHeader]);

const data = useMemo(() => tracks, [tracks]);
const initialState = {
const initialState: Partial<TableState<T> & UseSortByState<T>> = {
sortBy: [{ id: TrackTableColumn.Position, desc: false }]
};

Expand All @@ -150,7 +150,7 @@ function TrackTable<T extends Track>({
headerGroups.map(headerGroup => (
<tr {...headerGroup.getHeaderGroupProps() as TableHTMLAttributes<HTMLTableRowElement>}>
{
headerGroup.headers.map(column => (
headerGroup.headers.map((column: (HeaderGroup<T> & UseSortByColumnProps<T>)) => (
<th {...column.getHeaderProps(column.getSortByToggleProps()) as ThHTMLAttributes<HTMLTableCellElement>}>
{column.render('Header', extraProps)}
</th>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@types/numeral": "0.0.28",
"@types/react-beautiful-dnd": "^13.0.0",
"@types/react-measure": "^2.0.6",
"@types/react-table": "^7.7.12",
"@types/react-table": "^7.7.16",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.1.0",
"copyfiles": "^2.2.0",
Expand Down

0 comments on commit f49db74

Please sign in to comment.