node-power-user 0.0.17 → 0.0.18
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 +9 -7
- package/package.json +1 -1
- package/src/index.js +9 -7
package/dist/index.js
CHANGED
|
@@ -26,8 +26,11 @@ Main.prototype.process = async function (args) {
|
|
|
26
26
|
|
|
27
27
|
try {
|
|
28
28
|
self.npu_packageJSON = require('../package.json');
|
|
29
|
-
} catch (
|
|
30
|
-
|
|
29
|
+
} 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}`));
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
try {
|
|
@@ -50,12 +53,11 @@ Main.prototype.process = async function (args) {
|
|
|
50
53
|
});
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
if (self.options.debug) {
|
|
56
|
+
if (self.options.d || self.options.debug || self.options['-d'] || self.options['--debug']) {
|
|
55
57
|
console.log('options:', self.options);
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
if (self.options.v || self.options.version || self.options['-v'] || self.options['
|
|
60
|
+
if (self.options.v || self.options.version || self.options['-v'] || self.options['--version']) {
|
|
59
61
|
self.log(chalk.blue(`Node Power User is v${chalk.bold(self.npu_packageJSON.version)}`));
|
|
60
62
|
return self.npu_packageJSON.version;
|
|
61
63
|
}
|
|
@@ -65,7 +67,7 @@ Main.prototype.process = async function (args) {
|
|
|
65
67
|
return self.proj_packageJSON.versio
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
if (self.options.lp || self.options.listpackages || self.options['-lp'] || self.options['
|
|
70
|
+
if (self.options.lp || self.options.listpackages || self.options['-lp'] || self.options['--listpackages']) {
|
|
69
71
|
self.log(chalk.blue.bold(`Dependencies:`));
|
|
70
72
|
Object.keys(self.proj_packageJSON.dependencies || {})
|
|
71
73
|
.forEach((dep, i) => {
|
|
@@ -114,7 +116,7 @@ Main.prototype.process = async function (args) {
|
|
|
114
116
|
Main.prototype.log = function () {
|
|
115
117
|
const self = this;
|
|
116
118
|
|
|
117
|
-
if (self.options.
|
|
119
|
+
if (self.options.lo !== false) {
|
|
118
120
|
console.log(...arguments);
|
|
119
121
|
}
|
|
120
122
|
};
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -26,8 +26,11 @@ Main.prototype.process = async function (args) {
|
|
|
26
26
|
|
|
27
27
|
try {
|
|
28
28
|
self.npu_packageJSON = require('../package.json');
|
|
29
|
-
} catch (
|
|
30
|
-
|
|
29
|
+
} 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}`));
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
try {
|
|
@@ -50,12 +53,11 @@ Main.prototype.process = async function (args) {
|
|
|
50
53
|
});
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
if (self.options.debug) {
|
|
56
|
+
if (self.options.d || self.options.debug || self.options['-d'] || self.options['--debug']) {
|
|
55
57
|
console.log('options:', self.options);
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
if (self.options.v || self.options.version || self.options['-v'] || self.options['
|
|
60
|
+
if (self.options.v || self.options.version || self.options['-v'] || self.options['--version']) {
|
|
59
61
|
self.log(chalk.blue(`Node Power User is v${chalk.bold(self.npu_packageJSON.version)}`));
|
|
60
62
|
return self.npu_packageJSON.version;
|
|
61
63
|
}
|
|
@@ -65,7 +67,7 @@ Main.prototype.process = async function (args) {
|
|
|
65
67
|
return self.proj_packageJSON.versio
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
if (self.options.lp || self.options.listpackages || self.options['-lp'] || self.options['
|
|
70
|
+
if (self.options.lp || self.options.listpackages || self.options['-lp'] || self.options['--listpackages']) {
|
|
69
71
|
self.log(chalk.blue.bold(`Dependencies:`));
|
|
70
72
|
Object.keys(self.proj_packageJSON.dependencies || {})
|
|
71
73
|
.forEach((dep, i) => {
|
|
@@ -114,7 +116,7 @@ Main.prototype.process = async function (args) {
|
|
|
114
116
|
Main.prototype.log = function () {
|
|
115
117
|
const self = this;
|
|
116
118
|
|
|
117
|
-
if (self.options.
|
|
119
|
+
if (self.options.lo !== false) {
|
|
118
120
|
console.log(...arguments);
|
|
119
121
|
}
|
|
120
122
|
};
|