-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from emulsify-ds/platform-starters
feat: Add no-platform starter as default init setup
- Loading branch information
Showing
17 changed files
with
129 additions
and
52 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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
jest.mock('../fs/findFileInCurrentPath', () => jest.fn()); | ||
jest.mock('../fs/loadJsonFile', () => jest.fn()); | ||
|
||
import findFileInCurrentPath from '../fs/findFileInCurrentPath.js'; | ||
import getNoPlatformInfo from './getNoPlatformInfo.js'; | ||
|
||
const findFileMock = (findFileInCurrentPath as jest.Mock).mockReturnValue( | ||
'/home/uname/Projects/cornflake/project.emulsify.json', | ||
); | ||
|
||
describe('getNoPlatformInfo', () => { | ||
it('returns PlatformInstanceInfo if current directory is found', async () => { | ||
expect.assertions(1); | ||
await expect(getNoPlatformInfo()).resolves.toEqual({ | ||
name: 'none', | ||
platformMajorVersion: 1, | ||
emulsifyParentDirectory: | ||
'/home/uname/Projects/cornflake/web/themes/custom', | ||
root: '/home/uname/Projects/cornflake', | ||
}); | ||
}); | ||
|
||
it('returns void if no project.emulsify.json file is found', async () => { | ||
expect.assertions(1); | ||
findFileMock.mockReturnValueOnce(undefined); | ||
await expect(getNoPlatformInfo()).resolves.toBeUndefined(); | ||
}); | ||
}); |
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,21 @@ | ||
import { dirname, join } from 'path'; | ||
import findFileInCurrentPath from '../fs/findFileInCurrentPath.js'; | ||
import type { PlatformInstanceInfo } from '@emulsify-cli/internal'; | ||
|
||
/** | ||
* Looks for no platform specified within the cwd, and returns information | ||
* such as name, root path, and version. | ||
*/ | ||
export default async function getNoPlatformInfo(): Promise<PlatformInstanceInfo | void> { | ||
const existingProject = findFileInCurrentPath('project.emulsify.json'); | ||
if (!existingProject) { | ||
return undefined; | ||
} | ||
const root = dirname(existingProject); | ||
return { | ||
root, | ||
name: 'none', | ||
emulsifyParentDirectory: join(root, 'web', 'themes', 'custom'), | ||
platformMajorVersion: 1, | ||
}; | ||
} |
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
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