Skip to content

Commit

Permalink
Bump dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias committed Jul 14, 2021
1 parent 58de622 commit 7c028f7
Show file tree
Hide file tree
Showing 10 changed files with 1,685 additions and 2,657 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"devDependencies": {
"@babel/core": "^7.14.3",
"@babel/preset-env": "^7.14.2",
"babel-jest": "^26.6.3",
"babel-jest": "^27.0.6",
"codecov": "^3.8.2",
"eslint": "^7.26.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-xo": "^0.36.0",
"eslint-config-xo": "^0.37.0",
"eslint-plugin-prettier": "^3.4.0",
"husky": "^4.3.8",
"jest": "^26.6.3",
"husky": "^7.0.1",
"jest": "^27.0.6",
"lerna": "^4.0.0",
"lint-staged": "^11.0.0",
"prettier": "^2.3.0"
Expand Down
5 changes: 2 additions & 3 deletions packages/checkbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ module.exports = createPrompt(
});
}
},
mapStateToValue: ({ choices }) => {
return choices.filter((choice) => choice.checked).map((choice) => choice.value);
},
mapStateToValue: ({ choices }) =>
choices.filter((choice) => choice.checked).map((choice) => choice.value),
paginator: new Paginator(readline),
}),
(state, { paginator }) => {
Expand Down
92 changes: 44 additions & 48 deletions packages/core/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,54 +70,50 @@ exports.useEffect = (cb, depArray) => {
index++;
};

exports.useRef = (val) => {
return exports.useState({ current: val })[0];
};
exports.useRef = (val) => exports.useState({ current: val })[0];

exports.createPrompt = (view) => (options) => {
// Default `input` to stdin
const input = process.stdin;

// Add mute capabilities to the output
const output = new MuteStream();
output.pipe(process.stdout);

const rl = readline.createInterface({
terminal: true,
input,
output,
});
const screen = new ScreenManager(rl);

return new Promise((resolve, reject) => {
sessionRl = rl;

const done = (value) => {
let len = cleanupHook.length;
while (len--) {
cleanupHook(len);
}
screen.done();

// Reset hooks state
hooks = [];
index = 0;
sessionRl = undefined;

exports.createPrompt = (view) => {
return (options) => {
// Default `input` to stdin
const input = process.stdin;

// Add mute capabilities to the output
const output = new MuteStream();
output.pipe(process.stdout);

const rl = readline.createInterface({
terminal: true,
input,
output,
});
const screen = new ScreenManager(rl);

return new Promise((resolve, reject) => {
sessionRl = rl;

const done = (value) => {
let len = cleanupHook.length;
while (len--) {
cleanupHook(len);
}
screen.done();

// Reset hooks state
hooks = [];
index = 0;
sessionRl = undefined;

// Finally we resolve our promise
resolve(value);
};
// Finally we resolve our promise
resolve(value);
};

hooks = [];
const workLoop = (config) => {
index = 0;
handleChange = () => workLoop(config);
screen.render(...[view(config, done)].flat().filter(Boolean));
};

// TODO: we should display a loader while we get the default options.
getPromptConfig(options).then(workLoop, reject);
});
};
hooks = [];
const workLoop = (config) => {
index = 0;
handleChange = () => workLoop(config);
screen.render(...[view(config, done)].flat().filter(Boolean));
};

// TODO: we should display a loader while we get the default options.
getPromptConfig(options).then(workLoop, reject);
});
};
10 changes: 4 additions & 6 deletions packages/inquirer/lib/prompts/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ class CheckboxPrompt extends Base {
}

getCurrentValue() {
const choices = this.opt.choices.filter((choice) => {
return Boolean(choice.checked) && !choice.disabled;
});
const choices = this.opt.choices.filter(
(choice) => Boolean(choice.checked) && !choice.disabled
);

this.selection = _.map(choices, 'short');
return _.map(choices, 'value');
Expand Down Expand Up @@ -198,9 +198,7 @@ class CheckboxPrompt extends Base {

onAllKey() {
const shouldBeChecked = Boolean(
this.opt.choices.find((choice) => {
return choice.type !== 'separator' && !choice.checked;
})
this.opt.choices.find((choice) => choice.type !== 'separator' && !choice.checked)
);

this.opt.choices.forEach((choice) => {
Expand Down
8 changes: 4 additions & 4 deletions packages/inquirer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
},
"devDependencies": {
"chai": "^4.3.4",
"chalk-pipe": "^4.0.0",
"chalk-pipe": "^5.1.1",
"cmdify": "^0.0.4",
"mocha": "^8.4.0",
"mocha": "^9.0.2",
"mockery": "^2.1.0",
"nyc": "^15.0.0",
"sinon": "^10.0.0"
"sinon": "^11.1.1"
},
"scripts": {
"test": "nyc mocha test/**/* -r ./test/before",
Expand All @@ -47,7 +47,7 @@
"mute-stream": "0.0.8",
"ora": "^5.3.0",
"run-async": "^2.4.0",
"rxjs": "^6.6.6",
"rxjs": "^7.2.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0",
"through": "^2.3.6"
Expand Down
4 changes: 1 addition & 3 deletions packages/inquirer/test/specs/inquirer.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ describe('inquirer.prompt', () => {

it('should close readline instance on rejected promise', function (done) {
this.prompt.registerPrompt('stub', function () {
this.run = () => {
return Promise.reject(new Error('test error'));
};
this.run = () => Promise.reject(new Error('test error'));
});

const promise = this.prompt({
Expand Down
4 changes: 1 addition & 3 deletions packages/inquirer/test/specs/objects/choices.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ describe('Choices collection', () => {

it('should façade filter', () => {
const choices = new Choices(['a', 'b', 'c']);
const filtered = choices.filter((val) => {
return val.name === 'a';
});
const filtered = choices.filter((val) => val.name === 'a');
expect(filtered.length).to.equal(1);
expect(filtered[0].name).to.equal('a');
});
Expand Down
4 changes: 1 addition & 3 deletions packages/inquirer/test/specs/prompts/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ describe('`editor` prompt', () => {
const promise = prompt.run();
this.rl.emit('line', '');

return promise.then((answer) => {
return expect(answer).to.equal('testing');
});
return promise.then((answer) => expect(answer).to.equal('testing'));
});
});
4 changes: 1 addition & 3 deletions packages/inquirer/test/specs/prompts/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ describe('`list` prompt', () => {
});

it('should require a choices array', () => {
expect(() => {
return new List({ name: 'foo', message: 'bar' });
}).to.throw(/choices/);
expect(() => new List({ name: 'foo', message: 'bar' })).to.throw(/choices/);
});

it('should allow a numeric default', function (done) {
Expand Down
Loading

0 comments on commit 7c028f7

Please sign in to comment.