-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(predicate): added the function to determine if the lifter should…
… be applied
- Loading branch information
Showing
9 changed files
with
62 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
// #### Import | ||
// remark-usage-ignore-next | ||
import stubbedFs from 'mock-fs'; | ||
import {scaffold} from './lib/index.js'; | ||
import {scaffold, lift, test} from './lib/index.js'; | ||
|
||
// remark-usage-ignore-next | ||
stubbedFs(); | ||
|
||
// #### Execute | ||
|
||
(async () => { | ||
await scaffold({ | ||
projectRoot: process.cwd(), | ||
projectName: 'project-name' | ||
}); | ||
const projectRoot = process.cwd(); | ||
|
||
await scaffold({projectRoot, projectName: 'project-name'}); | ||
|
||
if (await test({projectRoot})) { | ||
await lift({projectRoot, vcs: {}}); | ||
} | ||
})(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export {default as scaffold} from './scaffolder.js'; | ||
export {lift} from './pom/index.js'; | ||
export {lift, test} from './pom/index.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export {default as scaffold} from './scaffolder.js'; | ||
export {default as lift} from './lifter.js'; | ||
export {default as test} from './predicate.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import {fileExists} from '@form8ion/core'; | ||
|
||
export default function ({projectRoot}) { | ||
return fileExists(`${projectRoot}/pom.xml`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {fileExists} from '@form8ion/core'; | ||
|
||
import {afterEach, describe, it, vi, expect} from 'vitest'; | ||
import any from '@travi/any'; | ||
import {when} from 'jest-when'; | ||
|
||
import pomExists from './predicate.js'; | ||
|
||
vi.mock('@form8ion/core'); | ||
|
||
describe('maven predicate', () => { | ||
const projectRoot = any.string(); | ||
|
||
afterEach(() => { | ||
vi.clearAllMocks(); | ||
}); | ||
|
||
it('should return `true` when a root pom exists', async () => { | ||
when(fileExists).calledWith(`${projectRoot}/pom.xml`).mockReturnValue(true); | ||
|
||
expect(await pomExists({projectRoot})).toBe(true); | ||
}); | ||
|
||
it('should return `false` when a root pom does not exist', async () => { | ||
when(fileExists).calledWith(`${projectRoot}/pom.xml`).mockReturnValue(false); | ||
|
||
expect(await pomExists({projectRoot})).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters