From 018a5f09ca45afeb6a10eb4409ada191598e5fb2 Mon Sep 17 00:00:00 2001 From: alechp Date: Mon, 15 Jul 2019 15:05:15 -0700 Subject: [PATCH 1/8] Protato using json for config > require warning is gone since switching to fs.readJson --- .protato.js | 17 ----------------- .protato.json | 15 +++++++++++++++ build/main.js | 2 +- build/main.js.map | 2 +- src/index.js | 42 +++++++++++++++++++++--------------------- src/linker.js | 6 ++++-- src/parser.js | 13 +++++-------- src/utilities.js | 5 +++++ 8 files changed, 52 insertions(+), 50 deletions(-) delete mode 100644 .protato.js create mode 100644 .protato.json diff --git a/.protato.js b/.protato.js deleted file mode 100644 index b0da72e..0000000 --- a/.protato.js +++ /dev/null @@ -1,17 +0,0 @@ -export const config = { - parent: { - dir: "sandbox/node-starter" - }, - children: [ - { - dir: "sandbox/npm-starter-sample-module", - src: "src" - }, - { - dir: "sandbox/library-genesis", - src: "src" - } - ] -}; - -//TODO: Make "src" default in the parser diff --git a/.protato.json b/.protato.json new file mode 100644 index 0000000..0c0e74d --- /dev/null +++ b/.protato.json @@ -0,0 +1,15 @@ +{ + "parent": { + "dir": "sandbox/node-starter" + }, + "children": [ + { + "dir": "sandbox/npm-starter-sample-module", + "src": "src" + }, + { + "dir": "sandbox/library-genesis", + "src": "src" + } + ] +} diff --git a/build/main.js b/build/main.js index e721fb5..af099c2 100644 --- a/build/main.js +++ b/build/main.js @@ -1,2 +1,2 @@ -!function(e,t){for(var r in t)e[r]=t[r]}(exports,function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=6)}([function(e,t){e.exports=require("tacker")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("chalk")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pathsExistAsync=function(e,t){return new Promise((r=s(regeneratorRuntime.mark(function r(o,a){return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,!Array.isArray(e)){r.next=6;break}e.map(function(){var e=s(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.default.access(t);case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),o([!0].concat(function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t1&&void 0!==g[1]?g[1]:"Path did not exist",!Array.isArray(t)){e.next=37;break}a=t.map(function(e){return"object"==c(e)?Object.values(e).map(function(e){return e}):e}),u=!0,s=!1,p=void 0,e.prev=6,f=a[Symbol.iterator]();case 8:if(u=(d=f.next()).done){e.next=21;break}return h=d.value,e.prev=10,e.next=13,i.default.access(h);case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(10),l("".concat(n.default.red("Array of paths failed")," ").concat((0,o.printLine)("red")," ").concat(n.default.red(r)," \n ").concat(n.default.grey(e.t0)));case 18:u=!0,e.next=8;break;case 21:e.next=27;break;case 23:e.prev=23,e.t1=e.catch(6),s=!0,p=e.t1;case 27:e.prev=27,e.prev=28,u||null==f.return||f.return();case 30:if(e.prev=30,!s){e.next=33;break}throw p;case 33:return e.finish(30);case 34:return e.finish(27);case 35:e.next=48;break;case 37:if("string"!=typeof t){e.next=48;break}return e.prev=38,e.next=41,i.default.access(t);case 41:e.next=48;break;case 43:e.prev=43,e.t2=e.catch(38),(0,o.printLine)("red"),l("".concat(n.default.red("Single string failed")," \n").concat(n.default.red(r)," \n ").concat(n.default.grey(e.t2))),(0,o.printLine)("red");case 48:case"end":return e.stop()}},e,null,[[6,23,27,35],[10,15],[28,,30,34],[38,43]])}))).apply(this,arguments)}},function(e,t){function r(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}r.keys=function(){return[]},r.resolve=r,e.exports=r,r.id=4},function(e,t){e.exports=require("is-empty")},function(e,t,r){e.exports=r(7)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.init=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:process.env.configRootDir||process.cwd(),s=arguments.length>1?arguments[1]:void 0;if((0,i.default)(s)){var p=n.default.join(t,".protato.js"),f=r(4)(p),d=f.config;e=d,(0,u.pathsExistAsync)(p,".protato.js config not found").then(function(e){(0,c.printMirror)({resp:e},"magenta","grey");var t=r(4)(p),n=t.config;(0,c.printLine)("blue"),(0,c.printMirror)({protatoPath:p},"blue","grey"),(0,c.printMirror)({config:n},"blue","grey"),(0,c.printLine)("blue")}).catch(function(e){l("init failed\n ".concat(e))})}else e=s,(0,c.printLine)("green"),(0,c.printMirror)({oConfig:e},"green","grey"),(0,c.printLine)("green");var h=(0,o.getWatcherConfig)(e);(0,a.initWatcher)(h).getDirectories()};var n=s(r(1)),i=s(r(5)),o=r(8),a=r(10),c=r(0),u=r(3);function s(e){return e&&e.__esModule?e:{default:e}}var l=console.log},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getWatcherConfig=t.PTOParser=void 0;var n=c(r(1)),i=c(r(2)),o=r(0),a=r(3);function c(e){return e&&e.__esModule?e:{default:e}}var u=console.log;function s(e){var t=e.parent,r=e.children;return(0,o.printLine)("yellow"),u("".concat(i.default.yellow("parent")," and ").concat(i.default.yellow("children")," objects were both found")),(0,o.printMirror)({parent:t},"yellow","grey"),(0,o.printMirror)({children:r},"yellow","grey"),(0,o.printLine)("yellow"),this.watcher={targets:void 0,options:void 0,parent:t},this.config=e,this.config.children=e.children,this}s.prototype.getWatcherTargets=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.children,t=e.map(function(e){var t=e.dir,r=e.src,i=process.env.configRootDir||process.cwd(),o=n.default.join(i,t,r),c=n.default.join(i,t,"package.json"),u=[o,c];return(0,a.pathsExistSync)(u,"getWatcherTargets' directory and package path check"),{childDirPath:o,childPackagePath:c}});return this.watcher.targets=t,void 0!==this.watcher.targets?((0,o.printLine)("yellow"),u("".concat(i.default.yellow("watcher targets")," are defined \n")),(0,o.printMirror)({targets:t},"yellow","grey"),(0,o.printLine)("yellow",null,null,2)):((0,o.printLine)("red"),(0,o.printMirror)({targets:t},"red","white"),(0,o.printLine)("red")),this},s.prototype.getWatcherOptions=function(){var e=[];return(0,o.printLine)("green"),this.config.children.map(function(t){var r,i,c=t.dir;(0,o.printMirror)({dir:c},"green","grey"),e.push((r=c,i=n.default.join(r,"node_modules"),(0,a.pathsExistSync)(i,"getWatcherOptions -> getChildNodeModulesPath() path check"),i))}),(0,o.printLine)({character:".",color:"green"}),(0,o.printMirror)({childrenDirectoriesToIgnore:e},"green","grey"),(0,o.printLine)("green"),this.watcher.options={cwd:process.env.configRootDir||process.cwd(),ignored:["node_modules/**/*"].concat(e),ignoreInitial:!0,ignorePermissionErrors:!0,followSymlinks:!0},this},t.PTOParser=s,t.getWatcherConfig=function(e){var t=new s(e);t.getWatcherTargets().getWatcherOptions();var r=t.watcher,n=r.targets,a=r.options,c=r.parent;return(0,o.printLine)("yellow"),(0,o.printMirror)({targets:n},"yellow","grey"),u("".concat(i.default.yellow("options"),": ").concat(i.default.grey(JSON.stringify(a,null,2)))),(0,o.printLine)("yellow"),{parent:c,targets:n,options:a}}},function(e,t){e.exports=require("fs-extra")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PTOWatcher=p,t.initWatcher=function(e){var t=new p(e);return t.getDirectories().createWatcher(),t};var n,i=r(11),o=(n=i)&&n.__esModule?n:{default:n},a=r(3),c=r(0),u=r(12);function s(e,t){var r=Object.keys(e);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e)),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}process.env.configRootDir||process.cwd();function p(e){return(0,c.printMirror)({oWatcherConfig:e},"blue","grey"),(0,a.pathsExistSync)(e.targets),this.parent=e.parent,this.targets=e.targets,this.options=e.options,this.directoriesToWatch=[],this.packagesToWatch=[],this}p.prototype.getDirectories=function(){var e=this,t=this.targets;return(0,c.printLine)("blue"),t.map(function(t){var r=t.childDirPath,n=t.childPackagePath;(0,c.printMirror)({childDirPath:r},"blue","grey"),(0,c.printMirror)({childPackagePath:n},"blue","grey"),e.directoriesToWatch.push(r),e.packagesToWatch.push(n)}),(0,c.printLine)("blue"),this},p.prototype.createWatcher=function(){var e,t=this,r=this.directoriesToWatch,n=this.options;if((0,a.pathsExistSync)(r),(0,c.printMirror)({directoriesToWatch:r},"blue","grey"),r.length>0&&(e=o.default.watch(r[0],function(e){for(var t=1;t1)for(var i=1;i1&&void 0!==g[1]?g[1]:"Path did not exist",!Array.isArray(r)){e.next=37;break}a=r.map(function(e){return"object"==c(e)?Object.values(e).map(function(e){return e}):e}),u=!0,s=!1,p=void 0,e.prev=6,f=a[Symbol.iterator]();case 8:if(u=(d=f.next()).done){e.next=21;break}return h=d.value,e.prev=10,e.next=13,i.default.access(h);case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(10),l("".concat(n.default.red("Array of paths failed")," ").concat((0,o.printLine)("red")," ").concat(n.default.red(t)," \n ").concat(n.default.grey(e.t0)));case 18:u=!0,e.next=8;break;case 21:e.next=27;break;case 23:e.prev=23,e.t1=e.catch(6),s=!0,p=e.t1;case 27:e.prev=27,e.prev=28,u||null==f.return||f.return();case 30:if(e.prev=30,!s){e.next=33;break}throw p;case 33:return e.finish(30);case 34:return e.finish(27);case 35:e.next=48;break;case 37:if("string"!=typeof r){e.next=48;break}return e.prev=38,e.next=41,i.default.access(r);case 41:e.next=48;break;case 43:e.prev=43,e.t2=e.catch(38),(0,o.printLine)("red"),l("".concat(n.default.red("Single string failed")," \n").concat(n.default.red(t)," \n ").concat(n.default.grey(e.t2))),(0,o.printLine)("red");case 48:case"end":return e.stop()}},e,null,[[6,23,27,35],[10,15],[28,,30,34],[38,43]])}))).apply(this,arguments)}},function(e,r){e.exports=require("is-empty")},function(e,r,t){e.exports=t(7)},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.init=f;var n=l(t(1)),i=l(t(5)),o=l(t(2)),a=t(8),c=t(9),u=t(0),s=t(4);function l(e){return e&&e.__esModule?e:{default:e}}function p(e,r,t,n,i,o,a){try{var c=e[o](a),u=c.value}catch(e){return void t(e)}c.done?r(u):Promise.resolve(u).then(n,i)}console.log;function f(){return d.apply(this,arguments)}function d(){var e;return e=regeneratorRuntime.mark(function e(){var r,t,l,p,f,d,h,g=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=g.length>0&&void 0!==g[0]?g[0]:process.env.configRootDir||process.cwd(),t=g.length>1?g[1]:void 0,(0,i.default)(t)){e.next=9;break}l=t,(0,u.printLine)("green"),(0,u.printMirror)({oConfig:l},"green","grey"),(0,u.printLine)("green"),e.next=21;break;case 9:return p=n.default.resolve(r,".protato.json"),(0,u.printLine)("green"),(0,u.printMirror)({protatoPath:p},"green","grey"),e.next=14,o.default.readJson(p);case 14:return l=e.sent,e.next=17,(0,s.pathsExistAsync)(p,".protato.json config not found");case 17:f=e.sent,d=f[0],(0,u.printMirror)({protatoPathFlag:d},"green","grey"),(0,u.printLine)("green");case 21:h=(0,a.getWatcherConfig)(l),(0,c.initWatcher)(h).getDirectories();case 24:case"end":return e.stop()}},e)}),(d=function(){var r=this,t=arguments;return new Promise(function(n,i){var o=e.apply(r,t);function a(e){p(o,n,i,a,c,"next",e)}function c(e){p(o,n,i,a,c,"throw",e)}a(void 0)})}).apply(this,arguments)}f()},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getWatcherConfig=r.PTOParser=void 0;var n=c(t(1)),i=c(t(3)),o=t(0),a=t(4);function c(e){return e&&e.__esModule?e:{default:e}}var u=console.log;function s(e){var r=e.parent,t=e.children;return(0,o.printLine)("yellow"),u("".concat(i.default.yellow("parent")," and ").concat(i.default.yellow("children")," objects were both found")),(0,o.printMirror)({parent:r},"yellow","grey"),(0,o.printMirror)({children:t},"yellow","grey"),(0,o.printLine)("yellow"),this.watcher={targets:void 0,options:void 0,parent:r},this.config=e,this.config.children=e.children,this}s.prototype.getWatcherTargets=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.children,r=e.map(function(e){var r=e.dir,t=e.src,i=process.env.configRootDir||process.cwd(),c=n.default.join(i,r,t),u=n.default.join(i,r,"package.json");(0,o.printLine)("magenta"),(0,o.printMirror)({childDirPath:c},"magenta","grey"),(0,o.printMirror)({childPackagePath:u},"magenta","grey"),(0,o.printLine)("magenta");var s=[c,u];return(0,a.pathsExistSync)(s,"getWatcherTargets' directory and package path check"),{childDirPath:c,childPackagePath:u}});return this.watcher.targets=r,void 0!==this.watcher.targets?((0,o.printLine)("yellow"),u("".concat(i.default.yellow("watcher targets")," are defined \n")),(0,o.printMirror)({targets:r},"yellow","grey"),(0,o.printLine)("yellow",null,null,2)):((0,o.printLine)("red"),(0,o.printMirror)({targets:r},"red","white"),(0,o.printLine)("red")),this},s.prototype.getWatcherOptions=function(){var e=[];return(0,o.printLine)("green"),this.config.children.map(function(r){var t,i,c=r.dir;(0,o.printMirror)({dir:c},"green","grey"),e.push((t=c,i=n.default.join(t,"node_modules"),(0,a.pathsExistSync)(i,"getWatcherOptions -> getChildNodeModulesPath() path check"),i))}),(0,o.printLine)({character:".",color:"green"}),(0,o.printMirror)({childrenDirectoriesToIgnore:e},"green","grey"),(0,o.printLine)("green"),this.watcher.options={cwd:process.env.configRootDir||process.cwd(),ignored:["node_modules/**/*"].concat(e),ignoreInitial:!0,ignorePermissionErrors:!0,followSymlinks:!0},this},r.PTOParser=s,r.getWatcherConfig=function(e){var r=new s(e);r.getWatcherTargets().getWatcherOptions();var t=r.watcher,n=t.targets,a=t.options,c=t.parent;return(0,o.printLine)("yellow"),(0,o.printMirror)({targets:n},"yellow","grey"),u("".concat(i.default.yellow("options"),": ").concat(i.default.grey(JSON.stringify(a,null,2)))),(0,o.printLine)("yellow"),{parent:c,targets:n,options:a}}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.PTOWatcher=p,r.initWatcher=function(e){var r=new p(e);return r.getDirectories().createWatcher(),r};var n,i=t(10),o=(n=i)&&n.__esModule?n:{default:n},a=t(4),c=t(0),u=t(11);function s(e,r){var t=Object.keys(e);return Object.getOwnPropertySymbols&&t.push.apply(t,Object.getOwnPropertySymbols(e)),r&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t}function l(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}process.env.configRootDir||process.cwd();function p(e){return(0,c.printMirror)({oWatcherConfig:e},"blue","grey"),(0,a.pathsExistSync)(e.targets),this.parent=e.parent,this.targets=e.targets,this.options=e.options,this.directoriesToWatch=[],this.packagesToWatch=[],this}p.prototype.getDirectories=function(){var e=this,r=this.targets;return(0,c.printLine)("blue"),r.map(function(r){var t=r.childDirPath,n=r.childPackagePath;(0,c.printMirror)({childDirPath:t},"blue","grey"),(0,c.printMirror)({childPackagePath:n},"blue","grey"),e.directoriesToWatch.push(t),e.packagesToWatch.push(n)}),(0,c.printLine)("blue"),this},p.prototype.createWatcher=function(){var e,r=this,t=this.directoriesToWatch,n=this.options;if((0,a.pathsExistSync)(t),(0,c.printMirror)({directoriesToWatch:t},"blue","grey"),t.length>0&&(e=o.default.watch(t[0],function(e){for(var r=1;r1)for(var i=1;i {\n try {\n if (Array.isArray(arrPathsObj)) {\n arrPathsObj.map(async pathToCheck => {\n await fs.access(pathToCheck);\n });\n resolve([true, ...arrPathsObj]);\n } else {\n await fs.access(arrPathsObj);\n resolve([true, arrPathsObj]);\n }\n } catch (err) {\n reject(`${chalk.red(szPreErrorMessage)}: \\n ${chalk.grey(err)}`);\n }\n });\n}\nexport async function pathsExistSync(\n arrPathsObj,\n szPreErrorMessage = \"Path did not exist\"\n) {\n //TODO: Consider adding a return value (or prom) so it can be caught inline\n //TODO: Consider adding option to include printLine & printMirrors for success cases\n //TODO: Convert below into unit test (should pass)\n // let rightPath = [\n // {\n // dir: \"sandbox/npm-starter-sample-module/src\",\n // name: \"npm-starter-sample-module\"\n // }\n // ];\n // pathsExistOrThrow(targets, \"PTOWatcher failed to initialize properly \");\n //TODO: Convert below code into unit test (ie. should throw error)\n // let wrongPathString = \"foo\"\n // let wrongPathArray = [\n // {\n // foo: \"bar\"\n // }\n // ];\n // pathsExistOrThrow(wrongPathArray, \"PTOWatcher failed to initialize properly \");\n // pathsExistOrThrow(wrongPathString, \"PTOWatcher failed to initialize properly \");\n\n if (Array.isArray(arrPathsObj)) {\n let arrFilePaths = arrPathsObj.map(mTarget => {\n if (typeof mTarget == \"object\") {\n // * handle array of objects\n // * (ie. default case; used for testing watcherConfig's \"targets\" array)\n\n return Object.values(mTarget).map(pathToCheck => {\n return pathToCheck;\n });\n } else {\n // * handle array of strings\n // * (ie. manually defined arrays with file paths)\n\n return mTarget;\n }\n });\n for (let pathToCheck of arrFilePaths) {\n // ? Now iterate over the flattened map of paths (all should be strings)\n try {\n await fs.access(pathToCheck);\n } catch (err) {\n log(\n `${chalk.red(\"Array of paths failed\")} ${printLine(\n \"red\"\n )} ${chalk.red(szPreErrorMessage)} \\n ${chalk.grey(err)}`\n );\n }\n }\n } else if (typeof arrPathsObj == \"string\") {\n // ? handle checking path of single string\n try {\n await fs.access(arrPathsObj);\n } catch (err) {\n printLine(\"red\");\n //TODO: Add a getLine() utility so that I can include in the middle of a log without needing to log inside of a log (which doesn't process stdout in proper order)\n log(\n `${chalk.red(\"Single string failed\")} \\n${chalk.red(\n szPreErrorMessage\n )} \\n ${chalk.grey(err)}`\n );\n printLine(\"red\");\n }\n }\n}\n","function webpackEmptyContext(req) {\n\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\te.code = 'MODULE_NOT_FOUND';\n\tthrow e;\n}\nwebpackEmptyContext.keys = function() { return []; };\nwebpackEmptyContext.resolve = webpackEmptyContext;\nmodule.exports = webpackEmptyContext;\nwebpackEmptyContext.id = 4;","module.exports = require(\"is-empty\");","const log = console.log;\nimport path from \"path\";\nimport isEmpty from \"is-empty\";\nimport { getWatcherConfig } from \"./parser\";\nimport { initWatcher } from \"./watcher\";\nimport { printLine, printMirror } from \"tacker\";\nimport { pathsExistAsync } from \"./utilities\";\n\nexport function init(cwd = process.env.configRootDir || process.cwd(), config) {\n let oConfig;\n if (!isEmpty(config)) {\n oConfig = config;\n printLine(\"green\");\n printMirror({ oConfig }, \"green\", \"grey\");\n printLine(\"green\");\n } else {\n let protatoPath = path.join(cwd, \".protato.js\");\n let { config } = require(protatoPath);\n oConfig = config;\n pathsExistAsync(protatoPath, \".protato.js config not found\")\n .then(resp => {\n printMirror({ resp }, \"magenta\", \"grey\");\n let { config } = require(protatoPath);\n\n printLine(\"blue\");\n printMirror({ protatoPath }, \"blue\", \"grey\");\n printMirror({ config }, \"blue\", \"grey\");\n printLine(\"blue\");\n })\n .catch(err => {\n log(`init failed\\n ${err}`);\n });\n }\n let oWC = getWatcherConfig(oConfig);\n let hWatcher = initWatcher(oWC);\n hWatcher.getDirectories();\n}\n\n// init();\nconst inlineConfig = {\n parent: {\n dir: \"sandbox/node-starter\"\n },\n children: [\n {\n dir: \"sandbox/npm-starter-sample-module\",\n src: \"src\"\n },\n {\n dir: \"sandbox/library-genesis\",\n src: \"src\"\n }\n ]\n};\n\n// init();\n// init(process.cwd(), inlineConfig);\n","/*\n * Objective\n 1. Autodetect user config (ie. \".protato.js\")\n 2. Transform user config into: [ watchTargets, watchOptions ]\n 2a. Do this via: getWatcherConfig\n 2ai. Do this via: [getWatchTargets, getWatchOptions]\n*/\n\nconst log = console.log;\nimport path from \"path\";\nimport chalk from \"chalk\";\nimport { printLine, printMirror } from \"tacker\";\nimport { pathsExistSync } from \"./utilities\";\n\nfunction PTOParser(config) {\n const { parent, children } = config;\n printLine(\"yellow\");\n log(\n `${chalk.yellow(\"parent\")} and ${chalk.yellow(\n \"children\"\n )} objects were both found`\n );\n printMirror({ parent }, \"yellow\", \"grey\");\n printMirror({ children }, \"yellow\", \"grey\");\n printLine(\"yellow\");\n\n this.watcher = { targets: undefined, options: undefined, parent };\n this.config = config;\n this.config.children = config.children;\n return this;\n}\n\nPTOParser.prototype.getWatcherTargets = function getWatcherTargets(\n children = this.config.children\n) {\n let targets = children.map(oChild => {\n let { dir, src } = oChild;\n let rootDir = process.env.configRootDir || process.cwd();\n let childDirPath = path.join(rootDir, dir, src);\n let childPackagePath = path.join(rootDir, dir, \"package.json\");\n let pathsToCheck = [childDirPath, childPackagePath];\n\n pathsExistSync(\n pathsToCheck,\n \"getWatcherTargets' directory and package path check\"\n );\n return { childDirPath, childPackagePath };\n });\n this.watcher.targets = targets;\n if (this.watcher.targets !== undefined) {\n printLine(\"yellow\");\n log(`${chalk.yellow(\"watcher targets\")} are defined \\n`);\n printMirror({ targets }, \"yellow\", \"grey\");\n printLine(\"yellow\", null, null, 2);\n } else {\n printLine(\"red\");\n printMirror({ targets }, \"red\", \"white\");\n printLine(\"red\");\n }\n return this;\n};\n\nPTOParser.prototype.getWatcherOptions = function getWatcherOptions() {\n let childrenDirectoriesToIgnore = [];\n\n function getChildNodeModulesPath(szChildTargetPath) {\n let potentialPath = path.join(szChildTargetPath, \"node_modules\");\n pathsExistSync(\n potentialPath,\n \"getWatcherOptions -> getChildNodeModulesPath() path check\"\n );\n return potentialPath;\n }\n\n printLine(\"green\");\n this.config.children.map(child => {\n const { dir } = child;\n printMirror({ dir }, \"green\", \"grey\");\n\n childrenDirectoriesToIgnore.push(getChildNodeModulesPath(dir));\n });\n\n printLine({ character: \".\", color: \"green\" });\n printMirror({ childrenDirectoriesToIgnore }, \"green\", \"grey\");\n printLine(\"green\");\n\n this.watcher.options = {\n cwd: process.env.configRootDir || process.cwd(),\n ignored: [\"node_modules/**/*\", ...childrenDirectoriesToIgnore],\n ignoreInitial: true,\n ignorePermissionErrors: true,\n followSymlinks: true\n };\n return this;\n};\n\nfunction getWatcherConfig(oConfig) {\n let parser = new PTOParser(oConfig);\n parser.getWatcherTargets().getWatcherOptions();\n\n const {\n watcher: { targets, options, parent }\n } = parser;\n\n printLine(\"yellow\");\n printMirror({ targets }, \"yellow\", \"grey\");\n log(\n `${chalk.yellow(\"options\")}: ${chalk.grey(\n JSON.stringify(options, null, 2)\n )}`\n );\n printLine(\"yellow\");\n return {\n parent,\n targets,\n options\n };\n}\n\nexport { PTOParser, getWatcherConfig };\n","module.exports = require(\"fs-extra\");","import chokidar from \"chokidar\";\nimport { pathsExistSync } from \"./utilities\";\nimport { printLine, printMirror } from \"tacker\";\nimport { linker } from \"./linker\";\n\nconst sampleConfig = {\n parent: {\n dir: \"sandbox/node-starter\"\n },\n targets: [\n {\n childDirPath: \"sandbox/npm-starter-sample-module/src\",\n childPackagePath: \"sandbox/npm-starter-sample-module/package.json\"\n }\n ],\n options: {\n cwd: process.env.configRootDir || process.cwd(),\n ignored: [\n \"node_modules\",\n \"sandbox/npm-starter-sample-module/node_modules\",\n \"sandbox/npm-starter-sample-module/.git\"\n ],\n ignoreInitial: true,\n ignorePermissionErrors: true,\n followSymlinks: true\n }\n};\n\nexport function PTOWatcher(oWatcherConfig) {\n printMirror({ oWatcherConfig }, \"blue\", \"grey\");\n pathsExistSync(oWatcherConfig.targets);\n this.parent = oWatcherConfig.parent;\n this.targets = oWatcherConfig.targets;\n this.options = oWatcherConfig.options;\n this.directoriesToWatch = [];\n this.packagesToWatch = [];\n\n return this;\n}\n\nPTOWatcher.prototype.getDirectories = function getDirectories() {\n let { targets } = this;\n printLine(\"blue\");\n targets.map(({ childDirPath, childPackagePath }) => {\n printMirror({ childDirPath }, \"blue\", \"grey\");\n printMirror({ childPackagePath }, \"blue\", \"grey\");\n this.directoriesToWatch.push(childDirPath);\n this.packagesToWatch.push(childPackagePath);\n });\n printLine(\"blue\");\n return this;\n};\n\nPTOWatcher.prototype.createWatcher = function createWatcher() {\n const { directoriesToWatch, options } = this;\n pathsExistSync(directoriesToWatch);\n printMirror({ directoriesToWatch }, \"blue\", \"grey\");\n var watcher;\n //TODO: Add a new sample repo to repogen\n //TODO: Create backup config to test whether this works with 2+ directories\n if (directoriesToWatch.length > 0) {\n watcher = chokidar.watch(directoriesToWatch[0], { ...options });\n }\n if (directoriesToWatch.length > 1) {\n for (let i = 1; i < directoriesToWatch.length; i++) {\n watcher.add(directoriesToWatch[i]);\n }\n }\n watcher.on(\"change\", modifiedChildPath => {\n printMirror({ modifiedChildPath }, \"green\", \"grey\");\n linker(modifiedChildPath, this.parent.dir);\n });\n};\n\nexport function initWatcher(oWatcherConfig) {\n let watcher = new PTOWatcher(oWatcherConfig);\n watcher.getDirectories().createWatcher();\n return watcher;\n}\n","module.exports = require(\"chokidar\");","const log = console.log;\nimport chalk from \"chalk\";\nimport path from \"path\";\nimport isEmpty from \"is-empty\";\nimport pkgDir from \"pkg-dir\";\nimport exec from \"await-exec\";\n\nimport { printLine, printMirror } from \"tacker\";\n\n//TODO: Try using yalc instead\n//TODO: Check to see whether yalc installed globally. If not, install. If install fails, throw err & explain\n\nexport async function linker(szModifiedFilePath, szParentDirPath) {\n if (!isEmpty(szModifiedFilePath) | !isEmpty(szParentDirPath)) {\n printMirror({ szModifiedFilePath }, \"magenta\", \"grey\");\n printMirror({ szParentDirPath }, \"magenta\", \"grey\");\n let childData, parentData, childModuleName;\n try {\n let modifiedRootDir = await pkgDir(szModifiedFilePath);\n printLine(\"blue\");\n printMirror({ modifiedRootDir }, \"magenta\", \"green\");\n let modifiedPkgPath = path.join(modifiedRootDir, \"package.json\");\n printMirror({ modifiedPkgPath }, \"magenta\", \"green\");\n const { name } = require(modifiedPkgPath);\n childModuleName = name;\n printMirror({ childModuleName }, \"blue\", \"grey\");\n printLine(\"blue\");\n childData = await exec(`cd ${modifiedRootDir} && yalc publish`);\n printLine(\"green\");\n log(`childData: ${JSON.stringify(childData, null, 2)}`);\n printLine(\"green\");\n } catch (err) {\n log(`${chalk.red(\"'yalc publish' failed\")}\\n${chalk.grey(err)}`);\n }\n\n try {\n let parentRootDir = await pkgDir(szParentDirPath);\n printMirror({ parentRootDir }, \"magenta\", \"green\");\n parentData = await exec(\n `cd ${parentRootDir} && yalc link ${childModuleName}`\n );\n printLine(\"yellow\");\n log(`parentData: ${JSON.stringify(parentData, null, 2)}`);\n printLine(\"yellow\");\n } catch (err) {\n log(\n `${chalk.red(\n `yalc add ${childModuleName} in ${chalk.yellow(parentRootDir)} failed`\n )}\\n${chalk.grey(err)}`\n );\n }\n } else {\n printLine(\"green\");\n log(`parentDirectory not set`);\n printLine(\"green\");\n }\n return this;\n}\n","module.exports = require(\"pkg-dir\");","module.exports = require(\"await-exec\");"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"tacker\"","webpack:///external \"path\"","webpack:///external \"fs-extra\"","webpack:///external \"chalk\"","webpack:///./src/utilities.js","webpack:///external \"is-empty\"","webpack:///./src/index.js","webpack:///./src/parser.js","webpack:///./src/watcher.js","webpack:///external \"chokidar\"","webpack:///./src/linker.js","webpack:///external \"pkg-dir\"","webpack:///external \"await-exec\""],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","require","pathsExistAsync","arrPathsObj","szPreErrorMessage","Promise","_ref","_asyncToGenerator","regeneratorRuntime","mark","_callee2","resolve","reject","wrap","_context2","prev","next","Array","isArray","map","_ref2","_callee","pathToCheck","_context","fs","access","stop","_x3","apply","this","arguments","concat","t0","chalk","red","grey","_x","_x2","pathsExistSync","_tacker","log","console","_callee3","arrFilePaths","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","_step","_args3","_context3","length","undefined","mTarget","_typeof","values","iterator","done","printLine","t1","return","finish","t2","init","_parser","_watcher","_utilities","cwd","oConfigOverride","oConfig","protatoPath","pathInfo","protatoPathFlag","oWC","_args","process","env","configRootDir","_isEmpty2","default","printMirror","path","readJson","sent","getWatcherConfig","initWatcher","getDirectories","PTOParser","config","parent","children","yellow","watcher","targets","options","getWatcherTargets","oChild","dir","src","rootDir","childDirPath","join","childPackagePath","pathsToCheck","getWatcherOptions","childrenDirectoriesToIgnore","child","szChildTargetPath","potentialPath","push","character","color","ignored","ignoreInitial","ignorePermissionErrors","followSymlinks","parser","_parser$watcher","JSON","stringify","PTOWatcher","oWatcherConfig","createWatcher","_chokidar","_linker","directoriesToWatch","packagesToWatch","_this","_this2","chokidar","watch","_objectSpread","add","on","modifiedChildPath","linker","szModifiedFilePath","szParentDirPath","childData","parentData","childModuleName","modifiedRootDir","modifiedPkgPath","_parentRootDir","_pkgDir2","_awaitExec2","parentRootDir","abrupt"],"mappings":"6DACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EA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4D,MA+BD,EAAA5C,EAAAmB,WAAU,UACVlB,EAAG,eAAAT,OAAgBuF,KAAKC,UAAUoB,EAAY,KAAM,MACpD,EAAApG,EAAAmB,WAAU,UAjCTnC,EAAAP,KAAA,iBAAAO,EAAAR,KAAA,GAAAQ,EAAAoC,GAAApC,EAAA,UAmCDiB,EAAG,GAAAT,OACEE,UAAMC,IAAN,YAAAH,OACW6G,EADX,QAAA7G,OACiCE,UAAM0D,OAAOuD,eAD9C,YADF,MAAAnH,OAGKE,UAAME,KAANZ,EAAAoC,MAtCP,QAAApC,EAAAP,KAAA,kBA0CH,EAAAuB,EAAAmB,WAAU,SACVlB,EAAG,4BACH,EAAAD,EAAAmB,WAAU,SA5CP,eAAAnC,EAAA4H,OAAA,SA8CEtH,MA9CF,yBAAAN,EAAAG,SAAAL,EAAAQ,KAAA,0OCZP7D,EAAAD,QAAAkC,QAAA,0BCAAjC,EAAAD,QAAAkC,QAAA","file":"main.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n","module.exports = require(\"tacker\");","module.exports = require(\"path\");","module.exports = require(\"fs-extra\");","module.exports = require(\"chalk\");","import chalk from \"chalk\";\nimport fs from \"fs-extra\";\nimport { printLine } from \"tacker\";\nconst log = console.log;\n\nexport function pathsExistAsync(arrPathsObj, szPreErrorMessage) {\n return new Promise(async (resolve, reject) => {\n try {\n if (Array.isArray(arrPathsObj)) {\n arrPathsObj.map(async pathToCheck => {\n await fs.access(pathToCheck);\n });\n resolve([true, ...arrPathsObj]);\n } else {\n await fs.access(arrPathsObj);\n resolve([true, arrPathsObj]);\n }\n } catch (err) {\n reject(`${chalk.red(szPreErrorMessage)}: \\n ${chalk.grey(err)}`);\n }\n });\n}\nexport async function pathsExistSync(\n arrPathsObj,\n szPreErrorMessage = \"Path did not exist\"\n) {\n //TODO: Consider adding a return value (or prom) so it can be caught inline\n //TODO: Consider adding option to include printLine & printMirrors for success cases\n //TODO: Convert below into unit test (should pass)\n // let rightPath = [\n // {\n // dir: \"sandbox/npm-starter-sample-module/src\",\n // name: \"npm-starter-sample-module\"\n // }\n // ];\n // pathsExistOrThrow(targets, \"PTOWatcher failed to initialize properly \");\n //TODO: Convert below code into unit test (ie. should throw error)\n // let wrongPathString = \"foo\"\n // let wrongPathArray = [\n // {\n // foo: \"bar\"\n // }\n // ];\n // pathsExistOrThrow(wrongPathArray, \"PTOWatcher failed to initialize properly \");\n // pathsExistOrThrow(wrongPathString, \"PTOWatcher failed to initialize properly \");\n\n if (Array.isArray(arrPathsObj)) {\n let arrFilePaths = arrPathsObj.map(mTarget => {\n if (typeof mTarget == \"object\") {\n // * handle array of objects\n // * (ie. default case; used for testing watcherConfig's \"targets\" array)\n\n return Object.values(mTarget).map(pathToCheck => {\n return pathToCheck;\n });\n } else {\n // * handle array of strings\n // * (ie. manually defined arrays with file paths)\n\n return mTarget;\n }\n });\n for (let pathToCheck of arrFilePaths) {\n // ? Now iterate over the flattened map of paths (all should be strings)\n try {\n await fs.access(pathToCheck);\n } catch (err) {\n /*\n TODO: Figure out why this is being thrown\n ? Array of paths failed ----------------------------------------------------------- Path did not exist\n ? TypeError [ERR_INVALID_ARG_TYPE]: The \"path\" argument must be one of type string, Buffer, or URL. Received type object\n */\n log(\n `${chalk.red(\"Array of paths failed\")} ${printLine(\n \"red\"\n )} ${chalk.red(szPreErrorMessage)} \\n ${chalk.grey(err)}`\n );\n }\n }\n } else if (typeof arrPathsObj == \"string\") {\n // ? handle checking path of single string\n try {\n await fs.access(arrPathsObj);\n } catch (err) {\n printLine(\"red\");\n //TODO: Add a getLine() utility so that I can include in the middle of a log without needing to log inside of a log (which doesn't process stdout in proper order)\n log(\n `${chalk.red(\"Single string failed\")} \\n${chalk.red(\n szPreErrorMessage\n )} \\n ${chalk.grey(err)}`\n );\n printLine(\"red\");\n }\n }\n}\n","module.exports = require(\"is-empty\");","const log = console.log;\nimport path from \"path\";\nimport isEmpty from \"is-empty\";\nimport fs from \"fs-extra\";\nimport { getWatcherConfig } from \"./parser\";\nimport { initWatcher } from \"./watcher\";\nimport { printLine, printMirror } from \"tacker\";\nimport { pathsExistAsync } from \"./utilities\";\n\nexport async function init(\n cwd = process.env.configRootDir || process.cwd(),\n oConfigOverride\n) {\n let oConfig;\n if (!isEmpty(oConfigOverride)) {\n oConfig = oConfigOverride;\n printLine(\"green\");\n printMirror({ oConfig }, \"green\", \"grey\");\n printLine(\"green\");\n } else {\n let protatoPath = path.resolve(cwd, \".protato.json\");\n printLine(\"green\");\n printMirror({ protatoPath }, \"green\", \"grey\");\n //TODO: Change to fs.readJsonSync\n // let { config } = require(protatoPath);\n oConfig = await fs.readJson(protatoPath);\n let pathInfo = await pathsExistAsync(\n protatoPath,\n \".protato.json config not found\"\n );\n let protatoPathFlag = pathInfo[0];\n printMirror({ protatoPathFlag }, \"green\", \"grey\");\n printLine(\"green\");\n }\n let oWC = getWatcherConfig(oConfig);\n let hWatcher = initWatcher(oWC);\n hWatcher.getDirectories();\n}\n\nconst inlineConfig = {\n parent: {\n dir: \"sandbox/node-starter\"\n },\n children: [\n {\n dir: \"sandbox/npm-starter-sample-module\",\n src: \"src\"\n },\n {\n dir: \"sandbox/library-genesis\",\n src: \"src\"\n }\n ]\n};\n\ninit();\n// init(process.cwd(), inlineConfig);\n","const log = console.log;\nimport path from \"path\";\nimport chalk from \"chalk\";\nimport { printLine, printMirror } from \"tacker\";\nimport { pathsExistSync } from \"./utilities\";\n\nfunction PTOParser(config) {\n const { parent, children } = config;\n printLine(\"yellow\");\n log(\n `${chalk.yellow(\"parent\")} and ${chalk.yellow(\n \"children\"\n )} objects were both found`\n );\n printMirror({ parent }, \"yellow\", \"grey\");\n printMirror({ children }, \"yellow\", \"grey\");\n printLine(\"yellow\");\n\n this.watcher = { targets: undefined, options: undefined, parent };\n this.config = config;\n this.config.children = config.children;\n return this;\n}\n\nPTOParser.prototype.getWatcherTargets = function getWatcherTargets(\n children = this.config.children\n) {\n let targets = children.map(oChild => {\n let { dir, src } = oChild;\n let rootDir = process.env.configRootDir || process.cwd();\n let childDirPath = path.join(rootDir, dir, src);\n let childPackagePath = path.join(rootDir, dir, \"package.json\");\n\n printLine(\"magenta\");\n printMirror({ childDirPath }, \"magenta\", \"grey\");\n printMirror({ childPackagePath }, \"magenta\", \"grey\");\n printLine(\"magenta\");\n let pathsToCheck = [childDirPath, childPackagePath];\n\n pathsExistSync(\n pathsToCheck,\n \"getWatcherTargets' directory and package path check\"\n );\n return { childDirPath, childPackagePath };\n });\n this.watcher.targets = targets;\n if (this.watcher.targets !== undefined) {\n printLine(\"yellow\");\n log(`${chalk.yellow(\"watcher targets\")} are defined \\n`);\n printMirror({ targets }, \"yellow\", \"grey\");\n printLine(\"yellow\", null, null, 2);\n } else {\n printLine(\"red\");\n printMirror({ targets }, \"red\", \"white\");\n printLine(\"red\");\n }\n return this;\n};\n\nPTOParser.prototype.getWatcherOptions = function getWatcherOptions() {\n let childrenDirectoriesToIgnore = [];\n\n function getChildNodeModulesPath(szChildTargetPath) {\n let potentialPath = path.join(szChildTargetPath, \"node_modules\");\n pathsExistSync(\n potentialPath,\n \"getWatcherOptions -> getChildNodeModulesPath() path check\"\n );\n return potentialPath;\n }\n\n printLine(\"green\");\n this.config.children.map(child => {\n const { dir } = child;\n printMirror({ dir }, \"green\", \"grey\");\n\n childrenDirectoriesToIgnore.push(getChildNodeModulesPath(dir));\n });\n\n printLine({ character: \".\", color: \"green\" });\n printMirror({ childrenDirectoriesToIgnore }, \"green\", \"grey\");\n printLine(\"green\");\n\n this.watcher.options = {\n cwd: process.env.configRootDir || process.cwd(),\n ignored: [\"node_modules/**/*\", ...childrenDirectoriesToIgnore],\n ignoreInitial: true,\n ignorePermissionErrors: true,\n followSymlinks: true\n };\n return this;\n};\n\nfunction getWatcherConfig(oConfig) {\n let parser = new PTOParser(oConfig);\n parser.getWatcherTargets().getWatcherOptions();\n\n const {\n watcher: { targets, options, parent }\n } = parser;\n\n printLine(\"yellow\");\n printMirror({ targets }, \"yellow\", \"grey\");\n log(\n `${chalk.yellow(\"options\")}: ${chalk.grey(\n JSON.stringify(options, null, 2)\n )}`\n );\n printLine(\"yellow\");\n return {\n parent,\n targets,\n options\n };\n}\n\nexport { PTOParser, getWatcherConfig };\n","import chokidar from \"chokidar\";\nimport { pathsExistSync } from \"./utilities\";\nimport { printLine, printMirror } from \"tacker\";\nimport { linker } from \"./linker\";\n\nconst sampleConfig = {\n parent: {\n dir: \"sandbox/node-starter\"\n },\n targets: [\n {\n childDirPath: \"sandbox/npm-starter-sample-module/src\",\n childPackagePath: \"sandbox/npm-starter-sample-module/package.json\"\n }\n ],\n options: {\n cwd: process.env.configRootDir || process.cwd(),\n ignored: [\n \"node_modules\",\n \"sandbox/npm-starter-sample-module/node_modules\",\n \"sandbox/npm-starter-sample-module/.git\"\n ],\n ignoreInitial: true,\n ignorePermissionErrors: true,\n followSymlinks: true\n }\n};\n\nexport function PTOWatcher(oWatcherConfig) {\n printMirror({ oWatcherConfig }, \"blue\", \"grey\");\n pathsExistSync(oWatcherConfig.targets);\n this.parent = oWatcherConfig.parent;\n this.targets = oWatcherConfig.targets;\n this.options = oWatcherConfig.options;\n this.directoriesToWatch = [];\n this.packagesToWatch = [];\n\n return this;\n}\n\nPTOWatcher.prototype.getDirectories = function getDirectories() {\n let { targets } = this;\n printLine(\"blue\");\n targets.map(({ childDirPath, childPackagePath }) => {\n printMirror({ childDirPath }, \"blue\", \"grey\");\n printMirror({ childPackagePath }, \"blue\", \"grey\");\n this.directoriesToWatch.push(childDirPath);\n this.packagesToWatch.push(childPackagePath);\n });\n printLine(\"blue\");\n return this;\n};\n\nPTOWatcher.prototype.createWatcher = function createWatcher() {\n const { directoriesToWatch, options } = this;\n pathsExistSync(directoriesToWatch);\n printMirror({ directoriesToWatch }, \"blue\", \"grey\");\n var watcher;\n //TODO: Add a new sample repo to repogen\n //TODO: Create backup config to test whether this works with 2+ directories\n if (directoriesToWatch.length > 0) {\n watcher = chokidar.watch(directoriesToWatch[0], { ...options });\n }\n if (directoriesToWatch.length > 1) {\n for (let i = 1; i < directoriesToWatch.length; i++) {\n watcher.add(directoriesToWatch[i]);\n }\n }\n watcher.on(\"change\", modifiedChildPath => {\n printMirror({ modifiedChildPath }, \"green\", \"grey\");\n linker(modifiedChildPath, this.parent.dir);\n });\n};\n\nexport function initWatcher(oWatcherConfig) {\n let watcher = new PTOWatcher(oWatcherConfig);\n watcher.getDirectories().createWatcher();\n return watcher;\n}\n","module.exports = require(\"chokidar\");","const log = console.log;\nimport chalk from \"chalk\";\nimport path from \"path\";\nimport isEmpty from \"is-empty\";\nimport pkgDir from \"pkg-dir\";\nimport exec from \"await-exec\";\nimport fs from \"fs-extra\";\n\nimport { printLine, printMirror } from \"tacker\";\n\n//TODO: Check to see whether yalc installed globally. If not, install. If install fails, throw err & explain\n\nexport async function linker(szModifiedFilePath, szParentDirPath) {\n if (!isEmpty(szModifiedFilePath) | !isEmpty(szParentDirPath)) {\n printMirror({ szModifiedFilePath }, \"magenta\", \"grey\");\n printMirror({ szParentDirPath }, \"magenta\", \"grey\");\n let childData, parentData, childModuleName;\n try {\n let modifiedRootDir = await pkgDir(szModifiedFilePath);\n printLine(\"blue\");\n printMirror({ modifiedRootDir }, \"magenta\", \"green\");\n let modifiedPkgPath = path.join(modifiedRootDir, \"package.json\");\n printMirror({ modifiedPkgPath }, \"magenta\", \"green\");\n //TODO: Change to fs.readJsonSync\n const { name } = await fs.readJson(modifiedPkgPath);\n // const { name } = require(modifiedPkgPath);\n childModuleName = name;\n printMirror({ childModuleName }, \"blue\", \"grey\");\n printLine(\"blue\");\n childData = await exec(`cd ${modifiedRootDir} && yalc publish`);\n printLine(\"green\");\n log(`childData: ${JSON.stringify(childData, null, 2)}`);\n printLine(\"green\");\n } catch (err) {\n log(`${chalk.red(\"'yalc publish' failed\")}\\n${chalk.grey(err)}`);\n }\n\n try {\n let parentRootDir = await pkgDir(szParentDirPath);\n printMirror({ parentRootDir }, \"magenta\", \"green\");\n parentData = await exec(\n `cd ${parentRootDir} && yalc link ${childModuleName}`\n );\n printLine(\"yellow\");\n log(`parentData: ${JSON.stringify(parentData, null, 2)}`);\n printLine(\"yellow\");\n } catch (err) {\n log(\n `${chalk.red(\n `yalc add ${childModuleName} in ${chalk.yellow(parentRootDir)} failed`\n )}\\n${chalk.grey(err)}`\n );\n }\n } else {\n printLine(\"green\");\n log(`parentDirectory not set`);\n printLine(\"green\");\n }\n return this;\n}\n","module.exports = require(\"pkg-dir\");","module.exports = require(\"await-exec\");"],"sourceRoot":""} \ No newline at end of file diff --git a/src/index.js b/src/index.js index c6b5631..e430d63 100644 --- a/src/index.js +++ b/src/index.js @@ -1,42 +1,42 @@ const log = console.log; import path from "path"; import isEmpty from "is-empty"; +import fs from "fs-extra"; import { getWatcherConfig } from "./parser"; import { initWatcher } from "./watcher"; import { printLine, printMirror } from "tacker"; import { pathsExistAsync } from "./utilities"; -export function init(cwd = process.env.configRootDir || process.cwd(), config) { +export async function init( + cwd = process.env.configRootDir || process.cwd(), + oConfigOverride +) { let oConfig; - if (!isEmpty(config)) { - oConfig = config; + if (!isEmpty(oConfigOverride)) { + oConfig = oConfigOverride; printLine("green"); printMirror({ oConfig }, "green", "grey"); printLine("green"); } else { - let protatoPath = path.join(cwd, ".protato.js"); - let { config } = require(protatoPath); - oConfig = config; - pathsExistAsync(protatoPath, ".protato.js config not found") - .then(resp => { - printMirror({ resp }, "magenta", "grey"); - let { config } = require(protatoPath); - - printLine("blue"); - printMirror({ protatoPath }, "blue", "grey"); - printMirror({ config }, "blue", "grey"); - printLine("blue"); - }) - .catch(err => { - log(`init failed\n ${err}`); - }); + let protatoPath = path.resolve(cwd, ".protato.json"); + printLine("green"); + printMirror({ protatoPath }, "green", "grey"); + //TODO: Change to fs.readJsonSync + // let { config } = require(protatoPath); + oConfig = await fs.readJson(protatoPath); + let pathInfo = await pathsExistAsync( + protatoPath, + ".protato.json config not found" + ); + let protatoPathFlag = pathInfo[0]; + printMirror({ protatoPathFlag }, "green", "grey"); + printLine("green"); } let oWC = getWatcherConfig(oConfig); let hWatcher = initWatcher(oWC); hWatcher.getDirectories(); } -// init(); const inlineConfig = { parent: { dir: "sandbox/node-starter" @@ -53,5 +53,5 @@ const inlineConfig = { ] }; -// init(); +init(); // init(process.cwd(), inlineConfig); diff --git a/src/linker.js b/src/linker.js index 1114a85..b537a8b 100644 --- a/src/linker.js +++ b/src/linker.js @@ -4,10 +4,10 @@ import path from "path"; import isEmpty from "is-empty"; import pkgDir from "pkg-dir"; import exec from "await-exec"; +import fs from "fs-extra"; import { printLine, printMirror } from "tacker"; -//TODO: Try using yalc instead //TODO: Check to see whether yalc installed globally. If not, install. If install fails, throw err & explain export async function linker(szModifiedFilePath, szParentDirPath) { @@ -21,7 +21,9 @@ export async function linker(szModifiedFilePath, szParentDirPath) { printMirror({ modifiedRootDir }, "magenta", "green"); let modifiedPkgPath = path.join(modifiedRootDir, "package.json"); printMirror({ modifiedPkgPath }, "magenta", "green"); - const { name } = require(modifiedPkgPath); + //TODO: Change to fs.readJsonSync + const { name } = await fs.readJson(modifiedPkgPath); + // const { name } = require(modifiedPkgPath); childModuleName = name; printMirror({ childModuleName }, "blue", "grey"); printLine("blue"); diff --git a/src/parser.js b/src/parser.js index 0c87d22..f5707e0 100644 --- a/src/parser.js +++ b/src/parser.js @@ -1,11 +1,3 @@ -/* - * Objective - 1. Autodetect user config (ie. ".protato.js") - 2. Transform user config into: [ watchTargets, watchOptions ] - 2a. Do this via: getWatcherConfig - 2ai. Do this via: [getWatchTargets, getWatchOptions] -*/ - const log = console.log; import path from "path"; import chalk from "chalk"; @@ -38,6 +30,11 @@ PTOParser.prototype.getWatcherTargets = function getWatcherTargets( let rootDir = process.env.configRootDir || process.cwd(); let childDirPath = path.join(rootDir, dir, src); let childPackagePath = path.join(rootDir, dir, "package.json"); + + printLine("magenta"); + printMirror({ childDirPath }, "magenta", "grey"); + printMirror({ childPackagePath }, "magenta", "grey"); + printLine("magenta"); let pathsToCheck = [childDirPath, childPackagePath]; pathsExistSync( diff --git a/src/utilities.js b/src/utilities.js index a3b89eb..f26f90c 100644 --- a/src/utilities.js +++ b/src/utilities.js @@ -65,6 +65,11 @@ export async function pathsExistSync( try { await fs.access(pathToCheck); } catch (err) { + /* + TODO: Figure out why this is being thrown + ? Array of paths failed ----------------------------------------------------------- Path did not exist + ? TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be one of type string, Buffer, or URL. Received type object + */ log( `${chalk.red("Array of paths failed")} ${printLine( "red" From 7821a6f4f157da818da19973bf675ce0811b5577 Mon Sep 17 00:00:00 2001 From: alechp Date: Mon, 15 Jul 2019 15:06:19 -0700 Subject: [PATCH 2/8] lodash vuln audit --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3c1eb05..1472c2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5433,9 +5433,9 @@ "dev": true }, "lodash.merge": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.1.tgz", - "integrity": "sha512-AOYza4+Hf5z1/0Hztxpm2/xiPZgi/cjMqdnKTUWTBSKchJlxXXuUSxCCl8rJlf4g6yww/j6mA8nC8Hw/EZWxKQ==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, "log-symbols": { From 4b37f4cf4a535bf73a228da8d48f6fdc94627125 Mon Sep 17 00:00:00 2001 From: alechp Date: Mon, 15 Jul 2019 15:17:55 -0700 Subject: [PATCH 3/8] commented test init --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index e430d63..8f80b9d 100644 --- a/src/index.js +++ b/src/index.js @@ -53,5 +53,5 @@ const inlineConfig = { ] }; -init(); +// init(); // init(process.cwd(), inlineConfig); From 615c5a4cbb0b515080d9c4d6d128947c2b82afb9 Mon Sep 17 00:00:00 2001 From: alechp Date: Mon, 15 Jul 2019 15:18:10 -0700 Subject: [PATCH 4/8] semver --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bf75d0b..95e62dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "protato-lib", - "version": "0.2.3", + "version": "0.2.4", "main": "build/main.js", "license": "MIT", "repository": { From 3905952bfbb6b3fe07a8efa7396604d43ed446de Mon Sep 17 00:00:00 2001 From: alechp Date: Mon, 15 Jul 2019 15:20:42 -0700 Subject: [PATCH 5/8] semver --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 1472c2d..f2486aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "protato-lib", - "version": "0.2.3", + "version": "0.2.4", "lockfileVersion": 1, "requires": true, "dependencies": { From f7f2967856402cae20530fb98ce1064272c522ff Mon Sep 17 00:00:00 2001 From: alechp Date: Mon, 15 Jul 2019 15:29:31 -0700 Subject: [PATCH 6/8] Confirmed init and overridden init working as expected --- build/main.js | 2 +- build/main.js.map | 2 +- src/index.js | 17 +++++++++-------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/build/main.js b/build/main.js index af099c2..d5a2da9 100644 --- a/build/main.js +++ b/build/main.js @@ -1,2 +1,2 @@ -!function(e,r){for(var t in r)e[t]=r[t]}(exports,function(e){var r={};function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var i in e)t.d(n,i,function(r){return e[r]}.bind(null,i));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=6)}([function(e,r){e.exports=require("tacker")},function(e,r){e.exports=require("path")},function(e,r){e.exports=require("fs-extra")},function(e,r){e.exports=require("chalk")},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.pathsExistAsync=function(e,r){return new Promise((t=s(regeneratorRuntime.mark(function t(o,a){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!Array.isArray(e)){t.next=6;break}e.map(function(){var e=s(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.default.access(r);case 2:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}()),o([!0].concat(function(e){if(Array.isArray(e)){for(var r=0,t=new Array(e.length);r1&&void 0!==g[1]?g[1]:"Path did not exist",!Array.isArray(r)){e.next=37;break}a=r.map(function(e){return"object"==c(e)?Object.values(e).map(function(e){return e}):e}),u=!0,s=!1,p=void 0,e.prev=6,f=a[Symbol.iterator]();case 8:if(u=(d=f.next()).done){e.next=21;break}return h=d.value,e.prev=10,e.next=13,i.default.access(h);case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(10),l("".concat(n.default.red("Array of paths failed")," ").concat((0,o.printLine)("red")," ").concat(n.default.red(t)," \n ").concat(n.default.grey(e.t0)));case 18:u=!0,e.next=8;break;case 21:e.next=27;break;case 23:e.prev=23,e.t1=e.catch(6),s=!0,p=e.t1;case 27:e.prev=27,e.prev=28,u||null==f.return||f.return();case 30:if(e.prev=30,!s){e.next=33;break}throw p;case 33:return e.finish(30);case 34:return e.finish(27);case 35:e.next=48;break;case 37:if("string"!=typeof r){e.next=48;break}return e.prev=38,e.next=41,i.default.access(r);case 41:e.next=48;break;case 43:e.prev=43,e.t2=e.catch(38),(0,o.printLine)("red"),l("".concat(n.default.red("Single string failed")," \n").concat(n.default.red(t)," \n ").concat(n.default.grey(e.t2))),(0,o.printLine)("red");case 48:case"end":return e.stop()}},e,null,[[6,23,27,35],[10,15],[28,,30,34],[38,43]])}))).apply(this,arguments)}},function(e,r){e.exports=require("is-empty")},function(e,r,t){e.exports=t(7)},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.init=f;var n=l(t(1)),i=l(t(5)),o=l(t(2)),a=t(8),c=t(9),u=t(0),s=t(4);function l(e){return e&&e.__esModule?e:{default:e}}function p(e,r,t,n,i,o,a){try{var c=e[o](a),u=c.value}catch(e){return void t(e)}c.done?r(u):Promise.resolve(u).then(n,i)}console.log;function f(){return d.apply(this,arguments)}function d(){var e;return e=regeneratorRuntime.mark(function e(){var r,t,l,p,f,d,h,g=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=g.length>0&&void 0!==g[0]?g[0]:process.env.configRootDir||process.cwd(),t=g.length>1?g[1]:void 0,(0,i.default)(t)){e.next=9;break}l=t,(0,u.printLine)("green"),(0,u.printMirror)({oConfig:l},"green","grey"),(0,u.printLine)("green"),e.next=21;break;case 9:return p=n.default.resolve(r,".protato.json"),(0,u.printLine)("green"),(0,u.printMirror)({protatoPath:p},"green","grey"),e.next=14,o.default.readJson(p);case 14:return l=e.sent,e.next=17,(0,s.pathsExistAsync)(p,".protato.json config not found");case 17:f=e.sent,d=f[0],(0,u.printMirror)({protatoPathFlag:d},"green","grey"),(0,u.printLine)("green");case 21:h=(0,a.getWatcherConfig)(l),(0,c.initWatcher)(h).getDirectories();case 24:case"end":return e.stop()}},e)}),(d=function(){var r=this,t=arguments;return new Promise(function(n,i){var o=e.apply(r,t);function a(e){p(o,n,i,a,c,"next",e)}function c(e){p(o,n,i,a,c,"throw",e)}a(void 0)})}).apply(this,arguments)}f()},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getWatcherConfig=r.PTOParser=void 0;var n=c(t(1)),i=c(t(3)),o=t(0),a=t(4);function c(e){return e&&e.__esModule?e:{default:e}}var u=console.log;function s(e){var r=e.parent,t=e.children;return(0,o.printLine)("yellow"),u("".concat(i.default.yellow("parent")," and ").concat(i.default.yellow("children")," objects were both found")),(0,o.printMirror)({parent:r},"yellow","grey"),(0,o.printMirror)({children:t},"yellow","grey"),(0,o.printLine)("yellow"),this.watcher={targets:void 0,options:void 0,parent:r},this.config=e,this.config.children=e.children,this}s.prototype.getWatcherTargets=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.children,r=e.map(function(e){var r=e.dir,t=e.src,i=process.env.configRootDir||process.cwd(),c=n.default.join(i,r,t),u=n.default.join(i,r,"package.json");(0,o.printLine)("magenta"),(0,o.printMirror)({childDirPath:c},"magenta","grey"),(0,o.printMirror)({childPackagePath:u},"magenta","grey"),(0,o.printLine)("magenta");var s=[c,u];return(0,a.pathsExistSync)(s,"getWatcherTargets' directory and package path check"),{childDirPath:c,childPackagePath:u}});return this.watcher.targets=r,void 0!==this.watcher.targets?((0,o.printLine)("yellow"),u("".concat(i.default.yellow("watcher targets")," are defined \n")),(0,o.printMirror)({targets:r},"yellow","grey"),(0,o.printLine)("yellow",null,null,2)):((0,o.printLine)("red"),(0,o.printMirror)({targets:r},"red","white"),(0,o.printLine)("red")),this},s.prototype.getWatcherOptions=function(){var e=[];return(0,o.printLine)("green"),this.config.children.map(function(r){var t,i,c=r.dir;(0,o.printMirror)({dir:c},"green","grey"),e.push((t=c,i=n.default.join(t,"node_modules"),(0,a.pathsExistSync)(i,"getWatcherOptions -> getChildNodeModulesPath() path check"),i))}),(0,o.printLine)({character:".",color:"green"}),(0,o.printMirror)({childrenDirectoriesToIgnore:e},"green","grey"),(0,o.printLine)("green"),this.watcher.options={cwd:process.env.configRootDir||process.cwd(),ignored:["node_modules/**/*"].concat(e),ignoreInitial:!0,ignorePermissionErrors:!0,followSymlinks:!0},this},r.PTOParser=s,r.getWatcherConfig=function(e){var r=new s(e);r.getWatcherTargets().getWatcherOptions();var t=r.watcher,n=t.targets,a=t.options,c=t.parent;return(0,o.printLine)("yellow"),(0,o.printMirror)({targets:n},"yellow","grey"),u("".concat(i.default.yellow("options"),": ").concat(i.default.grey(JSON.stringify(a,null,2)))),(0,o.printLine)("yellow"),{parent:c,targets:n,options:a}}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.PTOWatcher=p,r.initWatcher=function(e){var r=new p(e);return r.getDirectories().createWatcher(),r};var n,i=t(10),o=(n=i)&&n.__esModule?n:{default:n},a=t(4),c=t(0),u=t(11);function s(e,r){var t=Object.keys(e);return Object.getOwnPropertySymbols&&t.push.apply(t,Object.getOwnPropertySymbols(e)),r&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t}function l(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}process.env.configRootDir||process.cwd();function p(e){return(0,c.printMirror)({oWatcherConfig:e},"blue","grey"),(0,a.pathsExistSync)(e.targets),this.parent=e.parent,this.targets=e.targets,this.options=e.options,this.directoriesToWatch=[],this.packagesToWatch=[],this}p.prototype.getDirectories=function(){var e=this,r=this.targets;return(0,c.printLine)("blue"),r.map(function(r){var t=r.childDirPath,n=r.childPackagePath;(0,c.printMirror)({childDirPath:t},"blue","grey"),(0,c.printMirror)({childPackagePath:n},"blue","grey"),e.directoriesToWatch.push(t),e.packagesToWatch.push(n)}),(0,c.printLine)("blue"),this},p.prototype.createWatcher=function(){var e,r=this,t=this.directoriesToWatch,n=this.options;if((0,a.pathsExistSync)(t),(0,c.printMirror)({directoriesToWatch:t},"blue","grey"),t.length>0&&(e=o.default.watch(t[0],function(e){for(var r=1;r1)for(var i=1;i1&&void 0!==g[1]?g[1]:"Path did not exist",!Array.isArray(r)){e.next=37;break}a=r.map(function(e){return"object"==c(e)?Object.values(e).map(function(e){return e}):e}),u=!0,s=!1,p=void 0,e.prev=6,f=a[Symbol.iterator]();case 8:if(u=(d=f.next()).done){e.next=21;break}return h=d.value,e.prev=10,e.next=13,i.default.access(h);case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(10),l("".concat(n.default.red("Array of paths failed")," ").concat((0,o.printLine)("red")," ").concat(n.default.red(t)," \n ").concat(n.default.grey(e.t0)));case 18:u=!0,e.next=8;break;case 21:e.next=27;break;case 23:e.prev=23,e.t1=e.catch(6),s=!0,p=e.t1;case 27:e.prev=27,e.prev=28,u||null==f.return||f.return();case 30:if(e.prev=30,!s){e.next=33;break}throw p;case 33:return e.finish(30);case 34:return e.finish(27);case 35:e.next=48;break;case 37:if("string"!=typeof r){e.next=48;break}return e.prev=38,e.next=41,i.default.access(r);case 41:e.next=48;break;case 43:e.prev=43,e.t2=e.catch(38),(0,o.printLine)("red"),l("".concat(n.default.red("Single string failed")," \n").concat(n.default.red(t)," \n ").concat(n.default.grey(e.t2))),(0,o.printLine)("red");case 48:case"end":return e.stop()}},e,null,[[6,23,27,35],[10,15],[28,,30,34],[38,43]])}))).apply(this,arguments)}},function(e,r){e.exports=require("is-empty")},function(e,r,t){e.exports=t(7)},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.init=f;var n=l(t(2)),i=l(t(5)),o=l(t(3)),a=t(8),c=t(9),u=t(0),s=t(4);l(t(1));function l(e){return e&&e.__esModule?e:{default:e}}function p(e,r,t,n,i,o,a){try{var c=e[o](a),u=c.value}catch(e){return void t(e)}c.done?r(u):Promise.resolve(u).then(n,i)}console.log;function f(){return d.apply(this,arguments)}function d(){var e;return e=regeneratorRuntime.mark(function e(){var r,t,l,p,f,d,h,g=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=g.length>0&&void 0!==g[0]?g[0]:process.env.configRootDir||process.cwd(),t=g.length>1?g[1]:void 0,(0,i.default)(t)){e.next=9;break}(0,u.printLine)("cyan"),(0,u.printMirror)({oConfigOverride:t},"cyan","grey"),(0,u.printLine)("cyan"),l=t,e.next=21;break;case 9:return p=n.default.resolve(r,".protato.json"),(0,u.printLine)("green"),(0,u.printMirror)({protatoPath:p},"green","grey"),e.next=14,o.default.readJson(p);case 14:return l=e.sent,e.next=17,(0,s.pathsExistAsync)(p,".protato.json config not found");case 17:f=e.sent,d=f[0],(0,u.printMirror)({protatoPathFlag:d},"green","grey"),(0,u.printLine)("green");case 21:h=(0,a.getWatcherConfig)(l),(0,c.initWatcher)(h).getDirectories();case 24:case"end":return e.stop()}},e)}),(d=function(){var r=this,t=arguments;return new Promise(function(n,i){var o=e.apply(r,t);function a(e){p(o,n,i,a,c,"next",e)}function c(e){p(o,n,i,a,c,"throw",e)}a(void 0)})}).apply(this,arguments)}f()},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getWatcherConfig=r.PTOParser=void 0;var n=c(t(2)),i=c(t(1)),o=t(0),a=t(4);function c(e){return e&&e.__esModule?e:{default:e}}var u=console.log;function s(e){var r=e.parent,t=e.children;return(0,o.printLine)("yellow"),u("".concat(i.default.yellow("parent")," and ").concat(i.default.yellow("children")," objects were both found")),(0,o.printMirror)({parent:r},"yellow","grey"),(0,o.printMirror)({children:t},"yellow","grey"),(0,o.printLine)("yellow"),this.watcher={targets:void 0,options:void 0,parent:r},this.config=e,this.config.children=e.children,this}s.prototype.getWatcherTargets=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.children,r=e.map(function(e){var r=e.dir,t=e.src,i=process.env.configRootDir||process.cwd(),c=n.default.join(i,r,t),u=n.default.join(i,r,"package.json");(0,o.printLine)("magenta"),(0,o.printMirror)({childDirPath:c},"magenta","grey"),(0,o.printMirror)({childPackagePath:u},"magenta","grey"),(0,o.printLine)("magenta");var s=[c,u];return(0,a.pathsExistSync)(s,"getWatcherTargets' directory and package path check"),{childDirPath:c,childPackagePath:u}});return this.watcher.targets=r,void 0!==this.watcher.targets?((0,o.printLine)("yellow"),u("".concat(i.default.yellow("watcher targets")," are defined \n")),(0,o.printMirror)({targets:r},"yellow","grey"),(0,o.printLine)("yellow",null,null,2)):((0,o.printLine)("red"),(0,o.printMirror)({targets:r},"red","white"),(0,o.printLine)("red")),this},s.prototype.getWatcherOptions=function(){var e=[];return(0,o.printLine)("green"),this.config.children.map(function(r){var t,i,c=r.dir;(0,o.printMirror)({dir:c},"green","grey"),e.push((t=c,i=n.default.join(t,"node_modules"),(0,a.pathsExistSync)(i,"getWatcherOptions -> getChildNodeModulesPath() path check"),i))}),(0,o.printLine)({character:".",color:"green"}),(0,o.printMirror)({childrenDirectoriesToIgnore:e},"green","grey"),(0,o.printLine)("green"),this.watcher.options={cwd:process.env.configRootDir||process.cwd(),ignored:["node_modules/**/*"].concat(e),ignoreInitial:!0,ignorePermissionErrors:!0,followSymlinks:!0},this},r.PTOParser=s,r.getWatcherConfig=function(e){var r=new s(e);r.getWatcherTargets().getWatcherOptions();var t=r.watcher,n=t.targets,a=t.options,c=t.parent;return(0,o.printLine)("yellow"),(0,o.printMirror)({targets:n},"yellow","grey"),u("".concat(i.default.yellow("options"),": ").concat(i.default.grey(JSON.stringify(a,null,2)))),(0,o.printLine)("yellow"),{parent:c,targets:n,options:a}}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.PTOWatcher=p,r.initWatcher=function(e){var r=new p(e);return r.getDirectories().createWatcher(),r};var n,i=t(10),o=(n=i)&&n.__esModule?n:{default:n},a=t(4),c=t(0),u=t(11);function s(e,r){var t=Object.keys(e);return Object.getOwnPropertySymbols&&t.push.apply(t,Object.getOwnPropertySymbols(e)),r&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t}function l(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}process.env.configRootDir||process.cwd();function p(e){return(0,c.printMirror)({oWatcherConfig:e},"blue","grey"),(0,a.pathsExistSync)(e.targets),this.parent=e.parent,this.targets=e.targets,this.options=e.options,this.directoriesToWatch=[],this.packagesToWatch=[],this}p.prototype.getDirectories=function(){var e=this,r=this.targets;return(0,c.printLine)("blue"),r.map(function(r){var t=r.childDirPath,n=r.childPackagePath;(0,c.printMirror)({childDirPath:t},"blue","grey"),(0,c.printMirror)({childPackagePath:n},"blue","grey"),e.directoriesToWatch.push(t),e.packagesToWatch.push(n)}),(0,c.printLine)("blue"),this},p.prototype.createWatcher=function(){var e,r=this,t=this.directoriesToWatch,n=this.options;if((0,a.pathsExistSync)(t),(0,c.printMirror)({directoriesToWatch:t},"blue","grey"),t.length>0&&(e=o.default.watch(t[0],function(e){for(var r=1;r1)for(var i=1;i {\n try {\n if (Array.isArray(arrPathsObj)) {\n arrPathsObj.map(async pathToCheck => {\n await fs.access(pathToCheck);\n });\n resolve([true, ...arrPathsObj]);\n } else {\n await fs.access(arrPathsObj);\n resolve([true, arrPathsObj]);\n }\n } catch (err) {\n reject(`${chalk.red(szPreErrorMessage)}: \\n ${chalk.grey(err)}`);\n }\n });\n}\nexport async function pathsExistSync(\n arrPathsObj,\n szPreErrorMessage = \"Path did not exist\"\n) {\n //TODO: Consider adding a return value (or prom) so it can be caught inline\n //TODO: Consider adding option to include printLine & printMirrors for success cases\n //TODO: Convert below into unit test (should pass)\n // let rightPath = [\n // {\n // dir: \"sandbox/npm-starter-sample-module/src\",\n // name: \"npm-starter-sample-module\"\n // }\n // ];\n // pathsExistOrThrow(targets, \"PTOWatcher failed to initialize properly \");\n //TODO: Convert below code into unit test (ie. should throw error)\n // let wrongPathString = \"foo\"\n // let wrongPathArray = [\n // {\n // foo: \"bar\"\n // }\n // ];\n // pathsExistOrThrow(wrongPathArray, \"PTOWatcher failed to initialize properly \");\n // pathsExistOrThrow(wrongPathString, \"PTOWatcher failed to initialize properly \");\n\n if (Array.isArray(arrPathsObj)) {\n let arrFilePaths = arrPathsObj.map(mTarget => {\n if (typeof mTarget == \"object\") {\n // * handle array of objects\n // * (ie. default case; used for testing watcherConfig's \"targets\" array)\n\n return Object.values(mTarget).map(pathToCheck => {\n return pathToCheck;\n });\n } else {\n // * handle array of strings\n // * (ie. manually defined arrays with file paths)\n\n return mTarget;\n }\n });\n for (let pathToCheck of arrFilePaths) {\n // ? Now iterate over the flattened map of paths (all should be strings)\n try {\n await fs.access(pathToCheck);\n } catch (err) {\n /*\n TODO: Figure out why this is being thrown\n ? Array of paths failed ----------------------------------------------------------- Path did not exist\n ? TypeError [ERR_INVALID_ARG_TYPE]: The \"path\" argument must be one of type string, Buffer, or URL. Received type object\n */\n log(\n `${chalk.red(\"Array of paths failed\")} ${printLine(\n \"red\"\n )} ${chalk.red(szPreErrorMessage)} \\n ${chalk.grey(err)}`\n );\n }\n }\n } else if (typeof arrPathsObj == \"string\") {\n // ? handle checking path of single string\n try {\n await fs.access(arrPathsObj);\n } catch (err) {\n printLine(\"red\");\n //TODO: Add a getLine() utility so that I can include in the middle of a log without needing to log inside of a log (which doesn't process stdout in proper order)\n log(\n `${chalk.red(\"Single string failed\")} \\n${chalk.red(\n szPreErrorMessage\n )} \\n ${chalk.grey(err)}`\n );\n printLine(\"red\");\n }\n }\n}\n","module.exports = require(\"is-empty\");","const log = console.log;\nimport path from \"path\";\nimport isEmpty from \"is-empty\";\nimport fs from \"fs-extra\";\nimport { getWatcherConfig } from \"./parser\";\nimport { initWatcher } from \"./watcher\";\nimport { printLine, printMirror } from \"tacker\";\nimport { pathsExistAsync } from \"./utilities\";\n\nexport async function init(\n cwd = process.env.configRootDir || process.cwd(),\n oConfigOverride\n) {\n let oConfig;\n if (!isEmpty(oConfigOverride)) {\n oConfig = oConfigOverride;\n printLine(\"green\");\n printMirror({ oConfig }, \"green\", \"grey\");\n printLine(\"green\");\n } else {\n let protatoPath = path.resolve(cwd, \".protato.json\");\n printLine(\"green\");\n printMirror({ protatoPath }, \"green\", \"grey\");\n //TODO: Change to fs.readJsonSync\n // let { config } = require(protatoPath);\n oConfig = await fs.readJson(protatoPath);\n let pathInfo = await pathsExistAsync(\n protatoPath,\n \".protato.json config not found\"\n );\n let protatoPathFlag = pathInfo[0];\n printMirror({ protatoPathFlag }, \"green\", \"grey\");\n printLine(\"green\");\n }\n let oWC = getWatcherConfig(oConfig);\n let hWatcher = initWatcher(oWC);\n hWatcher.getDirectories();\n}\n\nconst inlineConfig = {\n parent: {\n dir: \"sandbox/node-starter\"\n },\n children: [\n {\n dir: \"sandbox/npm-starter-sample-module\",\n src: \"src\"\n },\n {\n dir: \"sandbox/library-genesis\",\n src: \"src\"\n }\n ]\n};\n\ninit();\n// init(process.cwd(), inlineConfig);\n","const log = console.log;\nimport path from \"path\";\nimport chalk from \"chalk\";\nimport { printLine, printMirror } from \"tacker\";\nimport { pathsExistSync } from \"./utilities\";\n\nfunction PTOParser(config) {\n const { parent, children } = config;\n printLine(\"yellow\");\n log(\n `${chalk.yellow(\"parent\")} and ${chalk.yellow(\n \"children\"\n )} objects were both found`\n );\n printMirror({ parent }, \"yellow\", \"grey\");\n printMirror({ children }, \"yellow\", \"grey\");\n printLine(\"yellow\");\n\n this.watcher = { targets: undefined, options: undefined, parent };\n this.config = config;\n this.config.children = config.children;\n return this;\n}\n\nPTOParser.prototype.getWatcherTargets = function getWatcherTargets(\n children = this.config.children\n) {\n let targets = children.map(oChild => {\n let { dir, src } = oChild;\n let rootDir = process.env.configRootDir || process.cwd();\n let childDirPath = path.join(rootDir, dir, src);\n let childPackagePath = path.join(rootDir, dir, \"package.json\");\n\n printLine(\"magenta\");\n printMirror({ childDirPath }, \"magenta\", \"grey\");\n printMirror({ childPackagePath }, \"magenta\", \"grey\");\n printLine(\"magenta\");\n let pathsToCheck = [childDirPath, childPackagePath];\n\n pathsExistSync(\n pathsToCheck,\n \"getWatcherTargets' directory and package path check\"\n );\n return { childDirPath, childPackagePath };\n });\n this.watcher.targets = targets;\n if (this.watcher.targets !== undefined) {\n printLine(\"yellow\");\n log(`${chalk.yellow(\"watcher targets\")} are defined \\n`);\n printMirror({ targets }, \"yellow\", \"grey\");\n printLine(\"yellow\", null, null, 2);\n } else {\n printLine(\"red\");\n printMirror({ targets }, \"red\", \"white\");\n printLine(\"red\");\n }\n return this;\n};\n\nPTOParser.prototype.getWatcherOptions = function getWatcherOptions() {\n let childrenDirectoriesToIgnore = [];\n\n function getChildNodeModulesPath(szChildTargetPath) {\n let potentialPath = path.join(szChildTargetPath, \"node_modules\");\n pathsExistSync(\n potentialPath,\n \"getWatcherOptions -> getChildNodeModulesPath() path check\"\n );\n return potentialPath;\n }\n\n printLine(\"green\");\n this.config.children.map(child => {\n const { dir } = child;\n printMirror({ dir }, \"green\", \"grey\");\n\n childrenDirectoriesToIgnore.push(getChildNodeModulesPath(dir));\n });\n\n printLine({ character: \".\", color: \"green\" });\n printMirror({ childrenDirectoriesToIgnore }, \"green\", \"grey\");\n printLine(\"green\");\n\n this.watcher.options = {\n cwd: process.env.configRootDir || process.cwd(),\n ignored: [\"node_modules/**/*\", ...childrenDirectoriesToIgnore],\n ignoreInitial: true,\n ignorePermissionErrors: true,\n followSymlinks: true\n };\n return this;\n};\n\nfunction getWatcherConfig(oConfig) {\n let parser = new PTOParser(oConfig);\n parser.getWatcherTargets().getWatcherOptions();\n\n const {\n watcher: { targets, options, parent }\n } = parser;\n\n printLine(\"yellow\");\n printMirror({ targets }, \"yellow\", \"grey\");\n log(\n `${chalk.yellow(\"options\")}: ${chalk.grey(\n JSON.stringify(options, null, 2)\n )}`\n );\n printLine(\"yellow\");\n return {\n parent,\n targets,\n options\n };\n}\n\nexport { PTOParser, getWatcherConfig };\n","import chokidar from \"chokidar\";\nimport { pathsExistSync } from \"./utilities\";\nimport { printLine, printMirror } from \"tacker\";\nimport { linker } from \"./linker\";\n\nconst sampleConfig = {\n parent: {\n dir: \"sandbox/node-starter\"\n },\n targets: [\n {\n childDirPath: \"sandbox/npm-starter-sample-module/src\",\n childPackagePath: \"sandbox/npm-starter-sample-module/package.json\"\n }\n ],\n options: {\n cwd: process.env.configRootDir || process.cwd(),\n ignored: [\n \"node_modules\",\n \"sandbox/npm-starter-sample-module/node_modules\",\n \"sandbox/npm-starter-sample-module/.git\"\n ],\n ignoreInitial: true,\n ignorePermissionErrors: true,\n followSymlinks: true\n }\n};\n\nexport function PTOWatcher(oWatcherConfig) {\n printMirror({ oWatcherConfig }, \"blue\", \"grey\");\n pathsExistSync(oWatcherConfig.targets);\n this.parent = oWatcherConfig.parent;\n this.targets = oWatcherConfig.targets;\n this.options = oWatcherConfig.options;\n this.directoriesToWatch = [];\n this.packagesToWatch = [];\n\n return this;\n}\n\nPTOWatcher.prototype.getDirectories = function getDirectories() {\n let { targets } = this;\n printLine(\"blue\");\n targets.map(({ childDirPath, childPackagePath }) => {\n printMirror({ childDirPath }, \"blue\", \"grey\");\n printMirror({ childPackagePath }, \"blue\", \"grey\");\n this.directoriesToWatch.push(childDirPath);\n this.packagesToWatch.push(childPackagePath);\n });\n printLine(\"blue\");\n return this;\n};\n\nPTOWatcher.prototype.createWatcher = function createWatcher() {\n const { directoriesToWatch, options } = this;\n pathsExistSync(directoriesToWatch);\n printMirror({ directoriesToWatch }, \"blue\", \"grey\");\n var watcher;\n //TODO: Add a new sample repo to repogen\n //TODO: Create backup config to test whether this works with 2+ directories\n if (directoriesToWatch.length > 0) {\n watcher = chokidar.watch(directoriesToWatch[0], { ...options });\n }\n if (directoriesToWatch.length > 1) {\n for (let i = 1; i < directoriesToWatch.length; i++) {\n watcher.add(directoriesToWatch[i]);\n }\n }\n watcher.on(\"change\", modifiedChildPath => {\n printMirror({ modifiedChildPath }, \"green\", \"grey\");\n linker(modifiedChildPath, this.parent.dir);\n });\n};\n\nexport function initWatcher(oWatcherConfig) {\n let watcher = new PTOWatcher(oWatcherConfig);\n watcher.getDirectories().createWatcher();\n return watcher;\n}\n","module.exports = require(\"chokidar\");","const log = console.log;\nimport chalk from \"chalk\";\nimport path from \"path\";\nimport isEmpty from \"is-empty\";\nimport pkgDir from \"pkg-dir\";\nimport exec from \"await-exec\";\nimport fs from \"fs-extra\";\n\nimport { printLine, printMirror } from \"tacker\";\n\n//TODO: Check to see whether yalc installed globally. If not, install. If install fails, throw err & explain\n\nexport async function linker(szModifiedFilePath, szParentDirPath) {\n if (!isEmpty(szModifiedFilePath) | !isEmpty(szParentDirPath)) {\n printMirror({ szModifiedFilePath }, \"magenta\", \"grey\");\n printMirror({ szParentDirPath }, \"magenta\", \"grey\");\n let childData, parentData, childModuleName;\n try {\n let modifiedRootDir = await pkgDir(szModifiedFilePath);\n printLine(\"blue\");\n printMirror({ modifiedRootDir }, \"magenta\", \"green\");\n let modifiedPkgPath = path.join(modifiedRootDir, \"package.json\");\n printMirror({ modifiedPkgPath }, \"magenta\", \"green\");\n //TODO: Change to fs.readJsonSync\n const { name } = await fs.readJson(modifiedPkgPath);\n // const { name } = require(modifiedPkgPath);\n childModuleName = name;\n printMirror({ childModuleName }, \"blue\", \"grey\");\n printLine(\"blue\");\n childData = await exec(`cd ${modifiedRootDir} && yalc publish`);\n printLine(\"green\");\n log(`childData: ${JSON.stringify(childData, null, 2)}`);\n printLine(\"green\");\n } catch (err) {\n log(`${chalk.red(\"'yalc publish' failed\")}\\n${chalk.grey(err)}`);\n }\n\n try {\n let parentRootDir = await pkgDir(szParentDirPath);\n printMirror({ parentRootDir }, \"magenta\", \"green\");\n parentData = await exec(\n `cd ${parentRootDir} && yalc link ${childModuleName}`\n );\n printLine(\"yellow\");\n log(`parentData: ${JSON.stringify(parentData, null, 2)}`);\n printLine(\"yellow\");\n } catch (err) {\n log(\n `${chalk.red(\n `yalc add ${childModuleName} in ${chalk.yellow(parentRootDir)} failed`\n )}\\n${chalk.grey(err)}`\n );\n }\n } else {\n printLine(\"green\");\n log(`parentDirectory not set`);\n printLine(\"green\");\n }\n return this;\n}\n","module.exports = require(\"pkg-dir\");","module.exports = require(\"await-exec\");"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"tacker\"","webpack:///external \"chalk\"","webpack:///external \"path\"","webpack:///external \"fs-extra\"","webpack:///./src/utilities.js","webpack:///external \"is-empty\"","webpack:///./src/index.js","webpack:///./src/parser.js","webpack:///./src/watcher.js","webpack:///external \"chokidar\"","webpack:///./src/linker.js","webpack:///external \"pkg-dir\"","webpack:///external \"await-exec\""],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","require","pathsExistAsync","arrPathsObj","szPreErrorMessage","Promise","_ref","_asyncToGenerator","regeneratorRuntime","mark","_callee2","resolve","reject","wrap","_context2","prev","next","Array","isArray","map","_ref2","_callee","pathToCheck","_context","fs","access","stop","_x3","apply","this","arguments","concat","t0","chalk","red","grey","_x","_x2","pathsExistSync","_tacker","log","console","_callee3","arrFilePaths","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","_step","_args3","_context3","length","undefined","mTarget","_typeof","values","iterator","done","printLine","t1","return","finish","t2","init","_parser","_watcher","_utilities","cwd","oConfigOverride","oConfig","protatoPath","pathInfo","protatoPathFlag","oWC","_args","process","env","configRootDir","_isEmpty2","default","printMirror","path","readJson","sent","getWatcherConfig","initWatcher","getDirectories","PTOParser","config","parent","children","yellow","watcher","targets","options","getWatcherTargets","oChild","dir","src","rootDir","childDirPath","join","childPackagePath","pathsToCheck","getWatcherOptions","childrenDirectoriesToIgnore","child","szChildTargetPath","potentialPath","push","character","color","ignored","ignoreInitial","ignorePermissionErrors","followSymlinks","parser","_parser$watcher","JSON","stringify","PTOWatcher","oWatcherConfig","createWatcher","_chokidar","_linker","directoriesToWatch","packagesToWatch","_this","_this2","chokidar","watch","_objectSpread","add","on","modifiedChildPath","linker","szModifiedFilePath","szParentDirPath","childData","parentData","childModuleName","modifiedRootDir","modifiedPkgPath","_parentRootDir","_pkgDir2","_awaitExec2","parentRootDir","abrupt"],"mappings":"6DACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QA0DA,OArDAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CZ,EAAAkB,EAAA,SAAAhB,GACA,oBAAAiB,eAAAC,aACAN,OAAAC,eAAAb,EAAAiB,OAAAC,YAAA,CAAwDC,MAAA,WAExDP,OAAAC,eAAAb,EAAA,cAAiDmB,OAAA,KAQjDrB,EAAAsB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAArB,EAAAqB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAF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OCZP7D,EAAAD,QAAAkC,QAAA,0BCAAjC,EAAAD,QAAAkC,QAAA","file":"main.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n","module.exports = require(\"tacker\");","module.exports = require(\"chalk\");","module.exports = require(\"path\");","module.exports = require(\"fs-extra\");","import chalk from \"chalk\";\nimport fs from \"fs-extra\";\nimport { printLine } from \"tacker\";\nconst log = console.log;\n\nexport function pathsExistAsync(arrPathsObj, szPreErrorMessage) {\n return new Promise(async (resolve, reject) => {\n try {\n if (Array.isArray(arrPathsObj)) {\n arrPathsObj.map(async pathToCheck => {\n await fs.access(pathToCheck);\n });\n resolve([true, ...arrPathsObj]);\n } else {\n await fs.access(arrPathsObj);\n resolve([true, arrPathsObj]);\n }\n } catch (err) {\n reject(`${chalk.red(szPreErrorMessage)}: \\n ${chalk.grey(err)}`);\n }\n });\n}\nexport async function pathsExistSync(\n arrPathsObj,\n szPreErrorMessage = \"Path did not exist\"\n) {\n //TODO: Consider adding a return value (or prom) so it can be caught inline\n //TODO: Consider adding option to include printLine & printMirrors for success cases\n //TODO: Convert below into unit test (should pass)\n // let rightPath = [\n // {\n // dir: \"sandbox/npm-starter-sample-module/src\",\n // name: \"npm-starter-sample-module\"\n // }\n // ];\n // pathsExistOrThrow(targets, \"PTOWatcher failed to initialize properly \");\n //TODO: Convert below code into unit test (ie. should throw error)\n // let wrongPathString = \"foo\"\n // let wrongPathArray = [\n // {\n // foo: \"bar\"\n // }\n // ];\n // pathsExistOrThrow(wrongPathArray, \"PTOWatcher failed to initialize properly \");\n // pathsExistOrThrow(wrongPathString, \"PTOWatcher failed to initialize properly \");\n\n if (Array.isArray(arrPathsObj)) {\n let arrFilePaths = arrPathsObj.map(mTarget => {\n if (typeof mTarget == \"object\") {\n // * handle array of objects\n // * (ie. default case; used for testing watcherConfig's \"targets\" array)\n\n return Object.values(mTarget).map(pathToCheck => {\n return pathToCheck;\n });\n } else {\n // * handle array of strings\n // * (ie. manually defined arrays with file paths)\n\n return mTarget;\n }\n });\n for (let pathToCheck of arrFilePaths) {\n // ? Now iterate over the flattened map of paths (all should be strings)\n try {\n await fs.access(pathToCheck);\n } catch (err) {\n /*\n TODO: Figure out why this is being thrown\n ? Array of paths failed ----------------------------------------------------------- Path did not exist\n ? TypeError [ERR_INVALID_ARG_TYPE]: The \"path\" argument must be one of type string, Buffer, or URL. Received type object\n */\n log(\n `${chalk.red(\"Array of paths failed\")} ${printLine(\n \"red\"\n )} ${chalk.red(szPreErrorMessage)} \\n ${chalk.grey(err)}`\n );\n }\n }\n } else if (typeof arrPathsObj == \"string\") {\n // ? handle checking path of single string\n try {\n await fs.access(arrPathsObj);\n } catch (err) {\n printLine(\"red\");\n //TODO: Add a getLine() utility so that I can include in the middle of a log without needing to log inside of a log (which doesn't process stdout in proper order)\n log(\n `${chalk.red(\"Single string failed\")} \\n${chalk.red(\n szPreErrorMessage\n )} \\n ${chalk.grey(err)}`\n );\n printLine(\"red\");\n }\n }\n}\n","module.exports = require(\"is-empty\");","const log = console.log;\nimport path from \"path\";\nimport isEmpty from \"is-empty\";\nimport fs from \"fs-extra\";\nimport { getWatcherConfig } from \"./parser\";\nimport { initWatcher } from \"./watcher\";\nimport { printLine, printMirror } from \"tacker\";\nimport { pathsExistAsync } from \"./utilities\";\nimport chalk from \"chalk\";\n\nexport async function init(\n cwd = process.env.configRootDir || process.cwd(),\n oConfigOverride\n) {\n let oConfig;\n if (!isEmpty(oConfigOverride)) {\n printLine(\"cyan\");\n printMirror({ oConfigOverride }, \"cyan\", \"grey\");\n printLine(\"cyan\");\n oConfig = oConfigOverride;\n } else {\n let protatoPath = path.resolve(cwd, \".protato.json\");\n printLine(\"green\");\n printMirror({ protatoPath }, \"green\", \"grey\");\n //TODO: Change to fs.readJsonSync\n // let { config } = require(protatoPath);\n oConfig = await fs.readJson(protatoPath);\n let pathInfo = await pathsExistAsync(\n protatoPath,\n \".protato.json config not found\"\n );\n let protatoPathFlag = pathInfo[0];\n printMirror({ protatoPathFlag }, \"green\", \"grey\");\n printLine(\"green\");\n }\n let oWC = getWatcherConfig(oConfig);\n let hWatcher = initWatcher(oWC);\n hWatcher.getDirectories();\n}\n\nconst inlineConfig = {\n parent: {\n dir: \"sandbox/node-starter\"\n },\n children: [\n {\n dir: \"sandbox/npm-starter-sample-module\",\n src: \"src\"\n },\n {\n dir: \"sandbox/library-genesis\",\n src: \"src\"\n }\n ]\n};\n\ninit();\n// init(process.cwd(), inlineConfig);\n","const log = console.log;\nimport path from \"path\";\nimport chalk from \"chalk\";\nimport { printLine, printMirror } from \"tacker\";\nimport { pathsExistSync } from \"./utilities\";\n\nfunction PTOParser(config) {\n const { parent, children } = config;\n printLine(\"yellow\");\n log(\n `${chalk.yellow(\"parent\")} and ${chalk.yellow(\n \"children\"\n )} objects were both found`\n );\n printMirror({ parent }, \"yellow\", \"grey\");\n printMirror({ children }, \"yellow\", \"grey\");\n printLine(\"yellow\");\n\n this.watcher = { targets: undefined, options: undefined, parent };\n this.config = config;\n this.config.children = config.children;\n return this;\n}\n\nPTOParser.prototype.getWatcherTargets = function getWatcherTargets(\n children = this.config.children\n) {\n let targets = children.map(oChild => {\n let { dir, src } = oChild;\n let rootDir = process.env.configRootDir || process.cwd();\n let childDirPath = path.join(rootDir, dir, src);\n let childPackagePath = path.join(rootDir, dir, \"package.json\");\n\n printLine(\"magenta\");\n printMirror({ childDirPath }, \"magenta\", \"grey\");\n printMirror({ childPackagePath }, \"magenta\", \"grey\");\n printLine(\"magenta\");\n let pathsToCheck = [childDirPath, childPackagePath];\n\n pathsExistSync(\n pathsToCheck,\n \"getWatcherTargets' directory and package path check\"\n );\n return { childDirPath, childPackagePath };\n });\n this.watcher.targets = targets;\n if (this.watcher.targets !== undefined) {\n printLine(\"yellow\");\n log(`${chalk.yellow(\"watcher targets\")} are defined \\n`);\n printMirror({ targets }, \"yellow\", \"grey\");\n printLine(\"yellow\", null, null, 2);\n } else {\n printLine(\"red\");\n printMirror({ targets }, \"red\", \"white\");\n printLine(\"red\");\n }\n return this;\n};\n\nPTOParser.prototype.getWatcherOptions = function getWatcherOptions() {\n let childrenDirectoriesToIgnore = [];\n\n function getChildNodeModulesPath(szChildTargetPath) {\n let potentialPath = path.join(szChildTargetPath, \"node_modules\");\n pathsExistSync(\n potentialPath,\n \"getWatcherOptions -> getChildNodeModulesPath() path check\"\n );\n return potentialPath;\n }\n\n printLine(\"green\");\n this.config.children.map(child => {\n const { dir } = child;\n printMirror({ dir }, \"green\", \"grey\");\n\n childrenDirectoriesToIgnore.push(getChildNodeModulesPath(dir));\n });\n\n printLine({ character: \".\", color: \"green\" });\n printMirror({ childrenDirectoriesToIgnore }, \"green\", \"grey\");\n printLine(\"green\");\n\n this.watcher.options = {\n cwd: process.env.configRootDir || process.cwd(),\n ignored: [\"node_modules/**/*\", ...childrenDirectoriesToIgnore],\n ignoreInitial: true,\n ignorePermissionErrors: true,\n followSymlinks: true\n };\n return this;\n};\n\nfunction getWatcherConfig(oConfig) {\n let parser = new PTOParser(oConfig);\n parser.getWatcherTargets().getWatcherOptions();\n\n const {\n watcher: { targets, options, parent }\n } = parser;\n\n printLine(\"yellow\");\n printMirror({ targets }, \"yellow\", \"grey\");\n log(\n `${chalk.yellow(\"options\")}: ${chalk.grey(\n JSON.stringify(options, null, 2)\n )}`\n );\n printLine(\"yellow\");\n return {\n parent,\n targets,\n options\n };\n}\n\nexport { PTOParser, getWatcherConfig };\n","import chokidar from \"chokidar\";\nimport { pathsExistSync } from \"./utilities\";\nimport { printLine, printMirror } from \"tacker\";\nimport { linker } from \"./linker\";\n\nconst sampleConfig = {\n parent: {\n dir: \"sandbox/node-starter\"\n },\n targets: [\n {\n childDirPath: \"sandbox/npm-starter-sample-module/src\",\n childPackagePath: \"sandbox/npm-starter-sample-module/package.json\"\n }\n ],\n options: {\n cwd: process.env.configRootDir || process.cwd(),\n ignored: [\n \"node_modules\",\n \"sandbox/npm-starter-sample-module/node_modules\",\n \"sandbox/npm-starter-sample-module/.git\"\n ],\n ignoreInitial: true,\n ignorePermissionErrors: true,\n followSymlinks: true\n }\n};\n\nexport function PTOWatcher(oWatcherConfig) {\n printMirror({ oWatcherConfig }, \"blue\", \"grey\");\n pathsExistSync(oWatcherConfig.targets);\n this.parent = oWatcherConfig.parent;\n this.targets = oWatcherConfig.targets;\n this.options = oWatcherConfig.options;\n this.directoriesToWatch = [];\n this.packagesToWatch = [];\n\n return this;\n}\n\nPTOWatcher.prototype.getDirectories = function getDirectories() {\n let { targets } = this;\n printLine(\"blue\");\n targets.map(({ childDirPath, childPackagePath }) => {\n printMirror({ childDirPath }, \"blue\", \"grey\");\n printMirror({ childPackagePath }, \"blue\", \"grey\");\n this.directoriesToWatch.push(childDirPath);\n this.packagesToWatch.push(childPackagePath);\n });\n printLine(\"blue\");\n return this;\n};\n\nPTOWatcher.prototype.createWatcher = function createWatcher() {\n const { directoriesToWatch, options } = this;\n pathsExistSync(directoriesToWatch);\n printMirror({ directoriesToWatch }, \"blue\", \"grey\");\n var watcher;\n //TODO: Add a new sample repo to repogen\n //TODO: Create backup config to test whether this works with 2+ directories\n if (directoriesToWatch.length > 0) {\n watcher = chokidar.watch(directoriesToWatch[0], { ...options });\n }\n if (directoriesToWatch.length > 1) {\n for (let i = 1; i < directoriesToWatch.length; i++) {\n watcher.add(directoriesToWatch[i]);\n }\n }\n watcher.on(\"change\", modifiedChildPath => {\n printMirror({ modifiedChildPath }, \"green\", \"grey\");\n linker(modifiedChildPath, this.parent.dir);\n });\n};\n\nexport function initWatcher(oWatcherConfig) {\n let watcher = new PTOWatcher(oWatcherConfig);\n watcher.getDirectories().createWatcher();\n return watcher;\n}\n","module.exports = require(\"chokidar\");","const log = console.log;\nimport chalk from \"chalk\";\nimport path from \"path\";\nimport isEmpty from \"is-empty\";\nimport pkgDir from \"pkg-dir\";\nimport exec from \"await-exec\";\nimport fs from \"fs-extra\";\n\nimport { printLine, printMirror } from \"tacker\";\n\n//TODO: Check to see whether yalc installed globally. If not, install. If install fails, throw err & explain\n\nexport async function linker(szModifiedFilePath, szParentDirPath) {\n if (!isEmpty(szModifiedFilePath) | !isEmpty(szParentDirPath)) {\n printMirror({ szModifiedFilePath }, \"magenta\", \"grey\");\n printMirror({ szParentDirPath }, \"magenta\", \"grey\");\n let childData, parentData, childModuleName;\n try {\n let modifiedRootDir = await pkgDir(szModifiedFilePath);\n printLine(\"blue\");\n printMirror({ modifiedRootDir }, \"magenta\", \"green\");\n let modifiedPkgPath = path.join(modifiedRootDir, \"package.json\");\n printMirror({ modifiedPkgPath }, \"magenta\", \"green\");\n //TODO: Change to fs.readJsonSync\n const { name } = await fs.readJson(modifiedPkgPath);\n // const { name } = require(modifiedPkgPath);\n childModuleName = name;\n printMirror({ childModuleName }, \"blue\", \"grey\");\n printLine(\"blue\");\n childData = await exec(`cd ${modifiedRootDir} && yalc publish`);\n printLine(\"green\");\n log(`childData: ${JSON.stringify(childData, null, 2)}`);\n printLine(\"green\");\n } catch (err) {\n log(`${chalk.red(\"'yalc publish' failed\")}\\n${chalk.grey(err)}`);\n }\n\n try {\n let parentRootDir = await pkgDir(szParentDirPath);\n printMirror({ parentRootDir }, \"magenta\", \"green\");\n parentData = await exec(\n `cd ${parentRootDir} && yalc link ${childModuleName}`\n );\n printLine(\"yellow\");\n log(`parentData: ${JSON.stringify(parentData, null, 2)}`);\n printLine(\"yellow\");\n } catch (err) {\n log(\n `${chalk.red(\n `yalc add ${childModuleName} in ${chalk.yellow(parentRootDir)} failed`\n )}\\n${chalk.grey(err)}`\n );\n }\n } else {\n printLine(\"green\");\n log(`parentDirectory not set`);\n printLine(\"green\");\n }\n return this;\n}\n","module.exports = require(\"pkg-dir\");","module.exports = require(\"await-exec\");"],"sourceRoot":""} \ No newline at end of file diff --git a/src/index.js b/src/index.js index 8f80b9d..e5d65ba 100644 --- a/src/index.js +++ b/src/index.js @@ -6,6 +6,7 @@ import { getWatcherConfig } from "./parser"; import { initWatcher } from "./watcher"; import { printLine, printMirror } from "tacker"; import { pathsExistAsync } from "./utilities"; +import chalk from "chalk"; export async function init( cwd = process.env.configRootDir || process.cwd(), @@ -13,14 +14,14 @@ export async function init( ) { let oConfig; if (!isEmpty(oConfigOverride)) { + printLine("cyan"); + printMirror({ oConfigOverride }, "cyan", "grey"); + printLine("cyan"); oConfig = oConfigOverride; - printLine("green"); - printMirror({ oConfig }, "green", "grey"); - printLine("green"); } else { let protatoPath = path.resolve(cwd, ".protato.json"); - printLine("green"); - printMirror({ protatoPath }, "green", "grey"); + printLine("cyan"); + printMirror({ protatoPath }, "cyan", "grey"); //TODO: Change to fs.readJsonSync // let { config } = require(protatoPath); oConfig = await fs.readJson(protatoPath); @@ -29,8 +30,8 @@ export async function init( ".protato.json config not found" ); let protatoPathFlag = pathInfo[0]; - printMirror({ protatoPathFlag }, "green", "grey"); - printLine("green"); + printMirror({ protatoPathFlag }, "cyan", "grey"); + printLine("cyan"); } let oWC = getWatcherConfig(oConfig); let hWatcher = initWatcher(oWC); @@ -53,5 +54,5 @@ const inlineConfig = { ] }; -// init(); +init(); // init(process.cwd(), inlineConfig); From b3d91289f296ed604bead54dddf842ac2c11d0ef Mon Sep 17 00:00:00 2001 From: alechp Date: Mon, 15 Jul 2019 15:29:50 -0700 Subject: [PATCH 7/8] commented init for pub --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index e5d65ba..e827628 100644 --- a/src/index.js +++ b/src/index.js @@ -54,5 +54,5 @@ const inlineConfig = { ] }; -init(); +// init(); // init(process.cwd(), inlineConfig); From 62c437106273069c286051b831130d75eb4c2bf1 Mon Sep 17 00:00:00 2001 From: alechp Date: Mon, 15 Jul 2019 15:30:22 -0700 Subject: [PATCH 8/8] updated build --- build/main.js | 2 +- build/main.js.map | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/main.js b/build/main.js index d5a2da9..ee0858f 100644 --- a/build/main.js +++ b/build/main.js @@ -1,2 +1,2 @@ -!function(e,r){for(var t in r)e[t]=r[t]}(exports,function(e){var r={};function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var i in e)t.d(n,i,function(r){return e[r]}.bind(null,i));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=6)}([function(e,r){e.exports=require("tacker")},function(e,r){e.exports=require("chalk")},function(e,r){e.exports=require("path")},function(e,r){e.exports=require("fs-extra")},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.pathsExistAsync=function(e,r){return new Promise((t=s(regeneratorRuntime.mark(function t(o,a){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!Array.isArray(e)){t.next=6;break}e.map(function(){var e=s(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.default.access(r);case 2:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}()),o([!0].concat(function(e){if(Array.isArray(e)){for(var r=0,t=new Array(e.length);r1&&void 0!==g[1]?g[1]:"Path did not exist",!Array.isArray(r)){e.next=37;break}a=r.map(function(e){return"object"==c(e)?Object.values(e).map(function(e){return e}):e}),u=!0,s=!1,p=void 0,e.prev=6,f=a[Symbol.iterator]();case 8:if(u=(d=f.next()).done){e.next=21;break}return h=d.value,e.prev=10,e.next=13,i.default.access(h);case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(10),l("".concat(n.default.red("Array of paths failed")," ").concat((0,o.printLine)("red")," ").concat(n.default.red(t)," \n ").concat(n.default.grey(e.t0)));case 18:u=!0,e.next=8;break;case 21:e.next=27;break;case 23:e.prev=23,e.t1=e.catch(6),s=!0,p=e.t1;case 27:e.prev=27,e.prev=28,u||null==f.return||f.return();case 30:if(e.prev=30,!s){e.next=33;break}throw p;case 33:return e.finish(30);case 34:return e.finish(27);case 35:e.next=48;break;case 37:if("string"!=typeof r){e.next=48;break}return e.prev=38,e.next=41,i.default.access(r);case 41:e.next=48;break;case 43:e.prev=43,e.t2=e.catch(38),(0,o.printLine)("red"),l("".concat(n.default.red("Single string failed")," \n").concat(n.default.red(t)," \n ").concat(n.default.grey(e.t2))),(0,o.printLine)("red");case 48:case"end":return e.stop()}},e,null,[[6,23,27,35],[10,15],[28,,30,34],[38,43]])}))).apply(this,arguments)}},function(e,r){e.exports=require("is-empty")},function(e,r,t){e.exports=t(7)},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.init=f;var n=l(t(2)),i=l(t(5)),o=l(t(3)),a=t(8),c=t(9),u=t(0),s=t(4);l(t(1));function l(e){return e&&e.__esModule?e:{default:e}}function p(e,r,t,n,i,o,a){try{var c=e[o](a),u=c.value}catch(e){return void t(e)}c.done?r(u):Promise.resolve(u).then(n,i)}console.log;function f(){return d.apply(this,arguments)}function d(){var e;return e=regeneratorRuntime.mark(function e(){var r,t,l,p,f,d,h,g=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=g.length>0&&void 0!==g[0]?g[0]:process.env.configRootDir||process.cwd(),t=g.length>1?g[1]:void 0,(0,i.default)(t)){e.next=9;break}(0,u.printLine)("cyan"),(0,u.printMirror)({oConfigOverride:t},"cyan","grey"),(0,u.printLine)("cyan"),l=t,e.next=21;break;case 9:return p=n.default.resolve(r,".protato.json"),(0,u.printLine)("green"),(0,u.printMirror)({protatoPath:p},"green","grey"),e.next=14,o.default.readJson(p);case 14:return l=e.sent,e.next=17,(0,s.pathsExistAsync)(p,".protato.json config not found");case 17:f=e.sent,d=f[0],(0,u.printMirror)({protatoPathFlag:d},"green","grey"),(0,u.printLine)("green");case 21:h=(0,a.getWatcherConfig)(l),(0,c.initWatcher)(h).getDirectories();case 24:case"end":return e.stop()}},e)}),(d=function(){var r=this,t=arguments;return new Promise(function(n,i){var o=e.apply(r,t);function a(e){p(o,n,i,a,c,"next",e)}function c(e){p(o,n,i,a,c,"throw",e)}a(void 0)})}).apply(this,arguments)}f()},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getWatcherConfig=r.PTOParser=void 0;var n=c(t(2)),i=c(t(1)),o=t(0),a=t(4);function c(e){return e&&e.__esModule?e:{default:e}}var u=console.log;function s(e){var r=e.parent,t=e.children;return(0,o.printLine)("yellow"),u("".concat(i.default.yellow("parent")," and ").concat(i.default.yellow("children")," objects were both found")),(0,o.printMirror)({parent:r},"yellow","grey"),(0,o.printMirror)({children:t},"yellow","grey"),(0,o.printLine)("yellow"),this.watcher={targets:void 0,options:void 0,parent:r},this.config=e,this.config.children=e.children,this}s.prototype.getWatcherTargets=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.children,r=e.map(function(e){var r=e.dir,t=e.src,i=process.env.configRootDir||process.cwd(),c=n.default.join(i,r,t),u=n.default.join(i,r,"package.json");(0,o.printLine)("magenta"),(0,o.printMirror)({childDirPath:c},"magenta","grey"),(0,o.printMirror)({childPackagePath:u},"magenta","grey"),(0,o.printLine)("magenta");var s=[c,u];return(0,a.pathsExistSync)(s,"getWatcherTargets' directory and package path check"),{childDirPath:c,childPackagePath:u}});return this.watcher.targets=r,void 0!==this.watcher.targets?((0,o.printLine)("yellow"),u("".concat(i.default.yellow("watcher targets")," are defined \n")),(0,o.printMirror)({targets:r},"yellow","grey"),(0,o.printLine)("yellow",null,null,2)):((0,o.printLine)("red"),(0,o.printMirror)({targets:r},"red","white"),(0,o.printLine)("red")),this},s.prototype.getWatcherOptions=function(){var e=[];return(0,o.printLine)("green"),this.config.children.map(function(r){var t,i,c=r.dir;(0,o.printMirror)({dir:c},"green","grey"),e.push((t=c,i=n.default.join(t,"node_modules"),(0,a.pathsExistSync)(i,"getWatcherOptions -> getChildNodeModulesPath() path check"),i))}),(0,o.printLine)({character:".",color:"green"}),(0,o.printMirror)({childrenDirectoriesToIgnore:e},"green","grey"),(0,o.printLine)("green"),this.watcher.options={cwd:process.env.configRootDir||process.cwd(),ignored:["node_modules/**/*"].concat(e),ignoreInitial:!0,ignorePermissionErrors:!0,followSymlinks:!0},this},r.PTOParser=s,r.getWatcherConfig=function(e){var r=new s(e);r.getWatcherTargets().getWatcherOptions();var t=r.watcher,n=t.targets,a=t.options,c=t.parent;return(0,o.printLine)("yellow"),(0,o.printMirror)({targets:n},"yellow","grey"),u("".concat(i.default.yellow("options"),": ").concat(i.default.grey(JSON.stringify(a,null,2)))),(0,o.printLine)("yellow"),{parent:c,targets:n,options:a}}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.PTOWatcher=p,r.initWatcher=function(e){var r=new p(e);return r.getDirectories().createWatcher(),r};var n,i=t(10),o=(n=i)&&n.__esModule?n:{default:n},a=t(4),c=t(0),u=t(11);function s(e,r){var t=Object.keys(e);return Object.getOwnPropertySymbols&&t.push.apply(t,Object.getOwnPropertySymbols(e)),r&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t}function l(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}process.env.configRootDir||process.cwd();function p(e){return(0,c.printMirror)({oWatcherConfig:e},"blue","grey"),(0,a.pathsExistSync)(e.targets),this.parent=e.parent,this.targets=e.targets,this.options=e.options,this.directoriesToWatch=[],this.packagesToWatch=[],this}p.prototype.getDirectories=function(){var e=this,r=this.targets;return(0,c.printLine)("blue"),r.map(function(r){var t=r.childDirPath,n=r.childPackagePath;(0,c.printMirror)({childDirPath:t},"blue","grey"),(0,c.printMirror)({childPackagePath:n},"blue","grey"),e.directoriesToWatch.push(t),e.packagesToWatch.push(n)}),(0,c.printLine)("blue"),this},p.prototype.createWatcher=function(){var e,r=this,t=this.directoriesToWatch,n=this.options;if((0,a.pathsExistSync)(t),(0,c.printMirror)({directoriesToWatch:t},"blue","grey"),t.length>0&&(e=o.default.watch(t[0],function(e){for(var r=1;r1)for(var i=1;i1&&void 0!==g[1]?g[1]:"Path did not exist",!Array.isArray(t)){e.next=37;break}a=t.map(function(e){return"object"==c(e)?Object.values(e).map(function(e){return e}):e}),u=!0,s=!1,p=void 0,e.prev=6,f=a[Symbol.iterator]();case 8:if(u=(d=f.next()).done){e.next=21;break}return h=d.value,e.prev=10,e.next=13,i.default.access(h);case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(10),l("".concat(n.default.red("Array of paths failed")," ").concat((0,o.printLine)("red")," ").concat(n.default.red(r)," \n ").concat(n.default.grey(e.t0)));case 18:u=!0,e.next=8;break;case 21:e.next=27;break;case 23:e.prev=23,e.t1=e.catch(6),s=!0,p=e.t1;case 27:e.prev=27,e.prev=28,u||null==f.return||f.return();case 30:if(e.prev=30,!s){e.next=33;break}throw p;case 33:return e.finish(30);case 34:return e.finish(27);case 35:e.next=48;break;case 37:if("string"!=typeof t){e.next=48;break}return e.prev=38,e.next=41,i.default.access(t);case 41:e.next=48;break;case 43:e.prev=43,e.t2=e.catch(38),(0,o.printLine)("red"),l("".concat(n.default.red("Single string failed")," \n").concat(n.default.red(r)," \n ").concat(n.default.grey(e.t2))),(0,o.printLine)("red");case 48:case"end":return e.stop()}},e,null,[[6,23,27,35],[10,15],[28,,30,34],[38,43]])}))).apply(this,arguments)}},function(e,t){e.exports=require("is-empty")},function(e,t,r){e.exports=r(7)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.init=function(){return f.apply(this,arguments)};var n=l(r(2)),i=l(r(5)),o=l(r(3)),a=r(8),c=r(9),u=r(0),s=r(4);l(r(1));function l(e){return e&&e.__esModule?e:{default:e}}function p(e,t,r,n,i,o,a){try{var c=e[o](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,i)}console.log;function f(){var e;return e=regeneratorRuntime.mark(function e(){var t,r,l,p,f,d,h,g=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=g.length>0&&void 0!==g[0]?g[0]:process.env.configRootDir||process.cwd(),r=g.length>1?g[1]:void 0,(0,i.default)(r)){e.next=9;break}(0,u.printLine)("cyan"),(0,u.printMirror)({oConfigOverride:r},"cyan","grey"),(0,u.printLine)("cyan"),l=r,e.next=21;break;case 9:return p=n.default.resolve(t,".protato.json"),(0,u.printLine)("cyan"),(0,u.printMirror)({protatoPath:p},"cyan","grey"),e.next=14,o.default.readJson(p);case 14:return l=e.sent,e.next=17,(0,s.pathsExistAsync)(p,".protato.json config not found");case 17:f=e.sent,d=f[0],(0,u.printMirror)({protatoPathFlag:d},"cyan","grey"),(0,u.printLine)("cyan");case 21:h=(0,a.getWatcherConfig)(l),(0,c.initWatcher)(h).getDirectories();case 24:case"end":return e.stop()}},e)}),(f=function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){p(o,n,i,a,c,"next",e)}function c(e){p(o,n,i,a,c,"throw",e)}a(void 0)})}).apply(this,arguments)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getWatcherConfig=t.PTOParser=void 0;var n=c(r(2)),i=c(r(1)),o=r(0),a=r(4);function c(e){return e&&e.__esModule?e:{default:e}}var u=console.log;function s(e){var t=e.parent,r=e.children;return(0,o.printLine)("yellow"),u("".concat(i.default.yellow("parent")," and ").concat(i.default.yellow("children")," objects were both found")),(0,o.printMirror)({parent:t},"yellow","grey"),(0,o.printMirror)({children:r},"yellow","grey"),(0,o.printLine)("yellow"),this.watcher={targets:void 0,options:void 0,parent:t},this.config=e,this.config.children=e.children,this}s.prototype.getWatcherTargets=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.children,t=e.map(function(e){var t=e.dir,r=e.src,i=process.env.configRootDir||process.cwd(),c=n.default.join(i,t,r),u=n.default.join(i,t,"package.json");(0,o.printLine)("magenta"),(0,o.printMirror)({childDirPath:c},"magenta","grey"),(0,o.printMirror)({childPackagePath:u},"magenta","grey"),(0,o.printLine)("magenta");var s=[c,u];return(0,a.pathsExistSync)(s,"getWatcherTargets' directory and package path check"),{childDirPath:c,childPackagePath:u}});return this.watcher.targets=t,void 0!==this.watcher.targets?((0,o.printLine)("yellow"),u("".concat(i.default.yellow("watcher targets")," are defined \n")),(0,o.printMirror)({targets:t},"yellow","grey"),(0,o.printLine)("yellow",null,null,2)):((0,o.printLine)("red"),(0,o.printMirror)({targets:t},"red","white"),(0,o.printLine)("red")),this},s.prototype.getWatcherOptions=function(){var e=[];return(0,o.printLine)("green"),this.config.children.map(function(t){var r,i,c=t.dir;(0,o.printMirror)({dir:c},"green","grey"),e.push((r=c,i=n.default.join(r,"node_modules"),(0,a.pathsExistSync)(i,"getWatcherOptions -> getChildNodeModulesPath() path check"),i))}),(0,o.printLine)({character:".",color:"green"}),(0,o.printMirror)({childrenDirectoriesToIgnore:e},"green","grey"),(0,o.printLine)("green"),this.watcher.options={cwd:process.env.configRootDir||process.cwd(),ignored:["node_modules/**/*"].concat(e),ignoreInitial:!0,ignorePermissionErrors:!0,followSymlinks:!0},this},t.PTOParser=s,t.getWatcherConfig=function(e){var t=new s(e);t.getWatcherTargets().getWatcherOptions();var r=t.watcher,n=r.targets,a=r.options,c=r.parent;return(0,o.printLine)("yellow"),(0,o.printMirror)({targets:n},"yellow","grey"),u("".concat(i.default.yellow("options"),": ").concat(i.default.grey(JSON.stringify(a,null,2)))),(0,o.printLine)("yellow"),{parent:c,targets:n,options:a}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PTOWatcher=p,t.initWatcher=function(e){var t=new p(e);return t.getDirectories().createWatcher(),t};var n,i=r(10),o=(n=i)&&n.__esModule?n:{default:n},a=r(4),c=r(0),u=r(11);function s(e,t){var r=Object.keys(e);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e)),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}process.env.configRootDir||process.cwd();function p(e){return(0,c.printMirror)({oWatcherConfig:e},"blue","grey"),(0,a.pathsExistSync)(e.targets),this.parent=e.parent,this.targets=e.targets,this.options=e.options,this.directoriesToWatch=[],this.packagesToWatch=[],this}p.prototype.getDirectories=function(){var e=this,t=this.targets;return(0,c.printLine)("blue"),t.map(function(t){var r=t.childDirPath,n=t.childPackagePath;(0,c.printMirror)({childDirPath:r},"blue","grey"),(0,c.printMirror)({childPackagePath:n},"blue","grey"),e.directoriesToWatch.push(r),e.packagesToWatch.push(n)}),(0,c.printLine)("blue"),this},p.prototype.createWatcher=function(){var e,t=this,r=this.directoriesToWatch,n=this.options;if((0,a.pathsExistSync)(r),(0,c.printMirror)({directoriesToWatch:r},"blue","grey"),r.length>0&&(e=o.default.watch(r[0],function(e){for(var t=1;t1)for(var i=1;i {\n try {\n if (Array.isArray(arrPathsObj)) {\n arrPathsObj.map(async pathToCheck => {\n await fs.access(pathToCheck);\n });\n resolve([true, ...arrPathsObj]);\n } else {\n await fs.access(arrPathsObj);\n resolve([true, arrPathsObj]);\n }\n } catch (err) {\n reject(`${chalk.red(szPreErrorMessage)}: \\n ${chalk.grey(err)}`);\n }\n });\n}\nexport async function pathsExistSync(\n arrPathsObj,\n szPreErrorMessage = \"Path did not exist\"\n) {\n //TODO: Consider adding a return value (or prom) so it can be caught inline\n //TODO: Consider adding option to include printLine & printMirrors for success cases\n //TODO: Convert below into unit test (should pass)\n // let rightPath = [\n // {\n // dir: \"sandbox/npm-starter-sample-module/src\",\n // name: \"npm-starter-sample-module\"\n // }\n // ];\n // pathsExistOrThrow(targets, \"PTOWatcher failed to initialize properly \");\n //TODO: Convert below code into unit test (ie. should throw error)\n // let wrongPathString = \"foo\"\n // let wrongPathArray = [\n // {\n // foo: \"bar\"\n // }\n // ];\n // pathsExistOrThrow(wrongPathArray, \"PTOWatcher failed to initialize properly \");\n // pathsExistOrThrow(wrongPathString, \"PTOWatcher failed to initialize properly \");\n\n if (Array.isArray(arrPathsObj)) {\n let arrFilePaths = arrPathsObj.map(mTarget => {\n if (typeof mTarget == \"object\") {\n // * handle array of objects\n // * (ie. default case; used for testing watcherConfig's \"targets\" array)\n\n return Object.values(mTarget).map(pathToCheck => {\n return pathToCheck;\n });\n } else {\n // * handle array of strings\n // * (ie. manually defined arrays with file paths)\n\n return mTarget;\n }\n });\n for (let pathToCheck of arrFilePaths) {\n // ? Now iterate over the flattened map of paths (all should be strings)\n try {\n await fs.access(pathToCheck);\n } catch (err) {\n /*\n TODO: Figure out why this is being thrown\n ? Array of paths failed ----------------------------------------------------------- Path did not exist\n ? TypeError [ERR_INVALID_ARG_TYPE]: The \"path\" argument must be one of type string, Buffer, or URL. Received type object\n */\n log(\n `${chalk.red(\"Array of paths failed\")} ${printLine(\n \"red\"\n )} ${chalk.red(szPreErrorMessage)} \\n ${chalk.grey(err)}`\n );\n }\n }\n } else if (typeof arrPathsObj == \"string\") {\n // ? handle checking path of single string\n try {\n await fs.access(arrPathsObj);\n } catch (err) {\n printLine(\"red\");\n //TODO: Add a getLine() utility so that I can include in the middle of a log without needing to log inside of a log (which doesn't process stdout in proper order)\n log(\n `${chalk.red(\"Single string failed\")} \\n${chalk.red(\n szPreErrorMessage\n )} \\n ${chalk.grey(err)}`\n );\n printLine(\"red\");\n }\n }\n}\n","module.exports = require(\"is-empty\");","const log = console.log;\nimport path from \"path\";\nimport isEmpty from \"is-empty\";\nimport fs from \"fs-extra\";\nimport { getWatcherConfig } from \"./parser\";\nimport { initWatcher } from \"./watcher\";\nimport { printLine, printMirror } from \"tacker\";\nimport { pathsExistAsync } from \"./utilities\";\nimport chalk from \"chalk\";\n\nexport async function init(\n cwd = process.env.configRootDir || process.cwd(),\n oConfigOverride\n) {\n let oConfig;\n if (!isEmpty(oConfigOverride)) {\n printLine(\"cyan\");\n printMirror({ oConfigOverride }, \"cyan\", \"grey\");\n printLine(\"cyan\");\n oConfig = oConfigOverride;\n } else {\n let protatoPath = path.resolve(cwd, \".protato.json\");\n printLine(\"green\");\n printMirror({ protatoPath }, \"green\", \"grey\");\n //TODO: Change to fs.readJsonSync\n // let { config } = require(protatoPath);\n oConfig = await fs.readJson(protatoPath);\n let pathInfo = await pathsExistAsync(\n protatoPath,\n \".protato.json config not found\"\n );\n let protatoPathFlag = pathInfo[0];\n printMirror({ protatoPathFlag }, \"green\", \"grey\");\n printLine(\"green\");\n }\n let oWC = getWatcherConfig(oConfig);\n let hWatcher = initWatcher(oWC);\n hWatcher.getDirectories();\n}\n\nconst inlineConfig = {\n parent: {\n dir: \"sandbox/node-starter\"\n },\n children: [\n {\n dir: \"sandbox/npm-starter-sample-module\",\n src: \"src\"\n },\n {\n dir: \"sandbox/library-genesis\",\n src: \"src\"\n }\n ]\n};\n\ninit();\n// init(process.cwd(), inlineConfig);\n","const log = console.log;\nimport path from \"path\";\nimport chalk from \"chalk\";\nimport { printLine, printMirror } from \"tacker\";\nimport { pathsExistSync } from \"./utilities\";\n\nfunction PTOParser(config) {\n const { parent, children } = config;\n printLine(\"yellow\");\n log(\n `${chalk.yellow(\"parent\")} and ${chalk.yellow(\n \"children\"\n )} objects were both found`\n );\n printMirror({ parent }, \"yellow\", \"grey\");\n printMirror({ children }, \"yellow\", \"grey\");\n printLine(\"yellow\");\n\n this.watcher = { targets: undefined, options: undefined, parent };\n this.config = config;\n this.config.children = config.children;\n return this;\n}\n\nPTOParser.prototype.getWatcherTargets = function getWatcherTargets(\n children = this.config.children\n) {\n let targets = children.map(oChild => {\n let { dir, src } = oChild;\n let rootDir = process.env.configRootDir || process.cwd();\n let childDirPath = path.join(rootDir, dir, src);\n let childPackagePath = path.join(rootDir, dir, \"package.json\");\n\n printLine(\"magenta\");\n printMirror({ childDirPath }, \"magenta\", \"grey\");\n printMirror({ childPackagePath }, \"magenta\", \"grey\");\n printLine(\"magenta\");\n let pathsToCheck = [childDirPath, childPackagePath];\n\n pathsExistSync(\n pathsToCheck,\n \"getWatcherTargets' directory and package path check\"\n );\n return { childDirPath, childPackagePath };\n });\n this.watcher.targets = targets;\n if (this.watcher.targets !== undefined) {\n printLine(\"yellow\");\n log(`${chalk.yellow(\"watcher targets\")} are defined \\n`);\n printMirror({ targets }, \"yellow\", \"grey\");\n printLine(\"yellow\", null, null, 2);\n } else {\n printLine(\"red\");\n printMirror({ targets }, \"red\", \"white\");\n printLine(\"red\");\n }\n return this;\n};\n\nPTOParser.prototype.getWatcherOptions = function getWatcherOptions() {\n let childrenDirectoriesToIgnore = [];\n\n function getChildNodeModulesPath(szChildTargetPath) {\n let potentialPath = path.join(szChildTargetPath, \"node_modules\");\n pathsExistSync(\n potentialPath,\n \"getWatcherOptions -> getChildNodeModulesPath() path check\"\n );\n return potentialPath;\n }\n\n printLine(\"green\");\n this.config.children.map(child => {\n const { dir } = child;\n printMirror({ dir }, \"green\", \"grey\");\n\n childrenDirectoriesToIgnore.push(getChildNodeModulesPath(dir));\n });\n\n printLine({ character: \".\", color: \"green\" });\n printMirror({ childrenDirectoriesToIgnore }, \"green\", \"grey\");\n printLine(\"green\");\n\n this.watcher.options = {\n cwd: process.env.configRootDir || process.cwd(),\n ignored: [\"node_modules/**/*\", ...childrenDirectoriesToIgnore],\n ignoreInitial: true,\n ignorePermissionErrors: true,\n followSymlinks: true\n };\n return this;\n};\n\nfunction getWatcherConfig(oConfig) {\n let parser = new PTOParser(oConfig);\n parser.getWatcherTargets().getWatcherOptions();\n\n const {\n watcher: { targets, options, parent }\n } = parser;\n\n printLine(\"yellow\");\n printMirror({ targets }, \"yellow\", \"grey\");\n log(\n `${chalk.yellow(\"options\")}: ${chalk.grey(\n JSON.stringify(options, null, 2)\n )}`\n );\n printLine(\"yellow\");\n return {\n parent,\n targets,\n options\n };\n}\n\nexport { PTOParser, getWatcherConfig };\n","import chokidar from \"chokidar\";\nimport { pathsExistSync } from \"./utilities\";\nimport { printLine, printMirror } from \"tacker\";\nimport { linker } from \"./linker\";\n\nconst sampleConfig = {\n parent: {\n dir: \"sandbox/node-starter\"\n },\n targets: [\n {\n childDirPath: \"sandbox/npm-starter-sample-module/src\",\n childPackagePath: \"sandbox/npm-starter-sample-module/package.json\"\n }\n ],\n options: {\n cwd: process.env.configRootDir || process.cwd(),\n ignored: [\n \"node_modules\",\n \"sandbox/npm-starter-sample-module/node_modules\",\n \"sandbox/npm-starter-sample-module/.git\"\n ],\n ignoreInitial: true,\n ignorePermissionErrors: true,\n followSymlinks: true\n }\n};\n\nexport function PTOWatcher(oWatcherConfig) {\n printMirror({ oWatcherConfig }, \"blue\", \"grey\");\n pathsExistSync(oWatcherConfig.targets);\n this.parent = oWatcherConfig.parent;\n this.targets = oWatcherConfig.targets;\n this.options = oWatcherConfig.options;\n this.directoriesToWatch = [];\n this.packagesToWatch = [];\n\n return this;\n}\n\nPTOWatcher.prototype.getDirectories = function getDirectories() {\n let { targets } = this;\n printLine(\"blue\");\n targets.map(({ childDirPath, childPackagePath }) => {\n printMirror({ childDirPath }, \"blue\", \"grey\");\n printMirror({ childPackagePath }, \"blue\", \"grey\");\n this.directoriesToWatch.push(childDirPath);\n this.packagesToWatch.push(childPackagePath);\n });\n printLine(\"blue\");\n return this;\n};\n\nPTOWatcher.prototype.createWatcher = function createWatcher() {\n const { directoriesToWatch, options } = this;\n pathsExistSync(directoriesToWatch);\n printMirror({ directoriesToWatch }, \"blue\", \"grey\");\n var watcher;\n //TODO: Add a new sample repo to repogen\n //TODO: Create backup config to test whether this works with 2+ directories\n if (directoriesToWatch.length > 0) {\n watcher = chokidar.watch(directoriesToWatch[0], { ...options });\n }\n if (directoriesToWatch.length > 1) {\n for (let i = 1; i < directoriesToWatch.length; i++) {\n watcher.add(directoriesToWatch[i]);\n }\n }\n watcher.on(\"change\", modifiedChildPath => {\n printMirror({ modifiedChildPath }, \"green\", \"grey\");\n linker(modifiedChildPath, this.parent.dir);\n });\n};\n\nexport function initWatcher(oWatcherConfig) {\n let watcher = new PTOWatcher(oWatcherConfig);\n watcher.getDirectories().createWatcher();\n return watcher;\n}\n","module.exports = require(\"chokidar\");","const log = console.log;\nimport chalk from \"chalk\";\nimport path from \"path\";\nimport isEmpty from \"is-empty\";\nimport pkgDir from \"pkg-dir\";\nimport exec from \"await-exec\";\nimport fs from \"fs-extra\";\n\nimport { printLine, printMirror } from \"tacker\";\n\n//TODO: Check to see whether yalc installed globally. If not, install. If install fails, throw err & explain\n\nexport async function linker(szModifiedFilePath, szParentDirPath) {\n if (!isEmpty(szModifiedFilePath) | !isEmpty(szParentDirPath)) {\n printMirror({ szModifiedFilePath }, \"magenta\", \"grey\");\n printMirror({ szParentDirPath }, \"magenta\", \"grey\");\n let childData, parentData, childModuleName;\n try {\n let modifiedRootDir = await pkgDir(szModifiedFilePath);\n printLine(\"blue\");\n printMirror({ modifiedRootDir }, \"magenta\", \"green\");\n let modifiedPkgPath = path.join(modifiedRootDir, \"package.json\");\n printMirror({ modifiedPkgPath }, \"magenta\", \"green\");\n //TODO: Change to fs.readJsonSync\n const { name } = await fs.readJson(modifiedPkgPath);\n // const { name } = require(modifiedPkgPath);\n childModuleName = name;\n printMirror({ childModuleName }, \"blue\", \"grey\");\n printLine(\"blue\");\n childData = await exec(`cd ${modifiedRootDir} && yalc publish`);\n printLine(\"green\");\n log(`childData: ${JSON.stringify(childData, null, 2)}`);\n printLine(\"green\");\n } catch (err) {\n log(`${chalk.red(\"'yalc publish' failed\")}\\n${chalk.grey(err)}`);\n }\n\n try {\n let parentRootDir = await pkgDir(szParentDirPath);\n printMirror({ parentRootDir }, \"magenta\", \"green\");\n parentData = await exec(\n `cd ${parentRootDir} && yalc link ${childModuleName}`\n );\n printLine(\"yellow\");\n log(`parentData: ${JSON.stringify(parentData, null, 2)}`);\n printLine(\"yellow\");\n } catch (err) {\n log(\n `${chalk.red(\n `yalc add ${childModuleName} in ${chalk.yellow(parentRootDir)} failed`\n )}\\n${chalk.grey(err)}`\n );\n }\n } else {\n printLine(\"green\");\n log(`parentDirectory not set`);\n printLine(\"green\");\n }\n return this;\n}\n","module.exports = require(\"pkg-dir\");","module.exports = require(\"await-exec\");"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"tacker\"","webpack:///external \"chalk\"","webpack:///external \"path\"","webpack:///external \"fs-extra\"","webpack:///./src/utilities.js","webpack:///external \"is-empty\"","webpack:///./src/index.js","webpack:///./src/parser.js","webpack:///./src/watcher.js","webpack:///external \"chokidar\"","webpack:///./src/linker.js","webpack:///external \"pkg-dir\"","webpack:///external \"await-exec\""],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","require","pathsExistAsync","arrPathsObj","szPreErrorMessage","Promise","_ref","_asyncToGenerator","regeneratorRuntime","mark","_callee2","resolve","reject","wrap","_context2","prev","next","Array","isArray","map","_ref2","_callee","pathToCheck","_context","fs","access","stop","_x3","apply","this","arguments","concat","t0","chalk","red","grey","_x","_x2","pathsExistSync","_tacker","log","console","_callee3","arrFilePaths","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","_step","_args3","_context3","length","undefined","mTarget","_typeof","values","iterator","done","printLine","t1","return","finish","t2","init","_parser","_watcher","_utilities","cwd","oConfigOverride","oConfig","protatoPath","pathInfo","protatoPathFlag","oWC","_args","process","env","configRootDir","_isEmpty2","default","printMirror","path","readJson","sent","getWatcherConfig","initWatcher","getDirectories","PTOParser","config","parent","children","yellow","watcher","targets","options","getWatcherTargets","oChild","dir","src","rootDir","childDirPath","join","childPackagePath","pathsToCheck","getWatcherOptions","childrenDirectoriesToIgnore","child","szChildTargetPath","potentialPath","push","character","color","ignored","ignoreInitial","ignorePermissionErrors","followSymlinks","parser","_parser$watcher","JSON","stringify","PTOWatcher","oWatcherConfig","createWatcher","_chokidar","_linker","directoriesToWatch","packagesToWatch","_this","_this2","chokidar","watch","_objectSpread","add","on","modifiedChildPath","linker","szModifiedFilePath","szParentDirPath","childData","parentData","childModuleName","modifiedRootDir","modifiedPkgPath","_parentRootDir","_pkgDir2","_awaitExec2","parentRootDir","abrupt"],"mappings":"6DACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QA0DA,OArDAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CZ,EAAAkB,EAAA,SAA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,UAAMC,IAAN,YAAAH,OACW6G,EADX,QAAA7G,OACiCE,UAAM0D,OAAOuD,eAD9C,YADF,MAAAnH,OAGKE,UAAME,KAANZ,EAAAoC,MAtCP,QAAApC,EAAAP,KAAA,kBA0CH,EAAAuB,EAAAmB,WAAU,SACVlB,EAAG,4BACH,EAAAD,EAAAmB,WAAU,SA5CP,eAAAnC,EAAA4H,OAAA,SA8CEtH,MA9CF,yBAAAN,EAAAG,SAAAL,EAAAQ,KAAA,0OCZP7D,EAAAD,QAAAkC,QAAA,0BCAAjC,EAAAD,QAAAkC,QAAA","file":"main.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n","module.exports = require(\"tacker\");","module.exports = require(\"chalk\");","module.exports = require(\"path\");","module.exports = require(\"fs-extra\");","import chalk from \"chalk\";\nimport fs from \"fs-extra\";\nimport { printLine } from \"tacker\";\nconst log = console.log;\n\nexport function pathsExistAsync(arrPathsObj, szPreErrorMessage) {\n return new Promise(async (resolve, reject) => {\n try {\n if (Array.isArray(arrPathsObj)) {\n arrPathsObj.map(async pathToCheck => {\n await fs.access(pathToCheck);\n });\n resolve([true, ...arrPathsObj]);\n } else {\n await fs.access(arrPathsObj);\n resolve([true, arrPathsObj]);\n }\n } catch (err) {\n reject(`${chalk.red(szPreErrorMessage)}: \\n ${chalk.grey(err)}`);\n }\n });\n}\nexport async function pathsExistSync(\n arrPathsObj,\n szPreErrorMessage = \"Path did not exist\"\n) {\n //TODO: Consider adding a return value (or prom) so it can be caught inline\n //TODO: Consider adding option to include printLine & printMirrors for success cases\n //TODO: Convert below into unit test (should pass)\n // let rightPath = [\n // {\n // dir: \"sandbox/npm-starter-sample-module/src\",\n // name: \"npm-starter-sample-module\"\n // }\n // ];\n // pathsExistOrThrow(targets, \"PTOWatcher failed to initialize properly \");\n //TODO: Convert below code into unit test (ie. should throw error)\n // let wrongPathString = \"foo\"\n // let wrongPathArray = [\n // {\n // foo: \"bar\"\n // }\n // ];\n // pathsExistOrThrow(wrongPathArray, \"PTOWatcher failed to initialize properly \");\n // pathsExistOrThrow(wrongPathString, \"PTOWatcher failed to initialize properly \");\n\n if (Array.isArray(arrPathsObj)) {\n let arrFilePaths = arrPathsObj.map(mTarget => {\n if (typeof mTarget == \"object\") {\n // * handle array of objects\n // * (ie. default case; used for testing watcherConfig's \"targets\" array)\n\n return Object.values(mTarget).map(pathToCheck => {\n return pathToCheck;\n });\n } else {\n // * handle array of strings\n // * (ie. manually defined arrays with file paths)\n\n return mTarget;\n }\n });\n for (let pathToCheck of arrFilePaths) {\n // ? Now iterate over the flattened map of paths (all should be strings)\n try {\n await fs.access(pathToCheck);\n } catch (err) {\n /*\n TODO: Figure out why this is being thrown\n ? Array of paths failed ----------------------------------------------------------- Path did not exist\n ? TypeError [ERR_INVALID_ARG_TYPE]: The \"path\" argument must be one of type string, Buffer, or URL. Received type object\n */\n log(\n `${chalk.red(\"Array of paths failed\")} ${printLine(\n \"red\"\n )} ${chalk.red(szPreErrorMessage)} \\n ${chalk.grey(err)}`\n );\n }\n }\n } else if (typeof arrPathsObj == \"string\") {\n // ? handle checking path of single string\n try {\n await fs.access(arrPathsObj);\n } catch (err) {\n printLine(\"red\");\n //TODO: Add a getLine() utility so that I can include in the middle of a log without needing to log inside of a log (which doesn't process stdout in proper order)\n log(\n `${chalk.red(\"Single string failed\")} \\n${chalk.red(\n szPreErrorMessage\n )} \\n ${chalk.grey(err)}`\n );\n printLine(\"red\");\n }\n }\n}\n","module.exports = require(\"is-empty\");","const log = console.log;\nimport path from \"path\";\nimport isEmpty from \"is-empty\";\nimport fs from \"fs-extra\";\nimport { getWatcherConfig } from \"./parser\";\nimport { initWatcher } from \"./watcher\";\nimport { printLine, printMirror } from \"tacker\";\nimport { pathsExistAsync } from \"./utilities\";\nimport chalk from \"chalk\";\n\nexport async function init(\n cwd = process.env.configRootDir || process.cwd(),\n oConfigOverride\n) {\n let oConfig;\n if (!isEmpty(oConfigOverride)) {\n printLine(\"cyan\");\n printMirror({ oConfigOverride }, \"cyan\", \"grey\");\n printLine(\"cyan\");\n oConfig = oConfigOverride;\n } else {\n let protatoPath = path.resolve(cwd, \".protato.json\");\n printLine(\"cyan\");\n printMirror({ protatoPath }, \"cyan\", \"grey\");\n //TODO: Change to fs.readJsonSync\n // let { config } = require(protatoPath);\n oConfig = await fs.readJson(protatoPath);\n let pathInfo = await pathsExistAsync(\n protatoPath,\n \".protato.json config not found\"\n );\n let protatoPathFlag = pathInfo[0];\n printMirror({ protatoPathFlag }, \"cyan\", \"grey\");\n printLine(\"cyan\");\n }\n let oWC = getWatcherConfig(oConfig);\n let hWatcher = initWatcher(oWC);\n hWatcher.getDirectories();\n}\n\nconst inlineConfig = {\n parent: {\n dir: \"sandbox/node-starter\"\n },\n children: [\n {\n dir: \"sandbox/npm-starter-sample-module\",\n src: \"src\"\n },\n {\n dir: \"sandbox/library-genesis\",\n src: \"src\"\n }\n ]\n};\n\n// init();\n// init(process.cwd(), inlineConfig);\n","const log = console.log;\nimport path from \"path\";\nimport chalk from \"chalk\";\nimport { printLine, printMirror } from \"tacker\";\nimport { pathsExistSync } from \"./utilities\";\n\nfunction PTOParser(config) {\n const { parent, children } = config;\n printLine(\"yellow\");\n log(\n `${chalk.yellow(\"parent\")} and ${chalk.yellow(\n \"children\"\n )} objects were both found`\n );\n printMirror({ parent }, \"yellow\", \"grey\");\n printMirror({ children }, \"yellow\", \"grey\");\n printLine(\"yellow\");\n\n this.watcher = { targets: undefined, options: undefined, parent };\n this.config = config;\n this.config.children = config.children;\n return this;\n}\n\nPTOParser.prototype.getWatcherTargets = function getWatcherTargets(\n children = this.config.children\n) {\n let targets = children.map(oChild => {\n let { dir, src } = oChild;\n let rootDir = process.env.configRootDir || process.cwd();\n let childDirPath = path.join(rootDir, dir, src);\n let childPackagePath = path.join(rootDir, dir, \"package.json\");\n\n printLine(\"magenta\");\n printMirror({ childDirPath }, \"magenta\", \"grey\");\n printMirror({ childPackagePath }, \"magenta\", \"grey\");\n printLine(\"magenta\");\n let pathsToCheck = [childDirPath, childPackagePath];\n\n pathsExistSync(\n pathsToCheck,\n \"getWatcherTargets' directory and package path check\"\n );\n return { childDirPath, childPackagePath };\n });\n this.watcher.targets = targets;\n if (this.watcher.targets !== undefined) {\n printLine(\"yellow\");\n log(`${chalk.yellow(\"watcher targets\")} are defined \\n`);\n printMirror({ targets }, \"yellow\", \"grey\");\n printLine(\"yellow\", null, null, 2);\n } else {\n printLine(\"red\");\n printMirror({ targets }, \"red\", \"white\");\n printLine(\"red\");\n }\n return this;\n};\n\nPTOParser.prototype.getWatcherOptions = function getWatcherOptions() {\n let childrenDirectoriesToIgnore = [];\n\n function getChildNodeModulesPath(szChildTargetPath) {\n let potentialPath = path.join(szChildTargetPath, \"node_modules\");\n pathsExistSync(\n potentialPath,\n \"getWatcherOptions -> getChildNodeModulesPath() path check\"\n );\n return potentialPath;\n }\n\n printLine(\"green\");\n this.config.children.map(child => {\n const { dir } = child;\n printMirror({ dir }, \"green\", \"grey\");\n\n childrenDirectoriesToIgnore.push(getChildNodeModulesPath(dir));\n });\n\n printLine({ character: \".\", color: \"green\" });\n printMirror({ childrenDirectoriesToIgnore }, \"green\", \"grey\");\n printLine(\"green\");\n\n this.watcher.options = {\n cwd: process.env.configRootDir || process.cwd(),\n ignored: [\"node_modules/**/*\", ...childrenDirectoriesToIgnore],\n ignoreInitial: true,\n ignorePermissionErrors: true,\n followSymlinks: true\n };\n return this;\n};\n\nfunction getWatcherConfig(oConfig) {\n let parser = new PTOParser(oConfig);\n parser.getWatcherTargets().getWatcherOptions();\n\n const {\n watcher: { targets, options, parent }\n } = parser;\n\n printLine(\"yellow\");\n printMirror({ targets }, \"yellow\", \"grey\");\n log(\n `${chalk.yellow(\"options\")}: ${chalk.grey(\n JSON.stringify(options, null, 2)\n )}`\n );\n printLine(\"yellow\");\n return {\n parent,\n targets,\n options\n };\n}\n\nexport { PTOParser, getWatcherConfig };\n","import chokidar from \"chokidar\";\nimport { pathsExistSync } from \"./utilities\";\nimport { printLine, printMirror } from \"tacker\";\nimport { linker } from \"./linker\";\n\nconst sampleConfig = {\n parent: {\n dir: \"sandbox/node-starter\"\n },\n targets: [\n {\n childDirPath: \"sandbox/npm-starter-sample-module/src\",\n childPackagePath: \"sandbox/npm-starter-sample-module/package.json\"\n }\n ],\n options: {\n cwd: process.env.configRootDir || process.cwd(),\n ignored: [\n \"node_modules\",\n \"sandbox/npm-starter-sample-module/node_modules\",\n \"sandbox/npm-starter-sample-module/.git\"\n ],\n ignoreInitial: true,\n ignorePermissionErrors: true,\n followSymlinks: true\n }\n};\n\nexport function PTOWatcher(oWatcherConfig) {\n printMirror({ oWatcherConfig }, \"blue\", \"grey\");\n pathsExistSync(oWatcherConfig.targets);\n this.parent = oWatcherConfig.parent;\n this.targets = oWatcherConfig.targets;\n this.options = oWatcherConfig.options;\n this.directoriesToWatch = [];\n this.packagesToWatch = [];\n\n return this;\n}\n\nPTOWatcher.prototype.getDirectories = function getDirectories() {\n let { targets } = this;\n printLine(\"blue\");\n targets.map(({ childDirPath, childPackagePath }) => {\n printMirror({ childDirPath }, \"blue\", \"grey\");\n printMirror({ childPackagePath }, \"blue\", \"grey\");\n this.directoriesToWatch.push(childDirPath);\n this.packagesToWatch.push(childPackagePath);\n });\n printLine(\"blue\");\n return this;\n};\n\nPTOWatcher.prototype.createWatcher = function createWatcher() {\n const { directoriesToWatch, options } = this;\n pathsExistSync(directoriesToWatch);\n printMirror({ directoriesToWatch }, \"blue\", \"grey\");\n var watcher;\n //TODO: Add a new sample repo to repogen\n //TODO: Create backup config to test whether this works with 2+ directories\n if (directoriesToWatch.length > 0) {\n watcher = chokidar.watch(directoriesToWatch[0], { ...options });\n }\n if (directoriesToWatch.length > 1) {\n for (let i = 1; i < directoriesToWatch.length; i++) {\n watcher.add(directoriesToWatch[i]);\n }\n }\n watcher.on(\"change\", modifiedChildPath => {\n printMirror({ modifiedChildPath }, \"green\", \"grey\");\n linker(modifiedChildPath, this.parent.dir);\n });\n};\n\nexport function initWatcher(oWatcherConfig) {\n let watcher = new PTOWatcher(oWatcherConfig);\n watcher.getDirectories().createWatcher();\n return watcher;\n}\n","module.exports = require(\"chokidar\");","const log = console.log;\nimport chalk from \"chalk\";\nimport path from \"path\";\nimport isEmpty from \"is-empty\";\nimport pkgDir from \"pkg-dir\";\nimport exec from \"await-exec\";\nimport fs from \"fs-extra\";\n\nimport { printLine, printMirror } from \"tacker\";\n\n//TODO: Check to see whether yalc installed globally. If not, install. If install fails, throw err & explain\n\nexport async function linker(szModifiedFilePath, szParentDirPath) {\n if (!isEmpty(szModifiedFilePath) | !isEmpty(szParentDirPath)) {\n printMirror({ szModifiedFilePath }, \"magenta\", \"grey\");\n printMirror({ szParentDirPath }, \"magenta\", \"grey\");\n let childData, parentData, childModuleName;\n try {\n let modifiedRootDir = await pkgDir(szModifiedFilePath);\n printLine(\"blue\");\n printMirror({ modifiedRootDir }, \"magenta\", \"green\");\n let modifiedPkgPath = path.join(modifiedRootDir, \"package.json\");\n printMirror({ modifiedPkgPath }, \"magenta\", \"green\");\n //TODO: Change to fs.readJsonSync\n const { name } = await fs.readJson(modifiedPkgPath);\n // const { name } = require(modifiedPkgPath);\n childModuleName = name;\n printMirror({ childModuleName }, \"blue\", \"grey\");\n printLine(\"blue\");\n childData = await exec(`cd ${modifiedRootDir} && yalc publish`);\n printLine(\"green\");\n log(`childData: ${JSON.stringify(childData, null, 2)}`);\n printLine(\"green\");\n } catch (err) {\n log(`${chalk.red(\"'yalc publish' failed\")}\\n${chalk.grey(err)}`);\n }\n\n try {\n let parentRootDir = await pkgDir(szParentDirPath);\n printMirror({ parentRootDir }, \"magenta\", \"green\");\n parentData = await exec(\n `cd ${parentRootDir} && yalc link ${childModuleName}`\n );\n printLine(\"yellow\");\n log(`parentData: ${JSON.stringify(parentData, null, 2)}`);\n printLine(\"yellow\");\n } catch (err) {\n log(\n `${chalk.red(\n `yalc add ${childModuleName} in ${chalk.yellow(parentRootDir)} failed`\n )}\\n${chalk.grey(err)}`\n );\n }\n } else {\n printLine(\"green\");\n log(`parentDirectory not set`);\n printLine(\"green\");\n }\n return this;\n}\n","module.exports = require(\"pkg-dir\");","module.exports = require(\"await-exec\");"],"sourceRoot":""} \ No newline at end of file