Skip to content

Commit

Permalink
Use publisherName and extensionName for theme id
Browse files Browse the repository at this point in the history
  • Loading branch information
jschr committed Jul 16, 2018
1 parent a0c22df commit 160c8f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 0 additions & 1 deletion backend/jobs/extractColors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
import * as fetch from 'jest-fetch-mock'
import createServices from '../services/mock'
import * as themeVariables from '../utils/themeVariables'
import createThemeId from '../utils/createThemeId'
import extractColors from './extractColors'

afterEach(() => fetch.resetMocks())
Expand Down
9 changes: 7 additions & 2 deletions backend/jobs/extractThemes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ export default async function run(services: Services): Promise<any> {
}

const { payload } = job
const { repositoryOwner, repository } = payload
const {
repositoryOwner,
repository,
publisherName,
extensionName,
} = payload
// Find the default branch of the repository.
const repositoryBranch = await fetchDefaultBranch(
services,
Expand Down Expand Up @@ -66,7 +71,7 @@ export default async function run(services: Services): Promise<any> {
// Remove './' from './path'.
const themePath = theme.path.replace(/^\.\//, '')
const url = `${branchUrl}/${themePath}`
const themeId = createThemeId(repositoryOwner, repository, themePath)
const themeId = createThemeId(publisherName, extensionName, themePath)

themes.push({
...payload,
Expand Down
6 changes: 3 additions & 3 deletions backend/utils/createThemeId.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Computes the id of a theme from it's github repository
// and path to the json definition.
export default function createThemeId(
repositoryOwner: string,
repository: string,
publisherName: string,
extensionName: string,
themePath: string,
): string {
return `${repositoryOwner}$${repository}$${themePath}`.toLowerCase()
return `${publisherName}$${extensionName}$${themePath}`.toLowerCase()
}

0 comments on commit 160c8f4

Please sign in to comment.