Skip to content

Commit

Permalink
feat(lift): passed dependencies through to the enhancers
Browse files Browse the repository at this point in the history
  • Loading branch information
travi committed May 24, 2024
1 parent 21b964a commit 6aa1e18
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
}
},
"dependencies": {
"@form8ion/core": "^4.0.0",
"@form8ion/core": "^4.3.0",
"@form8ion/execa-wrapper": "^1.0.0",
"@form8ion/overridable-prompts": "^1.1.0",
"@form8ion/readme": "3.1.0",
Expand Down
5 changes: 3 additions & 2 deletions src/lift.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ 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}) {
export default async function ({projectRoot, results, enhancers, vcs, dependencies}) {
const enhancerResults = await applyEnhancers({
results,
enhancers: {...enhancers, gitIgnore: {test: gitIgnoreExists, lift: liftGitignore}},
options: {projectRoot, vcs}
options: {projectRoot, vcs},
dependencies
});

await liftReadme({projectRoot, results: deepmerge.all([results, enhancerResults])});
Expand Down
6 changes: 4 additions & 2 deletions src/lift.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('lift', () => {
it('should lift the README based on the provided results', async () => {
const projectRoot = any.string();
const enhancers = any.simpleObject();
const dependencies = any.simpleObject();
const vcs = any.simpleObject();
const results = any.simpleObject();
const enhancerResults = any.simpleObject();
Expand All @@ -29,12 +30,13 @@ describe('lift', () => {
.calledWith({
results,
enhancers: {...enhancers, gitIgnore: {test: gitIgnoreExists, lift: liftGitignore}},
options: {projectRoot, vcs}
options: {projectRoot, vcs},
dependencies
})
.mockResolvedValue(enhancerResults);
when(deepmerge.all).calledWith([results, enhancerResults]).mockReturnValue(mergedResults);

expect(await lift({projectRoot, results, enhancers, vcs})).toEqual(enhancerResults);
expect(await lift({projectRoot, results, enhancers, vcs, dependencies})).toEqual(enhancerResults);
expect(readme.lift).toHaveBeenCalledWith({projectRoot, results: mergedResults});
});
});

0 comments on commit 6aa1e18

Please sign in to comment.