Socket
Socket
Sign inDemoInstall

makitso

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

makitso - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

4

examples/commands/01-hello_world.js

@@ -13,6 +13,6 @@ #! /usr/bin/env node

console.log("Hello World");
}
}
},
},
};
Makitso({ plugins: { commands } }).catch(console.error);

@@ -15,3 +15,3 @@ #! /usr/bin/env node

// the last argument can be [optional], or take multiple... values, or both
"[likes...] - things they like"
"[likes...] - things they like",
],

@@ -25,6 +25,6 @@ action: async ({ context, input }) => {

}
}
}
},
},
};
Makitso({ plugins: [{ commands }] }).catch(console.error);

@@ -15,3 +15,3 @@ #! /usr/bin/env node

"-h --hello {boolean} - say Hello",
"-g --greeting - custom Greeting"
"-g --greeting - custom Greeting",
],

@@ -28,6 +28,6 @@

console.log(`${message} ${name}`);
}
}
},
},
};
Makitso({ plugins: [{ commands }] }).catch(console.error);

@@ -12,3 +12,3 @@ #! /usr/bin/env node

"name - the person to say hi to",
"[likes...] - things they like"
"[likes...] - things they like",
],

@@ -28,6 +28,6 @@ action: async ({ context, input }) => {

return [];
}
}
},
},
};
Makitso({ plugins: [{ commands }] }).catch(console.error);

@@ -13,9 +13,9 @@ #! /usr/bin/env node

console.log("wait for me");
return new Promise(resolve => {
return new Promise((resolve) => {
setTimeout(() => resolve(), 30000);
});
}
}
},
},
};
Makitso({ plugins: { commands } }).catch(console.error);

@@ -19,4 +19,4 @@ #! /usr/bin/env node

// Always prompts, using stored value as default when available
storedValueIs: "default"
}
storedValueIs: "default",
},
},

@@ -28,6 +28,6 @@ response: {

// Doesn't prompt if it has a stored value
storedValueIs: "response"
}
}
}
storedValueIs: "response",
},
},
},
};

@@ -41,3 +41,3 @@

console.log(`Hello ${name}`);
}
},
},

@@ -49,4 +49,4 @@ hiResponse: {

console.log(`Hello ${name}`);
}
}
},
},
};

@@ -53,0 +53,0 @@

@@ -21,6 +21,6 @@ #! /usr/bin/env node

// Always prompts, using stored value as default when available
storedValueIs: "default"
}
}
}
storedValueIs: "default",
},
},
},
};

@@ -34,4 +34,4 @@

console.log(`Hello ${name}`);
}
}
},
},
};

@@ -38,0 +38,0 @@

@@ -26,3 +26,3 @@ #! /usr/bin/env node

service: "my-remote-service",
account: "password"
account: "password",
},

@@ -32,6 +32,6 @@ ask: {

secret: true,
storedValueIs: "response"
}
}
}
storedValueIs: "response",
},
},
},
};

@@ -45,4 +45,4 @@

console.log(`shhh.. ${password}`);
}
}
},
},
};

@@ -49,0 +49,0 @@

@@ -21,4 +21,4 @@ #! /usr/bin/env node

storedValueIs: "default",
suggest: ["John", "Sam", "Alexandria", "me"]
}
suggest: ["John", "Sam", "Alexandria", "me"],
},
},

@@ -30,6 +30,6 @@ dynamic: {

storedValueIs: "default",
suggest
}
}
}
suggest,
},
},
},
};

@@ -43,3 +43,3 @@

console.log(`Hello ${name}`);
}
},
},

@@ -51,4 +51,4 @@ dynamicSuggest: {

console.log(`Hello ${name}`);
}
}
},
},
};

@@ -55,0 +55,0 @@

@@ -11,3 +11,3 @@ import { parse } from "./args";

missing: [],
current: "std"
current: "std",
// opts: {}

@@ -23,3 +23,3 @@ });

missing: [],
current: "std"
current: "std",
// opts: {}

@@ -35,3 +35,3 @@ });

unknownArgs: ["hello", "world"],
missing: []
missing: [],
// opts: {}

@@ -45,3 +45,3 @@ });

optsLookup: {},
aliasLookup: {}
aliasLookup: {},
};

@@ -52,3 +52,3 @@ expect(parse({ appCmd, cmdArgs: "hello --two world -t world" })).toEqual({

missing: [],
current: "one"
current: "one",
});

