node-power-user 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4,7 +4,6 @@
4
4
 
5
5
  // https://www.sitepoint.com/javascript-command-line-interface-cli-node-js/
6
6
  // https://github.com/sitepoint-editors/ginit
7
-
8
7
  const jetpack = require('fs-jetpack');
9
8
  const chalk = require('chalk');
10
9
  const _ = require('lodash');
@@ -19,7 +18,7 @@ function Main() {
19
18
  }
20
19
 
21
20
  Main.prototype.process = async function (args) {
22
- const self = this;
21
+ const self = this;
23
22
  args = args || process.argv
24
23
  self.options = {};
25
24
  self.argv = argv;
@@ -27,10 +26,7 @@ Main.prototype.process = async function (args) {
27
26
  try {
28
27
  self.npu_packageJSON = require('../package.json');
29
28
  } catch (e) {
30
- self.npu_packageJSON = {
31
- version: '0.0.0'
32
- }
33
- console.error(chalk.red(`This project does not contain a valid package.json file!: \n${e}`));
29
+ throw new Error(`NPU does not contain a valid package.json file!: \n${e}`);
34
30
  }
35
31
 
36
32
  try {
@@ -38,8 +34,14 @@ Main.prototype.process = async function (args) {
38
34
  self.proj_packageJSONPath = path.resolve(self.proj_path, './package.json');
39
35
  self.proj_packageJSON = require(self.proj_packageJSONPath);
40
36
  } catch (e) {
41
- console.error(chalk.red(`Could not read package.json: ${e}`));
42
- return
37
+ self.proj_packageJSON = {
38
+ name: 'Unknown Name',
39
+ version: '0.0.0',
40
+ dependencies: {},
41
+ devDependencies: {},
42
+ peerDependencies: {},
43
+ }
44
+ console.error(chalk.red(`This project does not contain a valid package.json file!: \n${e}`));
43
45
  }
44
46
 
45
47
  if (Array.isArray(args)) {
@@ -64,7 +66,7 @@ Main.prototype.process = async function (args) {
64
66
 
65
67
  if (self.options.pv || self.options['project-version'] || self.options.project) {
66
68
  self.log(chalk.blue(`The current project (${chalk.bold(self.proj_packageJSON.name)}) is v${chalk.bold(self.proj_packageJSON.version)}`));
67
- return self.proj_packageJSON.versio
69
+ return self.proj_packageJSON.version;
68
70
  }
69
71
 
70
72
  if (self.options.lp || self.options.listpackages || self.options['-lp'] || self.options['--listpackages']) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-power-user",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "Easy tools for every Node.js developer!",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -4,7 +4,6 @@
4
4
 
5
5
  // https://www.sitepoint.com/javascript-command-line-interface-cli-node-js/
6
6
  // https://github.com/sitepoint-editors/ginit
7
-
8
7
  const jetpack = require('fs-jetpack');
9
8
  const chalk = require('chalk');
10
9
  const _ = require('lodash');
@@ -19,7 +18,7 @@ function Main() {
19
18
  }
20
19
 
21
20
  Main.prototype.process = async function (args) {
22
- const self = this;
21
+ const self = this;
23
22
  args = args || process.argv
24
23
  self.options = {};
25
24
  self.argv = argv;
@@ -27,10 +26,7 @@ Main.prototype.process = async function (args) {
27
26
  try {
28
27
  self.npu_packageJSON = require('../package.json');
29
28
  } catch (e) {
30
- self.npu_packageJSON = {
31
- version: '0.0.0'
32
- }
33
- console.error(chalk.red(`This project does not contain a valid package.json file!: \n${e}`));
29
+ throw new Error(`NPU does not contain a valid package.json file!: \n${e}`);
34
30
  }
35
31
 
36
32
  try {
@@ -38,8 +34,14 @@ Main.prototype.process = async function (args) {
38
34
  self.proj_packageJSONPath = path.resolve(self.proj_path, './package.json');
39
35
  self.proj_packageJSON = require(self.proj_packageJSONPath);
40
36
  } catch (e) {
41
- console.error(chalk.red(`Could not read package.json: ${e}`));
42
- return
37
+ self.proj_packageJSON = {
38
+ name: 'Unknown Name',
39
+ version: '0.0.0',
40
+ dependencies: {},
41
+ devDependencies: {},
42
+ peerDependencies: {},
43
+ }
44
+ console.error(chalk.red(`This project does not contain a valid package.json file!: \n${e}`));
43
45
  }
44
46
 
45
47
  if (Array.isArray(args)) {
@@ -64,7 +66,7 @@ Main.prototype.process = async function (args) {
64
66
 
65
67
  if (self.options.pv || self.options['project-version'] || self.options.project) {
66
68
  self.log(chalk.blue(`The current project (${chalk.bold(self.proj_packageJSON.name)}) is v${chalk.bold(self.proj_packageJSON.version)}`));
67
- return self.proj_packageJSON.versio
69
+ return self.proj_packageJSON.version;
68
70
  }
69
71
 
70
72
  if (self.options.lp || self.options.listpackages || self.options['-lp'] || self.options['--listpackages']) {