-
Notifications
You must be signed in to change notification settings - Fork 4
Feat/aab #18
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/aab #18
Changes from all commits
6b68f46
8e4b9c4
22ccd73
00e5446
e492c5e
6e0f50e
1503b5a
9e584fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,25 @@ | ||
| import { get, getAllPackages, post, uploadFile, doDelete } from './api'; | ||
| import { question, saveToLocal } from './utils'; | ||
| import { t } from './utils/i18n'; | ||
|
|
||
| import { getPlatform, getSelectedApp } from './app'; | ||
|
|
||
| import os from 'os'; | ||
| import path from 'path'; | ||
| import fs from 'fs-extra'; | ||
| import Table from 'tty-table'; | ||
| import { doDelete, getAllPackages, post, uploadFile } from './api'; | ||
| import { getPlatform, getSelectedApp } from './app'; | ||
| import type { Platform } from './types'; | ||
| import { getApkInfo, getAppInfo, getIpaInfo, getAabInfo } from './utils'; | ||
| import { | ||
| getAabInfo, | ||
| getApkInfo, | ||
| getAppInfo, | ||
| getIpaInfo, | ||
| question, | ||
| saveToLocal, | ||
| } from './utils'; | ||
| import { AabParser } from './utils/app-info-parser/aab'; | ||
| import { depVersions } from './utils/dep-versions'; | ||
| import { getCommitInfo } from './utils/git'; | ||
| import { t } from './utils/i18n'; | ||
|
|
||
| export async function listPackage(appId: string) { | ||
| const allPkgs = await getAllPackages(appId); | ||
| const allPkgs = (await getAllPackages(appId)) || []; | ||
|
|
||
| const header = [ | ||
| { value: t('nativePackageId') }, | ||
|
|
@@ -49,7 +57,7 @@ export async function choosePackage(appId: string) { | |
|
|
||
| while (true) { | ||
| const id = await question(t('enterNativePackageId')); | ||
| const app = list.find((v) => v.id.toString() === id); | ||
| const app = list?.find((v) => v.id.toString() === id); | ||
| if (app) { | ||
| return app; | ||
| } | ||
|
|
@@ -143,6 +151,48 @@ export const packageCommands = { | |
| saveToLocal(fn, `${appId}/package/${id}.apk`); | ||
| console.log(t('apkUploadSuccess', { id, version: versionName, buildTime })); | ||
| }, | ||
| uploadAab: async ({ | ||
| args, | ||
| options, | ||
| }: { | ||
| args: string[]; | ||
| options: Record<string, any>; | ||
| }) => { | ||
| const source = args[0]; | ||
| if (!source || !source.endsWith('.aab')) { | ||
| throw new Error(t('usageUploadAab')); | ||
| } | ||
|
|
||
| const output = path.join( | ||
| os.tmpdir(), | ||
| `${path.basename(source, path.extname(source))}-${Date.now()}.apk`, | ||
| ); | ||
|
|
||
| const includeAllSplits = | ||
| options.includeAllSplits === true || options.includeAllSplits === 'true'; | ||
| const splits = options.splits | ||
| ? String(options.splits) | ||
| .split(',') | ||
| .map((item) => item.trim()) | ||
| .filter(Boolean) | ||
| : null; | ||
|
|
||
| const parser = new AabParser(source); | ||
| try { | ||
| await parser.extractApk(output, { | ||
| includeAllSplits, | ||
| splits, | ||
| }); | ||
| await packageCommands.uploadApk({ | ||
| args: [output], | ||
| options, | ||
| }); | ||
| } finally { | ||
| if (await fs.pathExists(output)) { | ||
| await fs.remove(output); | ||
| } | ||
| } | ||
| }, | ||
| uploadApp: async ({ | ||
| args, | ||
| options, | ||
|
|
@@ -214,6 +264,42 @@ export const packageCommands = { | |
| } | ||
| console.log(await getAabInfo(fn)); | ||
| }, | ||
| extractApk: async ({ | ||
| args, | ||
| options, | ||
| }: { | ||
| args: string[]; | ||
| options: Record<string, any>; | ||
| }) => { | ||
| const source = args[0]; | ||
| if (!source || !source.endsWith('.aab')) { | ||
| throw new Error(t('usageExtractApk')); | ||
| } | ||
|
|
||
| const output = | ||
| options.output || | ||
| path.join( | ||
| path.dirname(source), | ||
| `${path.basename(source, path.extname(source))}.apk`, | ||
| ); | ||
|
|
||
| const includeAllSplits = | ||
| options.includeAllSplits === true || options.includeAllSplits === 'true'; | ||
| const splits = options.splits | ||
| ? String(options.splits) | ||
| .split(',') | ||
| .map((item) => item.trim()) | ||
| .filter(Boolean) | ||
| : null; | ||
|
|
||
| const parser = new AabParser(source); | ||
| await parser.extractApk(output, { | ||
| includeAllSplits, | ||
| splits, | ||
| }); | ||
|
|
||
| console.log(t('apkExtracted', { output })); | ||
| }, | ||
|
Comment on lines
+267
to
+302
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check README for bundletool mention
echo "=== Checking README for bundletool ==="
rg -i "bundletool" README.md || echo "No bundletool found in README.md"
# Check for any documentation of extractApk command
echo -e "\n=== Checking for extractApk documentation ==="
rg -i "extractapk|extract-apk" README.md docs/ 2>/dev/null || echo "No extractApk docs found"
# List documentation files
echo -e "\n=== Available documentation files ==="
git ls-files | grep -E "(README|docs/|\.md$)" | head -20Repository: reactnativecn/react-native-update-cli Length of output: 511 🏁 Script executed: #!/bin/bash
# Find and examine the AabParser class to understand bundletool usage
echo "=== Finding AabParser implementation ==="
fd -t f "AabParser" --type f
# Search for AabParser in the codebase
echo -e "\n=== Searching for AabParser class definition ==="
rg "class AabParser|export.*AabParser" -A 5
# Search for extractApk method in AabParser
echo -e "\n=== Searching for extractApk method ==="
rg "extractApk" -B 2 -A 10Repository: reactnativecn/react-native-update-cli Length of output: 5520 🏁 Script executed: #!/bin/bash
# Check how bundletool is invoked
echo "=== Checking for bundletool invocations ==="
rg "bundletool|node-bundletool" -A 3 -B 3
# Check for error messages related to bundletool or missing dependencies
echo -e "\n=== Checking for dependency error messages ==="
rg -i "bundletool.*not.*found|bundletool.*install|bundletool.*require" -A 2Repository: reactnativecn/react-native-update-cli Length of output: 1580 🏁 Script executed: #!/bin/bash
# Get the full AabParser.extractApk method
cat -n src/utils/app-info-parser/aab.ts | sed -n '1,200p'Repository: reactnativecn/react-native-update-cli Length of output: 6837 🏁 Script executed: #!/bin/bash
# Find the exact line numbers for extractApk method
rg -n "async extractApk" src/utils/app-info-parser/aab.ts
# Then read the full method
wc -l src/utils/app-info-parser/aab.tsRepository: reactnativecn/react-native-update-cli Length of output: 140 🏁 Script executed: #!/bin/bash
# Check the localization strings for bundletool/dependency error messages
echo "=== English error messages ==="
rg "aabOpenApksFailed|aabReadUniversalApkFailed|aabUniversalApkNotFound" src/locales/en.ts -A 1
echo -e "\n=== Chinese error messages ==="
rg "aabOpenApksFailed|aabReadUniversalApkFailed|aabUniversalApkNotFound" src/locales/zh.ts -A 1
# Check if there are any other error message keys for bundletool
echo -e "\n=== All aab-related error messages ==="
rg "aab[A-Z]" src/locales/en.ts | grep -E ":\s*['\"]"Repository: reactnativecn/react-native-update-cli Length of output: 1094 🏁 Script executed: #!/bin/bash
# Check if there's any documentation about bundletool in package.json or setup guides
echo "=== Checking package.json for bundletool reference ==="
rg "bundletool" package.json
# Check if there's a setup guide or install guide
echo -e "\n=== Looking for setup/install documentation ==="
fd -t f -e md | xargs grep -l -i "install\|setup\|depend" 2>/dev/null | head -10
# Check cli.json for extractApk full definition
echo -e "\n=== Checking cli.json extractApk definition ==="
rg -A 10 '"extractApk"' cli.jsonRepository: reactnativecn/react-native-update-cli Length of output: 499 Document bundletool dependency and improve error messages for missing binary. The Add bundletool to the README installation/dependencies section, and improve the error handling in 🤖 Prompt for AI Agents |
||
| packages: async ({ options }: { options: { platform: Platform } }) => { | ||
| const platform = await getPlatform(options.platform); | ||
| const { appId } = await getSelectedApp(platform); | ||
|
|
@@ -224,7 +310,12 @@ export const packageCommands = { | |
| options, | ||
| }: { | ||
| args: string[]; | ||
| options: { appId?: string; packageId?: string; packageVersion?: string; platform?: Platform }; | ||
| options: { | ||
| appId?: string; | ||
| packageId?: string; | ||
| packageVersion?: string; | ||
| platform?: Platform; | ||
| }; | ||
| }) => { | ||
| let { appId, packageId, packageVersion } = options; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
actions/setup-node v6 release breaking changes💡 Result:
Short summary — breaking changes in actions/setup-node v6:
Automatic caching behavior narrowed: automatic cache is now enabled only for npm projects when package.json sets packageManager (or devEngines.packageManager); Yarn and pnpm caching is disabled by default and must be opted into via the cache input. [1][2]
The always-auth input was removed (deprecated; handling was removed in v6/v6.1.x). Remove any references to always-auth in your workflows. [1][2]
Sources:
[1] actions/setup-node README — “Breaking changes in V6”.
[2] actions/setup-node GitHub releases (v6.0.0 / v6.1.0 release notes).
Verify workflow compatibility with setup-node v6 breaking changes.
The upgrade to
actions/setup-node@v6introduces breaking changes:packageManager(ordevEngines.packageManager) specified inpackage.json. Yarn and pnpm caching are disabled by default and must be explicitly opted into via thecacheinput.Check the workflow and
package.jsonto confirm caching behavior is still correct and thatalways-authis not used.🤖 Prompt for AI Agents