Skip to content

Commit

Permalink
Refactor codebase
Browse files Browse the repository at this point in the history
Add getting started commands to readme
Update version to 1.0.0 for Wee 3 release
  • Loading branch information
leigeber committed Nov 21, 2015
1 parent d5951ee commit 40e7b61
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 29 deletions.
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -4,6 +4,11 @@ This repository is part of the [Wee framework](https://github.com/weepower/wee).

[![NPM version](https://img.shields.io/npm/v/wee-cli.svg?style=flat)](https://www.npmjs.com/package/wee-cli)

## Getting Started

* Install from npm using `npm install -g wee-cli`
* To update to the latest version run `npm update -g wee-cli`

## Bugs

Have a bug or a feature request? [Open a new issue](https://github.com/weepower/wee/issues).
Expand Down
50 changes: 28 additions & 22 deletions lib/wee.js
Expand Up @@ -4,34 +4,40 @@
// Licensed under Apache 2 (http://www.apache.org/licenses/LICENSE-2.0)
// DO NOT MODIFY

/* global process */
/* global process, require */

var fs = require('fs'),
cwd = process.cwd(),
cliPath = cwd + '/node_modules/wee-core/cli.js';

fs.stat(cliPath, function(err, stat) {
if (err === null) {
require(cliPath)(cwd);
} else {
fs.stat('./package.json', function(err, stat) {
if (err === null) {
fs.readFile('./package.json', function(err, data) {
if (err) {
console.log(err);
}

var config = JSON.parse(data);

if (config.name == 'wee') {
console.log('Wee core not found. Run "npm install" and try again.');
} else {
console.log('The local package.json is not formatted for Wee.');
}
});
} else {
console.log('Wee package.json not found in the current directory.');
fs.stat(cliPath, function(err) {
if (err !== null) {
fs.stat('./package.json', function(err) {
if (err !== null) {
console.log('Wee package.json not found in current directory');
return;
}

fs.readFile('./package.json', function(err, data) {
if (err) {
console.log(err);
return;
}

// Check for valid Wee installation
var config = JSON.parse(data);

if (config.name == 'wee') {
console.log('Run "npm install" to install Wee core');
} else {
console.log('The package.json is not compatible with Wee');
}
});
});

return;
}

// Interface to core package
require(cliPath)(cwd);
});
12 changes: 5 additions & 7 deletions package.json
@@ -1,21 +1,19 @@
{
"name": "wee-cli",
"version": "1.0.0-beta",
"description": "Blueprint for modern web development",
"version": "1.0.0",
"description": "Global command line interface for Wee",
"homepage": "https://www.weepower.com",
"license": "Apache-2.0",
"keywords": [
"css",
"framework",
"javascript",
"responsive"
"cli",
"wee"
],
"repository": {
"type": "git",
"url": "https://github.com/weepower/wee-cli.git"
},
"bugs": {
"url": "https://github.com/weepower/wee-cli/issues"
"url": "https://github.com/weepower/wee/issues"
},
"bin": {
"wee" : "lib/wee.js"
Expand Down

0 comments on commit 40e7b61

Please sign in to comment.