Skip to content

Commit

Permalink
tailwindcss added
Browse files Browse the repository at this point in the history
  • Loading branch information
gagarin55 committed Dec 25, 2023
1 parent 8bcc1c4 commit 04b6dee
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 95 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build-tauri.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Build (Tauri)

on:
push:
branches: [ "tauri" ]
pull_request:
branches: [ "tauri" ]

jobs:
build:
name: Build ${{ matrix.os }}
strategy:
matrix:
os: [ 'windows-latest', 'macos-latest', 'ubuntu-latest' ]
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3

# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: '3.7'

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm i
- run: npm run build
- run: npm run test
- run: npm run tauri build
- uses: actions/upload-artifact@v3
with:
name: ${{ runner.OS }}
path: dist/ergo-wallet-*.*
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"compile": "tsc",
"start": "npm run build && electron ./app/main/electron.js",
"start:debug": "npm run build && electron --inspect ./app/main/electron.js",
"build": "rimraf app/ && npm run compile && webpack --config webpack.config.js",
"build": "rimraf app/ && npm run compile && webpack --config webpack.config.js --mode=production",
"dist": "rimraf dist/ && electron-builder --publish never",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"dev": "webpack-dev-server --mode=development",
Expand All @@ -37,7 +37,7 @@
},
"main": "./main/electron.js",
"devDependencies": {
"@babel/preset-env": "^7.23.2",
"@babel/preset-env": "^7.23.6",
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.23.2",
"@storybook/addon-essentials": "^7.5.3",
Expand All @@ -59,6 +59,7 @@
"@types/recharts": "^1.8.14",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"autoprefixer": "^10.4.16",
"copy-webpack-plugin": "6.4.1",
"cross-env": "7.0.2",
"css-loader": "5.2.4",
Expand All @@ -68,17 +69,20 @@
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-storybook": "^0.6.15",
"file-loader": "^6.0.0",
"html-webpack-plugin": "4.5.2",
"html-webpack-plugin": "^4.5.2",
"jest": "29.7.0",
"postcss": "^8.4.32",
"postcss-loader": "^7.3.3",
"rimraf": "^3.0.2",
"storybook": "^7.5.3",
"style-loader": "^1.2.1",
"tailwindcss": "^3.4.0",
"ts-jest": "^29.1.1",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.1",
"typescript": "^5.3.3",
"url-loader": "^4.1.0",
"webpack": "5.88.2",
"webpack": "^5.89.0",
"webpack-cli": "5.1.4",
"webpack-dev-server": "^4.15.1"
},
Expand Down
8 changes: 8 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
// Add you postcss configuration here
// Learn more about it at https://github.com/webpack-contrib/postcss-loader#config-files
plugins: [
['tailwindcss'],
['autoprefixer'],
],
};
3 changes: 3 additions & 0 deletions src/renderer/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
1 change: 1 addition & 0 deletions src/renderer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import './index.css';
import 'typeface-roboto/index.css';
import { Provider } from "react-redux";
import store from "./store/store";
Expand Down
26 changes: 15 additions & 11 deletions src/renderer/modules/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import * as constants from '../../../common/constants';
import {Container, CssBaseline, ThemeProvider} from '@mui/material';
import {Container, CssBaseline, StyledEngineProvider, ThemeProvider} from '@mui/material';
import MainScreen from './MainScreen';
import LoginScreen from './login/LoginScreen';
import { BrowserRouter } from "react-router-dom";
Expand Down Expand Up @@ -74,10 +74,12 @@ const App = (props: any) => {

if (!app.ready) {
return (
<ThemeProvider theme={theme}>
<CssBaseline />
<Loading />
</ThemeProvider>
<StyledEngineProvider injectFirst>
<ThemeProvider theme={theme}>
<CssBaseline />
<Loading />
</ThemeProvider>
</StyledEngineProvider>
);
}

Expand Down Expand Up @@ -141,12 +143,14 @@ const App = (props: any) => {
}

return (
<ThemeProvider theme={theme}>
<CssBaseline />
{content}
<NewVersionNotification />
{/*<div>{props.width}</div>*/}
</ThemeProvider>
<StyledEngineProvider injectFirst>
<ThemeProvider theme={theme}>
<CssBaseline />
{content}
<NewVersionNotification />
{/*<div>{props.width}</div>*/}
</ThemeProvider>
</StyledEngineProvider>
);
};

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/modules/app/MainScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const MainScreen = (props: MainScreenProps) => {
<React.Fragment>
<AppBar position='static'>
<Toolbar sx={{paddingRight: 24 }}>
<div>
<div className=''>
<Button
startIcon={<AccountBalanceWalletOutlinedIcon/>}
color="inherit"
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/modules/app/login/LoginScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface LoginScreenProps {
}

const submitStyle = (theme: any) => ({
margin: theme.spacing(3, 0, 2),
margin: theme.spacing(2, 0, 2),
})

const paperStyle = (theme: any) => ({
Expand Down
14 changes: 14 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{js,jsx,ts,tsx}'],
important: '#app',
theme: {
extend: {},
},
corePlugins: {
// Remove the Tailwind CSS preflight styles so it can use Material UI's preflight instead (CssBaseline).
preflight: false,
},
plugins: [],
}

164 changes: 86 additions & 78 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,85 +1,93 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const isProduction = process.env.NODE_ENV === 'production';

module.exports = [
// {
// mode: 'development',
// entry: path.join(__dirname, 'src/main/electron.ts'),
// target: 'electron-main',
// module: {
// rules: [{
// test: /\.(ts|tsx)$/,
// exclude: /node_modules/,
// loader: 'ts-loader',
// }]
// },
// output: {
// path: __dirname + '/app',
// filename: 'index.js'
// },
// resolve: {
// extensions: ['.js', '.ts']
// }
// },
{
mode: 'development',
entry: './src/renderer/index.tsx',
target: 'web',
devtool: 'source-map',
devServer: {
static: {
directory: path.join(__dirname, 'app'),
},
compress: true,
host: 'localhost',
port: 9000,
// {
// mode: 'development',
// entry: path.join(__dirname, 'src/main/electron.ts'),
// target: 'electron-main',
// module: {
// rules: [{
// test: /\.(ts|tsx)$/,
// exclude: /node_modules/,
// loader: 'ts-loader',
// }]
// },
// output: {
// path: __dirname + '/app',
// filename: 'index.js'
// },
// resolve: {
// extensions: ['.js', '.ts']
// }
// },
const config = {
entry: './src/renderer/index.tsx',
target: 'web',
devtool: 'source-map',
devServer: {
static: {
directory: path.join(__dirname, 'app'),
},
module: {
rules: [
{
test: /\.ts(x?)$/,
include: /src/,
use: [{loader: 'ts-loader'}]
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
include: [/typeface-roboto/, /typeface-roboto-mono/],
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts/'
}
compress: true,
host: 'localhost',
port: 9000,
},
module: {
rules: [
{
test: /\.ts(x?)$/,
include: /src/,
use: [{ loader: 'ts-loader' }]
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader', 'postcss-loader'],
include: [/typeface-roboto/, /typeface-roboto-mono/, path.resolve(__dirname, 'src')],
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts/'
}
]
}
]
},
output: {
path: __dirname + '/app',
filename: 'renderer.js'
},
plugins: [
new HtmlWebpackPlugin({
template: './src/renderer/index.html'
}),
new CopyWebpackPlugin({
patterns: [
{ from: path.join(__dirname, 'resources/icons/16x16.png'), to: './icons/' }
],
options: {
// copyUnmodified: true
}
}),
],
resolve: {
extensions: ['.js', '.tsx', '.ts']
}
}
]
}
]
},
output: {
path: __dirname + '/app',
filename: 'renderer.js'
},
plugins: [
new HtmlWebpackPlugin({
template: './src/renderer/index.html'
}),
new CopyWebpackPlugin({
patterns: [
{ from: path.join(__dirname, 'resources/icons/16x16.png'), to: './icons/' }
],
options: {
// copyUnmodified: true
}
}),
],
resolve: {
extensions: ['.js', '.tsx', '.ts']
}
}


module.exports = () => {
if (isProduction) {
config.mode = 'production';
} else {
config.mode = 'development';
}
];
return config;
};

0 comments on commit 04b6dee

Please sign in to comment.