inquirerer 2.1.9 → 2.1.11
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/esm/utils.js +3 -3
- package/package.json +3 -2
- package/utils.js +3 -3
- package/esm/package.js +0 -26
- package/package.d.ts +0 -1
- package/package.js +0 -29
package/esm/utils.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { green, blue } from 'yanse';
|
|
2
|
-
import {
|
|
2
|
+
import { findAndRequirePackageJson } from "find-and-require-package-json";
|
|
3
3
|
// Function to display the version information
|
|
4
4
|
export function displayVersion() {
|
|
5
|
-
const pkg =
|
|
5
|
+
const pkg = findAndRequirePackageJson(__dirname);
|
|
6
6
|
console.log(green(`Name: ${pkg.name}`));
|
|
7
7
|
console.log(blue(`Version: ${pkg.version}`));
|
|
8
8
|
}
|
|
9
9
|
export function getVersion() {
|
|
10
|
-
const pkg =
|
|
10
|
+
const pkg = findAndRequirePackageJson(__dirname);
|
|
11
11
|
return pkg.version;
|
|
12
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inquirerer",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.11",
|
|
4
4
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
5
5
|
"description": "TypeScript-first library for building beautiful CLI interfaces with interactive prompts",
|
|
6
6
|
"main": "index.js",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"deepmerge": "^4.3.1",
|
|
33
|
+
"find-and-require-package-json": "0.8.0",
|
|
33
34
|
"js-yaml": "^4.1.0",
|
|
34
35
|
"minimist": "^1.2.8",
|
|
35
36
|
"yanse": "0.1.6"
|
|
@@ -40,5 +41,5 @@
|
|
|
40
41
|
"clean-ansi": "0.1.3",
|
|
41
42
|
"makage": "0.1.8"
|
|
42
43
|
},
|
|
43
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "a704f3ec0e53747e4fba85c2018138439120f309"
|
|
44
45
|
}
|
package/utils.js
CHANGED
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.displayVersion = displayVersion;
|
|
4
4
|
exports.getVersion = getVersion;
|
|
5
5
|
const yanse_1 = require("yanse");
|
|
6
|
-
const
|
|
6
|
+
const find_and_require_package_json_1 = require("find-and-require-package-json");
|
|
7
7
|
// Function to display the version information
|
|
8
8
|
function displayVersion() {
|
|
9
|
-
const pkg = (0,
|
|
9
|
+
const pkg = (0, find_and_require_package_json_1.findAndRequirePackageJson)(__dirname);
|
|
10
10
|
console.log((0, yanse_1.green)(`Name: ${pkg.name}`));
|
|
11
11
|
console.log((0, yanse_1.blue)(`Version: ${pkg.version}`));
|
|
12
12
|
}
|
|
13
13
|
function getVersion() {
|
|
14
|
-
const pkg = (0,
|
|
14
|
+
const pkg = (0, find_and_require_package_json_1.findAndRequirePackageJson)(__dirname);
|
|
15
15
|
return pkg.version;
|
|
16
16
|
}
|
package/esm/package.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "fs";
|
|
2
|
-
import { dirname, join } from "path";
|
|
3
|
-
// need to search due to the dist/ folder and src/, etc.
|
|
4
|
-
function findPackageJson(currentDir) {
|
|
5
|
-
const filePath = join(currentDir, 'package.json');
|
|
6
|
-
// Check if package.json exists in the current directory
|
|
7
|
-
if (existsSync(filePath)) {
|
|
8
|
-
return filePath;
|
|
9
|
-
}
|
|
10
|
-
// Get the parent directory
|
|
11
|
-
const parentDir = dirname(currentDir);
|
|
12
|
-
// If reached the root directory, package.json is not found
|
|
13
|
-
if (parentDir === currentDir) {
|
|
14
|
-
throw new Error('package.json not found in any parent directory');
|
|
15
|
-
}
|
|
16
|
-
// Recursively look in the parent directory
|
|
17
|
-
return findPackageJson(parentDir);
|
|
18
|
-
}
|
|
19
|
-
export function readAndParsePackageJson() {
|
|
20
|
-
// Start searching from the current directory
|
|
21
|
-
const pkgPath = findPackageJson(__dirname);
|
|
22
|
-
// Read and parse the package.json
|
|
23
|
-
const str = readFileSync(pkgPath, 'utf8');
|
|
24
|
-
const pkg = JSON.parse(str);
|
|
25
|
-
return pkg;
|
|
26
|
-
}
|
package/package.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function readAndParsePackageJson(): any;
|
package/package.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readAndParsePackageJson = readAndParsePackageJson;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
// need to search due to the dist/ folder and src/, etc.
|
|
7
|
-
function findPackageJson(currentDir) {
|
|
8
|
-
const filePath = (0, path_1.join)(currentDir, 'package.json');
|
|
9
|
-
// Check if package.json exists in the current directory
|
|
10
|
-
if ((0, fs_1.existsSync)(filePath)) {
|
|
11
|
-
return filePath;
|
|
12
|
-
}
|
|
13
|
-
// Get the parent directory
|
|
14
|
-
const parentDir = (0, path_1.dirname)(currentDir);
|
|
15
|
-
// If reached the root directory, package.json is not found
|
|
16
|
-
if (parentDir === currentDir) {
|
|
17
|
-
throw new Error('package.json not found in any parent directory');
|
|
18
|
-
}
|
|
19
|
-
// Recursively look in the parent directory
|
|
20
|
-
return findPackageJson(parentDir);
|
|
21
|
-
}
|
|
22
|
-
function readAndParsePackageJson() {
|
|
23
|
-
// Start searching from the current directory
|
|
24
|
-
const pkgPath = findPackageJson(__dirname);
|
|
25
|
-
// Read and parse the package.json
|
|
26
|
-
const str = (0, fs_1.readFileSync)(pkgPath, 'utf8');
|
|
27
|
-
const pkg = JSON.parse(str);
|
|
28
|
-
return pkg;
|
|
29
|
-
}
|