kempo 2.10.4 → 2.10.7

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/utils/cli.js CHANGED
@@ -1 +1 @@
1
- import{spawn}from"child_process";const args={};let win={};"undefined"!=typeof window?win=window:"undefined"!=typeof global&&(win=global),win.log=(...e)=>{args.debug&&console.log(...e)};export const getArgs=(e={d:"debug"})=>{let s="",o=[];const r=()=>{s&&(0===o.length?args[s]=!0:1===o.length?"false"===o[0]?args[s]=!1:args[s]=o[0]:args[s]=o)};for(let t=2;t<process.argv.length;t++){const n=process.argv[t];n.startsWith("-")?(r(),n.startsWith("--")?s=n.slice(2):(s=n.slice(1),e[s]&&(s=e[s])),o=[]):o.push(n)}return r(),args};export const runChildProcess=e=>new Promise(((s,o)=>{const[r,...t]=e.split(" ");spawn(r,t).on("close",(e=>{0===e?s(`child process exited with code ${e}`):o(new Error(`child process exited with code ${e}`))}))}));export const runChildNodeProcess=(e,s={})=>{const o=`node ${e} ${Object.entries(s).flatMap((([e,s])=>!0===s?[`--${e}`]:[`--${e}`,s])).join(" ")}`;return runChildProcess(o)};export default{getArgs:getArgs,runChildNodeProcess:runChildNodeProcess,runChildNodeProcess:runChildNodeProcess};
1
+ import{spawn}from"child_process";import readline from"readline";const args={};let win={};"undefined"!=typeof window?win=window:"undefined"!=typeof global&&(win=global),win.log=(...e)=>{args.debug&&console.log(...e)};export const getArgs=(e={d:"debug"})=>{let r="",s=[];const o=()=>{r&&(0===s.length?args[r]=!0:1===s.length?"false"===s[0]?args[r]=!1:args[r]=s[0]:args[r]=s)};for(let t=2;t<process.argv.length;t++){const n=process.argv[t];n.startsWith("-")?(o(),n.startsWith("--")?r=n.slice(2):(r=n.slice(1),e[r]&&(r=e[r])),s=[]):s.push(n)}return o(),args};export const runChildProcess=e=>new Promise(((r,s)=>{const[o,...t]=e.split(" ");spawn(o,t).on("close",(e=>{0===e?r(`child process exited with code ${e}`):s(new Error(`child process exited with code ${e}`))}))}));export const runChildNodeProcess=(e,r={})=>{const s=`node ${e} ${Object.entries(r).flatMap((([e,r])=>!0===r?[`--${e}`]:[`--${e}`,r])).join(" ")}`;return runChildProcess(s)};export const promptUser=e=>{const r=readline.createInterface({input:process.stdin,output:process.stdout});return new Promise((s=>{r.question(e,(e=>{r.close(),s(e)}))}))};export const promptYN=(e,r="y")=>promptUser(`${e} [${r}] `).then((e=>{const s=e.trim().toLowerCase();return""===s?"y"===r:"y"===s}));export default{getArgs:getArgs,runChildNodeProcess:runChildNodeProcess,runChildNodeProcess:runChildNodeProcess,promptUser:promptUser,promptYN:promptYN};
@@ -1 +1 @@
1
- import{spawn}from"child_process";const args={};let win={};"undefined"!=typeof window?win=window:"undefined"!=typeof global&&(win=global),win.log=(...e)=>{args.debug&&console.log(...e)};export const getArgs=(e={d:"debug"})=>{let s="",o=[];const r=()=>{s&&(0===o.length?args[s]=!0:1===o.length?"false"===o[0]?args[s]=!1:args[s]=o[0]:args[s]=o)};for(let t=2;t<process.argv.length;t++){const n=process.argv[t];n.startsWith("-")?(r(),n.startsWith("--")?s=n.slice(2):(s=n.slice(1),e[s]&&(s=e[s])),o=[]):o.push(n)}return r(),args};export const runChildProcess=e=>new Promise(((s,o)=>{const[r,...t]=e.split(" ");spawn(r,t).on("close",(e=>{0===e?s(`child process exited with code ${e}`):o(new Error(`child process exited with code ${e}`))}))}));export const runChildNodeProcess=(e,s={})=>{const o=`node ${e} ${Object.entries(s).flatMap((([e,s])=>!0===s?[`--${e}`]:[`--${e}`,s])).join(" ")}`;return runChildProcess(o)};export default{getArgs:getArgs,runChildNodeProcess:runChildNodeProcess,runChildNodeProcess:runChildNodeProcess};
1
+ import{spawn}from"child_process";import readline from"readline";const args={};let win={};"undefined"!=typeof window?win=window:"undefined"!=typeof global&&(win=global),win.log=(...e)=>{args.debug&&console.log(...e)};export const getArgs=(e={d:"debug"})=>{let r="",s=[];const o=()=>{r&&(0===s.length?args[r]=!0:1===s.length?"false"===s[0]?args[r]=!1:args[r]=s[0]:args[r]=s)};for(let t=2;t<process.argv.length;t++){const n=process.argv[t];n.startsWith("-")?(o(),n.startsWith("--")?r=n.slice(2):(r=n.slice(1),e[r]&&(r=e[r])),s=[]):s.push(n)}return o(),args};export const runChildProcess=e=>new Promise(((r,s)=>{const[o,...t]=e.split(" ");spawn(o,t).on("close",(e=>{0===e?r(`child process exited with code ${e}`):s(new Error(`child process exited with code ${e}`))}))}));export const runChildNodeProcess=(e,r={})=>{const s=`node ${e} ${Object.entries(r).flatMap((([e,r])=>!0===r?[`--${e}`]:[`--${e}`,r])).join(" ")}`;return runChildProcess(s)};export const promptUser=e=>{const r=readline.createInterface({input:process.stdin,output:process.stdout});return new Promise((s=>{r.question(e,(e=>{r.close(),s(e)}))}))};export const promptYN=(e,r="y")=>promptUser(`${e} [${r}] `).then((e=>{const s=e.trim().toLowerCase();return""===s?"y"===r:"y"===s}));export default{getArgs:getArgs,runChildNodeProcess:runChildNodeProcess,runChildNodeProcess:runChildNodeProcess,promptUser:promptUser,promptYN:promptYN};
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "kempo",
3
- "version": "2.10.4",
3
+ "version": "2.10.7",
4
4
  "type": "module",
5
5
  "description": "A web component library",
6
6
  "main": "dist/index.js",
7
+ "exports": {
8
+ ".": "./dist/index.js",
9
+ "./utils/*": "./dist/utils/*",
10
+ "./components/*": "./dist/components/*"
11
+ },
7
12
  "scripts": {
8
13
  "test": "node ./scrips/test.js",
9
14
  "build": "node ./scripts/build.js",
package/src/utils/cli.js CHANGED
@@ -99,9 +99,21 @@ export const promptUser = (query) => {
99
99
  });
100
100
  };
101
101
 
102
+ export const promptYN = (query, defaultValue = 'y') => {
103
+ const formattedQuery = `${query} [${defaultValue}] `;
104
+ return promptUser(formattedQuery).then((answer) => {
105
+ const normalizedAnswer = answer.trim().toLowerCase();
106
+ if (normalizedAnswer === '') {
107
+ return defaultValue === 'y';
108
+ }
109
+ return normalizedAnswer === 'y';
110
+ });
111
+ };
112
+
102
113
  export default {
103
114
  getArgs,
104
115
  runChildNodeProcess,
105
116
  runChildNodeProcess,
106
- promptUser
117
+ promptUser,
118
+ promptYN
107
119
  };