Skip to content

Commit f1f2bbf

Browse files
committed
[4.8] Keep custom theme repositories on their default branch
Use the stable release by default only for Skeleton theme. Preserve the default branch for custom repositories unless --latest is passed.
1 parent d725067 commit f1f2bbf

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎packages/theme/src/cli/commands/theme/init.test.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,18 @@ describe('theme init', () => {
104104
expect(cloneRepo).toHaveBeenCalledWith('https://github.com/Shopify/dawn.git', expect.any(String))
105105
})
106106

107-
test('uses the latest tag for a custom repository when stdin is not a TTY', async () => {
107+
test('keeps the default branch for a custom repository when stdin is not a TTY', async () => {
108108
Object.defineProperty(process.stdin, 'isTTY', {configurable: true, value: false})
109109

110110
await run(['--clone-url=https://github.com/Shopify/dawn.git'])
111111

112+
expect(cloneRepo).toHaveBeenCalledWith('https://github.com/Shopify/dawn.git', expect.any(String))
113+
expect(cloneRepoAndCheckoutLatestTag).not.toHaveBeenCalled()
114+
})
115+
116+
test('uses the latest tag for a custom repository with --latest', async () => {
117+
await run(['--clone-url=https://github.com/Shopify/dawn.git', '--latest'])
118+
112119
expect(cloneRepoAndCheckoutLatestTag).toHaveBeenCalledWith(
113120
'https://github.com/Shopify/dawn.git',
114121
expect.any(String),

‎packages/theme/src/cli/commands/theme/init.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ export default class Init extends ThemeCommand {
6565
const name = args.name ?? (await this.promptName(flags.path, inputDisabled))
6666
const repoUrl = flags['clone-url']
6767
const destination = joinPath(flags.path, name)
68-
let latestRelease = flags.latest || inputDisabled
68+
let latestRelease = flags.latest
6969

7070
if (!latestRelease && repoUrl === SKELETON_THEME_URL) {
7171
latestRelease =
72+
inputDisabled ||
7273
!terminalSupportsPrompting() ||
7374
(await renderSelectPrompt({
7475
message: 'Which version of Skeleton theme would you like to use?',

0 commit comments

Comments
 (0)