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 +11 -9
- package/package.json +1 -1
- package/src/index.js +11 -9
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
42
|
-
|
|
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.
|
|
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
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
42
|
-
|
|
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.
|
|
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']) {
|