mirror of https://github.com/codefeathers/w
Muthu Kumar
7 years ago
6 changed files with 67 additions and 28 deletions
@ -1,9 +1,31 @@ |
|||||
# w |
# w |
||||
|
|
||||
w is a cli application to spin up WordBox instances. Unstable, but in active development. |
w-cli is a cli application to spin up WordBox instances. |
||||
|
|
||||
[WordBox](https://github.com/codefeathers/WordBox) is a quick development (and deployment) environment for PHP. |
[WordBox](https://github.com/codefeathers/WordBox) is a quick development (and deployment) environment for PHP. |
||||
|
|
||||
|
## Install |
||||
|
|
||||
|
> Before you install! `p7zip` must be in your PATH. `7z --help` to verify. On Debian or Ubuntu, use `sudo apt-get install p7zip`. Currently `w-cli` only works in Linux. |
||||
|
|
||||
|
Install `w` from npm! |
||||
|
|
||||
|
`npm install w --global` |
||||
|
|
||||
|
## Usage |
||||
|
|
||||
|
`w new <appname>` |
||||
|
|
||||
|
Creates a new project at current folder with name `appname`. Downloads WordBox and extracts it to the folder and does `npm install` to resolve dependencies. You should download or compile `php` and `php-cgi` binaries and place them at `appname/php`. Place your public `.php` files at `appname/public`. Check `config.js` to see if all's perfect, then do `node .` to start a new Express server that runs PHP. |
||||
|
|
||||
|
You should probably use `nginx` to reverse-proxy the server in production. Check out my other project `up-serve` [[npm]](https://npmjs.com/package/up-serve) [[Github]](https://github.com/codefeathers/up-serve) to setup nginx servers with a single command. |
||||
|
|
||||
|
## Version |
||||
|
|
||||
|
Current version is `v 1.1.0`. This is an MVP. |
||||
|
|
||||
|
> Note: Because npm versions are immutable, our public version number starts directly from v.1.0.1. The project should be considered unstable until v.2.0.0 which will be `w-cli`'s first stable release version. |
||||
|
|
||||
### Credits |
### Credits |
||||
|
|
||||
I humbly thank [@wbhob](https://github.com/wbhob) for donating the package name `w` on npm. |
I humbly thank [@wbhob](https://github.com/wbhob) for donating the package name `w` on npm. |
||||
|
@ -1,11 +1,12 @@ |
|||||
var sevenZip = require('node-7z') |
'use strict'; |
||||
var Zip = new sevenZip() |
|
||||
|
|
||||
const extract = (filename, destination) => { |
const child = require('child_process'); |
||||
Zip.extractFull(filename, destination) |
const { normalize } = require('path'); |
||||
.progress((files) => console.log('Some files are extracted: %s', files)) |
|
||||
.then(() => console.log('Extracting done!')) |
|
||||
.catch((err) => console.error(err)) |
|
||||
} |
|
||||
|
|
||||
module.exports = extract |
function extract(source, destination) { |
||||
|
child.execSync(`7z x ${source} -o${destination}`); |
||||
|
child.execSync(`mv ${normalize(destination + '/WordBox-master/*')} ${destination}`); |
||||
|
child.execSync(`rm -rf ${normalize(destination + '/WordBox-master/')}`); |
||||
|
}; |
||||
|
|
||||
|
module.exports = extract; |
@ -0,0 +1,9 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
const child = require('child_process'); |
||||
|
|
||||
|
function npminstall(projectFolder) { |
||||
|
return std = child.execSync(`cd ${projectFolder} && npm install`); |
||||
|
}; |
||||
|
|
||||
|
module.exports = npminstall; |
Loading…
Reference in new issue