Skip to content

Commit

Permalink
feat(git-ignore): wired the ignore lifter into the project lifter
Browse files Browse the repository at this point in the history
  • Loading branch information
travi committed Dec 27, 2023
1 parent c00b836 commit 4fe5b1e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/lift.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ import deepmerge from 'deepmerge';
import {applyEnhancers} from '@form8ion/core';
import {lift as liftReadme} from '@form8ion/readme';

import {test as gitIgnoreExists, lift as liftGitignore} from './vcs/git/ignore/index.js';

export default async function ({projectRoot, results, enhancers, vcs}) {
const enhancerResults = await applyEnhancers({results, enhancers, options: {projectRoot, vcs}});
const enhancerResults = await applyEnhancers({
results,
enhancers: {...enhancers, gitIgnore: {test: gitIgnoreExists, lift: liftGitignore}},
options: {projectRoot, vcs}
});

await liftReadme({projectRoot, results: deepmerge.all([results, enhancerResults])});

Expand Down
7 changes: 6 additions & 1 deletion src/lift.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {afterEach, describe, expect, it, vi} from 'vitest';
import any from '@travi/any';
import {when} from 'jest-when';

import {lift as liftGitignore, test as gitIgnoreExists} from './vcs/git/ignore/index.js';
import lift from './lift.js';

vi.mock('deepmerge');
Expand All @@ -25,7 +26,11 @@ describe('lift', () => {
const enhancerResults = any.simpleObject();
const mergedResults = any.simpleObject();
when(core.applyEnhancers)
.calledWith({results, enhancers, options: {projectRoot, vcs}})
.calledWith({
results,
enhancers: {...enhancers, gitIgnore: {test: gitIgnoreExists, lift: liftGitignore}},
options: {projectRoot, vcs}
})
.mockResolvedValue(enhancerResults);
when(deepmerge.all).calledWith([results, enhancerResults]).mockReturnValue(mergedResults);

Expand Down

0 comments on commit 4fe5b1e

Please sign in to comment.