Skip to content

Commit

Permalink
Merge branch 'release/v1.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
themodernpk committed Nov 25, 2020
2 parents 4654e11 + b443b53 commit 6a7cc0f
Show file tree
Hide file tree
Showing 9 changed files with 338 additions and 26 deletions.
102 changes: 100 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Please consider starring the project to show your :heart: and support.
#### Completed
:white_check_mark: VaahCMS Installer
:white_check_mark: VaahCMS Module Generator
:white_check_mark: VaahCMS Themes

#### Planned
:black_square_button: Laravel Package Development
Expand All @@ -18,8 +19,6 @@ Please consider starring the project to show your :heart: and support.

:black_square_button: VaahCMS Modules Files (migration, model, view, controller, seed )

:black_square_button: VaahCMS Themes

:black_square_button: VaahCMS Themes Files (migration, model, view, controller, seed )

:black_square_button: WordPress Theme
Expand Down Expand Up @@ -185,13 +184,29 @@ Security:
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->
* [Vaah](#vaah)
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->
# Usage
<!-- usage -->
```sh-session
$ npm install -g vaah
$ vaah COMMAND
running command...
$ vaah (-v|--version|version)
vaah/1.0.2 win32-x64 node-v12.16.1
$ vaah --help [COMMAND]
USAGE
$ vaah COMMAND
...
```
<!-- usagestop -->
```sh-session
$ npm install -g vaah
$ vaah COMMAND
running command...
$ vaah (-v|--version|version)
vaah/1.0.1 win32-x64 node-v12.16.1
$ vaah --help [COMMAND]
USAGE
Expand All @@ -215,6 +230,89 @@ USAGE
<!-- commands -->
* [`vaah cms:install [PROJECT_NAME]`](#vaah-cmsinstall-project_name)
* [`vaah cms:m`](#vaah-cmsm)
* [`vaah cms:t [FILE]`](#vaah-cmst-file)
* [`vaah hello [FILE]`](#vaah-hello-file)
* [`vaah help [COMMAND]`](#vaah-help-command)

## `vaah cms:install [PROJECT_NAME]`

```
USAGE
$ vaah cms:install [PROJECT_NAME]
ARGUMENTS
PROJECT_NAME [default: vaahcms] Enter the project folder name
OPTIONS
-h, --help show CLI help
--here If you want to VaahCMS in current director
```

_See code: [src/commands/cms/install.ts](https://github.com/webreinvent/vaah/blob/v1.0.2/src/commands/cms/install.ts)_

## `vaah cms:m`

```
USAGE
$ vaah cms:m
OPTIONS
-f, --force
-h, --help show CLI help
-n, --name show CLI help
```

_See code: [src/commands/cms/m.ts](https://github.com/webreinvent/vaah/blob/v1.0.2/src/commands/cms/m.ts)_

## `vaah cms:t [FILE]`

```
USAGE
$ vaah cms:t [FILE]
OPTIONS
-f, --force
-h, --help show CLI help
-n, --name=name name to print
```

_See code: [src/commands/cms/t.ts](https://github.com/webreinvent/vaah/blob/v1.0.2/src/commands/cms/t.ts)_

## `vaah hello [FILE]`

```
USAGE
$ vaah hello [FILE]
OPTIONS
-f, --force
-h, --help show CLI help
-n, --name=name name to print
EXAMPLE
$ vaah hello
hello world from ./src/hello.ts!
```

_See code: [src/commands/hello.ts](https://github.com/webreinvent/vaah/blob/v1.0.2/src/commands/hello.ts)_

## `vaah help [COMMAND]`

```
USAGE
$ vaah help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.0/src/commands/help.ts)_
<!-- commandsstop -->
* [`vaah cms:install [PROJECT_NAME]`](#vaah-cmsinstall-project_name)
* [`vaah cms:m`](#vaah-cmsm)
* [`vaah hello [FILE]`](#vaah-hello-file)
* [`vaah help [COMMAND]`](#vaah-help-command)

Expand Down
8 changes: 8 additions & 0 deletions lib/commands/cms/install.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { Command } from '@oclif/command';
export default class CmsInstall extends Command {
args: {
[k: string]: any;
};
flags: {
[k: string]: any;
};
inputs: {
[k: string]: any;
};
Expand All @@ -21,5 +27,7 @@ export default class CmsInstall extends Command {
run(): Promise<void>;
install(): Promise<void>;
spin(): Promise<void>;
printName(): Promise<void>;
spinStop(): Promise<void>;
spinStopWithError(): Promise<void>;
}
72 changes: 53 additions & 19 deletions lib/commands/cms/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ const execa = require('execa');
const Listr = require('listr');
var shell = require('shelljs');
const { exec } = require('child_process');
let fsSync = require('fs-sync');
const fsPromises = fs.promises;
const chalk = require('chalk');
const log = console.log;
class CmsInstall extends command_1.Command {
constructor() {
super(...arguments);
this.args = {};
this.flags = {};
this.inputs = {};
this.spinner = {};
this.repo = 'https://github.com/webreinvent/vaahcms-ready';
this.target_dir = './';
//-----------------------------------
//-----------------------------------
//-----------------------------------
}
/*
*---------------------------------------------------
Expand All @@ -27,18 +30,37 @@ class CmsInstall extends command_1.Command {
*/
async run() {
const { args, flags } = this.parse(CmsInstall);
this.args = args;
this.flags = flags;
await this.printName();
await this.spin();
if (!flags.here) {
this.target_dir = this.target_dir + args.project_name + "/";
this.target_dir = this.target_dir + args.project_name;
}
if (!fs.existsSync(this.target_dir)) {
fs.mkdirSync(this.target_dir);
}
await this.spin();
await this.install();
}
//-----------------------------------
//-----------------------------------
async install() {
const tasks = new Listr([
{
title: 'Creating Project Folder',
task: () => new Promise((resolve, reject) => {
{
let self = this;
if (this.args.project_name) {
fs.mkdir(self.target_dir, (error, result) => {
if (error != null) {
log("");
log(chalk.red("- Project Folder Already Exists"));
return reject(error);
}
resolve(result);
});
}
}
})
},
{
title: 'Downloading Repository',
task: () => new Promise((resolve, reject) => {
Expand All @@ -47,7 +69,7 @@ class CmsInstall extends command_1.Command {
let options = [
'clone',
this.repo,
this.target_dir
'./'
];
let git = execa('git', options);
git.then(resolve)
Expand All @@ -59,22 +81,26 @@ class CmsInstall extends command_1.Command {
})
},
{
title: 'Installing Dependencies via Composer',
title: 'Installing Dependencies via Composer (Takes 5 - 6 minutes)',
task: () => new Promise((resolve, reject) => {
{
log(chalk.yellow("Be patient, this can take up to 5 - 6 minutes.."));
shell.cd(this.target_dir);
fs.rmdirSync(this.target_dir + '.git/', { recursive: true });
let project = '.git';
fs.rmdirSync(project, { recursive: true });
let options = [
'install',
];
let composer = execa('composer', options, {
buffer: true,
let output_options = {
buffer: false,
stderr: "inherit"
});
composer.stdout.pipe(process.stdout);
};
//let composer = execa('composer', options, output_options);
//composer.stdout.pipe(process.stdout);
let composer = execa('composer', options);
composer.then(resolve)
.catch(() => {
reject(new Error('Failed'));
.catch((error) => {
return reject(error);
});
return composer;
}
Expand Down Expand Up @@ -104,17 +130,17 @@ class CmsInstall extends command_1.Command {
return command;
}
})
},
}
]);
tasks.run().then(() => {
this.spinStop();
}).catch((err) => {
console.error(err);
this.spinStopWithError();
});
}
//-----------------------------------
//-----------------------------------
//-----------------------------------
async spin() {
this.spinner = ora();
this.spinner.start('Installing VaahCMS...');
Expand All @@ -135,20 +161,28 @@ class CmsInstall extends command_1.Command {
};
}
//-----------------------------------
async spinStop() {
this.spinner.succeed();
async printName() {
log(chalk.red(`
/\\ /\\ __ _ __ _ | |__ / __\\ /\\/\\ / _\\
\\ \\ / // _\` | / _\` || '_ \\ / / / \\ \\ \\
\\ V /| (_| || (_| || | | |/ /___/ /\\/\\ \\_\\ \\
\\_/ \\__,_| \\__,_||_| |_|\\____/\\/ \\/\\__/
`));
}
//-----------------------------------
async spinStop() {
this.spinner.succeed();
log(chalk.white.bgGreen.bold(" VaahCMS Installed! "));
log(chalk.green("=================================================================="));
log("Run " + chalk.green("php artisan server") + " and visit following url to setup:");
log(chalk.green("http://127.0.0.1:8000/vaahcms/setup"));
log(chalk.green("=================================================================="));
}
//-----------------------------------
async spinStopWithError() {
this.spinner.succeed();
log(chalk.white.bgRed.bold(" VaahCMS Installation Failed! "));
}
}
exports.default = CmsInstall;
CmsInstall.description = 'Install VaahCMS';
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vaah",
"description": "CLi of VaahCMS",
"version": "1.0.2",
"description": "CLI of VaahCMS - VaahCLI",
"version": "1.0.3",
"author": "Vaah",
"bin": {
"vaah": "./bin/run"
Expand Down
Loading

0 comments on commit 6a7cc0f

Please sign in to comment.