makitso
Advanced tools
Comparing version 2.0.0-beta.1 to 2.0.0
@@ -88,3 +88,3 @@ "use strict"; | ||
if (!appCmd.action) return [3 /*break*/, 5]; | ||
return [4 /*yield*/, appCmd.action({ context: context, command: appCmd, input: input })]; | ||
return [4 /*yield*/, appCmd.action({ commands: commands, context: context, command: appCmd, input: input })]; | ||
case 4: | ||
@@ -121,3 +121,14 @@ _b.sent(); | ||
Object.assign(prompt, { | ||
keyPressers: __spreadArrays(prompt.keyPressers, [ | ||
keyPressers: __spreadArrays([ | ||
{ | ||
keyPress: function (state) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
debug_1.debug("keyPresser1", state); | ||
return [2 /*return*/, state]; | ||
}); | ||
}); | ||
} | ||
} | ||
], prompt.keyPressers, [ | ||
makitso_prompt_1.keyPressHistory, | ||
@@ -146,2 +157,9 @@ keyPressParser, | ||
initCommandPrompt({ context: context, commands: commands, prompt: prompt }); | ||
process.on("SIGINT", function () { | ||
console.log("Interrupted"); | ||
console.log(prompt.state); | ||
if (!prompt.state.pojo.returnCommand) { | ||
process.exit(); | ||
} | ||
}); | ||
return [2 /*return*/, promptAndRun({ context: context, commands: commands, prompt: prompt })]; | ||
@@ -148,0 +166,0 @@ }); |
@@ -39,2 +39,3 @@ import * as yargsParseArgs from "yargs-parser"; | ||
export declare type CommandActionArgs = { | ||
commands: Commands; | ||
command: Command; | ||
@@ -44,2 +45,7 @@ context: ContextSchema; | ||
}; | ||
export declare type CommandSuggestArgs = { | ||
command: Command; | ||
context: ContextSchema; | ||
input: CommandActionInput; | ||
}; | ||
export declare type CommandAction = (args: CommandActionArgs) => Promise<void>; | ||
@@ -51,3 +57,3 @@ export declare type Command = { | ||
options?: string[]; | ||
suggest?: (args: CommandActionArgs) => Promise<string[]>; | ||
suggest?: (args: CommandSuggestArgs) => Promise<string[]>; | ||
help?: (args: { | ||
@@ -54,0 +60,0 @@ context: ContextSchema; |
@@ -43,3 +43,3 @@ "use strict"; | ||
if (appCmd.action) { | ||
await appCmd.action({ context, command: appCmd, input }); | ||
await appCmd.action({ commands, context, command: appCmd, input }); | ||
} | ||
@@ -76,2 +76,8 @@ } | ||
keyPressers: [ | ||
{ | ||
async keyPress(state: any) { | ||
debug("keyPresser1", state); | ||
return state; | ||
} | ||
}, | ||
...prompt.keyPressers, | ||
@@ -101,3 +107,12 @@ keyPressHistory, | ||
initCommandPrompt({ context, commands, prompt }); | ||
process.on("SIGINT", function() { | ||
console.log("Interrupted"); | ||
console.log(prompt.state); | ||
if (!prompt.state.pojo.returnCommand) { | ||
process.exit(); | ||
} | ||
}); | ||
return promptAndRun({ context, commands, prompt }); | ||
} |
@@ -47,2 +47,3 @@ import * as yargsParseArgs from "yargs-parser"; | ||
export type CommandActionArgs = { | ||
commands: Commands; | ||
command: Command; | ||
@@ -53,2 +54,8 @@ context: ContextSchema; | ||
export type CommandSuggestArgs = { | ||
command: Command; | ||
context: ContextSchema; | ||
input: CommandActionInput; | ||
}; | ||
export type CommandAction = (args: CommandActionArgs) => Promise<void>; | ||
@@ -61,3 +68,3 @@ | ||
options?: string[]; | ||
suggest?: (args: CommandActionArgs) => Promise<string[]>; | ||
suggest?: (args: CommandSuggestArgs) => Promise<string[]>; | ||
help?: (args: { | ||
@@ -64,0 +71,0 @@ context: ContextSchema; |
{ | ||
"name": "makitso", | ||
"version": "2.0.0-beta.1", | ||
"version": "2.0.0", | ||
"description": "A Framework for building composable interactive commandline apps", | ||
@@ -19,30 +19,30 @@ "main": "dist/index.js", | ||
"@lecstor/app-error": "^0.0.2", | ||
"chalk": "^2.3.0", | ||
"ellipsize": "^0.0.3", | ||
"chalk": "^4.0.0", | ||
"ellipsize": "^0.1.0", | ||
"js-yaml": "^3.10.0", | ||
"keytar": "^4.0.5", | ||
"makitso-prompt": "3.0.0-beta.1", | ||
"keytar": "^5.6.0", | ||
"makitso-prompt": "^3.0.0", | ||
"prettyjson": "^1.2.1", | ||
"yargs-parser": "^9.0.2" | ||
"yargs-parser": "^18.1.3" | ||
}, | ||
"devDependencies": { | ||
"@types/eslint-plugin-prettier": "2.2.0", | ||
"@types/jest": "^25.1.4", | ||
"@types/lodash": "^4.14.149", | ||
"@types/node": "^13.7.7", | ||
"@types/prettier": "1.19.0", | ||
"@types/eslint-plugin-prettier": "3.1.0", | ||
"@types/jest": "^25.2.2", | ||
"@types/lodash": "^4.14.151", | ||
"@types/node": "^14.0.1", | ||
"@types/prettier": "2.0.0", | ||
"@types/yargs-parser": "^15.0.0", | ||
"@typescript-eslint/eslint-plugin": "^2.7.0", | ||
"@typescript-eslint/parser": "^2.2.0", | ||
"eslint": "^6.6.0", | ||
"eslint-config-prettier": "^6.3.0", | ||
"eslint-plugin-prettier": "^3.1.0", | ||
"jest": "^25.1.0", | ||
"mock-stdin": "^0.3.1", | ||
"@typescript-eslint/eslint-plugin": "^2.33.0", | ||
"@typescript-eslint/parser": "^2.33.0", | ||
"eslint": "^7.0.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"jest": "^26.0.1", | ||
"mock-stdin": "^1.0.0", | ||
"node-ansiparser": "^2.2.0", | ||
"node-ansiterminal": "^0.2.1-beta", | ||
"prettier": "^1.18.2", | ||
"prettier-eslint": "^8.3.1", | ||
"ts-jest": "^25.2.1", | ||
"typescript": "^3.8.3" | ||
"prettier": "^2.0.5", | ||
"prettier-eslint": "^9.0.1", | ||
"ts-jest": "^25.5.1", | ||
"typescript": "^3.9.2" | ||
}, | ||
@@ -49,0 +49,0 @@ "engines": { |
@@ -14,4 +14,5 @@ { | ||
"dist", | ||
"__tests__" | ||
"**/__tests__", | ||
"**/*.test.*" | ||
] | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
786853
119
1
3
0
6174
+ Addedansi-escapes@4.3.2(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbl@4.1.0(transitive)
+ Addedbuffer@5.7.1(transitive)
+ Addedcamelcase@5.3.1(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addeddecompress-response@4.2.1(transitive)
+ Addedellipsize@0.1.0(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedkeytar@5.6.0(transitive)
+ Addedmakitso-prompt@3.0.2(transitive)
+ Addedmimic-response@2.1.0(transitive)
+ Addedmkdirp-classic@0.5.3(transitive)
+ Addednan@2.14.1(transitive)
+ Addedprebuild-install@5.3.3(transitive)
+ Addedpump@3.0.0(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsimple-get@3.1.1(transitive)
+ Addedsupports-color@7.2.0(transitive)
+ Addedtar-fs@2.1.1(transitive)
+ Addedtar-stream@2.2.0(transitive)
+ Addedtype-fest@0.21.3(transitive)
+ Addedyargs-parser@18.1.3(transitive)
- Removedansi-escapes@3.2.0(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedbl@1.2.3(transitive)
- Removedbuffer-alloc@1.2.0(transitive)
- Removedbuffer-alloc-unsafe@1.1.0(transitive)
- Removedbuffer-fill@1.0.0(transitive)
- Removedcamelcase@4.1.0(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removeddecompress-response@3.3.0(transitive)
- Removedellipsize@0.0.3(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedkeytar@4.13.0(transitive)
- Removedmakitso-prompt@3.0.0-beta.1(transitive)
- Removedmimic-response@1.0.1(transitive)
- Removednan@2.14.0(transitive)
- Removedos-homedir@1.0.2(transitive)
- Removedprebuild-install@5.3.0(transitive)
- Removedpump@1.0.32.0.1(transitive)
- Removedsimple-get@2.8.2(transitive)
- Removedsupports-color@5.5.0(transitive)
- Removedtar-fs@1.16.3(transitive)
- Removedtar-stream@1.6.2(transitive)
- Removedto-buffer@1.1.1(transitive)
- Removedxtend@4.0.2(transitive)
- Removedyargs-parser@9.0.2(transitive)
Updatedchalk@^4.0.0
Updatedellipsize@^0.1.0
Updatedkeytar@^5.6.0
Updatedmakitso-prompt@^3.0.0
Updatedyargs-parser@^18.1.3