-
Notifications
You must be signed in to change notification settings - Fork 46
Migra o bundler do projeto para utilizar o Vite #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
71f3118
chore: add vite
alvarogfn 3a615ed
fix: change browser router to hash router
alvarogfn dd8c366
refactor: remove dist electron
alvarogfn 454dc38
chore: update vite config
alvarogfn b3736d5
chore: update eslint config
alvarogfn 70bccc6
chore: move electron config from package.json to electron builder json
alvarogfn ffe3485
chore: add electron base files
alvarogfn 2d7e503
chore: update setupTests.js
alvarogfn 20af7c1
style: eslint --fix
alvarogfn 4a6b966
chore: update yarn lock
alvarogfn 6ff076b
chore: uncomment husky files
alvarogfn 2f70525
Merge branch 'master' of https://github.com/hatcoders/octopost into a…
alvarogfn 705cc13
fix: add extension in home.module.scss
alvarogfn 818231e
chore: update pipeline
alvarogfn 34840cc
chore: update pipeline
alvarogfn 24c05ab
chore: update css module vitest resolution
alvarogfn 8323ece
test: update usePostsStore mock
alvarogfn 61a4359
style: just space
alvarogfn 68661b3
docs: update contributing docs
alvarogfn 2343d73
Merge branch 'master' of https://github.com/alvarogfn/octopost into a…
alvarogfn 2539644
Merge branch 'master' of https://github.com/Alecell/octopost into alv…
alvarogfn b15fd5b
Merge branch 'master' of https://github.com/Alecell/octopost into alv…
alvarogfn 2bd2cdd
style: just prettier
alvarogfn a9f3d8f
revert: update electron configuration
alvarogfn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
const { defineConfig } = require('eslint-define-config'); | ||
|
||
module.exports = defineConfig({ | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
ignorePatterns: [ | ||
'dist', | ||
'.eslintrc.cjs', | ||
'.next', | ||
'.vscode', | ||
'node_modules', | ||
'!*.scss', | ||
], | ||
extends: ['eslint:recommended'], | ||
plugins: ['prettier', 'eslint-plugin-import-helpers'], | ||
rules: { | ||
'prettier/prettier': ['error', { endOfLine: 'auto' }], | ||
'no-console': 'error', | ||
'import-helpers/order-imports': [ | ||
'error', | ||
{ | ||
newlinesBetween: 'always', | ||
groups: [ | ||
'/^react.*/', | ||
'/^next/', | ||
'module', | ||
[ | ||
'/^\\~interfaces/', | ||
'/^\\~store/', | ||
'/^\\~snippets/', | ||
'/^\\~hooks/', | ||
'/^\\~services/', | ||
'/^\\~transformers/', | ||
'/^\\~constants/', | ||
'/^\\~utils/', | ||
'/^\\~enums/', | ||
'/^\\~types/', | ||
'/^\\~config/', | ||
], | ||
'/^(\\.|\\.\\.)(\\/[a-z]{1}\\w+)*$/', | ||
'/^\\~components/', | ||
'/^(\\.|\\.\\.)(\\/[\\w]+)*((\\/[A-Z]{1}\\w+)){1}$/', | ||
'/\\~styles/', | ||
'/^(\\.|\\.\\.).*(\\.scss)$/', | ||
'/^(\\.|\\.\\.).*(\\.(svg|png|jpg|jpeg))$/', | ||
], | ||
alphabetize: { order: 'asc', ignoreCase: true }, | ||
}, | ||
], | ||
}, | ||
overrides: [ | ||
// test files with vitest | ||
{ | ||
files: ['**/*.spec.*'], | ||
extends: ['plugin:vitest/recommended'], | ||
plugins: ['vitest'], | ||
}, | ||
// react rules | ||
{ | ||
files: ['src/**.(ts|tsx)'], | ||
extends: ['plugin:react-hooks/recommended', 'plugin:react/recommended'], | ||
plugins: ['react'], | ||
}, | ||
|
||
// stories | ||
{ | ||
files: ['**/*.stories.tsx'], | ||
rules: { | ||
'no-console': 'off', | ||
}, | ||
}, | ||
// configuration files | ||
{ | ||
files: '.eslintrc.js', | ||
rules: { | ||
'no-undef': 'off', | ||
}, | ||
}, | ||
// validate typescript files | ||
{ | ||
extends: ['plugin:@typescript-eslint/recommended'], | ||
files: ['**/*.ts', '**/*.tsx'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint'], | ||
rules: { | ||
// TODO: Colocar regra de underscore em variaveis membro e regra de nomeclatura de classe abstrata | ||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
{ | ||
selector: 'interface', | ||
prefix: ['I'], | ||
format: ['PascalCase'], | ||
}, | ||
{ | ||
selector: 'enum', | ||
prefix: ['E'], | ||
format: ['PascalCase'], | ||
}, | ||
{ | ||
selector: 'typeAlias', | ||
prefix: ['T'], | ||
format: ['PascalCase'], | ||
}, | ||
], | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['./src/types/*.ts', '*.d.ts'], | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['*.js'], | ||
rules: { | ||
'no-console': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
}, | ||
}, | ||
], | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,6 +106,7 @@ typings/ | |
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
dist-electron | ||
|
||
# Gatsby files | ||
.cache/ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Alecell marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/electron-userland/electron-builder/master/packages/app-builder-lib/scheme.json", | ||
"productName": "octopost", | ||
"mac": { | ||
"target": { | ||
"target": "default", | ||
"arch": ["universal"] | ||
}, | ||
"category": "public.app-category.productivity" | ||
}, | ||
"extends": null, | ||
"files": ["dist/**/*", "dist-electron", "package.json"], | ||
"directories": { | ||
"buildResources": "assets" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
/// <reference types="vite-plugin-electron/electron-env" /> | ||
|
||
declare namespace NodeJS { | ||
interface ProcessEnv { | ||
/** | ||
* The built directory structure | ||
* | ||
* ```tree | ||
* ├─┬ dist | ||
* │ ├─┬ electron | ||
* │ │ ├── main.js | ||
* │ │ └── preload.js | ||
* │ ├── index.html | ||
* │ ├── ...other-static-files-from-public | ||
* │ | ||
* ``` | ||
*/ | ||
DIST: string; | ||
/** /dist/ or /public/ */ | ||
VITE_PUBLIC: string; | ||
} | ||
} | ||
|
||
// Used in Renderer process, expose in `preload.ts` | ||
interface Window { | ||
ipcRenderer: import('electron').IpcRenderer; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,47 @@ | ||
import { app, BrowserWindow } from 'electron'; | ||
import * as isDev from 'electron-is-dev'; | ||
import * as path from 'path'; | ||
import path from 'path'; | ||
|
||
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'; | ||
|
||
process.env.DIST = path.join(__dirname, '../dist'); | ||
process.env.VITE_PUBLIC = app.isPackaged | ||
? process.env.DIST | ||
: path.join(process.env.DIST, '../public'); | ||
|
||
if (!app.requestSingleInstanceLock()) { | ||
app.quit(); | ||
process.exit(0); | ||
} | ||
|
||
let win: BrowserWindow | null; | ||
|
||
function createWindow() { | ||
const win = new BrowserWindow({ | ||
width: 800, | ||
height: 600, | ||
win = new BrowserWindow({ | ||
icon: path.join(process.env.VITE_PUBLIC, 'logo.svg'), | ||
webPreferences: { | ||
preload: path.join(__dirname, './preload.js'), | ||
nodeIntegration: true, | ||
contextIsolation: false, | ||
}, | ||
}); | ||
|
||
win.loadURL( | ||
isDev | ||
? 'http://localhost:3000' | ||
: `file://${path.join(__dirname, '../build/index.html')}` | ||
); | ||
// Test active push message to Renderer-process. | ||
win.webContents.on('did-finish-load', () => { | ||
win?.webContents.send('main-process-message', new Date().toLocaleString()); | ||
}); | ||
|
||
win.webContents.openDevTools(); | ||
if (process.env.VITE_DEV_SERVER_URL) { | ||
win.loadURL(process.env.VITE_DEV_SERVER_URL); | ||
win.webContents.openDevTools(); | ||
} else { | ||
// win.loadFile('dist/index.html') | ||
win.loadFile(path.join(process.env.DIST, 'index.html')); | ||
} | ||
} | ||
|
||
app.whenReady().then(createWindow); | ||
|
||
app.on('window-all-closed', () => { | ||
if (process.platform !== 'darwin') { | ||
app.quit(); | ||
} | ||
app.quit(); | ||
win = null; | ||
}); | ||
|
||
app.on('activate', () => { | ||
if (BrowserWindow.getAllWindows().length === 0) { | ||
createWindow(); | ||
} | ||
}); | ||
app.whenReady().then(createWindow); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.