Skip to content

Commit

Permalink
Hide shared options and drop support for kebab case options.
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Feb 20, 2021
1 parent 310f72d commit ee0d1ad
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 146 deletions.
12 changes: 4 additions & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ class Generator extends Base {
questionStorage.setPath(name, answer);
});

if (!this.options['skip-cache'] && !this.options.skipCache) {
if (!this.options.skipCache) {
promptSuggestion.storeAnswers(
this._globalConfig,
questions,
Expand Down Expand Up @@ -1071,13 +1071,9 @@ class Generator extends Base {
// Pass down the default options so they're correctly mirrored down the chain.
options = {
...options,
skipInstall: this.options.skipInstall || this.options['skip-install'],
'skip-install': this.options.skipInstall || this.options['skip-install'],
skipCache: this.options.skipCache || this.options['skip-cache'],
'skip-cache': this.options.skipCache || this.options['skip-cache'],
forceInstall: this.options.forceInstall || this.options['force-install'],
'force-install':
this.options.forceInstall || this.options['force-install'],
skipInstall: this.options.skipInstall,
skipCache: this.options.skipCache,
forceInstall: this.options.forceInstall,
skipLocalCache: this.options.skipLocalCache,
destinationRoot: this._destinationRoot
};
Expand Down
6 changes: 0 additions & 6 deletions test/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -828,12 +828,6 @@ describe('Base', () => {
setTimeout(() => {
this.dummy.run().then(() => {
sinon.assert.callOrder(runSpy, this.spy);
assert.equal(this.spy.thisValues[0].options.skipInstall, true);
assert.equal(this.spy.thisValues[0].options['skip-install'], true);
assert.equal(this.spy.thisValues[0].options.forceInstall, true);
assert.equal(this.spy.thisValues[0].options['force-install'], true);
assert.equal(this.spy.thisValues[0].options.skipCache, true);
assert.equal(this.spy.thisValues[0].options['skip-cache'], true);
assert(this.spy.calledAfter(runSpy));
done();
});
Expand Down
132 changes: 0 additions & 132 deletions test/generators-compose-workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,30 +89,6 @@ describe('Multiples generators', () => {
this.spyEnd1,
this.spyEnd2
);
assert.equal(this.spyExec1.thisValues[0].options.skipInstall, true);
assert.equal(
this.spyExec1.thisValues[0].options['skip-install'],
true
);
assert.equal(this.spyExec1.thisValues[0].options.forceInstall, true);
assert.equal(
this.spyExec1.thisValues[0].options['force-install'],
true
);
assert.equal(this.spyExec1.thisValues[0].options.skipCache, true);
assert.equal(this.spyExec1.thisValues[0].options['skip-cache'], true);
assert.equal(this.spyExec2.thisValues[0].options.skipInstall, true);
assert.equal(
this.spyExec2.thisValues[0].options['skip-install'],
true
);
assert.equal(this.spyExec2.thisValues[0].options.forceInstall, true);
assert.equal(
this.spyExec2.thisValues[0].options['force-install'],
true
);
assert.equal(this.spyExec2.thisValues[0].options.skipCache, true);
assert.equal(this.spyExec2.thisValues[0].options['skip-cache'], true);
assert(this.spyInit1.calledAfter(runSpy));
assert(this.spyInit2.calledAfter(this.spyInit1));
assert(this.spyExec1.calledAfter(this.spyInit2));
Expand Down Expand Up @@ -143,30 +119,6 @@ describe('Multiples generators', () => {
this.spyEnd2,
this.spyEnd1
);
assert.equal(this.spyExec1.thisValues[0].options.skipInstall, true);
assert.equal(
this.spyExec1.thisValues[0].options['skip-install'],
true
);
assert.equal(this.spyExec1.thisValues[0].options.forceInstall, true);
assert.equal(
this.spyExec1.thisValues[0].options['force-install'],
true
);
assert.equal(this.spyExec1.thisValues[0].options.skipCache, true);
assert.equal(this.spyExec1.thisValues[0].options['skip-cache'], true);
assert.equal(this.spyExec2.thisValues[0].options.skipInstall, true);
assert.equal(
this.spyExec2.thisValues[0].options['skip-install'],
true
);
assert.equal(this.spyExec2.thisValues[0].options.forceInstall, true);
assert.equal(
this.spyExec2.thisValues[0].options['force-install'],
true
);
assert.equal(this.spyExec2.thisValues[0].options.skipCache, true);
assert.equal(this.spyExec2.thisValues[0].options['skip-cache'], true);
assert(this.spyInit2.calledAfter(runSpy));
assert(this.spyInit1.calledAfter(this.spyInit2));
assert(this.spyExec2.calledAfter(this.spyInit1));
Expand Down Expand Up @@ -211,42 +163,6 @@ describe('Multiples generators', () => {
this.spyEnd1,
this.spyEnd2
);
assert.equal(this.spyExec1.thisValues[0].options.skipInstall, true);
assert.equal(
this.spyExec1.thisValues[0].options['skip-install'],
true
);
assert.equal(this.spyExec1.thisValues[0].options.forceInstall, true);
assert.equal(
this.spyExec1.thisValues[0].options['force-install'],
true
);
assert.equal(this.spyExec1.thisValues[0].options.skipCache, true);
assert.equal(this.spyExec1.thisValues[0].options['skip-cache'], true);
assert.equal(this.spyExec2.thisValues[0].options.skipInstall, true);
assert.equal(
this.spyExec2.thisValues[0].options['skip-install'],
true
);
assert.equal(this.spyExec2.thisValues[0].options.forceInstall, true);
assert.equal(
this.spyExec2.thisValues[0].options['force-install'],
true
);
assert.equal(this.spyExec2.thisValues[0].options.skipCache, true);
assert.equal(this.spyExec2.thisValues[0].options['skip-cache'], true);
assert.equal(this.spyExec3.thisValues[0].options.skipInstall, true);
assert.equal(
this.spyExec3.thisValues[0].options['skip-install'],
true
);
assert.equal(this.spyExec3.thisValues[0].options.forceInstall, true);
assert.equal(
this.spyExec3.thisValues[0].options['force-install'],
true
);
assert.equal(this.spyExec3.thisValues[0].options.skipCache, true);
assert.equal(this.spyExec3.thisValues[0].options['skip-cache'], true);
assert(this.spyInit1.calledAfter(runSpy));
assert(this.spyInit2.calledAfter(this.spyInit1));
assert(this.spyInit3.calledAfter(this.spyInit2));
Expand Down Expand Up @@ -307,30 +223,6 @@ describe('Multiples generators', () => {
this.spyEnd1,
this.spyEnd2
);
assert.equal(this.spyExec1.thisValues[0].options.skipInstall, true);
assert.equal(
this.spyExec1.thisValues[0].options['skip-install'],
true
);
assert.equal(this.spyExec1.thisValues[0].options.forceInstall, true);
assert.equal(
this.spyExec1.thisValues[0].options['force-install'],
true
);
assert.equal(this.spyExec1.thisValues[0].options.skipCache, true);
assert.equal(this.spyExec1.thisValues[0].options['skip-cache'], true);
assert.equal(this.spyExec2.thisValues[0].options.skipInstall, true);
assert.equal(
this.spyExec2.thisValues[0].options['skip-install'],
true
);
assert.equal(this.spyExec2.thisValues[0].options.forceInstall, true);
assert.equal(
this.spyExec2.thisValues[0].options['force-install'],
true
);
assert.equal(this.spyExec2.thisValues[0].options.skipCache, true);
assert.equal(this.spyExec2.thisValues[0].options['skip-cache'], true);
assert(writingSpy1.calledAfter(runSpy));
assert(this.spyInit1.calledAfter(writingSpy1));
assert(this.spyInit2.calledAfter(this.spyInit1));
Expand Down Expand Up @@ -404,30 +296,6 @@ describe('Multiples generators', () => {
this.spyEnd1,
this.spyEnd2
);
assert.equal(this.spyExec1.thisValues[0].options.skipInstall, true);
assert.equal(
this.spyExec1.thisValues[0].options['skip-install'],
true
);
assert.equal(this.spyExec1.thisValues[0].options.forceInstall, true);
assert.equal(
this.spyExec1.thisValues[0].options['force-install'],
true
);
assert.equal(this.spyExec1.thisValues[0].options.skipCache, true);
assert.equal(this.spyExec1.thisValues[0].options['skip-cache'], true);
assert.equal(this.spyExec2.thisValues[0].options.skipInstall, true);
assert.equal(
this.spyExec2.thisValues[0].options['skip-install'],
true
);
assert.equal(this.spyExec2.thisValues[0].options.forceInstall, true);
assert.equal(
this.spyExec2.thisValues[0].options['force-install'],
true
);
assert.equal(this.spyExec2.thisValues[0].options.skipCache, true);
assert.equal(this.spyExec2.thisValues[0].options['skip-cache'], true);
assert(writingSpy1.calledAfter(runSpy));
assert(this.spyInit1.calledAfter(writingSpy1));
assert(this.spyExec1.calledAfter(this.spyInit1));
Expand Down

0 comments on commit ee0d1ad

Please sign in to comment.