Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add asset support for capacitor #222

Merged
merged 6 commits into from
Sep 25, 2024
Merged
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
641 changes: 635 additions & 6 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
"test": "turbo run test",
"shipit": "npm run build-jar -w packages/gradle-parse && npm run build -- --force && npm run test && npx changeset publish && git push --tags"
},
"volta": {
"node": "16.18.1",
"npm": "9.1.2"
},
"packageManager": "[email protected]"
"dependencies": {
"@types/sharp": "^0.31.1"
}
}
1 change: 1 addition & 0 deletions packages/project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"prettier": "^2.7.1",
"prompts": "^2.4.2",
"replace": "^1.1.0",
"sharp": "^0.33.5",
"tempy": "^1.0.1",
"tmp": "^0.2.1",
"ts-node": "^10.2.1",
Expand Down
116 changes: 116 additions & 0 deletions packages/project/src/assets/android/assets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import type {
AndroidOutputAssetTemplate,
AndroidOutputAssetTemplateAdaptiveIcon
} from '../asset-types';
import { AssetKind, AndroidDensity, Format, Platform } from '../asset-types';

export const ANDROID_LDPI_ICON: AndroidOutputAssetTemplate = {
platform: Platform.Android,
kind: AssetKind.Icon,
format: Format.Png,
width: 36,
height: 36,
density: AndroidDensity.Ldpi,
};

export const ANDROID_MDPI_ICON: AndroidOutputAssetTemplate = {
platform: Platform.Android,
kind: AssetKind.Icon,
format: Format.Png,
width: 48,
height: 48,
density: AndroidDensity.Mdpi,
};

export const ANDROID_HDPI_ICON: AndroidOutputAssetTemplate = {
platform: Platform.Android,
kind: AssetKind.Icon,
format: Format.Png,
width: 72,
height: 72,
density: AndroidDensity.Hdpi,
};

export const ANDROID_XHDPI_ICON: AndroidOutputAssetTemplate = {
platform: Platform.Android,
kind: AssetKind.Icon,
format: Format.Png,
width: 96,
height: 96,
density: AndroidDensity.Xhdpi,
};

export const ANDROID_XXHDPI_ICON: AndroidOutputAssetTemplate = {
platform: Platform.Android,
kind: AssetKind.Icon,
format: Format.Png,
width: 144,
height: 144,
density: AndroidDensity.Xxhdpi,
};

export const ANDROID_XXXHDPI_ICON: AndroidOutputAssetTemplate = {
platform: Platform.Android,
kind: AssetKind.Icon,
format: Format.Png,
width: 192,
height: 192,
density: AndroidDensity.Xxxhdpi,
};

/**
* Adaptive icons
*/
export const ANDROID_LDPI_ADAPTIVE_ICON: AndroidOutputAssetTemplateAdaptiveIcon = {
platform: Platform.Android,
kind: AssetKind.AdaptiveIcon,
format: Format.Png,
width: 81,
height: 81,
density: AndroidDensity.Ldpi,
};

export const ANDROID_MDPI_ADAPTIVE_ICON: AndroidOutputAssetTemplateAdaptiveIcon = {
platform: Platform.Android,
kind: AssetKind.AdaptiveIcon,
format: Format.Png,
width: 108,
height: 108,
density: AndroidDensity.Mdpi,
};

export const ANDROID_HDPI_ADAPTIVE_ICON: AndroidOutputAssetTemplateAdaptiveIcon = {
platform: Platform.Android,
kind: AssetKind.AdaptiveIcon,
format: Format.Png,
width: 162,
height: 162,
density: AndroidDensity.Hdpi,
};

export const ANDROID_XHDPI_ADAPTIVE_ICON: AndroidOutputAssetTemplateAdaptiveIcon = {
platform: Platform.Android,
kind: AssetKind.AdaptiveIcon,
format: Format.Png,
width: 216,
height: 216,
density: AndroidDensity.Xhdpi,
};

export const ANDROID_XXHDPI_ADAPTIVE_ICON: AndroidOutputAssetTemplateAdaptiveIcon = {
platform: Platform.Android,
kind: AssetKind.AdaptiveIcon,
format: Format.Png,
width: 324,
height: 324,
density: AndroidDensity.Xxhdpi,
};

export const ANDROID_XXXHDPI_ADAPTIVE_ICON: AndroidOutputAssetTemplateAdaptiveIcon = {
platform: Platform.Android,
kind: AssetKind.AdaptiveIcon,
format: Format.Png,
width: 432,
height: 432,
density: AndroidDensity.Xxxhdpi,
};
Loading
Loading