Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ theme/templates/**/*.json
theme/sections/*.json

.shopkeeper
!src/utilities/fixtures/.shopkeeper/
shopify
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ installation of [Dawn](https://github.com/shopify/dawn):
.shopkeeper
├── production
│   ├── config
│   │   └── settings_data.json
│   │   ├── settings_data.json
│   ├── locales
│   │   ├── en.default.json
│   │   └── es.json
│   ├── sections
│   │   ├── footer-group.json
│   │   └── header-group.json
Expand Down
3 changes: 3 additions & 0 deletions docs/the_complete_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ bucket, run `shopkeeper bucket create --bucket production`.
.shopkeeper
├── production
│   ├── config
│   ├── locales
│   ├── sections
│   ├── templates
│   ├── .env
Expand Down Expand Up @@ -143,6 +144,8 @@ theme/assets
theme/config/settings_data.json
theme/templates/**/*.json
theme/sections/*.json
theme/locales/*.json
!theme/locales/*schema*.json
```

Adding this config makes only the settings in `.shopkeeper` trackable by `git`.
Expand Down
2 changes: 2 additions & 0 deletions src/services/bucket/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ theme/assets
theme/config/settings_data.json
theme/templates/**/*.json
theme/sections/*.json
theme/locales/*.json
!theme/locales/*schema*.json
`
11 changes: 9 additions & 2 deletions src/utilities/bucket.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('bucket utilities', () => {
const configPath = joinPath(shopkeeperRoot, 'production', 'config')
const templatesPath = joinPath(shopkeeperRoot, 'production', 'templates')
const sectionsPath = joinPath(shopkeeperRoot, 'production', 'sections')
const localesPath = joinPath(shopkeeperRoot, 'production', 'locales')

// When
await createBuckets(shopkeeperRoot, ['production'])
Expand All @@ -46,6 +47,7 @@ describe('bucket utilities', () => {
expect(await fileExists(configPath)).toBe(true)
expect(await fileExists(templatesPath)).toBe(true)
expect(await fileExists(sectionsPath)).toBe(true)
expect(await fileExists(localesPath)).toBe(true)
})
})
})
Expand Down Expand Up @@ -124,6 +126,7 @@ describe('bucket utilities', () => {
[
'config/settings_data.json',
'templates/product.json',
'locales/en.default.json',
'templates/customers/account.json',
'templates/metaobject/toy.json',
'sections/header-group.json',
Expand All @@ -148,6 +151,7 @@ describe('bucket utilities', () => {
'templates/customers/account.json',
'templates/metaobject/toy.json',
'sections/header-group.json',
'locales/en.default.json',
].sort(),
)
})
Expand All @@ -169,6 +173,7 @@ describe('bucket utilities', () => {
'templates/customers/account.json',
'templates/metaobject/toy.json',
'sections/header-group.json',
'locales/en.default.json',
].sort(),
)
})
Expand Down Expand Up @@ -235,7 +240,7 @@ describe('bucket utilities', () => {
const settingsFolders = getSettingsPatterns()

// Then
expect(settingsFolders).toEqual(['config/settings_data.json', 'templates/**/*.json', 'sections/*.json'])
expect(settingsFolders).toEqual(['config/settings_data.json', 'templates/**/*.json', 'sections/*.json', 'locales/!(*schema*).json'])
})
})

Expand All @@ -257,6 +262,8 @@ describe('bucket utilities', () => {
'templates/customers/*.json',
'--only',
'templates/metaobject/*.json',
'--only',
'locales/!(*schema*).json',
])
})
})
Expand All @@ -267,7 +274,7 @@ describe('bucket utilities', () => {
const settingsFolders = getSettingsFolders()

// Then
expect(settingsFolders).toEqual(['config', 'templates', 'sections'])
expect(settingsFolders).toEqual(['config', 'templates', 'sections', 'locales'])
})
})
})
11 changes: 9 additions & 2 deletions src/utilities/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export async function createBuckets(shopkeeperRoot: string, buckets: string[]) {
await mkdir(joinPath(bucketPath, 'config'))
await mkdir(joinPath(bucketPath, 'templates'))
await mkdir(joinPath(bucketPath, 'sections'))
await mkdir(joinPath(bucketPath, 'locales'))
}),
)
}
Expand Down Expand Up @@ -137,7 +138,12 @@ export async function getCurrentBucket(shopkeeperRoot: string): Promise<string>
}

export function getSettingsPatterns(): string[] {
return ['config/settings_data.json', 'templates/**/*.json', 'sections/*.json']
return [
'config/settings_data.json',
'templates/**/*.json',
'sections/*.json',
'locales/!(*schema*).json',
]
}

