Skip to content

Commit

Permalink
Merge pull request #563 from martpie/dx
Browse files Browse the repository at this point in the history
  • Loading branch information
martpie authored May 21, 2021
2 parents 98ad717 + 90ef04d commit 0f01f95
Show file tree
Hide file tree
Showing 125 changed files with 1,013 additions and 665 deletions.
26 changes: 21 additions & 5 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,37 @@ files:
mac:
category: public.app-category.music
target:
- dmg
- target: dmg
arch:
- x64
# - arm64
icon: src/images/logos/museeks.icns
artifactName: ${name}.${ext}
linux:
category: AudioVideo
target:
- deb
- AppImage
- rpm
- target: deb
arch:
- x64
- ia32
- target: AppImage
arch:
- x64
- ia32
- target: rpm
arch:
- x64
- ia32
executableName: museeks
artifactName: ${name}-${arch}.${ext}
deb:
depends: ['libdbus-1-dev', 'libglib2.0-dev']
win:
target: nsis
target:
- target: nsis
arch:
- x64
- ia32
icon: src/images/logos/museeks.ico
artifactName: ${name}-setup.${ext}
# nsis:
Expand Down
69 changes: 36 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,34 @@
"test:formatting": "prettier --check \"./**/*.{ts,tsx,js}\"",
"test:formatting:fix": "prettier --write \"./**/*.{ts,tsx,js}\"",
"test:css": "stylelint \"src/**/*.css\"",
"package:lmw": "electron-builder -lmw --ia32 --x64 && npm run package:checksums",
"package:lw": "electron-builder -lw --ia32 --x64",
"package:l": "electron-builder -l --ia32 --x64",
"package:w": "electron-builder -w --ia32 --x64",
"package:lmw": "electron-builder -lmw && npm run package:checksums",
"package:lw": "electron-builder -lw",
"package:l": "electron-builder -l",
"package:w": "electron-builder -w",
"package:m": "electron-builder -m",
"package:checksums": "bash scripts/checksum.sh"
},
"dependencies": {
"@reduxjs/toolkit": "^1.5.0",
"bluebird": "3.7.2",
"chardet": "1.3.0",
"classnames": "2.2.6",
"electron-devtools-installer": "^3.1.1",
"font-awesome": "4.7.0",
"globby": "11.0.1",
"globby": "11.0.2",
"history": "4.10.1",
"iconv-lite": "0.6.2",
"level-js": "4.0.1",
"linvodb3": "3.26.0",
"lodash-es": "4.17.20",
"m3ujs": "0.2.1",
"mime-types": "2.1.27",
"mime-types": "2.1.28",
"mpris-service": "2.1.0",
"music-metadata": "7.5.2",
"music-metadata": "7.7.0",
"postcss-scss": "3.0.4",
"ps-node": "0.1.6",
"queue": "6.0.1",
"rc-scrollbars": "^1.0.3",
"queue": "6.0.2",
"rc-scrollbars": "^1.1.2",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-fontawesome": "1.7.1",
Expand All @@ -60,7 +62,6 @@
"react-router": "5.2.0",
"react-router-dom": "5.2.0",
"react-simple-input": "0.4.2",
"redux": "4.0.5",
"redux-persist": "^6.0.0",
"redux-thunk": "2.3.0",
"semver": "7.3.4",
Expand All @@ -70,54 +71,56 @@
"devDependencies": {
"@types/bluebird": "3.5.33",
"@types/classnames": "2.2.11",
"@types/electron-devtools-installer": "^2.2.0",
"@types/history": "4.7.8",
"@types/lodash-es": "4.17.4",
"@types/mime-types": "2.1.0",
"@types/react": "17.0.0",
"@types/react": "17.0.2",
"@types/react-custom-scrollbars": "4.0.7",
"@types/react-dom": "17.0.0",
"@types/react-dom": "17.0.1",
"@types/react-fontawesome": "1.6.4",
"@types/react-redux": "7.1.14",
"@types/react-router-dom": "5.1.6",
"@types/react-redux": "7.1.16",
"@types/react-router-dom": "5.1.7",
"@types/redux-logger": "3.0.8",
"@types/semver": "7.3.4",
"@typescript-eslint/eslint-plugin": "4.11.0",
"@typescript-eslint/parser": "4.11.0",
"@typescript-eslint/eslint-plugin": "4.15.1",
"@typescript-eslint/parser": "4.15.1",
"clean-terminal-webpack-plugin": "3.0.0",
"css-loader": "5.0.1",
"electron": "11.1.1",
"clean-webpack-plugin": "^3.0.0",
"css-loader": "5.0.2",
"electron": "11.2.3",
"electron-builder": "22.9.1",
"eslint": "7.16.0",
"eslint-config-prettier": "7.1.0",
"eslint": "7.20.0",
"eslint-config-prettier": "7.2.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jsx-a11y": "6.4.1",
"eslint-plugin-prettier": "3.3.0",
"eslint-plugin-react": "7.21.5",
"eslint-plugin-prettier": "3.3.1",
"eslint-plugin-react": "7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"file-loader": "6.2.0",
"html-webpack-plugin": "4.5.0",
"html-webpack-plugin": "5.1.0",
"install": "0.13.0",
"mini-css-extract-plugin": "1.3.3",
"mini-css-extract-plugin": "1.3.7",
"node-loader": "1.0.2",
"normalize.css": "8.0.1",
"postcss": "^8.2.1",
"postcss": "^8.2.6",
"postcss-import": "14.0.0",
"postcss-loader": "4.1.0",
"postcss-loader": "5.0.0",
"postcss-nested": "5.0.3",
"prettier": "2.2.1",
"prettier-eslint": "12.0.0",
"redux-logger": "3.0.6",
"source-map-loader": "2.0.0",
"stylelint": "13.8.0",
"source-map-loader": "2.0.1",
"stylelint": "13.10.0",
"stylelint-config-css-modules": "2.2.0",
"stylelint-config-standard": "20.0.0",
"svg-inline-loader": "0.8.2",
"terser-webpack-plugin": "5.0.3",
"ts-loader": "8.0.12",
"typescript": "4.1.3",
"terser-webpack-plugin": "5.1.1",
"ts-loader": "8.0.17",
"typescript": "4.1.5",
"url-loader": "4.1.1",
"webpack": "5.11.0",
"webpack-cli": "4.3.0",
"webpack": "5.22.0",
"webpack-cli": "4.5.0",
"webpack-merge": "5.7.3",
"webpackbar": "5.0.0-3"
}
Expand Down
7 changes: 5 additions & 2 deletions src/app.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' data:; media-src 'self'; child-src 'self'; object-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self' https://api.github.com; font-src 'self' data:">
<meta charset="UTF-8" />
<meta
http-equiv="Content-Security-Policy"
content="default-src 'none'; img-src 'self' data:; media-src 'self'; child-src 'self'; object-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self' https://api.github.com; font-src 'self' data:"
/>
<title><%= htmlWebpackPlugin.options.title %></title>
</head>

Expand Down
15 changes: 13 additions & 2 deletions src/main/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'path';
import electron from 'electron';
import installExtension, { REDUX_DEVTOOLS, REACT_DEVELOPER_TOOLS, REACT_PERF } from 'electron-devtools-installer';

import IpcModule from './modules/ipc';
import MenuModule from './modules/menu';
Expand All @@ -17,8 +18,10 @@ import { checkBounds } from './lib/utils';

const { app, BrowserWindow } = electron;

const isProduction = process.env.NODE_ENV === 'production';

const appRoot = path.resolve(__dirname, '../..'); // Careful, not future-proof
const uiDistPath = path.join(appRoot, 'dist/ui');
const rendererDistPath = path.join(appRoot, 'dist', 'renderer');

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the javascript object is GCed.
Expand Down Expand Up @@ -49,6 +52,13 @@ app.on('window-all-closed', () => {
// This method will be called when Electron has finished its
// initialization and ready to create browser windows.
app.on('ready', async () => {
// Let's install some extensions so it's easier for us to debug things
if (!isProduction) {
installExtension([REDUX_DEVTOOLS, REACT_DEVELOPER_TOOLS, REACT_PERF])
.then((name) => console.info(`[INFO] Added Extension: ${name}`))
.catch((err) => console.info('[WARN] An error occurred while trying to add extensions: ', err));
}

const configModule = new ConfigModule();
await ModulesManager.init(configModule);

Expand All @@ -73,12 +83,13 @@ app.on('ready', async () => {
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false,
autoplayPolicy: 'no-user-gesture-required',
},
});

// ... and load the html page generated by Webpack
mainWindow.loadURL(`file://${uiDistPath}/index.html#/library`);
mainWindow.loadURL(`file://${rendererDistPath}/index.html#/library`);

// Open dev tools if museeks is run in debug mode
if (process.argv.includes('--devtools')) mainWindow.webContents.openDevTools({ mode: 'detach' });
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/ui/App.tsx β†’ src/renderer/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import Header from './components/Header/Header';
import Footer from './components/Footer/Footer';
import Toasts from './components/Toasts/Toasts';

import AppActions from './actions/AppActions';
import * as PlayerActions from './actions/PlayerActions';
import AppActions from './store/actions/AppActions';
import * as PlayerActions from './store/actions/PlayerActions';

import styles from './App.module.css';
import { isCtrlKey } from './lib/utils-platform';
Expand All @@ -28,7 +28,7 @@ const Museeks: React.FC = (props) => {
case ' ':
e.preventDefault();
e.stopPropagation();
await PlayerActions.playPause();
PlayerActions.playPause();
break;
case ',':
if (isCtrlKey(e)) {
Expand Down
7 changes: 2 additions & 5 deletions src/ui/Root.tsx β†’ src/renderer/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ interface State {
hasError: boolean;
}

// eslint-disable-next-line
type Props = {};

class Root extends React.Component<Props, State> {
constructor(props: Props) {
class Root extends React.Component<unknown, State> {
constructor(props: unknown) {
super(props);
this.state = { hasError: false };
}
Expand Down
24 changes: 24 additions & 0 deletions src/renderer/Router.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';
import { Router as ReactRouter, Switch, Route } from 'react-router-dom';

import history from './lib/history';

// Views
import App from './App';
import LibraryView from './views/Library/Library';
import PlaylistsView from './views/Playlists/Playlists';
import SettingsView from './views/Settings/Settings';

const Router: React.FC = () => (
<ReactRouter history={history}>
<App>
<Switch>
<Route path='/library' component={LibraryView} />
<Route path='/settings' component={SettingsView} />
<Route path='/playlists/:playlistId?' component={PlaylistsView} />
</Switch>
</App>
</ReactRouter>
);

export default Router;
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import Icon from 'react-fontawesome';
import { connect } from 'react-redux';

import { getStatus } from '../../lib/utils-library';
import { RootState } from '../../reducers';
import { LibraryState } from '../../reducers/library';
import { RootState } from '../../store/reducers';
import { LibraryState } from '../../store/reducers/library';

import ProgressBar from '../ProgressBar/ProgressBar';
import styles from './Footer.module.css';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import KeyBinding from 'react-keybinding-component';
import PlayingBar from '../PlayingBar/PlayingBar';
import PlayerControls from '../PlayerControls/PlayerControls';

import * as LibraryActions from '../../actions/LibraryActions';
import * as LibraryActions from '../../store/actions/LibraryActions';
import { isCtrlKey } from '../../lib/utils-platform';
import { RootState } from '../../reducers';
import { RootState } from '../../store/reducers';
import { TrackModel, PlayerStatus, Repeat } from '../../../shared/types/museeks';

import styles from './Header.module.css';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import Icon from 'react-fontawesome';
import VolumeControl from '../VolumeControl/VolumeControl';

import * as PlayerActions from '../../actions/PlayerActions';
import * as PlayerActions from '../../store/actions/PlayerActions';
import { PlayerStatus } from '../../../shared/types/museeks';

import styles from './PlayerControls.module.css';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import InlineSVG from 'svg-inline-react';
import cx from 'classnames';

import * as PlayerActions from '../../actions/PlayerActions';
import * as PlayerActions from '../../store/actions/PlayerActions';
import { Repeat } from '../../../shared/types/museeks';

import styles from './common.module.css';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import InlineSVG from 'svg-inline-react';
import cx from 'classnames';

import * as PlayerActions from '../../actions/PlayerActions';
import * as PlayerActions from '../../store/actions/PlayerActions';

import styles from './common.module.css';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import ButtonShuffle from '../PlayerOptionsButtons/ButtonShuffle';
import ButtonRepeat from '../PlayerOptionsButtons/ButtonRepeat';

import * as PlayerActions from '../../actions/PlayerActions';
import * as PlayerActions from '../../store/actions/PlayerActions';
import Player from '../../lib/player';
import * as utils from '../../lib/utils';
import { TrackModel, Repeat } from '../../../shared/types/museeks';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React from 'react';
import Icon from 'react-fontawesome';
import { connect } from 'react-redux';

import * as PlayerActions from '../../actions/PlayerActions';
import * as PlayerActions from '../../store/actions/PlayerActions';
import { PlayerStatus } from '../../../shared/types/museeks';
import { RootState } from '../../reducers';
import { RootState } from '../../store/reducers';

import styles from './PlayingIndicator.module.css';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { Link, RouteComponentProps } from 'react-router-dom';
import TracksList from '../TracksList/TracksList';
import * as ViewMessage from '../../elements/ViewMessage/ViewMessage';

import * as PlaylistsActions from '../../actions/PlaylistsActions';
import * as PlaylistsActions from '../../store/actions/PlaylistsActions';
import { filterTracks } from '../../lib/utils-library';
import { TrackModel, PlaylistModel, PlayerStatus } from '../../../shared/types/museeks';
import { RootState } from '../../reducers';
import { RootState } from '../../store/reducers';

type OwnProps = RouteComponentProps<RouteParams>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import electron from 'electron';
import React from 'react';
import Icon from 'react-fontawesome';

import * as PlaylistsActions from '../../actions/PlaylistsActions';
import * as PlaylistsActions from '../../store/actions/PlaylistsActions';
import PlaylistsNavLink from '../PlaylistsNavLink/PlaylistsNavLink';
import { PlaylistModel } from '../../../shared/types/museeks';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { NavLink } from 'react-router-dom';

import * as PlaylistActions from '../../actions/PlaylistsActions';
import * as PlaylistActions from '../../store/actions/PlaylistsActions';

import styles from './PlaylistsNavLink.module.css';

Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 0f01f95

Please sign in to comment.