Skip to content

Commit

Permalink
Merge branch 'master' into shyam/0905-ts
Browse files Browse the repository at this point in the history
  • Loading branch information
doggan committed Sep 6, 2023
2 parents 1af13af + 319d196 commit 01ee6d8
Show file tree
Hide file tree
Showing 74 changed files with 2,898 additions and 2,669 deletions.
8 changes: 7 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,19 @@ module.exports = {
'./packages/desktop-client/src/components/UpdateNotification.*',
'./packages/desktop-client/src/components/accounts/Header.*',
'./packages/desktop-client/src/components/alerts.*',
'./packages/desktop-client/src/components/budget/BudgetCategories.*',
'./packages/desktop-client/src/components/budget/BudgetTotals.*',
'./packages/desktop-client/src/components/budget/ExpenseGroup.*',
'./packages/desktop-client/src/components/budget/IncomeGroup.*',
'./packages/desktop-client/src/components/budget/MobileBudget.*',
'./packages/desktop-client/src/components/budget/MobileBudgetTable.*',
'./packages/desktop-client/src/components/budget/MobileTable.*',
'./packages/desktop-client/src/components/budget/MonthCountSelector.*',
'./packages/desktop-client/src/components/budget/MonthPicker.*',
'./packages/desktop-client/src/components/budget/RenderMonths.*',
'./packages/desktop-client/src/components/budget/SidebarCategory.*',
'./packages/desktop-client/src/components/budget/SidebarGroup.*',
'./packages/desktop-client/src/components/budget/constants.*',
'./packages/desktop-client/src/components/budget/misc.*',
'./packages/desktop-client/src/components/budget/report/BudgetSummary.*',
'./packages/desktop-client/src/components/budget/report/components.*',
'./packages/desktop-client/src/components/budget/rollover/BudgetSummary.*',
Expand Down
4 changes: 3 additions & 1 deletion packages/crdt/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module.exports = {
preset: 'ts-jest/presets/js-with-ts-esm',
testEnvironment: 'node',
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
};
3 changes: 2 additions & 1 deletion packages/crdt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
"uuid": "^9.0.0"
},
"devDependencies": {
"@swc/core": "^1.3.82",
"@swc/jest": "^0.2.29",
"@types/jest": "^27.5.0",
"@types/uuid": "^9.0.2",
"jest": "^27.0.0",
"ts-jest": "^27.0.0",
"ts-protoc-gen": "^0.15.0",
"typescript": "^5.0.2"
}
Expand Down
15 changes: 15 additions & 0 deletions packages/desktop-client/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"jsc": {
"target": "es2022",
"transform": {
"react": {
"runtime": "automatic"
}
},
"externalHelpers": true,
"parser": {
"syntax": "typescript",
"tsx": true
}
}
}
77 changes: 0 additions & 77 deletions packages/desktop-client/config-overrides.js

This file was deleted.

116 changes: 116 additions & 0 deletions packages/desktop-client/craco.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
const path = require('path');

const {
loaderByName,
removeLoaders,
addAfterLoader,
addPlugins,
} = require('@craco/craco');
const chokidar = require('chokidar');
const TerserPlugin = require('terser-webpack-plugin');
const { IgnorePlugin } = require('webpack');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');

if (process.env.CI) {
process.env.DISABLE_ESLINT_PLUGIN = 'true';
}

// Forward Netlify env variables
if (process.env.REVIEW_ID) {
process.env.REACT_APP_REVIEW_ID = process.env.REVIEW_ID;
}

