Skip to content

Commit

Permalink
Merge branch 'release/v8'
Browse files Browse the repository at this point in the history
  • Loading branch information
saltyshiomix committed Sep 13, 2023
2 parents fdc2a3a + 9d41e72 commit e534e89
Show file tree
Hide file tree
Showing 97 changed files with 3,638 additions and 1,648 deletions.
8 changes: 3 additions & 5 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"presets": [
"@babel/preset-typescript"
],
"presets": ["@babel/preset-typescript"],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread"
"@babel/plugin-transform-class-properties",
"@babel/plugin-transform-object-rest-spread"
]
}
9 changes: 9 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
/pnpm-lock.yaml

# nextron
bin
workspace

# examples
examples
14 changes: 14 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"root": true,
"extends": [
"eslint:recommended",
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "error"
}
}
58 changes: 29 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '45 21 * * 3'

Expand All @@ -32,40 +32,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
node_modules

# nextron
bin
workspace

# examples
examples/**/yarn.lock
examples/**/package-lock.json
examples/**/pnpm-lock.yaml
examples/**/renderer/next-env.d.ts

# misc
.idea
.DS_Store
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enable-pre-post-scripts=true
9 changes: 9 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
/pnpm-lock.yaml

# nextron
bin
workspace

# examples
examples
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "es5",
"useTabs": false,
"tabWidth": 2
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"typescript.tsdk": "node_modules/typescript/lib"
}
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ module.exports = {
// main process' webpack config
webpack: (config, env) => {
// do some stuff here
return config;
return config
},
};
}
```

## Custom Babel Config for the Main Process
Expand All @@ -166,21 +166,21 @@ If we want to use some libraries that don't support SSR, we should check if the
```jsx
// pages/home.jsx

import electron from 'electron';
import electron from 'electron'

const Home = () => {
// we can't use `electron.ipcRenderer` directly!
const ipcRenderer = electron.ipcRenderer;
const ipcRenderer = electron.ipcRenderer

// we should check it like this
const ipcRenderer = electron.ipcRenderer || false;
const ipcRenderer = electron.ipcRenderer || false
if (ipcRenderer) {
// we can use `electron.ipcRenderer`
// because this scope is the client webpack process
}
};
}

export default Home;
export default Home
```

### The Basic of React Hooks :)
Expand All @@ -190,8 +190,8 @@ As mentioned above, we should check if the webpack process is a client because t
```jsx
// pages/home.jsx

import electron from 'electron';
import React from 'react';
import electron from 'electron'
import React from 'react'

const Home = () => {
// In this scope, both of server and client processes are running
Expand All @@ -201,17 +201,17 @@ const Home = () => {
// componentDidMount() like

// In this scope, only the client process is running
window.alert('wow');
window.alert('wow')

return () => {
// componentWillUnmount() like
};
}, []);
}
}, [])

return <p>Hello Nextron</p>;
};
return <p>Hello Nextron</p>
}

export default Home;
export default Home
```

## Examples
Expand Down Expand Up @@ -403,18 +403,22 @@ $ pnpm dev <EXAMPLE-FOLDER-NAME>
### Developing for your own project

1. Install development version of nextron

```
$ cd nextron
$ npm install
$ npm run build
$ npm link
$ npm link
```

2. Install linked nextron in your project

```
$ cd your-project
$ npm install -D @babel/runtime-corejs3 # required for nextron
$ npm link nextron
```

3. On every change in nextron, run `npm run build` in nextron folder and restart your project

## Maintainers ⚡
Expand Down
43 changes: 26 additions & 17 deletions babel.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
module.exports = (api) => {
api.cache(() => process.env.NODE_ENV === 'production');
api.cache(() => process.env.NODE_ENV === 'production')
return {
presets: [
[require('@babel/preset-env'), {
targets: {
node: true,
[
require('@babel/preset-env'),
{
targets: {
node: true,
},
},
}],
],
require('@babel/preset-typescript'),
],
plugins: [
require('@babel/plugin-proposal-class-properties'),
[require('@babel/plugin-proposal-object-rest-spread'), {
useBuiltIns: true,
}],
[require('@babel/plugin-transform-runtime'), {
corejs: 3,
helpers: true,
regenerator: true,
useESModules: false,
}],
require('@babel/plugin-transform-class-properties'),
[
require('@babel/plugin-transform-object-rest-spread'),
{
useBuiltIns: true,
},
],
[
require('@babel/plugin-transform-runtime'),
{
corejs: 3,
helpers: true,
regenerator: true,
useESModules: false,
},
],
],
};
};
}
}
Loading

0 comments on commit e534e89

Please sign in to comment.