rename to electron-prebuilt

This commit is contained in:
Max Ogden 2015-04-17 11:19:50 -07:00
parent cb161234e5
commit 698d0c5e70
8 changed files with 40 additions and 36 deletions

1
npm/.gitignore vendored
View file

@ -1,3 +1,4 @@
node_modules node_modules
*.zip *.zip
dist dist
.DS_Store

View file

@ -1,4 +1,4 @@
versions published to npm should match the versions published to [github releases for atom-shell](https://github.com/atom/atom-shell/releases) versions published to npm should match the versions published to [github releases for electron](https://github.com/atom/electron/releases)
coding style should be `standard`: coding style should be `standard`:

View file

@ -1,63 +1,63 @@
# atom-shell # electron-prebuilt
[![build status](http://img.shields.io/travis/mafintosh/atom-shell.svg?style=flat)](http://travis-ci.org/mafintosh/atom-shell) [![build status](http://img.shields.io/travis/mafintosh/electron-prebuilt.svg?style=flat)](http://travis-ci.org/mafintosh/electron-prebuilt)
Install [atom-shell](https://github.com/atom/atom-shell) prebuilt binaries for command-line use using npm. Install [electron](https://github.com/atom/electron) (formerly called **atom-shell**) prebuilt binaries for command-line use using npm.
Works on Mac, Windows and Linux OSes that Atom Shell supports (e.g. Atom Shell [does not support Windows XP](https://github.com/atom/atom-shell/issues/691)). Works on Mac, Windows and Linux OSes that Electron supports (e.g. Electron [does not support Windows XP](https://github.com/atom/electron/issues/691)).
Atom Shell is a javascript runtime that bundles Node.js and Chromium. You use it similar to the `node` command on the command line for executing javascript programs. This module helps you easily install the `atom-shell` command for use on the command line without having to compile anything. Electron is a javascript runtime that bundles Node.js and Chromium. You use it similar to the `node` command on the command line for executing javascript programs. This module helps you easily install the `electron` command for use on the command line without having to compile anything.
## Installation ## Installation
Download and install the latest build of atom-shell for your OS and add it to your projects `package.json` as a `devDependency`: Download and install the latest build of electron for your OS and add it to your projects `package.json` as a `devDependency`:
``` ```
npm install atom-shell --save-dev npm install electron-prebuilt --save-dev
``` ```
This is the preferred way to use atom-shell, as it doesn't require users to install atom-shell globally. This is the preferred way to use electron, as it doesn't require users to install electron globally.
You can also use the `-g` flag (global) to symlink it into your PATH: You can also use the `-g` flag (global) to symlink it into your PATH:
``` ```
npm install -g atom-shell npm install -g electron-prebuilt
``` ```
If that command fails with an `EACCESS` error you may have to run it again with `sudo`: If that command fails with an `EACCESS` error you may have to run it again with `sudo`:
``` ```
sudo npm install -g atom-shell sudo npm install -g electron-prebuilt
``` ```
Now you can just run `atom-shell` to run atom-shell: Now you can just run `electron` to run electron:
``` ```
atom-shell electron
``` ```
## Usage ## Usage
First you have to [write an atom shell application](https://github.com/atom/atom-shell/blob/master/docs/tutorial/quick-start.md#write-your-first-atom-shell-app) First you have to [write an electron application](https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md)
Then you can run your app using: Then you can run your app using:
``` ```
atom-shell your-app/ electron your-app/
``` ```
## Programmatic usage ## Programmatic usage
If you require `atom-shell` inside your node app it will return the file path to the binary. If you require `electron-prebuilt` inside your node app it will return the file path to the binary.
Use this to spawn atom shell Use this to spawn electron
``` js ``` js
var atom = require('atom-shell') var electron = require('electron-prebuilt')
var proc = require('child_process') var proc = require('child_process')
// will something similar to print /Users/maf/.../Atom // will something similar to print /Users/maf/.../Electron
console.log(atom) console.log(electron)
// spawn atom-shell // spawn electron
var child = proc.spawn(atom) var child = proc.spawn(electron)
``` ```

View file

@ -8,18 +8,18 @@ var fs = require('fs')
var platform = os.platform() var platform = os.platform()
var arch = os.arch() var arch = os.arch()
var version = '0.23.0' var version = '0.24.0'
var filename = 'atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' var filename = 'electron-v' + version + '-' + platform + '-' + arch + '.zip'
var url = 'https://github.com/atom/atom-shell/releases/download/v' + version + '/atom-shell-v' + version + '-' + platform + '-' + arch + '.zip' var url = 'https://github.com/atom/electron/releases/download/v' + version + '/electron-v' + version + '-' + platform + '-' + arch + '.zip'
function onerror (err) { function onerror (err) {
throw err throw err
} }
var paths = { var paths = {
darwin: path.join(__dirname, './dist/Atom.app/Contents/MacOS/Atom'), darwin: path.join(__dirname, './dist/Electron.app/Contents/MacOS/Electron'),
linux: path.join(__dirname, './dist/atom'), linux: path.join(__dirname, './dist/electron'),
win32: path.join(__dirname, './dist/atom.exe') win32: path.join(__dirname, './dist/electron.exe')
} }
var shebang = { var shebang = {

View file

@ -1,17 +1,17 @@
{ {
"name": "atom-shell", "name": "electron-prebuilt",
"version": "0.23.0", "version": "0.23.0",
"description": "Install atom-shell prebuilts using npm", "description": "Install electron (formerly called atom-shell) prebuilts using npm",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/mafintosh/atom-shell" "url": "https://github.com/mafintosh/electron"
}, },
"scripts": { "scripts": {
"install": "node install.js", "install": "node install.js",
"test": "tape test/*.js" "test": "tape test/*.js"
}, },
"bin": { "bin": {
"atom-shell": "run.bat" "electron": "run.bat"
}, },
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
@ -24,7 +24,7 @@
"author": "Mathias Buus", "author": "Mathias Buus",
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {
"url": "https://github.com/mafintosh/atom-shell/issues" "url": "https://github.com/mafintosh/electron-prebuilt/issues"
}, },
"homepage": "https://github.com/mafintosh/atom-shell" "homepage": "https://github.com/mafintosh/electron-prebuilt"
} }

1
npm/path.txt Normal file
View file

@ -0,0 +1 @@
/Users/maxogden/src/js/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron

2
npm/run.bat Normal file → Executable file
View file

@ -0,0 +1,2 @@
#!/bin/bash
"/Users/maxogden/src/js/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron" "$@"

View file

@ -1,8 +1,8 @@
var tape = require('tape') var tape = require('tape')
var atom = require('../') var electron = require('../')
var fs = require('fs') var fs = require('fs')
tape('has binary', function(t) { tape('has binary', function(t) {
t.ok(fs.existsSync(atom), 'atom-shell was downloaded') t.ok(fs.existsSync(electron), 'electron was downloaded')
t.end() t.end()
}) })