(http://alexei.ro/)"],
9 | "homepage": "https://github.com/alexei/sprintf.js",
10 | "repository": {
11 | "type": "git",
12 | "url": "git://github.com/alexei/sprintf.js.git"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/node_modules/sprintf-js/demo/angular.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{ "%+010d"|sprintf:-123 }}
10 | {{ "%+010d"|vsprintf:[-123] }}
11 | {{ "%+010d"|fmt:-123 }}
12 | {{ "%+010d"|vfmt:[-123] }}
13 | {{ "I've got %2$d apples and %1$d oranges."|fmt:4:2 }}
14 | {{ "I've got %(apples)d apples and %(oranges)d oranges."|fmt:{apples: 2, oranges: 4} }}
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/node_modules/sprintf-js/dist/angular-sprintf.min.js:
--------------------------------------------------------------------------------
1 | /*! sprintf-js | Alexandru Marasteanu (http://alexei.ro/) | BSD-3-Clause */
2 |
3 | angular.module("sprintf",[]).filter("sprintf",function(){return function(){return sprintf.apply(null,arguments)}}).filter("fmt",["$filter",function(a){return a("sprintf")}]).filter("vsprintf",function(){return function(a,b){return vsprintf(a,b)}}).filter("vfmt",["$filter",function(a){return a("vsprintf")}]);
4 | //# sourceMappingURL=angular-sprintf.min.map
--------------------------------------------------------------------------------
/node_modules/sprintf-js/dist/angular-sprintf.min.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"angular-sprintf.min.js","sources":["../src/angular-sprintf.js"],"names":["angular","module","filter","sprintf","apply","arguments","$filter","format","argv","vsprintf"],"mappings":";;AAAAA,QACIC,OAAO,cACPC,OAAO,UAAW,WACd,MAAO,YACH,MAAOC,SAAQC,MAAM,KAAMC,cAGnCH,OAAO,OAAQ,UAAW,SAASI,GAC/B,MAAOA,GAAQ,cAEnBJ,OAAO,WAAY,WACf,MAAO,UAASK,EAAQC,GACpB,MAAOC,UAASF,EAAQC,MAGhCN,OAAO,QAAS,UAAW,SAASI,GAChC,MAAOA,GAAQ"}
--------------------------------------------------------------------------------
/node_modules/sprintf-js/dist/angular-sprintf.min.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"angular-sprintf.min.js","sources":["../src/angular-sprintf.js"],"names":["angular","module","filter","sprintf","apply","arguments","$filter","format","argv","vsprintf"],"mappings":";;AAAAA,QACIC,OAAO,cACPC,OAAO,UAAW,WACd,MAAO,YACH,MAAOC,SAAQC,MAAM,KAAMC,cAGnCH,OAAO,OAAQ,UAAW,SAASI,GAC/B,MAAOA,GAAQ,cAEnBJ,OAAO,WAAY,WACf,MAAO,UAASK,EAAQC,GACpB,MAAOC,UAASF,EAAQC,MAGhCN,OAAO,QAAS,UAAW,SAASI,GAChC,MAAOA,GAAQ"}
--------------------------------------------------------------------------------
/node_modules/sprintf-js/dist/sprintf.min.js:
--------------------------------------------------------------------------------
1 | /*! sprintf-js | Alexandru Marasteanu (http://alexei.ro/) | BSD-3-Clause */
2 |
3 | !function(a){function b(){var a=arguments[0],c=b.cache;return c[a]&&c.hasOwnProperty(a)||(c[a]=b.parse(a)),b.format.call(null,c[a],arguments)}function c(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}function d(a,b){return Array(b+1).join(a)}var e={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};b.format=function(a,f){var g,h,i,j,k,l,m,n=1,o=a.length,p="",q=[],r=!0,s="";for(h=0;o>h;h++)if(p=c(a[h]),"string"===p)q[q.length]=a[h];else if("array"===p){if(j=a[h],j[2])for(g=f[n],i=0;i=0),j[8]){case"b":g=g.toString(2);break;case"c":g=String.fromCharCode(g);break;case"d":case"i":g=parseInt(g,10);break;case"j":g=JSON.stringify(g,null,j[6]?parseInt(j[6]):0);break;case"e":g=j[7]?g.toExponential(j[7]):g.toExponential();break;case"f":g=j[7]?parseFloat(g).toFixed(j[7]):parseFloat(g);break;case"g":g=j[7]?parseFloat(g).toPrecision(j[7]):parseFloat(g);break;case"o":g=g.toString(8);break;case"s":g=(g=String(g))&&j[7]?g.substring(0,j[7]):g;break;case"u":g>>>=0;break;case"x":g=g.toString(16);break;case"X":g=g.toString(16).toUpperCase()}e.json.test(j[8])?q[q.length]=g:(!e.number.test(j[8])||r&&!j[3]?s="":(s=r?"+":"-",g=g.toString().replace(e.sign,"")),l=j[4]?"0"===j[4]?"0":j[4].charAt(1):" ",m=j[6]-(s+g).length,k=j[6]&&m>0?d(l,m):"",q[q.length]=j[5]?s+g+k:"0"===l?s+k+g:k+s+g)}return q.join("")},b.cache={},b.parse=function(a){for(var b=a,c=[],d=[],f=0;b;){if(null!==(c=e.text.exec(b)))d[d.length]=c[0];else if(null!==(c=e.modulo.exec(b)))d[d.length]="%";else{if(null===(c=e.placeholder.exec(b)))throw new SyntaxError("[sprintf] unexpected placeholder");if(c[2]){f|=1;var g=[],h=c[2],i=[];if(null===(i=e.key.exec(h)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(g[g.length]=i[1];""!==(h=h.substring(i[0].length));)if(null!==(i=e.key_access.exec(h)))g[g.length]=i[1];else{if(null===(i=e.index_access.exec(h)))throw new SyntaxError("[sprintf] failed to parse named argument key");g[g.length]=i[1]}c[2]=g}else f|=2;if(3===f)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");d[d.length]=c}b=b.substring(c[0].length)}return d};var f=function(a,c,d){return d=(c||[]).slice(0),d.splice(0,0,a),b.apply(null,d)};"undefined"!=typeof exports?(exports.sprintf=b,exports.vsprintf=f):(a.sprintf=b,a.vsprintf=f,"function"==typeof define&&define.amd&&define(function(){return{sprintf:b,vsprintf:f}}))}("undefined"==typeof window?this:window);
4 | //# sourceMappingURL=sprintf.min.map
--------------------------------------------------------------------------------
/node_modules/sprintf-js/dist/sprintf.min.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"sprintf.min.js","sources":["../src/sprintf.js"],"names":["window","sprintf","key","arguments","cache","hasOwnProperty","parse","format","call","get_type","variable","Object","prototype","toString","slice","toLowerCase","str_repeat","input","multiplier","Array","join","re","not_string","number","json","not_json","text","modulo","placeholder","key_access","index_access","sign","parse_tree","argv","arg","i","k","match","pad","pad_character","pad_length","cursor","tree_length","length","node_type","output","is_positive","Error","test","isNaN","TypeError","String","fromCharCode","parseInt","JSON","stringify","toExponential","parseFloat","toFixed","substring","toUpperCase","replace","charAt","fmt","_fmt","arg_names","exec","SyntaxError","field_list","replacement_field","field_match","vsprintf","_argv","splice","apply","exports","define","amd","this"],"mappings":";;CAAA,SAAUA,GAeN,QAASC,KACL,GAAIC,GAAMC,UAAU,GAAIC,EAAQH,EAAQG,KAIxC,OAHMA,GAAMF,IAAQE,EAAMC,eAAeH,KACrCE,EAAMF,GAAOD,EAAQK,MAAMJ,IAExBD,EAAQM,OAAOC,KAAK,KAAMJ,EAAMF,GAAMC,WA4JjD,QAASM,GAASC,GACd,MAAOC,QAAOC,UAAUC,SAASL,KAAKE,GAAUI,MAAM,EAAG,IAAIC,cAGjE,QAASC,GAAWC,EAAOC,GACvB,MAAOC,OAAMD,EAAa,GAAGE,KAAKH,GApLtC,GAAII,IACAC,WAAY,OACZC,OAAQ,SACRC,KAAM,MACNC,SAAU,OACVC,KAAM,YACNC,OAAQ,WACRC,YAAa,yFACb1B,IAAK,sBACL2B,WAAY,wBACZC,aAAc,aACdC,KAAM,UAWV9B,GAAQM,OAAS,SAASyB,EAAYC,GAClC,GAAiEC,GAAkBC,EAAGC,EAAGC,EAAOC,EAAKC,EAAeC,EAAhHC,EAAS,EAAGC,EAAcV,EAAWW,OAAQC,EAAY,GAASC,KAA0DC,GAAc,EAAMf,EAAO,EAC3J,KAAKI,EAAI,EAAOO,E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AcjD,EAAGnB,IAAIgE,KAAKG,IAe3B,KAAM,IAAIF,aAAY,+CAbtB,KADAC,EAAWA,EAAWzB,QAAU2B,EAAY,GACwC,MAA5ED,EAAoBA,EAAkBV,UAAUW,EAAY,GAAG3B,UACnE,GAA8D,QAAzD2B,EAAcjD,EAAGQ,WAAWqC,KAAKG,IAClCD,EAAWA,EAAWzB,QAAU2B,EAAY,OAE3C,CAAA,GAAgE,QAA3DA,EAAcjD,EAAGS,aAAaoC,KAAKG,IAIzC,KAAM,IAAIF,aAAY,+CAHtBC,GAAWA,EAAWzB,QAAU2B,EAAY,GAUxDjC,EAAM,GAAK+B,MAGXH,IAAa,CAEjB,IAAkB,IAAdA,EACA,KAAM,IAAIlB,OAAM,4EAEpBf,GAAWA,EAAWW,QAAUN,EAKpC2B,EAAOA,EAAKL,UAAUtB,EAAM,GAAGM,QAEnC,MAAOX,GAGX,IAAIuC,GAAW,SAASR,EAAK9B,EAAMuC,GAG/B,MAFAA,IAASvC,OAAYnB,MAAM,GAC3B0D,EAAMC,OAAO,EAAG,EAAGV,GACZ9D,EAAQyE,MAAM,KAAMF,GAiBR,oBAAZG,UACPA,QAAQ1E,QAAUA,EAClB0E,QAAQJ,SAAWA,IAGnBvE,EAAOC,QAAUA,EACjBD,EAAOuE,SAAWA,EAEI,kBAAXK,SAAyBA,OAAOC,KACvCD,OAAO,WACH,OACI3E,QAASA,EACTsE,SAAUA,OAKT,mBAAXvE,QAAyB8E,KAAO9E"}
--------------------------------------------------------------------------------
/node_modules/sprintf-js/dist/sprintf.min.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"sprintf.min.js","sources":["../src/sprintf.js"],"names":["window","sprintf","key","arguments","cache","hasOwnProperty","parse","format","call","get_type","variable","Object","prototype","toString","slice","toLowerCase","str_repeat","input","multiplier","Array","join","re","not_string","number","json","not_json","text","modulo","placeholder","key_access","index_access","sign","parse_tree","argv","arg","i","k","match","pad","pad_character","pad_length","cursor","tree_length","length","node_type","output","is_positive","Error","test","isNaN","TypeError","String","fromCharCode","parseInt","JSON","stringify","toExponential","parseFloat","toFixed","toPrecision","substring","toUpperCase","replace","charAt","fmt","_fmt","arg_names","exec","SyntaxError","field_list","replacement_field","field_match","vsprintf","_argv","splice","apply","exports","define","amd","this"],"mappings":";;CAAA,SAAUA,GAeN,QAASC,KACL,GAAIC,GAAMC,UAAU,GAAIC,EAAQH,EAAQG,KAIxC,OAHMA,GAAMF,IAAQE,EAAMC,eAAeH,KACrCE,EAAMF,GAAOD,EAAQK,MAAMJ,IAExBD,EAAQM,OAAOC,KAAK,KAAMJ,EAAMF,GAAMC,WA+JjD,QAASM,GAASC,GACd,MAAOC,QAAOC,UAAUC,SAASL,KAAKE,GAAUI,MAAM,EAAG,IAAIC,cAGjE,QAASC,GAAWC,EAAOC,GACvB,MAAOC,OAAMD,EAAa,GAAGE,KAAKH,GAvLtC,GAAII,IACAC,WAAY,OACZC,OAAQ,UACRC,KAAM,MACNC,SAAU,OACVC,KAAM,YACNC,OAAQ,WACRC,YAAa,yFACb1B,IAAK,sBACL2B,WAAY,wBACZC,aAAc,aACdC,KAAM,UAWV9B,GAAQM,OAAS,SAASyB,EAAYC,GAClC,GAAiEC,GAAkBC,EAAGC,EAAGC,EAAOC,EAAKC,EAAeC,EAAhHC,EAAS,EAAGC,EAAcV,EAAWW,OAAQC,EAAY,GAASC,KAA0DC,GAAc,EAAMf,EAAO,EAC3J,KAAKI,EAAI,EAAOO,EAAJP,EAAiBA,IAEzB,GADAS,EAAYnC,EAASuB,EAAWG,IACd,WAAdS,EACAC,EAAOA,EAAOF,QAAUX,EAAWG,OAElC,IAAkB,UAAdS,EAAuB,CAE5B,GADAP,EAAQL,EAAWG,GACfE,EAAM,GAEN,IADAH,EAAMD,EAAKQ,GACNL,EAAI,EAAGA,EAAIC,EAAM,GAAGM,OAAQP,IAAK,CAClC,IAAKF,EAAI7B,eAAegC,EAAM,GAAGD,IAC7B,KAAM,IAAIW,OAAM9C,EAAQ,yCAA0CoC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AAY,OAE3C,CAAA,GAAgE,QAA3DA,EAAclD,EAAGS,aAAaqC,KAAKG,IAIzC,KAAM,IAAIF,aAAY,+CAHtBC,GAAWA,EAAW1B,QAAU4B,EAAY,GAUxDlC,EAAM,GAAKgC,MAGXH,IAAa,CAEjB,IAAkB,IAAdA,EACA,KAAM,IAAInB,OAAM,4EAEpBf,GAAWA,EAAWW,QAAUN,EAKpC4B,EAAOA,EAAKL,UAAUvB,EAAM,GAAGM,QAEnC,MAAOX,GAGX,IAAIwC,GAAW,SAASR,EAAK/B,EAAMwC,GAG/B,MAFAA,IAASxC,OAAYnB,MAAM,GAC3B2D,EAAMC,OAAO,EAAG,EAAGV,GACZ/D,EAAQ0E,MAAM,KAAMF,GAiBR,oBAAZG,UACPA,QAAQ3E,QAAUA,EAClB2E,QAAQJ,SAAWA,IAGnBxE,EAAOC,QAAUA,EACjBD,EAAOwE,SAAWA,EAEI,kBAAXK,SAAyBA,OAAOC,KACvCD,OAAO,WACH,OACI5E,QAASA,EACTuE,SAAUA,OAKT,mBAAXxE,QAAyB+E,KAAO/E"}
--------------------------------------------------------------------------------
/node_modules/sprintf-js/gruntfile.js:
--------------------------------------------------------------------------------
1 | module.exports = function(grunt) {
2 | grunt.initConfig({
3 | pkg: grunt.file.readJSON("package.json"),
4 |
5 | uglify: {
6 | options: {
7 | banner: "/*! <%= pkg.name %> | <%= pkg.author %> | <%= pkg.license %> */\n",
8 | sourceMap: true
9 | },
10 | build: {
11 | files: [
12 | {
13 | src: "src/sprintf.js",
14 | dest: "dist/sprintf.min.js"
15 | },
16 | {
17 | src: "src/angular-sprintf.js",
18 | dest: "dist/angular-sprintf.min.js"
19 | }
20 | ]
21 | }
22 | },
23 |
24 | watch: {
25 | js: {
26 | files: "src/*.js",
27 | tasks: ["uglify"]
28 | }
29 | }
30 | })
31 |
32 | grunt.loadNpmTasks("grunt-contrib-uglify")
33 | grunt.loadNpmTasks("grunt-contrib-watch")
34 |
35 | grunt.registerTask("default", ["uglify", "watch"])
36 | }
37 |
--------------------------------------------------------------------------------
/node_modules/sprintf-js/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "_args": [
3 | [
4 | "sprintf-js@1.0.3",
5 | "/Users/sabino/src/use-private-action"
6 | ]
7 | ],
8 | "_from": "sprintf-js@1.0.3",
9 | "_id": "sprintf-js@1.0.3",
10 | "_inBundle": false,
11 | "_integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
12 | "_location": "/sprintf-js",
13 | "_phantomChildren": {},
14 | "_requested": {
15 | "type": "version",
16 | "registry": true,
17 | "raw": "sprintf-js@1.0.3",
18 | "name": "sprintf-js",
19 | "escapedName": "sprintf-js",
20 | "rawSpec": "1.0.3",
21 | "saveSpec": null,
22 | "fetchSpec": "1.0.3"
23 | },
24 | "_requiredBy": [
25 | "/argparse"
26 | ],
27 | "_resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
28 | "_spec": "1.0.3",
29 | "_where": "/Users/sabino/src/use-private-action",
30 | "author": {
31 | "name": "Alexandru Marasteanu",
32 | "email": "hello@alexei.ro",
33 | "url": "http://alexei.ro/"
34 | },
35 | "bugs": {
36 | "url": "https://github.com/alexei/sprintf.js/issues"
37 | },
38 | "description": "JavaScript sprintf implementation",
39 | "devDependencies": {
40 | "grunt": "*",
41 | "grunt-contrib-uglify": "*",
42 | "grunt-contrib-watch": "*",
43 | "mocha": "*"
44 | },
45 | "homepage": "https://github.com/alexei/sprintf.js#readme",
46 | "license": "BSD-3-Clause",
47 | "main": "src/sprintf.js",
48 | "name": "sprintf-js",
49 | "repository": {
50 | "type": "git",
51 | "url": "git+https://github.com/alexei/sprintf.js.git"
52 | },
53 | "scripts": {
54 | "test": "mocha test/test.js"
55 | },
56 | "version": "1.0.3"
57 | }
58 |
--------------------------------------------------------------------------------
/node_modules/sprintf-js/src/angular-sprintf.js:
--------------------------------------------------------------------------------
1 | angular.
2 | module("sprintf", []).
3 | filter("sprintf", function() {
4 | return function() {
5 | return sprintf.apply(null, arguments)
6 | }
7 | }).
8 | filter("fmt", ["$filter", function($filter) {
9 | return $filter("sprintf")
10 | }]).
11 | filter("vsprintf", function() {
12 | return function(format, argv) {
13 | return vsprintf(format, argv)
14 | }
15 | }).
16 | filter("vfmt", ["$filter", function($filter) {
17 | return $filter("vsprintf")
18 | }])
19 |
--------------------------------------------------------------------------------
/node_modules/sprintf-js/test/test.js:
--------------------------------------------------------------------------------
1 | var assert = require("assert"),
2 | sprintfjs = require("../src/sprintf.js"),
3 | sprintf = sprintfjs.sprintf,
4 | vsprintf = sprintfjs.vsprintf
5 |
6 | describe("sprintfjs", function() {
7 | var pi = 3.141592653589793
8 |
9 | it("should return formated strings for simple placeholders", function() {
10 | assert.equal("%", sprintf("%%"))
11 | assert.equal("10", sprintf("%b", 2))
12 | assert.equal("A", sprintf("%c", 65))
13 | assert.equal("2", sprintf("%d", 2))
14 | assert.equal("2", sprintf("%i", 2))
15 | assert.equal("2", sprintf("%d", "2"))
16 | assert.equal("2", sprintf("%i", "2"))
17 | assert.equal('{"foo":"bar"}', sprintf("%j", {foo: "bar"}))
18 | assert.equal('["foo","bar"]', sprintf("%j", ["foo", "bar"]))
19 | assert.equal("2e+0", sprintf("%e", 2))
20 | assert.equal("2", sprintf("%u", 2))
21 | assert.equal("4294967294", sprintf("%u", -2))
22 | assert.equal("2.2", sprintf("%f", 2.2))
23 | assert.equal("3.141592653589793", sprintf("%g", pi))
24 | assert.equal("10", sprintf("%o", 8))
25 | assert.equal("%s", sprintf("%s", "%s"))
26 | assert.equal("ff", sprintf("%x", 255))
27 | assert.equal("FF", sprintf("%X", 255))
28 | assert.equal("Polly wants a cracker", sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants"))
29 | assert.equal("Hello world!", sprintf("Hello %(who)s!", {"who": "world"}))
30 | })
31 |
32 | it("should return formated strings for complex placeholders", function() {
33 | // sign
34 | assert.equal("2", sprintf("%d", 2))
35 | assert.equal("-2", sprintf("%d", -2))
36 | assert.equal("+2", sprintf("%+d", 2))
37 | assert.equal("-2", sprintf("%+d", -2))
38 | assert.equal("2", sprintf("%i", 2))
39 | assert.equal("-2", sprintf("%i", -2))
40 | assert.equal("+2", sprintf("%+i", 2))
41 | assert.equal("-2", sprintf("%+i", -2))
42 | assert.equal("2.2", sprintf("%f", 2.2))
43 | assert.equal("-2.2", sprintf("%f", -2.2))
44 | assert.equal("+2.2", sprintf("%+f", 2.2))
45 | assert.equal("-2.2", sprintf("%+f", -2.2))
46 | assert.equal("-2.3", sprintf("%+.1f", -2.34))
47 | assert.equal("-0.0", sprintf("%+.1f", -0.01))
48 | assert.equal("3.14159", sprintf("%.6g", pi))
49 | assert.equal("3.14", sprintf("%.3g", pi))
50 | assert.equal("3", sprintf("%.1g", pi))
51 | assert.equal("-000000123", sprintf("%+010d", -123))
52 | assert.equal("______-123", sprintf("%+'_10d", -123))
53 | assert.equal("-234.34 123.2", sprintf("%f %f", -234.34, 123.2))
54 |
55 | // padding
56 | assert.equal("-0002", sprintf("%05d", -2))
57 | assert.equal("-0002", sprintf("%05i", -2))
58 | assert.equal(" <", sprintf("%5s", "<"))
59 | assert.equal("0000<", sprintf("%05s", "<"))
60 | assert.equal("____<", sprintf("%'_5s", "<"))
61 | assert.equal("> ", sprintf("%-5s", ">"))
62 | assert.equal(">0000", sprintf("%0-5s", ">"))
63 | assert.equal(">____", sprintf("%'_-5s", ">"))
64 | assert.equal("xxxxxx", sprintf("%5s", "xxxxxx"))
65 | assert.equal("1234", sprintf("%02u", 1234))
66 | assert.equal(" -10.235", sprintf("%8.3f", -10.23456))
67 | assert.equal("-12.34 xxx", sprintf("%f %s", -12.34, "xxx"))
68 | assert.equal('{\n "foo": "bar"\n}', sprintf("%2j", {foo: "bar"}))
69 | assert.equal('[\n "foo",\n "bar"\n]', sprintf("%2j", ["foo", "bar"]))
70 |
71 | // precision
72 | assert.equal("2.3", sprintf("%.1f", 2.345))
73 | assert.equal("xxxxx", sprintf("%5.5s", "xxxxxx"))
74 | assert.equal(" x", sprintf("%5.1s", "xxxxxx"))
75 |
76 | })
77 |
78 | it("should return formated strings for callbacks", function() {
79 | assert.equal("foobar", sprintf("%s", function() { return "foobar" }))
80 | assert.equal(Date.now(), sprintf("%s", Date.now)) // should pass...
81 | })
82 | })
83 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@bagbyte/use-private-action",
3 | "version": "0.0.2",
4 | "private": true,
5 | "description": "This action allow the use of GitHub private actions",
6 | "main": "dist/main.js",
7 | "scripts": {
8 | "build": "tsc",
9 | "test": "jest",
10 | "prepublishOnly": "npm run build && npm prune --prod && npm version patch"
11 | },
12 | "repository": {
13 | "type": "git",
14 | "url": "git+https://github.com/bagbyte/use-private-action.git"
15 | },
16 | "keywords": [
17 | "github",
18 | "actions",
19 | "private"
20 | ],
21 | "author": "bagbyte",
22 | "license": "MIT",
23 | "files": [
24 | "dist/**/*",
25 | "node_modules/**/*",
26 | "action.yml"
27 | ],
28 | "dependencies": {
29 | "@actions/core": "^1.2.0",
30 | "@actions/exec": "^1.0.1",
31 | "@actions/io": "^1.0.1",
32 | "js-yaml": "^3.13.1"
33 | },
34 | "devDependencies": {
35 | "@types/jest": "^24.0.13",
36 | "@types/node": "^12.0.4",
37 | "jest": "^24.8.0",
38 | "jest-circus": "^24.7.1",
39 | "ts-jest": "^24.0.2",
40 | "typescript": "^3.5.1"
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import * as core from '@actions/core';
2 | import * as exec from '@actions/exec';
3 | import * as io from '@actions/io';
4 |
5 | import * as path from 'path';
6 |
7 | const yaml = require('js-yaml');
8 |
9 | // Default error message describing the `action` input parmeter format
10 | const ACTION_ERROR = `Provided 'action' is not valid, it must have the following format: '{org}/{repo}[/path]@ref'`;
11 |
12 | // Interface describing the `action.yml` file format
13 | interface ActionFileContent {
14 | runs: {
15 | using: string;
16 | main: string;
17 | },
18 | }
19 |
20 | // This method generates a random string to be useed as temporary folder to clone the action repo
21 | function randomFolderName() {
22 | return Math.random().toString(36).substring(2, 15);
23 | }
24 |
25 | // This method clones the action repository
26 | async function cloneRepository(tempFolder: string, repositoryUrl: string) {
27 | try {
28 | await exec.exec('git', ['clone', repositoryUrl, tempFolder]);
29 | } catch (err) {
30 | core.error(err);
31 | throw new Error('There was an error while trying to clone the action repository');
32 | }
33 | }
34 |
35 | // This method checks out the requested repo's reference (branch/tag/commit)
36 | async function checkout(tempFolder: string, reference: string) {
37 | try {
38 | await exec.exec('git', ['checkout', '-f', '--detach', reference], { cwd: tempFolder });
39 | } catch (err) {
40 | core.error(err);
41 | throw new Error(`There was an error while trying to checkout '${reference}'`);
42 | }
43 | }
44 |
45 | // This method parses the `action.yml` file and execute the action
46 | async function executeAction(actionFileFolder: string) {
47 | // Prepare an empty string which will contain the content of the `action.yml` file
48 | let actionFileContent = '';
49 |
50 | // Create an object to listen on the stdout of the cat command
51 | const options = {
52 | listeners: {
53 | stdout: (data: Buffer) => {
54 | actionFileContent += data.toString();
55 | },
56 | }
57 | };
58 |
59 | try {
60 | // Use cat to fetch the content of `action.yml` file
61 | await exec.exec('cat', [actionFileFolder + '/action.yml'], options);
62 | } catch (err) {
63 | core.error(err);
64 | throw new Error(`There was an error while trying to read 'action.yml'`);
65 | }
66 |
67 | let actionFileObject: ActionFileContent;
68 | try {
69 | // Convert the YML file into a javascript object
70 | actionFileObject = await yaml.safeLoad(actionFileContent);
71 | } catch (err) {
72 | core.error(err);
73 | throw new Error(`The 'action.yml' file seems to have an invalid format`);
74 | }
75 |
76 | // Check if the `action.yml` file has properly written
77 | if (!('runs' in actionFileObject) || !('using' in actionFileObject.runs)) {
78 | throw new Error(`There was an error while parsing 'action.yml' file, missing 'runs.using'`);
79 | }
80 |
81 | // Check if the action is based on node
82 | if (!actionFileObject.runs.using.startsWith('node')) {
83 | throw new Error(`Unexpected value '${actionFileObject.runs.using}' for 'runs.using' in the 'action.yml' file`);
84 | }
85 |
86 | try {
87 | let currentPath = '';
88 |
89 | // Get the full path of the current path
90 | await exec.exec('pwd', [], {
91 | listeners: {
92 | stdline: (data: string) => {
93 | currentPath = data;
94 | }
95 | }
96 | });
97 |
98 | // Get the full path of the main file of the action to execute
99 | const mainFullPath = path.join(currentPath, actionFileFolder, actionFileObject.runs.main.replace(/^((.\/)|(\/))/, ''));
100 |
101 | // Execute the action
102 | await require(mainFullPath);
103 | } catch (err) {
104 | core.error(err);
105 | throw new Error(`There was an error while trying to execute the action`);
106 | }
107 | }
108 |
109 | // This method deletes the folder used for the repository clone
110 | async function deleteFolder(tempFolder: string) {
111 | // Cleanup
112 | if (tempFolder) {
113 | try {
114 | await io.rmRF(tempFolder);
115 | } catch (err) {
116 | core.error(err);
117 | core.setFailed(`There was an error while trying to delete temp folder '${tempFolder}'`);
118 | }
119 | }
120 | }
121 |
122 | // This method checks out the code from the repository and branch where the action has been called
123 | async function checkoutCode() {
124 | // Read `private-action` input parmeter
125 | const action = core.getInput('private-action');
126 |
127 | // Read `private-action-token` input parmeter
128 | const token = core.getInput('private-action-token');
129 |
130 | // If `private-action` input prameter is missing, return an error
131 | if (!action) {
132 | core.setFailed(`Missing 'private-action' input parameter`);
133 | return;
134 | }
135 |
136 | // If `private-action-token` input prameter is missing, return an error
137 | if (!token) {
138 | core.setFailed(`Missing 'private-action-token' input parameter`);
139 | return;
140 | }
141 |
142 | // Extract `ref` from `private-action`
143 | const [ repoParts, ref ] = action.split('@');
144 |
145 | // If `ref` is missing, return an error
146 | if (!ref) {
147 | core.setFailed(ACTION_ERROR);
148 | return;
149 | }
150 |
151 | // Extract all components from `private-action` input parameter
152 | const [ org, repo, path ] = repoParts.split('/');
153 |
154 | // If `org` or `repo` is missing, return an error
155 | if (!org || !repo) {
156 | core.setFailed(ACTION_ERROR);
157 | return;
158 | }
159 |
160 | // Create a random folder name where to checkout the action
161 | const tempFolderName = randomFolderName();
162 |
163 | try {
164 | // Generate repository URL for the action to checkout
165 | const url = `https://${token}:x-oauth-basic@github.com/${org}/${repo}.git`;
166 |
167 | // Clone the action repository
168 | await cloneRepository(tempFolderName, url);
169 |
170 | // Checkout the reference
171 | await checkout(tempFolderName, ref);
172 |
173 | // Set the expected path for the `action.yml` file
174 | const actionFileFolder = [tempFolderName, path].filter(p => p).join('/');
175 |
176 | // Execute the action
177 | await executeAction(actionFileFolder);
178 | } catch (err) {
179 | core.setFailed(err);
180 | } finally {
181 | // Cleanup
182 | deleteFolder(tempFolderName);
183 | }
184 | }
185 |
186 | // Start the execution
187 | checkoutCode();
188 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es6",
4 | "module": "commonjs",
5 | "outDir": "./dist",
6 | "rootDir": "./src",
7 | "strict": true,
8 | "noImplicitAny": false,
9 | "esModuleInterop": true
10 | },
11 | "exclude": ["node_modules", "**/*.spec.ts", "**/*.test.ts"]
12 | }
--------------------------------------------------------------------------------