Skip to content

Commit

Permalink
Merge pull request #1489 from form8ion/beta
Browse files Browse the repository at this point in the history
  • Loading branch information
travi authored Jan 3, 2024
2 parents 9499626 + fa2fac4 commit f917275
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 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
1 change: 0 additions & 1 deletion test/integration/features/git.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Feature: Git Repository
Then the base git files should be present
And the additional ignores are added to the gitignore

@wip
Scenario: already versioned without an existing gitignore
Given the project root is already initialized as a git repository
And a language scaffolder is chosen
Expand Down
1 change: 0 additions & 1 deletion test/integration/features/lift/git/ignore.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Feature: Gitignore
When the project is lifted
Then the gitignore file is unchanged

@wip
Scenario: additional directories and files
Given additional directories are provided to be ignored from vcs
And additional files are provided to be ignored from vcs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ Then('the gitignore file is unchanged', async function () {
Then('the gitignore file is added', async function () {
assert.equal(
await fs.readFile(`${process.cwd()}/.gitignore`, 'utf-8'),
`${this.vcsIgnoreDirectories.join('\n')}\n\n${this.vcsIgnoreFiles.join('\n')}`
`\n${this.vcsIgnoreDirectories.join('\n')}\n\n${this.vcsIgnoreFiles.join('\n')}`
);
});

0 comments on commit f917275

Please sign in to comment.