electron
Advanced tools
Comparing version
@@ -7,3 +7,3 @@ #!/usr/bin/env node | ||
var child = proc.spawn(electron, process.argv.slice(2), {stdio: 'inherit', windowsHide: false}) | ||
var child = proc.spawn(electron, process.argv.slice(2), { stdio: 'inherit', windowsHide: false }) | ||
child.on('close', function (code) { | ||
@@ -10,0 +10,0 @@ process.exit(code) |
16
index.js
@@ -6,6 +6,14 @@ var fs = require('fs') | ||
if (fs.existsSync(pathFile)) { | ||
module.exports = path.join(__dirname, fs.readFileSync(pathFile, 'utf-8')) | ||
} else { | ||
throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again') | ||
function getElectronPath () { | ||
if (fs.existsSync(pathFile)) { | ||
var executablePath = fs.readFileSync(pathFile, 'utf-8') | ||
if (process.env.ELECTRON_OVERRIDE_DIST_PATH) { | ||
return path.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath) | ||
} | ||
return path.join(__dirname, 'dist', executablePath) | ||
} else { | ||
throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again') | ||
} | ||
} | ||
module.exports = getElectronPath() |
#!/usr/bin/env node | ||
var version = require('./package').version | ||
const version = require('./package').version | ||
var fs = require('fs') | ||
var os = require('os') | ||
var path = require('path') | ||
var extract = require('extract-zip') | ||
var download = require('electron-download') | ||
const fs = require('fs') | ||
const os = require('os') | ||
const path = require('path') | ||
const extract = require('extract-zip') | ||
const { downloadArtifact } = require('@electron/get') | ||
var installedVersion = null | ||
let installedVersion = null | ||
try { | ||
@@ -18,30 +18,27 @@ installedVersion = fs.readFileSync(path.join(__dirname, 'dist', 'version'), 'utf-8').replace(/^v/, '') | ||
var platformPath = getPlatformPath() | ||
if (installedVersion === version && fs.existsSync(path.join(__dirname, platformPath))) { | ||
if (process.env.ELECTRON_SKIP_BINARY_DOWNLOAD) { | ||
process.exit(0) | ||
} | ||
var mirror | ||
const platformPath = getPlatformPath() | ||
if (version.indexOf('nightly') !== -1) { | ||
mirror = 'https://github.com/electron/nightlies/releases/download/v' | ||
const electronPath = process.env.ELECTRON_OVERRIDE_DIST_PATH || path.join(__dirname, 'dist', platformPath) | ||
if (installedVersion === version && fs.existsSync(electronPath)) { | ||
process.exit(0) | ||
} | ||
// downloads if not cached | ||
download({ | ||
cache: process.env.electron_config_cache, | ||
version: version, | ||
platform: process.env.npm_config_platform, | ||
arch: process.env.npm_config_arch, | ||
strictSSL: process.env.npm_config_strict_ssl === 'true', | ||
downloadArtifact({ | ||
version, | ||
artifactName: 'electron', | ||
force: process.env.force_no_cache === 'true', | ||
quiet: process.env.npm_config_loglevel === 'silent' || process.env.CI, | ||
mirror | ||
}, extractFile) | ||
cacheRoot: process.env.electron_config_cache, | ||
platform: process.env.npm_config_platform || process.platform, | ||
arch: process.env.npm_config_arch || process.arch | ||
}).then((zipPath) => extractFile(zipPath)).catch((err) => onerror(err)) | ||
// unzips and makes path.txt point at the correct executable | ||
function extractFile (err, zipPath) { | ||
if (err) return onerror(err) | ||
extract(zipPath, {dir: path.join(__dirname, 'dist')}, function (err) { | ||
function extractFile (zipPath) { | ||
extract(zipPath, { dir: path.join(__dirname, 'dist') }, function (err) { | ||
if (err) return onerror(err) | ||
@@ -59,12 +56,12 @@ fs.writeFile(path.join(__dirname, 'path.txt'), platformPath, function (err) { | ||
function getPlatformPath () { | ||
var platform = process.env.npm_config_platform || os.platform() | ||
const platform = process.env.npm_config_platform || os.platform() | ||
switch (platform) { | ||
case 'darwin': | ||
return 'dist/Electron.app/Contents/MacOS/Electron' | ||
return 'Electron.app/Contents/MacOS/Electron' | ||
case 'freebsd': | ||
case 'linux': | ||
return 'dist/electron' | ||
return 'electron' | ||
case 'win32': | ||
return 'dist/electron.exe' | ||
return 'electron.exe' | ||
default: | ||
@@ -71,0 +68,0 @@ throw new Error('Electron builds are not available on platform: ' + platform) |
{ | ||
"scripts": { | ||
"cache-clean": "rm -rf ~/.electron && rm -rf dist", | ||
"postinstall": "node install.js", | ||
"pretest": "npm run cache-clean", | ||
"test": "standard" | ||
}, | ||
"main": "index.js", | ||
"types": "electron.d.ts", | ||
"bin": { | ||
"electron": "cli.js" | ||
}, | ||
"main": "index.js", | ||
"types": "electron.d.ts", | ||
"scripts": { | ||
"postinstall": "node install.js" | ||
}, | ||
"dependencies": { | ||
"@types/node": "^8.0.24", | ||
"electron-download": "^3.0.1", | ||
"@electron/get": "^1.0.1", | ||
"@types/node": "^12.0.12", | ||
"extract-zip": "^1.0.3" | ||
}, | ||
"devDependencies": { | ||
"home-path": "^0.1.1", | ||
"path-exists": "^2.0.0", | ||
"standard": "^5.4.1" | ||
"engines": { | ||
"node": ">= 8.6" | ||
}, | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"name": "electron", | ||
"version": "2.0.18", | ||
"version": "7.3.3", | ||
"repository": "https://github.com/electron/electron", | ||
@@ -29,0 +21,0 @@ "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", |
@@ -5,9 +5,7 @@ [](https://electronjs.org) | ||
[](https://circleci.com/gh/electron/electron/tree/master) | ||
[](https://windows-ci.electronjs.org/project/AppVeyor/electron/branch/master) | ||
[](https://mac-ci.electronjs.org/blue/organizations/jenkins/Electron%20org%2Felectron/activity?branch=master) | ||
[](https://ci.appveyor.com/project/electron-bot/electron-ljo26/branch/master) | ||
[](https://david-dm.org/electron/electron?type=dev) | ||
[](https://atom-slack.herokuapp.com/) | ||
:memo: Available Translations: 🇨🇳 🇹🇼 🇧🇷 🇪🇸 🇰🇷 🇯🇵 🇷🇺 🇫🇷 🇹🇭 🇳🇱 🇹🇷 🇮🇩 🇺🇦 🇨🇿 🇮🇹. | ||
View these docs in other languages at [electron/electron-i18n](https://github.com/electron/electron-i18n/tree/master/content/). | ||
:memo: Available Translations: 🇨🇳 🇹🇼 🇧🇷 🇪🇸 🇰🇷 🇯🇵 🇷🇺 🇫🇷 🇹🇭 🇳🇱 🇹🇷 🇮🇩 🇺🇦 🇨🇿 🇮🇹 🇵🇱. | ||
View these docs in other languages at [electron/i18n](https://github.com/electron/i18n/tree/master/content/). | ||
@@ -34,7 +32,7 @@ The Electron framework lets you write cross-platform desktop applications | ||
```sh | ||
npm install electron --save-dev --save-exact | ||
npm install electron --save-dev [--save-exact] | ||
``` | ||
The `--save-exact` flag is recommended as Electron does not follow semantic | ||
versioning. For info on how to manage Electron versions in your apps, see | ||
The `--save-exact` flag is recommended for Electron prior to version 2, as it does not follow semantic | ||
versioning. As of version 2.0.0, Electron follows semver, so you don't need `--save-exact` flag. For info on how to manage Electron versions in your apps, see | ||
[Electron versioning](docs/tutorial/electron-versioning.md). | ||
@@ -45,5 +43,10 @@ | ||
## Quick start | ||
## Quick start & Electron Fiddle | ||
Clone and run the | ||
Use [`Electron Fiddle`](https://github.com/electron/fiddle) | ||
to build, run, and package small Electron experiments, to see code examples for all of Electron's APIs, and | ||
to try out different versions of Electron. It's designed to make the start of your journey with | ||
Electron easier. | ||
Alternatively, clone and run the | ||
[electron/electron-quick-start](https://github.com/electron/electron-quick-start) | ||
@@ -62,2 +65,3 @@ repository to see a minimal Electron app in action: | ||
- [electronjs.org/docs](https://electronjs.org/docs) - all of Electron's documentation | ||
- [electron/fiddle](https://github.com/electron/fiddle) - A tool to build, run, and package small Electron experiments | ||
- [electron/electron-quick-start](https://github.com/electron/electron-quick-start) - a very basic starter Electron app | ||
@@ -92,4 +96,8 @@ - [electronjs.org/community#boilerplates](https://electronjs.org/community#boilerplates) - sample starter apps created by the community | ||
Find documentation translations in [electron/electron-i18n](https://github.com/electron/electron-i18n). | ||
Find documentation translations in [electron/i18n](https://github.com/electron/i18n). | ||
## Contributing | ||
If you are interested in reporting/fixing issues and contributing directly to the code base, please see [CONTRIBUTING.md](CONTRIBUTING.md) for more information on what we're looking for and how to get started. | ||
## Community | ||
@@ -96,0 +104,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
541253
44.23%0
-100%12959
50.91%108
8%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated