Skip to content

Commit ca08ec9

Browse files
committed
Merge branch 'release/v8'
2 parents 651967d + ad48002 commit ca08ec9

File tree

18 files changed

+3693
-2888
lines changed

18 files changed

+3693
-2888
lines changed

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.11.0
1+
20.14.0

examples/basic-lang-javascript-python/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"electron": "^29.3.0",
1919
"electron-builder": "^24.13.3",
2020
"next": "^13.5.6",
21-
"nextron": "^8.15.0",
21+
"nextron": "^8.16.0",
2222
"react": "^18.2.0",
2323
"react-dom": "^18.2.0"
2424
}

examples/basic-lang-javascript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"electron": "^29.3.0",
1919
"electron-builder": "^24.13.3",
2020
"next": "^13.5.6",
21-
"nextron": "^8.15.0",
21+
"nextron": "^8.16.0",
2222
"react": "^18.2.0",
2323
"react-dom": "^18.2.0"
2424
}

examples/basic-lang-typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"electron": "^29.3.0",
2121
"electron-builder": "^24.13.3",
2222
"next": "^13.5.6",
23-
"nextron": "^8.15.0",
23+
"nextron": "^8.16.0",
2424
"react": "^18.2.0",
2525
"react-dom": "^18.2.0",
2626
"typescript": "^5.4.5"

examples/basic-launch-app-from-url/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"electron": "^29.3.0",
2121
"electron-builder": "^24.13.3",
2222
"next": "^13.5.6",
23-
"nextron": "^8.15.0",
23+
"nextron": "^8.16.0",
2424
"react": "^18.2.0",
2525
"react-dom": "^18.2.0",
2626
"typescript": "^5.4.5"

examples/basic-store-data/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"electron": "^29.3.0",
2121
"electron-builder": "^24.13.3",
2222
"next": "^13.5.6",
23-
"nextron": "^8.15.0",
23+
"nextron": "^8.16.0",
2424
"react": "^18.2.0",
2525
"react-dom": "^18.2.0",
2626
"typescript": "^5.4.5"

examples/custom-build-options/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"electron": "^29.3.0",
2626
"electron-builder": "^24.13.3",
2727
"next": "^13.5.6",
28-
"nextron": "^8.15.0",
28+
"nextron": "^8.16.0",
2929
"react": "^18.2.0",
3030
"react-dom": "^18.2.0",
3131
"typescript": "^5.4.5"

examples/custom-renderer-port/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"electron": "^29.3.0",
2121
"electron-builder": "^24.13.3",
2222
"next": "^13.5.6",
23-
"nextron": "^8.15.0",
23+
"nextron": "^8.16.0",
2424
"react": "^18.2.0",
2525
"react-dom": "^18.2.0",
2626
"typescript": "^5.4.5"

examples/with-ant-design/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"electron": "^29.3.0",
2323
"electron-builder": "^24.13.3",
2424
"next": "^13.5.6",
25-
"nextron": "^8.15.0",
25+
"nextron": "^8.16.0",
2626
"react": "^18.2.0",
2727
"react-dom": "^18.2.0",
2828
"typescript": "^5.4.5"

examples/with-chakra-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"electron-builder": "^24.13.3",
2727
"framer-motion": "^11.0.28",
2828
"next": "^13.5.6",
29-
"nextron": "^8.15.0",
29+
"nextron": "^8.16.0",
3030
"react": "^18.2.0",
3131
"react-dom": "^18.2.0",
3232
"typescript": "^5.4.5"

examples/with-emotion/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"electron": "^29.3.0",
2424
"electron-builder": "^24.13.3",
2525
"next": "^13.5.6",
26-
"nextron": "^8.15.0",
26+
"nextron": "^8.16.0",
2727
"react": "^18.2.0",
2828
"react-dom": "^18.2.0",
2929
"typescript": "^5.4.5"

examples/with-material-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"electron": "^29.3.0",
2828
"electron-builder": "^24.13.3",
2929
"next": "^13.5.6",
30-
"nextron": "^8.15.0",
30+
"nextron": "^8.16.0",
3131
"react": "^18.2.0",
3232
"react-dom": "^18.2.0",
3333
"typescript": "^5.4.5"

