scenv-inquirer 0.1.0

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.cjs ADDED
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ prompt: () => prompt
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+ var import_inquirer = __toESM(require("inquirer"), 1);
37
+ function prompt() {
38
+ return async (name, defaultValue) => {
39
+ const defaultStr = defaultValue !== void 0 && defaultValue !== null ? String(defaultValue) : "";
40
+ const { value } = await import_inquirer.default.prompt([
41
+ {
42
+ type: "input",
43
+ name: "value",
44
+ message: name,
45
+ default: defaultStr
46
+ }
47
+ ]);
48
+ return value;
49
+ };
50
+ }
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ prompt
54
+ });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Returns a prompt function for use with senv(): (name, defaultValue) => Promise<T>.
3
+ * Senv passes the variable name and default (from env/context/default); this uses inquirer to ask for input.
4
+ * Returns string; use a validator (e.g. scenv-zod) for type/coercion.
5
+ */
6
+ declare function prompt<T = string>(): (name: string, defaultValue: T) => Promise<T>;
7
+
8
+ export { prompt };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Returns a prompt function for use with senv(): (name, defaultValue) => Promise<T>.
3
+ * Senv passes the variable name and default (from env/context/default); this uses inquirer to ask for input.
4
+ * Returns string; use a validator (e.g. scenv-zod) for type/coercion.
5
+ */
6
+ declare function prompt<T = string>(): (name: string, defaultValue: T) => Promise<T>;
7
+
8
+ export { prompt };
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ // src/index.ts
2
+ import inquirer from "inquirer";
3
+ function prompt() {
4
+ return async (name, defaultValue) => {
5
+ const defaultStr = defaultValue !== void 0 && defaultValue !== null ? String(defaultValue) : "";
6
+ const { value } = await inquirer.prompt([
7
+ {
8
+ type: "input",
9
+ name: "value",
10
+ message: name,
11
+ default: defaultStr
12
+ }
13
+ ]);
14
+ return value;
15
+ };
16
+ }
17
+ export {
18
+ prompt
19
+ };
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "scenv-inquirer",
3
+ "version": "0.1.0",
4
+ "description": "Inquirer prompt for scenv variables",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/PKWadsy/senv.git"
8
+ },
9
+ "keywords": [
10
+ "scenv",
11
+ "inquirer",
12
+ "prompt"
13
+ ],
14
+ "type": "module",
15
+ "main": "dist/index.cjs",
16
+ "module": "dist/index.js",
17
+ "types": "dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "import": "./dist/index.js",
21
+ "require": "./dist/index.cjs",
22
+ "types": "./dist/index.d.ts"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "peerDependencies": {
29
+ "inquirer": "^8.0.0 || ^9.0.0",
30
+ "scenv": "0.1.0"
31
+ },
32
+ "devDependencies": {
33
+ "@types/inquirer": "^8.2.0",
34
+ "inquirer": "^9.2.0",
35
+ "tsup": "^8.0.0",
36
+ "typescript": "^5.3.0",
37
+ "scenv": "0.1.0"
38
+ },
39
+ "scripts": {
40
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean"
41
+ }
42
+ }