module.exports = {
webpack: {
configure: (webpackConfig, { env, paths }) => {
webpackConfig.mode =
process.env.NODE_ENV === 'development' ? 'development' : 'production';

// swc-loader
addAfterLoader(webpackConfig, loaderByName('babel-loader'), {
test: /\.m?[tj]sx?$/,
exclude: /node_modules/,
loader: require.resolve('swc-loader'),
});

// remove the babel loaders
removeLoaders(webpackConfig, loaderByName('babel-loader'));

addPlugins(webpackConfig, [
new BundleAnalyzerPlugin({
analyzerMode: 'disabled',
generateStatsFile: true,
}),
// Pikaday throws a warning if Moment.js is not installed however it doesn't
// actually require it to be installed. As we don't use Moment.js ourselves
// then we can just silence this warning.
new IgnorePlugin({
contextRegExp: /pikaday$/,
resourceRegExp: /moment$/,
}),
]);

webpackConfig.resolve.extensions = [
'.web.js',
'.web.jsx',
'.web.ts',
'.web.tsx',
'.js',
'.jsx',
'.ts',
'.tsx',
...webpackConfig.resolve.extensions,
];

if (process.env.IS_GENERIC_BROWSER) {
webpackConfig.resolve.extensions = [
'.browser.js',
'.browser.jsx',
'.browser.ts',
'.browser.tsx',
...webpackConfig.resolve.extensions,
];
}

webpackConfig.optimization = {
...webpackConfig.optimization,
minimize:
process.env.CI === 'true' || process.env.NODE_ENV !== 'development',
minimizer: [
new TerserPlugin({
minify: TerserPlugin.swcMinify,
// `terserOptions` options will be passed to `swc` (`@swc/core`)
// Link to options - https://swc.rs/docs/config-js-minify
terserOptions: {
compress: false,
mangle: true,
},
}),
],
};

return webpackConfig;
},
},
devServer: (devServerConfig, { env, paths, proxy, allowedHost }) => {
devServerConfig.onBeforeSetupMiddleware = server => {
chokidar
.watch([
path.resolve('../loot-core/lib-dist/*.js'),
path.resolve('../loot-core/lib-dist/browser/*.js'),
])
.on('all', function () {
for (const ws of server.webSocketServer.clients) {
ws.send(JSON.stringify({ type: 'static-changed' }));
}
});
};
devServerConfig.headers = {
...devServerConfig.headers,
'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp',
};

return devServerConfig;
},
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 10 additions & 11 deletions packages/desktop-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"build"
],
"devDependencies": {
"@craco/craco": "^7.1.0",
"@craco/types": "^7.1.0",
"@juggle/resize-observer": "^3.1.2",
"@playwright/test": "^1.37.1",
"@reach/listbox": "^0.18.0",
Expand All @@ -15,6 +17,8 @@
"@react-stately/collections": "^3.10.0",
"@react-stately/list": "^3.9.1",
"@svgr/cli": "^8.0.1",
"@swc/core": "^1.3.82",
"@swc/helpers": "^0.5.1",
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "14.4.3",
"@types/react": "^18.2.0",
Expand All @@ -26,7 +30,6 @@
"@types/webpack-bundle-analyzer": "^4.6.0",
"chokidar": "^3.5.3",
"cross-env": "^7.0.3",
"customize-cra": "^1.0.0",
"date-fns": "^2.29.3",
"debounce": "^1.2.0",
"downshift": "7.6.0",
Expand All @@ -40,7 +43,6 @@
"memoize-one": "^6.0.0",
"pikaday": "1.8.0",
"react": "18.2.0",
"react-app-rewired": "^2.2.1",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "18.2.0",
Expand All @@ -57,25 +59,22 @@
"redux-thunk": "^2.3.0",
"remark-gfm": "^3.0.1",
"sass": "^1.63.6",
"swc-loader": "^0.2.3",
"terser-webpack-plugin": "^5.3.9",
"uuid": "^9.0.0",
"victory": "^36.6.8",
"webpack-bundle-analyzer": "^4.9.0",
"webpack-bundle-analyzer": "^4.9.1",
"xml2js": "^0.6.2"
},
"scripts": {
"start": "cross-env PORT=3001 react-app-rewired start",
"start": "cross-env PORT=3001 craco start",
"start:browser": "cross-env ./bin/watch-browser",
"watch": "cross-env BROWSER=none yarn start",
"build": "cross-env INLINE_RUNTIME_CHUNK=false react-app-rewired build",
"build": "cross-env INLINE_RUNTIME_CHUNK=false craco build",
"build:browser": "cross-env ./bin/build-browser",
"generate:icons": "rm src/icons/*/*.js; cd src/icons && svgr --expand-props start --ext js -d . .",
"test": "react-app-rewired test",
"test": "craco test",
"e2e": "npx playwright test --browser=chromium",
"vrt": "cross-env VRT=true npx playwright test --browser=chromium"
},
"jest": {
"setupFilesAfterEnv": [
"<rootDir>/src/setupTests.js"
]
}
}
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/AppBackground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function AppBackground({ initializing, loadingText }: AppBackgroundProps) {

{(loadingText != null || initializing) && (
<View
{...css({
className={`${css({
position: 'absolute',
top: 0,
left: 0,
Expand All @@ -30,7 +30,7 @@ function AppBackground({ initializing, loadingText }: AppBackgroundProps) {
paddingTop: 200,
color: theme.pageText,
alignItems: 'center',
})}
})}`}
>
<Block style={{ marginBottom: 20, fontSize: 18 }}>
{loadingText}
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/NotesButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ function NotesTooltip({
{editable ? (
<textarea
ref={inputRef}
{...css({
className={`${css({
border: '1px solid ' + colors.border,
padding: 7,
minWidth: 350,
minHeight: 120,
outline: 'none',
})}
})}`}
value={notes || ''}
onChange={e => setNotes(e.target.value)}
placeholder="Notes (markdown supported)"
Expand Down
3 changes: 3 additions & 0 deletions packages/desktop-client/src/components/PrivacyFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ function BlurredOverlay({ blurIntensity, children, ...props }) {
...(!hovered && {
filter: `blur(${blurIntensity})`,
WebkitFilter: `blur(${blurIntensity})`,
// To fix blur performance issue in Safari.
// https://graffino.com/til/CjT2jrcLHP-how-to-fix-filter-blur-performance-issue-in-safari
transform: `translate3d(0, 0, 0)`,
}),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default function AccountDetails({
}}
>
<Link
to="/accounts"
to={-1}
style={{
color: theme.formLabelText,
alignItems: 'center',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class AccountList extends Component {

const accountContent = (
<Page title="Accounts">
<AccountHeader name="Budgeted" amount={getOnBudgetBalance()} />
<AccountHeader name="For Budget" amount={getOnBudgetBalance()} />
{budgetedAccounts.map((acct, idx) => (
<AccountCard
account={acct}
Expand Down
Loading

0 comments on commit 01ee6d8

Please sign in to comment.