examples/with-next-i18next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"i18next": "^23.11.1",
2424
"next": "^13.5.6",
2525
"next-i18next": "^15.2.0",
26-
"nextron": "^8.15.0",
26+
"nextron": "^8.16.0",
2727
"react": "^18.2.0",
2828
"react-dom": "^18.2.0",
2929
"react-i18next": "^14.1.0"

examples/with-tailwindcss/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"electron": "^29.3.0",
2222
"electron-builder": "^24.13.3",
2323
"next": "^13.5.6",
24-
"nextron": "^8.15.0",
24+
"nextron": "^8.16.0",
2525
"postcss": "^8.4.38",
2626
"react": "^18.2.0",
2727
"react-dom": "^18.2.0",

lib/configs/useExportCommand.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import fs from 'fs-extra'
2+
import path from 'path'
3+
import { getNextronConfig } from './getNextronConfig'
4+
import * as logger from '../logger'
5+
6+
const cwd = process.cwd()
7+
const pkgPath = path.join(cwd, 'package.json')
8+
const nextConfigPath = path.join(
9+
getNextronConfig().rendererSrcDir || 'renderer',
10+
'next.config.js'
11+
)
12+
13+
export const useExportCommand = async (): Promise<boolean> => {
14+
const { dependencies, devDependencies } = await fs.readJSON(pkgPath)
15+
16+
let nextronVersion: string
17+
nextronVersion = dependencies.nextron
18+
if (nextronVersion) {
19+
logger.info(
20+
'To reduce the bundle size of the electron app, we recommend placing nextron in devDependencies instead of dependencies.'
21+
)
22+
}
23+
if (!nextronVersion) {
24+
nextronVersion = devDependencies.nextron
25+
if (!nextronVersion) {
26+
logger.error(
27+
'Nextron not found in both dependencies and devDependencies.'
28+
)
29+
process.exit(1)
30+
}
31+
}
32+
33+
const majorVersion = ~~nextronVersion
34+
.split('.')
35+
.filter((v) => v.trim() !== '')[0]
36+
if (majorVersion < 13) {
37+
return true
38+
}
39+
if (majorVersion === 13) {
40+
const { output } = await fs.readJSON(nextConfigPath)
41+
return output !== 'export'
42+
}
43+
if (majorVersion > 13) {
44+
const { output } = await fs.readJSON(nextConfigPath)
45+
if (output !== 'export') {
46+
logger.error(
47+
'We must export static files so as Electron can handle them. Please set next.config.js#output to "export".'
48+
)
49+
process.exit(1)
50+
}
51+
return false
52+
}
53+
54+
logger.error('Unexpected error occerred')
55+
process.exit(1)
56+
}

lib/nextron-build.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import chalk from 'chalk'
55
import execa from 'execa'
66
import * as logger from './logger'
77
import { getNextronConfig } from './configs/getNextronConfig'
8+
import { useExportCommand } from './configs/useExportCommand'
89

910
const args = arg({
1011
'--mac': Boolean,
@@ -39,11 +40,13 @@ const execaOptions: execa.Options = {
3940

4041
logger.info('Building renderer process')
4142
await execa('next', ['build', path.join(cwd, rendererSrcDir)], execaOptions)
42-
await execa(
43-
'next',
44-
['export', '-o', appDir, path.join(cwd, rendererSrcDir)],
45-
execaOptions
46-
)
43+
if (await useExportCommand()) {
44+
await execa(
45+
'next',
46+
['export', '-o', appDir, path.join(cwd, rendererSrcDir)],
47+
execaOptions
48+
)
49+
}
4750

4851
logger.info('Building main process')
4952
await execa(

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nextron",
3-
"version": "8.15.0",
3+
"version": "8.16.0",
44
"description": "⚡ NEXT.js + Electron ⚡",
55
"repository": "git@github.com:saltyshiomix/nextron.git",
66
"author": {

0 commit comments

Comments
 (0)