mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-12-22 01:58:54 +00:00
Update Electron to 21 + Node to 16 (#1550)
This commit is contained in:
parent
fae8edd183
commit
051622d58e
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@ -19,10 +19,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js 19
|
- name: Use Node.js 20
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: 19
|
node-version: 20
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: |
|
cache-dependency-path: |
|
||||||
npm-shrinkwrap.json
|
npm-shrinkwrap.json
|
||||||
@ -37,10 +37,10 @@ jobs:
|
|||||||
runs-on: windows-latest # Doesn't work on headless ubuntu, and is slow on mac
|
runs-on: windows-latest # Doesn't work on headless ubuntu, and is slow on mac
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js 19
|
- name: Use Node.js 20
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: 19
|
node-version: 20
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: |
|
cache-dependency-path: |
|
||||||
npm-shrinkwrap.json
|
npm-shrinkwrap.json
|
||||||
@ -59,8 +59,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version:
|
node-version:
|
||||||
- '19'
|
- '20'
|
||||||
- '12' # the oldest we require in package.json -> engines.node, to check we run on this minimum
|
- '16' # the oldest we require in package.json -> engines.node, to check we run on this minimum
|
||||||
platform: [ubuntu-latest, macos-latest, windows-latest]
|
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
steps:
|
steps:
|
||||||
|
4
.github/workflows/publish.yml
vendored
4
.github/workflows/publish.yml
vendored
@ -10,7 +10,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v1 # Setup .npmrc file to publish to npm
|
- uses: actions/setup-node@v1 # Setup .npmrc file to publish to npm
|
||||||
with:
|
with:
|
||||||
node-version: '19' # Align the version of Node here with ci.yml.
|
node-version: '20' # Align the version of Node here with ci.yml.
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
- run: npm ci --no-fund # Will also (via `prepare` hook): 1. install ./app, 2. build
|
- run: npm ci --no-fund # Will also (via `prepare` hook): 1. install ./app, 2. build
|
||||||
- run: npm run test:playwright
|
- run: npm run test:playwright
|
||||||
@ -23,7 +23,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v1 # Setup .npmrc file to publish to npm
|
- uses: actions/setup-node@v1 # Setup .npmrc file to publish to npm
|
||||||
with:
|
with:
|
||||||
node-version: '19' # Align the version of Node here with ci.yml.
|
node-version: '20' # Align the version of Node here with ci.yml.
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
- run: npm ci --no-fund # Will also (via `prepare` hook): 1. install ./app, 2. build
|
- run: npm ci --no-fund # Will also (via `prepare` hook): 1. install ./app, 2. build
|
||||||
- run: npm run test:noplaywright
|
- run: npm run test:noplaywright
|
||||||
|
@ -127,8 +127,10 @@ When a new major [Electron release](https://github.com/electron/electron/release
|
|||||||
(also via the [Releases page](https://github.com/electron/electron/releases) and [the blog](https://www.electronjs.org/blog/), the content is different),
|
(also via the [Releases page](https://github.com/electron/electron/releases) and [the blog](https://www.electronjs.org/blog/), the content is different),
|
||||||
grepping our codebase for every changed API.
|
grepping our codebase for every changed API.
|
||||||
- If called for by the breaking changes, perform the necessary API changes
|
- If called for by the breaking changes, perform the necessary API changes
|
||||||
3. Bump `src/constants.ts` / `DEFAULT_ELECTRON_VERSION` & `DEFAULT_CHROME_VERSION`
|
3. Bump
|
||||||
and `app / package.json / devDeps / electron`
|
- `src/constants.ts` / `DEFAULT_ELECTRON_VERSION` & `DEFAULT_CHROME_VERSION`
|
||||||
|
- `package.json / devDeps / electron`
|
||||||
|
- `app / package.json / devDeps / electron`
|
||||||
4. On Windows, macOS, Linux, test for regression and crashes:
|
4. On Windows, macOS, Linux, test for regression and crashes:
|
||||||
1. With `npm test` and `npm run test:manual`
|
1. With `npm test` and `npm run test:manual`
|
||||||
2. With extra manual testing
|
2. With extra manual testing
|
||||||
|
@ -31,8 +31,8 @@ Whatsapp Web ([HN thread](https://news.ycombinator.com/item?id=10930718)). Nativ
|
|||||||
|
|
||||||
Install Nativefier globally with `npm install -g nativefier` . Requirements:
|
Install Nativefier globally with `npm install -g nativefier` . Requirements:
|
||||||
|
|
||||||
- macOS 10.10+ / Windows / Linux
|
- macOS 10.13+ / Windows / Linux
|
||||||
- [Node.js](https://nodejs.org/) ≥ 12.9 and npm ≥ 6.9
|
- [Node.js](https://nodejs.org/) ≥ 16.9 and npm ≥ 7.10
|
||||||
|
|
||||||
Optional dependencies:
|
Optional dependencies:
|
||||||
|
|
||||||
|
1444
app/npm-shrinkwrap.json
generated
1444
app/npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
@ -20,6 +20,6 @@
|
|||||||
"source-map-support": "^0.5.19"
|
"source-map-support": "^0.5.19"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^19.1.4"
|
"electron": "^21.4.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ export async function createLoginWindow(
|
|||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true, // TODO work around this; insecure
|
nodeIntegration: true, // TODO work around this; insecure
|
||||||
contextIsolation: false, // https://github.com/electron/electron/issues/28017
|
contextIsolation: false, // https://github.com/electron/electron/issues/28017
|
||||||
|
sandbox: false, // https://www.electronjs.org/blog/electron-20-0#default-changed-renderers-without-nodeintegration-true-are-sandboxed-by-default
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await loginWindow.loadURL(
|
await loginWindow.loadURL(
|
||||||
|
@ -149,6 +149,7 @@ export function getDefaultWindowOptions(
|
|||||||
nodeIntegration: false, // `true` is *insecure*, and cause trouble with messenger.com
|
nodeIntegration: false, // `true` is *insecure*, and cause trouble with messenger.com
|
||||||
preload: path.join(__dirname, 'preload.js'),
|
preload: path.join(__dirname, 'preload.js'),
|
||||||
plugins: true,
|
plugins: true,
|
||||||
|
sandbox: false, // https://www.electronjs.org/blog/electron-20-0#default-changed-renderers-without-nodeintegration-true-are-sandboxed-by-default
|
||||||
webSecurity: !options.insecure,
|
webSecurity: !options.insecure,
|
||||||
zoomFactor: options.zoom,
|
zoomFactor: options.zoom,
|
||||||
// `contextIsolation` was switched to true in Electron 12, which:
|
// `contextIsolation` was switched to true in Electron 12, which:
|
||||||
|
9353
npm-shrinkwrap.json
generated
9353
npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
@ -7,8 +7,8 @@
|
|||||||
"engines_README": "Bumping the minimum required Node version? You must bump: 1. package.json -> engines.node, 2. package.json -> devDependencies.@types/node , 3. tsconfig.json -> {target, lib} , 4. .github/workflows/ci.yml -> node-version",
|
"engines_README": "Bumping the minimum required Node version? You must bump: 1. package.json -> engines.node, 2. package.json -> devDependencies.@types/node , 3. tsconfig.json -> {target, lib} , 4. .github/workflows/ci.yml -> node-version",
|
||||||
"engines_READMEforEnginesNode": "Here in engines.node, we require a version as old as possible, for Nativefier to be easily installable using the stock Node.js shipped by conservative Linux distros. It's a balancing act between this, and our own dependencies requiring more a recent Node; as much as possible, try to keep supporting Debian stable; https://packages.debian.org/search?suite=stable&keywords=nodejs",
|
"engines_READMEforEnginesNode": "Here in engines.node, we require a version as old as possible, for Nativefier to be easily installable using the stock Node.js shipped by conservative Linux distros. It's a balancing act between this, and our own dependencies requiring more a recent Node; as much as possible, try to keep supporting Debian stable; https://packages.debian.org/search?suite=stable&keywords=nodejs",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 12.9.0",
|
"node": ">= 16.16.0",
|
||||||
"npm": ">= 6.9.0"
|
"npm": ">= 8.11.0"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"desktop",
|
"desktop",
|
||||||
@ -77,13 +77,13 @@
|
|||||||
"@types/hasbin": "^1.2.0",
|
"@types/hasbin": "^1.2.0",
|
||||||
"@types/jest": "^28.1.6",
|
"@types/jest": "^28.1.6",
|
||||||
"@types/ncp": "^2.0.5",
|
"@types/ncp": "^2.0.5",
|
||||||
"@types/node": "^12.12.6",
|
"@types/node": "^16.0.0",
|
||||||
"@types/page-icon": "^0.3.4",
|
"@types/page-icon": "^0.3.4",
|
||||||
"@types/tmp": "^0.2.1",
|
"@types/tmp": "^0.2.1",
|
||||||
"@types/yargs": "^17.0.10",
|
"@types/yargs": "^17.0.10",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
||||||
"@typescript-eslint/parser": "^5.3.0",
|
"@typescript-eslint/parser": "^5.3.0",
|
||||||
"electron": "^19.1.4",
|
"electron": "^21.4.4",
|
||||||
"eslint": "^8.1.0",
|
"eslint": "^8.1.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.3.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
@ -126,6 +126,7 @@
|
|||||||
".+\\.js\\.map"
|
".+\\.js\\.map"
|
||||||
],
|
],
|
||||||
"testRegex": "test\\.js",
|
"testRegex": "test\\.js",
|
||||||
|
"testTimeout": 15000,
|
||||||
"watchPathIgnorePatterns": [
|
"watchPathIgnorePatterns": [
|
||||||
"<rootDir>/app/lib.*",
|
"<rootDir>/app/lib.*",
|
||||||
"<rootDir>/app/src.*",
|
"<rootDir>/app/src.*",
|
||||||
|
@ -6,20 +6,20 @@ export const DEFAULT_APP_NAME = 'APP';
|
|||||||
// - upgrade app / package.json / "devDependencies" / "electron"
|
// - upgrade app / package.json / "devDependencies" / "electron"
|
||||||
// - upgrade package.json / "devDependencies" / "electron"
|
// - upgrade package.json / "devDependencies" / "electron"
|
||||||
// Doing a *major* upgrade? Read https://github.com/nativefier/nativefier/blob/master/HACKING.md#deps-major-upgrading-electron
|
// Doing a *major* upgrade? Read https://github.com/nativefier/nativefier/blob/master/HACKING.md#deps-major-upgrading-electron
|
||||||
export const DEFAULT_ELECTRON_VERSION = '19.1.4';
|
export const DEFAULT_ELECTRON_VERSION = '21.4.4';
|
||||||
// https://atom.io/download/atom-shell/index.json
|
// https://atom.io/download/atom-shell/index.json
|
||||||
// https://www.electronjs.org/releases/stable
|
// https://www.electronjs.org/releases/stable
|
||||||
export const DEFAULT_CHROME_VERSION = '102.0.5005.167';
|
export const DEFAULT_CHROME_VERSION = '106.0.5249.199';
|
||||||
|
|
||||||
// Update each of these periodically
|
// Update each of these periodically
|
||||||
// https://product-details.mozilla.org/1.0/firefox_versions.json
|
// https://product-details.mozilla.org/1.0/firefox_versions.json
|
||||||
export const DEFAULT_FIREFOX_VERSION = '106.0.5';
|
export const DEFAULT_FIREFOX_VERSION = '116.0';
|
||||||
|
|
||||||
// https://en.wikipedia.org/wiki/Safari_version_history
|
// https://en.wikipedia.org/wiki/Safari_version_history
|
||||||
export const DEFAULT_SAFARI_VERSION = {
|
export const DEFAULT_SAFARI_VERSION = {
|
||||||
majorVersion: 15,
|
majorVersion: 65,
|
||||||
version: '15.6.1',
|
version: '16.5.2',
|
||||||
webkitVersion: '613.2.7',
|
webkitVersion: '605.1.15',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ELECTRON_MAJOR_VERSION = parseInt(
|
export const ELECTRON_MAJOR_VERSION = parseInt(
|
||||||
|
@ -78,7 +78,7 @@ test('short userAgent parameter is passed with an electronVersion', async () =>
|
|||||||
);
|
);
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
packager: { electronVersion: '12.0.0', platform: 'darwin' },
|
packager: { electronVersion: '16.0.0', platform: 'darwin' },
|
||||||
nativefier: { userAgent: 'edge' },
|
nativefier: { userAgent: 'edge' },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -86,5 +86,5 @@ test('short userAgent parameter is passed with an electronVersion', async () =>
|
|||||||
|
|
||||||
expect(parsedUserAgent).not.toBe(params.nativefier.userAgent);
|
expect(parsedUserAgent).not.toBe(params.nativefier.userAgent);
|
||||||
expect(parsedUserAgent).toContain('102.0.0');
|
expect(parsedUserAgent).toContain('102.0.0');
|
||||||
expect(getChromeVersionForElectronVersion).toHaveBeenCalledWith('12.0.0');
|
expect(getChromeVersionForElectronVersion).toHaveBeenCalledWith('16.0.0');
|
||||||
});
|
});
|
||||||
|
@ -312,7 +312,7 @@ describe('Application launch', () => {
|
|||||||
// which isn't particularly useful
|
// which isn't particularly useful
|
||||||
expect({
|
expect({
|
||||||
message: 'console.error called unexpectedly with',
|
message: 'console.error called unexpectedly with',
|
||||||
consoleMessage,
|
consoleMessage: { ...consoleMessage },
|
||||||
}).toBeUndefined();
|
}).toBeUndefined();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -322,9 +322,9 @@ describe('Application launch', () => {
|
|||||||
|
|
||||||
test('basic auth', async () => {
|
test('basic auth', async () => {
|
||||||
const mainWindow = (await spawnApp({
|
const mainWindow = (await spawnApp({
|
||||||
targetUrl: 'http://httpbin.org/basic-auth/foo/bar',
|
targetUrl: 'https://authenticationtest.com/HTTPAuth/',
|
||||||
basicAuthUsername: 'foo',
|
basicAuthUsername: 'user',
|
||||||
basicAuthPassword: 'bar',
|
basicAuthPassword: 'pass',
|
||||||
})) as Page;
|
})) as Page;
|
||||||
await mainWindow.waitForLoadState('networkidle');
|
await mainWindow.waitForLoadState('networkidle');
|
||||||
|
|
||||||
@ -332,20 +332,31 @@ describe('Application launch', () => {
|
|||||||
'document.documentElement.innerText',
|
'document.documentElement.innerText',
|
||||||
);
|
);
|
||||||
|
|
||||||
const documentJSON = JSON.parse(documentText) as {
|
expect(documentText).toContain('Success');
|
||||||
authenticated: boolean;
|
|
||||||
user: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
expect(documentJSON).toEqual({
|
expect(documentText).not.toContain('Failure');
|
||||||
authenticated: true,
|
});
|
||||||
user: 'foo',
|
|
||||||
});
|
test('basic auth - bad login', async () => {
|
||||||
|
const mainWindow = (await spawnApp({
|
||||||
|
targetUrl: 'https://authenticationtest.com/HTTPAuth/',
|
||||||
|
basicAuthUsername: 'userbad',
|
||||||
|
basicAuthPassword: 'passbad',
|
||||||
|
})) as Page;
|
||||||
|
await mainWindow.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
const documentText = await mainWindow.evaluate<string>(
|
||||||
|
'document.documentElement.innerText',
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(documentText).not.toContain('Success');
|
||||||
|
|
||||||
|
expect(documentText).toContain('Failure');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('basic auth without pre-providing', async () => {
|
test('basic auth without pre-providing', async () => {
|
||||||
const mainWindow = (await spawnApp({
|
const mainWindow = (await spawnApp({
|
||||||
targetUrl: 'http://httpbin.org/basic-auth/foo/bar',
|
targetUrl: 'https://authenticationtest.com/HTTPAuth/',
|
||||||
})) as Page;
|
})) as Page;
|
||||||
await mainWindow.waitForLoadState('load');
|
await mainWindow.waitForLoadState('load');
|
||||||
|
|
||||||
@ -363,11 +374,11 @@ describe('Application launch', () => {
|
|||||||
|
|
||||||
const usernameField = await loginWindow.$('#username-input');
|
const usernameField = await loginWindow.$('#username-input');
|
||||||
expect(usernameField).not.toBeNull();
|
expect(usernameField).not.toBeNull();
|
||||||
await usernameField?.fill('foo');
|
await usernameField?.fill('user');
|
||||||
|
|
||||||
const passwordField = await loginWindow.$('#password-input');
|
const passwordField = await loginWindow.$('#password-input');
|
||||||
expect(passwordField).not.toBeNull();
|
expect(passwordField).not.toBeNull();
|
||||||
await passwordField?.fill('bar');
|
await passwordField?.fill('pass');
|
||||||
|
|
||||||
const submitButton = await loginWindow.$('#submit-form-button');
|
const submitButton = await loginWindow.$('#submit-form-button');
|
||||||
expect(submitButton).not.toBeNull();
|
expect(submitButton).not.toBeNull();
|
||||||
@ -387,15 +398,9 @@ describe('Application launch', () => {
|
|||||||
'document.documentElement.innerText',
|
'document.documentElement.innerText',
|
||||||
);
|
);
|
||||||
|
|
||||||
const documentJSON = JSON.parse(documentText) as {
|
expect(documentText).toContain('Success');
|
||||||
authenticated: boolean;
|
|
||||||
user: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
expect(documentJSON).toEqual({
|
expect(documentText).not.toContain('Failure');
|
||||||
authenticated: true,
|
|
||||||
user: 'foo',
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user