UNPKG

7.32 kBTypeScriptView Raw
1import type { InstrumentationMode } from '../profiling';
2interface IConfigPlatform {
3 /**
4 * App's bundle id
5 */
6 id?: string;
7 /**
8 * Discard any uncaught JS exceptions
9 * This can be very useful in production environments when you don't want your app to just crash if a developer forgot to guard against an unexpected JS level exception.
10 */
11 discardUncaughtJsExceptions?: boolean;
12}
13export interface IOSRemoteSPMPackage {
14 name: string;
15 libs: string[];
16 repositoryURL: string;
17 version: string;
18}
19export interface IOSLocalSPMPackage {
20 name: string;
21 libs: string[];
22 path: string;
23}
24export type IOSSPMPackage = IOSRemoteSPMPackage | IOSLocalSPMPackage;
25interface IConfigIOS extends IConfigPlatform {
26 /**
27 * Swift Package Manager
28 * List packages to be included in the iOS build.
29 */
30 SPMPackages?: Array<IOSSPMPackage>;
31}
32interface IConfigVisionOS extends IConfigIOS {
33}
34interface IConfigAndroid extends IConfigPlatform {
35 /**
36 * These are the v8 runtime flags you can pass in, you must have "--expose_gc" as this is used in the runtime
37 */
38 v8Flags?: string;
39 /**
40 * Enable code cache by setting this to "true"
41 */
42 codeCache?: boolean;
43 /**
44 * Depreciated
45 * Do not change
46 */
47 heapSnapshotScript?: string;
48 /**
49 * Depreciated
50 * Do No change - File to use for Snapshots
51 */
52 SnapshotFile?: string;
53 /**
54 * Directory of profiler out put files
55 */
56 profilerOutputDir?: string;
57 /**
58 * How frequently in MS to automatically trigger a gc (0 = Disabled & Default)
59 * Docs: https://docs.nativescript.org/core-concepts/android-runtime/advanced-topics/memory-management
60 */
61 gcThrottleTime?: number;
62 /**
63 * "none" & "full" is supported, "full" is depreciated
64 * Default: none
65 */
66 markingMode?: string;
67 /**
68 * Allow time zone changes to notify app, default: false
69 */
70 handleTimeZoneChanges?: boolean;
71 /**
72 * Maximum size of a single output string; default: 1024
73 */
74 maxLogcatObjectSize?: number;
75 /**
76 * Enable logging in Release applications, default: false
77 */
78 forceLog?: boolean;
79 /**
80 * How frequently in ms that it does the freeMemoryRatio check
81 * Docs: https://docs.nativescript.org/core-concepts/android-runtime/advanced-topics/memory-management
82 */
83 memoryCheckInterval?: number;
84 /**
85 * Percentage of memory (0.0 to 1.0) before it forces a GC (default & disabled = 0)
86 * Paired with he memoryCheckInterval
87 * Docs: https://docs.nativescript.org/core-concepts/android-runtime/advanced-topics/memory-management
88 */
89 freeMemoryRatio?: number;
90 /**
91 * Used for Advanced debugging
92 */
93 enableLineBreakpoints?: boolean;
94 /**
95 * Enable the multithreaded JavaScript engine, this will probably break plugins...
96 * Default: false - disabled.
97 */
98 enableMultithreadedJavascript?: boolean;
99}
100interface IConfigCLI {
101 /**
102 * Set the package manager to use for this project.
103 * Defaults to the CLI set package manager, or `npm` if not set globally
104 */
105 packageManager: 'yarn' | 'pnpm' | 'npm';
106 /**
107 * Optional - Override the files or paths to clean when running the `ns clean` command
108 */
109 pathsToClean?: string[];
110 /**
111 * Optional - Additional files or paths to clean when running the `ns clean` command, the paths are appended to the default list of paths.
112 */
113 additionalPathsToClean?: string[];
114}
115interface IConfigHook {
116 /**
117 * Event name for when to run the hook.
118 * Possible event names are any of the following with the pattern
119 * `before-*` and `after-*`
120 *
121 * * `buildAndroidPlugin` - Builds aar file for Android plugin, runs during prepareNativeApp
122 * * `buildAndroid` - Builds Android app
123 * * `buildIOS` - Builds iOS app
124 * * `checkEnvironment` - Validate project env, runs during ns doctor, clean, and most build commands
125 * * `checkForChanges` - Changes occurred during watch
126 * * `install` - Application installed to device/emulator
127 * * `prepare` - Compiles webpack and prepares native app in platforms folder
128 * * `prepareNativeApp` - Preparing the actual native app, runs during prepare/watch hook
129 * * `resolveCommand` - Resolves command and arguments, runs before all cli commands
130 * * `watch` - Setup watchers for live sync, runs during prepare hook
131 * * `watchPatterns` - Setup watch patterns, runs during watch hook
132 */
133 type: 'before-buildAndroidPlugin' | 'after-buildAndroidPlugin' | 'before-buildAndroid' | 'after-buildAndroid' | 'before-buildIOS' | 'after-buildIOS' | 'before-checkEnvironment' | 'after-checkEnvironment' | 'before-checkForChanges' | 'after-checkForChanges' | 'before-install' | 'after-install' | 'before-prepare' | 'after-prepare' | 'before-prepareNativeApp' | 'after-prepareNativeApp' | 'before-resolveCommand' | 'after-resolveCommand' | 'before-watch' | 'after-watch' | 'before-watchPatterns' | 'after-watchPatterns';
134 /**
135 * Path to the hook script file to run
136 */
137 script: string;
138}
139export interface NativeScriptConfig {
140 /**
141 * App's bundle id
142 * Used for both iOS and Android if they use the same bundle id. You can override per platform in the respective platform specific configurations.
143 */
144 id?: string;
145 /**
146 * App's main entry file - this setting overrides the value set in package.json
147 */
148 main?: string;
149 /**
150 * Path to the app source directory
151 * This is often the `src` or `app` directory however can be changed.
152 */
153 appPath?: string;
154 /**
155 * App_Resources path
156 * This is often at the root or inside `src` or `app` directory however can be anywhere.
157 */
158 appResourcesPath?: string;
159 shared?: boolean;
160 previewAppSchema?: string;
161 overridePods?: string;
162 /**
163 * Custom webpack config path
164 * The default is `webpack.config.js` in the root however you can use a custom name and place elsewhere.
165 */
166 webpackConfigPath?: string;
167 /**
168 * iOS specific configurations
169 * Various iOS specific configurations including iOS runtime flags.
170 */
171 ios?: IConfigIOS;
172 /**
173 * Vision Pro specific configurations
174 * Various VisionOS specific configurations including iOS runtime flags.
175 */
176 visionos?: IConfigVisionOS;
177 /**
178 * Android specific configurations
179 * Various Android specific configurations including Android runtime flags.
180 */
181 android?: IConfigAndroid;
182 /**
183 * Enable profiling for the application. Default: no profiling
184 * In most cases when profiling, you will want to use "timeline"
185 */
186 profiling?: InstrumentationMode;
187 /**
188 * Set the default CSS parser that NativeScript will use.
189 * Default: css-tree
190 */
191 cssParser?: 'rework' | 'nativescript' | 'css-tree';
192 /**
193 * Optionally specify a list of npm package names for which you would like the NativeScript CLI to ignore when attaching native dependencies to the build
194 */
195 ignoredNativeDependencies?: string[];
196 /**
197 * Set cli options
198 */
199 cli?: IConfigCLI;
200 /**
201 * Set project persistent hooks to run
202 */
203 hooks?: IConfigHook[];
204}
205export {};