@@ -59,3 +59,3 @@ expect(parse({ appCmd, cmdArgs: "hello --two wor --two ld" })).toEqual({

missing: [],
current: "one"
current: "one",
});

@@ -66,3 +66,3 @@ expect(parse({ appCmd, cmdArgs: "hello --t wor --t ld" })).toEqual({

missing: [],
current: "one"
current: "one",
});

@@ -73,3 +73,3 @@ });

const appCmd = {
args: [{ name: "std" }, { name: "std2" }, { name: "std3" }]
args: [{ name: "std" }, { name: "std2" }, { name: "std3" }],
};

@@ -80,3 +80,3 @@ const cmdArgs = "hello";

missing: [{ name: "std2" }, { name: "std3" }],
current: "std"
current: "std",
});

@@ -91,3 +91,3 @@ });

missing: [],
current: "multi"
current: "multi",
});

@@ -102,3 +102,3 @@ });

missing: [],
current: "optional"
current: "optional",
});

@@ -111,4 +111,4 @@ });

{ name: "std" },
{ name: "optMulti", isMulti: true, isOptional: true }
]
{ name: "optMulti", isMulti: true, isOptional: true },
],
};

@@ -118,3 +118,3 @@ expect(parse({ appCmd, cmdArgs: "hello" })).toEqual({

missing: [],
current: "std"
current: "std",
});

@@ -127,4 +127,4 @@ });

{ name: "std" },
{ name: "optMulti", isMulti: true, isOptional: true }
]
{ name: "optMulti", isMulti: true, isOptional: true },
],
};

@@ -134,3 +134,3 @@ expect(parse({ appCmd, cmdArgs: "hello world" })).toEqual({

missing: [],
current: "optMulti"
current: "optMulti",
});

@@ -143,4 +143,4 @@ });

{ name: "std" },
{ name: "optMulti", isMulti: true, isOptional: true }
]
{ name: "optMulti", isMulti: true, isOptional: true },
],
};

@@ -150,3 +150,3 @@ expect(parse({ appCmd, cmdArgs: "hello there, world" })).toEqual({

missing: [],
current: "optMulti"
current: "optMulti",
});

@@ -162,5 +162,5 @@ });

throw new Error("boom");
}
}
}
},
},
},
// argsParserOpts: { coerce: { word: (val: string) => val.toLowercase() } }

@@ -175,7 +175,7 @@ };

const appCmd = {
args: []
args: [],
};
expect(parse({ appCmd, cmdArgs: "", cmdLine: "do " })).toEqual({
args: {},
missing: []
missing: [],
});

@@ -186,3 +186,3 @@ });

const appCmd = {
args: [{ name: "first" }, { name: "second" }]
args: [{ name: "first" }, { name: "second" }],
};

@@ -192,3 +192,3 @@ expect(parse({ appCmd, cmdArgs: "", cmdLine: "do " })).toEqual({

current: "first",
missing: [{ name: "first" }, { name: "second" }]
missing: [{ name: "first" }, { name: "second" }],
});

@@ -199,3 +199,3 @@ });

const appCmd = {
args: [{ name: "first" }, { name: "second" }]
args: [{ name: "first" }, { name: "second" }],
};

@@ -205,3 +205,3 @@ expect(parse({ appCmd, cmdArgs: "abc", cmdLine: "do abc" })).toEqual({

current: "first",
missing: [{ name: "second" }]
missing: [{ name: "second" }],
});

@@ -212,3 +212,3 @@ });

const appCmd = {
args: [{ name: "first" }, { name: "second" }]
args: [{ name: "first" }, { name: "second" }],
};

@@ -218,3 +218,3 @@ expect(parse({ appCmd, cmdArgs: "abc", cmdLine: "do abc " })).toEqual({

current: "second",
missing: [{ name: "second" }]
missing: [{ name: "second" }],
});

@@ -225,3 +225,3 @@ });

const appCmd = {
args: [{ name: "first" }, { name: "second" }]
args: [{ name: "first" }, { name: "second" }],
};

@@ -233,3 +233,3 @@ expect(

current: "second",
missing: []
missing: [],
});

@@ -236,0 +236,0 @@ });

@@ -6,4 +6,4 @@ import { findCommand } from "./find";

top: {
commands: { sub: { args: "foo qux", action: async () => undefined } }
}
commands: { sub: { args: "foo qux", action: async () => undefined } },
},
};

