-
Notifications
You must be signed in to change notification settings - Fork 1
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 #36 from elementsinteractive/feature/android-json-…
…config feat!: adds json configuration file for android generation
- Loading branch information
Showing
17 changed files
with
171 additions
and
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"theme": { | ||
"typography": { | ||
"destination": "src/android/__tests__/__output/base", | ||
"packageName": "nl.makerstreet.design.typography" | ||
}, | ||
"colors": { | ||
"destination": "src/android/__tests__/__output/light", | ||
"packageName": "nl.makerstreet.design.colors" | ||
}, | ||
"spacings": { | ||
"destination": "src/android/__tests__/__output/base", | ||
"packageName": "nl.makerstreet.design.spacings" | ||
} | ||
} | ||
} |
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,23 +1,31 @@ | ||
import { join } from 'path' | ||
import { AndroidTheme } from './types' | ||
|
||
export const TEMPLATES = (destination: string) => ({ | ||
export const ColorFilename = 'Color.kt' | ||
export const SpacingFilename = 'Spacing.kt' | ||
export const TypeFilename = 'Type.kt' | ||
|
||
export const TEMPLATES = (theme: AndroidTheme) => ({ | ||
typographyTemplate: { | ||
source: join(__dirname, './templates/typographies.ejs'), | ||
destination: `${destination}/Type.kt`, | ||
destination: `${theme.typography.destination}/${TypeFilename}`, | ||
filter: 'isTypography', | ||
formatter: 'android/compose/typography', | ||
packageName: theme.typography.packageName, | ||
}, | ||
spacingsTemplate: { | ||
source: join(__dirname, './templates/spacings.ejs'), | ||
destination: `${destination}/Spacing.kt`, | ||
destination: `${theme.spacings.destination}/${SpacingFilename}`, | ||
filter: 'isSpacing', | ||
formatter: 'android/spacings', | ||
packageName: theme.spacings.packageName, | ||
}, | ||
colorsTemplate: { | ||
source: join(__dirname, './templates/colors.ejs'), | ||
destination: `${destination}/Color.kt`, | ||
destination: `${theme.colors.destination}/${ColorFilename}`, | ||
filter: 'color', | ||
formatter: 'android/compose/colors', | ||
packageName: theme.colors.packageName, | ||
}, | ||
headerTemplate: join(__dirname, './templates/header.ejs'), | ||
}) |
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,16 @@ | ||
import { AndroidTheme } from '../../types' | ||
|
||
export const DUMMY_ANDROID_THEME: AndroidTheme = { | ||
typography: { | ||
destination: '', | ||
packageName: '', | ||
}, | ||
spacings: { | ||
destination: '', | ||
packageName: '', | ||
}, | ||
colors: { | ||
destination: '', | ||
packageName: '', | ||
}, | ||
} |
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,5 @@ | ||
import { fileToJSON } from '../common/helpers' | ||
import { AndroidJsonOptions } from './types' | ||
|
||
export const readJsonFileAsOptions = (configPath: string) => | ||
fileToJSON(configPath) as AndroidJsonOptions |
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
Oops, something went wrong.