export const CLI_SETTINGS_FLAGS = [
Expand All @@ -146,6 +152,7 @@ export const CLI_SETTINGS_FLAGS = [
'templates/*.json',
'templates/customers/*.json',
'templates/metaobject/*.json',
'locales/!(*schema*).json',
]

export function cliSettingFlags() {
Expand All @@ -157,7 +164,7 @@ export function cliSettingFlags() {
}

export function getSettingsFolders() {
return ['config', 'templates', 'sections']
return ['config', 'templates', 'sections', 'locales']
}

export async function copyFiles(moves: FileMove[]) {
Expand Down
Empty file.
Empty file.
11 changes: 11 additions & 0 deletions src/utilities/theme.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe('theme utilities', () => {
'templates/*.json',
'templates/customers/*.json',
'templates/metaobject/*.json',
'locales/!(*schema*).json',
]
const flags: PullFlags = {
only: settingsFlags,
Expand Down Expand Up @@ -50,6 +51,7 @@ describe('theme utilities', () => {
'templates/*.json',
'templates/customers/*.json',
'templates/metaobject/*.json',
'locales/!(*schema*).json',
]
const flags: PullFlags = {
only: settingsFlags,
Expand Down Expand Up @@ -105,6 +107,7 @@ describe('theme utilities', () => {
'templates/*.json',
'templates/customers/*.json',
'templates/metaobject/*.json',
'locales/!(*schema*).json',
],
})
})
Expand Down Expand Up @@ -143,6 +146,7 @@ describe('theme utilities', () => {
'templates/*.json',
'templates/customers/*.json',
'templates/metaobject/*.json',
'locales/!(*schema*).json',
],
})
})
Expand Down Expand Up @@ -181,6 +185,7 @@ describe('theme utilities', () => {
'templates/*.json',
'templates/customers/*.json',
'templates/metaobject/*.json',
'locales/!(*schema*).json',
],
})
})
Expand Down Expand Up @@ -219,6 +224,7 @@ describe('theme utilities', () => {
'templates/*.json',
'templates/customers/*.json',
'templates/metaobject/*.json',
'locales/!(*schema*).json',
],
})
})
Expand Down Expand Up @@ -257,6 +263,7 @@ describe('theme utilities', () => {
'templates/*.json',
'templates/customers/*.json',
'templates/metaobject/*.json',
'locales/!(*schema*).json',
],
})
})
Expand Down Expand Up @@ -362,6 +369,7 @@ describe('theme utilities', () => {
'templates/*.json',
'templates/customers/*.json',
'templates/metaobject/*.json',
'locales/!(*schema*).json',
],
})
})
Expand Down Expand Up @@ -400,6 +408,7 @@ describe('theme utilities', () => {
'templates/*.json',
'templates/customers/*.json',
'templates/metaobject/*.json',
'locales/!(*schema*).json',
],
})
})
Expand Down Expand Up @@ -434,6 +443,7 @@ describe('theme utilities', () => {
'templates/*.json',
'templates/customers/*.json',
'templates/metaobject/*.json',
'locales/!(*schema*).json',
],
})
})
Expand All @@ -451,6 +461,7 @@ describe('theme utilities', () => {
'templates/*.json',
'templates/customers/*.json',
'templates/metaobject/*.json',
'locales/!(*schema*).json',
],
}))
})
Expand Down