@@ -24,3 +24,3 @@

cmdLine: "top",
commands
commands,
});

@@ -38,3 +38,3 @@ expect(cmd).toBeDefined;

cmdLine: "top sub do",
commands
commands,
});

@@ -52,3 +52,3 @@ expect(cmd).toBeDefined;

cmdLine: "top sub",
commands
commands,
});

@@ -55,0 +55,0 @@ expect(cmd).toBeDefined;

@@ -37,3 +37,3 @@ import _forEach from "lodash/forEach";

_forEach([...words], word => {
_forEach([...words], (word) => {
if (!appCmd.commands) {

@@ -58,4 +58,4 @@ return false; // there are no sub-commands

cmdArgs: words.join(" "),
cmdArgsList: words
cmdArgsList: words,
};
}

@@ -7,3 +7,3 @@ import _every from "lodash/every";

function allMatch(suggests: string[], match: string) {
return _every(suggests, choice => choice.startsWith(match));
return _every(suggests, (choice) => choice.startsWith(match));
}

@@ -32,3 +32,3 @@

export function Autocomplete({
commandInfo
commandInfo,
}: {

@@ -35,0 +35,0 @@ commandInfo: (state: State) => Promise<void>;

@@ -18,3 +18,3 @@ import _map from "lodash/map";

if (missing.length) {
const args = _map(missing, arg => arg.name);
const args = _map(missing, (arg) => arg.name);
const { name, description } = missing[0];

@@ -21,0 +21,0 @@ state.returnCommand = false;

@@ -25,6 +25,6 @@ import { Prompt } from "makitso-prompt";

ask: {
prompt: `Enter your username.. `
}
}
}
prompt: `Enter your username.. `,
},
},
},
};

@@ -35,3 +35,3 @@ const context = Context({

prompt,
commands: {}
commands: {},
});

@@ -47,3 +47,3 @@

prompt: "Enter your username.. ",
maskInput: false
maskInput: false,
});

@@ -64,6 +64,6 @@

prompt: `Enter your username.. `,
default: "lecstor"
}
}
}
default: "lecstor",
},
},
},
};

@@ -74,3 +74,3 @@ const context = Context({

prompt,
commands: {}
commands: {},
});

@@ -87,3 +87,3 @@

prompt: "Enter your username.. ",
maskInput: false
maskInput: false,
});

@@ -99,3 +99,3 @@

const session = new MemoryStore({
data: { github: { username: { default: "lastUsed" } } }
data: { github: { username: { default: "lastUsed" } } },
});

@@ -109,6 +109,6 @@ const schema = {

default: "lecstor",
storedValueIs: "default"
}
}
}
storedValueIs: "default",
},
},
},
};

@@ -119,3 +119,3 @@ const context = Context({

prompt,
commands: {}
commands: {},
});

@@ -132,3 +132,3 @@

prompt: "Enter your username.. ",
maskInput: false
maskInput: false,
});

@@ -143,3 +143,3 @@

const session = new MemoryStore({
data: { github: { username: { default: "lecstor" } } }
data: { github: { username: { default: "lecstor" } } },
});

@@ -153,6 +153,6 @@ const schema = {

default: "lecstor",
storedValueIs: "response"
}
}
}
storedValueIs: "response",
},
},
},
};

@@ -163,3 +163,3 @@ const context = Context({

prompt,
commands: {}
commands: {},
});

@@ -166,0 +166,0 @@ return expect(context.get("github.username")).resolves.toEqual("lecstor");

@@ -19,3 +19,3 @@ import { Context } from "./index";

expect(result).toEqual({
github: { username: { default: "lecstor" } }
github: { username: { default: "lecstor" } },
});

@@ -34,3 +34,3 @@ });

result = await session.get({
propertyPath: "github.username.work"
propertyPath: "github.username.work",
});

@@ -41,5 +41,5 @@ expect(result).toEqual("lecstor");

expect(result).toEqual({
github: { username: { work: "lecstor" } }
github: { username: { work: "lecstor" } },
});
});
});

@@ -22,3 +22,3 @@ "use strict";

message: `There is no schema defined for the property "${schemaPath}"`,
meta: { propSchemaPath: schemaPath }
meta: { propSchemaPath: schemaPath },
});

@@ -36,3 +36,3 @@ }

A property reference is a dotted string with exactly two or three parts.`,
meta: { propRef }
meta: { propRef },
});

@@ -49,3 +49,3 @@ }

message: `The requested context store "${storeRef}" does not exist.`,
meta: { storeRef }
meta: { storeRef },
});

@@ -127,3 +127,3 @@ }

*/
get: async function(prop: string) {
get: async function (prop: string) {
const meta = getPropMeta(this.schema, prop);

@@ -142,3 +142,3 @@

storedValueIs,
suggest
suggest,
} = meta.ask;

@@ -159,3 +159,3 @@

Object.assign(prompt, {
keyPressers: [...prompt.keyPressers, complete]
keyPressers: [...prompt.keyPressers, complete],
});

@@ -169,3 +169,3 @@ }

default: value && storedValueIs === "default" ? value : mDefault,
maskInput
maskInput,
};

@@ -184,3 +184,3 @@ const answer = await prompt.start(thisPrompt);

*/
set: async function(prop: string, value: unknown) {
set: async function (prop: string, value: unknown) {
const meta = getPropMeta(this.schema, prop);

@@ -200,3 +200,3 @@ if (!this.stores[meta.store]) {

*/
delete: async function(prop: string) {
delete: async function (prop: string) {
const meta = getPropMeta(this.schema, prop);

@@ -212,3 +212,3 @@ return this.stores[meta.store].delete(meta);

*/
getStore: async function(store: string) {
getStore: async function (store: string) {
return this.stores[store];

@@ -222,3 +222,3 @@ },

*/
listStores: async function() {
listStores: async function () {
return Object.keys(this.stores);

@@ -231,6 +231,6 @@ },

*/
getSchema: function() {
getSchema: function () {
return JSON.parse(JSON.stringify(this.schema));
}
},
};
}

@@ -6,5 +6,5 @@ import _filter from "lodash/filter";

return {
keyPress: async function(state: State, press: KeyPress) {
keyPress: async function (state: State, press: KeyPress) {
if (state.mode === "command") {
const matches = _filter(choices, choice =>
const matches = _filter(choices, (choice) =>
choice.startsWith(state.command)

@@ -21,4 +21,4 @@ );

return state;
}
},
};
}

@@ -7,7 +7,7 @@ import { Prompt } from "makitso-prompt";

app: {
description: "Makitso - tests"
description: "Makitso - tests",
},
prompt: {
message: "Test>"
}
message: "Test>",
},
};

@@ -21,3 +21,3 @@

options: ["-o --one another one", "-f --four fourth one"],
action: basicMockAction
action: basicMockAction,
},

@@ -27,11 +27,11 @@ multi: {

options: ["--noalias no short alias", "-n no long alias"],
action: basicMockAction
action: basicMockAction,
},
optional: {
arguments: ["one - first one", "[optional] - optional"],
action: basicMockAction
action: basicMockAction,
},
multiOptional: {
arguments: ["one - first one", "[multiOpt...] - multi-optional"],
action: basicMockAction
action: basicMockAction,
},

@@ -41,4 +41,4 @@ quit: {

throw new Error("quit");
}
}
},
},
};

@@ -61,3 +61,3 @@

plugins: { commands: testCommands },
commandPrompt: prompt
commandPrompt: prompt,
});

@@ -75,3 +75,3 @@ }

unknownArgs: ["quattro"],
missing: []
missing: [],
});

@@ -88,3 +88,3 @@ });

missing: [],
current: "multi"
current: "multi",
});

@@ -101,3 +101,3 @@ });

missing: [],
current: "optional"
current: "optional",
});

@@ -114,3 +114,3 @@ });

missing: [],
current: "one"
current: "one",
});

@@ -127,3 +127,3 @@ });

missing: [],
current: "multiOpt"
current: "multiOpt",
});

@@ -140,3 +140,3 @@ });

missing: [],
current: "one"
current: "one",
});

@@ -157,3 +157,3 @@ });

name: "one",
string: "one - first one"
string: "one - first one",
},

@@ -165,3 +165,3 @@ {

name: "two",
string: "two - second one"
string: "two - second one",
},

@@ -173,7 +173,7 @@ {

name: "three",
string: "three - third one"
}
string: "three - third one",
},
],
unknownOpts: [{ three: ["tre"] }],
current: "one"
current: "one",
});

@@ -184,3 +184,3 @@ });

await initMakitso({
command: "basic Uno due tre -o UnoDue --one UnoDueDue -f quattro"
command: "basic Uno due tre -o UnoDue --one UnoDueDue -f quattro",
});

@@ -195,9 +195,9 @@

three: "tre",
two: "due"
two: "due",
},
unknownOpts: [{ o: ["UnoDue"] }, { one: ["UnoDueDue"] }],
missing: [],
current: "three"
current: "three",
});
});
});

@@ -235,3 +235,3 @@ import _merge from "lodash/merge";

};
cmdLine: string;
cmdLine?: string;
};

@@ -238,0 +238,0 @@

@@ -12,5 +12,5 @@ "use strict";

throw new Error("quit");
}
},
},
...help.commands
...help.commands,
};

@@ -17,0 +17,0 @@

@@ -33,7 +33,7 @@ import _forEach from "lodash/forEach";

write(" Arguments:");
appCmd.arguments.forEach(arg => write(` ${arg}`));
appCmd.arguments.forEach((arg) => write(` ${arg}`));
}
if (appCmd.options && appCmd.options.length) {
write(" Options:");
appCmd.options.forEach(opt => write(` ${opt}`));
appCmd.options.forEach((opt) => write(` ${opt}`));
}

@@ -62,3 +62,3 @@ }

}
return Object.keys(commands).filter(comm => comm !== "help");
return Object.keys(commands).filter((comm) => comm !== "help");
}

@@ -71,4 +71,4 @@

action,
suggest
}
suggest,
},
};

@@ -75,0 +75,0 @@

@@ -7,4 +7,4 @@ import { plugin as commandsPlugin } from "./commands";

stores: await storesPlugin(args),
commands: commandsPlugin()
commands: commandsPlugin(),
};
}

@@ -9,4 +9,4 @@ jest.mock("keytar");

service: "twitter.password",
account: "{variant}"
}
account: "{variant}",
},
};

@@ -13,0 +13,0 @@

@@ -5,3 +5,3 @@ import { MemoryStore } from "../memory-store";

const store = new MemoryStore({
data: { github: { username: { default: "lecstor" } } }
data: { github: { username: { default: "lecstor" } } },
});

@@ -8,0 +8,0 @@ it("provides get", async () => {

@@ -131,5 +131,5 @@ "use strict";

stores: {
file: store
}
file: store,
},
};
}

@@ -22,3 +22,3 @@ import { FileStore, FileStoreArgs } from "./file-store";

secure: new KeychainStore(),
session: new MemoryStore(session)
session: new MemoryStore(session),
};

@@ -25,0 +25,0 @@ if (file) {

@@ -21,3 +21,3 @@ "use strict";

function replaceVariant(variant: string, ...values: string[]) {
return values.map(value => value.replace("{variant}", variant));
return values.map((value) => value.replace("{variant}", variant));
}

@@ -60,3 +60,3 @@

variant,
storeOptions
storeOptions,
});

@@ -104,5 +104,5 @@ return keytar.getPassword(service, account);

stores: {
keychain: new KeychainStore()
}
keychain: new KeychainStore(),
},
};
}

@@ -73,5 +73,5 @@ "use strict";

stores: {
session: new MemoryStore(args)
}
session: new MemoryStore(args),
},
};
}
{
"name": "makitso",
"version": "2.1.0",
"version": "2.1.1",
"description": "A Framework for building composable interactive commandline apps",

@@ -22,3 +22,3 @@ "main": "dist/index.js",

"js-yaml": "^3.10.0",
"keytar": "^5.6.0",
"keytar": "^6.0.1",
"makitso-prompt": "^3.0.0",

@@ -33,6 +33,6 @@ "prettyjson": "^1.2.1",

"@types/node": "^14.0.1",
"@types/prettier": "2.0.0",
"@types/prettier": "2.0.1",
"@types/yargs-parser": "^15.0.0",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@typescript-eslint/eslint-plugin": "^3.1.0",
"@typescript-eslint/parser": "^3.1.0",
"eslint": "^7.0.0",

@@ -46,4 +46,4 @@ "eslint-config-prettier": "^6.11.0",

"prettier": "^2.0.5",
"prettier-eslint": "^9.0.1",
"ts-jest": "^25.5.1",
"prettier-eslint": "^10.1.1",
"ts-jest": "^26.1.0",
"typescript": "^3.9.2"

@@ -50,0 +50,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc