inquirerer 2.1.13 → 2.1.14
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/README.md +13 -0
- package/esm/resolvers/workspace.js +27 -0
- package/esm/utils.js +1 -1
- package/package.json +6 -6
- package/resolvers/workspace.js +27 -0
package/README.md
CHANGED
|
@@ -747,6 +747,19 @@ Inquirerer comes with several built-in resolvers ready to use:
|
|
|
747
747
|
| `date.now` | ISO timestamp | `"2025-11-23T15:30:45.123Z"` |
|
|
748
748
|
| `date.timestamp` | Unix timestamp (ms) | `"1732375845123"` |
|
|
749
749
|
|
|
750
|
+
#### Workspace (nearest package.json)
|
|
751
|
+
|
|
752
|
+
| Resolver | Description | Example Output |
|
|
753
|
+
|----------|-------------|----------------|
|
|
754
|
+
| `workspace.name` | Repo slug from `repository` URL (fallback: `package.json` `name`) | `"dev-utils"` |
|
|
755
|
+
| `workspace.repo.name` | Repo name from `repository` URL | `"dev-utils"` |
|
|
756
|
+
| `workspace.repo.organization` | Repo org/owner from `repository` URL | `"constructive-io"` |
|
|
757
|
+
| `workspace.organization.name` | Alias for `workspace.repo.organization` | `"constructive-io"` |
|
|
758
|
+
| `workspace.license` | License field from `package.json` | `"MIT"` |
|
|
759
|
+
| `workspace.author` | Author name from `package.json` | `"Constructive"` |
|
|
760
|
+
| `workspace.author.name` | Author name from `package.json` | `"Constructive"` |
|
|
761
|
+
| `workspace.author.email` | Author email from `package.json` | `"email@example.org"` |
|
|
762
|
+
|
|
750
763
|
### Priority Order
|
|
751
764
|
|
|
752
765
|
When resolving default values, inquirerer follows this priority:
|
|
@@ -72,6 +72,19 @@ function parseAuthor(author) {
|
|
|
72
72
|
* These resolve values from the nearest package.json in the current working directory.
|
|
73
73
|
*/
|
|
74
74
|
export const workspaceResolvers = {
|
|
75
|
+
'workspace.name': () => {
|
|
76
|
+
const pkg = findPackageJsonFromCwd();
|
|
77
|
+
if (!pkg)
|
|
78
|
+
return undefined;
|
|
79
|
+
const url = getRepositoryUrl(pkg);
|
|
80
|
+
// Prefer repo slug when repository is set; fall back to package name
|
|
81
|
+
if (url) {
|
|
82
|
+
const parsed = parseGitHubUrl(url);
|
|
83
|
+
if (parsed.name)
|
|
84
|
+
return parsed.name;
|
|
85
|
+
}
|
|
86
|
+
return pkg.name;
|
|
87
|
+
},
|
|
75
88
|
'workspace.repo.name': () => {
|
|
76
89
|
const pkg = findPackageJsonFromCwd();
|
|
77
90
|
if (!pkg)
|
|
@@ -90,6 +103,20 @@ export const workspaceResolvers = {
|
|
|
90
103
|
return undefined;
|
|
91
104
|
return parseGitHubUrl(url).organization;
|
|
92
105
|
},
|
|
106
|
+
// Alias for repo.organization for template readability
|
|
107
|
+
'workspace.organization.name': () => {
|
|
108
|
+
const pkg = findPackageJsonFromCwd();
|
|
109
|
+
if (!pkg)
|
|
110
|
+
return undefined;
|
|
111
|
+
const url = getRepositoryUrl(pkg);
|
|
112
|
+
if (!url)
|
|
113
|
+
return undefined;
|
|
114
|
+
return parseGitHubUrl(url).organization;
|
|
115
|
+
},
|
|
116
|
+
'workspace.license': () => {
|
|
117
|
+
const pkg = findPackageJsonFromCwd();
|
|
118
|
+
return pkg?.license;
|
|
119
|
+
},
|
|
93
120
|
'workspace.author': () => {
|
|
94
121
|
const pkg = findPackageJsonFromCwd();
|
|
95
122
|
if (!pkg)
|
package/esm/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { green, blue } from 'yanse';
|
|
2
|
-
import { findAndRequirePackageJson } from
|
|
2
|
+
import { findAndRequirePackageJson } from 'find-and-require-package-json';
|
|
3
3
|
// Function to display the version information
|
|
4
4
|
export function displayVersion() {
|
|
5
5
|
const pkg = findAndRequirePackageJson(__dirname);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inquirerer",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"author": "Constructive <
|
|
3
|
+
"version": "2.1.14",
|
|
4
|
+
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "TypeScript-first library for building beautiful CLI interfaces with interactive prompts",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"module": "esm/index.js",
|
|
@@ -30,16 +30,16 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"deepmerge": "^4.3.1",
|
|
33
|
-
"find-and-require-package-json": "0.8.
|
|
33
|
+
"find-and-require-package-json": "0.8.2",
|
|
34
34
|
"js-yaml": "^4.1.0",
|
|
35
35
|
"minimist": "^1.2.8",
|
|
36
|
-
"yanse": "0.1.
|
|
36
|
+
"yanse": "0.1.8"
|
|
37
37
|
},
|
|
38
38
|
"keywords": [],
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/minimist": "^1.2.5",
|
|
41
|
-
"clean-ansi": "0.1.
|
|
41
|
+
"clean-ansi": "0.1.5",
|
|
42
42
|
"makage": "0.1.8"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "64ad2e12049b05169df7dc7e3bcc401da6f42842"
|
|
45
45
|
}
|
package/resolvers/workspace.js
CHANGED
|
@@ -75,6 +75,19 @@ function parseAuthor(author) {
|
|
|
75
75
|
* These resolve values from the nearest package.json in the current working directory.
|
|
76
76
|
*/
|
|
77
77
|
exports.workspaceResolvers = {
|
|
78
|
+
'workspace.name': () => {
|
|
79
|
+
const pkg = findPackageJsonFromCwd();
|
|
80
|
+
if (!pkg)
|
|
81
|
+
return undefined;
|
|
82
|
+
const url = getRepositoryUrl(pkg);
|
|
83
|
+
// Prefer repo slug when repository is set; fall back to package name
|
|
84
|
+
if (url) {
|
|
85
|
+
const parsed = parseGitHubUrl(url);
|
|
86
|
+
if (parsed.name)
|
|
87
|
+
return parsed.name;
|
|
88
|
+
}
|
|
89
|
+
return pkg.name;
|
|
90
|
+
},
|
|
78
91
|
'workspace.repo.name': () => {
|
|
79
92
|
const pkg = findPackageJsonFromCwd();
|
|
80
93
|
if (!pkg)
|
|
@@ -93,6 +106,20 @@ exports.workspaceResolvers = {
|
|
|
93
106
|
return undefined;
|
|
94
107
|
return parseGitHubUrl(url).organization;
|
|
95
108
|
},
|
|
109
|
+
// Alias for repo.organization for template readability
|
|
110
|
+
'workspace.organization.name': () => {
|
|
111
|
+
const pkg = findPackageJsonFromCwd();
|
|
112
|
+
if (!pkg)
|
|
113
|
+
return undefined;
|
|
114
|
+
const url = getRepositoryUrl(pkg);
|
|
115
|
+
if (!url)
|
|
116
|
+
return undefined;
|
|
117
|
+
return parseGitHubUrl(url).organization;
|
|
118
|
+
},
|
|
119
|
+
'workspace.license': () => {
|
|
120
|
+
const pkg = findPackageJsonFromCwd();
|
|
121
|
+
return pkg?.license;
|
|
122
|
+
},
|
|
96
123
|
'workspace.author': () => {
|
|
97
124
|
const pkg = findPackageJsonFromCwd();
|
|
98
125
|
if (!pkg)
|