file-prompt
Advanced tools
Comparing version 1.0.0 to 1.1.0
/* eslint no-console: 0 */ | ||
import gulp from 'gulp'; | ||
import { colors } from 'gulp-util'; | ||
import log from 'gutil-waterlog'; | ||
import log from 'liquidlog'; | ||
@@ -6,0 +6,0 @@ // Load all of our tasks -- in the future we might be able to make it |
@@ -31,3 +31,3 @@ { | ||
"gulp-watch": ">= 4.3.5", | ||
"gutil-waterlog": ">= 0.0.5", | ||
"liquidlog": ">= 0.0.5", | ||
"minimist": ">= 1.2.0", | ||
@@ -34,0 +34,0 @@ "strip-json-comments": ">= 1.0.4", |
@@ -15,3 +15,3 @@ /** | ||
// Libraries | ||
import log from 'gutil-waterlog'; | ||
import log from 'liquidlog'; | ||
import tap from '../lib/tap'; | ||
@@ -18,0 +18,0 @@ |
@@ -11,3 +11,3 @@ /** | ||
import path from 'path'; | ||
import log from 'gutil-waterlog'; | ||
import log from 'liquidlog'; | ||
import project from '../config/project'; | ||
@@ -14,0 +14,0 @@ |
@@ -6,3 +6,3 @@ /** | ||
import path from 'path'; | ||
import log from 'gutil-waterlog'; | ||
import log from 'liquidlog'; | ||
@@ -9,0 +9,0 @@ let files = [], |
@@ -15,3 +15,3 @@ /* eslint quote-props: [0, "consistent-as-needed"] */ | ||
// Libraries | ||
import log from 'gutil-waterlog'; | ||
import log from 'liquidlog'; | ||
import tap from '../lib/tap'; | ||
@@ -18,0 +18,0 @@ |
@@ -10,3 +10,3 @@ /* eslint no-process-env: 0 */ | ||
import gulp from 'gulp'; | ||
import log from 'gutil-waterlog'; | ||
import log from 'liquidlog'; | ||
import minimist from 'minimist'; | ||
@@ -13,0 +13,0 @@ import mocha from 'gulp-mocha'; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function readDir(e,t){var r={},n=new _minimatch2["default"].Minimatch(t);return _fs2["default"].readdirSync(e).filter(n.match,n).forEach(function(t){var n=_path2["default"].basename(t,"_page.js");r[n]=require(_path2["default"].resolve(__dirname,e,t))["default"]}),r}function selectCurrentPage(e){return e.getState().currentPage}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _component=require("./component"),_component2=_interopRequireDefault(_component),_fs=require("fs"),_fs2=_interopRequireDefault(_fs),_minimatch=require("minimatch"),_minimatch2=_interopRequireDefault(_minimatch),_path=require("path"),_path2=_interopRequireDefault(_path),_reducers=require("./reducers"),_reducers2=_interopRequireDefault(_reducers),_redux=require("redux"),_actions=require("./actions"),App=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return r.store=(0,_redux.createStore)(_reducers2["default"],{config:{base:r.props.base},files:[],glob:r.props.glob,currentPage:{name:"index",props:{}}}),r}return _inherits(t,e),_createClass(t,[{key:"getDefaultProps",value:function(){return{base:process.cwd(),filter:"**/*.js",stdin:process.stdin,stdout:process.stdout}}},{key:"getInitialState",value:function(){return{pageName:null,pageProps:null}}},{key:"componentWillMount",value:function(){var e=this,t=selectCurrentPage(this.store);this.once("complete",function(){e.componentWillUnmount()},this),this.once("error",function(){e.componentWillUnmount()},this),this.setState({pageName:t.name,pageProps:t.props})}},{key:"componentDidMount",value:function(){var e=this;this.unsubscribe=this.store.subscribe(function(){var t=selectCurrentPage(e.store);t.is_navigating&&(e.setState({pageName:t.name,pageProps:t.props}),_component2["default"].display(e),e.store.dispatch((0,_actions.navigateComplete)()))})}},{key:"componentWillUnmount",value:function(){this.off(),this.unsubscribe()}},{key:"renderPage",value:function(){var e={app:this,store:this.store,stdin:this.props.stdin,stdout:this.props.stdout};if(!t.PAGES.hasOwnProperty(this.state.pageName))throw new Error("App: Page does not exist “"+this.state.pageName+"”.");return this.state.pageProps&&Object.assign(e,this.state.pageProps),new t.PAGES[this.state.pageName](e).render()}},{key:"render",value:function(){return this.renderPage()}}]),t}(_component2["default"]);App.PAGES=readDir(_path2["default"].join(__dirname,"pages"),"*_page.js"),exports["default"]=App; | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function readDir(e,t){var r={},n=new _minimatch2["default"].Minimatch(t);return _fs2["default"].readdirSync(e).filter(n.match,n).forEach(function(t){var n=_path2["default"].basename(t,"_page.js");r[n]=require(_path2["default"].resolve(__dirname,e,t))["default"]}),r}function selectCurrentPage(e){return e.getState().currentPage}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _component=require("./component"),_component2=_interopRequireDefault(_component),_fs=require("fs"),_fs2=_interopRequireDefault(_fs),_minimatch=require("minimatch"),_minimatch2=_interopRequireDefault(_minimatch),_path=require("path"),_path2=_interopRequireDefault(_path),_reducers=require("./reducers"),_reducers2=_interopRequireDefault(_reducers),_redux=require("redux"),_actions=require("./actions"),App=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return r.store=(0,_redux.createStore)(_reducers2["default"],{config:{base:r.props.base},files:[],glob:r.props.glob,currentPage:{name:"index",props:{glob:r.props.glob},isNavigating:!1}}),r}return _inherits(t,e),_createClass(t,[{key:"getDefaultProps",value:function(){return{base:process.cwd(),filter:"**/*.js",stdin:process.stdin,stdout:process.stdout}}},{key:"getInitialState",value:function(){return{pageName:null,pageProps:null}}},{key:"componentWillMount",value:function(){var e=this,t=selectCurrentPage(this.store);this.once("complete",function(){e.componentWillUnmount()},this),this.once("error",function(){e.componentWillUnmount()},this),this.setState({pageName:t.name,pageProps:t.props})}},{key:"componentDidMount",value:function(){var e=this;this.unsubscribe=this.store.subscribe(function(){var t=selectCurrentPage(e.store);t.isNavigating&&(e.setState({pageName:t.name,pageProps:t.props}),_component2["default"].display(e),e.store.dispatch((0,_actions.navigateComplete)()))})}},{key:"componentWillUnmount",value:function(){this.off(),this.unsubscribe()}},{key:"renderPage",value:function(){var e={app:this,store:this.store,stdin:this.props.stdin,stdout:this.props.stdout};if(!t.PAGES.hasOwnProperty(this.state.pageName))throw new Error("App: Page does not exist “"+this.state.pageName+"”.");return this.state.pageProps&&Object.assign(e,this.state.pageProps),new t.PAGES[this.state.pageName](e).render()}},{key:"render",value:function(){return this.renderPage()}}]),t}(_component2["default"]);App.PAGES=readDir(_path2["default"].join(__dirname,"pages"),"*_page.js"),exports["default"]=App; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _chalk=require("chalk"),_chalk2=_interopRequireDefault(_chalk),_column=require("./util/column"),_column2=_interopRequireDefault(_column),_component=require("./component"),_component2=_interopRequireDefault(_component),_bluebird=require("bluebird"),_bluebird2=_interopRequireDefault(_bluebird),_query=require("./query"),_query2=_interopRequireDefault(_query),_stripAnsi=require("strip-ansi"),_stripAnsi2=_interopRequireDefault(_stripAnsi),ITEMS_PER_ROW=4,MAX_COLUMN_LENGTH=20,Menu=function(e){function t(e){return _classCallCheck(this,t),_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e))}return _inherits(t,e),_createClass(t,[{key:"getDefaultProps",value:function(){return{options:[],canUnselect:!1,acceptsMany:!1,stdout:process.stdout,stdin:process.stdin}}},{key:"getInitialState",value:function(){return{options:this.props.options||[]}}},{key:"each",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?this:arguments[1];return this.options().forEach(e,t),this}},{key:"find",value:function(e,t){var r=this;return new _bluebird2["default"](function(n,o){var i=[],u=[];if(""===e.trim())return n({selectedItems:[{action:null,value:null}],queryCount:1});if(!_query2["default"].isValid(e))return r.error(e,o);if(i=_query2["default"].createFrom(e),i.length>1&&!r.props.acceptsMany&&o(new Error("no_match")),t&&"function"==typeof t&&(i=t(i)||[]),u=r.processQueries(i,o),!u.length)throw new Error("no_match");n({selectedItems:u,queryCount:i.length})})["catch"](function(t){switch(t.message||t){case"no_match":r.props.stdout.write(r.formatError(e));break;default:r.props.app.emit("error",t),r.props.stdin.pause(),r.props.stdout.write("\n"+(t.stack||t.message)+"\n")}throw t})}},{key:"findByName",value:function(e){var t=this.filter(function(t){return e.isStartOf(t.name)});return 1!==t.length?[]:t.map(function(e){return e.id})}},{key:"filter",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?this:arguments[1];return this.options().filter(e,t)}},{key:"formatError",value:function(e){var t=(0,_stripAnsi2["default"])(e);return t&&(t="("+t+")"),_chalk2["default"].red.bold("Huh "+t+"?\n")}},{key:"getOptionValue",value:function(e){return this.filter(function(t){return t.id===e})[0].value}},{key:"hasOption",value:function(e){return this.options().map(function(e){return e.id}).indexOf(Number(e))>-1}},{key:"options",value:function(){return this.state.options}},{key:"processQueries",value:function(e){var t=this,r=[],n=!1;return e.forEach(function(e){var o=e.data,i=o.type,u=o.action,a=o.value,s=void 0;if("unselect"===u&&!t.props.canUnselect)throw n=!0,new Error("no_match");switch(i){case"all":if(!t.props.acceptsMany)throw n=!0,new Error("no_match");s=t.options().map(function(e){return e.id});break;case"range":if(!t.props.acceptsMany)throw n=!0,new Error("no_match");s=t.range(a.min,a.max);break;case"id":if(!t.hasOption(a))return void(n=!0);s=[a];break;case"string":s=t.findByName(e)}if(!(s&&s.length||n))throw new Error("no_match");s=s.map(function(e){return{action:u,id:e,type:i,value:t.getOptionValue(e)}}),r=r.concat(s)}),r}},{key:"range",value:function(e,t){return" ".repeat(t-e).split(" ").map(function(t,r){return r+e}).filter(this.hasOption,this)}},{key:"setOptions",value:function(e){this.setState({options:e})}},{key:"renderLabel",value:function(e){return""+_chalk2["default"].magenta.bold(e.slice(0,1))+e.slice(1)}},{key:"renderOption",value:function(e,t){var r=(t+1)%ITEMS_PER_ROW===0,n=" "+e.id+": "+this.renderLabel(e.label);return n=(0,_column2["default"])(n,MAX_COLUMN_LENGTH),n+" "+(r?"\n":"")}},{key:"render",value:function(){return this.state.options.map(this.renderOption,this).join("")}}]),t}(_component2["default"]);exports["default"]=Menu; | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _chalk=require("chalk"),_chalk2=_interopRequireDefault(_chalk),_column=require("./util/column"),_column2=_interopRequireDefault(_column),_component=require("./component"),_component2=_interopRequireDefault(_component),ITEMS_PER_ROW=4,MAX_COLUMN_LENGTH=20,Menu=function(e){function t(e){return _classCallCheck(this,t),_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e))}return _inherits(t,e),_createClass(t,[{key:"getDefaultProps",value:function(){return{options:[],stdout:process.stdout,stdin:process.stdin}}},{key:"getInitialState",value:function(){return{options:this.props.options||[]}}},{key:"options",value:function(){return this.state.options}},{key:"setOptions",value:function(e){this.setState({options:e})}},{key:"renderLabel",value:function(e){return""+_chalk2["default"].magenta.bold(e.slice(0,1))+e.slice(1)}},{key:"renderOption",value:function(e,t){var n=(t+1)%ITEMS_PER_ROW===0,o=" "+e.id+": "+this.renderLabel(e.label);return o=(0,_column2["default"])(o,MAX_COLUMN_LENGTH),o+" "+(n?"\n":"")}},{key:"render",value:function(){return this.state.options.map(this.renderOption,this).join("")}}]),t}(_component2["default"]);exports["default"]=Menu; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _chalk=require("chalk"),_chalk2=_interopRequireDefault(_chalk),_component=require("./component"),_component2=_interopRequireDefault(_component),_actions=require("./actions"),Page=function(e){function t(e){return _classCallCheck(this,t),_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e))}return _inherits(t,e),_createClass(t,null,[{key:"NoMatchError",value:function(e){return"no_match"===e.message}}]),_createClass(t,[{key:"getDefaultProps",value:function(){return{stdin:process.stdin,stdout:process.stdout}}},{key:"getInitialState",value:function(){return{selected:[]}}},{key:"dispatch",value:function(e){return this.props.store.dispatch(e)}},{key:"displayError",value:function(e){"no_match"!==e.message&&process.stderr.write(_chalk2["default"].bold.red(e.stack||e.message)+"\n")}},{key:"getBasedir",value:function(){return this.props.base||this.select("config.base")}},{key:"getGlob",value:function(){return this.props.glob||this.select("glob")}},{key:"navigate",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];this.dispatch((0,_actions.navigate)(e,t))}},{key:"select",value:function(e){var t=this.props.store.getState();return e.split(".").map(function(e){t=t[e]}),t}},{key:"render",value:function(){var e=[];return this.renderIntro&&e.push(this.renderIntro()),this.renderMenu&&e.push(this.renderMenu()),this.renderPrompt&&e.push(this.renderPrompt()),e}}]),t}(_component2["default"]);exports["default"]=Page; | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _component=require("./component"),_component2=_interopRequireDefault(_component),_bind_methods=require("./util/bind_methods"),_bind_methods2=_interopRequireDefault(_bind_methods),_actions=require("./actions"),Page=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return(0,_bind_methods2["default"])(r,"errorHandler","pipeTo","reprompt","route","showPrompt"),r}return _inherits(t,e),_createClass(t,[{key:"getDefaultProps",value:function(){return{stdin:process.stdin,stdout:process.stdout}}},{key:"getInitialState",value:function(){return{selected:[]}}},{key:"dispatch",value:function(e){return this.props.store.dispatch(e)}},{key:"errorHandler",value:function(e){this.props.app.emmit("error",e)}},{key:"getBasedir",value:function(){return this.props.base||this.select("config.base")}},{key:"getGlob",value:function(){return this.props.glob||this.select("glob")}},{key:"navigate",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];this.dispatch((0,_actions.navigate)(e,t))}},{key:"pipeTo",value:function(e){return e.on("restart",this.reprompt)}},{key:"reprompt",value:function(){this.renderComponent(),t.display(this)}},{key:"select",value:function(e){var t=this.props.store.getState();return e.split(".").map(function(e){t=t[e]}),t}},{key:"render",value:function(){var e=[];return this.renderIntro&&e.push(this.renderIntro()),this.renderMenu&&e.push(this.renderMenu()),this.renderPrompt&&e.push(this.renderPrompt()),e}}]),t}(_component2["default"]);exports["default"]=Page; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _vertical_menu=require("../vertical_menu"),_vertical_menu2=_interopRequireDefault(_vertical_menu),_minimatch=require("minimatch"),_minimatch2=_interopRequireDefault(_minimatch),_page=require("../page"),_page2=_interopRequireDefault(_page),_path=require("path"),_path2=_interopRequireDefault(_path),_prompt=require("../prompt"),_prompt2=_interopRequireDefault(_prompt),_actions=require("../actions"),_child_process=require("child_process"),ChangedPage=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return r.question="Add files",r}return _inherits(t,e),_createClass(t,[{key:"getInitialState",value:function(){return{files:this.getFiles(this.getGlob()),menu:new _vertical_menu2["default"]({canUnselect:!0,acceptsMany:!0,stdin:this.props.stdin,stdout:this.props.stdout,app:this.props.app}),prompt:new _prompt2["default"]({stdin:this.props.stdin,stdout:this.props.stdout})}}},{key:"createOptionsFrom",value:function(e){var t=this.select("files"),r=this.getBasedir();return e.map(function(e,n){return{id:n+1,label:_path2["default"].relative(r,e),name:e,value:e,isSelected:t.indexOf(e)>-1}})||[]}},{key:"getFiles",value:function(e){var t=this.getBasedir(),r=(0,_child_process.execSync)("git diff --name-only"),n=r.toString().split("\n"),i=new _minimatch2["default"].Minimatch(e);return n.length?n.map(function(e){return _path2["default"].resolve(e)}).filter(function(e){return i.match(e)&&e.indexOf(t)>-1}):[]}},{key:"updateFiles",value:function(e){var t=this;Array.isArray(e)&&e.forEach(function(e){"select"===e.action?t.dispatch((0,_actions.addFile)(e.value)):t.dispatch((0,_actions.removeFile)(e.value))})}},{key:"prompt",value:function(){var e=this,t=function(){e.props.stdout.write(e.renderMenu()),e.prompt()};this.state.prompt.beckon(this.question).then(this.processInput.bind(this)).then(function(r){var n=r.selectedItems,i=r.queryCount;return 1===i&&null===n[0].value?e.navigate("index"):(e.updateFiles(n),1===i&&"all"===n[0].type?e.navigate("index"):void t())})["catch"](_page2["default"].NoMatchError,t)}},{key:"processInput",value:function(e){return this.state.menu.find(e)}},{key:"renderMenu",value:function(){return this.state.menu.setOptions(this.createOptionsFrom(this.state.files)),this.state.menu.render()}},{key:"renderPrompt",value:function(){return this.prompt.bind(this)}}]),t}(_page2["default"]);exports["default"]=ChangedPage; | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _chalk=require("chalk"),_chalk2=_interopRequireDefault(_chalk),_base_dispatcher=require("../streams/base_dispatcher"),_base_dispatcher2=_interopRequireDefault(_base_dispatcher),_menu_transform=require("../streams/menu_transform"),_menu_transform2=_interopRequireDefault(_menu_transform),_minimatch=require("minimatch"),_minimatch2=_interopRequireDefault(_minimatch),_page=require("../page"),_page2=_interopRequireDefault(_page),_path=require("path"),_path2=_interopRequireDefault(_path),_prompt=require("../prompt"),_prompt2=_interopRequireDefault(_prompt),_queries_transform=require("../streams/queries_transform"),_queries_transform2=_interopRequireDefault(_queries_transform),_vertical_menu=require("../vertical_menu"),_vertical_menu2=_interopRequireDefault(_vertical_menu),_child_process=require("child_process"),ChangedPage=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return r.question="Add files",r.menu=new _vertical_menu2["default"]({canUnselect:!0,acceptsMany:!0,stdin:r.props.stdin,stdout:r.props.stdout,app:r.props.app}),r.prompt=new _prompt2["default"]({stdin:r.props.stdin,stdout:r.props.stdout}),r}return _inherits(t,e),_createClass(t,[{key:"getInitialState",value:function(){return{files:this.getFiles(this.getGlob())}}},{key:"createOptionsFrom",value:function(e){var t=this.select("files"),r=this.getBasedir();return e.map(function(e,n){return{id:n+1,label:_path2["default"].relative(r,e),name:e,value:e,isSelected:t.indexOf(e)>-1}})||[]}},{key:"getFiles",value:function(e){var t=this.getBasedir(),r=(0,_child_process.execSync)("git diff --name-only"),n=r.toString().split("\n"),i=new _minimatch2["default"].Minimatch(e);return n.length?n.map(function(e){return _path2["default"].resolve(e)}).filter(function(e){return i.match(e)&&e.indexOf(t)>-1}):[]}},{key:"showPrompt",value:function(){return 0===this.menu.options().length?(process.stderr.write(_chalk2["default"].bold.red("No files have been changed since last git commit.\n")),this.navigate("index")):this.prompt.beckon(this.question).pipe(new _queries_transform2["default"]).pipe(new _menu_transform2["default"]({choices:this.menu.options()})).pipe(new _base_dispatcher2["default"]({store:this.props.store})).then(this.reprompt)}},{key:"renderMenu",value:function(){return this.menu.setOptions(this.createOptionsFrom(this.state.files)),this.menu.render()}},{key:"renderPrompt",value:function(){return this.showPrompt}}]),t}(_page2["default"]);exports["default"]=ChangedPage; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _chalk=require("chalk"),_chalk2=_interopRequireDefault(_chalk),_fs=require("fs"),_fs2=_interopRequireDefault(_fs),_vertical_menu=require("../vertical_menu"),_vertical_menu2=_interopRequireDefault(_vertical_menu),_page=require("../page"),_page2=_interopRequireDefault(_page),_path=require("path"),_path2=_interopRequireDefault(_path),_prompt=require("../prompt"),_prompt2=_interopRequireDefault(_prompt),_actions=require("../actions"),_minimatch=require("minimatch"),DirectoriesPage=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return r.question="Add files or enter directory",r}return _inherits(t,e),_createClass(t,[{key:"getInitialState",value:function(){return{menu:new _vertical_menu2["default"]({canUnselect:!0,acceptsMany:!0,stdin:this.props.stdin,stdout:this.props.stdout,app:this.props.app}),prompt:new _prompt2["default"]({stdin:this.props.stdin,stdout:this.props.stdout})}}},{key:"getFiles",value:function(e,t){var r=this.select("config.base"),n=t===r,i=this.select("files"),a=[],u=[],s=new _minimatch.Minimatch(e);return a=_fs2["default"].readdirSync(t),a=a.map(function(e){return _path2["default"].join(t,e)}).filter(function(e){var t=_fs2["default"].statSync(e);return t.isDirectory()?(u.push(e),!0):s.match(e)}).map(function(e,r){var a=_path2["default"].relative(t,e),s=u.indexOf(e)>-1;return s&&(a+="/"),{id:n?r+1:r+2,name:a,value:e,isSelected:i.indexOf(e)>-1,label:s?_chalk2["default"].bold(a):a}}),t!==r&&a.unshift({id:1,name:"..",value:_path2["default"].resolve(t,".."),label:_chalk2["default"].bold("..")}),a}},{key:"updateFiles",value:function(e){var t=this;Array.isArray(e)&&e.forEach(function(e){"select"===e.action?t.dispatch((0,_actions.addFile)(e.value)):t.dispatch((0,_actions.removeFile)(e.value))})}},{key:"prompt",value:function(){var e=this,t=function(){e.props.stdout.write(e.renderMenu()),e.prompt()};this.state.prompt.beckon(this.question).then(this.processInput.bind(this)).then(function(r){var n=r.selectedItems,i=r.queryCount;return 1===i&&null===n[0].value?e.navigate("index"):e.processFiles(n)?r:void t()})["catch"](_page2["default"].NoMatchError,t)}},{key:"processFiles",value:function(e){var t=this,r=[],n=null;return e.forEach(function(e){var i=e.value,a=_fs2["default"].statSync(i);a.isDirectory()&&!n&&"all"!==e.type?n=i:a.isDirectory()||r.push(e),t.updateFiles(r)}),n&&1===e.length?(this.navigate("directories",{base:n}),!0):!1}},{key:"processInput",value:function(e){return this.state.menu.find(e)}},{key:"renderMenu",value:function(){return this.state.menu.setOptions(this.getFiles(this.getGlob(),this.getBasedir())),this.state.menu.render()}},{key:"renderPrompt",value:function(){return this.prompt.bind(this)}}]),t}(_page2["default"]);exports["default"]=DirectoriesPage; | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _chalk=require("chalk"),_chalk2=_interopRequireDefault(_chalk),_fs=require("fs"),_fs2=_interopRequireDefault(_fs),_base_dispatcher=require("../streams/base_dispatcher"),_base_dispatcher2=_interopRequireDefault(_base_dispatcher),_generic_transform=require("../streams/generic_transform"),_generic_transform2=_interopRequireDefault(_generic_transform),_menu_transform=require("../streams/menu_transform"),_menu_transform2=_interopRequireDefault(_menu_transform),_page=require("../page"),_page2=_interopRequireDefault(_page),_path=require("path"),_path2=_interopRequireDefault(_path),_prompt=require("../prompt"),_prompt2=_interopRequireDefault(_prompt),_queries_transform=require("../streams/queries_transform"),_queries_transform2=_interopRequireDefault(_queries_transform),_vertical_menu=require("../vertical_menu"),_vertical_menu2=_interopRequireDefault(_vertical_menu),_minimatch=require("minimatch"),DirectoriesPage=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return r.question="Add files or enter directory",r.menu=new _vertical_menu2["default"]({canUnselect:!0,acceptsMany:!0,stdin:r.props.stdin,stdout:r.props.stdout,app:r.props.app}),r.prompt=new _prompt2["default"]({stdin:r.props.stdin,stdout:r.props.stdout}),r}return _inherits(t,e),_createClass(t,[{key:"getInitialState",value:function(){return{selected:[],targetDir:null}}},{key:"getFiles",value:function(e,t){var r=this.select("config.base"),i=t===r,n=this.select("files"),a=[],s=[],u=new _minimatch.Minimatch(e);return a=_fs2["default"].readdirSync(t),a=a.map(function(e){return _path2["default"].join(t,e)}).filter(function(e){var t=_fs2["default"].statSync(e);return t.isDirectory()?(s.push(e),!0):u.match(e)}).map(function(e,r){var a=_path2["default"].relative(t,e),u=s.indexOf(e)>-1;return u&&(a+="/"),{id:i?r+1:r+2,name:a,value:e,isSelected:n.indexOf(e)>-1,label:u?_chalk2["default"].bold(a):a}}),t!==r&&a.unshift({id:1,name:"..",value:_path2["default"].resolve(t,".."),label:_chalk2["default"].bold("..")}),a}},{key:"showPrompt",value:function(){return this.prompt.beckon(this.question).pipe(new _queries_transform2["default"]).pipe(new _menu_transform2["default"]({choices:this.menu.options()})).pipe(new _generic_transform2["default"](this.processFile.bind(this))).pipe(new _base_dispatcher2["default"]({store:this.props.store,route:this.route})).then(this.reprompt)}},{key:"processFile",value:function(e,t){var r=null,i=t.data,n=t.params,a=i.value,s=void 0;return"file"!==t.type?void e.push(t):(s=_fs2["default"].statSync(a),s.isDirectory()&&(r=a,t.type="directory"),r&&1===n.queryCount&&!this.state.targetDir&&"single"===i.type&&(this.state.targetDir=r),void e.push(t))}},{key:"route",value:function(){return this.state.targetDir?(this.navigate("directories",{base:this.state.targetDir}),!0):void 0}},{key:"renderMenu",value:function(){return this.menu.setOptions(this.getFiles(this.getGlob(),this.getBasedir())),this.menu.render()}},{key:"renderPrompt",value:function(){return this.showPrompt}}]),t}(_page2["default"]);exports["default"]=DirectoriesPage; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_get=function e(t,r,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,r);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,n)}if("value"in i)return i.value;var a=i.get;if(void 0!==a)return a.call(n)};Object.defineProperty(exports,"__esModule",{value:!0});var _glob=require("glob"),_glob2=_interopRequireDefault(_glob),_vertical_menu=require("../vertical_menu"),_vertical_menu2=_interopRequireDefault(_vertical_menu),_page=require("../page"),_page2=_interopRequireDefault(_page),_path=require("path"),_path2=_interopRequireDefault(_path),_prompt=require("../prompt"),_prompt2=_interopRequireDefault(_prompt),_actions=require("../actions"),FilesPage=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return r.question="Add files",r}return _inherits(t,e),_createClass(t,[{key:"getDefaultProps",value:function(){var e=_get(Object.getPrototypeOf(t.prototype),"getDefaultProps",this).call(this);return Object.assign(e,{glob:"**/*.js"}),e}},{key:"getInitialState",value:function(){return{menu:new _vertical_menu2["default"]({canUnselect:!0,acceptsMany:!0,stdin:this.props.stdin,stdout:this.props.stdout,app:this.props.app}),prompt:new _prompt2["default"]({stdin:this.props.stdin,stdout:this.props.stdout})}}},{key:"getFiles",value:function(e){var t=this.getBasedir(),r=this.select("files");return _glob2["default"].sync(_path2["default"].join(t,e),{cwd:process.cwd()}).map(function(e,n){var i=_path2["default"].relative(t,e);return{id:n+1,name:i,value:e,isSelected:r.indexOf(e)>-1,label:i}})||[]}},{key:"updateFiles",value:function(e){var t=this;Array.isArray(e)&&e.forEach(function(e){"select"===e.action?t.dispatch((0,_actions.addFile)(e.value)):t.dispatch((0,_actions.removeFile)(e.value))})}},{key:"prompt",value:function(){var e=this,t=function(){e.props.stdout.write(e.renderMenu()),e.prompt()};this.state.prompt.beckon(this.question).then(this.processInput.bind(this)).then(function(r){var n=r.selectedItems,i=r.queryCount;return 1===i&&null===n[0].value?e.navigate("index"):(e.updateFiles(n),1===i&&"all"===n[0].type?e.navigate("index"):void t())})["catch"](_page2["default"].NoMatchError,t)}},{key:"processInput",value:function(e){return this.state.menu.find(e)}},{key:"renderMenu",value:function(){return this.state.menu.setOptions(this.getFiles(this.getGlob())),this.state.menu.render()}},{key:"renderPrompt",value:function(){return this.prompt.bind(this)}}]),t}(_page2["default"]);exports["default"]=FilesPage; | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _globAll=require("glob-all"),_globAll2=_interopRequireDefault(_globAll),_base_dispatcher=require("../streams/base_dispatcher"),_base_dispatcher2=_interopRequireDefault(_base_dispatcher),_menu_transform=require("../streams/menu_transform"),_menu_transform2=_interopRequireDefault(_menu_transform),_page=require("../page"),_page2=_interopRequireDefault(_page),_path=require("path"),_path2=_interopRequireDefault(_path),_prompt=require("../prompt"),_prompt2=_interopRequireDefault(_prompt),_queries_transform=require("../streams/queries_transform"),_queries_transform2=_interopRequireDefault(_queries_transform),_vertical_menu=require("../vertical_menu"),_vertical_menu2=_interopRequireDefault(_vertical_menu),FilesPage=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return r.question="Add files",r.menu=new _vertical_menu2["default"]({canUnselect:!0,acceptsMany:!0,stdin:r.props.stdin,stdout:r.props.stdout,app:r.props.app}),r.prompt=new _prompt2["default"]({stdin:r.props.stdin,stdout:r.props.stdout}),r}return _inherits(t,e),_createClass(t,[{key:"getFiles",value:function(e){var t=this.getBasedir(),r=this.select("files"),n=e;return Array.isArray(n)||(n=[n]),n=n.map(function(e){return _path2["default"].join(t,e)}),_globAll2["default"].sync(n,{cwd:process.cwd()}).map(function(e,n){var i=_path2["default"].relative(t,e);return{id:n+1,name:i,value:e,isSelected:r.indexOf(e)>-1,label:i}})||[]}},{key:"showPrompt",value:function(){this.prompt.beckon(this.question).pipe(new _queries_transform2["default"]).pipe(new _menu_transform2["default"]({choices:this.menu.options()})).pipe(new _base_dispatcher2["default"]({store:this.props.store})).then(this.reprompt)}},{key:"processInput",value:function(e){return this.menu.find(e)}},{key:"renderMenu",value:function(){return this.menu.setOptions(this.getFiles(this.getGlob())),this.menu.render()}},{key:"renderPrompt",value:function(){return this.showPrompt.bind(this)}}]),t}(_page2["default"]);exports["default"]=FilesPage; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _chalk=require("chalk"),_chalk2=_interopRequireDefault(_chalk),_glob=require("glob"),_glob2=_interopRequireDefault(_glob),_vertical_menu=require("../vertical_menu"),_vertical_menu2=_interopRequireDefault(_vertical_menu),_page=require("../page"),_page2=_interopRequireDefault(_page),_path=require("path"),_path2=_interopRequireDefault(_path),_prompt=require("../prompt"),_prompt2=_interopRequireDefault(_prompt),_actions=require("../actions"),GlobPage=function(e){function t(e){return _classCallCheck(this,t),_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e))}return _inherits(t,e),_createClass(t,[{key:"getInitialState",value:function(){return{files:[],filter:null,menu:new _vertical_menu2["default"]({canUnselect:!0,acceptsMany:!0,stdin:this.props.stdin,stdout:this.props.stdout,app:this.props.app}),prompt:new _prompt2["default"]({stdin:this.props.stdin,stdout:this.props.stdout})}}},{key:"componentShouldUpdate",value:function(){return!1}},{key:"createOptionsFrom",value:function(e){var t=this.select("files"),r=this.getBasedir();return e.map(function(e,n){return{id:n+1,label:_path2["default"].relative(r,e),name:e,value:e,isSelected:t.indexOf(e)>-1}})||[]}},{key:"getFiles",value:function(e){var t=this.getBasedir();return _glob2["default"].sync(_path2["default"].join(t,e),{cwd:process.cwd()})}},{key:"updateFiles",value:function(e){var t=this;Array.isArray(e)&&e.forEach(function(e){"select"===e.action?t.dispatch((0,_actions.addFile)(e.value)):t.dispatch((0,_actions.removeFile)(e.value))})}},{key:"prompt",value:function(){var e=this,t=function(){e.props.stdout.write(e.renderMenu()),e.prompt()};this.state.files.length?this.state.prompt.beckon(this.question()).then(this.processInput.bind(this)).then(function(r){var n=r.selectedItems,i=r.queryCount;return 1===i&&null===n[0].value?e.navigate("index"):(e.updateFiles(n),1===i&&"all"===n[0].type?e.navigate("index"):void t())})["catch"](_page2["default"].NoMatchError,t):this.state.prompt.beckon(this.question()).then(function(r){var n=[];if(!r)return e.navigate("index");if(n=e.getFiles(r),!n.length)throw new Error("no_glob_match");e.setState({filter:r,files:n}),t()})["catch"](function(r){switch(r.message){case"no_glob_match":e.props.stdout.write(_chalk2["default"].bold.red("No files found. Try again.\n"))}t()})}},{key:"processInput",value:function(e){return this.state.menu.find(e)}},{key:"question",value:function(){var e=this.getBasedir();return this.state.files.length?"Add files":(e=_path2["default"].relative(_path2["default"].resolve(this.select("config.base"),".."),e),"Enter glob from "+e)}},{key:"renderMenu",value:function(){return this.state.files.length?(this.state.menu.setOptions(this.createOptionsFrom(this.state.files)),this.state.menu.render()):""}},{key:"renderPrompt",value:function(){return this.prompt.bind(this)}}]),t}(_page2["default"]);exports["default"]=GlobPage; | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _globAll=require("glob-all"),_globAll2=_interopRequireDefault(_globAll),_base_dispatcher=require("../streams/base_dispatcher"),_base_dispatcher2=_interopRequireDefault(_base_dispatcher),_generic_transform=require("../streams/generic_transform"),_generic_transform2=_interopRequireDefault(_generic_transform),_menu_transform=require("../streams/menu_transform"),_menu_transform2=_interopRequireDefault(_menu_transform),_page=require("../page"),_page2=_interopRequireDefault(_page),_path=require("path"),_path2=_interopRequireDefault(_path),_prompt=require("../prompt"),_prompt2=_interopRequireDefault(_prompt),_queries_transform=require("../streams/queries_transform"),_queries_transform2=_interopRequireDefault(_queries_transform),_vertical_menu=require("../vertical_menu"),_vertical_menu2=_interopRequireDefault(_vertical_menu),GlobPage=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return r.menu=new _vertical_menu2["default"]({canUnselect:!0,acceptsMany:!0,stdin:r.props.stdin,stdout:r.props.stdout,app:r.props.app}),r.prompt=new _prompt2["default"]({stdin:r.props.stdin,stdout:r.props.stdout}),r}return _inherits(t,e),_createClass(t,[{key:"getInitialState",value:function(){return{files:[],filter:null}}},{key:"componentShouldUpdate",value:function(){return!1}},{key:"createOptionsFrom",value:function(e){var t=this.select("files"),r=this.getBasedir();return e.map(function(e,n){return{id:n+1,label:_path2["default"].relative(r,e),name:e,value:e,isSelected:t.indexOf(e)>-1}})||[]}},{key:"getFiles",value:function(e){var t=this.getBasedir();return _globAll2["default"].sync(_path2["default"].join(t,e),{cwd:process.cwd()})}},{key:"processGlob",value:function(e,t){var r=void 0,n=[],i=t.type,s=t.creator;return"string"!==i||"prompt"!==s?e.push(t):(r=t.data,r||(this.navigate("index"),e.push(null)),n=this.getFiles(r),n.length?(this.setState({filter:r,files:n}),void e.push(null)):e.pushError(new Error('No files matched the glob string "'+r+'"')))}},{key:"question",value:function(){var e=this.getBasedir();return this.state.files.length?"Add files":(e=_path2["default"].relative(_path2["default"].resolve(this.select("config.base"),".."),e),"Enter glob from "+e)}},{key:"showPrompt",value:function(){this.state.files.length?this.prompt.beckon(this.question()).pipe(new _queries_transform2["default"]).pipe(new _menu_transform2["default"]({choices:this.menu.options()})).pipe(new _base_dispatcher2["default"]({store:this.props.store})).then(this.reprompt):this.prompt.beckon(this.question()).pipe(new _generic_transform2["default"](this.processGlob.bind(this))).pipe(new _base_dispatcher2["default"]({store:this.props.store})).on("finish",this.reprompt)}},{key:"renderMenu",value:function(){return this.state.files.length?(this.menu.setOptions(this.createOptionsFrom(this.state.files)),this.menu.render()):""}},{key:"renderPrompt",value:function(){return this.showPrompt}}]),t}(_page2["default"]);exports["default"]=GlobPage; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _chalk=require("chalk"),_chalk2=_interopRequireDefault(_chalk),_column=require("../util/column"),_column2=_interopRequireDefault(_column),_menu=require("../menu"),_menu2=_interopRequireDefault(_menu),_page=require("../page"),_page2=_interopRequireDefault(_page),_path=require("path"),_path2=_interopRequireDefault(_path),_prompt=require("../prompt"),_prompt2=_interopRequireDefault(_prompt),MENU_OPTIONS=[{id:1,label:"directories",name:"directories",value:"directories"},{id:2,label:"files",name:"files",value:"files"},{id:3,label:"glob",name:"glob",value:"glob"},{id:4,label:"changed",name:"changed",value:"changed"},{id:5,label:"help",name:"help",value:"help"},{id:6,label:"quit",name:"quit",value:"quit"}],MAX_LABEL_WIDTH=6,MAX_HELP_WIDTH=11,IndexPage=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return r.intro="*** COMMANDS ***",r.question="What do you seek?",r}return _inherits(t,e),_createClass(t,[{key:"getInitialState",value:function(){return{prompt:new _prompt2["default"]({stdin:this.props.stdin,stdout:this.props.stdout}),menu:new _menu2["default"]({options:MENU_OPTIONS,stdin:this.props.stdin,stdout:this.props.stdout,app:this.props.app})}}},{key:"prompt",value:function(){var e=this,t=function(){e.props.stdout.write(e.renderIntro()),e.props.stdout.write(e.renderMenu()),e.prompt()};return this.state.prompt.beckon(this.question).then(this.processInput.bind(this)).then(function(r){var n=r.selectedItems[0];switch(n.value){case"quit":e.quit();break;case"help":e.showHelp(),t();break;case null:t();break;default:e.navigate(n.value)}return r})["catch"](_page2["default"].NoMatchError,t)}},{key:"processInput",value:function(e){return this.state.menu.find(e,function(e){return e.slice(0,1)})}},{key:"quit",value:function(){this.props.app&&this.props.app.emit("complete",this.select("files")),this.props.stdin.pause()}},{key:"showHelp",value:function(){var e={directories:"Select files & browse directories",files:"Select from a list of all nested files",glob:"Input a glob string then selected from matches",changed:"Select files from git diff --name-only",help:"Uhhh... this thing I guess...",quit:"Forward files along"},t="HELP\n";for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];t+=(0,_column2["default"])(r,MAX_HELP_WIDTH)+" - "+n+"\n"}this.props.stdout.write(_chalk2["default"].bold.red(t))}},{key:"renderIntro",value:function(){var e="",t=this.select("files"),r=this.select("config.base");return t.length&&(e+="\n",t.forEach(function(t,n){var i=_path2["default"].relative(r,t),o=n+1+": ";o=(0,_column2["default"])(o,MAX_LABEL_WIDTH),e+=o+" "+i+"\n"}),e+="\n"),e+=_chalk2["default"].white.bold(this.intro)+"\n"}},{key:"renderPrompt",value:function(){return this.prompt.bind(this)}},{key:"renderMenu",value:function(){return this.state.menu.render()+"\n"}}]),t}(_page2["default"]);exports["default"]=IndexPage; | ||
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _chalk=require("chalk"),_chalk2=_interopRequireDefault(_chalk),_column=require("../util/column"),_column2=_interopRequireDefault(_column),_base_dispatcher=require("../streams/base_dispatcher"),_base_dispatcher2=_interopRequireDefault(_base_dispatcher),_menu=require("../menu"),_menu2=_interopRequireDefault(_menu),_menu_transform=require("../streams/menu_transform"),_menu_transform2=_interopRequireDefault(_menu_transform),_page=require("../page"),_page2=_interopRequireDefault(_page),_path=require("path"),_path2=_interopRequireDefault(_path),_prompt=require("../prompt"),_prompt2=_interopRequireDefault(_prompt),_queries_transform=require("../streams/queries_transform"),_queries_transform2=_interopRequireDefault(_queries_transform),MENU_OPTIONS=[{id:1,label:"directories",name:"directories",value:"directories"},{id:2,label:"files",name:"files",value:"files"},{id:3,label:"glob",name:"glob",value:"glob"},{id:4,label:"changed",name:"changed",value:"changed"},{id:5,label:"help",name:"help",value:"help"},{id:6,label:"quit",name:"quit",value:"quit"}],MAX_LABEL_WIDTH=6,MAX_HELP_WIDTH=11,IndexPage=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e));return r.intro="*** COMMANDS ***",r.question="What do you seek?",r.prompt=new _prompt2["default"]({stdin:r.props.stdin,stdout:r.props.stdout}),r.menu=new _menu2["default"]({options:MENU_OPTIONS,stdin:r.props.stdin,stdout:r.props.stdout,app:r.props.app}),r}return _inherits(t,e),_createClass(t,[{key:"processInput",value:function(e){return this.menu.find(e,function(e){return e.slice(0,1)})}},{key:"quit",value:function(){this.props.app&&this.props.app.emit("complete",this.select("files")),this.props.stdin.pause()}},{key:"route",value:function(e,t,r){var n=r.value;switch(n){case null:return!1;case"quit":return this.quit(),!0;case"help":return this.showHelp(),!1;default:return this.navigate(n),!0}}},{key:"showHelp",value:function(){var e={directories:"Select files & browse directories",files:"Select from a list of all nested files",glob:"Input a glob string then selected from matches",changed:"Select files from git diff --name-only",help:"Uhhh... this thing I guess...",quit:"Forward files along"},t="HELP\n";for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];t+=" "+(0,_column2["default"])(r,MAX_HELP_WIDTH)+" - "+n+"\n"}this.props.stdout.write(_chalk2["default"].bold.red(t))}},{key:"showPrompt",value:function(){var e=this.pipeTo;return this.prompt.beckon(this.question).pipe(e(new _queries_transform2["default"]({maxQueries:1}))).pipe(e(new _menu_transform2["default"]({choices:this.menu.options(),canUnselect:!1}))).pipe(e(new _base_dispatcher2["default"]({store:this.props.store,route:this.route}))).then(this.reprompt)}},{key:"renderIntro",value:function(){var e="",t=this.select("files"),r=this.select("config.base");return t.length&&(e+="\n",t.forEach(function(t,n){var i=_path2["default"].relative(r,t),o=n+1+": ";o=(0,_column2["default"])(o,MAX_LABEL_WIDTH),e+=o+" "+i+"\n"}),e+="\n"),e+=_chalk2["default"].white.bold(this.intro)+"\n"}},{key:"renderPrompt",value:function(){return this.showPrompt}},{key:"renderMenu",value:function(){return this.menu.render()+"\n"}}]),t}(_page2["default"]);exports["default"]=IndexPage; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopRequireDefault(t){return t&&t.__esModule?t:{"default":t}}function _typeof(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();Object.defineProperty(exports,"__esModule",{value:!0});var _chalk=require("chalk"),_chalk2=_interopRequireDefault(_chalk),_bluebird=require("bluebird"),_bluebird2=_interopRequireDefault(_bluebird),Prompt=function(){function t(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];_classCallCheck(this,t),this.text="",this.options={stdin:process.stdin,stdout:process.stdout},e&&"string"==typeof e&&(this.text=e),"object"===("undefined"==typeof e?"undefined":_typeof(e))&&(n=e,e=null),n&&(this.options=Object.assign(this.options,n))}return _createClass(t,[{key:"beckon",value:function(t){var e=this;return t&&(this.text=t),this.options.stdin.setEncoding("utf8"),this.options.stdout.write(this.formatText()+this.formatPrompt()),new _bluebird2["default"](function(t,n){var o=function(){var n=e.options.stdin.read();null!==n&&(e.options.stdin.removeAllListeners("readable"),t(n.toString().trim()))};try{e.options.stdin.removeAllListeners("readable"),e.options.stdin.on("readable",o)}catch(r){e.close(),e.options.stdout.write(r),n(r)}})}},{key:"close",value:function(){this.options.stdin.end()}},{key:"formatPrompt",value:function(){return _chalk2["default"].magenta.bold(" > ")}},{key:"formatText",value:function(){return _chalk2["default"].blue.bold(this.text)}}]),t}();exports["default"]=Prompt; | ||
"use strict";function _interopRequireDefault(t){return t&&t.__esModule?t:{"default":t}}function _typeof(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();Object.defineProperty(exports,"__esModule",{value:!0});var _chalk=require("chalk"),_chalk2=_interopRequireDefault(_chalk),_stdin_reader=require("./streams/stdin_reader"),_stdin_reader2=_interopRequireDefault(_stdin_reader),Prompt=function(){function t(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];_classCallCheck(this,t),this.text="",this.options={stdin:process.stdin,stdout:process.stdout},e&&"string"==typeof e&&(this.text=e),"object"===("undefined"==typeof e?"undefined":_typeof(e))&&(n=e,e=null),n&&(this.options=Object.assign(this.options,n))}return _createClass(t,[{key:"beckon",value:function(t){return t&&(this.text=t),this.options.stdin.setEncoding("utf8"),this.options.stdout.write(this.formatText()+this.formatPrompt()),new _stdin_reader2["default"](this.options)}},{key:"close",value:function(){this.options.stdin.end()}},{key:"formatPrompt",value:function(){return _chalk2["default"].magenta.bold(" > ")}},{key:"formatText",value:function(){return _chalk2["default"].blue.bold(this.text)}}]),t}();exports["default"]=Prompt; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mapToObject(e,t){var r={};return e.forEach(function(e,n){r[e]=t[n]}),r}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var Query=function(){function e(t){_classCallCheck(this,e),this.query=null,this.data={},this.rawQueryString=t,e.isValid(t)&&(this.query=String(t).trim().toLowerCase(),this.data=this.parse())}return _createClass(e,null,[{key:"createFrom",value:function(t){try{return t.split(/,| /g).filter(function(e){return""===e?!1:!0}).map(function(t){return new e(t)})}catch(r){return[]}}},{key:"extractNumbers",value:function(e){return e.match(/[\d]+/g).map(function(e){return Number(e)})}},{key:"isValid",value:function(e){return"string"==typeof e&&!!e.trim()}}]),_createClass(e,[{key:"extractNumbers",value:function(){return e.extractNumbers(this.query)}},{key:"is",value:function(e){return e.toLowerCase()===this.query}},{key:"isAsterik",value:function(){return this.query.length<=2&&/\*$/.test(this.query)}},{key:"isInteger",value:function(){return Number.isInteger(Number(this.query))}},{key:"isStartOf",value:function(e){return e.toLowerCase().startsWith(this.data.value)}},{key:"isRange",value:function(){return/[\d]+[\s]*-[\s]*[\d]/g.test(this.query)}},{key:"isValid",value:function(){return e.isValid(this.query)}},{key:"parse",value:function(){var t={action:"select"},r=this.query;return"-"===this.query.slice(0,1)&&(t.action="unselect",r=this.query.slice(1)),this.isRange()?(t.type="range",t.value=mapToObject(["min","max"],e.extractNumbers(r))):this.isInteger()?(t.type="id",t.value=Number(r)):this.isAsterik()?t.type="all":(t.type="string",t.value=r),t.query=this.rawQueryString,t}},{key:"rawQuery",value:function(){return String(this.rawQueryString)}},{key:"toString",value:function(){return this.query}}]),e}();exports["default"]=Query; | ||
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mapToObject(e,t){var r={};return e.forEach(function(e,n){r[e]=t[n]}),r}var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var Query=function(){function e(t){_classCallCheck(this,e),this.query=null,this.data={},this.rawQueryString=t,e.isValid(t)&&(this.query=String(t).trim().toLowerCase(),this.data=this.parse())}return _createClass(e,null,[{key:"createFrom",value:function(t){try{return t.split(/,| /g).filter(function(e){return""===e?!1:!0}).map(function(t){return new e(t)})}catch(r){return[]}}},{key:"extractNumbers",value:function(e){return e.match(/[\d]+/g).map(function(e){return Number(e)})}},{key:"isValid",value:function(e){return"string"==typeof e&&e.trim().length>0}}]),_createClass(e,[{key:"extractNumbers",value:function(){return e.extractNumbers(this.query)}},{key:"is",value:function(e){return e.toLowerCase()===this.query}},{key:"isAsterik",value:function(){return this.query.length<=2&&/\*$/.test(this.query)}},{key:"isInteger",value:function(){return Number.isInteger(Number(this.query))}},{key:"isStartOf",value:function(e){return e.toLowerCase().startsWith(this.data.value)}},{key:"isRange",value:function(){return/[\d]+[\s]*-[\s]*[\d]/g.test(this.query)}},{key:"isValid",value:function(){return e.isValid(this.query)}},{key:"parse",value:function(){var t={action:"select"},r=this.query;return"-"===this.query.slice(0,1)&&(t.action="unselect",r=this.query.slice(1)),this.isRange()?(t.type="range",t.value=mapToObject(["min","max"],e.extractNumbers(r))):this.isInteger()?(t.type="id",t.value=Number(r)):this.isAsterik()?t.type="all":(t.type="string",t.value=r),t.query=this.rawQueryString,t}},{key:"rawQuery",value:function(){return String(this.rawQueryString)}},{key:"toString",value:function(){return this.query}}]),e}();exports["default"]=Query; |
@@ -1,1 +0,1 @@ | ||
"use strict";function config(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments[1];switch(n.type){case _actions.SET_CONFIG:return Object.assign({},e,n.config);default:return e}}function currentPage(){var e=arguments.length<=0||void 0===arguments[0]?{name:"index",props:{},is_navigating:!1}:arguments[0],n=arguments[1];switch(n.type){case _actions.NAVIGATE:return{name:n.name,props:n.props,is_navigating:!0};case _actions.NAVIGATE_COMPLETE:return{name:e.name,props:e.props,is_navigating:!1};default:return e}}function files(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],n=arguments[1],r=e.slice();switch(n.type){case _actions.ADD_FILE:return e.indexOf(n.file)>-1?e:e.concat([n.file]);case _actions.REMOVE_FILE:return-1===e.indexOf(n.file)?e:(r.splice(e.indexOf(n.file),1),r);default:return e}}function glob(){var e=arguments.length<=0||void 0===arguments[0]?"**/*.js":arguments[0],n=arguments[1];switch(n.type){case _actions.SET_FILTER:return n.glob;default:return e}}Object.defineProperty(exports,"__esModule",{value:!0});var _redux=require("redux"),_actions=require("./actions"),reducers=(0,_redux.combineReducers)({config:config,currentPage:currentPage,files:files,glob:glob});exports["default"]=reducers; | ||
"use strict";function config(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments[1];switch(n.type){case _actions.SET_CONFIG:return Object.assign({},e,n.config);default:return e}}function currentPage(){var e=arguments.length<=0||void 0===arguments[0]?{name:"index",props:{},isNavigating:!1}:arguments[0],n=arguments[1];switch(n.type){case _actions.NAVIGATE:return{name:n.name,props:n.props,isNavigating:!0};case _actions.NAVIGATE_COMPLETE:return{name:e.name,props:e.props,isNavigating:!1};default:return e}}function files(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],n=arguments[1],r=e.slice();switch(n.type){case _actions.ADD_FILE:return e.indexOf(n.file)>-1?e:e.concat([n.file]);case _actions.REMOVE_FILE:return-1===e.indexOf(n.file)?e:(r.splice(e.indexOf(n.file),1),r);default:return e}}function glob(){var e=arguments.length<=0||void 0===arguments[0]?"**/*.js":arguments[0],n=arguments[1];switch(n.type){case _actions.SET_FILTER:return n.glob;default:return e}}Object.defineProperty(exports,"__esModule",{value:!0});var _redux=require("redux"),_actions=require("./actions"),reducers=(0,_redux.combineReducers)({config:config,currentPage:currentPage,files:files,glob:glob});exports["default"]=reducers; |
{ | ||
"name": "file-prompt", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "An interactive prompt for selecting files from a directory.", | ||
@@ -36,3 +36,3 @@ "main": "index.js", | ||
"eslint-plugin-react": ">= 3.10.0 < 4", | ||
"glob": "^6.0.1", | ||
"glob-all": "^3.0.1", | ||
"gulp": ">= 3.9.0 < 4", | ||
@@ -44,3 +44,5 @@ "minimatch": "^3.0.0", | ||
}, | ||
"devDependencies": {} | ||
"devDependencies": { | ||
"minimist": "^1.2.0" | ||
} | ||
} |
@@ -78,3 +78,5 @@ import Component from './component'; | ||
name: 'index', | ||
props: {}, | ||
props: { | ||
glob: this.props.glob | ||
}, | ||
isNavigating: false | ||
@@ -81,0 +83,0 @@ } |
@@ -10,3 +10,3 @@ import Promise from 'bluebird'; | ||
* @param {string} options.base - Base directory to search in | ||
* @param {string} options.filter - Glob filter for files and git diff files | ||
* @param {string} options.glob - Glob filter for files and git diff files | ||
* @returns {Promise} A promise when files have been selected or rejected on | ||
@@ -13,0 +13,0 @@ * error. |
@@ -1,2 +0,2 @@ | ||
import glob from 'glob'; | ||
import glob from 'glob-all'; | ||
import Dispatcher from '../streams/base_dispatcher'; | ||
@@ -63,21 +63,2 @@ import MenuTransform from '../streams/menu_transform'; | ||
/** | ||
* Get Default Props | ||
* Returns the default properties for this component. Can be overridden | ||
* by a subclass | ||
* | ||
* @method | ||
* @privae | ||
* @returns {object} Default FilesPage props | ||
*/ | ||
getDefaultProps () { | ||
let data = super.getDefaultProps(); | ||
Object.assign(data, { | ||
glob: '**/*.js' | ||
}); | ||
return data; | ||
} | ||
/** | ||
* Get Files | ||
@@ -93,5 +74,14 @@ * Returns an array of files to select | ||
let basedir = this.getBasedir(), | ||
selectedFiles = this.select('files'); | ||
selectedFiles = this.select('files'), | ||
globs = pattern; | ||
return glob.sync(path.join(basedir, pattern), { cwd: process.cwd() }) | ||
// Make sure we have an array of globs | ||
if (!Array.isArray(globs)) globs = [globs]; | ||
// Prepend the basedir to each glob | ||
globs = globs.map((globStr) => { | ||
return path.join(basedir, globStr); | ||
}); | ||
return glob.sync(globs, { cwd: process.cwd() }) | ||
.map((filename, i) => { | ||
@@ -98,0 +88,0 @@ let label = path.relative(basedir, filename); |
@@ -1,2 +0,2 @@ | ||
import glob from 'glob'; | ||
import glob from 'glob-all'; | ||
import Dispatcher from '../streams/base_dispatcher'; | ||
@@ -3,0 +3,0 @@ import GenericTransform from '../streams/generic_transform'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
346627
91
1
5280
20
+ Addedglob-all@^3.0.1
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedcamelcase@5.3.1(transitive)
+ Addedcliui@6.0.0(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedfind-up@4.1.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedget-caller-file@2.0.5(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedglob-all@3.3.1(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedlocate-path@5.0.0(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@4.1.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedrequire-directory@2.1.1(transitive)
+ Addedrequire-main-filename@2.0.0(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedwhich-module@2.0.1(transitive)
+ Addedwrap-ansi@6.2.0(transitive)
+ Addedy18n@4.0.3(transitive)
+ Addedyargs@15.4.1(transitive)
+ Addedyargs-parser@18.1.3(transitive)
- Removedglob@^6.0.1
- Removedglob@6.0.4(transitive)