Skip to content

Commit 2ec05ec

Browse files
committed
add ignore prompt if fs is passed to createConflicterCheckTransform
1 parent 5279fb9 commit 2ec05ec

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

lib/environment.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -1285,14 +1285,7 @@ class Environment extends Base {
12851285

12861286
const conflicterStatus = {};
12871287
if (this.enableConflicterIgnore) {
1288-
conflicterStatus.fileActions = [{
1289-
key: 'i',
1290-
name: 'ignore, do not overwrite and remember (experimental)',
1291-
value: ({relativeFilePath}) => {
1292-
this.fs.append(`${this.cwd}/.yo-resolve`, `${relativeFilePath} skip`, {create: true});
1293-
return 'skip';
1294-
}
1295-
}];
1288+
conflicterStatus.fs = this.fs;
12961289
}
12971290

12981291
this.fs.commit([

lib/util/conflicter.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,20 @@ class Conflicter {
315315
value: 'edit'
316316
}
317317
);
318-
if (conflicterStatus && conflicterStatus.fileActions) {
319-
prompt.choices.push(...conflicterStatus.fileActions);
318+
if (conflicterStatus) {
319+
if (conflicterStatus.fileActions) {
320+
prompt.choices.push(...conflicterStatus.fileActions);
321+
}
322+
if (conflicterStatus.fs) {
323+
prompt.choices.push({
324+
key: 'i',
325+
name: 'ignore, do not overwrite and remember (experimental)',
326+
value: ({relativeFilePath}) => {
327+
conflicterStatus.fs.append(`${this.cwd}/.yo-resolve`, `${relativeFilePath} skip`, {create: true});
328+
return 'skip';
329+
}
330+
});
331+
}
320332
}
321333
}
322334

test/environment.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ describe('Environment', () => {
462462
});
463463
});
464464

465-
describe.only('#getGeneratorMeta{}', () => {
465+
describe('#getGeneratorMeta{}', () => {
466466
it('importGenerator should return a class', async function () {
467467
this.env
468468
.register(path.join(__dirname, './fixtures/generator-module/generators/app'), 'fixtures:generator-module');

0 commit comments

Comments
 (0)