bundo-appgen 0.0.1-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +253 -0
- package/bin.mjs +21 -0
- package/lib/bin/bin.mjs +1141 -0
- package/lib/bin/plugin-sandbox-runner.mjs +105 -0
- package/lib/commonjs/index.js +125 -0
- package/lib/module/chunk-bhc5nymd.js +12 -0
- package/lib/module/chunk-dvyy3g4j.js +25 -0
- package/lib/module/chunk-ynqw05p0.js +70 -0
- package/lib/module/config/apple/create-osx-appiconset.js +6 -0
- package/lib/module/config/apple/index.js +7 -0
- package/lib/module/config/index.js +8 -0
- package/lib/module/index.js +8 -0
- package/lib/typescript/config/apple/asset-catalog-format/app-icon/index.d.ts +3 -0
- package/lib/typescript/config/apple/asset-catalog-format/app-icon/index.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/app-icon/set-type.d.ts +42 -0
- package/lib/typescript/config/apple/asset-catalog-format/app-icon/set-type.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/app-icon/size.d.ts +21 -0
- package/lib/typescript/config/apple/asset-catalog-format/app-icon/size.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/appearances.d.ts +13 -0
- package/lib/typescript/config/apple/asset-catalog-format/appearances.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/idiom.d.ts +5 -0
- package/lib/typescript/config/apple/asset-catalog-format/idiom.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/color-space.d.ts +2 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/color-space.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/compression-type.d.ts +2 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/compression-type.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/display-gamut.d.ts +2 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/display-gamut.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/index.d.ts +6 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/index.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/language-direction.d.ts +2 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/language-direction.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/scale.d.ts +9 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/scale.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/set-type.d.ts +58 -0
- package/lib/typescript/config/apple/asset-catalog-format/image/set-type.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalog-format/index.d.ts +5 -0
- package/lib/typescript/config/apple/asset-catalog-format/index.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalogs-namespaced.d.ts +5 -0
- package/lib/typescript/config/apple/asset-catalogs-namespaced.d.ts.map +1 -0
- package/lib/typescript/config/apple/asset-catalogs.d.ts +73 -0
- package/lib/typescript/config/apple/asset-catalogs.d.ts.map +1 -0
- package/lib/typescript/config/apple/create-osx-appiconset.d.mts +72 -0
- package/lib/typescript/config/apple/create-osx-appiconset.d.mts.map +1 -0
- package/lib/typescript/config/apple/data.d.ts +103 -0
- package/lib/typescript/config/apple/data.d.ts.map +1 -0
- package/lib/typescript/config/apple/index.d.mts +8 -0
- package/lib/typescript/config/apple/index.d.mts.map +1 -0
- package/lib/typescript/config/apple/info-plist-value.d.ts +8 -0
- package/lib/typescript/config/apple/info-plist-value.d.ts.map +1 -0
- package/lib/typescript/config/apple/info-plist.d.ts +4 -0
- package/lib/typescript/config/apple/info-plist.d.ts.map +1 -0
- package/lib/typescript/config/apple/string-catalog.d.ts +2 -0
- package/lib/typescript/config/apple/string-catalog.d.ts.map +1 -0
- package/lib/typescript/config/data.d.ts +50 -0
- package/lib/typescript/config/data.d.ts.map +1 -0
- package/lib/typescript/config/index.d.mts +5 -0
- package/lib/typescript/config/index.d.mts.map +1 -0
- package/lib/typescript/config/plugin-item.d.ts +2 -0
- package/lib/typescript/config/plugin-item.d.ts.map +1 -0
- package/lib/typescript/config/plugin-registry.d.ts +3 -0
- package/lib/typescript/config/plugin-registry.d.ts.map +1 -0
- package/lib/typescript/index.d.mts +3 -0
- package/lib/typescript/index.d.mts.map +1 -0
- package/lib/typescript/plugin/apple/context.d.ts +28 -0
- package/lib/typescript/plugin/apple/context.d.ts.map +1 -0
- package/lib/typescript/plugin/apple/files.d.ts +7 -0
- package/lib/typescript/plugin/apple/files.d.ts.map +1 -0
- package/lib/typescript/plugin/apple/index.d.ts +6 -0
- package/lib/typescript/plugin/apple/index.d.ts.map +1 -0
- package/lib/typescript/plugin/apple/pod-spec-source-from-cocoapods.d.ts +5 -0
- package/lib/typescript/plugin/apple/pod-spec-source-from-cocoapods.d.ts.map +1 -0
- package/lib/typescript/plugin/apple/pod-spec-source-from-git.d.ts +11 -0
- package/lib/typescript/plugin/apple/pod-spec-source-from-git.d.ts.map +1 -0
- package/lib/typescript/plugin/apple/pod-spec-source-from-local.d.ts +7 -0
- package/lib/typescript/plugin/apple/pod-spec-source-from-local.d.ts.map +1 -0
- package/lib/typescript/plugin/context.d.ts +9 -0
- package/lib/typescript/plugin/context.d.ts.map +1 -0
- package/lib/typescript/plugin/index.d.ts +3 -0
- package/lib/typescript/plugin/index.d.ts.map +1 -0
- package/package.json +49 -0
- package/src/_bin/_global-vars/_global-vars.mts +47 -0
- package/src/_bin/_global-vars/index.mts +30 -0
- package/src/_bin/_main/_check-config-validity.mts +94 -0
- package/src/_bin/_main/_evaluate-plugin-registry.mts +181 -0
- package/src/_bin/_main/_exec-plugin-runner/_spawn-plugin-sandbox-runner.mts +149 -0
- package/src/_bin/_main/_exec-plugin-runner/exec-plugin-runner.mts +92 -0
- package/src/_bin/_main/_exec-plugin-runner/index.mts +1 -0
- package/src/_bin/_main/_get-config.mts +64 -0
- package/src/_bin/_main/_helpers/config/get-name.mts +24 -0
- package/src/_bin/_main/_helpers/config/get-project-name.mts +27 -0
- package/src/_bin/_main/_helpers/config/index.mts +2 -0
- package/src/_bin/_main/_helpers/index.mts +2 -0
- package/src/_bin/_main/_helpers/platform/compatibility-error.mts +7 -0
- package/src/_bin/_main/_helpers/platform/data.ts +9 -0
- package/src/_bin/_main/_helpers/platform/get-data.mts +48 -0
- package/src/_bin/_main/_helpers/platform/index.mts +4 -0
- package/src/_bin/_main/_helpers/platform/is-compatible.mts +30 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_init-appiconsets.mts +223 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_init-imagesets.mts +241 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_metadata-check/appearances.mts +24 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_metadata-check/idiom.mts +22 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_metadata-check/image/compression-type.mts +15 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_metadata-check/image/display-gamut.mts +12 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_metadata-check/image/index.mts +3 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_metadata-check/image/language-direction.mts +12 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_metadata-check/index.mts +3 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/create-asset-catalogs.mts +54 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/index.mts +1 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-string-catalogs/create-string-catalog.mts +134 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-string-catalogs/index.mts +1 -0
- package/src/_bin/_main/_init-template/_init-apple/_mod-files/_app-delegate-swift.mts +62 -0
- package/src/_bin/_main/_init-template/_init-apple/_mod-files/_podfile.mts +31 -0
- package/src/_bin/_main/_init-template/_init-apple/_mod-files/index.mts +1 -0
- package/src/_bin/_main/_init-template/_init-apple/_mod-files/mod-files.mts +17 -0
- package/src/_bin/_main/_init-template/_init-apple/index.mts +1 -0
- package/src/_bin/_main/_init-template/_init-apple/init-apple.mts +81 -0
- package/src/_bin/_main/_init-template/index.mts +1 -0
- package/src/_bin/_main/_init-template/init-template.mts +39 -0
- package/src/_bin/_main/_mod-plugin/index.mts +1 -0
- package/src/_bin/_main/_mod-plugin/mod-plugin.mts +77 -0
- package/src/_bin/_main/_xcodegen/_create-project-spec/_init-resources.mts +86 -0
- package/src/_bin/_main/_xcodegen/_create-project-spec/create-project-spec.mts +216 -0
- package/src/_bin/_main/_xcodegen/_create-project-spec/index.mts +1 -0
- package/src/_bin/_main/_xcodegen/_mod-known-regions/index.ts +1 -0
- package/src/_bin/_main/_xcodegen/_mod-known-regions/mod-known-regions.mts +52 -0
- package/src/_bin/_main/_xcodegen/index.mts +1 -0
- package/src/_bin/_main/_xcodegen/xcodegen.mts +46 -0
- package/src/_bin/_main/index.mts +1 -0
- package/src/_bin/_main/main.mts +160 -0
- package/src/_bin/bin.mts +68 -0
- package/src/_bin/plugin-sandbox-runner/_exec-plugins.mts +135 -0
- package/src/_bin/plugin-sandbox-runner/argv-json.ts +20 -0
- package/src/_bin/plugin-sandbox-runner/evaluated-plugin-registry.ts +12 -0
- package/src/_bin/plugin-sandbox-runner/index.ts +3 -0
- package/src/_bin/plugin-sandbox-runner/plugin-runner-context-result.ts +33 -0
- package/src/_bin/plugin-sandbox-runner/plugin-sandbox-runner.mts +68 -0
- package/src/config/apple/asset-catalog-format/app-icon/index.ts +2 -0
- package/src/config/apple/asset-catalog-format/app-icon/set-type.ts +59 -0
- package/src/config/apple/asset-catalog-format/app-icon/size.ts +37 -0
- package/src/config/apple/asset-catalog-format/appearances.ts +10 -0
- package/src/config/apple/asset-catalog-format/idiom.ts +16 -0
- package/src/config/apple/asset-catalog-format/image/color-space.ts +3 -0
- package/src/config/apple/asset-catalog-format/image/compression-type.ts +6 -0
- package/src/config/apple/asset-catalog-format/image/display-gamut.ts +3 -0
- package/src/config/apple/asset-catalog-format/image/index.ts +6 -0
- package/src/config/apple/asset-catalog-format/image/language-direction.ts +3 -0
- package/src/config/apple/asset-catalog-format/image/scale.ts +11 -0
- package/src/config/apple/asset-catalog-format/image/set-type.ts +85 -0
- package/src/config/apple/asset-catalog-format/index.ts +4 -0
- package/src/config/apple/asset-catalogs-namespaced.ts +13 -0
- package/src/config/apple/asset-catalogs.ts +76 -0
- package/src/config/apple/create-osx-appiconset.mts +135 -0
- package/src/config/apple/data.ts +123 -0
- package/src/config/apple/index.mts +7 -0
- package/src/config/apple/info-plist-value.ts +16 -0
- package/src/config/apple/info-plist.ts +6 -0
- package/src/config/apple/string-catalog.ts +0 -0
- package/src/config/data.ts +59 -0
- package/src/config/index.mts +4 -0
- package/src/config/plugin-item.ts +4 -0
- package/src/config/plugin-registry.ts +5 -0
- package/src/index.mts +2 -0
- package/src/plugin/apple/context.ts +68 -0
- package/src/plugin/apple/files.ts +14 -0
- package/src/plugin/apple/index.ts +5 -0
- package/src/plugin/apple/pod-spec-source-from-cocoapods.ts +9 -0
- package/src/plugin/apple/pod-spec-source-from-git.ts +13 -0
- package/src/plugin/apple/pod-spec-source-from-local.ts +6 -0
- package/src/plugin/context.ts +12 -0
- package/src/plugin/index.ts +2 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type * as AssetCatalogFormat from "./asset-catalog-format";
|
|
2
|
+
/**
|
|
3
|
+
* @see https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_ref-Asset_Catalog_Format/AssetTypes.html
|
|
4
|
+
*/
|
|
5
|
+
export interface AssetCatalogs {
|
|
6
|
+
/**
|
|
7
|
+
* Provide app icons in Asset Catalogs.
|
|
8
|
+
*
|
|
9
|
+
* Be aware! This configuration doesn't prevent you to provide incorrect or invalid app icon catalog data.
|
|
10
|
+
* You may prefer to use our helper such as `Config.Apple.createOSXappiconset()` to provide correct data.
|
|
11
|
+
*
|
|
12
|
+
* If you want to learn it, you can still use Xcode to provide app icon in Asset Catalogs,
|
|
13
|
+
* and see how Xcode instructs you to provide correct image size for each platform, along with its variant.
|
|
14
|
+
*
|
|
15
|
+
* Based on Apple documentation:
|
|
16
|
+
* - iOS, iPadOS, tvOS, and watchOS apps can auto-generate all icon variations from a single 1024×1024 pixel image.
|
|
17
|
+
* - For macOS and tvOS, you need to supply an asset for each size. At a minimum, you must provide all OS X icon sizes: 16x16, 32x32, 128x128, 256x256, 512x512, and 1024x1024.
|
|
18
|
+
* - For visionOS, you need to supply a single 1024x1024 pixel asset
|
|
19
|
+
*
|
|
20
|
+
* @see https://developer.apple.com/documentation/xcode/configuring-your-app-icon
|
|
21
|
+
* @see https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_ref-Asset_Catalog_Format/AppIconType.html
|
|
22
|
+
*/
|
|
23
|
+
appiconsets?: AssetCatalogFormat.AppIcon.SetType[];
|
|
24
|
+
/**
|
|
25
|
+
* Provide image assets in the {@link https://developer.apple.com/documentation/xcode/managing-assets-with-asset-catalogs|Asset Catalogs}.
|
|
26
|
+
*
|
|
27
|
+
* For React Native side, this is useful if you want to bundle your image files by the system, instead of using raw loose file next to the JavaScript bundle, so the system ships only the scale a device needs.
|
|
28
|
+
*
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // bundo.config.mjs
|
|
31
|
+
* export default {
|
|
32
|
+
* macos: {
|
|
33
|
+
* assetCatalogs: {
|
|
34
|
+
* imagesets: [{
|
|
35
|
+
* name: "FooImg",
|
|
36
|
+
* images: [{
|
|
37
|
+
* path: "./path/to/your-image.png",
|
|
38
|
+
* scale: "1x",
|
|
39
|
+
* }, {
|
|
40
|
+
* path: "./path/to/your-image-much-larger-scale.png",
|
|
41
|
+
* scale: "2x",
|
|
42
|
+
* }],
|
|
43
|
+
* }],
|
|
44
|
+
*
|
|
45
|
+
* BarName: {
|
|
46
|
+
* imagesets: [{
|
|
47
|
+
* name: "MyImage",
|
|
48
|
+
* images: [{
|
|
49
|
+
* path: "./path/to/my-image.png"
|
|
50
|
+
* }],
|
|
51
|
+
* }]
|
|
52
|
+
* },
|
|
53
|
+
* }
|
|
54
|
+
* },
|
|
55
|
+
* }
|
|
56
|
+
* // ---
|
|
57
|
+
*
|
|
58
|
+
* // React Native
|
|
59
|
+
* import { Image } from "react-native"
|
|
60
|
+
*
|
|
61
|
+
* export function Component() {
|
|
62
|
+
* return (<>
|
|
63
|
+
* <Image source={{ uri: "FooImg" }}/>
|
|
64
|
+
* <Image source={{ uri: "BarName/MyImage" }}/>
|
|
65
|
+
* </>)
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @see https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_ref-Asset_Catalog_Format/ImageSetType.html
|
|
70
|
+
*/
|
|
71
|
+
imagesets?: AssetCatalogFormat.Image.SetType[];
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=asset-catalogs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-catalogs.d.ts","sourceRoot":"","sources":["../../../../src/config/apple/asset-catalogs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,kBAAkB,MAAM,wBAAwB,CAAA;AAEjE;;GAEG;AACH,MAAM,WAAW,aAAa;IAE7B;;;;;;;;;;;;;;;;OAgBG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACH,SAAS,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;CAE/C"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type * as AssetCatalogFormat from "./asset-catalog-format/index.ts";
|
|
2
|
+
/**
|
|
3
|
+
* An helper to provide correct OS X app icon in the catalog.
|
|
4
|
+
* You can provide a single image for 1024x1024 size in the `images` property.
|
|
5
|
+
* However, if you want to customize your app’s icon variants, such as to show more or less detail at a specific size, you can provide individual assets for the variations.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createOSXappiconset(data: {
|
|
8
|
+
name: string;
|
|
9
|
+
images: OSXappiconsetImages;
|
|
10
|
+
}): {
|
|
11
|
+
name: string;
|
|
12
|
+
images: [{
|
|
13
|
+
path: string;
|
|
14
|
+
size: "16x16";
|
|
15
|
+
idiom: "mac";
|
|
16
|
+
scale: "1x";
|
|
17
|
+
}, {
|
|
18
|
+
path: string;
|
|
19
|
+
size: "16x16";
|
|
20
|
+
idiom: "mac";
|
|
21
|
+
scale: "2x";
|
|
22
|
+
}, {
|
|
23
|
+
path: string;
|
|
24
|
+
size: "32x32";
|
|
25
|
+
idiom: "mac";
|
|
26
|
+
scale: "1x";
|
|
27
|
+
}, {
|
|
28
|
+
path: string;
|
|
29
|
+
size: "32x32";
|
|
30
|
+
idiom: "mac";
|
|
31
|
+
scale: "2x";
|
|
32
|
+
}, {
|
|
33
|
+
path: string;
|
|
34
|
+
size: "128x128";
|
|
35
|
+
idiom: "mac";
|
|
36
|
+
scale: "1x";
|
|
37
|
+
}, {
|
|
38
|
+
path: string;
|
|
39
|
+
size: "128x128";
|
|
40
|
+
idiom: "mac";
|
|
41
|
+
scale: "2x";
|
|
42
|
+
}, {
|
|
43
|
+
path: string;
|
|
44
|
+
size: "256x256";
|
|
45
|
+
idiom: "mac";
|
|
46
|
+
scale: "1x";
|
|
47
|
+
}, {
|
|
48
|
+
path: string;
|
|
49
|
+
size: "256x256";
|
|
50
|
+
idiom: "mac";
|
|
51
|
+
scale: "2x";
|
|
52
|
+
}, {
|
|
53
|
+
path: string;
|
|
54
|
+
size: "512x512";
|
|
55
|
+
idiom: "mac";
|
|
56
|
+
scale: "1x";
|
|
57
|
+
}, {
|
|
58
|
+
path: string;
|
|
59
|
+
size: "512x512";
|
|
60
|
+
idiom: "mac";
|
|
61
|
+
scale: "2x";
|
|
62
|
+
}];
|
|
63
|
+
};
|
|
64
|
+
type OSXIconSize = Extract<AssetCatalogFormat.AppIcon.Size, "16x16" | "32x32" | "128x128" | "256x256" | "512x512" | "1024x1024"> | "64x64";
|
|
65
|
+
type OSXappiconsetImagesRequired = {
|
|
66
|
+
[Size in Extract<OSXIconSize, "1024x1024">]: string;
|
|
67
|
+
};
|
|
68
|
+
type OSXappiconsetImages = OSXappiconsetImagesRequired & Partial<{
|
|
69
|
+
[Size in Exclude<OSXIconSize, "1024x1024">]: string;
|
|
70
|
+
}>;
|
|
71
|
+
export {};
|
|
72
|
+
//# sourceMappingURL=create-osx-appiconset.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-osx-appiconset.d.mts","sourceRoot":"","sources":["../../../../src/config/apple/create-osx-appiconset.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,kBAAkB,MAAM,iCAAiC,CAAA;AAE1E;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE;IACL,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,mBAAmB,CAAC;CAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+ED;AAED,KAAK,WAAW,GACb,OAAO,CACR,kBAAkB,CAAC,OAAO,CAAC,IAAI,EAC7B,OAAO,GACP,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,WAAW,CACb,GACC,OAAO,CAAA;AAEV,KAAK,2BAA2B,GAAG;KACjC,IAAI,IAAI,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,GAAG,MAAM;CACnD,CAAA;AAED,KAAK,mBAAmB,GACrB,2BAA2B,GAC3B,OAAO,CAAC;KACR,IAAI,IAAI,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,GAAG,MAAM;CACnD,CAAC,CAAA"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { AssetCatalogs } from "./asset-catalogs";
|
|
2
|
+
import type { AssetCatalogsNamespaced } from "./asset-catalogs-namespaced";
|
|
3
|
+
import type { InfoPlist } from "./info-plist";
|
|
4
|
+
export interface Data {
|
|
5
|
+
/**
|
|
6
|
+
* Use one name of `appiconsets` in Asset Catalogs as the app icon.
|
|
7
|
+
* appgen script will throw an error if the name given is not found in the catalog.
|
|
8
|
+
*/
|
|
9
|
+
appicon?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Put compatible files as Asset Catalogs in Apple app.
|
|
12
|
+
*
|
|
13
|
+
* Unknown properties will be considered as namespace.
|
|
14
|
+
*
|
|
15
|
+
* @see https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_ref-Asset_Catalog_Format/AssetTypes.html
|
|
16
|
+
*/
|
|
17
|
+
assetCatalogs?: AssetCatalogs | AssetCatalogsNamespaced;
|
|
18
|
+
/**
|
|
19
|
+
* Build number for your Apple standalone app. Corresponds to `CFBundleVersion` and must match Apple's [specified format](https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion).
|
|
20
|
+
*/
|
|
21
|
+
buildVersion: string;
|
|
22
|
+
bundleIdentifier: string;
|
|
23
|
+
/**
|
|
24
|
+
* Customize the information property list values for your app.
|
|
25
|
+
*
|
|
26
|
+
* For human readable information property list, you can localize the information property through string catalog. See {@link stringCatalogs|`stringCatalogs`}
|
|
27
|
+
*/
|
|
28
|
+
infoPlist?: InfoPlist;
|
|
29
|
+
/**
|
|
30
|
+
* Provide array of [language identifier](https://developer.apple.com/documentation/xcode/choosing-localization-regions-and-scripts), made up of a [2-letter language code](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) of your desired language, with an optional region code (for example, en-US or en-GB).
|
|
31
|
+
*
|
|
32
|
+
* The first locale in the array will take it as the default language for your app. If there is no locales provided, "en" locale will be used.
|
|
33
|
+
*/
|
|
34
|
+
locales?: string[];
|
|
35
|
+
/**
|
|
36
|
+
* Apple app minimum deployment.
|
|
37
|
+
* @default "15.6"
|
|
38
|
+
*/
|
|
39
|
+
minimumDeployment?: string;
|
|
40
|
+
/**
|
|
41
|
+
* The name of your app as it appears on your home screen as a standalone app.
|
|
42
|
+
* It will overrides `name` property in the common config.
|
|
43
|
+
*
|
|
44
|
+
* This name will be used also for project name in Xcode with removed spaces and special characters.
|
|
45
|
+
*/
|
|
46
|
+
name?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Add files to the native bundle resources directory, e.g. "/Applications/Hello World.app/Contents/Resources".
|
|
49
|
+
* This property expects an array of string, which the string represent as the path, and it can be pointing to a specific file or a directory.
|
|
50
|
+
*
|
|
51
|
+
* For example, "../node_modules/foo-bar-module/xyz/abc" will copy the "abc" including its files if it is directory. Your app will has "abc" under bundle resources directory, e.g. "/Applications/Hello World.app/Contents/Resources/abc".
|
|
52
|
+
*
|
|
53
|
+
* For another real example, you can copy your font files in the bundle resources, and use in your React Native macOS app.
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* import type { Config } from "bundo.rn/appgen"
|
|
57
|
+
*
|
|
58
|
+
* export default {
|
|
59
|
+
*
|
|
60
|
+
* resources: ["./path/to/your/font-files"],
|
|
61
|
+
*
|
|
62
|
+
* infoPlist: {
|
|
63
|
+
* ATSApplicationFontsPath: "font-files/"
|
|
64
|
+
* },
|
|
65
|
+
*
|
|
66
|
+
* } satisfies Config.Data
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
resources?: string[];
|
|
70
|
+
/**
|
|
71
|
+
* Create string catalog in your app for localizable string. This is useful if you want to localize your information property list of your app.
|
|
72
|
+
*
|
|
73
|
+
* For example, to localize your app display name, you can provide a `InfoPlist` string catalog, with `CFBundleDisplayName` object and its key-value for each locale
|
|
74
|
+
* ```ts
|
|
75
|
+
* import type { Config } from "bundo.rn/appgen"
|
|
76
|
+
*
|
|
77
|
+
* export default {
|
|
78
|
+
* locales: ["en", "de"],
|
|
79
|
+
*
|
|
80
|
+
* stringCatalogs: {
|
|
81
|
+
* InfoPlist: {
|
|
82
|
+
* CFBundleDisplayName: {
|
|
83
|
+
* en: "Hello World",
|
|
84
|
+
* de: "Hallo Welt"
|
|
85
|
+
* },
|
|
86
|
+
* },
|
|
87
|
+
* },
|
|
88
|
+
* } satisfies Config.Data
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
stringCatalogs?: {
|
|
92
|
+
[CatalogName in string]: {
|
|
93
|
+
[Key in string]: {
|
|
94
|
+
[Locale in string]: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* This corresponds to `CFBundleShortVersionString`, The required format can be found [here](https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring)
|
|
100
|
+
*/
|
|
101
|
+
version: string;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/config/apple/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,EACb,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EACX,uBAAuB,EACvB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,KAAK,EACX,SAAS,EACT,MAAM,cAAc,CAAA;AAErB,MAAM,WAAW,IAAI;IAEpB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,aAAa,GAAG,uBAAuB,CAAC;IAExD;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAErB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,cAAc,CAAC,EAAE;SACf,WAAW,IAAI,MAAM,GAAG;aACvB,GAAG,IAAI,MAAM,GAAG;iBACf,MAAM,IAAI,MAAM,GAAG,MAAM;aAC1B;SACD;KACD,CAAC;IAEF;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CAEhB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type * as AssetCatalogFormat from "./asset-catalog-format/index.ts";
|
|
2
|
+
export type * from "./asset-catalogs.ts";
|
|
3
|
+
export type * from "./asset-catalogs-namespaced.ts";
|
|
4
|
+
export * from "./create-osx-appiconset.mts";
|
|
5
|
+
export type * from "./data.ts";
|
|
6
|
+
export type * from "./info-plist.ts";
|
|
7
|
+
export type * from "./info-plist-value.ts";
|
|
8
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/config/apple/index.mts"],"names":[],"mappings":"AAAA,YAAY,KAAK,kBAAkB,MAAM,iCAAiC,CAAA;AAC1E,mBAAmB,qBAAqB,CAAA;AACxC,mBAAmB,gCAAgC,CAAA;AACnD,cAAc,6BAA6B,CAAA;AAC3C,mBAAmB,WAAW,CAAA;AAC9B,mBAAmB,iBAAiB,CAAA;AACpC,mBAAmB,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type InfoPlistValue = boolean | string | string[] | DictionaryValue;
|
|
2
|
+
type DictionaryValue = {
|
|
3
|
+
[Key in string]: boolean | string | string[] | DictionaryValue | {
|
|
4
|
+
[Key2 in string]: DictionaryValue;
|
|
5
|
+
}[];
|
|
6
|
+
};
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=info-plist-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info-plist-value.d.ts","sourceRoot":"","sources":["../../../../src/config/apple/info-plist-value.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GACvB,OAAO,GACP,MAAM,GACN,MAAM,EAAE,GACR,eAAe,CAAA;AAElB,KAAK,eAAe,GAAG;KACrB,GAAG,IAAI,MAAM,GACX,OAAO,GACP,MAAM,GACN,MAAM,EAAE,GACR,eAAe,GACf;SACA,IAAI,IAAI,MAAM,GAAG,eAAe;KACjC,EAAE;CACJ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info-plist.d.ts","sourceRoot":"","sources":["../../../../src/config/apple/info-plist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,cAAc,EACd,MAAM,oBAAoB,CAAA;AAE3B,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC;CAChE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-catalog.d.ts","sourceRoot":"","sources":["../../../../src/config/apple/string-catalog.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type * as Apple from "./apple/index.mts";
|
|
2
|
+
import type { PluginRegistry } from "./plugin-registry";
|
|
3
|
+
export interface Data {
|
|
4
|
+
/**
|
|
5
|
+
* Please, only register a plugin in this field if you are really trust the plugin will not doing anything suspicious.
|
|
6
|
+
*
|
|
7
|
+
* Plugin in this registry is **letting a plugin to run its function in less restrictive way**, and run after all the restrictive plugins has finished.
|
|
8
|
+
*
|
|
9
|
+
* In this field, we let plugins run their functions in with these listed permissions
|
|
10
|
+
*
|
|
11
|
+
* - File System : Read and/or write access to these directories:
|
|
12
|
+
* - _rw_ : <project>/macos
|
|
13
|
+
* - _rw_ : <project>/windows
|
|
14
|
+
* - _r_ : node_modules directory lookup relatively from your project and global modules
|
|
15
|
+
* - _r_ : Its own plugin directory
|
|
16
|
+
* - Networking : HTTP request such as `fetch`.
|
|
17
|
+
*
|
|
18
|
+
* A plugin can modify some provided template files such as `AppDelegate.swift` without asking your permission.
|
|
19
|
+
* It is strongly recommended to check or audit your generated native project.
|
|
20
|
+
*
|
|
21
|
+
* Read {@link https://nodejs.org/api/permissions.html|Node.js Permission Model} for more informations.
|
|
22
|
+
*/
|
|
23
|
+
lessRestrictivePlugins?: PluginRegistry;
|
|
24
|
+
/**
|
|
25
|
+
* The name of your app as it appears on user screen as a standalone app. This value can be overriden in the platform specific config property if some cases the app name is different each platform.
|
|
26
|
+
*
|
|
27
|
+
* This name will be used also for project name in Xcode and Visual Studio with removed spaces and special characters.
|
|
28
|
+
*/
|
|
29
|
+
name?: string;
|
|
30
|
+
macos?: Apple.Data;
|
|
31
|
+
/**
|
|
32
|
+
* Register a plugin for letting the plugin to customize your generated native project, such as adding assets, modifying native code, and other advanced configurations.
|
|
33
|
+
*
|
|
34
|
+
* Plugins in this registry will only allow plugins to run their function in restrictive way. A plugin cannot perform a non restricted action such as File System, Networking, Child Process, and other actions in Node.js. See {@link https://nodejs.org/api/permissions.html|Node.js Permission Model}.
|
|
35
|
+
*
|
|
36
|
+
* In this field, we let plugins run their functions in with these listed permissions
|
|
37
|
+
*
|
|
38
|
+
* - File System - Read only access to these directories and/or files
|
|
39
|
+
* - <project>/macos/HelloWorld/AppDelegate.swift
|
|
40
|
+
* - <project>/macos/Podfile
|
|
41
|
+
* - node_modules directory lookup relatively from your project and global modules
|
|
42
|
+
* - Its own plugin directory
|
|
43
|
+
*
|
|
44
|
+
* A plugin still can modify some provided template files such as `AppDelegate.swift` without asking your permission.
|
|
45
|
+
* It is recommended to check or audit your generated native project.
|
|
46
|
+
*/
|
|
47
|
+
plugins?: PluginRegistry;
|
|
48
|
+
windows?: unknown;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/config/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,mBAAmB,CAAA;AAE/C,OAAO,KAAK,EACX,cAAc,EACd,MAAM,mBAAmB,CAAA;AAE1B,MAAM,WAAW,IAAI;IAEpB;;;;;;;;;;;;;;;;;;OAkBG;IACH,sBAAsB,CAAC,EAAE,cAAc,CAAC;IAExC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,KAAK,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC;IAEnB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB,OAAO,CAAC,EAAE,OAAO,CAAC;CAElB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/config/index.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAA;AAC1C,mBAAmB,WAAW,CAAA;AAC9B,mBAAmB,kBAAkB,CAAA;AACrC,mBAAmB,sBAAsB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-item.d.ts","sourceRoot":"","sources":["../../../src/config/plugin-item.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GACnB,MAAM,GACN,CAAC,MAAM,CAAC,GACR,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../../../src/config/plugin-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,UAAU,EACV,MAAM,eAAe,CAAA;AAEtB,MAAM,MAAM,cAAc,GAAG,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/index.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAA;AAC5C,YAAY,KAAK,MAAM,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type * as Config from "../../config/index.mts";
|
|
2
|
+
import type { Files } from "./files";
|
|
3
|
+
export interface Context {
|
|
4
|
+
/**
|
|
5
|
+
* Read and modify the templated files in raw source text.
|
|
6
|
+
*
|
|
7
|
+
* The initial source text will be the client app files.
|
|
8
|
+
* If the `appgen` run for the first time or clean run, the source text will be the `bundo-appgen` templates files.
|
|
9
|
+
*
|
|
10
|
+
* The source text is incrementally modified by client, other plugins, and yours.
|
|
11
|
+
* Be careful about modifying the source text file.
|
|
12
|
+
*
|
|
13
|
+
* See the directory `bundo-appgen/templates` in the node_modules
|
|
14
|
+
* or in our GitHub repository for your references.
|
|
15
|
+
*/
|
|
16
|
+
readonly files: Files;
|
|
17
|
+
/**
|
|
18
|
+
* Write a Info Plist for client app.
|
|
19
|
+
*
|
|
20
|
+
* The Info Plist object is initially an empty object,
|
|
21
|
+
* which means you cannot read what is the current Info Plist configuration from client configuration,
|
|
22
|
+
* but incrementally added and overwritten by other plugins.
|
|
23
|
+
*
|
|
24
|
+
* The Info Plist result from plugin cannot overwrite an Info Plist item of client app with the same key.
|
|
25
|
+
*/
|
|
26
|
+
readonly infoPlist: Config.Apple.InfoPlist;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/plugin/apple/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAA;AAErD,OAAO,KAAK,EACX,KAAK,EACL,MAAM,SAAS,CAAA;AAchB,MAAM,WAAW,OAAO;IAwBvB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAEtB;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;CAE3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../../src/plugin/apple/files.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,OAAO,EAAE;QACjB,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAK9B,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;CAKhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugin/apple/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,WAAW,CAAA;AAC9B,mBAAmB,SAAS,CAAA;AAC5B,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,8BAA8B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pod-spec-source-from-cocoapods.d.ts","sourceRoot":"","sources":["../../../../src/plugin/apple/pod-spec-source-from-cocoapods.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,EACN,GAAG,GACH,IAAI,GACJ,GAAG,GACH,IAAI,GACJ,IAAI,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pod-spec-source-from-git.d.ts","sourceRoot":"","sources":["../../../../src/plugin/apple/pod-spec-source-from-git.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EACN;QACD,MAAM,EAAE,MAAM,CAAC;KACf,GACC;QACD,GAAG,EAAE,MAAM,CAAC;KACZ,GACC;QACD,MAAM,EAAE,MAAM,CAAC;KACf,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pod-spec-source-from-local.d.ts","sourceRoot":"","sources":["../../../../src/plugin/apple/pod-spec-source-from-local.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as Apple from "./apple";
|
|
2
|
+
export interface Context<PluginParam extends object = object> {
|
|
3
|
+
/**
|
|
4
|
+
* An object that user passed to your plugin through plugin registry.
|
|
5
|
+
*/
|
|
6
|
+
readonly parameter: PluginParam | undefined;
|
|
7
|
+
readonly macos: Apple.Context;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/plugin/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,SAAS,CAAA;AAErC,MAAM,WAAW,OAAO,CAAC,WAAW,SAAS,MAAM,GAAG,MAAM;IAE3D;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,WAAW,GAAG,SAAS,CAAC;IAE5C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;CAE9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugin/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,WAAW,CAAA;AAC9B,YAAY,KAAK,KAAK,MAAM,SAAS,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bundo-appgen",
|
|
3
|
+
"version": "0.0.1-beta.7",
|
|
4
|
+
"description": "App generator CLI for React Native macOS and Windows",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "RakaDoank <rakaaudira@gmail.com> (https://github.com/RakaDoank)",
|
|
7
|
+
"homepage": "https://github.com/RakaDoank/bundo.rn",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/RakaDoank/bundo.rn.git",
|
|
11
|
+
"directory": "packages/bundo-appgen"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "bun run ./_scripts/build.mts",
|
|
15
|
+
"build-types": "bunx tsc --project ./tsconfig.build-types.json"
|
|
16
|
+
},
|
|
17
|
+
"bin": "./bin.mjs",
|
|
18
|
+
"types": "./lib/typescript/index.d.mts",
|
|
19
|
+
"files": [
|
|
20
|
+
"bin.mjs",
|
|
21
|
+
"lib",
|
|
22
|
+
"src",
|
|
23
|
+
"!*.tsbuildinfo"
|
|
24
|
+
],
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"import": "./lib/module/index.js",
|
|
28
|
+
"require": "./lib/commonjs/index.js",
|
|
29
|
+
"types": "./lib/typescript/index.d.mts"
|
|
30
|
+
},
|
|
31
|
+
"./bin.mjs": {
|
|
32
|
+
"node": "./bin.mjs"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"react-native-macos": "^0.81"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"typescript": ">=6 <=7",
|
|
40
|
+
"yargs": "^18"
|
|
41
|
+
},
|
|
42
|
+
"optionalDependencies": {
|
|
43
|
+
"tsx": "^4"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"bun": "^1",
|
|
47
|
+
"node": ">=22"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const
|
|
2
|
+
prefixName =
|
|
3
|
+
`__bundo_appgen_${Math.random()}_` as const,
|
|
4
|
+
|
|
5
|
+
postfixSetCount =
|
|
6
|
+
"_setcount" as const,
|
|
7
|
+
|
|
8
|
+
postfixSetCountMax =
|
|
9
|
+
"_setcountmax" as const
|
|
10
|
+
|
|
11
|
+
export function globalVars<TypeData = symbol>(
|
|
12
|
+
name: string,
|
|
13
|
+
initialValue: TypeData,
|
|
14
|
+
/**
|
|
15
|
+
* @default 1
|
|
16
|
+
*/
|
|
17
|
+
maxSetCount?: number,
|
|
18
|
+
) {
|
|
19
|
+
// @ts-expect-error custom var
|
|
20
|
+
globalThis[prefixName + name] = initialValue
|
|
21
|
+
|
|
22
|
+
// @ts-expect-error custom var
|
|
23
|
+
globalThis[prefixName + name + postfixSetCount] = 0
|
|
24
|
+
// @ts-expect-error custom var
|
|
25
|
+
globalThis[prefixName + name + postfixSetCountMax] = maxSetCount ?? 1
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
get(): TypeData {
|
|
29
|
+
// @ts-expect-error custom var
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
31
|
+
return globalThis[prefixName + name]
|
|
32
|
+
},
|
|
33
|
+
set(value: TypeData) {
|
|
34
|
+
// @ts-expect-error custom var
|
|
35
|
+
globalThis[prefixName + name + postfixSetCount] += 1
|
|
36
|
+
|
|
37
|
+
if(
|
|
38
|
+
// @ts-expect-error custom var
|
|
39
|
+
globalThis[prefixName + name + postfixSetCount] > globalThis[prefixName + name + postfixSetCountMax]
|
|
40
|
+
) {
|
|
41
|
+
throw new Error("Exceeded amount of modifying.")
|
|
42
|
+
}
|
|
43
|
+
// @ts-expect-error custom var
|
|
44
|
+
globalThis[prefixName + name] = value
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
}
|