@gfean/react-native-bundle-drop 0.4.3 → 0.4.4
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/BundleDropExpo.podspec +21 -0
- package/README.md +250 -124
- package/android/src/main/java/com/bundledrop/BundleDropNativePaths.kt +33 -3
- package/app.plugin.js +3 -0
- package/expo/android/build.gradle +159 -0
- package/expo/android/src/main/AndroidManifest.xml +1 -0
- package/expo/android/src/main/java/com/bundledrop/expo/BundleDropExpoConfiguration.kt +35 -0
- package/expo/android/src/main/java/com/bundledrop/expo/BundleDropExpoIdentityModule.kt +30 -0
- package/expo/android/src/main/java/com/bundledrop/expo/BundleDropExpoPackage.kt +29 -0
- package/expo/android/src/main/java/com/bundledrop/expo/BundleDropExpoReactNativeHostHandler.kt +16 -0
- package/expo/bundle-drop-expo-gradle-plugin/build.gradle +31 -0
- package/expo/bundle-drop-expo-gradle-plugin/src/main/groovy/com/bundledrop/gradle/BundleDropExpoPlugin.groovy +83 -0
- package/expo/bundle-drop-expo-gradle-plugin/src/main/groovy/com/bundledrop/gradle/GenerateBundleDropBuildIdentityTask.groovy +57 -0
- package/expo/ios/Sources/BundleDropExpoIdentity.m +31 -0
- package/expo/ios/Sources/BundleDropExpoReactDelegateHandler.swift +24 -0
- package/expo-module.config.json +19 -0
- package/ios/BundleDropLocator.swift +7 -1
- package/lib/CLI/cli.d.ts +1 -2
- package/lib/CLI/cli.js +116 -14
- package/lib/CLI/scripts/aipowered/apply-setup-plan.d.ts +12 -0
- package/lib/CLI/scripts/aipowered/apply-setup-plan.js +55 -0
- package/lib/CLI/scripts/aipowered/backend-client.d.ts +6 -1
- package/lib/CLI/scripts/aipowered/backend-client.js +25 -2
- package/lib/CLI/scripts/aipowered/init-project-config.d.ts +17 -0
- package/lib/CLI/scripts/aipowered/init-project-config.js +400 -0
- package/lib/CLI/scripts/aipowered/scanner.d.ts +10 -1
- package/lib/CLI/scripts/aipowered/scanner.js +252 -5
- package/lib/CLI/scripts/aipowered/types.d.ts +39 -0
- package/lib/CLI/scripts/aipowered/validate-plan.d.ts +12 -0
- package/lib/CLI/scripts/aipowered/validate-plan.js +76 -1
- package/lib/CLI/scripts/doctor.d.ts +17 -0
- package/lib/CLI/scripts/doctor.js +412 -0
- package/lib/CLI/scripts/expo/build-receipt.d.ts +26 -0
- package/lib/CLI/scripts/expo/build-receipt.js +223 -0
- package/lib/CLI/scripts/expo/configure-expo.d.ts +28 -0
- package/lib/CLI/scripts/expo/configure-expo.js +268 -0
- package/lib/CLI/scripts/expo/eas-build-proof.d.ts +22 -0
- package/lib/CLI/scripts/expo/eas-build-proof.js +116 -0
- package/lib/CLI/scripts/expo/package-manager.d.ts +11 -0
- package/lib/CLI/scripts/expo/package-manager.js +84 -0
- package/lib/CLI/scripts/expo/write-build-receipt.d.ts +25 -0
- package/lib/CLI/scripts/expo/write-build-receipt.js +325 -0
- package/lib/CLI/scripts/expo/write-eas-build-receipt.d.ts +8 -0
- package/lib/CLI/scripts/expo/write-eas-build-receipt.js +71 -0
- package/lib/CLI/scripts/init-config.d.ts +18 -1
- package/lib/CLI/scripts/init-config.js +29 -8
- package/lib/CLI/scripts/init-metro-config.d.ts +7 -0
- package/lib/CLI/scripts/init-metro-config.js +28 -8
- package/lib/CLI/scripts/login-cli.js +17 -3
- package/lib/CLI/scripts/post-init.d.ts +6 -1
- package/lib/CLI/scripts/post-init.js +6 -33
- package/lib/CLI/scripts/upload-cli.d.ts +1 -0
- package/lib/CLI/scripts/upload-cli.js +106 -36
- package/lib/context.d.ts +0 -2
- package/lib/context.js +18 -2
- package/lib/expo/buildIdentity.d.ts +15 -0
- package/lib/expo/buildIdentity.js +201 -0
- package/lib/expo/buildReceipt.d.ts +42 -0
- package/lib/expo/buildReceipt.js +272 -0
- package/lib/expo/config.d.ts +7 -0
- package/lib/expo/config.js +43 -0
- package/lib/expo/configCache.d.ts +1 -0
- package/lib/expo/configCache.js +20 -0
- package/lib/expo/errors.d.ts +6 -0
- package/lib/expo/errors.js +11 -0
- package/lib/expo/expoUpdatesOwnership.d.ts +13 -0
- package/lib/expo/expoUpdatesOwnership.js +22 -0
- package/lib/expo/exportExpoProject.d.ts +21 -0
- package/lib/expo/exportExpoProject.js +125 -0
- package/lib/expo/exportValidation.d.ts +11 -0
- package/lib/expo/exportValidation.js +115 -0
- package/lib/expo/index.d.ts +18 -0
- package/lib/expo/index.js +25 -0
- package/lib/expo/localModules.d.ts +4 -0
- package/lib/expo/localModules.js +51 -0
- package/lib/expo/nativeIdentity.d.ts +1 -0
- package/lib/expo/nativeIdentity.js +17 -0
- package/lib/expo/projectType.d.ts +7 -0
- package/lib/expo/projectType.js +200 -0
- package/lib/expo/runtimeVersion.d.ts +13 -0
- package/lib/expo/runtimeVersion.js +45 -0
- package/lib/expo/types.d.ts +15 -0
- package/lib/expo/types.js +2 -0
- package/lib/fs/userProperties.d.ts +0 -2
- package/lib/fs/userProperties.js +0 -3
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -2
- package/lib/loadConfig.d.ts +15 -7
- package/lib/loadConfig.js +2 -19
- package/lib/metro.d.ts +17 -0
- package/lib/metro.js +57 -0
- package/lib/native/bundleDropNative.d.ts +2 -0
- package/lib/native/bundleDropNative.js +9 -1
- package/lib/runtime/service.js +12 -1
- package/lib/scripts/bundle.d.ts +2 -2
- package/lib/scripts/bundle.js +10 -97
- package/lib/scripts/canonicalArtifact.d.ts +30 -0
- package/lib/scripts/canonicalArtifact.js +212 -0
- package/lib/scripts/exportProject.d.ts +41 -0
- package/lib/scripts/exportProject.js +82 -0
- package/package.json +51 -46
- package/plugin/constants.js +9 -0
- package/plugin/expoUpdates.js +131 -0
- package/plugin/index.js +11 -0
- package/plugin/markers.js +31 -0
- package/plugin/withBundleDrop.js +36 -0
- package/plugin/xcodeBuildPhase.js +77 -0
- package/react-native.config.js +20 -0
package/lib/CLI/cli.js
CHANGED
|
@@ -90,6 +90,8 @@ ${chalk_1.default.bold.cyan('Available Commands:')}
|
|
|
90
90
|
${chalk_1.default.bold.cyan('Common Usage:')}
|
|
91
91
|
${chalk_1.default.gray('bundle-drop login')}
|
|
92
92
|
${chalk_1.default.gray('bundle-drop init')}
|
|
93
|
+
${chalk_1.default.gray('bundle-drop doctor')}
|
|
94
|
+
${chalk_1.default.gray('bundle-drop doctor --project-type bare --platform android')}
|
|
93
95
|
${chalk_1.default.gray('bundle-drop upload android --version 1.2.3 --channel develop')}
|
|
94
96
|
${chalk_1.default.gray('bundle-drop upload ios --plist-file ios/Info.plist --channel develop')}
|
|
95
97
|
${chalk_1.default.gray('bundle-drop upload android --buildgradle-path android/app/build.gradle --channel develop --release-notes "Fixes"')}
|
|
@@ -98,8 +100,7 @@ ${chalk_1.default.gray('Docs →')} ${chalk_1.default.underline.gray(DOCS_CLI_UR
|
|
|
98
100
|
${chalk_1.default.gray('Uploading →')} ${chalk_1.default.underline.gray(DOCS_UPLOADING_URL)}
|
|
99
101
|
${chalk_1.default.gray('CI/CD →')} ${chalk_1.default.underline.gray(DOCS_CI_CD_URL)}\n`);
|
|
100
102
|
program
|
|
101
|
-
.command('upload')
|
|
102
|
-
.argument('<platform>', chalk_1.default.gray('ios or android'))
|
|
103
|
+
.command('upload <platform>')
|
|
103
104
|
.option('--plist-file <path>', 'Path to Info.plist for iOS')
|
|
104
105
|
.option('--version <version>', 'App version. iOS will fallback to --plist-file; Android can fallback to build.gradle when provided.')
|
|
105
106
|
.option('--buildgradle-path <path>', 'Optional Android build.gradle path to read versionName')
|
|
@@ -109,6 +110,7 @@ ${chalk_1.default.gray('CI/CD →')} ${chalk_1.default.underline.gray(DOCS_CI_CD
|
|
|
109
110
|
.option('--author <name>', 'Override the author name stored with the bundle')
|
|
110
111
|
.option('--sourcemap', 'Generate source maps alongside the bundle for error tracking')
|
|
111
112
|
.option('--artifact-dir <path>', 'Copy bundle, source map, and result JSON to this directory before cleanup')
|
|
113
|
+
.option('--build-receipt <path>', 'Exact local/EAS Expo build identity receipt')
|
|
112
114
|
.description(chalk_1.default.whiteBright('Bundle and upload an OTA zip to the server'))
|
|
113
115
|
.addHelpText('after', `
|
|
114
116
|
${chalk_1.default.bold('Examples:')}
|
|
@@ -138,23 +140,57 @@ ${chalk_1.default.gray('CI/CD docs →')} ${chalk_1.default.underline.gray(DOCS_
|
|
|
138
140
|
program
|
|
139
141
|
.command('login')
|
|
140
142
|
.description('Log in to the CLI')
|
|
141
|
-
.action(() =>
|
|
142
|
-
require('../CLI/scripts/login-cli').default();
|
|
143
|
-
});
|
|
143
|
+
.action(() => require('../CLI/scripts/login-cli').default());
|
|
144
144
|
program
|
|
145
145
|
.command('init')
|
|
146
146
|
.option('--token <token>', 'Personal Access Token (alternative to `bundle-drop login`)')
|
|
147
|
-
.
|
|
147
|
+
.option('--project-type <type>', 'Force project type: expo or bare')
|
|
148
|
+
.option('--dry-run', 'Preview setup and AI context without changing files')
|
|
149
|
+
.option('--migrate-expo-updates', 'Explicitly remove active expo-updates configuration and dependency')
|
|
150
|
+
.option('--prebuild', 'Run a layered Expo prebuild for committed native directories')
|
|
151
|
+
.option('--yes', 'Approve ordinary setup changes noninteractively')
|
|
152
|
+
.description('Configure Bundle Drop for Expo or bare React Native')
|
|
148
153
|
.action(async (options) => {
|
|
154
|
+
if (options.projectType && !['expo', 'bare'].includes(options.projectType)) {
|
|
155
|
+
throw new Error('--project-type must be expo or bare.');
|
|
156
|
+
}
|
|
149
157
|
if (options.token) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
158
|
+
const { detectProjectType } = require('../expo');
|
|
159
|
+
const projectType = detectProjectType({
|
|
160
|
+
projectRoot: process.cwd(),
|
|
161
|
+
explicitType: options.projectType,
|
|
162
|
+
});
|
|
163
|
+
const serverUrl = normalizeServerUrl(process.env.BUNDLE_DROP_SERVER_URL);
|
|
164
|
+
const tokenContext = await fetchFreshAuthContext({
|
|
165
|
+
serverUrl,
|
|
166
|
+
token: options.token,
|
|
167
|
+
});
|
|
168
|
+
const initConfigModule = require('../CLI/scripts/init-config');
|
|
169
|
+
const hadConfig = initConfigModule.hasExistingBundleDropConfig();
|
|
170
|
+
const configResult = await initConfigModule.initConfig({
|
|
171
|
+
serverUrl,
|
|
172
|
+
projects: tokenContext?.projects || [],
|
|
173
|
+
organizations: tokenContext?.organizations || [],
|
|
154
174
|
downloadApiKey: '',
|
|
155
175
|
authToken: options.token,
|
|
176
|
+
dryRun: true,
|
|
177
|
+
projectType,
|
|
178
|
+
});
|
|
179
|
+
await (0, post_init_1.runPostInitPrompts)({
|
|
180
|
+
...options,
|
|
181
|
+
projectType,
|
|
182
|
+
...(!hadConfig && configResult
|
|
183
|
+
? {
|
|
184
|
+
virtualConfig: {
|
|
185
|
+
content: configResult.content,
|
|
186
|
+
serverUrl: configResult.serverUrl,
|
|
187
|
+
orgSlug: configResult.orgSlug,
|
|
188
|
+
projectSlug: configResult.projectSlug,
|
|
189
|
+
authToken: options.token,
|
|
190
|
+
},
|
|
191
|
+
}
|
|
192
|
+
: {}),
|
|
156
193
|
});
|
|
157
|
-
await (0, post_init_1.runPostInitPrompts)();
|
|
158
194
|
return;
|
|
159
195
|
}
|
|
160
196
|
const authState = readStoredAuthData();
|
|
@@ -173,6 +209,11 @@ ${chalk_1.default.gray('CI/CD docs →')} ${chalk_1.default.underline.gray(DOCS_
|
|
|
173
209
|
logInvalidAuthFile();
|
|
174
210
|
return;
|
|
175
211
|
}
|
|
212
|
+
const { detectProjectType } = require('../expo');
|
|
213
|
+
const projectType = detectProjectType({
|
|
214
|
+
projectRoot: process.cwd(),
|
|
215
|
+
explicitType: options.projectType,
|
|
216
|
+
});
|
|
176
217
|
const serverUrl = normalizeServerUrl(data.serverUrl || data.baseUrl || process.env.BUNDLE_DROP_SERVER_URL);
|
|
177
218
|
const freshContext = await fetchFreshAuthContext({
|
|
178
219
|
serverUrl,
|
|
@@ -182,19 +223,42 @@ ${chalk_1.default.gray('CI/CD docs →')} ${chalk_1.default.underline.gray(DOCS_
|
|
|
182
223
|
if (freshContext) {
|
|
183
224
|
writeStoredAuthData(authState.tokenPath, initData);
|
|
184
225
|
}
|
|
185
|
-
|
|
226
|
+
const initConfigModule = require('../CLI/scripts/init-config');
|
|
227
|
+
const hadConfig = initConfigModule.hasExistingBundleDropConfig();
|
|
228
|
+
const configResult = await initConfigModule.initConfig({
|
|
186
229
|
serverUrl,
|
|
187
230
|
projects: initData.projects || [],
|
|
188
231
|
organizations: initData.organizations || [],
|
|
189
232
|
downloadApiKey: data.downloadApiKey || '',
|
|
190
233
|
authToken: data.token,
|
|
234
|
+
dryRun: true,
|
|
235
|
+
projectType,
|
|
236
|
+
});
|
|
237
|
+
await (0, post_init_1.runPostInitPrompts)({
|
|
238
|
+
...options,
|
|
239
|
+
projectType,
|
|
240
|
+
...(!hadConfig && configResult
|
|
241
|
+
? {
|
|
242
|
+
virtualConfig: {
|
|
243
|
+
content: configResult.content,
|
|
244
|
+
serverUrl: configResult.serverUrl,
|
|
245
|
+
orgSlug: configResult.orgSlug,
|
|
246
|
+
projectSlug: configResult.projectSlug,
|
|
247
|
+
authToken: data.token,
|
|
248
|
+
},
|
|
249
|
+
}
|
|
250
|
+
: {}),
|
|
191
251
|
});
|
|
192
|
-
await (0, post_init_1.runPostInitPrompts)();
|
|
193
252
|
});
|
|
194
253
|
program
|
|
195
254
|
.command('init-native')
|
|
196
|
-
.description('
|
|
255
|
+
.description('Deprecated bare-only native setup escape hatch; use bundle-drop init')
|
|
197
256
|
.action(async () => {
|
|
257
|
+
const { detectProjectType } = require('../expo');
|
|
258
|
+
if (detectProjectType({ projectRoot: process.cwd() }) === 'expo') {
|
|
259
|
+
throw new Error('init-native is bare-only. Run `bundle-drop init` for Expo projects.');
|
|
260
|
+
}
|
|
261
|
+
console.log(chalk_1.default.yellow('init-native is deprecated; use `bundle-drop init --project-type bare`.'));
|
|
198
262
|
await require('../CLI/scripts/aipowered/init-native-config').initNativeConfigAi();
|
|
199
263
|
});
|
|
200
264
|
program
|
|
@@ -203,6 +267,44 @@ ${chalk_1.default.gray('CI/CD docs →')} ${chalk_1.default.underline.gray(DOCS_
|
|
|
203
267
|
.action(() => {
|
|
204
268
|
require('../CLI/scripts/init-metro-config').initMetroConfig();
|
|
205
269
|
});
|
|
270
|
+
program
|
|
271
|
+
.command('doctor')
|
|
272
|
+
.option('--platform <platform>', 'Limit checks to ios or android')
|
|
273
|
+
.option('--project-type <type>', 'Force project type: expo or bare')
|
|
274
|
+
.description('Validate Bundle Drop setup, runtime identity, and OTA startup ownership')
|
|
275
|
+
.addHelpText('after', `
|
|
276
|
+
${chalk_1.default.bold('Examples:')}
|
|
277
|
+
${chalk_1.default.gray('bundle-drop doctor')}
|
|
278
|
+
${chalk_1.default.gray('bundle-drop doctor --platform ios')}
|
|
279
|
+
${chalk_1.default.gray('bundle-drop doctor --project-type bare --platform android')}
|
|
280
|
+
`)
|
|
281
|
+
.action(async (options) => {
|
|
282
|
+
if (options.platform && !['ios', 'android'].includes(options.platform)) {
|
|
283
|
+
throw new Error('--platform must be ios or android.');
|
|
284
|
+
}
|
|
285
|
+
if (options.projectType && !['expo', 'bare'].includes(options.projectType)) {
|
|
286
|
+
throw new Error('--project-type must be expo or bare.');
|
|
287
|
+
}
|
|
288
|
+
await require('./scripts/doctor').runDoctor(options);
|
|
289
|
+
});
|
|
290
|
+
program
|
|
291
|
+
.command('eas-receipt <platform>')
|
|
292
|
+
.requiredOption('--build-id <id>', 'Exact finished EAS application build ID')
|
|
293
|
+
.option('--output <path>', 'Receipt path; defaults under .bundle-drop')
|
|
294
|
+
.description('Create an authenticated Expo build receipt from official EAS metadata')
|
|
295
|
+
.action(async (platform, options) => {
|
|
296
|
+
if (platform !== 'ios' && platform !== 'android') {
|
|
297
|
+
throw new Error('eas-receipt platform must be ios or android.');
|
|
298
|
+
}
|
|
299
|
+
const receiptPath = await require('./scripts/expo/write-eas-build-receipt')
|
|
300
|
+
.writeEasBuildReceipt({
|
|
301
|
+
projectRoot: process.cwd(),
|
|
302
|
+
platform,
|
|
303
|
+
easBuildId: options.buildId,
|
|
304
|
+
outputPath: options.output,
|
|
305
|
+
});
|
|
306
|
+
console.log(chalk_1.default.green(`EAS build receipt written to ${receiptPath}`));
|
|
307
|
+
});
|
|
206
308
|
program
|
|
207
309
|
.command('whoami')
|
|
208
310
|
.description('Show currently logged in user')
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AiPatchPlan, AiSetupProjectType } from './types';
|
|
2
|
+
export type SetupApplyResult = {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
backupDir: string;
|
|
5
|
+
changedFiles: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare function restoreSetupBackups(result: SetupApplyResult): void;
|
|
8
|
+
export declare function applySetupPatchPlans(params: {
|
|
9
|
+
projectRoot: string;
|
|
10
|
+
projectType: AiSetupProjectType;
|
|
11
|
+
changes: AiPatchPlan[];
|
|
12
|
+
}): SetupApplyResult;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.restoreSetupBackups = restoreSetupBackups;
|
|
7
|
+
exports.applySetupPatchPlans = applySetupPatchPlans;
|
|
8
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
9
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const validate_plan_1 = require("./validate-plan");
|
|
12
|
+
const sha256 = (content) => crypto_1.default.createHash('sha256').update(content).digest('hex');
|
|
13
|
+
const timestamp = () => new Date().toISOString().replace(/[:.]/g, '-');
|
|
14
|
+
const isAllowedSetupFile = (projectType, filePath) => projectType === 'expo'
|
|
15
|
+
? (0, validate_plan_1.isPatchableExpoConfig)(filePath)
|
|
16
|
+
: (0, validate_plan_1.isPatchableNativeEntrypoint)(filePath);
|
|
17
|
+
function restoreSetupBackups(result) {
|
|
18
|
+
for (const relativePath of result.changedFiles) {
|
|
19
|
+
const backupPath = path_1.default.join(result.backupDir, relativePath);
|
|
20
|
+
if (fs_extra_1.default.existsSync(backupPath)) {
|
|
21
|
+
fs_extra_1.default.copyFileSync(backupPath, path_1.default.join(result.projectRoot, relativePath));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function applySetupPatchPlans(params) {
|
|
26
|
+
const result = {
|
|
27
|
+
projectRoot: params.projectRoot,
|
|
28
|
+
backupDir: path_1.default.join(params.projectRoot, '.bundledrop-backup', timestamp()),
|
|
29
|
+
changedFiles: [],
|
|
30
|
+
};
|
|
31
|
+
try {
|
|
32
|
+
for (const change of params.changes) {
|
|
33
|
+
if (!(0, validate_plan_1.isSafeRelativePath)(change.file) || !isAllowedSetupFile(params.projectType, change.file)) {
|
|
34
|
+
throw new Error(`Refusing to write AI setup plan outside its allowlist: ${change.file}`);
|
|
35
|
+
}
|
|
36
|
+
const targetPath = path_1.default.join(params.projectRoot, change.file);
|
|
37
|
+
const original = fs_extra_1.default.readFileSync(targetPath, 'utf8');
|
|
38
|
+
if (sha256(original) !== change.originalSha256) {
|
|
39
|
+
throw new Error(`File changed since AI setup scan: ${change.file}`);
|
|
40
|
+
}
|
|
41
|
+
const backupPath = path_1.default.join(result.backupDir, change.file);
|
|
42
|
+
fs_extra_1.default.ensureDirSync(path_1.default.dirname(backupPath));
|
|
43
|
+
fs_extra_1.default.copyFileSync(targetPath, backupPath);
|
|
44
|
+
result.changedFiles.push(change.file);
|
|
45
|
+
const temporaryPath = `${targetPath}.bundledrop-tmp`;
|
|
46
|
+
fs_extra_1.default.writeFileSync(temporaryPath, change.updated, 'utf8');
|
|
47
|
+
fs_extra_1.default.renameSync(temporaryPath, targetPath);
|
|
48
|
+
}
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
restoreSetupBackups(result);
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { AiInitPlanRequest, AiInitPlanResponse } from './types';
|
|
1
|
+
import { AiInitPlanRequest, AiInitPlanResponse, AiSetupPlanRequest, AiSetupPlanResponse } from './types';
|
|
2
2
|
export declare function requestAiInitPlan(params: {
|
|
3
3
|
serverUrl: string;
|
|
4
4
|
authToken: string;
|
|
5
5
|
request: AiInitPlanRequest;
|
|
6
6
|
}): Promise<AiInitPlanResponse>;
|
|
7
|
+
export declare function requestAiSetupPlan(params: {
|
|
8
|
+
serverUrl: string;
|
|
9
|
+
authToken: string;
|
|
10
|
+
request: AiSetupPlanRequest;
|
|
11
|
+
}): Promise<AiSetupPlanResponse>;
|
|
@@ -4,10 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.requestAiInitPlan = requestAiInitPlan;
|
|
7
|
+
exports.requestAiSetupPlan = requestAiSetupPlan;
|
|
7
8
|
const axios_1 = __importDefault(require("axios"));
|
|
8
9
|
const DEFAULT_AI_INIT_TIMEOUT_MS = 180000;
|
|
9
10
|
const resolveTimeoutMs = () => {
|
|
10
|
-
const value = Number(process.env.BUNDLE_DROP_AI_INIT_TIMEOUT_MS ||
|
|
11
|
+
const value = Number(process.env.BUNDLE_DROP_AI_INIT_TIMEOUT_MS || '');
|
|
11
12
|
return Number.isFinite(value) && value > 0 ? value : DEFAULT_AI_INIT_TIMEOUT_MS;
|
|
12
13
|
};
|
|
13
14
|
async function requestAiInitPlan(params) {
|
|
@@ -24,7 +25,7 @@ async function requestAiInitPlan(params) {
|
|
|
24
25
|
catch (error) {
|
|
25
26
|
const raw = error?.response?.data;
|
|
26
27
|
if (error?.code === 'ECONNABORTED' || /timeout/i.test(String(error?.message || ''))) {
|
|
27
|
-
throw new Error('AI planning request timed out.
|
|
28
|
+
throw new Error('AI planning request timed out. Try again, or set BUNDLE_DROP_AI_INIT_TIMEOUT_MS to a larger value.');
|
|
28
29
|
}
|
|
29
30
|
const message = raw && typeof raw === 'object'
|
|
30
31
|
? raw.error || JSON.stringify(raw)
|
|
@@ -32,3 +33,25 @@ async function requestAiInitPlan(params) {
|
|
|
32
33
|
throw new Error(`AI planning request failed: ${message}`);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
36
|
+
async function requestAiSetupPlan(params) {
|
|
37
|
+
try {
|
|
38
|
+
const response = await axios_1.default.post(`${params.serverUrl}/ai/setup-plan`, params.request, {
|
|
39
|
+
headers: {
|
|
40
|
+
Accept: 'application/json',
|
|
41
|
+
Authorization: `Bearer ${params.authToken}`,
|
|
42
|
+
},
|
|
43
|
+
timeout: resolveTimeoutMs(),
|
|
44
|
+
});
|
|
45
|
+
return response.data;
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
const raw = error?.response?.data;
|
|
49
|
+
if (error?.code === 'ECONNABORTED' || /timeout/i.test(String(error?.message || ''))) {
|
|
50
|
+
throw new Error('AI setup planning timed out. Try again, or increase BUNDLE_DROP_AI_INIT_TIMEOUT_MS.');
|
|
51
|
+
}
|
|
52
|
+
const message = raw && typeof raw === 'object'
|
|
53
|
+
? raw.error || JSON.stringify(raw)
|
|
54
|
+
: raw || error?.message || 'AI setup planning failed';
|
|
55
|
+
throw new Error(`AI setup planning failed: ${message}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ProjectType } from '../../../expo';
|
|
2
|
+
export type InitProjectOptions = {
|
|
3
|
+
projectType?: ProjectType;
|
|
4
|
+
dryRun?: boolean;
|
|
5
|
+
migrateExpoUpdates?: boolean;
|
|
6
|
+
prebuild?: boolean;
|
|
7
|
+
yes?: boolean;
|
|
8
|
+
virtualConfig?: {
|
|
9
|
+
content: string;
|
|
10
|
+
serverUrl: string;
|
|
11
|
+
orgSlug: string;
|
|
12
|
+
projectSlug: string;
|
|
13
|
+
authToken: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare function initProjectConfigAi(options?: InitProjectOptions): Promise<void>;
|
|
17
|
+
export default initProjectConfigAi;
|