Skip to content

Commit

Permalink
Create CLI app
Browse files Browse the repository at this point in the history
  • Loading branch information
jrstylle committed Oct 2, 2018
1 parent 913c0cb commit a7e5c47
Show file tree
Hide file tree
Showing 9 changed files with 2,123 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

[*.{cs}]
indent_size = 4
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
16 changes: 16 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"root": true,
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {}
},
"globals": {},
"env": {
"es6": true,
"node": true
},
"rules": {
"semi": 2
}
}
63 changes: 63 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

.cache
19 changes: 19 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2018 [José Rodrigues da Silva Junior](https://joserodrigues.me)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
60 changes: 58 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,58 @@
# page-bone-cli
A CLI app to create new project usign page-bone Boilerplate
# pagebone-cli

> :computer: A simple CLI app to create new project using pagebone Boilerplate
[![npm](https://img.shields.io/npm/v/pagebone-cli.svg?colorB=green)](https://www.npmjs.com/package/pagebone-cli)
[![NpmLicense](https://img.shields.io/npm/l/pagebone-cli.svg?colorB=brightgreen)](https://www.npmjs.com/package/pagebone-cli)


## How it works?

![pagebone](https://user-images.githubusercontent.com/6127099/46318395-b49c7780-c5ac-11e8-8b3f-1b3c02d7dcde.gif)

## How to install

Verify if you have [node](http://nodejs.org/) and [npm](https://www.npmjs.org/) installed.

### Command Line

```sh
$ npm install -g pagebone-cli
```

## Command Line Usage

*Show the CLI version.*

```sh
$ pagebone-cli --version
```

*Show all available commands.*

```sh
$ pagebone-cli --help
```

*Create new project using the pagebone Boilerplate.*

```sh
$ pagebone-cli new <projectName>
```

<hr>

## Versioning

To keep better organization of releases we follow the [Semantic Versioning 2.0.0](http://semver.org/) guidelines.

## History

See [Releases](https://github.com/jrstylle/pagebone-cli/releases) for detailed changelog.

## License

[MIT License](https://github.com/jrstylle/pagebone-cli/blob/master/LICENSE.md) © [José Rodrigues da Silva Junior](https://joserodrigues.me)



51 changes: 51 additions & 0 deletions bin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env node

const download = require('download');
const cli = require('commander');
const tree = require('tree-directory');
const ora = require('ora');
const packageFile = require('../package.json');

function help() {
return console.log(`
Usage: ${packageFile.name} [options] or [commands]
A simple CLI app to create new project usign pagebone Boilerplate https://github.com/jrstylle/pagebone#readme
Options:
-v --version Show the CLI version
-h --help Show all available commands and options
Commands:
new <projectName> Create new project using the pagebone Boilerplate
`);
}

cli.version(`version ${packageFile.version}`, '-v, --version');

cli.command('new <projectName>').action( projectName => {

const spinner = ora({color: "cyan"}).start('Downloading the project...');

download('https://github.com/jrstylle/pagebone/archive/master.zip',`${projectName}`, { extract: true, strip: 1, mode: 666, headers: { accept: 'application/zip' } })
.then(() => {

spinner.succeed(`Download complete\n\n${projectName}`);
tree(`${projectName}`).then( res => {

console.log(res);
});
})
.catch( err => {

spinner.fail('Download failed');
console.log(err);
});
});

(!process.argv[2] || process.argv[2] === '-h' || process.argv[2] === '--help')
? help()
: cli.parse(process.argv);

Loading

0 comments on commit a7e5c47

Please sign in to comment.