Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: (node:78208) Warning and nw remove error #31

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
package-lock.json
46 changes: 26 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,60 @@
# nwjs [![version](https://img.shields.io/npm/v/nwjs.svg)](https://www.npmjs.com/package/nwjs) [![npm](https://img.shields.io/npm/dm/nwjs.svg)](https://www.npmjs.com/package/nwjs)
# tnwjs [![version](https://img.shields.io/npm/v/tnwjs.svg)](https://www.npmjs.com/package/tnwjs) [![npm](https://img.shields.io/npm/dm/tnwjs.svg)](https://www.npmjs.com/package/tnwjs)

> forked from <https://github.com/egoist/nwjs>. fixed some errors

Inspired by [electron-prebuilt](https://github.com/mafintosh/electron-prebuilt)

You can use `nwjs` as an nw.js version manager, and do things like `nw /your/app/path`
You can use `tnwjs` as an nw.js version manager, and do things like `tnw /your/app/path`

![preview](http://ooo.0o0.ooo/2016/02/01/56af0ee357dab.gif)

# Install
## Install

```bash
npm i -g nwjs
npm i -g tnwjs
```
# Usage

## Usage

```bash
# Install a version
$ nw install 0.12.3
$ tnw install 0.12.3

# Install a SDK version
$ nw install 0.13.0-rc3-sdk
$ tnw install 0.13.0-rc3-sdk

# Run nw in cwd or specific any directory
$ nw .
# Run tnw in cwd or specific any directory
$ tnw .

# Use another cached version
$ nw use 0.13.0-beta3
$ tnw use 0.13.0-beta3

# Use SDK version
$ nw use 0.13.0-rc3-sdk
$ tnw use 0.13.0-rc3-sdk

# Show the nw version currently in use
$ tnw current

# List all local cached versions
$ nw ls
$ tnw ls

# Use a proxy
$ http_proxy=http://127.0.0.1:8787 nw install 0.13.0-beta5
$ http_proxy=http://127.0.0.1:8787 tnw install 0.13.0-beta5

# For fish shell users
$ env http_proxy=http://127.0.0.1:8787 nw install 0.13.0-beta5
$ env http_proxy=http://127.0.0.1:8787 tnw install 0.13.0-beta5
```

For all available versions to install please use `nw ls-remote`
For all available versions to install please use `tnw ls-remote`

_Tested on Windows 7(32), Windows 10(32), Ubuntu 14.04(32), OSX El Capitan (64)._

## Help

```bash
$ nw -h
$ tnw -h

Usage: nw [options] [command]
Usage: tnw [options] [command]


Commands:
Expand All @@ -69,11 +75,11 @@ $ nw -h
## Programmatic usage

```js
const spawn = require('child_process').spawn
const spawn = require("child_process").spawn;
// this returns the path to nwjs excutable
const nw = require('nwjs')
const nw = require("tnwjs");

const child = spawn(nw)
const child = spawn(nw);
```

## License
Expand Down
16 changes: 16 additions & 0 deletions lib/current.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use strict";

/**
* Module dependencies
*/
const co = require("co");
const config = require("./config");

module.exports = co.wrap(function* () {
try {
const current = config.get("current");
console.log(current);
} catch (e) {
console.log(e.stack);
}
});
2 changes: 1 addition & 1 deletion lib/remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function (version) {
}

const dir = `${home}/.nwjs/${version}`
rm('-r', dir)
rm('-rf', dir)
} catch (e) {
console.log(e.stack)
}
Expand Down
9 changes: 8 additions & 1 deletion nw
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const use = require('./lib/use')
const list = require('./lib/list')
const listRemote = require('./lib/list-remote')
const remove = require('./lib/remove')
const current = require('./lib/current')

/**
* Update notify
Expand All @@ -33,7 +34,7 @@ cli

cli
.command('install <version>')
.description('Install an nwjs version')
.description('Install a nwjs version')
.alias('i')
.action(install)

Expand Down Expand Up @@ -61,6 +62,12 @@ cli
.alias('r')
.action(remove)

cli
.command('current')
.description('Show the nw version currently in use')
.alias('c')
.action(current)

const inst = cli.parse(process.argv)

if(!inst.args.length) {
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nwjs",
"version": "1.4.4",
"name": "tnwjs",
"version": "2.1.0",
"description": "Install nw.js prebuilts using npm",
"main": "index.js",
"scripts": {
Expand All @@ -9,7 +9,8 @@
},
"preferGlobal": true,
"bin": {
"nw": "nw"
"nw": "nw",
"tnw": "nw"
},
"files": [
"nw",
Expand All @@ -19,14 +20,14 @@
],
"repository": {
"type": "git",
"url": "git+https://github.com/egoist/nwjs.git"
"url": "git+https://github.com/ost-forks/nwjs.git"
},
"author": "EGOIST <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/egoist/nwjs/issues"
"url": "https://github.com/ost-forks/nwjs/issues"
},
"homepage": "https://github.com/egoist/nwjs#readme",
"homepage": "https://github.com/ost-forks/nwjs#readme",
"dependencies": {
"co": "^4.6.0",
"colorful": "^2.1.0",
Expand All @@ -40,7 +41,7 @@
"path-exists": "^1.0.0",
"pget": "0.0.0",
"pify": "^2.3.0",
"shelljs": "^0.7.5",
"shelljs": "^0.8.5",
"update-notifier": "^0.6.0",
"user-home": "^2.0.0"
}
Expand Down