Comparing version 9.0.1 to 9.1.1
@@ -6,2 +6,10 @@ # Change Log | ||
<a name="9.1.1"></a> | ||
## [9.1.1](https://github.com/xing/hops/compare/v9.1.0...v9.1.1) (2017-12-05) | ||
**Note:** Version bump only for package hops-cli | ||
<a name="7.4.0"></a> | ||
@@ -8,0 +16,0 @@ # [7.4.0](https://github.com/xing/hops/compare/v7.3.5...v7.4.0) (2017-11-01) |
77
hops.js
@@ -12,3 +12,3 @@ #!/usr/bin/env node | ||
var getLocalCliPath = function () { | ||
var getLocalCliPath = function() { | ||
try { | ||
@@ -21,17 +21,18 @@ return resolveCwd('hops-local-cli'); | ||
var PACKAGES_TO_INSTALL = [ | ||
'hops-local-cli' | ||
]; | ||
var PACKAGES_TO_INSTALL = ['hops-local-cli']; | ||
function globalCLI (argv) { | ||
function globalCLI(argv) { | ||
return require('yargs') | ||
.version(packageManifest.version) | ||
.usage('Usage: $0 <command> [options]') | ||
.command('init <project-name>', 'Generates a new project with the ' + | ||
'specified name') | ||
.command( | ||
'init <project-name>', | ||
'Generates a new project with the ' + 'specified name' | ||
) | ||
.option('template', { | ||
type: 'string', | ||
describe: 'Use this with the npm package name of a template to ' + | ||
describe: | ||
'Use this with the npm package name of a template to ' + | ||
'initialize with a different template', | ||
default: 'hops-template-react' | ||
default: 'hops-template-react', | ||
}) | ||
@@ -41,3 +42,3 @@ .option('hops-version', { | ||
describe: 'Which version (or npm dist-tag) of hops-local-cli to use', | ||
default: 'latest' | ||
default: 'latest', | ||
}) | ||
@@ -47,3 +48,3 @@ .option('verbose', { | ||
describe: 'Increase verbosity of command', | ||
default: false | ||
default: false, | ||
}) | ||
@@ -53,3 +54,3 @@ .option('npm', { | ||
describe: 'Force usage of `npm` instead of yarn', | ||
default: false | ||
default: false, | ||
}) | ||
@@ -73,3 +74,3 @@ .example( | ||
function validateName (name) { | ||
function validateName(name) { | ||
var validationResult = validatePackageName(name); | ||
@@ -83,6 +84,10 @@ if (!validationResult.validForNewPackages) { | ||
if (validationResult.errors) { | ||
validationResult.errors.forEach(function (msg) { console.error(msg); }); | ||
validationResult.errors.forEach(function(msg) { | ||
console.error(msg); | ||
}); | ||
} | ||
if (validationResult.warnings) { | ||
validationResult.warnings.forEach(function (msg) { console.warn(msg); }); | ||
validationResult.warnings.forEach(function(msg) { | ||
console.warn(msg); | ||
}); | ||
} | ||
@@ -93,3 +98,3 @@ process.exit(1); | ||
function createDirectory (root) { | ||
function createDirectory(root) { | ||
if (fs.existsSync(root)) { | ||
@@ -109,14 +114,18 @@ console.error( | ||
function writePackageManifest (root) { | ||
function writePackageManifest(root) { | ||
fs.writeFileSync( | ||
path.join(root, 'package.json'), | ||
JSON.stringify({ | ||
name: name, | ||
version: '1.0.0', | ||
private: true | ||
}, null, 2) | ||
JSON.stringify( | ||
{ | ||
name: name, | ||
version: '1.0.0', | ||
private: true, | ||
}, | ||
null, | ||
2 | ||
) | ||
); | ||
} | ||
function isYarnAvailable () { | ||
function isYarnAvailable() { | ||
try { | ||
@@ -130,18 +139,9 @@ execSync('yarn --version', { stdio: 'ignore' }); | ||
function installPackages (packages, options) { | ||
function installPackages(packages, options) { | ||
var command = null; | ||
var shouldUseYarn = isYarnAvailable() && !options.npm; | ||
if (shouldUseYarn) { | ||
command = [ | ||
'yarn', | ||
'add', | ||
'--exact' | ||
]; | ||
command = ['yarn', 'add', '--exact']; | ||
} else { | ||
command = [ | ||
'npm', | ||
'install', | ||
'--save', | ||
'--save-exact' | ||
]; | ||
command = ['npm', 'install', '--save', '--save-exact']; | ||
} | ||
@@ -173,4 +173,5 @@ if (options.verbose) { | ||
var manifest = require(path.resolve(process.cwd(), 'package.json')); | ||
var dependencies = Object.keys(manifest.dependencies || {}) | ||
.concat(Object.keys(manifest.devDependencies || {})); | ||
var dependencies = Object.keys(manifest.dependencies || {}).concat( | ||
Object.keys(manifest.devDependencies || {}) | ||
); | ||
isInsideHopsProject = dependencies.indexOf('hops-local-cli') > -1; | ||
@@ -197,3 +198,3 @@ } catch (error) { | ||
var root = process.cwd(); | ||
var versionedPackages = PACKAGES_TO_INSTALL.map(function (name) { | ||
var versionedPackages = PACKAGES_TO_INSTALL.map(function(name) { | ||
return name + '@' + options.hopsVersion; | ||
@@ -200,0 +201,0 @@ }); |
{ | ||
"name": "hops-cli", | ||
"version": "9.0.1", | ||
"version": "9.1.1", | ||
"description": "Global CLI module to initialize new hops projects", | ||
"keywords": [ | ||
"hops", | ||
"cli" | ||
], | ||
"keywords": ["hops", "cli"], | ||
"license": "MIT", | ||
@@ -14,5 +11,3 @@ "bin": { | ||
"preferGlobal": true, | ||
"files": [ | ||
"hops.js" | ||
], | ||
"files": ["hops.js"], | ||
"repository": { | ||
@@ -19,0 +14,0 @@ "type": "git", |
@@ -7,3 +7,3 @@ # Hops CLI | ||
This binary provides different commands based on the context in which it is called. | ||
This binary provides different commands based on the context in which it is called.\ | ||
If called inside a hops project it will delegate to the [hops-local-cli](https://github.com/xing/hops/tree/master/packages/local-cli) and provide the commands defined there. | ||
@@ -13,3 +13,2 @@ | ||
## Installation | ||
@@ -26,2 +25,3 @@ | ||
``` | ||
This will create a very basic hops example project that is ready to go. | ||
@@ -31,9 +31,8 @@ | ||
- `--verbose` - to increase the verbosity of the output for debugging purposes | ||
- `--npm` - to force usage of `npm` instead of `yarn` even if yarn is available | ||
- `--template` - to specify a different template for the intial structure. | ||
available templates: | ||
- [hops-template-react](https://github.com/xing/hops/tree/master/packages/template-react) | ||
- [hops-template-minimal](https://github.com/xing/hops/tree/master/packages/template-minimal) | ||
* `--verbose` - to increase the verbosity of the output for debugging purposes | ||
* `--npm` - to force usage of `npm` instead of `yarn` even if yarn is available | ||
* `--template` - to specify a different template for the intial structure. available templates: | ||
* [hops-template-react](https://github.com/xing/hops/tree/master/packages/template-react) | ||
* [hops-template-minimal](https://github.com/xing/hops/tree/master/packages/template-minimal) | ||
Then `cd` into `my-new-hops-project` and execute `hops --help` again to see a list of supported commands. These commands are provided by [hops-local-cli](https://github.com/xing/hops/tree/master/packages/local-cli). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8508
181
35