Comparing version 1.0.11 to 1.0.12
@@ -35,3 +35,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
/******/ // eslint-disable-next-line no-unused-vars | ||
/******/ var hotCurrentHash = "b4c26dc2f92d49fe5c1d"; | ||
/******/ var hotCurrentHash = "681b9e457b43d59a72c6"; | ||
/******/ var hotRequestTimeout = 10000; | ||
@@ -781,2 +781,3 @@ /******/ var hotCurrentModuleData = {}; | ||
var path = __webpack_require__("path"); | ||
var spawnSync = __webpack_require__("child_process").spawnSync; | ||
var get = __webpack_require__("lodash.get"); | ||
@@ -809,2 +810,16 @@ | ||
}, | ||
git: function (name) { | ||
var cmds; | ||
switch (name) { | ||
case "branch": | ||
cmds = ["rev-parse", "--abbrev-ref", "HEAD"]; | ||
break; | ||
case "sha1": | ||
cmds = ["rev-parse", "HEAD"]; | ||
break; | ||
} | ||
var result = spawnSync("git", cmds); | ||
var output = result.output.toString().replace(/,|\n/gi, ""); | ||
return output; | ||
}, | ||
env: function (name) { | ||
@@ -1122,2 +1137,9 @@ return process.env[name]; | ||
/***/ "child_process": | ||
/***/ (function(module, exports) { | ||
module.exports = require("child_process"); | ||
/***/ }), | ||
/***/ "fs": | ||
@@ -1124,0 +1146,0 @@ /***/ (function(module, exports) { |
{ | ||
"name": "sls-yaml", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "Serverless framework yaml extension parser", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
const fs = require("fs"); | ||
const path = require("path"); | ||
const { spawnSync } = require("child_process"); | ||
const get = require("lodash.get"); | ||
@@ -34,2 +35,16 @@ import readYamlSync from "./sls-yaml"; | ||
}, | ||
git: (name: string) => { | ||
let cmds; | ||
switch (name) { | ||
case "branch": | ||
cmds = ["rev-parse", "--abbrev-ref", "HEAD"]; | ||
break; | ||
case "sha1": | ||
cmds = ["rev-parse", "HEAD"]; | ||
break; | ||
} | ||
const result = spawnSync("git", cmds); | ||
const output = result.output.toString().replace(/,|\n/gi, ""); | ||
return output; | ||
}, | ||
env: (name: string) => { | ||
@@ -36,0 +51,0 @@ return process.env[name]; |
@@ -341,3 +341,18 @@ import yaml from "./sls-yaml"; | ||
}); | ||
describe("When passing a git:branch command", () => { | ||
it("Should return result of command", () => { | ||
const content = Buffer.from("branch: ${git:branch}"); | ||
const result = yaml(content); | ||
expect(result).toEqual({ branch: "master" }); | ||
}); | ||
}); | ||
describe("When passing a git:sha1 command", () => { | ||
it("Should return result of command", () => { | ||
const content = Buffer.from("sha1: ${git:sha1}"); | ||
const result = yaml(content); | ||
expect(result.sha1).toBeDefined(); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119770
1999
1