Socket
Socket
Sign inDemoInstall

makfy

Package Overview
Dependencies
43
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.4 to 2.1.0

4

CHANGELOG.md
# makfy changelog
## 2.1.0
- Added support for multiline template literals as well as comment commands (commands starting with "//").
## 2.0.4

@@ -4,0 +8,0 @@

@@ -10,2 +10,4 @@ "use strict";

return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -12,0 +14,0 @@ function __() { this.constructor = d; }

129

dist/lib/execRuntime.js

@@ -84,5 +84,6 @@ "use strict";

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};

@@ -150,3 +151,3 @@ var __values = (this && this.__values) || function(o) {

argDefs = parsedCommand.argDefinitions;
baseIdStack = __spread(baseContext.idStack, [chalk_1.default.bold.blue(commandName)]);
baseIdStack = __spreadArray(__spreadArray([], __read(baseContext.idStack)), [chalk_1.default.bold.blue(commandName)]);
warnAsync = function (msg) { return __awaiter(void 0, void 0, void 0, function () {

@@ -243,4 +244,4 @@ return __generator(this, function (_a) {

lastId++;
newExecContext = __assign(__assign({}, baseContext), { syncMode: syncMode, idStack: __spread(baseIdStack, [chalk_1.default.bold.keyword(color)(id)]) });
return [2 /*return*/, createExecFunction(newExecContext).apply(void 0, __spread(execCommands))];
newExecContext = __assign(__assign({}, baseContext), { syncMode: syncMode, idStack: __spreadArray(__spreadArray([], __read(baseIdStack)), [chalk_1.default.bold.keyword(color)(id)]) });
return [2 /*return*/, createExecFunction(newExecContext).apply(void 0, __spreadArray([], __read(execCommands)))];
});

@@ -257,63 +258,85 @@ });

return __awaiter(void 0, void 0, void 0, function () {
var commands_1, commands_1_1, command, e_2_1;
var e_2, _a;
return __generator(this, function (_b) {
switch (_b.label) {
var expandedCommands, commands_1, commands_1_1, command, expandedCommand, expandedCommands_1, expandedCommands_1_1, command, e_2_1;
var e_3, _a, e_2, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
_b.trys.push([0, 15, 16, 17]);
commands_1 = __values(commands), commands_1_1 = commands_1.next();
_b.label = 1;
expandedCommands = [];
try {
for (commands_1 = __values(commands), commands_1_1 = commands_1.next(); !commands_1_1.done; commands_1_1 = commands_1.next()) {
command = commands_1_1.value;
if (typeof command === "string") {
expandedCommand = command.split("\n");
expandedCommands.push.apply(expandedCommands, __spreadArray([], __read(expandedCommand)));
}
else {
expandedCommands.push(command);
}
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (commands_1_1 && !commands_1_1.done && (_a = commands_1.return)) _a.call(commands_1);
}
finally { if (e_3) throw e_3.error; }
}
_c.label = 1;
case 1:
if (!!commands_1_1.done) return [3 /*break*/, 14];
command = commands_1_1.value;
if (!(command === null || command === undefined)) return [3 /*break*/, 2];
return [3 /*break*/, 13];
_c.trys.push([1, 16, 17, 18]);
expandedCommands_1 = __values(expandedCommands), expandedCommands_1_1 = expandedCommands_1.next();
_c.label = 2;
case 2:
if (!Array.isArray(command)) return [3 /*break*/, 4];
if (!!expandedCommands_1_1.done) return [3 /*break*/, 15];
command = expandedCommands_1_1.value;
if (!(command === null || command === undefined)) return [3 /*break*/, 3];
return [3 /*break*/, 14];
case 3:
if (!Array.isArray(command)) return [3 /*break*/, 5];
return [4 /*yield*/, execArrayAsync(command, context, innerExec)];
case 3:
_b.sent();
return [3 /*break*/, 13];
case 4:
if (!(typeof command === "object")) return [3 /*break*/, 6];
_c.sent();
return [3 /*break*/, 14];
case 5:
if (!(typeof command === "object")) return [3 /*break*/, 7];
return [4 /*yield*/, execObjectAsync(command, context)];
case 5:
_b.sent();
return [3 /*break*/, 13];
case 6:
if (!(typeof command === "string")) return [3 /*break*/, 13];
_c.sent();
return [3 /*break*/, 14];
case 7:
if (!(typeof command === "string")) return [3 /*break*/, 14];
command = command.trim();
if (!(command === "")) return [3 /*break*/, 7];
return [3 /*break*/, 13];
case 7:
if (!command.startsWith("@")) return [3 /*break*/, 9];
return [4 /*yield*/, execCSubcmmandStringAsync(command, context)];
if (!(command === "" || command.startsWith("//"))) return [3 /*break*/, 8];
return [3 /*break*/, 14];
case 8:
_b.sent();
return [3 /*break*/, 13];
if (!command.startsWith("@")) return [3 /*break*/, 10];
return [4 /*yield*/, execSubcommandStringAsync(command, context)];
case 9:
if (!command.startsWith("?")) return [3 /*break*/, 11];
_c.sent();
return [3 /*break*/, 14];
case 10:
if (!command.startsWith("?")) return [3 /*break*/, 12];
return [4 /*yield*/, execHelpStringAsync(command, context)];
case 10:
_b.sent();
return [3 /*break*/, 13];
case 11: return [4 /*yield*/, execCommandStringAsync(command, context)];
case 12:
_b.sent();
_b.label = 13;
case 11:
_c.sent();
return [3 /*break*/, 14];
case 12: return [4 /*yield*/, execCommandStringAsync(command, context)];
case 13:
commands_1_1 = commands_1.next();
return [3 /*break*/, 1];
case 14: return [3 /*break*/, 17];
case 15:
e_2_1 = _b.sent();
_c.sent();
_c.label = 14;
case 14:
expandedCommands_1_1 = expandedCommands_1.next();
return [3 /*break*/, 2];
case 15: return [3 /*break*/, 18];
case 16:
e_2_1 = _c.sent();
e_2 = { error: e_2_1 };
return [3 /*break*/, 17];
case 16:
return [3 /*break*/, 18];
case 17:
try {
if (commands_1_1 && !commands_1_1.done && (_a = commands_1.return)) _a.call(commands_1);
if (expandedCommands_1_1 && !expandedCommands_1_1.done && (_b = expandedCommands_1.return)) _b.call(expandedCommands_1);
}
finally { if (e_2) throw e_2.error; }
return [7 /*endfinally*/];
case 17: return [2 /*return*/, {
case 18: return [2 /*return*/, {
keepContext: innerExec

@@ -357,3 +380,3 @@ }];

if (!baseContext.syncMode) return [3 /*break*/, 2];
baseIdStack = __spread(baseContext.idStack);
baseIdStack = __spreadArray([], __read(baseContext.idStack));
execFunc_1 = createExecFunctionContext(baseContext, baseIdStack, false);

@@ -368,3 +391,3 @@ limit_1 = promise_1.limitPromiseConcurrency(32);

// turning into sync mode
return [4 /*yield*/, execFunction.apply(void 0, __spread(commands))];
return [4 /*yield*/, execFunction.apply(void 0, __spreadArray([], __read(commands)))];
case 3:

@@ -378,3 +401,3 @@ // turning into sync mode

}); };
var execCSubcmmandStringAsync = function (command, context) { return __awaiter(void 0, void 0, void 0, function () {
var execSubcommandStringAsync = function (command, context) { return __awaiter(void 0, void 0, void 0, function () {
var parsed, cmdName, parsedWithoutExtras;

@@ -381,0 +404,0 @@ return __generator(this, function (_a) {

@@ -98,5 +98,6 @@ "use strict";

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};

@@ -239,3 +240,3 @@ var __importDefault = (this && this.__importDefault) || function (mod) {

var lengths = argDefsList.map(function (entry) { return strip_ansi_1.default(formatLeftHelp_1(entry[1])).length; });
var maxLeftLength_1 = Math.max.apply(Math, __spread(lengths)) + 4;
var maxLeftLength_1 = Math.max.apply(Math, __spreadArray([], __read(lengths))) + 4;
var writeArgHelp_1 = function (argDef) {

@@ -242,0 +243,0 @@ var rightHelp = argDef[1].rightHelp;

@@ -66,5 +66,6 @@ "use strict";

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};

@@ -143,3 +144,3 @@ var _a;

switch (_a.label) {
case 0: return [4 /*yield*/, exec.apply(void 0, __spread(cmdOrCommands))];
case 0: return [4 /*yield*/, exec.apply(void 0, __spreadArray([], __read(cmdOrCommands)))];
case 1:

@@ -146,0 +147,0 @@ _a.sent();

@@ -84,5 +84,6 @@ "use strict";

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};

@@ -130,3 +131,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

}
return shell_1.escapeForShell(__spread(parts));
return shell_1.escapeForShell(__spreadArray([], __read(parts)));
}

@@ -133,0 +134,0 @@ exports.escape = escape;

@@ -18,5 +18,6 @@ "use strict";

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};

@@ -65,3 +66,3 @@ var __values = (this && this.__values) || function(o) {

if (obj._) {
arr.push.apply(arr, __spread(obj._));
arr.push.apply(arr, __spreadArray([], __read(obj._)));
}

@@ -81,3 +82,3 @@ try {

else {
arr.push.apply(arr, __spread([exports.argNameToDashedArgName(argName), argValue.toString()]));
arr.push.apply(arr, [exports.argNameToDashedArgName(argName), argValue.toString()]);
}

@@ -84,0 +85,0 @@ break;

@@ -65,5 +65,6 @@ "use strict";

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};

@@ -153,3 +154,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

return [7 /*endfinally*/];
case 8: return [2 /*return*/, __spread(set)];
case 8: return [2 /*return*/, __spreadArray([], __read(set))];
}

@@ -156,0 +157,0 @@ });

@@ -84,5 +84,6 @@ "use strict";

};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};

@@ -195,3 +196,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

var newHashes = newHashCollection.hashes;
var union = new Set(__spread(Object.keys(oldHashes), Object.keys(newHashes)));
var union = new Set(__spreadArray(__spreadArray([], __read(Object.keys(oldHashes))), __read(Object.keys(newHashes))));
try {

@@ -198,0 +199,0 @@ for (var union_1 = __values(union), union_1_1 = union_1.next(); !union_1_1.done; union_1_1 = union_1.next()) {

{
"name": "makfy",
"version": "2.0.4",
"version": "2.1.0",
"description": "makfy - npm scripts on steroids!",

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

"devDependencies": {
"@types/node": "^14.14.25",
"@types/node": "^15.3.0",
"@types/tmp": "0.2.0",

@@ -50,8 +50,8 @@ "@types/yargs": "^16.0.0",

"pretty-hrtime": "^1.0.3",
"strip-ansi": "^6.0.0",
"strip-ansi": "^7.0.0",
"tmp": "^0.2.1",
"ts-node": "^9.1.1",
"typescript": "^4.1.3",
"yargs": "^16.2.0"
"yargs": "^17.0.1"
}
}

@@ -10,3 +10,3 @@ <p align="center">

`npm install -g makfy` / `yarn global add makfy`
`npm install -g makfy` / `yarn global add makfy`

@@ -69,12 +69,11 @@ or locally

cmd("clean")
.run(async (exec) => {
await exec(
// running sequentially
"rimraf ./dist-a",
"rimraf ./dist-b",
// and these run after the other ones too, but in parallel!
["rimraf ./dist-c", "rimraf ./dist-d"]
);
});
cmd("clean").run(async (exec) => {
await exec(
// running sequentially
"rimraf ./dist-a",
"rimraf ./dist-b",
// and these run after the other ones too, but in parallel!
["rimraf ./dist-c", "rimraf ./dist-d"]
);
});
```

@@ -99,7 +98,4 @@

})
.run(async (exec, {prod, dev}) => {
await exec(
prod ? "rimraf ./dist-prod" : null,
dev ? "rimraf ./dist-dev" : null
);
.run(async (exec, { prod, dev }) => {
await exec(prod ? "rimraf ./dist-prod" : null, dev ? "rimraf ./dist-dev" : null);
});

@@ -182,15 +178,14 @@ ```

cmd("compile")
.run(async (exec) => {
const delta = await getFileChanges("typescript", ["./src/**/*.ts", "./src/**/*.tsx"]);
cmd("compile").run(async (exec) => {
const delta = await getFileChanges("typescript", ["./src/**/*.ts", "./src/**/*.tsx"]);
if (delta.hasChanges) {
await exec(
// here you would remove all target files generated by this step
// then compile new target files
"tsc -p ."
// additionally you could even only run the compiler over delta.added + delta.modified files
);
}
});
if (delta.hasChanges) {
await exec(
// here you would remove all target files generated by this step
// then compile new target files
"tsc -p ."
// additionally you could even only run the compiler over delta.added + delta.modified files
);
}
});
```

@@ -207,13 +202,25 @@

cmd("clean")
.desc("cleans stuff")
.run(
// running sequentially
"rimraf ./dist-a",
"rimraf ./dist-b",
// and these run after the other ones too, but in parallel!
["rimraf ./dist-c", "rimraf ./dist-d"]
);
cmd("clean").desc("cleans stuff").run(
// running sequentially
"rimraf ./dist-a",
"rimraf ./dist-b",
// and these run after the other ones too, but in parallel!
["rimraf ./dist-c", "rimraf ./dist-d"]
);
```
If you want to make it even shorter you might use template literals:
```ts
import { cmd } from "makfy";
// or
const { cmd } = require("makfy");
cmd("clean").desc("cleans stuff").run(`
// commands starting with '//' will be ignored
rimraf ./dist-a
rimraf ./dist-b
`);
```
## Documentation

@@ -252,5 +259,5 @@

Adds a command to the list of possible commands. If `commandName` starts with `_` then it will be
considered an internal command that cannot be invoked/listed using the CLI, yet can be run by other
commands.
Adds a command to the list of possible commands. If `commandName` starts with `_` then it will be
considered an internal command that cannot be invoked/listed using the CLI, yet can be run by other
commands.

@@ -296,3 +303,6 @@ - **`.run(async (exec, args) => Promise<void>)`**

> > > // once a, b+c are done then runs (e,f) in parallel with (g,h)
> > > [[e, f], [g, h]],
> > > [
> > > [e, f],
> > > [g, h]
> > > ],
> > > i // once a, b+c, (e,f)+(g+h) are done then runs i

@@ -299,0 +309,0 @@ > > > );

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc