mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-11-23 00:36:11 +08:00
Compare commits
54 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c633af549d | ||
|
|
78159f362b | ||
|
|
b76440d018 | ||
|
|
e3c951bc1b | ||
|
|
f6ed8872bd | ||
|
|
fd46bafb98 | ||
|
|
917f99f2ab | ||
|
|
ac13464d4d | ||
|
|
f82bab887a | ||
|
|
07ff19fbe5 | ||
|
|
a4467717bc | ||
|
|
cd890347d1 | ||
|
|
e6de3eeef3 | ||
|
|
7e7e555450 | ||
|
|
e98bcf504f | ||
|
|
4cb5f7fa4e | ||
|
|
13ab10f53f | ||
|
|
6db237fc8c | ||
|
|
bd7d78e7ac | ||
|
|
91a602979d | ||
|
|
2cfe451db5 | ||
|
|
c7d0aadbf2 | ||
|
|
2e37d6f1c7 | ||
|
|
6e7d5de82e | ||
|
|
3266f09644 | ||
|
|
848f528625 | ||
|
|
18d772b1bc | ||
|
|
bf0cea66b9 | ||
|
|
8c31ee5762 | ||
|
|
002e8662d6 | ||
|
|
ebfb9dd4b9 | ||
|
|
59c5be2719 | ||
|
|
2e8e242e75 | ||
|
|
0cfb1a9beb | ||
|
|
b22c598ca4 | ||
|
|
573ab60e44 | ||
|
|
4613da1fbe | ||
|
|
f2f33a190d | ||
|
|
cc6c1aae79 | ||
|
|
91b26ebc87 | ||
|
|
9cb8d458ad | ||
|
|
d853918d8d | ||
|
|
c4a34490e3 | ||
|
|
e2737a29eb | ||
|
|
9b55610675 | ||
|
|
5d1466ddec | ||
|
|
081d54ba63 | ||
|
|
4326c08d79 | ||
|
|
20010a9ea6 | ||
|
|
36220a48aa | ||
|
|
d281d72737 | ||
|
|
d351243ab7 | ||
|
|
fbdacfffd2 | ||
|
|
b725d2b08e |
49
.github/workflows/claude.yml
vendored
Normal file
49
.github/workflows/claude.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
name: Claude PR Assistant
|
||||||
|
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
pull_request_review_comment:
|
||||||
|
types: [created]
|
||||||
|
issues:
|
||||||
|
types: [opened, assigned]
|
||||||
|
pull_request_review:
|
||||||
|
types: [submitted]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
claude-code-action:
|
||||||
|
if: |
|
||||||
|
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
|
||||||
|
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
|
||||||
|
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
|
||||||
|
(github.event_name == 'issues' && contains(github.event.issue.body, '@claude'))
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: read
|
||||||
|
issues: read
|
||||||
|
id-token: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Run Claude PR Action
|
||||||
|
uses: anthropics/claude-code-action@beta
|
||||||
|
with:
|
||||||
|
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||||
|
# Or use OAuth token instead:
|
||||||
|
# claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||||
|
timeout_minutes: "60"
|
||||||
|
# Optional: Restrict network access to specific domains only
|
||||||
|
# experimental_allowed_domains: |
|
||||||
|
# .anthropic.com
|
||||||
|
# .github.com
|
||||||
|
# api.github.com
|
||||||
|
# .githubusercontent.com
|
||||||
|
# bun.sh
|
||||||
|
# registry.npmjs.org
|
||||||
|
# .blob.core.windows.net
|
||||||
|
env:
|
||||||
|
ANTHROPIC_BASE_URL: https://anyrouter.top
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -105,3 +105,6 @@ dist
|
|||||||
|
|
||||||
lib/
|
lib/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
# react-native-update
|
||||||
|
.update
|
||||||
|
.pushy
|
||||||
1
.swcrc
1
.swcrc
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"jsc": {
|
"jsc": {
|
||||||
|
"baseUrl": "./src",
|
||||||
"loose": true,
|
"loose": true,
|
||||||
"target": "es2018",
|
"target": "es2018",
|
||||||
"parser": {
|
"parser": {
|
||||||
|
|||||||
604
README.md
604
README.md
@@ -1 +1,603 @@
|
|||||||
# react-native-update-cli
|
# React Native Update CLI
|
||||||
|
|
||||||
|
[中文文档](./README.zh-CN.md) | [Chinese Documentation](./README.zh-CN.md)
|
||||||
|
|
||||||
|
A unified React Native Update CLI that supports both traditional commands and modular architecture with custom publishing workflows.
|
||||||
|
|
||||||
|
## 🚀 Features
|
||||||
|
|
||||||
|
- **Unified CLI**: Single `pushy` command for all functionality
|
||||||
|
- **Backward Compatibility**: All existing commands work as before
|
||||||
|
- **Modular Architecture**: Split CLI functionality into independent modules
|
||||||
|
- **Custom Workflows**: Support for creating custom publishing workflows
|
||||||
|
- **Extensibility**: Users can import and register custom modules
|
||||||
|
- **Type Safety**: Complete TypeScript type support
|
||||||
|
|
||||||
|
## 📦 Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install react-native-update-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🎯 Quick Start
|
||||||
|
|
||||||
|
### Basic Usage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Use unified CLI
|
||||||
|
npx pushy help
|
||||||
|
|
||||||
|
# List all available commands and workflows
|
||||||
|
npx pushy list
|
||||||
|
|
||||||
|
# Execute built-in workflow
|
||||||
|
npx pushy workflow setup-app
|
||||||
|
|
||||||
|
# Execute custom workflow
|
||||||
|
npx pushy workflow custom-publish
|
||||||
|
```
|
||||||
|
|
||||||
|
### Programmatic Usage
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { moduleManager, CLIProviderImpl } from 'react-native-update-cli';
|
||||||
|
|
||||||
|
// Get CLI provider
|
||||||
|
const provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
// Execute bundling
|
||||||
|
const bundleResult = await provider.bundle({
|
||||||
|
platform: 'ios',
|
||||||
|
dev: false,
|
||||||
|
sourcemap: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Publish version
|
||||||
|
const publishResult = await provider.publish({
|
||||||
|
name: 'v1.2.3',
|
||||||
|
description: 'Bug fixes and improvements',
|
||||||
|
rollout: 100,
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🔧 Creating Custom Modules
|
||||||
|
|
||||||
|
### 1. Define Module
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import type {
|
||||||
|
CLIModule,
|
||||||
|
CommandDefinition,
|
||||||
|
CustomWorkflow,
|
||||||
|
} from 'react-native-update-cli';
|
||||||
|
|
||||||
|
export const myCustomModule: CLIModule = {
|
||||||
|
name: 'my-custom',
|
||||||
|
version: '1.0.0',
|
||||||
|
|
||||||
|
commands: [
|
||||||
|
{
|
||||||
|
name: 'custom-command',
|
||||||
|
description: 'My custom command',
|
||||||
|
handler: async (context) => {
|
||||||
|
console.log('Executing custom command...');
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: { message: 'Custom command executed' },
|
||||||
|
};
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
param: { hasValue: true, description: 'Custom parameter' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
workflows: [
|
||||||
|
{
|
||||||
|
name: 'my-workflow',
|
||||||
|
description: 'My custom workflow',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'step1',
|
||||||
|
description: 'First step',
|
||||||
|
execute: async (context, previousResult) => {
|
||||||
|
console.log('Executing step 1...');
|
||||||
|
return { step1Completed: true };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'step2',
|
||||||
|
description: 'Second step',
|
||||||
|
execute: async (context, previousResult) => {
|
||||||
|
console.log('Executing step 2...');
|
||||||
|
return { ...previousResult, step2Completed: true };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
init: (provider) => {
|
||||||
|
console.log('Custom module initialized');
|
||||||
|
},
|
||||||
|
|
||||||
|
cleanup: () => {
|
||||||
|
console.log('Custom module cleanup');
|
||||||
|
},
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Register Module
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { moduleManager } from 'react-native-update-cli';
|
||||||
|
import { myCustomModule } from './my-custom-module';
|
||||||
|
|
||||||
|
// Register custom module
|
||||||
|
moduleManager.registerModule(myCustomModule);
|
||||||
|
|
||||||
|
// Execute custom command
|
||||||
|
const result = await moduleManager.executeCommand('custom-command', {
|
||||||
|
args: [],
|
||||||
|
options: { param: 'value' },
|
||||||
|
});
|
||||||
|
|
||||||
|
// Execute custom workflow
|
||||||
|
const workflowResult = await moduleManager.executeWorkflow('my-workflow', {
|
||||||
|
args: [],
|
||||||
|
options: {},
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🔄 Workflow System
|
||||||
|
|
||||||
|
### Workflow Steps
|
||||||
|
|
||||||
|
Each workflow step contains:
|
||||||
|
|
||||||
|
- `name`: Step name
|
||||||
|
- `description`: Step description
|
||||||
|
- `execute`: Execution function
|
||||||
|
- `condition`: Optional condition function
|
||||||
|
|
||||||
|
### Conditional Execution
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
{
|
||||||
|
name: 'conditional-step',
|
||||||
|
description: 'Only execute in production',
|
||||||
|
execute: async (context, previousResult) => {
|
||||||
|
// Execution logic
|
||||||
|
},
|
||||||
|
condition: (context) => {
|
||||||
|
return context.options.environment === 'production';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Workflow Validation
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
{
|
||||||
|
name: 'validated-workflow',
|
||||||
|
description: 'Workflow with validation',
|
||||||
|
steps: [...],
|
||||||
|
validate: (context) => {
|
||||||
|
if (!context.options.requiredParam) {
|
||||||
|
console.error('Required parameter missing');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📋 Built-in Modules
|
||||||
|
|
||||||
|
### Bundle Module (`bundle`)
|
||||||
|
|
||||||
|
- `bundle`: Bundle JavaScript code and optionally publish
|
||||||
|
- `diff`: Generate differences between two PPK files
|
||||||
|
- `hdiff`: Generate hdiff between two PPK files
|
||||||
|
- `diffFromApk`: Generate differences from APK files
|
||||||
|
- `hdiffFromApk`: Generate hdiff from APK files
|
||||||
|
- `hdiffFromApp`: Generate hdiff from APP files
|
||||||
|
- `diffFromIpa`: Generate differences from IPA files
|
||||||
|
- `hdiffFromIpa`: Generate hdiff from IPA files
|
||||||
|
|
||||||
|
### Version Module (`version`)
|
||||||
|
|
||||||
|
- `publish`: Publish new version
|
||||||
|
- `versions`: List all versions
|
||||||
|
- `update`: Update version information
|
||||||
|
- `updateVersionInfo`: Update version metadata
|
||||||
|
|
||||||
|
### App Module (`app`)
|
||||||
|
|
||||||
|
- `createApp`: Create new application
|
||||||
|
- `apps`: List all applications
|
||||||
|
- `selectApp`: Select application
|
||||||
|
- `deleteApp`: Delete application
|
||||||
|
|
||||||
|
### Package Module (`package`)
|
||||||
|
|
||||||
|
- `uploadIpa`: Upload IPA files (supports `--version` to override extracted version)
|
||||||
|
- `uploadApk`: Upload APK files (supports `--version` to override extracted version)
|
||||||
|
- `uploadApp`: Upload APP files (supports `--version` to override extracted version)
|
||||||
|
- `parseApp`: Parse APP file information
|
||||||
|
- `parseIpa`: Parse IPA file information
|
||||||
|
- `parseApk`: Parse APK file information
|
||||||
|
- `packages`: List packages
|
||||||
|
|
||||||
|
### User Module (`user`)
|
||||||
|
|
||||||
|
- `login`: Login
|
||||||
|
- `logout`: Logout
|
||||||
|
- `me`: Show user information
|
||||||
|
|
||||||
|
## 🛠️ CLI Provider API
|
||||||
|
|
||||||
|
### Core Functionality
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface CLIProvider {
|
||||||
|
// Bundle
|
||||||
|
bundle(options: BundleOptions): Promise<CommandResult>;
|
||||||
|
|
||||||
|
// Publish
|
||||||
|
publish(options: PublishOptions): Promise<CommandResult>;
|
||||||
|
|
||||||
|
// Upload
|
||||||
|
upload(options: UploadOptions): Promise<CommandResult>;
|
||||||
|
|
||||||
|
// Application management
|
||||||
|
getSelectedApp(
|
||||||
|
platform?: Platform,
|
||||||
|
): Promise<{ appId: string; platform: Platform }>;
|
||||||
|
listApps(platform?: Platform): Promise<CommandResult>;
|
||||||
|
createApp(name: string, platform: Platform): Promise<CommandResult>;
|
||||||
|
|
||||||
|
// Version management
|
||||||
|
listVersions(appId: string): Promise<CommandResult>;
|
||||||
|
getVersion(appId: string, versionId: string): Promise<CommandResult>;
|
||||||
|
updateVersion(
|
||||||
|
appId: string,
|
||||||
|
versionId: string,
|
||||||
|
updates: Partial<Version>,
|
||||||
|
): Promise<CommandResult>;
|
||||||
|
|
||||||
|
// Package management
|
||||||
|
listPackages(appId: string, platform?: Platform): Promise<CommandResult>;
|
||||||
|
getPackage(appId: string, packageId: string): Promise<CommandResult>;
|
||||||
|
|
||||||
|
// Utility functions
|
||||||
|
getPlatform(platform?: Platform): Promise<Platform>;
|
||||||
|
loadSession(): Promise<Session>;
|
||||||
|
saveToLocal(key: string, value: string): void;
|
||||||
|
question(prompt: string): Promise<string>;
|
||||||
|
|
||||||
|
// Workflows
|
||||||
|
registerWorkflow(workflow: CustomWorkflow): void;
|
||||||
|
executeWorkflow(
|
||||||
|
workflowName: string,
|
||||||
|
context: CommandContext,
|
||||||
|
): Promise<CommandResult>;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Custom Commands
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Execute custom bundle command
|
||||||
|
const bundleResult = await moduleManager.executeCommand('custom-bundle', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
platform: 'android',
|
||||||
|
validate: true,
|
||||||
|
optimize: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Generate diff file
|
||||||
|
const diffResult = await moduleManager.executeCommand('diff', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
origin: './build/v1.0.0.ppk',
|
||||||
|
next: './build/v1.1.0.ppk',
|
||||||
|
output: './build/diff.patch',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Generate diff from APK files
|
||||||
|
const apkDiffResult = await moduleManager.executeCommand('diffFromApk', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
origin: './build/app-v1.0.0.apk',
|
||||||
|
next: './build/app-v1.1.0.apk',
|
||||||
|
output: './build/apk-diff.patch',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🔧 Configuration
|
||||||
|
|
||||||
|
### Environment Variables
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Set API endpoint
|
||||||
|
export PUSHY_REGISTRY=https://your-api-endpoint.com
|
||||||
|
|
||||||
|
# Set non-interactive mode
|
||||||
|
export NO_INTERACTIVE=true
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configuration File
|
||||||
|
|
||||||
|
Create `update.json` file:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"ios": {
|
||||||
|
"appId": "your-ios-app-id",
|
||||||
|
"appKey": "your-ios-app-key"
|
||||||
|
},
|
||||||
|
"android": {
|
||||||
|
"appId": "your-android-app-id",
|
||||||
|
"appKey": "your-android-app-key"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🚨 Important Notes
|
||||||
|
|
||||||
|
1. **Backward Compatibility**: The new modular CLI maintains compatibility with existing CLI
|
||||||
|
2. **Type Safety**: All APIs have complete TypeScript type definitions
|
||||||
|
3. **Error Handling**: All operations return standardized result formats
|
||||||
|
4. **Resource Cleanup**: Modules support cleanup functions to release resources
|
||||||
|
5. **Module Separation**: Functionality is logically separated into different modules for easy maintenance and extension
|
||||||
|
|
||||||
|
## 🤝 Contributing
|
||||||
|
|
||||||
|
Welcome to submit Issues and Pull Requests to improve this project!
|
||||||
|
|
||||||
|
## 🚀 Provider API Usage Guide
|
||||||
|
|
||||||
|
Provider provides a concise programming interface suitable for integrating React Native Update CLI functionality in applications.
|
||||||
|
|
||||||
|
### 📋 Core API Methods
|
||||||
|
|
||||||
|
#### Core Business Functions
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Bundle application
|
||||||
|
await provider.bundle({
|
||||||
|
platform: 'ios',
|
||||||
|
dev: false,
|
||||||
|
sourcemap: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Publish version
|
||||||
|
await provider.publish({
|
||||||
|
name: 'v1.0.0',
|
||||||
|
description: 'Bug fixes',
|
||||||
|
rollout: 100,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Upload file
|
||||||
|
await provider.upload({
|
||||||
|
filePath: 'app.ipa',
|
||||||
|
platform: 'ios',
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Application Management
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Create application
|
||||||
|
await provider.createApp('MyApp', 'ios');
|
||||||
|
|
||||||
|
// List applications
|
||||||
|
await provider.listApps('ios');
|
||||||
|
|
||||||
|
// Get current application
|
||||||
|
const { appId, platform } = await provider.getSelectedApp('ios');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Version Management
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// List versions
|
||||||
|
await provider.listVersions('app123');
|
||||||
|
|
||||||
|
// Update version
|
||||||
|
await provider.updateVersion('app123', 'version456', {
|
||||||
|
name: 'v1.1.0',
|
||||||
|
description: 'New features',
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Utility Functions
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Get platform
|
||||||
|
const platform = await provider.getPlatform('ios');
|
||||||
|
|
||||||
|
// Load session
|
||||||
|
const session = await provider.loadSession();
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🎯 Use Cases
|
||||||
|
|
||||||
|
#### 1. Automated Build Scripts
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { moduleManager } from 'react-native-update-cli';
|
||||||
|
|
||||||
|
async function buildAndPublish() {
|
||||||
|
const provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
// 1. Bundle
|
||||||
|
const bundleResult = await provider.bundle({
|
||||||
|
platform: 'ios',
|
||||||
|
dev: false,
|
||||||
|
sourcemap: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!bundleResult.success) {
|
||||||
|
throw new Error(`Bundle failed: ${bundleResult.error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Publish
|
||||||
|
const publishResult = await provider.publish({
|
||||||
|
name: 'v1.2.3',
|
||||||
|
description: 'Bug fixes and performance improvements',
|
||||||
|
rollout: 100,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!publishResult.success) {
|
||||||
|
throw new Error(`Publish failed: ${publishResult.error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Build and publish completed!');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2. CI/CD Integration
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
async function ciBuild() {
|
||||||
|
const provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
const result = await provider.bundle({
|
||||||
|
platform: process.env.PLATFORM as 'ios' | 'android',
|
||||||
|
dev: process.env.NODE_ENV !== 'production',
|
||||||
|
sourcemap: process.env.NODE_ENV === 'production',
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 3. Application Management Service
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
class AppManagementService {
|
||||||
|
private provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
async setupNewApp(name: string, platform: Platform) {
|
||||||
|
// Create application
|
||||||
|
const createResult = await this.provider.createApp(name, platform);
|
||||||
|
|
||||||
|
if (createResult.success) {
|
||||||
|
// Get application information
|
||||||
|
const { appId } = await this.provider.getSelectedApp(platform);
|
||||||
|
|
||||||
|
// List versions
|
||||||
|
await this.provider.listVersions(appId);
|
||||||
|
|
||||||
|
return { appId, success: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
return { success: false, error: createResult.error };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### ⚠️ Important Notes
|
||||||
|
|
||||||
|
1. **Error Handling**: All Provider methods return `CommandResult`, need to check the `success` field
|
||||||
|
2. **Type Safety**: Provider provides complete TypeScript type support
|
||||||
|
3. **Session Management**: Ensure login before use, can check via `loadSession()`
|
||||||
|
4. **Platform Support**: Supports `'ios' | 'android' | 'harmony'` three platforms
|
||||||
|
|
||||||
|
### 🔧 Advanced Features
|
||||||
|
|
||||||
|
#### Custom Workflows
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Register custom workflow
|
||||||
|
provider.registerWorkflow({
|
||||||
|
name: 'quick-release',
|
||||||
|
description: 'Quick release process',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'bundle',
|
||||||
|
execute: async () => {
|
||||||
|
return await provider.bundle({ platform: 'ios', dev: false });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'publish',
|
||||||
|
execute: async (context, bundleResult) => {
|
||||||
|
if (!bundleResult.success) {
|
||||||
|
throw new Error('Bundle failed, cannot publish');
|
||||||
|
}
|
||||||
|
return await provider.publish({ name: 'auto-release', rollout: 50 });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
// Execute workflow
|
||||||
|
await provider.executeWorkflow('quick-release', { args: [], options: {} });
|
||||||
|
```
|
||||||
|
|
||||||
|
### 📚 Complete Example
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { moduleManager } from 'react-native-update-cli';
|
||||||
|
|
||||||
|
class ReactNativeUpdateService {
|
||||||
|
private provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
async initialize() {
|
||||||
|
// Load session
|
||||||
|
await this.provider.loadSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
async buildAndDeploy(platform: Platform, version: string) {
|
||||||
|
try {
|
||||||
|
// 1. Bundle
|
||||||
|
const bundleResult = await this.provider.bundle({
|
||||||
|
platform,
|
||||||
|
dev: false,
|
||||||
|
sourcemap: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!bundleResult.success) {
|
||||||
|
throw new Error(`Bundle failed: ${bundleResult.error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Publish
|
||||||
|
const publishResult = await this.provider.publish({
|
||||||
|
name: version,
|
||||||
|
description: `Release ${version}`,
|
||||||
|
rollout: 100,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!publishResult.success) {
|
||||||
|
throw new Error(`Publish failed: ${publishResult.error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return { success: true, data: publishResult.data };
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getAppInfo(platform: Platform) {
|
||||||
|
const { appId } = await this.provider.getSelectedApp(platform);
|
||||||
|
const versions = await this.provider.listVersions(appId);
|
||||||
|
|
||||||
|
return { appId, versions };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Usage example
|
||||||
|
const service = new ReactNativeUpdateService();
|
||||||
|
await service.initialize();
|
||||||
|
await service.buildAndDeploy('ios', 'v1.0.0');
|
||||||
|
```
|
||||||
|
|||||||
601
README.zh-CN.md
Normal file
601
README.zh-CN.md
Normal file
@@ -0,0 +1,601 @@
|
|||||||
|
# React Native Update CLI
|
||||||
|
|
||||||
|
这是一个统一的 React Native Update CLI,同时支持传统命令和模块化架构以及自定义发布流程。
|
||||||
|
|
||||||
|
## 🚀 特性
|
||||||
|
|
||||||
|
- **统一 CLI**: 使用单个`pushy`命令提供所有功能
|
||||||
|
- **向后兼容**: 所有现有命令都能正常工作
|
||||||
|
- **模块化架构**: 将 CLI 功能拆分为独立的模块
|
||||||
|
- **自定义工作流**: 支持创建自定义的发布流程
|
||||||
|
- **可扩展性**: 用户可以导入和注册自定义模块
|
||||||
|
- **类型安全**: 完整的 TypeScript 类型支持
|
||||||
|
|
||||||
|
## 📦 安装
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install react-native-update-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🎯 快速开始
|
||||||
|
|
||||||
|
### 基本使用
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 使用统一CLI
|
||||||
|
npx pushy help
|
||||||
|
|
||||||
|
# 列出所有可用命令和工作流
|
||||||
|
npx pushy list
|
||||||
|
|
||||||
|
# 执行内置的工作流
|
||||||
|
npx pushy workflow setup-app
|
||||||
|
|
||||||
|
# 执行自定义工作流
|
||||||
|
npx pushy workflow custom-publish
|
||||||
|
```
|
||||||
|
|
||||||
|
### 编程方式使用
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { moduleManager, CLIProviderImpl } from 'react-native-update-cli';
|
||||||
|
|
||||||
|
// 获取CLI提供者
|
||||||
|
const provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
// 执行打包
|
||||||
|
const bundleResult = await provider.bundle({
|
||||||
|
platform: 'ios',
|
||||||
|
dev: false,
|
||||||
|
sourcemap: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 发布版本
|
||||||
|
const publishResult = await provider.publish({
|
||||||
|
name: 'v1.2.3',
|
||||||
|
description: 'Bug fixes and improvements',
|
||||||
|
rollout: 100,
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🔧 创建自定义模块
|
||||||
|
|
||||||
|
### 1. 定义模块
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import type {
|
||||||
|
CLIModule,
|
||||||
|
CommandDefinition,
|
||||||
|
CustomWorkflow,
|
||||||
|
} from 'react-native-update-cli';
|
||||||
|
|
||||||
|
export const myCustomModule: CLIModule = {
|
||||||
|
name: 'my-custom',
|
||||||
|
version: '1.0.0',
|
||||||
|
|
||||||
|
commands: [
|
||||||
|
{
|
||||||
|
name: 'custom-command',
|
||||||
|
description: 'My custom command',
|
||||||
|
handler: async (context) => {
|
||||||
|
console.log('Executing custom command...');
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: { message: 'Custom command executed' },
|
||||||
|
};
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
param: { hasValue: true, description: 'Custom parameter' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
workflows: [
|
||||||
|
{
|
||||||
|
name: 'my-workflow',
|
||||||
|
description: 'My custom workflow',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'step1',
|
||||||
|
description: 'First step',
|
||||||
|
execute: async (context, previousResult) => {
|
||||||
|
console.log('Executing step 1...');
|
||||||
|
return { step1Completed: true };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'step2',
|
||||||
|
description: 'Second step',
|
||||||
|
execute: async (context, previousResult) => {
|
||||||
|
console.log('Executing step 2...');
|
||||||
|
return { ...previousResult, step2Completed: true };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
init: (provider) => {
|
||||||
|
console.log('Custom module initialized');
|
||||||
|
},
|
||||||
|
|
||||||
|
cleanup: () => {
|
||||||
|
console.log('Custom module cleanup');
|
||||||
|
},
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 注册模块
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { moduleManager } from 'react-native-update-cli';
|
||||||
|
import { myCustomModule } from './my-custom-module';
|
||||||
|
|
||||||
|
// 注册自定义模块
|
||||||
|
moduleManager.registerModule(myCustomModule);
|
||||||
|
|
||||||
|
// 执行自定义命令
|
||||||
|
const result = await moduleManager.executeCommand('custom-command', {
|
||||||
|
args: [],
|
||||||
|
options: { param: 'value' },
|
||||||
|
});
|
||||||
|
|
||||||
|
// 执行自定义工作流
|
||||||
|
const workflowResult = await moduleManager.executeWorkflow('my-workflow', {
|
||||||
|
args: [],
|
||||||
|
options: {},
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🔄 工作流系统
|
||||||
|
|
||||||
|
### 工作流步骤
|
||||||
|
|
||||||
|
每个工作流步骤包含:
|
||||||
|
|
||||||
|
- `name`: 步骤名称
|
||||||
|
- `description`: 步骤描述
|
||||||
|
- `execute`: 执行函数
|
||||||
|
- `condition`: 可选的条件函数
|
||||||
|
|
||||||
|
### 条件执行
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
{
|
||||||
|
name: 'conditional-step',
|
||||||
|
description: 'Only execute in production',
|
||||||
|
execute: async (context, previousResult) => {
|
||||||
|
// 执行逻辑
|
||||||
|
},
|
||||||
|
condition: (context) => {
|
||||||
|
return context.options.environment === 'production';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 工作流验证
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
{
|
||||||
|
name: 'validated-workflow',
|
||||||
|
description: 'Workflow with validation',
|
||||||
|
steps: [...],
|
||||||
|
validate: (context) => {
|
||||||
|
if (!context.options.requiredParam) {
|
||||||
|
console.error('Required parameter missing');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📋 内置模块
|
||||||
|
|
||||||
|
### Bundle 模块 (`bundle`)
|
||||||
|
|
||||||
|
- `bundle`: 打包 JavaScript 代码并可选发布
|
||||||
|
- `diff`: 生成两个 PPK 文件之间的差异
|
||||||
|
- `hdiff`: 生成两个 PPK 文件之间的 hdiff
|
||||||
|
- `diffFromApk`: 从 APK 文件生成差异
|
||||||
|
- `hdiffFromApk`: 从 APK 文件生成 hdiff
|
||||||
|
- `hdiffFromApp`: 从 APP 文件生成 hdiff
|
||||||
|
- `diffFromIpa`: 从 IPA 文件生成差异
|
||||||
|
- `hdiffFromIpa`: 从 IPA 文件生成 hdiff
|
||||||
|
|
||||||
|
### Version 模块 (`version`)
|
||||||
|
|
||||||
|
- `publish`: 发布新版本
|
||||||
|
- `versions`: 列出所有版本
|
||||||
|
- `update`: 更新版本信息
|
||||||
|
- `updateVersionInfo`: 更新版本元数据
|
||||||
|
|
||||||
|
### App 模块 (`app`)
|
||||||
|
|
||||||
|
- `createApp`: 创建新应用
|
||||||
|
- `apps`: 列出所有应用
|
||||||
|
- `selectApp`: 选择应用
|
||||||
|
- `deleteApp`: 删除应用
|
||||||
|
|
||||||
|
### Package 模块 (`package`)
|
||||||
|
|
||||||
|
- `uploadIpa`: 上传 IPA 文件(支持 `--version` 参数覆盖提取的版本)
|
||||||
|
- `uploadApk`: 上传 APK 文件(支持 `--version` 参数覆盖提取的版本)
|
||||||
|
- `uploadApp`: 上传 APP 文件(支持 `--version` 参数覆盖提取的版本)
|
||||||
|
- `parseApp`: 解析 APP 文件信息
|
||||||
|
- `parseIpa`: 解析 IPA 文件信息
|
||||||
|
- `parseApk`: 解析 APK 文件信息
|
||||||
|
- `packages`: 列出包
|
||||||
|
|
||||||
|
### User 模块 (`user`)
|
||||||
|
|
||||||
|
- `login`: 登录
|
||||||
|
- `logout`: 登出
|
||||||
|
- `me`: 显示用户信息
|
||||||
|
|
||||||
|
## 🛠️ CLI 提供者 API
|
||||||
|
|
||||||
|
### 核心功能
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface CLIProvider {
|
||||||
|
// 打包
|
||||||
|
bundle(options: BundleOptions): Promise<CommandResult>;
|
||||||
|
|
||||||
|
// 发布
|
||||||
|
publish(options: PublishOptions): Promise<CommandResult>;
|
||||||
|
|
||||||
|
// 上传
|
||||||
|
upload(options: UploadOptions): Promise<CommandResult>;
|
||||||
|
|
||||||
|
// 应用管理
|
||||||
|
getSelectedApp(
|
||||||
|
platform?: Platform,
|
||||||
|
): Promise<{ appId: string; platform: Platform }>;
|
||||||
|
listApps(platform?: Platform): Promise<CommandResult>;
|
||||||
|
createApp(name: string, platform: Platform): Promise<CommandResult>;
|
||||||
|
|
||||||
|
// 版本管理
|
||||||
|
listVersions(appId: string): Promise<CommandResult>;
|
||||||
|
getVersion(appId: string, versionId: string): Promise<CommandResult>;
|
||||||
|
updateVersion(
|
||||||
|
appId: string,
|
||||||
|
versionId: string,
|
||||||
|
updates: Partial<Version>,
|
||||||
|
): Promise<CommandResult>;
|
||||||
|
|
||||||
|
// 包管理
|
||||||
|
listPackages(appId: string, platform?: Platform): Promise<CommandResult>;
|
||||||
|
getPackage(appId: string, packageId: string): Promise<CommandResult>;
|
||||||
|
|
||||||
|
// 工具函数
|
||||||
|
getPlatform(platform?: Platform): Promise<Platform>;
|
||||||
|
loadSession(): Promise<Session>;
|
||||||
|
saveToLocal(key: string, value: string): void;
|
||||||
|
question(prompt: string): Promise<string>;
|
||||||
|
|
||||||
|
// 工作流
|
||||||
|
registerWorkflow(workflow: CustomWorkflow): void;
|
||||||
|
executeWorkflow(
|
||||||
|
workflowName: string,
|
||||||
|
context: CommandContext,
|
||||||
|
): Promise<CommandResult>;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 自定义命令
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// 执行自定义打包命令
|
||||||
|
const bundleResult = await moduleManager.executeCommand('custom-bundle', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
platform: 'android',
|
||||||
|
validate: true,
|
||||||
|
optimize: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// 生成差异文件
|
||||||
|
const diffResult = await moduleManager.executeCommand('diff', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
origin: './build/v1.0.0.ppk',
|
||||||
|
next: './build/v1.1.0.ppk',
|
||||||
|
output: './build/diff.patch',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// 从APK文件生成差异
|
||||||
|
const apkDiffResult = await moduleManager.executeCommand('diffFromApk', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
origin: './build/app-v1.0.0.apk',
|
||||||
|
next: './build/app-v1.1.0.apk',
|
||||||
|
output: './build/apk-diff.patch',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🔧 配置
|
||||||
|
|
||||||
|
### 环境变量
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 设置API端点
|
||||||
|
export PUSHY_REGISTRY=https://your-api-endpoint.com
|
||||||
|
|
||||||
|
# 设置非交互模式
|
||||||
|
export NO_INTERACTIVE=true
|
||||||
|
```
|
||||||
|
|
||||||
|
### 配置文件
|
||||||
|
|
||||||
|
创建 `update.json` 文件:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"ios": {
|
||||||
|
"appId": "your-ios-app-id",
|
||||||
|
"appKey": "your-ios-app-key"
|
||||||
|
},
|
||||||
|
"android": {
|
||||||
|
"appId": "your-android-app-id",
|
||||||
|
"appKey": "your-android-app-key"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🚨 注意事项
|
||||||
|
|
||||||
|
1. **向后兼容**: 新的模块化 CLI 保持与现有 CLI 的兼容性
|
||||||
|
2. **类型安全**: 所有 API 都有完整的 TypeScript 类型定义
|
||||||
|
3. **错误处理**: 所有操作都返回标准化的结果格式
|
||||||
|
4. **资源清理**: 模块支持清理函数来释放资源
|
||||||
|
5. **模块分离**: 功能按逻辑分离到不同模块中,便于维护和扩展
|
||||||
|
|
||||||
|
## 🤝 贡献
|
||||||
|
|
||||||
|
欢迎提交 Issue 和 Pull Request 来改进这个项目!
|
||||||
|
|
||||||
|
## 🚀 Provider API 使用指南
|
||||||
|
|
||||||
|
Provider 提供了简洁的编程接口,适合在应用程序中集成 React Native Update CLI 功能。
|
||||||
|
|
||||||
|
### 📋 核心 API 方法
|
||||||
|
|
||||||
|
#### 核心业务功能
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// 打包应用
|
||||||
|
await provider.bundle({
|
||||||
|
platform: 'ios',
|
||||||
|
dev: false,
|
||||||
|
sourcemap: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 发布版本
|
||||||
|
await provider.publish({
|
||||||
|
name: 'v1.0.0',
|
||||||
|
description: 'Bug fixes',
|
||||||
|
rollout: 100,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 上传文件
|
||||||
|
await provider.upload({
|
||||||
|
filePath: 'app.ipa',
|
||||||
|
platform: 'ios',
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 应用管理
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// 创建应用
|
||||||
|
await provider.createApp('MyApp', 'ios');
|
||||||
|
|
||||||
|
// 列出应用
|
||||||
|
await provider.listApps('ios');
|
||||||
|
|
||||||
|
// 获取当前应用
|
||||||
|
const { appId, platform } = await provider.getSelectedApp('ios');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 版本管理
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// 列出版本
|
||||||
|
await provider.listVersions('app123');
|
||||||
|
|
||||||
|
// 更新版本
|
||||||
|
await provider.updateVersion('app123', 'version456', {
|
||||||
|
name: 'v1.1.0',
|
||||||
|
description: 'New features',
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 工具函数
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// 获取平台
|
||||||
|
const platform = await provider.getPlatform('ios');
|
||||||
|
|
||||||
|
// 加载会话
|
||||||
|
const session = await provider.loadSession();
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🎯 使用场景
|
||||||
|
|
||||||
|
#### 1. 自动化构建脚本
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { moduleManager } from 'react-native-update-cli';
|
||||||
|
|
||||||
|
async function buildAndPublish() {
|
||||||
|
const provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
// 1. 打包
|
||||||
|
const bundleResult = await provider.bundle({
|
||||||
|
platform: 'ios',
|
||||||
|
dev: false,
|
||||||
|
sourcemap: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!bundleResult.success) {
|
||||||
|
throw new Error(`打包失败: ${bundleResult.error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 发布
|
||||||
|
const publishResult = await provider.publish({
|
||||||
|
name: 'v1.2.3',
|
||||||
|
description: 'Bug fixes and performance improvements',
|
||||||
|
rollout: 100,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!publishResult.success) {
|
||||||
|
throw new Error(`发布失败: ${publishResult.error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('构建和发布完成!');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2. CI/CD 集成
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
async function ciBuild() {
|
||||||
|
const provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
const result = await provider.bundle({
|
||||||
|
platform: process.env.PLATFORM as 'ios' | 'android',
|
||||||
|
dev: process.env.NODE_ENV !== 'production',
|
||||||
|
sourcemap: process.env.NODE_ENV === 'production',
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 3. 应用管理服务
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
class AppManagementService {
|
||||||
|
private provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
async setupNewApp(name: string, platform: Platform) {
|
||||||
|
// 创建应用
|
||||||
|
const createResult = await this.provider.createApp(name, platform);
|
||||||
|
|
||||||
|
if (createResult.success) {
|
||||||
|
// 获取应用信息
|
||||||
|
const { appId } = await this.provider.getSelectedApp(platform);
|
||||||
|
|
||||||
|
// 列出版本
|
||||||
|
await this.provider.listVersions(appId);
|
||||||
|
|
||||||
|
return { appId, success: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
return { success: false, error: createResult.error };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### ⚠️ 注意事项
|
||||||
|
|
||||||
|
1. **错误处理**: 所有 Provider 方法都返回`CommandResult`,需要检查`success`字段
|
||||||
|
2. **类型安全**: Provider 提供完整的 TypeScript 类型支持
|
||||||
|
3. **会话管理**: 使用前确保已登录,可通过`loadSession()`检查
|
||||||
|
4. **平台支持**: 支持`'ios' | 'android' | 'harmony'`三个平台
|
||||||
|
|
||||||
|
### 🔧 高级功能
|
||||||
|
|
||||||
|
#### 自定义工作流
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// 注册自定义工作流
|
||||||
|
provider.registerWorkflow({
|
||||||
|
name: 'quick-release',
|
||||||
|
description: '快速发布流程',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'bundle',
|
||||||
|
execute: async () => {
|
||||||
|
return await provider.bundle({ platform: 'ios', dev: false });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'publish',
|
||||||
|
execute: async (context, bundleResult) => {
|
||||||
|
if (!bundleResult.success) {
|
||||||
|
throw new Error('打包失败,无法发布');
|
||||||
|
}
|
||||||
|
return await provider.publish({ name: 'auto-release', rollout: 50 });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
// 执行工作流
|
||||||
|
await provider.executeWorkflow('quick-release', { args: [], options: {} });
|
||||||
|
```
|
||||||
|
|
||||||
|
### 📚 完整示例
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { moduleManager } from 'react-native-update-cli';
|
||||||
|
|
||||||
|
class ReactNativeUpdateService {
|
||||||
|
private provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
async initialize() {
|
||||||
|
// 加载会话
|
||||||
|
await this.provider.loadSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
async buildAndDeploy(platform: Platform, version: string) {
|
||||||
|
try {
|
||||||
|
// 1. 打包
|
||||||
|
const bundleResult = await this.provider.bundle({
|
||||||
|
platform,
|
||||||
|
dev: false,
|
||||||
|
sourcemap: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!bundleResult.success) {
|
||||||
|
throw new Error(`打包失败: ${bundleResult.error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 发布
|
||||||
|
const publishResult = await this.provider.publish({
|
||||||
|
name: version,
|
||||||
|
description: `Release ${version}`,
|
||||||
|
rollout: 100,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!publishResult.success) {
|
||||||
|
throw new Error(`发布失败: ${publishResult.error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return { success: true, data: publishResult.data };
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getAppInfo(platform: Platform) {
|
||||||
|
const { appId } = await this.provider.getSelectedApp(platform);
|
||||||
|
const versions = await this.provider.listVersions(appId);
|
||||||
|
|
||||||
|
return { appId, versions };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用示例
|
||||||
|
const service = new ReactNativeUpdateService();
|
||||||
|
await service.initialize();
|
||||||
|
await service.buildAndDeploy('ios', 'v1.0.0');
|
||||||
|
```
|
||||||
@@ -12,7 +12,8 @@
|
|||||||
"noDoubleEquals": "off"
|
"noDoubleEquals": "off"
|
||||||
},
|
},
|
||||||
"style": {
|
"style": {
|
||||||
"noNonNullAssertion": "off"
|
"noNonNullAssertion": "off",
|
||||||
|
"useNodejsImportProtocol": "off"
|
||||||
},
|
},
|
||||||
"a11y": {
|
"a11y": {
|
||||||
"useValidAnchor": "off"
|
"useValidAnchor": "off"
|
||||||
|
|||||||
302
bun.lock
302
bun.lock
@@ -3,56 +3,58 @@
|
|||||||
"workspaces": {
|
"workspaces": {
|
||||||
"": {
|
"": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@badisi/latest-version": "^7.0.12",
|
"@colors/colors": "^1.6.0",
|
||||||
"bplist-parser": "^0.3.2",
|
"bplist-parser": "^0.3.2",
|
||||||
"bytebuffer": "^5.0.1",
|
"bytebuffer": "^5.0.1",
|
||||||
"cgbi-to-png": "^1.0.7",
|
"cgbi-to-png": "^1.0.7",
|
||||||
"chalk": "4",
|
"chalk": "4",
|
||||||
"cli-arguments": "^0.2.1",
|
"cli-arguments": "^0.2.1",
|
||||||
"commander": "^13.1.0",
|
"commander": "^13",
|
||||||
"compare-versions": "^6.1.1",
|
"compare-versions": "^6.1.1",
|
||||||
"filesize-parser": "^1.5.1",
|
"filesize-parser": "^1.5.1",
|
||||||
"form-data": "^4.0.2",
|
"form-data": "^4.0.2",
|
||||||
"fs-extra": "8",
|
"fs-extra": "8",
|
||||||
|
"global-dirs": "^4.0.0",
|
||||||
"gradle-to-js": "^2.0.1",
|
"gradle-to-js": "^2.0.1",
|
||||||
"i18next": "^24.2.3",
|
"i18next": "^24.2.3",
|
||||||
"isomorphic-git": "^1.29.0",
|
"isomorphic-git": "^1.30.1",
|
||||||
"isomorphic-unzip": "^1.1.5",
|
"isomorphic-unzip": "^1.1.5",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
"plist": "^3.1.0",
|
"plist": "^3.1.0",
|
||||||
"progress": "^2.0.3",
|
"progress": "^2.0.3",
|
||||||
"properties": "^1.2.1",
|
"properties": "^1.2.1",
|
||||||
"read": "^4.1.0",
|
"read": "^4.1.0",
|
||||||
"semver": "^7.7.1",
|
"registry-auth-token": "^5.1.0",
|
||||||
|
"semver": "^7.7.2",
|
||||||
"tcp-ping": "^0.1.1",
|
"tcp-ping": "^0.1.1",
|
||||||
"tty-table": "4.2",
|
"tty-table": "4.2",
|
||||||
"update-notifier": "^5.1.0",
|
|
||||||
"yauzl": "^3.2.0",
|
"yauzl": "^3.2.0",
|
||||||
"yazl": "3.3.1",
|
"yazl": "3.3.1",
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "^1.9.4",
|
"@biomejs/biome": "^1.9.4",
|
||||||
"@swc/cli": "^0.6.0",
|
"@swc/cli": "0.7.7",
|
||||||
"@swc/core": "^1.11.9",
|
"@swc/core": "^1.11.24",
|
||||||
"@types/filesize-parser": "^1.5.3",
|
"@types/filesize-parser": "^1.5.3",
|
||||||
"@types/fs-extra": "^11.0.4",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@types/node": "^22.13.10",
|
"@types/node": "^22.15.18",
|
||||||
"@types/node-fetch": "^2.6.12",
|
"@types/node-fetch": "^2.6.12",
|
||||||
"@types/progress": "^2.0.7",
|
"@types/progress": "^2.0.7",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.7.0",
|
||||||
"@types/tcp-ping": "^0.1.6",
|
"@types/tcp-ping": "^0.1.6",
|
||||||
"@types/update-notifier": "^6.0.8",
|
|
||||||
"@types/yauzl": "^2.10.3",
|
"@types/yauzl": "^2.10.3",
|
||||||
"@types/yazl": "^2.4.6",
|
"@types/yazl": "^2.4.6",
|
||||||
"typescript": "^5.8.2",
|
"typescript": "^5.8.3",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"trustedDependencies": [
|
||||||
|
"@biomejs/biome",
|
||||||
|
"@swc/core",
|
||||||
|
],
|
||||||
"packages": {
|
"packages": {
|
||||||
"@babel/runtime": ["@babel/runtime@7.26.10", "", { "dependencies": { "regenerator-runtime": "^0.14.0" } }, "sha512-2WJMeRQPHKSPemqk/awGrAiuFfzBmOIPXKizAsVhWH9YJqLZ0H+HS4c8loHGgW6utJ3E/ejXQUsiGaQy2NZ9Fw=="],
|
"@babel/runtime": ["@babel/runtime@7.26.10", "", { "dependencies": { "regenerator-runtime": "^0.14.0" } }, "sha512-2WJMeRQPHKSPemqk/awGrAiuFfzBmOIPXKizAsVhWH9YJqLZ0H+HS4c8loHGgW6utJ3E/ejXQUsiGaQy2NZ9Fw=="],
|
||||||
|
|
||||||
"@badisi/latest-version": ["@badisi/latest-version@7.0.12", "", { "dependencies": { "@colors/colors": "^1.6.0", "global-dirs": "3.0.1", "ora": "^8.2.0", "registry-auth-token": "^5.1.0", "semver": "^7.7.1" }, "bin": { "latest-version": "bin/latest-version", "lv": "bin/latest-version" } }, "sha512-Ae5c0510gSWpy97PpAtfVunvGt8u2nkaX4jahtTFTii8V+/etMNvfxUw3XhCXSG9zZ6y2uxGZXWMfO0hUtSRJQ=="],
|
|
||||||
|
|
||||||
"@biomejs/biome": ["@biomejs/biome@1.9.4", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "1.9.4", "@biomejs/cli-darwin-x64": "1.9.4", "@biomejs/cli-linux-arm64": "1.9.4", "@biomejs/cli-linux-arm64-musl": "1.9.4", "@biomejs/cli-linux-x64": "1.9.4", "@biomejs/cli-linux-x64-musl": "1.9.4", "@biomejs/cli-win32-arm64": "1.9.4", "@biomejs/cli-win32-x64": "1.9.4" }, "bin": { "biome": "bin/biome" } }, "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog=="],
|
"@biomejs/biome": ["@biomejs/biome@1.9.4", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "1.9.4", "@biomejs/cli-darwin-x64": "1.9.4", "@biomejs/cli-linux-arm64": "1.9.4", "@biomejs/cli-linux-arm64-musl": "1.9.4", "@biomejs/cli-linux-x64": "1.9.4", "@biomejs/cli-linux-x64-musl": "1.9.4", "@biomejs/cli-win32-arm64": "1.9.4", "@biomejs/cli-win32-x64": "1.9.4" }, "bin": { "biome": "bin/biome" } }, "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog=="],
|
||||||
|
|
||||||
"@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@1.9.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw=="],
|
"@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@1.9.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw=="],
|
||||||
@@ -123,40 +125,38 @@
|
|||||||
|
|
||||||
"@sindresorhus/is": ["@sindresorhus/is@5.6.0", "", {}, "sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g=="],
|
"@sindresorhus/is": ["@sindresorhus/is@5.6.0", "", {}, "sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g=="],
|
||||||
|
|
||||||
"@swc/cli": ["@swc/cli@0.6.0", "", { "dependencies": { "@swc/counter": "^0.1.3", "@xhmikosr/bin-wrapper": "^13.0.5", "commander": "^8.3.0", "fast-glob": "^3.2.5", "minimatch": "^9.0.3", "piscina": "^4.3.1", "semver": "^7.3.8", "slash": "3.0.0", "source-map": "^0.7.3" }, "peerDependencies": { "@swc/core": "^1.2.66", "chokidar": "^4.0.1" }, "optionalPeers": ["chokidar"], "bin": { "swc": "bin/swc.js", "swcx": "bin/swcx.js", "spack": "bin/spack.js" } }, "sha512-Q5FsI3Cw0fGMXhmsg7c08i4EmXCrcl+WnAxb6LYOLHw4JFFC3yzmx9LaXZ7QMbA+JZXbigU2TirI7RAfO0Qlnw=="],
|
"@swc/cli": ["@swc/cli@0.7.7", "", { "dependencies": { "@swc/counter": "^0.1.3", "@xhmikosr/bin-wrapper": "^13.0.5", "commander": "^8.3.0", "fast-glob": "^3.2.5", "minimatch": "^9.0.3", "piscina": "^4.3.1", "semver": "^7.3.8", "slash": "3.0.0", "source-map": "^0.7.3" }, "peerDependencies": { "@swc/core": "^1.2.66", "chokidar": "^4.0.1" }, "optionalPeers": ["chokidar"], "bin": { "swc": "bin/swc.js", "swcx": "bin/swcx.js", "spack": "bin/spack.js" } }, "sha512-j4yYm9bx3pxWofaJKX1BFwj/3ngUDynN4UIQ2Xd2h0h/7Gt7zkReBTpDN7g5S13mgAYxacaTHTOUsz18097E8w=="],
|
||||||
|
|
||||||
"@swc/core": ["@swc/core@1.11.9", "", { "dependencies": { "@swc/counter": "^0.1.3", "@swc/types": "^0.1.19" }, "optionalDependencies": { "@swc/core-darwin-arm64": "1.11.9", "@swc/core-darwin-x64": "1.11.9", "@swc/core-linux-arm-gnueabihf": "1.11.9", "@swc/core-linux-arm64-gnu": "1.11.9", "@swc/core-linux-arm64-musl": "1.11.9", "@swc/core-linux-x64-gnu": "1.11.9", "@swc/core-linux-x64-musl": "1.11.9", "@swc/core-win32-arm64-msvc": "1.11.9", "@swc/core-win32-ia32-msvc": "1.11.9", "@swc/core-win32-x64-msvc": "1.11.9" }, "peerDependencies": { "@swc/helpers": "*" }, "optionalPeers": ["@swc/helpers"] }, "sha512-4UQ66FwTkFDr+UzYzRNKQyHMScOrc4zJbTJHyK6dP1yVMrxi5sl0FTzNKiqoYvRZ7j8TAYgtYvvuPSW/XXvp5g=="],
|
"@swc/core": ["@swc/core@1.11.24", "", { "dependencies": { "@swc/counter": "^0.1.3", "@swc/types": "^0.1.21" }, "optionalDependencies": { "@swc/core-darwin-arm64": "1.11.24", "@swc/core-darwin-x64": "1.11.24", "@swc/core-linux-arm-gnueabihf": "1.11.24", "@swc/core-linux-arm64-gnu": "1.11.24", "@swc/core-linux-arm64-musl": "1.11.24", "@swc/core-linux-x64-gnu": "1.11.24", "@swc/core-linux-x64-musl": "1.11.24", "@swc/core-win32-arm64-msvc": "1.11.24", "@swc/core-win32-ia32-msvc": "1.11.24", "@swc/core-win32-x64-msvc": "1.11.24" }, "peerDependencies": { "@swc/helpers": ">=0.5.17" }, "optionalPeers": ["@swc/helpers"] }, "sha512-MaQEIpfcEMzx3VWWopbofKJvaraqmL6HbLlw2bFZ7qYqYw3rkhM0cQVEgyzbHtTWwCwPMFZSC2DUbhlZgrMfLg=="],
|
||||||
|
|
||||||
"@swc/core-darwin-arm64": ["@swc/core-darwin-arm64@1.11.9", "", { "os": "darwin", "cpu": "arm64" }, "sha512-moqbPCWG6SHiDMENTDYsEQJ0bFustbLtrdbDbdjnijSyhCyIcm9zKowmovE6MF8JBdOwmLxbuN1Yarq6CrPNlw=="],
|
"@swc/core-darwin-arm64": ["@swc/core-darwin-arm64@1.11.24", "", { "os": "darwin", "cpu": "arm64" }, "sha512-dhtVj0PC1APOF4fl5qT2neGjRLgHAAYfiVP8poJelhzhB/318bO+QCFWAiimcDoyMgpCXOhTp757gnoJJrheWA=="],
|
||||||
|
|
||||||
"@swc/core-darwin-x64": ["@swc/core-darwin-x64@1.11.9", "", { "os": "darwin", "cpu": "x64" }, "sha512-/lgMo5l9q6y3jjLM3v30y6SBvuuyLsM/K94hv3hPvDf91N+YlZLw4D7KY0Qknfhj6WytoAcjOIDU6xwBRPyUWg=="],
|
"@swc/core-darwin-x64": ["@swc/core-darwin-x64@1.11.24", "", { "os": "darwin", "cpu": "x64" }, "sha512-H/3cPs8uxcj2Fe3SoLlofN5JG6Ny5bl8DuZ6Yc2wr7gQFBmyBkbZEz+sPVgsID7IXuz7vTP95kMm1VL74SO5AQ=="],
|
||||||
|
|
||||||
"@swc/core-linux-arm-gnueabihf": ["@swc/core-linux-arm-gnueabihf@1.11.9", "", { "os": "linux", "cpu": "arm" }, "sha512-7bL6z/63If11IpBElQRozIGRadiy6rt3DoUyfGuFIFQKxtnZxzHuLxm1/wrCAGN9iAZxrpHxHP0VbPQvr6Mcjg=="],
|
"@swc/core-linux-arm-gnueabihf": ["@swc/core-linux-arm-gnueabihf@1.11.24", "", { "os": "linux", "cpu": "arm" }, "sha512-PHJgWEpCsLo/NGj+A2lXZ2mgGjsr96ULNW3+T3Bj2KTc8XtMUkE8tmY2Da20ItZOvPNC/69KroU7edyo1Flfbw=="],
|
||||||
|
|
||||||
"@swc/core-linux-arm64-gnu": ["@swc/core-linux-arm64-gnu@1.11.9", "", { "os": "linux", "cpu": "arm64" }, "sha512-9ArpxjrNbyFTr7gG+toiGbbK2mfS+X97GIruBKPsD8CJH/yJlMknBsX3lfy9h/L119zYVnFBmZDnwsv5yW8/cw=="],
|
"@swc/core-linux-arm64-gnu": ["@swc/core-linux-arm64-gnu@1.11.24", "", { "os": "linux", "cpu": "arm64" }, "sha512-C2FJb08+n5SD4CYWCTZx1uR88BN41ZieoHvI8A55hfVf2woT8+6ZiBzt74qW2g+ntZ535Jts5VwXAKdu41HpBg=="],
|
||||||
|
|
||||||
"@swc/core-linux-arm64-musl": ["@swc/core-linux-arm64-musl@1.11.9", "", { "os": "linux", "cpu": "arm64" }, "sha512-UOnunJWu7T7oNkBr4DLMwXXbldjiwi+JxmqBKrD2+BNiHGu6P5VpqDHiTGuWuLrda0TcTmeNE6gzlIVOVBo/vw=="],
|
"@swc/core-linux-arm64-musl": ["@swc/core-linux-arm64-musl@1.11.24", "", { "os": "linux", "cpu": "arm64" }, "sha512-ypXLIdszRo0re7PNNaXN0+2lD454G8l9LPK/rbfRXnhLWDBPURxzKlLlU/YGd2zP98wPcVooMmegRSNOKfvErw=="],
|
||||||
|
|
||||||
"@swc/core-linux-x64-gnu": ["@swc/core-linux-x64-gnu@1.11.9", "", { "os": "linux", "cpu": "x64" }, "sha512-HAqmCkNoNhRusBqSokyylXKsLJ/dr3dnMgBERdUrCIh47L8CKR2qEFUP6FI05sHVB85403ctWnfzBYblcarpqg=="],
|
"@swc/core-linux-x64-gnu": ["@swc/core-linux-x64-gnu@1.11.24", "", { "os": "linux", "cpu": "x64" }, "sha512-IM7d+STVZD48zxcgo69L0yYptfhaaE9cMZ+9OoMxirNafhKKXwoZuufol1+alEFKc+Wbwp+aUPe/DeWC/Lh3dg=="],
|
||||||
|
|
||||||
"@swc/core-linux-x64-musl": ["@swc/core-linux-x64-musl@1.11.9", "", { "os": "linux", "cpu": "x64" }, "sha512-THwUT2g2qSWUxhi3NGRCEdmh/q7WKl3d5jcN9mz/4jum76Tb46LB9p3oOVPBIcfnFQ9OaddExjCwLoUl0ju2pA=="],
|
"@swc/core-linux-x64-musl": ["@swc/core-linux-x64-musl@1.11.24", "", { "os": "linux", "cpu": "x64" }, "sha512-DZByJaMVzSfjQKKQn3cqSeqwy6lpMaQDQQ4HPlch9FWtDx/dLcpdIhxssqZXcR2rhaQVIaRQsCqwV6orSDGAGw=="],
|
||||||
|
|
||||||
"@swc/core-win32-arm64-msvc": ["@swc/core-win32-arm64-msvc@1.11.9", "", { "os": "win32", "cpu": "arm64" }, "sha512-r4SGD9lR0MM9HSIsQ72BEL3Za3XsuVj+govuXQTlK0mty5gih4L+Qgfnb9PmhjFakK3F63gZyyEr2y8Fj0mN6Q=="],
|
"@swc/core-win32-arm64-msvc": ["@swc/core-win32-arm64-msvc@1.11.24", "", { "os": "win32", "cpu": "arm64" }, "sha512-Q64Ytn23y9aVDKN5iryFi8mRgyHw3/kyjTjT4qFCa8AEb5sGUuSj//AUZ6c0J7hQKMHlg9do5Etvoe61V98/JQ=="],
|
||||||
|
|
||||||
"@swc/core-win32-ia32-msvc": ["@swc/core-win32-ia32-msvc@1.11.9", "", { "os": "win32", "cpu": "ia32" }, "sha512-jrEh6MDSnhwfpjRlSWd2Bk8pS5EjreQD1YbkNcnXviQf3+H0wSPmeVSktZyoIdkxAuc2suFx8mj7Yja2UXAgUg=="],
|
"@swc/core-win32-ia32-msvc": ["@swc/core-win32-ia32-msvc@1.11.24", "", { "os": "win32", "cpu": "ia32" }, "sha512-9pKLIisE/Hh2vJhGIPvSoTK4uBSPxNVyXHmOrtdDot4E1FUUI74Vi8tFdlwNbaj8/vusVnb8xPXsxF1uB0VgiQ=="],
|
||||||
|
|
||||||
"@swc/core-win32-x64-msvc": ["@swc/core-win32-x64-msvc@1.11.9", "", { "os": "win32", "cpu": "x64" }, "sha512-oAwuhzr+1Bmb4As2wa3k57/WPJeyVEYRQelwEMYjPgi/h6TH+Y69jQAgKOd+ec1Yl8L5nkWTZMVA/dKDac1bAQ=="],
|
"@swc/core-win32-x64-msvc": ["@swc/core-win32-x64-msvc@1.11.24", "", { "os": "win32", "cpu": "x64" }, "sha512-sybnXtOsdB+XvzVFlBVGgRHLqp3yRpHK7CrmpuDKszhj/QhmsaZzY/GHSeALlMtLup13M0gqbcQvsTNlAHTg3w=="],
|
||||||
|
|
||||||
"@swc/counter": ["@swc/counter@0.1.3", "", {}, "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ=="],
|
"@swc/counter": ["@swc/counter@0.1.3", "", {}, "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ=="],
|
||||||
|
|
||||||
"@swc/types": ["@swc/types@0.1.19", "", { "dependencies": { "@swc/counter": "^0.1.3" } }, "sha512-WkAZaAfj44kh/UFdAQcrMP1I0nwRqpt27u+08LMBYMqmQfwwMofYoMh/48NGkMMRfC4ynpfwRbJuu8ErfNloeA=="],
|
"@swc/types": ["@swc/types@0.1.21", "", { "dependencies": { "@swc/counter": "^0.1.3" } }, "sha512-2YEtj5HJVbKivud9N4bpPBAyZhj4S2Ipe5LkUG94alTpr7in/GU/EARgPAd3BwU+YOmFVJC2+kjqhGRi3r0ZpQ=="],
|
||||||
|
|
||||||
"@szmarczak/http-timer": ["@szmarczak/http-timer@5.0.1", "", { "dependencies": { "defer-to-connect": "^2.0.1" } }, "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw=="],
|
"@szmarczak/http-timer": ["@szmarczak/http-timer@5.0.1", "", { "dependencies": { "defer-to-connect": "^2.0.1" } }, "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw=="],
|
||||||
|
|
||||||
"@tokenizer/token": ["@tokenizer/token@0.3.0", "", {}, "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A=="],
|
"@tokenizer/token": ["@tokenizer/token@0.3.0", "", {}, "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A=="],
|
||||||
|
|
||||||
"@types/configstore": ["@types/configstore@6.0.2", "", {}, "sha512-OS//b51j9uyR3zvwD04Kfs5kHpve2qalQ18JhY/ho3voGYUTPLEG90/ocfKPI48hyHH8T04f7KEEbK6Ue60oZQ=="],
|
|
||||||
|
|
||||||
"@types/filesize-parser": ["@types/filesize-parser@1.5.3", "", {}, "sha512-D8veS92mQAfcKz5kbV9WINfKvvaxVfQHqnO3OWW6FxdYTZozDDb8mTLWCsvEqe8M/M7skeULTZzYeMf3Lsss+A=="],
|
"@types/filesize-parser": ["@types/filesize-parser@1.5.3", "", {}, "sha512-D8veS92mQAfcKz5kbV9WINfKvvaxVfQHqnO3OWW6FxdYTZozDDb8mTLWCsvEqe8M/M7skeULTZzYeMf3Lsss+A=="],
|
||||||
|
|
||||||
"@types/fs-extra": ["@types/fs-extra@11.0.4", "", { "dependencies": { "@types/jsonfile": "*", "@types/node": "*" } }, "sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ=="],
|
"@types/fs-extra": ["@types/fs-extra@11.0.4", "", { "dependencies": { "@types/jsonfile": "*", "@types/node": "*" } }, "sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ=="],
|
||||||
@@ -165,18 +165,16 @@
|
|||||||
|
|
||||||
"@types/jsonfile": ["@types/jsonfile@6.1.4", "", { "dependencies": { "@types/node": "*" } }, "sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ=="],
|
"@types/jsonfile": ["@types/jsonfile@6.1.4", "", { "dependencies": { "@types/node": "*" } }, "sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ=="],
|
||||||
|
|
||||||
"@types/node": ["@types/node@22.13.10", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw=="],
|
"@types/node": ["@types/node@22.15.18", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-v1DKRfUdyW+jJhZNEI1PYy29S2YRxMV5AOO/x/SjKmW0acCIOqmbj6Haf9eHAhsPmrhlHSxEhv/1WszcLWV4cg=="],
|
||||||
|
|
||||||
"@types/node-fetch": ["@types/node-fetch@2.6.12", "", { "dependencies": { "@types/node": "*", "form-data": "^4.0.0" } }, "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA=="],
|
"@types/node-fetch": ["@types/node-fetch@2.6.12", "", { "dependencies": { "@types/node": "*", "form-data": "^4.0.0" } }, "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA=="],
|
||||||
|
|
||||||
"@types/progress": ["@types/progress@2.0.7", "", { "dependencies": { "@types/node": "*" } }, "sha512-iadjw02vte8qWx7U0YM++EybBha2CQLPGu9iJ97whVgJUT5Zq9MjAPYUnbfRI2Kpehimf1QjFJYxD0t8nqzu5w=="],
|
"@types/progress": ["@types/progress@2.0.7", "", { "dependencies": { "@types/node": "*" } }, "sha512-iadjw02vte8qWx7U0YM++EybBha2CQLPGu9iJ97whVgJUT5Zq9MjAPYUnbfRI2Kpehimf1QjFJYxD0t8nqzu5w=="],
|
||||||
|
|
||||||
"@types/semver": ["@types/semver@7.5.8", "", {}, "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ=="],
|
"@types/semver": ["@types/semver@7.7.0", "", {}, "sha512-k107IF4+Xr7UHjwDc7Cfd6PRQfbdkiRabXGRjo07b4WyPahFBZCZ1sE+BNxYIJPPg73UkfOsVOLwqVc/6ETrIA=="],
|
||||||
|
|
||||||
"@types/tcp-ping": ["@types/tcp-ping@0.1.6", "", {}, "sha512-1TTOm3cK+0NrZ6uTlY51YERzo5tEW3RybX1594vy9oiZOc1vsVL4LmdiIklDJXYLlzmve5lBkM5GjvwBG1Bc4A=="],
|
"@types/tcp-ping": ["@types/tcp-ping@0.1.6", "", {}, "sha512-1TTOm3cK+0NrZ6uTlY51YERzo5tEW3RybX1594vy9oiZOc1vsVL4LmdiIklDJXYLlzmve5lBkM5GjvwBG1Bc4A=="],
|
||||||
|
|
||||||
"@types/update-notifier": ["@types/update-notifier@6.0.8", "", { "dependencies": { "@types/configstore": "*", "boxen": "^7.1.1" } }, "sha512-IlDFnfSVfYQD+cKIg63DEXn3RFmd7W1iYtKQsJodcHK9R1yr8aKbKaPKfBxzPpcHCq2DU8zUq4PIPmy19Thjfg=="],
|
|
||||||
|
|
||||||
"@types/yauzl": ["@types/yauzl@2.10.3", "", { "dependencies": { "@types/node": "*" } }, "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q=="],
|
"@types/yauzl": ["@types/yauzl@2.10.3", "", { "dependencies": { "@types/node": "*" } }, "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q=="],
|
||||||
|
|
||||||
"@types/yazl": ["@types/yazl@2.4.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-/ifFjQtcKaoZOjl5NNCQRR0fAKafB3Foxd7J/WvFPTMea46zekapcR30uzkwIkKAAuq5T6d0dkwz754RFH27hg=="],
|
"@types/yazl": ["@types/yazl@2.4.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-/ifFjQtcKaoZOjl5NNCQRR0fAKafB3Foxd7J/WvFPTMea46zekapcR30uzkwIkKAAuq5T6d0dkwz754RFH27hg=="],
|
||||||
@@ -203,8 +201,6 @@
|
|||||||
|
|
||||||
"@xmldom/xmldom": ["@xmldom/xmldom@0.8.10", "", {}, "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw=="],
|
"@xmldom/xmldom": ["@xmldom/xmldom@0.8.10", "", {}, "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw=="],
|
||||||
|
|
||||||
"ansi-align": ["ansi-align@3.0.1", "", { "dependencies": { "string-width": "^4.1.0" } }, "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w=="],
|
|
||||||
|
|
||||||
"ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
|
"ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
|
||||||
|
|
||||||
"ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
"ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
||||||
@@ -237,8 +233,6 @@
|
|||||||
|
|
||||||
"bin-version-check": ["bin-version-check@5.1.0", "", { "dependencies": { "bin-version": "^6.0.0", "semver": "^7.5.3", "semver-truncate": "^3.0.0" } }, "sha512-bYsvMqJ8yNGILLz1KP9zKLzQ6YpljV3ln1gqhuLkUtyfGi3qXKGuK2p+U4NAvjVFzDFiBBtOpCOSFNuYYEGZ5g=="],
|
"bin-version-check": ["bin-version-check@5.1.0", "", { "dependencies": { "bin-version": "^6.0.0", "semver": "^7.5.3", "semver-truncate": "^3.0.0" } }, "sha512-bYsvMqJ8yNGILLz1KP9zKLzQ6YpljV3ln1gqhuLkUtyfGi3qXKGuK2p+U4NAvjVFzDFiBBtOpCOSFNuYYEGZ5g=="],
|
||||||
|
|
||||||
"boxen": ["boxen@7.1.1", "", { "dependencies": { "ansi-align": "^3.0.1", "camelcase": "^7.0.1", "chalk": "^5.2.0", "cli-boxes": "^3.0.0", "string-width": "^5.1.2", "type-fest": "^2.13.0", "widest-line": "^4.0.1", "wrap-ansi": "^8.1.0" } }, "sha512-2hCgjEmP8YLWQ130n2FerGv7rYpfBmnmp9Uy2Le1vge6X3gZIfSmEzP5QTDElFxcvVcXlEn8Aq6MU/PZygIOog=="],
|
|
||||||
|
|
||||||
"bplist-parser": ["bplist-parser@0.3.2", "", { "dependencies": { "big-integer": "1.6.x" } }, "sha512-apC2+fspHGI3mMKj+dGevkGo/tCqVB8jMb6i+OX+E29p0Iposz07fABkRIfVUPNd5A5VbuOz1bZbnmkKLYF+wQ=="],
|
"bplist-parser": ["bplist-parser@0.3.2", "", { "dependencies": { "big-integer": "1.6.x" } }, "sha512-apC2+fspHGI3mMKj+dGevkGo/tCqVB8jMb6i+OX+E29p0Iposz07fABkRIfVUPNd5A5VbuOz1bZbnmkKLYF+wQ=="],
|
||||||
|
|
||||||
"brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="],
|
"brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="],
|
||||||
@@ -263,30 +257,20 @@
|
|||||||
|
|
||||||
"call-bind-apply-helpers": ["call-bind-apply-helpers@1.0.2", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" } }, "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ=="],
|
"call-bind-apply-helpers": ["call-bind-apply-helpers@1.0.2", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" } }, "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ=="],
|
||||||
|
|
||||||
"camelcase": ["camelcase@7.0.1", "", {}, "sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw=="],
|
"camelcase": ["camelcase@5.3.1", "", {}, "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="],
|
||||||
|
|
||||||
"cgbi-to-png": ["cgbi-to-png@1.0.7", "", { "dependencies": { "bufferpack": "0.0.6", "crc": "^3.3.0", "stream-to-buffer": "^0.1.0", "streamifier": "^0.1.1" } }, "sha512-YR80kxTPuq9oRpZUdQmNEQWrmTKLINk1cfLVfyrV7Rfr9KLtLJdcockPKbreIr4JYAq+DhHBR7w+WA/tF5VDaQ=="],
|
"cgbi-to-png": ["cgbi-to-png@1.0.7", "", { "dependencies": { "bufferpack": "0.0.6", "crc": "^3.3.0", "stream-to-buffer": "^0.1.0", "streamifier": "^0.1.1" } }, "sha512-YR80kxTPuq9oRpZUdQmNEQWrmTKLINk1cfLVfyrV7Rfr9KLtLJdcockPKbreIr4JYAq+DhHBR7w+WA/tF5VDaQ=="],
|
||||||
|
|
||||||
"chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
|
"chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
|
||||||
|
|
||||||
"ci-info": ["ci-info@2.0.0", "", {}, "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ=="],
|
|
||||||
|
|
||||||
"clean-git-ref": ["clean-git-ref@2.0.1", "", {}, "sha512-bLSptAy2P0s6hU4PzuIMKmMJJSE6gLXGH1cntDu7bWJUksvuM+7ReOK61mozULErYvP6a15rnYl0zFDef+pyPw=="],
|
"clean-git-ref": ["clean-git-ref@2.0.1", "", {}, "sha512-bLSptAy2P0s6hU4PzuIMKmMJJSE6gLXGH1cntDu7bWJUksvuM+7ReOK61mozULErYvP6a15rnYl0zFDef+pyPw=="],
|
||||||
|
|
||||||
"cli-arguments": ["cli-arguments@0.2.1", "", {}, "sha512-vaoTjiREjxKlpTNMiaJUkQnYRhgui8r+huhB6mMHcGQyz5F7Hd1o1jsW9C/wRKjlNYQ6fTvODLtZe7DxfEIz8g=="],
|
"cli-arguments": ["cli-arguments@0.2.1", "", {}, "sha512-vaoTjiREjxKlpTNMiaJUkQnYRhgui8r+huhB6mMHcGQyz5F7Hd1o1jsW9C/wRKjlNYQ6fTvODLtZe7DxfEIz8g=="],
|
||||||
|
|
||||||
"cli-boxes": ["cli-boxes@3.0.0", "", {}, "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g=="],
|
|
||||||
|
|
||||||
"cli-cursor": ["cli-cursor@5.0.0", "", { "dependencies": { "restore-cursor": "^5.0.0" } }, "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw=="],
|
|
||||||
|
|
||||||
"cli-spinners": ["cli-spinners@2.9.2", "", {}, "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg=="],
|
|
||||||
|
|
||||||
"cliui": ["cliui@8.0.1", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="],
|
"cliui": ["cliui@8.0.1", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="],
|
||||||
|
|
||||||
"clone": ["clone@1.0.4", "", {}, "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg=="],
|
"clone": ["clone@1.0.4", "", {}, "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg=="],
|
||||||
|
|
||||||
"clone-response": ["clone-response@1.0.3", "", { "dependencies": { "mimic-response": "^1.0.0" } }, "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA=="],
|
|
||||||
|
|
||||||
"color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="],
|
"color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="],
|
||||||
|
|
||||||
"color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
|
"color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
|
||||||
@@ -299,8 +283,6 @@
|
|||||||
|
|
||||||
"config-chain": ["config-chain@1.1.13", "", { "dependencies": { "ini": "^1.3.4", "proto-list": "~1.2.1" } }, "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ=="],
|
"config-chain": ["config-chain@1.1.13", "", { "dependencies": { "ini": "^1.3.4", "proto-list": "~1.2.1" } }, "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ=="],
|
||||||
|
|
||||||
"configstore": ["configstore@5.0.1", "", { "dependencies": { "dot-prop": "^5.2.0", "graceful-fs": "^4.1.2", "make-dir": "^3.0.0", "unique-string": "^2.0.0", "write-file-atomic": "^3.0.0", "xdg-basedir": "^4.0.0" } }, "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA=="],
|
|
||||||
|
|
||||||
"content-disposition": ["content-disposition@0.5.4", "", { "dependencies": { "safe-buffer": "5.2.1" } }, "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ=="],
|
"content-disposition": ["content-disposition@0.5.4", "", { "dependencies": { "safe-buffer": "5.2.1" } }, "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ=="],
|
||||||
|
|
||||||
"crc": ["crc@3.8.0", "", { "dependencies": { "buffer": "^5.1.0" } }, "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ=="],
|
"crc": ["crc@3.8.0", "", { "dependencies": { "buffer": "^5.1.0" } }, "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ=="],
|
||||||
@@ -309,8 +291,6 @@
|
|||||||
|
|
||||||
"cross-spawn": ["cross-spawn@7.0.3", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w=="],
|
"cross-spawn": ["cross-spawn@7.0.3", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w=="],
|
||||||
|
|
||||||
"crypto-random-string": ["crypto-random-string@2.0.0", "", {}, "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA=="],
|
|
||||||
|
|
||||||
"csv": ["csv@5.5.3", "", { "dependencies": { "csv-generate": "^3.4.3", "csv-parse": "^4.16.3", "csv-stringify": "^5.6.5", "stream-transform": "^2.1.3" } }, "sha512-QTaY0XjjhTQOdguARF0lGKm5/mEq9PD9/VhZZegHDIBq2tQwgNpHc3dneD4mGo2iJs+fTKv5Bp0fZ+BRuY3Z0g=="],
|
"csv": ["csv@5.5.3", "", { "dependencies": { "csv-generate": "^3.4.3", "csv-parse": "^4.16.3", "csv-stringify": "^5.6.5", "stream-transform": "^2.1.3" } }, "sha512-QTaY0XjjhTQOdguARF0lGKm5/mEq9PD9/VhZZegHDIBq2tQwgNpHc3dneD4mGo2iJs+fTKv5Bp0fZ+BRuY3Z0g=="],
|
||||||
|
|
||||||
"csv-generate": ["csv-generate@3.4.3", "", {}, "sha512-w/T+rqR0vwvHqWs/1ZyMDWtHHSJaN06klRqJXBEpDJaM/+dZkso0OKh1VcuuYvK3XM53KysVNq8Ko/epCK8wOw=="],
|
"csv-generate": ["csv-generate@3.4.3", "", {}, "sha512-w/T+rqR0vwvHqWs/1ZyMDWtHHSJaN06klRqJXBEpDJaM/+dZkso0OKh1VcuuYvK3XM53KysVNq8Ko/epCK8wOw=="],
|
||||||
@@ -329,8 +309,6 @@
|
|||||||
|
|
||||||
"decompress-response": ["decompress-response@6.0.0", "", { "dependencies": { "mimic-response": "^3.1.0" } }, "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ=="],
|
"decompress-response": ["decompress-response@6.0.0", "", { "dependencies": { "mimic-response": "^3.1.0" } }, "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ=="],
|
||||||
|
|
||||||
"deep-extend": ["deep-extend@0.6.0", "", {}, "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="],
|
|
||||||
|
|
||||||
"defaults": ["defaults@1.0.4", "", { "dependencies": { "clone": "^1.0.2" } }, "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A=="],
|
"defaults": ["defaults@1.0.4", "", { "dependencies": { "clone": "^1.0.2" } }, "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A=="],
|
||||||
|
|
||||||
"defer-to-connect": ["defer-to-connect@2.0.1", "", {}, "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg=="],
|
"defer-to-connect": ["defer-to-connect@2.0.1", "", {}, "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg=="],
|
||||||
@@ -343,17 +321,9 @@
|
|||||||
|
|
||||||
"diff3": ["diff3@0.0.3", "", {}, "sha512-iSq8ngPOt0K53A6eVr4d5Kn6GNrM2nQZtC740pzIriHtn4pOQ2lyzEXQMBeVcWERN0ye7fhBsk9PbLLQOnUx/g=="],
|
"diff3": ["diff3@0.0.3", "", {}, "sha512-iSq8ngPOt0K53A6eVr4d5Kn6GNrM2nQZtC740pzIriHtn4pOQ2lyzEXQMBeVcWERN0ye7fhBsk9PbLLQOnUx/g=="],
|
||||||
|
|
||||||
"dot-prop": ["dot-prop@5.3.0", "", { "dependencies": { "is-obj": "^2.0.0" } }, "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q=="],
|
|
||||||
|
|
||||||
"dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
|
"dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
|
||||||
|
|
||||||
"duplexer3": ["duplexer3@0.1.5", "", {}, "sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA=="],
|
"emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
|
||||||
|
|
||||||
"eastasianwidth": ["eastasianwidth@0.2.0", "", {}, "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="],
|
|
||||||
|
|
||||||
"emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
|
|
||||||
|
|
||||||
"end-of-stream": ["end-of-stream@1.4.4", "", { "dependencies": { "once": "^1.4.0" } }, "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q=="],
|
|
||||||
|
|
||||||
"es-abstract": ["es-abstract@1.23.3", "", { "dependencies": { "array-buffer-byte-length": "^1.0.1", "arraybuffer.prototype.slice": "^1.0.3", "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.7", "data-view-buffer": "^1.0.1", "data-view-byte-length": "^1.0.1", "data-view-byte-offset": "^1.0.0", "es-define-property": "^1.0.0", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", "es-set-tostringtag": "^2.0.3", "es-to-primitive": "^1.2.1", "function.prototype.name": "^1.1.6", "get-intrinsic": "^1.2.4", "get-symbol-description": "^1.0.2", "globalthis": "^1.0.3", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.2", "has-proto": "^1.0.3", "has-symbols": "^1.0.3", "hasown": "^2.0.2", "internal-slot": "^1.0.7", "is-array-buffer": "^3.0.4", "is-callable": "^1.2.7", "is-data-view": "^1.0.1", "is-negative-zero": "^2.0.3", "is-regex": "^1.1.4", "is-shared-array-buffer": "^1.0.3", "is-string": "^1.0.7", "is-typed-array": "^1.1.13", "is-weakref": "^1.0.2", "object-inspect": "^1.13.1", "object-keys": "^1.1.1", "object.assign": "^4.1.5", "regexp.prototype.flags": "^1.5.2", "safe-array-concat": "^1.1.2", "safe-regex-test": "^1.0.3", "string.prototype.trim": "^1.2.9", "string.prototype.trimend": "^1.0.8", "string.prototype.trimstart": "^1.0.8", "typed-array-buffer": "^1.0.2", "typed-array-byte-length": "^1.0.1", "typed-array-byte-offset": "^1.0.2", "typed-array-length": "^1.0.6", "unbox-primitive": "^1.0.2", "which-typed-array": "^1.1.15" } }, "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A=="],
|
"es-abstract": ["es-abstract@1.23.3", "", { "dependencies": { "array-buffer-byte-length": "^1.0.1", "arraybuffer.prototype.slice": "^1.0.3", "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.7", "data-view-buffer": "^1.0.1", "data-view-byte-length": "^1.0.1", "data-view-byte-offset": "^1.0.0", "es-define-property": "^1.0.0", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", "es-set-tostringtag": "^2.0.3", "es-to-primitive": "^1.2.1", "function.prototype.name": "^1.1.6", "get-intrinsic": "^1.2.4", "get-symbol-description": "^1.0.2", "globalthis": "^1.0.3", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.2", "has-proto": "^1.0.3", "has-symbols": "^1.0.3", "hasown": "^2.0.2", "internal-slot": "^1.0.7", "is-array-buffer": "^3.0.4", "is-callable": "^1.2.7", "is-data-view": "^1.0.1", "is-negative-zero": "^2.0.3", "is-regex": "^1.1.4", "is-shared-array-buffer": "^1.0.3", "is-string": "^1.0.7", "is-typed-array": "^1.1.13", "is-weakref": "^1.0.2", "object-inspect": "^1.13.1", "object-keys": "^1.1.1", "object.assign": "^4.1.5", "regexp.prototype.flags": "^1.5.2", "safe-array-concat": "^1.1.2", "safe-regex-test": "^1.0.3", "string.prototype.trim": "^1.2.9", "string.prototype.trimend": "^1.0.8", "string.prototype.trimstart": "^1.0.8", "typed-array-buffer": "^1.0.2", "typed-array-byte-length": "^1.0.1", "typed-array-byte-offset": "^1.0.2", "typed-array-length": "^1.0.6", "unbox-primitive": "^1.0.2", "which-typed-array": "^1.1.15" } }, "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A=="],
|
||||||
|
|
||||||
@@ -371,8 +341,6 @@
|
|||||||
|
|
||||||
"escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="],
|
"escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="],
|
||||||
|
|
||||||
"escape-goat": ["escape-goat@2.1.1", "", {}, "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q=="],
|
|
||||||
|
|
||||||
"execa": ["execa@5.1.1", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", "human-signals": "^2.1.0", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.1", "onetime": "^5.1.2", "signal-exit": "^3.0.3", "strip-final-newline": "^2.0.0" } }, "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg=="],
|
"execa": ["execa@5.1.1", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", "human-signals": "^2.1.0", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.1", "onetime": "^5.1.2", "signal-exit": "^3.0.3", "strip-final-newline": "^2.0.0" } }, "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg=="],
|
||||||
|
|
||||||
"ext-list": ["ext-list@2.2.2", "", { "dependencies": { "mime-db": "^1.28.0" } }, "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA=="],
|
"ext-list": ["ext-list@2.2.2", "", { "dependencies": { "mime-db": "^1.28.0" } }, "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA=="],
|
||||||
@@ -417,8 +385,6 @@
|
|||||||
|
|
||||||
"get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="],
|
"get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="],
|
||||||
|
|
||||||
"get-east-asian-width": ["get-east-asian-width@1.3.0", "", {}, "sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ=="],
|
|
||||||
|
|
||||||
"get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="],
|
"get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="],
|
||||||
|
|
||||||
"get-proto": ["get-proto@1.0.1", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g=="],
|
"get-proto": ["get-proto@1.0.1", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g=="],
|
||||||
@@ -429,7 +395,7 @@
|
|||||||
|
|
||||||
"glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
|
"glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
|
||||||
|
|
||||||
"global-dirs": ["global-dirs@3.0.1", "", { "dependencies": { "ini": "2.0.0" } }, "sha512-NBcGGFbBA9s1VzD41QXDG+3++t9Mn5t1FpLdhESY6oKY4gYTFpX4wO3sqGUa0Srjtbfj3szX0RnemmrVRUdULA=="],
|
"global-dirs": ["global-dirs@4.0.0", "", { "dependencies": { "ini": "2.0.0" } }, "sha512-PJ0OjGf/kVuu9gh5IPgAyssfJne5PsU9+ICxfWiRYDUnYq8ob+Y2nSWAEUNEHRj+gowyzI+wg5/nWkvcjcyLwg=="],
|
||||||
|
|
||||||
"globalthis": ["globalthis@1.0.4", "", { "dependencies": { "define-properties": "^1.2.1", "gopd": "^1.0.1" } }, "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ=="],
|
"globalthis": ["globalthis@1.0.4", "", { "dependencies": { "define-properties": "^1.2.1", "gopd": "^1.0.1" } }, "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ=="],
|
||||||
|
|
||||||
@@ -455,8 +421,6 @@
|
|||||||
|
|
||||||
"has-tostringtag": ["has-tostringtag@1.0.2", "", { "dependencies": { "has-symbols": "^1.0.3" } }, "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw=="],
|
"has-tostringtag": ["has-tostringtag@1.0.2", "", { "dependencies": { "has-symbols": "^1.0.3" } }, "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw=="],
|
||||||
|
|
||||||
"has-yarn": ["has-yarn@2.1.0", "", {}, "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw=="],
|
|
||||||
|
|
||||||
"hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="],
|
"hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="],
|
||||||
|
|
||||||
"http-cache-semantics": ["http-cache-semantics@4.1.1", "", {}, "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ=="],
|
"http-cache-semantics": ["http-cache-semantics@4.1.1", "", {}, "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ=="],
|
||||||
@@ -471,10 +435,6 @@
|
|||||||
|
|
||||||
"ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="],
|
"ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="],
|
||||||
|
|
||||||
"import-lazy": ["import-lazy@2.1.0", "", {}, "sha512-m7ZEHgtw69qOGw+jwxXkHlrlIPdTGkyh66zXZ1ajZbxkDBNjSY/LGbmjc7h0s2ELsUDTAhFr55TrPSSqJGPG0A=="],
|
|
||||||
|
|
||||||
"imurmurhash": ["imurmurhash@0.1.4", "", {}, "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="],
|
|
||||||
|
|
||||||
"inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
|
"inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
|
||||||
|
|
||||||
"ini": ["ini@2.0.0", "", {}, "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA=="],
|
"ini": ["ini@2.0.0", "", {}, "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA=="],
|
||||||
@@ -491,8 +451,6 @@
|
|||||||
|
|
||||||
"is-callable": ["is-callable@1.2.7", "", {}, "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA=="],
|
"is-callable": ["is-callable@1.2.7", "", {}, "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA=="],
|
||||||
|
|
||||||
"is-ci": ["is-ci@2.0.0", "", { "dependencies": { "ci-info": "^2.0.0" }, "bin": { "is-ci": "bin.js" } }, "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w=="],
|
|
||||||
|
|
||||||
"is-data-view": ["is-data-view@1.0.1", "", { "dependencies": { "is-typed-array": "^1.1.13" } }, "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w=="],
|
"is-data-view": ["is-data-view@1.0.1", "", { "dependencies": { "is-typed-array": "^1.1.13" } }, "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w=="],
|
||||||
|
|
||||||
"is-date-object": ["is-date-object@1.0.5", "", { "dependencies": { "has-tostringtag": "^1.0.0" } }, "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ=="],
|
"is-date-object": ["is-date-object@1.0.5", "", { "dependencies": { "has-tostringtag": "^1.0.0" } }, "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ=="],
|
||||||
@@ -503,22 +461,12 @@
|
|||||||
|
|
||||||
"is-glob": ["is-glob@4.0.3", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="],
|
"is-glob": ["is-glob@4.0.3", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="],
|
||||||
|
|
||||||
"is-installed-globally": ["is-installed-globally@0.4.0", "", { "dependencies": { "global-dirs": "^3.0.0", "is-path-inside": "^3.0.2" } }, "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ=="],
|
|
||||||
|
|
||||||
"is-interactive": ["is-interactive@2.0.0", "", {}, "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ=="],
|
|
||||||
|
|
||||||
"is-negative-zero": ["is-negative-zero@2.0.3", "", {}, "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw=="],
|
"is-negative-zero": ["is-negative-zero@2.0.3", "", {}, "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw=="],
|
||||||
|
|
||||||
"is-npm": ["is-npm@5.0.0", "", {}, "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA=="],
|
|
||||||
|
|
||||||
"is-number": ["is-number@7.0.0", "", {}, "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="],
|
"is-number": ["is-number@7.0.0", "", {}, "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="],
|
||||||
|
|
||||||
"is-number-object": ["is-number-object@1.0.7", "", { "dependencies": { "has-tostringtag": "^1.0.0" } }, "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ=="],
|
"is-number-object": ["is-number-object@1.0.7", "", { "dependencies": { "has-tostringtag": "^1.0.0" } }, "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ=="],
|
||||||
|
|
||||||
"is-obj": ["is-obj@2.0.0", "", {}, "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w=="],
|
|
||||||
|
|
||||||
"is-path-inside": ["is-path-inside@3.0.3", "", {}, "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ=="],
|
|
||||||
|
|
||||||
"is-plain-obj": ["is-plain-obj@1.1.0", "", {}, "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg=="],
|
"is-plain-obj": ["is-plain-obj@1.1.0", "", {}, "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg=="],
|
||||||
|
|
||||||
"is-regex": ["is-regex@1.1.4", "", { "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" } }, "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg=="],
|
"is-regex": ["is-regex@1.1.4", "", { "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" } }, "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg=="],
|
||||||
@@ -533,19 +481,13 @@
|
|||||||
|
|
||||||
"is-typed-array": ["is-typed-array@1.1.13", "", { "dependencies": { "which-typed-array": "^1.1.14" } }, "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw=="],
|
"is-typed-array": ["is-typed-array@1.1.13", "", { "dependencies": { "which-typed-array": "^1.1.14" } }, "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw=="],
|
||||||
|
|
||||||
"is-typedarray": ["is-typedarray@1.0.0", "", {}, "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA=="],
|
|
||||||
|
|
||||||
"is-unicode-supported": ["is-unicode-supported@2.1.0", "", {}, "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ=="],
|
|
||||||
|
|
||||||
"is-weakref": ["is-weakref@1.0.2", "", { "dependencies": { "call-bind": "^1.0.2" } }, "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ=="],
|
"is-weakref": ["is-weakref@1.0.2", "", { "dependencies": { "call-bind": "^1.0.2" } }, "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ=="],
|
||||||
|
|
||||||
"is-yarn-global": ["is-yarn-global@0.3.0", "", {}, "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw=="],
|
|
||||||
|
|
||||||
"isarray": ["isarray@2.0.5", "", {}, "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="],
|
"isarray": ["isarray@2.0.5", "", {}, "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="],
|
||||||
|
|
||||||
"isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
|
"isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
|
||||||
|
|
||||||
"isomorphic-git": ["isomorphic-git@1.29.0", "", { "dependencies": { "async-lock": "^1.4.1", "clean-git-ref": "^2.0.1", "crc-32": "^1.2.0", "diff3": "0.0.3", "ignore": "^5.1.4", "minimisted": "^2.0.0", "pako": "^1.0.10", "path-browserify": "^1.0.1", "pify": "^4.0.1", "readable-stream": "^3.4.0", "sha.js": "^2.4.9", "simple-get": "^4.0.1" }, "bin": { "isogit": "cli.cjs" } }, "sha512-zWGqk8901cicvVEhVpN76AwKrS/TzHak2NQCtNXIAavpMIy/yqh+d/JtC9A8AUKZAauUdOyEWKI29tuCLAL+Zg=="],
|
"isomorphic-git": ["isomorphic-git@1.30.1", "", { "dependencies": { "async-lock": "^1.4.1", "clean-git-ref": "^2.0.1", "crc-32": "^1.2.0", "diff3": "0.0.3", "ignore": "^5.1.4", "minimisted": "^2.0.0", "pako": "^1.0.10", "path-browserify": "^1.0.1", "pify": "^4.0.1", "readable-stream": "^3.4.0", "sha.js": "^2.4.9", "simple-get": "^4.0.1" }, "bin": { "isogit": "cli.cjs" } }, "sha512-eWBlPIPDOctGY/bTUc/whs6EZ8YvnG1H2kOjTCJ/AkvBWUzODXcfulhpiA8Y4Px9e+bRYYkifE5fSE8FcRk8Ew=="],
|
||||||
|
|
||||||
"isomorphic-unzip": ["isomorphic-unzip@1.1.5", "", { "dependencies": { "buffer": "^5.0.7", "yauzl": "^2.8.0" } }, "sha512-2McA51lWhmO3Kk438jxVcYeh6L+AOqVnl9XdX1yI7GlLA9RwEyTBgGem1rNuRIU2abAmOiv+IagThdUxASY4IA=="],
|
"isomorphic-unzip": ["isomorphic-unzip@1.1.5", "", { "dependencies": { "buffer": "^5.0.7", "yauzl": "^2.8.0" } }, "sha512-2McA51lWhmO3Kk438jxVcYeh6L+AOqVnl9XdX1yI7GlLA9RwEyTBgGem1rNuRIU2abAmOiv+IagThdUxASY4IA=="],
|
||||||
|
|
||||||
@@ -559,19 +501,15 @@
|
|||||||
|
|
||||||
"kleur": ["kleur@4.1.5", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="],
|
"kleur": ["kleur@4.1.5", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="],
|
||||||
|
|
||||||
"latest-version": ["latest-version@5.1.0", "", { "dependencies": { "package-json": "^6.3.0" } }, "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA=="],
|
|
||||||
|
|
||||||
"locate-path": ["locate-path@5.0.0", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="],
|
"locate-path": ["locate-path@5.0.0", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="],
|
||||||
|
|
||||||
"lodash.merge": ["lodash.merge@4.6.2", "", {}, "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="],
|
"lodash.merge": ["lodash.merge@4.6.2", "", {}, "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="],
|
||||||
|
|
||||||
"log-symbols": ["log-symbols@6.0.0", "", { "dependencies": { "chalk": "^5.3.0", "is-unicode-supported": "^1.3.0" } }, "sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw=="],
|
|
||||||
|
|
||||||
"long": ["long@3.2.0", "", {}, "sha512-ZYvPPOMqUwPoDsbJaR10iQJYnMuZhRTvHYl62ErLIEX7RgFlziSBUUvrt3OVfc47QlHHpzPZYP17g3Fv7oeJkg=="],
|
"long": ["long@3.2.0", "", {}, "sha512-ZYvPPOMqUwPoDsbJaR10iQJYnMuZhRTvHYl62ErLIEX7RgFlziSBUUvrt3OVfc47QlHHpzPZYP17g3Fv7oeJkg=="],
|
||||||
|
|
||||||
"lowercase-keys": ["lowercase-keys@3.0.0", "", {}, "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ=="],
|
"lowercase-keys": ["lowercase-keys@3.0.0", "", {}, "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ=="],
|
||||||
|
|
||||||
"make-dir": ["make-dir@3.1.0", "", { "dependencies": { "semver": "^6.0.0" } }, "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw=="],
|
"make-dir": ["make-dir@4.0.0", "", { "dependencies": { "semver": "^7.5.3" } }, "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw=="],
|
||||||
|
|
||||||
"math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
|
"math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
|
||||||
|
|
||||||
@@ -587,8 +525,6 @@
|
|||||||
|
|
||||||
"mimic-fn": ["mimic-fn@2.1.0", "", {}, "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="],
|
"mimic-fn": ["mimic-fn@2.1.0", "", {}, "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="],
|
||||||
|
|
||||||
"mimic-function": ["mimic-function@5.0.1", "", {}, "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA=="],
|
|
||||||
|
|
||||||
"mimic-response": ["mimic-response@3.1.0", "", {}, "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="],
|
"mimic-response": ["mimic-response@3.1.0", "", {}, "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="],
|
||||||
|
|
||||||
"minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="],
|
"minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="],
|
||||||
@@ -617,8 +553,6 @@
|
|||||||
|
|
||||||
"onetime": ["onetime@5.1.2", "", { "dependencies": { "mimic-fn": "^2.1.0" } }, "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg=="],
|
"onetime": ["onetime@5.1.2", "", { "dependencies": { "mimic-fn": "^2.1.0" } }, "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg=="],
|
||||||
|
|
||||||
"ora": ["ora@8.2.0", "", { "dependencies": { "chalk": "^5.3.0", "cli-cursor": "^5.0.0", "cli-spinners": "^2.9.2", "is-interactive": "^2.0.0", "is-unicode-supported": "^2.0.0", "log-symbols": "^6.0.0", "stdin-discarder": "^0.2.2", "string-width": "^7.2.0", "strip-ansi": "^7.1.0" } }, "sha512-weP+BZ8MVNnlCm8c0Qdc1WSWq4Qn7I+9CJGm7Qali6g44e/PUzbjNqJX5NJ9ljlNMosfJvg1fKEGILklK9cwnw=="],
|
|
||||||
|
|
||||||
"p-cancelable": ["p-cancelable@3.0.0", "", {}, "sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw=="],
|
"p-cancelable": ["p-cancelable@3.0.0", "", {}, "sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw=="],
|
||||||
|
|
||||||
"p-limit": ["p-limit@2.3.0", "", { "dependencies": { "p-try": "^2.0.0" } }, "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="],
|
"p-limit": ["p-limit@2.3.0", "", { "dependencies": { "p-try": "^2.0.0" } }, "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="],
|
||||||
@@ -627,8 +561,6 @@
|
|||||||
|
|
||||||
"p-try": ["p-try@2.2.0", "", {}, "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="],
|
"p-try": ["p-try@2.2.0", "", {}, "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="],
|
||||||
|
|
||||||
"package-json": ["package-json@6.5.0", "", { "dependencies": { "got": "^9.6.0", "registry-auth-token": "^4.0.0", "registry-url": "^5.0.0", "semver": "^6.2.0" } }, "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ=="],
|
|
||||||
|
|
||||||
"pako": ["pako@1.0.11", "", {}, "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="],
|
"pako": ["pako@1.0.11", "", {}, "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="],
|
||||||
|
|
||||||
"path-browserify": ["path-browserify@1.0.1", "", {}, "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g=="],
|
"path-browserify": ["path-browserify@1.0.1", "", {}, "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g=="],
|
||||||
@@ -651,26 +583,18 @@
|
|||||||
|
|
||||||
"possible-typed-array-names": ["possible-typed-array-names@1.0.0", "", {}, "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q=="],
|
"possible-typed-array-names": ["possible-typed-array-names@1.0.0", "", {}, "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q=="],
|
||||||
|
|
||||||
"prepend-http": ["prepend-http@2.0.0", "", {}, "sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA=="],
|
|
||||||
|
|
||||||
"progress": ["progress@2.0.3", "", {}, "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA=="],
|
"progress": ["progress@2.0.3", "", {}, "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA=="],
|
||||||
|
|
||||||
"properties": ["properties@1.2.1", "", {}, "sha512-qYNxyMj1JeW54i/EWEFsM1cVwxJbtgPp8+0Wg9XjNaK6VE/c4oRi6PNu5p7w1mNXEIQIjV5Wwn8v8Gz82/QzdQ=="],
|
"properties": ["properties@1.2.1", "", {}, "sha512-qYNxyMj1JeW54i/EWEFsM1cVwxJbtgPp8+0Wg9XjNaK6VE/c4oRi6PNu5p7w1mNXEIQIjV5Wwn8v8Gz82/QzdQ=="],
|
||||||
|
|
||||||
"proto-list": ["proto-list@1.2.4", "", {}, "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA=="],
|
"proto-list": ["proto-list@1.2.4", "", {}, "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA=="],
|
||||||
|
|
||||||
"pump": ["pump@3.0.2", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw=="],
|
|
||||||
|
|
||||||
"pupa": ["pupa@2.1.1", "", { "dependencies": { "escape-goat": "^2.0.0" } }, "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A=="],
|
|
||||||
|
|
||||||
"queue-microtask": ["queue-microtask@1.2.3", "", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="],
|
"queue-microtask": ["queue-microtask@1.2.3", "", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="],
|
||||||
|
|
||||||
"queue-tick": ["queue-tick@1.0.1", "", {}, "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag=="],
|
"queue-tick": ["queue-tick@1.0.1", "", {}, "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag=="],
|
||||||
|
|
||||||
"quick-lru": ["quick-lru@5.1.1", "", {}, "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA=="],
|
"quick-lru": ["quick-lru@5.1.1", "", {}, "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA=="],
|
||||||
|
|
||||||
"rc": ["rc@1.2.8", "", { "dependencies": { "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" }, "bin": { "rc": "./cli.js" } }, "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw=="],
|
|
||||||
|
|
||||||
"read": ["read@4.1.0", "", { "dependencies": { "mute-stream": "^2.0.0" } }, "sha512-uRfX6K+f+R8OOrYScaM3ixPY4erg69f8DN6pgTvMcA9iRc8iDhwrA4m3Yu8YYKsXJgVvum+m8PkRboZwwuLzYA=="],
|
"read": ["read@4.1.0", "", { "dependencies": { "mute-stream": "^2.0.0" } }, "sha512-uRfX6K+f+R8OOrYScaM3ixPY4erg69f8DN6pgTvMcA9iRc8iDhwrA4m3Yu8YYKsXJgVvum+m8PkRboZwwuLzYA=="],
|
||||||
|
|
||||||
"readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
|
"readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
|
||||||
@@ -681,8 +605,6 @@
|
|||||||
|
|
||||||
"registry-auth-token": ["registry-auth-token@5.1.0", "", { "dependencies": { "@pnpm/npm-conf": "^2.1.0" } }, "sha512-GdekYuwLXLxMuFTwAPg5UKGLW/UXzQrZvH/Zj791BQif5T05T0RsaLfHc9q3ZOKi7n+BoprPD9mJ0O0k4xzUlw=="],
|
"registry-auth-token": ["registry-auth-token@5.1.0", "", { "dependencies": { "@pnpm/npm-conf": "^2.1.0" } }, "sha512-GdekYuwLXLxMuFTwAPg5UKGLW/UXzQrZvH/Zj791BQif5T05T0RsaLfHc9q3ZOKi7n+BoprPD9mJ0O0k4xzUlw=="],
|
||||||
|
|
||||||
"registry-url": ["registry-url@5.1.0", "", { "dependencies": { "rc": "^1.2.8" } }, "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw=="],
|
|
||||||
|
|
||||||
"require-directory": ["require-directory@2.1.1", "", {}, "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="],
|
"require-directory": ["require-directory@2.1.1", "", {}, "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="],
|
||||||
|
|
||||||
"require-main-filename": ["require-main-filename@2.0.0", "", {}, "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="],
|
"require-main-filename": ["require-main-filename@2.0.0", "", {}, "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="],
|
||||||
@@ -691,8 +613,6 @@
|
|||||||
|
|
||||||
"responselike": ["responselike@3.0.0", "", { "dependencies": { "lowercase-keys": "^3.0.0" } }, "sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg=="],
|
"responselike": ["responselike@3.0.0", "", { "dependencies": { "lowercase-keys": "^3.0.0" } }, "sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg=="],
|
||||||
|
|
||||||
"restore-cursor": ["restore-cursor@5.1.0", "", { "dependencies": { "onetime": "^7.0.0", "signal-exit": "^4.1.0" } }, "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA=="],
|
|
||||||
|
|
||||||
"reusify": ["reusify@1.0.4", "", {}, "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw=="],
|
"reusify": ["reusify@1.0.4", "", {}, "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw=="],
|
||||||
|
|
||||||
"run-parallel": ["run-parallel@1.2.0", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="],
|
"run-parallel": ["run-parallel@1.2.0", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="],
|
||||||
@@ -705,9 +625,7 @@
|
|||||||
|
|
||||||
"seek-bzip": ["seek-bzip@2.0.0", "", { "dependencies": { "commander": "^6.0.0" }, "bin": { "seek-bunzip": "bin/seek-bunzip", "seek-table": "bin/seek-bzip-table" } }, "sha512-SMguiTnYrhpLdk3PwfzHeotrcwi8bNV4iemL9tx9poR/yeaMYwB9VzR1w7b57DuWpuqR8n6oZboi0hj3AxZxQg=="],
|
"seek-bzip": ["seek-bzip@2.0.0", "", { "dependencies": { "commander": "^6.0.0" }, "bin": { "seek-bunzip": "bin/seek-bunzip", "seek-table": "bin/seek-bzip-table" } }, "sha512-SMguiTnYrhpLdk3PwfzHeotrcwi8bNV4iemL9tx9poR/yeaMYwB9VzR1w7b57DuWpuqR8n6oZboi0hj3AxZxQg=="],
|
||||||
|
|
||||||
"semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="],
|
"semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="],
|
||||||
|
|
||||||
"semver-diff": ["semver-diff@3.1.1", "", { "dependencies": { "semver": "^6.3.0" } }, "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg=="],
|
|
||||||
|
|
||||||
"semver-regex": ["semver-regex@4.0.5", "", {}, "sha512-hunMQrEy1T6Jr2uEVjrAIqjwWcQTgOAcIM52C8MY1EZSD3DDNft04XzvYKPqjED65bNVVko0YI38nYeEHCX3yw=="],
|
"semver-regex": ["semver-regex@4.0.5", "", {}, "sha512-hunMQrEy1T6Jr2uEVjrAIqjwWcQTgOAcIM52C8MY1EZSD3DDNft04XzvYKPqjED65bNVVko0YI38nYeEHCX3yw=="],
|
||||||
|
|
||||||
@@ -743,8 +661,6 @@
|
|||||||
|
|
||||||
"source-map": ["source-map@0.7.4", "", {}, "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA=="],
|
"source-map": ["source-map@0.7.4", "", {}, "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA=="],
|
||||||
|
|
||||||
"stdin-discarder": ["stdin-discarder@0.2.2", "", {}, "sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ=="],
|
|
||||||
|
|
||||||
"stream-to": ["stream-to@0.2.2", "", {}, "sha512-Kg1BSDTwgGiVMtTCJNlo7kk/xzL33ZuZveEBRt6rXw+f1WLK/8kmz2NVCT/Qnv0JkV85JOHcLhD82mnXsR3kPw=="],
|
"stream-to": ["stream-to@0.2.2", "", {}, "sha512-Kg1BSDTwgGiVMtTCJNlo7kk/xzL33ZuZveEBRt6rXw+f1WLK/8kmz2NVCT/Qnv0JkV85JOHcLhD82mnXsR3kPw=="],
|
||||||
|
|
||||||
"stream-to-buffer": ["stream-to-buffer@0.1.0", "", { "dependencies": { "stream-to": "~0.2.0" } }, "sha512-Da4WoKaZyu3nf+bIdIifh7IPkFjARBnBK+pYqn0EUJqksjV9afojjaCCHUemH30Jmu7T2qcKvlZm2ykN38uzaw=="],
|
"stream-to-buffer": ["stream-to-buffer@0.1.0", "", { "dependencies": { "stream-to": "~0.2.0" } }, "sha512-Da4WoKaZyu3nf+bIdIifh7IPkFjARBnBK+pYqn0EUJqksjV9afojjaCCHUemH30Jmu7T2qcKvlZm2ykN38uzaw=="],
|
||||||
@@ -755,7 +671,7 @@
|
|||||||
|
|
||||||
"streamx": ["streamx@2.20.2", "", { "dependencies": { "fast-fifo": "^1.3.2", "queue-tick": "^1.0.1", "text-decoder": "^1.1.0" }, "optionalDependencies": { "bare-events": "^2.2.0" } }, "sha512-aDGDLU+j9tJcUdPGOaHmVF1u/hhI+CsGkT02V3OKlHDV7IukOI+nTWAGkiZEKCO35rWN1wIr4tS7YFr1f4qSvA=="],
|
"streamx": ["streamx@2.20.2", "", { "dependencies": { "fast-fifo": "^1.3.2", "queue-tick": "^1.0.1", "text-decoder": "^1.1.0" }, "optionalDependencies": { "bare-events": "^2.2.0" } }, "sha512-aDGDLU+j9tJcUdPGOaHmVF1u/hhI+CsGkT02V3OKlHDV7IukOI+nTWAGkiZEKCO35rWN1wIr4tS7YFr1f4qSvA=="],
|
||||||
|
|
||||||
"string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="],
|
"string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
|
||||||
|
|
||||||
"string.prototype.trim": ["string.prototype.trim@1.2.9", "", { "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", "es-abstract": "^1.23.0", "es-object-atoms": "^1.0.0" } }, "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw=="],
|
"string.prototype.trim": ["string.prototype.trim@1.2.9", "", { "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", "es-abstract": "^1.23.0", "es-object-atoms": "^1.0.0" } }, "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw=="],
|
||||||
|
|
||||||
@@ -771,8 +687,6 @@
|
|||||||
|
|
||||||
"strip-final-newline": ["strip-final-newline@2.0.0", "", {}, "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA=="],
|
"strip-final-newline": ["strip-final-newline@2.0.0", "", {}, "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA=="],
|
||||||
|
|
||||||
"strip-json-comments": ["strip-json-comments@2.0.1", "", {}, "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ=="],
|
|
||||||
|
|
||||||
"strtok3": ["strtok3@9.0.1", "", { "dependencies": { "@tokenizer/token": "^0.3.0", "peek-readable": "^5.3.1" } }, "sha512-ERPW+XkvX9W2A+ov07iy+ZFJpVdik04GhDA4eVogiG9hpC97Kem2iucyzhFxbFRvQ5o2UckFtKZdp1hkGvnrEw=="],
|
"strtok3": ["strtok3@9.0.1", "", { "dependencies": { "@tokenizer/token": "^0.3.0", "peek-readable": "^5.3.1" } }, "sha512-ERPW+XkvX9W2A+ov07iy+ZFJpVdik04GhDA4eVogiG9hpC97Kem2iucyzhFxbFRvQ5o2UckFtKZdp1hkGvnrEw=="],
|
||||||
|
|
||||||
"supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
|
"supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
|
||||||
@@ -785,8 +699,6 @@
|
|||||||
|
|
||||||
"through": ["through@2.3.8", "", {}, "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg=="],
|
"through": ["through@2.3.8", "", {}, "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg=="],
|
||||||
|
|
||||||
"to-readable-stream": ["to-readable-stream@1.0.0", "", {}, "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q=="],
|
|
||||||
|
|
||||||
"to-regex-range": ["to-regex-range@5.0.1", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="],
|
"to-regex-range": ["to-regex-range@5.0.1", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="],
|
||||||
|
|
||||||
"token-types": ["token-types@6.0.0", "", { "dependencies": { "@tokenizer/token": "^0.3.0", "ieee754": "^1.2.1" } }, "sha512-lbDrTLVsHhOMljPscd0yitpozq7Ga2M5Cvez5AjGg8GASBjtt6iERCAJ93yommPmz62fb45oFIXHEZ3u9bfJEA=="],
|
"token-types": ["token-types@6.0.0", "", { "dependencies": { "@tokenizer/token": "^0.3.0", "ieee754": "^1.2.1" } }, "sha512-lbDrTLVsHhOMljPscd0yitpozq7Ga2M5Cvez5AjGg8GASBjtt6iERCAJ93yommPmz62fb45oFIXHEZ3u9bfJEA=="],
|
||||||
@@ -795,8 +707,6 @@
|
|||||||
|
|
||||||
"tty-table": ["tty-table@4.2.3", "", { "dependencies": { "chalk": "^4.1.2", "csv": "^5.5.3", "kleur": "^4.1.5", "smartwrap": "^2.0.2", "strip-ansi": "^6.0.1", "wcwidth": "^1.0.1", "yargs": "^17.7.1" }, "bin": { "tty-table": "adapters/terminal-adapter.js" } }, "sha512-Fs15mu0vGzCrj8fmJNP7Ynxt5J7praPXqFN0leZeZBXJwkMxv9cb2D454k1ltrtUSJbZ4yH4e0CynsHLxmUfFA=="],
|
"tty-table": ["tty-table@4.2.3", "", { "dependencies": { "chalk": "^4.1.2", "csv": "^5.5.3", "kleur": "^4.1.5", "smartwrap": "^2.0.2", "strip-ansi": "^6.0.1", "wcwidth": "^1.0.1", "yargs": "^17.7.1" }, "bin": { "tty-table": "adapters/terminal-adapter.js" } }, "sha512-Fs15mu0vGzCrj8fmJNP7Ynxt5J7praPXqFN0leZeZBXJwkMxv9cb2D454k1ltrtUSJbZ4yH4e0CynsHLxmUfFA=="],
|
||||||
|
|
||||||
"type-fest": ["type-fest@2.19.0", "", {}, "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA=="],
|
|
||||||
|
|
||||||
"typed-array-buffer": ["typed-array-buffer@1.0.2", "", { "dependencies": { "call-bind": "^1.0.7", "es-errors": "^1.3.0", "is-typed-array": "^1.1.13" } }, "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ=="],
|
"typed-array-buffer": ["typed-array-buffer@1.0.2", "", { "dependencies": { "call-bind": "^1.0.7", "es-errors": "^1.3.0", "is-typed-array": "^1.1.13" } }, "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ=="],
|
||||||
|
|
||||||
"typed-array-byte-length": ["typed-array-byte-length@1.0.1", "", { "dependencies": { "call-bind": "^1.0.7", "for-each": "^0.3.3", "gopd": "^1.0.1", "has-proto": "^1.0.3", "is-typed-array": "^1.1.13" } }, "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw=="],
|
"typed-array-byte-length": ["typed-array-byte-length@1.0.1", "", { "dependencies": { "call-bind": "^1.0.7", "for-each": "^0.3.3", "gopd": "^1.0.1", "has-proto": "^1.0.3", "is-typed-array": "^1.1.13" } }, "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw=="],
|
||||||
@@ -805,9 +715,7 @@
|
|||||||
|
|
||||||
"typed-array-length": ["typed-array-length@1.0.6", "", { "dependencies": { "call-bind": "^1.0.7", "for-each": "^0.3.3", "gopd": "^1.0.1", "has-proto": "^1.0.3", "is-typed-array": "^1.1.13", "possible-typed-array-names": "^1.0.0" } }, "sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g=="],
|
"typed-array-length": ["typed-array-length@1.0.6", "", { "dependencies": { "call-bind": "^1.0.7", "for-each": "^0.3.3", "gopd": "^1.0.1", "has-proto": "^1.0.3", "is-typed-array": "^1.1.13", "possible-typed-array-names": "^1.0.0" } }, "sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g=="],
|
||||||
|
|
||||||
"typedarray-to-buffer": ["typedarray-to-buffer@3.1.5", "", { "dependencies": { "is-typedarray": "^1.0.0" } }, "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q=="],
|
"typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
|
||||||
|
|
||||||
"typescript": ["typescript@5.8.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ=="],
|
|
||||||
|
|
||||||
"uint8array-extras": ["uint8array-extras@1.4.0", "", {}, "sha512-ZPtzy0hu4cZjv3z5NW9gfKnNLjoz4y6uv4HlelAjDK7sY/xOkKZv9xK/WQpcsBB3jEybChz9DPC2U/+cusjJVQ=="],
|
"uint8array-extras": ["uint8array-extras@1.4.0", "", {}, "sha512-ZPtzy0hu4cZjv3z5NW9gfKnNLjoz4y6uv4HlelAjDK7sY/xOkKZv9xK/WQpcsBB3jEybChz9DPC2U/+cusjJVQ=="],
|
||||||
|
|
||||||
@@ -815,16 +723,10 @@
|
|||||||
|
|
||||||
"unbzip2-stream": ["unbzip2-stream@1.4.3", "", { "dependencies": { "buffer": "^5.2.1", "through": "^2.3.8" } }, "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg=="],
|
"unbzip2-stream": ["unbzip2-stream@1.4.3", "", { "dependencies": { "buffer": "^5.2.1", "through": "^2.3.8" } }, "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg=="],
|
||||||
|
|
||||||
"undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="],
|
"undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
|
||||||
|
|
||||||
"unique-string": ["unique-string@2.0.0", "", { "dependencies": { "crypto-random-string": "^2.0.0" } }, "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg=="],
|
|
||||||
|
|
||||||
"universalify": ["universalify@0.1.2", "", {}, "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="],
|
"universalify": ["universalify@0.1.2", "", {}, "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="],
|
||||||
|
|
||||||
"update-notifier": ["update-notifier@5.1.0", "", { "dependencies": { "boxen": "^5.0.0", "chalk": "^4.1.0", "configstore": "^5.0.1", "has-yarn": "^2.1.0", "import-lazy": "^2.1.0", "is-ci": "^2.0.0", "is-installed-globally": "^0.4.0", "is-npm": "^5.0.0", "is-yarn-global": "^0.3.0", "latest-version": "^5.1.0", "pupa": "^2.1.1", "semver": "^7.3.4", "semver-diff": "^3.1.1", "xdg-basedir": "^4.0.0" } }, "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw=="],
|
|
||||||
|
|
||||||
"url-parse-lax": ["url-parse-lax@3.0.0", "", { "dependencies": { "prepend-http": "^2.0.0" } }, "sha512-NjFKA0DidqPa5ciFcSrXnAltTtzz84ogy+NebPvfEgAck0+TNg4UJ4IN+fB7zRZfbgUf0syOo9MDxFkDSMuFaQ=="],
|
|
||||||
|
|
||||||
"util-deprecate": ["util-deprecate@1.0.2", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="],
|
"util-deprecate": ["util-deprecate@1.0.2", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="],
|
||||||
|
|
||||||
"wcwidth": ["wcwidth@1.0.1", "", { "dependencies": { "defaults": "^1.0.3" } }, "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg=="],
|
"wcwidth": ["wcwidth@1.0.1", "", { "dependencies": { "defaults": "^1.0.3" } }, "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg=="],
|
||||||
@@ -841,16 +743,10 @@
|
|||||||
|
|
||||||
"which-typed-array": ["which-typed-array@1.1.15", "", { "dependencies": { "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.7", "for-each": "^0.3.3", "gopd": "^1.0.1", "has-tostringtag": "^1.0.2" } }, "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA=="],
|
"which-typed-array": ["which-typed-array@1.1.15", "", { "dependencies": { "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.7", "for-each": "^0.3.3", "gopd": "^1.0.1", "has-tostringtag": "^1.0.2" } }, "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA=="],
|
||||||
|
|
||||||
"widest-line": ["widest-line@4.0.1", "", { "dependencies": { "string-width": "^5.0.1" } }, "sha512-o0cyEG0e8GPzT4iGHphIOh0cJOV8fivsXxddQasHPHfoZf1ZexrfeA21w2NaEN1RHE+fXlfISmOE8R9N3u3Qig=="],
|
"wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="],
|
||||||
|
|
||||||
"wrap-ansi": ["wrap-ansi@8.1.0", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="],
|
|
||||||
|
|
||||||
"wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
|
"wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
|
||||||
|
|
||||||
"write-file-atomic": ["write-file-atomic@3.0.3", "", { "dependencies": { "imurmurhash": "^0.1.4", "is-typedarray": "^1.0.0", "signal-exit": "^3.0.2", "typedarray-to-buffer": "^3.1.5" } }, "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q=="],
|
|
||||||
|
|
||||||
"xdg-basedir": ["xdg-basedir@4.0.0", "", {}, "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q=="],
|
|
||||||
|
|
||||||
"xmlbuilder": ["xmlbuilder@15.1.1", "", {}, "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg=="],
|
"xmlbuilder": ["xmlbuilder@15.1.1", "", {}, "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg=="],
|
||||||
|
|
||||||
"y18n": ["y18n@5.0.8", "", {}, "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="],
|
"y18n": ["y18n@5.0.8", "", {}, "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="],
|
||||||
@@ -881,30 +777,18 @@
|
|||||||
|
|
||||||
"@types/yazl/@types/node": ["@types/node@22.9.3", "", { "dependencies": { "undici-types": "~6.19.8" } }, "sha512-F3u1fs/fce3FFk+DAxbxc78DF8x0cY09RRL8GnXLmkJ1jvx3TtPdWoTT5/NiYfI5ASqXBmfqJi9dZ3gxMx4lzw=="],
|
"@types/yazl/@types/node": ["@types/node@22.9.3", "", { "dependencies": { "undici-types": "~6.19.8" } }, "sha512-F3u1fs/fce3FFk+DAxbxc78DF8x0cY09RRL8GnXLmkJ1jvx3TtPdWoTT5/NiYfI5ASqXBmfqJi9dZ3gxMx4lzw=="],
|
||||||
|
|
||||||
"@xhmikosr/decompress/make-dir": ["make-dir@4.0.0", "", { "dependencies": { "semver": "^7.5.3" } }, "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw=="],
|
|
||||||
|
|
||||||
"@xhmikosr/downloader/defaults": ["defaults@3.0.0", "", {}, "sha512-RsqXDEAALjfRTro+IFNKpcPCt0/Cy2FqHSIlnomiJp9YGadpQnrtbRpSgN2+np21qHcIKiva4fiOQGjS9/qR/A=="],
|
"@xhmikosr/downloader/defaults": ["defaults@3.0.0", "", {}, "sha512-RsqXDEAALjfRTro+IFNKpcPCt0/Cy2FqHSIlnomiJp9YGadpQnrtbRpSgN2+np21qHcIKiva4fiOQGjS9/qR/A=="],
|
||||||
|
|
||||||
"ansi-align/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
|
|
||||||
|
|
||||||
"arraybuffer.prototype.slice/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
"arraybuffer.prototype.slice/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
||||||
|
|
||||||
"bin-version-check/semver": ["semver@7.6.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A=="],
|
"bin-version-check/semver": ["semver@7.6.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A=="],
|
||||||
|
|
||||||
"boxen/chalk": ["chalk@5.3.0", "", {}, "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w=="],
|
|
||||||
|
|
||||||
"cacheable-request/mimic-response": ["mimic-response@4.0.0", "", {}, "sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg=="],
|
"cacheable-request/mimic-response": ["mimic-response@4.0.0", "", {}, "sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg=="],
|
||||||
|
|
||||||
"call-bind/es-define-property": ["es-define-property@1.0.0", "", { "dependencies": { "get-intrinsic": "^1.2.4" } }, "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ=="],
|
"call-bind/es-define-property": ["es-define-property@1.0.0", "", { "dependencies": { "get-intrinsic": "^1.2.4" } }, "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ=="],
|
||||||
|
|
||||||
"call-bind/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
"call-bind/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
||||||
|
|
||||||
"cliui/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
|
|
||||||
|
|
||||||
"cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="],
|
|
||||||
|
|
||||||
"clone-response/mimic-response": ["mimic-response@1.0.1", "", {}, "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ=="],
|
|
||||||
|
|
||||||
"config-chain/ini": ["ini@1.3.8", "", {}, "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="],
|
"config-chain/ini": ["ini@1.3.8", "", {}, "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="],
|
||||||
|
|
||||||
"define-data-property/es-define-property": ["es-define-property@1.0.0", "", { "dependencies": { "get-intrinsic": "^1.2.4" } }, "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ=="],
|
"define-data-property/es-define-property": ["es-define-property@1.0.0", "", { "dependencies": { "get-intrinsic": "^1.2.4" } }, "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ=="],
|
||||||
@@ -939,40 +823,16 @@
|
|||||||
|
|
||||||
"isomorphic-unzip/yauzl": ["yauzl@2.10.0", "", { "dependencies": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" } }, "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g=="],
|
"isomorphic-unzip/yauzl": ["yauzl@2.10.0", "", { "dependencies": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" } }, "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g=="],
|
||||||
|
|
||||||
"log-symbols/chalk": ["chalk@5.3.0", "", {}, "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w=="],
|
"make-dir/semver": ["semver@7.6.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A=="],
|
||||||
|
|
||||||
"log-symbols/is-unicode-supported": ["is-unicode-supported@1.3.0", "", {}, "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ=="],
|
|
||||||
|
|
||||||
"make-dir/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
|
|
||||||
|
|
||||||
"object.assign/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
"object.assign/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
||||||
|
|
||||||
"ora/chalk": ["chalk@5.3.0", "", {}, "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w=="],
|
|
||||||
|
|
||||||
"ora/string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="],
|
|
||||||
|
|
||||||
"ora/strip-ansi": ["strip-ansi@7.1.0", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ=="],
|
|
||||||
|
|
||||||
"package-json/got": ["got@9.6.0", "", { "dependencies": { "@sindresorhus/is": "^0.14.0", "@szmarczak/http-timer": "^1.1.2", "cacheable-request": "^6.0.0", "decompress-response": "^3.3.0", "duplexer3": "^0.1.4", "get-stream": "^4.1.0", "lowercase-keys": "^1.0.1", "mimic-response": "^1.0.1", "p-cancelable": "^1.0.0", "to-readable-stream": "^1.0.0", "url-parse-lax": "^3.0.0" } }, "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q=="],
|
|
||||||
|
|
||||||
"package-json/registry-auth-token": ["registry-auth-token@4.2.2", "", { "dependencies": { "rc": "1.2.8" } }, "sha512-PC5ZysNb42zpFME6D/XlIgtNGdTl8bBOCw90xQLVMpzuuubJKYDWFAEuUNc+Cn8Z8724tg2SDhDRrkVEsqfDMg=="],
|
|
||||||
|
|
||||||
"package-json/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
|
|
||||||
|
|
||||||
"rc/ini": ["ini@1.3.8", "", {}, "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="],
|
|
||||||
|
|
||||||
"restore-cursor/onetime": ["onetime@7.0.0", "", { "dependencies": { "mimic-function": "^5.0.0" } }, "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ=="],
|
|
||||||
|
|
||||||
"restore-cursor/signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="],
|
|
||||||
|
|
||||||
"safe-array-concat/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
"safe-array-concat/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
||||||
|
|
||||||
"safe-array-concat/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
"safe-array-concat/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
||||||
|
|
||||||
"seek-bzip/commander": ["commander@6.2.1", "", {}, "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA=="],
|
"seek-bzip/commander": ["commander@6.2.1", "", {}, "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA=="],
|
||||||
|
|
||||||
"semver-diff/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
|
|
||||||
|
|
||||||
"semver-truncate/semver": ["semver@7.6.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A=="],
|
"semver-truncate/semver": ["semver@7.6.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A=="],
|
||||||
|
|
||||||
"set-function-length/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
"set-function-length/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
||||||
@@ -983,8 +843,6 @@
|
|||||||
|
|
||||||
"smartwrap/yargs": ["yargs@15.4.1", "", { "dependencies": { "cliui": "^6.0.0", "decamelize": "^1.2.0", "find-up": "^4.1.0", "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^4.2.0", "which-module": "^2.0.0", "y18n": "^4.0.0", "yargs-parser": "^18.1.2" } }, "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A=="],
|
"smartwrap/yargs": ["yargs@15.4.1", "", { "dependencies": { "cliui": "^6.0.0", "decamelize": "^1.2.0", "find-up": "^4.1.0", "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^4.2.0", "which-module": "^2.0.0", "y18n": "^4.0.0", "yargs-parser": "^18.1.2" } }, "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A=="],
|
||||||
|
|
||||||
"string-width/strip-ansi": ["strip-ansi@7.1.0", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ=="],
|
|
||||||
|
|
||||||
"string.prototype.trim/es-object-atoms": ["es-object-atoms@1.0.0", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw=="],
|
"string.prototype.trim/es-object-atoms": ["es-object-atoms@1.0.0", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw=="],
|
||||||
|
|
||||||
"string.prototype.trimend/es-object-atoms": ["es-object-atoms@1.0.0", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw=="],
|
"string.prototype.trimend/es-object-atoms": ["es-object-atoms@1.0.0", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw=="],
|
||||||
@@ -999,18 +857,8 @@
|
|||||||
|
|
||||||
"unbox-primitive/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
"unbox-primitive/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
||||||
|
|
||||||
"update-notifier/boxen": ["boxen@5.1.2", "", { "dependencies": { "ansi-align": "^3.0.0", "camelcase": "^6.2.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.1", "string-width": "^4.2.2", "type-fest": "^0.20.2", "widest-line": "^3.1.0", "wrap-ansi": "^7.0.0" } }, "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ=="],
|
|
||||||
|
|
||||||
"update-notifier/semver": ["semver@7.6.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A=="],
|
|
||||||
|
|
||||||
"which-typed-array/gopd": ["gopd@1.0.1", "", { "dependencies": { "get-intrinsic": "^1.1.3" } }, "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA=="],
|
"which-typed-array/gopd": ["gopd@1.0.1", "", { "dependencies": { "get-intrinsic": "^1.1.3" } }, "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA=="],
|
||||||
|
|
||||||
"wrap-ansi/ansi-styles": ["ansi-styles@6.2.1", "", {}, "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug=="],
|
|
||||||
|
|
||||||
"wrap-ansi/strip-ansi": ["strip-ansi@7.1.0", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ=="],
|
|
||||||
|
|
||||||
"yargs/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
|
|
||||||
|
|
||||||
"yazl/buffer-crc32": ["buffer-crc32@1.0.0", "", {}, "sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w=="],
|
"yazl/buffer-crc32": ["buffer-crc32@1.0.0", "", {}, "sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w=="],
|
||||||
|
|
||||||
"@types/fs-extra/@types/node/undici-types": ["undici-types@6.19.8", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="],
|
"@types/fs-extra/@types/node/undici-types": ["undici-types@6.19.8", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="],
|
||||||
@@ -1025,16 +873,10 @@
|
|||||||
|
|
||||||
"@types/yazl/@types/node/undici-types": ["undici-types@6.19.8", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="],
|
"@types/yazl/@types/node/undici-types": ["undici-types@6.19.8", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="],
|
||||||
|
|
||||||
"@xhmikosr/decompress/make-dir/semver": ["semver@7.6.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A=="],
|
|
||||||
|
|
||||||
"ansi-align/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
|
|
||||||
|
|
||||||
"arraybuffer.prototype.slice/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
"arraybuffer.prototype.slice/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
||||||
|
|
||||||
"call-bind/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
"call-bind/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
||||||
|
|
||||||
"cliui/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
|
|
||||||
|
|
||||||
"define-data-property/es-define-property/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
"define-data-property/es-define-property/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
||||||
|
|
||||||
"define-data-property/gopd/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
"define-data-property/gopd/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
||||||
@@ -1049,64 +891,24 @@
|
|||||||
|
|
||||||
"is-array-buffer/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
"is-array-buffer/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
||||||
|
|
||||||
"ora/string-width/emoji-regex": ["emoji-regex@10.4.0", "", {}, "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw=="],
|
|
||||||
|
|
||||||
"ora/strip-ansi/ansi-regex": ["ansi-regex@6.1.0", "", {}, "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA=="],
|
|
||||||
|
|
||||||
"package-json/got/@sindresorhus/is": ["@sindresorhus/is@0.14.0", "", {}, "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ=="],
|
|
||||||
|
|
||||||
"package-json/got/@szmarczak/http-timer": ["@szmarczak/http-timer@1.1.2", "", { "dependencies": { "defer-to-connect": "^1.0.1" } }, "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA=="],
|
|
||||||
|
|
||||||
"package-json/got/cacheable-request": ["cacheable-request@6.1.0", "", { "dependencies": { "clone-response": "^1.0.2", "get-stream": "^5.1.0", "http-cache-semantics": "^4.0.0", "keyv": "^3.0.0", "lowercase-keys": "^2.0.0", "normalize-url": "^4.1.0", "responselike": "^1.0.2" } }, "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg=="],
|
|
||||||
|
|
||||||
"package-json/got/decompress-response": ["decompress-response@3.3.0", "", { "dependencies": { "mimic-response": "^1.0.0" } }, "sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA=="],
|
|
||||||
|
|
||||||
"package-json/got/get-stream": ["get-stream@4.1.0", "", { "dependencies": { "pump": "^3.0.0" } }, "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w=="],
|
|
||||||
|
|
||||||
"package-json/got/lowercase-keys": ["lowercase-keys@1.0.1", "", {}, "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA=="],
|
|
||||||
|
|
||||||
"package-json/got/mimic-response": ["mimic-response@1.0.1", "", {}, "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ=="],
|
|
||||||
|
|
||||||
"package-json/got/p-cancelable": ["p-cancelable@1.1.0", "", {}, "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw=="],
|
|
||||||
|
|
||||||
"set-function-length/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
"set-function-length/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
||||||
|
|
||||||
"side-channel/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
"side-channel/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
||||||
|
|
||||||
"smartwrap/yargs/cliui": ["cliui@6.0.0", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^6.2.0" } }, "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ=="],
|
"smartwrap/yargs/cliui": ["cliui@6.0.0", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^6.2.0" } }, "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ=="],
|
||||||
|
|
||||||
"smartwrap/yargs/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
|
|
||||||
|
|
||||||
"smartwrap/yargs/y18n": ["y18n@4.0.3", "", {}, "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ=="],
|
"smartwrap/yargs/y18n": ["y18n@4.0.3", "", {}, "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ=="],
|
||||||
|
|
||||||
"smartwrap/yargs/yargs-parser": ["yargs-parser@18.1.3", "", { "dependencies": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" } }, "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ=="],
|
"smartwrap/yargs/yargs-parser": ["yargs-parser@18.1.3", "", { "dependencies": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" } }, "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ=="],
|
||||||
|
|
||||||
"string-width/strip-ansi/ansi-regex": ["ansi-regex@6.1.0", "", {}, "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA=="],
|
|
||||||
|
|
||||||
"typed-array-byte-length/gopd/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
"typed-array-byte-length/gopd/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
||||||
|
|
||||||
"typed-array-byte-offset/gopd/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
"typed-array-byte-offset/gopd/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
||||||
|
|
||||||
"typed-array-length/gopd/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
"typed-array-length/gopd/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
||||||
|
|
||||||
"update-notifier/boxen/camelcase": ["camelcase@6.3.0", "", {}, "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA=="],
|
|
||||||
|
|
||||||
"update-notifier/boxen/cli-boxes": ["cli-boxes@2.2.1", "", {}, "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw=="],
|
|
||||||
|
|
||||||
"update-notifier/boxen/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
|
|
||||||
|
|
||||||
"update-notifier/boxen/type-fest": ["type-fest@0.20.2", "", {}, "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ=="],
|
|
||||||
|
|
||||||
"update-notifier/boxen/widest-line": ["widest-line@3.1.0", "", { "dependencies": { "string-width": "^4.0.0" } }, "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg=="],
|
|
||||||
|
|
||||||
"update-notifier/boxen/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="],
|
|
||||||
|
|
||||||
"which-typed-array/gopd/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
"which-typed-array/gopd/get-intrinsic": ["get-intrinsic@1.2.4", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "hasown": "^2.0.0" } }, "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ=="],
|
||||||
|
|
||||||
"wrap-ansi/strip-ansi/ansi-regex": ["ansi-regex@6.1.0", "", {}, "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA=="],
|
|
||||||
|
|
||||||
"yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
|
|
||||||
|
|
||||||
"define-data-property/es-define-property/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
"define-data-property/es-define-property/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
||||||
|
|
||||||
"define-data-property/gopd/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
"define-data-property/gopd/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
||||||
@@ -1115,36 +917,14 @@
|
|||||||
|
|
||||||
"has-property-descriptors/es-define-property/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
"has-property-descriptors/es-define-property/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
||||||
|
|
||||||
"package-json/got/@szmarczak/http-timer/defer-to-connect": ["defer-to-connect@1.1.3", "", {}, "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ=="],
|
|
||||||
|
|
||||||
"package-json/got/cacheable-request/get-stream": ["get-stream@5.2.0", "", { "dependencies": { "pump": "^3.0.0" } }, "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA=="],
|
|
||||||
|
|
||||||
"package-json/got/cacheable-request/keyv": ["keyv@3.1.0", "", { "dependencies": { "json-buffer": "3.0.0" } }, "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA=="],
|
|
||||||
|
|
||||||
"package-json/got/cacheable-request/lowercase-keys": ["lowercase-keys@2.0.0", "", {}, "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA=="],
|
|
||||||
|
|
||||||
"package-json/got/cacheable-request/normalize-url": ["normalize-url@4.5.1", "", {}, "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA=="],
|
|
||||||
|
|
||||||
"package-json/got/cacheable-request/responselike": ["responselike@1.0.2", "", { "dependencies": { "lowercase-keys": "^1.0.0" } }, "sha512-/Fpe5guzJk1gPqdJLJR5u7eG/gNY4nImjbRDaVWVMRhne55TCmj2i9Q+54PBRfatRC8v/rIiv9BN0pMd9OV5EQ=="],
|
|
||||||
|
|
||||||
"smartwrap/yargs/cliui/wrap-ansi": ["wrap-ansi@6.2.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA=="],
|
"smartwrap/yargs/cliui/wrap-ansi": ["wrap-ansi@6.2.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA=="],
|
||||||
|
|
||||||
"smartwrap/yargs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
|
|
||||||
|
|
||||||
"smartwrap/yargs/yargs-parser/camelcase": ["camelcase@5.3.1", "", {}, "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="],
|
|
||||||
|
|
||||||
"typed-array-byte-length/gopd/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
"typed-array-byte-length/gopd/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
||||||
|
|
||||||
"typed-array-byte-offset/gopd/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
"typed-array-byte-offset/gopd/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
||||||
|
|
||||||
"typed-array-length/gopd/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
"typed-array-length/gopd/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
||||||
|
|
||||||
"update-notifier/boxen/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
|
|
||||||
|
|
||||||
"which-typed-array/gopd/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
"which-typed-array/gopd/get-intrinsic/has-symbols": ["has-symbols@1.0.3", "", {}, "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="],
|
||||||
|
|
||||||
"package-json/got/cacheable-request/keyv/json-buffer": ["json-buffer@3.0.0", "", {}, "sha512-CuUqjv0FUZIdXkHPI8MezCnFCdaTAacej1TZYulLoAg1h/PhwkdXFN4V/gzY4g+fMBCOV2xF+rp7t2XD2ns/NQ=="],
|
|
||||||
|
|
||||||
"package-json/got/cacheable-request/responselike/lowercase-keys": ["lowercase-keys@1.0.1", "", {}, "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA=="],
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
139
cli.json
139
cli.json
@@ -31,9 +31,27 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"uploadIpa": {},
|
"uploadIpa": {
|
||||||
"uploadApk": {},
|
"options": {
|
||||||
"uploadApp": {},
|
"version": {
|
||||||
|
"hasValue": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"uploadApk": {
|
||||||
|
"options": {
|
||||||
|
"version": {
|
||||||
|
"hasValue": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"uploadApp": {
|
||||||
|
"options": {
|
||||||
|
"version": {
|
||||||
|
"hasValue": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"parseApp": {},
|
"parseApp": {},
|
||||||
"parseIpa": {},
|
"parseIpa": {},
|
||||||
"parseApk": {},
|
"parseApk": {},
|
||||||
@@ -44,6 +62,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"deletePackage": {
|
||||||
|
"options": {
|
||||||
|
"appId": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"packageVersion": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"packageId": {
|
||||||
|
"hasValue": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"publish": {
|
"publish": {
|
||||||
"options": {
|
"options": {
|
||||||
"platform": {
|
"platform": {
|
||||||
@@ -57,6 +88,27 @@
|
|||||||
},
|
},
|
||||||
"metaInfo": {
|
"metaInfo": {
|
||||||
"hasValue": true
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"packageId": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"packageVersion": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"minPackageVersion": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"maxPackageVersion": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"packageVersionRange": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"rollout": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"dryRun": {
|
||||||
|
"default": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -87,8 +139,14 @@
|
|||||||
"maxPackageVersion": {
|
"maxPackageVersion": {
|
||||||
"hasValue": true
|
"hasValue": true
|
||||||
},
|
},
|
||||||
|
"packageVersionRange": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
"rollout": {
|
"rollout": {
|
||||||
"hasValue": true
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"dryRun": {
|
||||||
|
"default": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -118,7 +176,7 @@
|
|||||||
"description": "Bundle javascript and copy assets."
|
"description": "Bundle javascript and copy assets."
|
||||||
},
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"description": "Bundle javascript code only.",
|
"description": "Bundle javascript code only and optionally publish.",
|
||||||
"options": {
|
"options": {
|
||||||
"dev": {
|
"dev": {
|
||||||
"default": "false",
|
"default": "false",
|
||||||
@@ -136,11 +194,11 @@
|
|||||||
"hasValue": true
|
"hasValue": true
|
||||||
},
|
},
|
||||||
"intermediaDir": {
|
"intermediaDir": {
|
||||||
"default": ".pushy/intermedia/${platform}",
|
"default": "${tempDir}/intermedia/${platform}",
|
||||||
"hasValue": true
|
"hasValue": true
|
||||||
},
|
},
|
||||||
"output": {
|
"output": {
|
||||||
"default": ".pushy/output/${platform}.${time}.ppk",
|
"default": "${tempDir}/output/${platform}.${time}.ppk",
|
||||||
"hasValue": true
|
"hasValue": true
|
||||||
},
|
},
|
||||||
"sourcemap": {
|
"sourcemap": {
|
||||||
@@ -157,6 +215,39 @@
|
|||||||
},
|
},
|
||||||
"disableHermes": {
|
"disableHermes": {
|
||||||
"default": false
|
"default": false
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"hasValue": true,
|
||||||
|
"description": "Version name for publishing"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"hasValue": true,
|
||||||
|
"description": "Version description for publishing"
|
||||||
|
},
|
||||||
|
"metaInfo": {
|
||||||
|
"hasValue": true,
|
||||||
|
"description": "Meta information for publishing"
|
||||||
|
},
|
||||||
|
"packageId": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"packageVersion": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"minPackageVersion": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"maxPackageVersion": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"packageVersionRange": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"rollout": {
|
||||||
|
"hasValue": true
|
||||||
|
},
|
||||||
|
"dryRun": {
|
||||||
|
"default": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -167,7 +258,7 @@
|
|||||||
"description": "Create diff patch",
|
"description": "Create diff patch",
|
||||||
"options": {
|
"options": {
|
||||||
"output": {
|
"output": {
|
||||||
"default": ".pushy/output/diff",
|
"default": "${tempDir}/output/diff",
|
||||||
"hasValue": true
|
"hasValue": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,7 +267,7 @@
|
|||||||
"description": "Create diff patch from a Android package(.apk)",
|
"description": "Create diff patch from a Android package(.apk)",
|
||||||
"options": {
|
"options": {
|
||||||
"output": {
|
"output": {
|
||||||
"default": ".pushy/output/diff-${time}.apk-patch",
|
"default": "${tempDir}/output/diff-${time}.apk-patch",
|
||||||
"hasValue": true
|
"hasValue": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,7 +276,7 @@
|
|||||||
"description": "Create diff patch from a iOS package(.ipa)",
|
"description": "Create diff patch from a iOS package(.ipa)",
|
||||||
"options": {
|
"options": {
|
||||||
"output": {
|
"output": {
|
||||||
"default": ".pushy/output/diff-${time}.ipa-patch",
|
"default": "${tempDir}/output/diff-${time}.ipa-patch",
|
||||||
"hasValue": true
|
"hasValue": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -194,7 +285,7 @@
|
|||||||
"description": "Create hdiff patch",
|
"description": "Create hdiff patch",
|
||||||
"options": {
|
"options": {
|
||||||
"output": {
|
"output": {
|
||||||
"default": ".pushy/output/hdiff",
|
"default": "${tempDir}/output/hdiff",
|
||||||
"hasValue": true
|
"hasValue": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -203,7 +294,7 @@
|
|||||||
"description": "Create hdiff patch from a Android package(.apk)",
|
"description": "Create hdiff patch from a Android package(.apk)",
|
||||||
"options": {
|
"options": {
|
||||||
"output": {
|
"output": {
|
||||||
"default": ".pushy/output/hdiff-${time}.apk-patch",
|
"default": "${tempDir}/output/hdiff-${time}.apk-patch",
|
||||||
"hasValue": true
|
"hasValue": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,7 +303,7 @@
|
|||||||
"description": "Create hdiff patch from a Prepare package(.ppk)",
|
"description": "Create hdiff patch from a Prepare package(.ppk)",
|
||||||
"options": {
|
"options": {
|
||||||
"output": {
|
"output": {
|
||||||
"default": ".pushy/output/hdiff-${time}.ppk-patch",
|
"default": "${tempDir}/output/hdiff-${time}.ppk-patch",
|
||||||
"hasValue": true
|
"hasValue": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -221,7 +312,7 @@
|
|||||||
"description": "Create hdiff patch from a Harmony package(.app)",
|
"description": "Create hdiff patch from a Harmony package(.app)",
|
||||||
"options": {
|
"options": {
|
||||||
"output": {
|
"output": {
|
||||||
"default": ".pushy/output/hdiff-${time}.app-patch",
|
"default": "${tempDir}/output/hdiff-${time}.app-patch",
|
||||||
"hasValue": true
|
"hasValue": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,7 +321,25 @@
|
|||||||
"description": "Create hdiff patch from a iOS package(.ipa)",
|
"description": "Create hdiff patch from a iOS package(.ipa)",
|
||||||
"options": {
|
"options": {
|
||||||
"output": {
|
"output": {
|
||||||
"default": ".pushy/output/hdiff-${time}.ipa-patch",
|
"default": "${tempDir}/output/hdiff-${time}.ipa-patch",
|
||||||
|
"hasValue": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"list": {
|
||||||
|
"description": "List all bundles",
|
||||||
|
"options": {
|
||||||
|
"output": {
|
||||||
|
"default": "${tempDir}/output/list",
|
||||||
|
"hasValue": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"workflow": {
|
||||||
|
"description": "List all workflows",
|
||||||
|
"options": {
|
||||||
|
"output": {
|
||||||
|
"default": "${tempDir}/output/workflow",
|
||||||
"hasValue": true
|
"hasValue": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,4 +350,4 @@
|
|||||||
"default": false
|
"default": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
471
example/ENHANCED_WORKFLOWS.md
Normal file
471
example/ENHANCED_WORKFLOWS.md
Normal file
@@ -0,0 +1,471 @@
|
|||||||
|
# 核心模块增强工作流
|
||||||
|
|
||||||
|
这个文档详细介绍了为React Native Update CLI核心模块设计的增强工作流,包括`app-module`、`bundle-module`、`package-module`、`user-module`、`version-module`的高级工作流功能。
|
||||||
|
|
||||||
|
## 📋 目录
|
||||||
|
|
||||||
|
- [App模块工作流](#app模块工作流)
|
||||||
|
- [Bundle模块工作流](#bundle模块工作流)
|
||||||
|
- [Package模块工作流](#package模块工作流)
|
||||||
|
- [User模块工作流](#user模块工作流)
|
||||||
|
- [Version模块工作流](#version模块工作流)
|
||||||
|
- [工作流使用示例](#工作流使用示例)
|
||||||
|
- [最佳实践](#最佳实践)
|
||||||
|
|
||||||
|
## 🚀 快速开始
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 运行所有增强工作流演示
|
||||||
|
npx ts-node example/scripts/enhanced-workflow-demo.ts
|
||||||
|
|
||||||
|
# 交互式执行特定工作流
|
||||||
|
npx ts-node example/scripts/enhanced-workflow-demo.ts interactive [工作流名称] [参数...]
|
||||||
|
|
||||||
|
# 示例:应用初始化
|
||||||
|
npx ts-node example/scripts/enhanced-workflow-demo.ts interactive app-initialization --name MyApp --platform ios
|
||||||
|
|
||||||
|
# 示例:智能打包
|
||||||
|
npx ts-node example/scripts/enhanced-workflow-demo.ts interactive intelligent-bundle --platform android --optimize true
|
||||||
|
|
||||||
|
# 示例:版本发布
|
||||||
|
npx ts-node example/scripts/enhanced-workflow-demo.ts interactive version-release-management --name v1.0.0 --platform ios --dryRun true
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📱 App模块工作流
|
||||||
|
|
||||||
|
### 1. 应用初始化工作流 (`app-initialization`)
|
||||||
|
|
||||||
|
**用途**: 完整的应用创建和初始化流程
|
||||||
|
|
||||||
|
**功能特性**:
|
||||||
|
- ✅ 参数验证和格式检查
|
||||||
|
- ✅ 应用存在性检查和冲突处理
|
||||||
|
- ✅ 应用创建和配置
|
||||||
|
- ✅ 自动选择新创建的应用
|
||||||
|
- ✅ 完整性验证和健康检查
|
||||||
|
|
||||||
|
**工作流步骤**:
|
||||||
|
1. **参数验证**: 检查应用名称、平台、下载URL格式
|
||||||
|
2. **存在性检查**: 验证应用是否已存在,支持强制覆盖
|
||||||
|
3. **应用创建**: 执行应用创建操作
|
||||||
|
4. **基本配置**: 设置更新策略、安全参数、版本控制
|
||||||
|
5. **应用选择**: 自动选择新创建的应用
|
||||||
|
6. **设置验证**: 验证应用配置的完整性和可用性
|
||||||
|
|
||||||
|
**使用示例**:
|
||||||
|
```typescript
|
||||||
|
await moduleManager.executeWorkflow('app-initialization', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
name: 'MyAwesomeApp', // 应用名称 (必需)
|
||||||
|
platform: 'ios', // 平台 (必需)
|
||||||
|
downloadUrl: 'https://...', // 下载URL (可选)
|
||||||
|
force: false // 强制覆盖 (可选)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
**适用场景**:
|
||||||
|
- 新项目应用创建
|
||||||
|
- 多环境应用设置
|
||||||
|
- 自动化部署脚本
|
||||||
|
|
||||||
|
### 2. 多平台应用管理工作流 (`multi-platform-app-management`)
|
||||||
|
|
||||||
|
**用途**: 跨平台应用统一管理和优化
|
||||||
|
|
||||||
|
**功能特性**:
|
||||||
|
- 🔍 全平台应用扫描
|
||||||
|
- 📊 应用状态分析和统计
|
||||||
|
- ⚡ 自动优化建议和执行
|
||||||
|
- 📈 应用健康度评估
|
||||||
|
|
||||||
|
**工作流步骤**:
|
||||||
|
1. **平台扫描**: 扫描iOS、Android、Harmony平台的所有应用
|
||||||
|
2. **状态分析**: 分析应用活跃度、版本分布、平台分布
|
||||||
|
3. **问题识别**: 识别非活跃应用、配置问题
|
||||||
|
4. **自动优化**: 执行应用配置优化和清理
|
||||||
|
|
||||||
|
**使用示例**:
|
||||||
|
```typescript
|
||||||
|
await moduleManager.executeWorkflow('multi-platform-app-management', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
includeInactive: true, // 包含非活跃应用
|
||||||
|
autoOptimize: true // 自动优化配置
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
**适用场景**:
|
||||||
|
- 应用生态管理
|
||||||
|
- 定期健康检查
|
||||||
|
- 批量优化操作
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📦 Bundle模块工作流
|
||||||
|
|
||||||
|
### 1. 智能打包工作流 (`intelligent-bundle`)
|
||||||
|
|
||||||
|
**用途**: 自动优化的多平台智能构建
|
||||||
|
|
||||||
|
**功能特性**:
|
||||||
|
- 🖥️ 构建环境自动检测
|
||||||
|
- 📂 项目结构智能分析
|
||||||
|
- ⚙️ 自动优化配置
|
||||||
|
- 🏗️ 多平台并行构建
|
||||||
|
- 🔍 构建质量检查
|
||||||
|
|
||||||
|
**工作流步骤**:
|
||||||
|
1. **环境检测**: 检查Node.js版本、内存、平台兼容性
|
||||||
|
2. **项目分析**: 分析项目类型、依赖、预估大小
|
||||||
|
3. **优化设置**: 根据项目特征自动配置优化选项
|
||||||
|
4. **多平台构建**: 并行构建指定平台或所有平台
|
||||||
|
5. **质量检查**: 检查构建质量、包大小、构建时间
|
||||||
|
|
||||||
|
**使用示例**:
|
||||||
|
```typescript
|
||||||
|
await moduleManager.executeWorkflow('intelligent-bundle', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
platform: 'ios', // 目标平台 (可选,不指定则构建所有)
|
||||||
|
dev: false, // 开发模式
|
||||||
|
sourcemap: true, // 生成源码映射
|
||||||
|
optimize: true // 启用自动优化
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
**适用场景**:
|
||||||
|
- 自动化CI/CD构建
|
||||||
|
- 多平台发布准备
|
||||||
|
- 性能优化构建
|
||||||
|
|
||||||
|
### 2. 增量构建工作流 (`incremental-build`)
|
||||||
|
|
||||||
|
**用途**: 高效的增量更新包生成
|
||||||
|
|
||||||
|
**功能特性**:
|
||||||
|
- 🔍 自动基准版本检测
|
||||||
|
- 🏗️ 当前版本构建
|
||||||
|
- 📥 基准版本下载
|
||||||
|
- 🔄 智能差异计算
|
||||||
|
- ✅ 差异包验证
|
||||||
|
|
||||||
|
**工作流步骤**:
|
||||||
|
1. **基准检测**: 自动检测或使用指定的基准版本
|
||||||
|
2. **当前构建**: 构建当前版本的Bundle
|
||||||
|
3. **基准下载**: 下载基准版本的Bundle文件
|
||||||
|
4. **差异生成**: 计算并生成差异包
|
||||||
|
5. **验证测试**: 验证差异包的完整性和可用性
|
||||||
|
|
||||||
|
**使用示例**:
|
||||||
|
```typescript
|
||||||
|
await moduleManager.executeWorkflow('incremental-build', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
platform: 'android', // 目标平台 (必需)
|
||||||
|
baseVersion: 'v1.0.0', // 基准版本 (可选,自动检测)
|
||||||
|
skipValidation: false // 跳过验证
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
**适用场景**:
|
||||||
|
- 热更新包生成
|
||||||
|
- 减少更新下载大小
|
||||||
|
- 快速增量发布
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📄 Package模块工作流
|
||||||
|
|
||||||
|
### 1. 批量包处理工作流 (`batch-package-processing`)
|
||||||
|
|
||||||
|
**用途**: 批量处理多个应用包文件
|
||||||
|
|
||||||
|
**功能特性**:
|
||||||
|
- 🔍 智能文件扫描
|
||||||
|
- 📊 包信息分析统计
|
||||||
|
- 🔍 批量内容解析
|
||||||
|
- 📤 自动上传处理
|
||||||
|
- 📋 详细处理报告
|
||||||
|
|
||||||
|
**工作流步骤**:
|
||||||
|
1. **文件扫描**: 扫描指定目录的包文件(IPA、APK、APP)
|
||||||
|
2. **信息分析**: 分析包大小、平台分布、版本信息
|
||||||
|
3. **内容解析**: 批量解析包的元信息、权限、资源
|
||||||
|
4. **批量上传**: 自动上传解析成功的包文件
|
||||||
|
5. **报告生成**: 生成详细的处理报告和统计信息
|
||||||
|
|
||||||
|
**使用示例**:
|
||||||
|
```typescript
|
||||||
|
await moduleManager.executeWorkflow('batch-package-processing', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
directory: './packages', // 包文件目录
|
||||||
|
pattern: '*.{ipa,apk,app}', // 文件匹配模式
|
||||||
|
skipUpload: false // 跳过上传步骤
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
**适用场景**:
|
||||||
|
- 批量包文件处理
|
||||||
|
- 包文件质量检查
|
||||||
|
- 自动化包管理
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 👤 User模块工作流
|
||||||
|
|
||||||
|
> User模块已经在现有代码中包含了完善的工作流:
|
||||||
|
|
||||||
|
### 1. 认证状态检查工作流 (`auth-check`)
|
||||||
|
|
||||||
|
**功能特性**:
|
||||||
|
- 🔐 会话状态检查
|
||||||
|
- ✅ 服务端验证
|
||||||
|
- 👤 用户信息获取
|
||||||
|
- 🔄 自动登录支持
|
||||||
|
|
||||||
|
### 2. 完整登录流程工作流 (`login-flow`)
|
||||||
|
|
||||||
|
**功能特性**:
|
||||||
|
- 🔍 现有会话检查
|
||||||
|
- 🔐 用户登录执行
|
||||||
|
- ✅ 登录状态验证
|
||||||
|
- 📋 流程状态汇总
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🏷️ Version模块工作流
|
||||||
|
|
||||||
|
### 1. 版本发布管理工作流 (`version-release-management`)
|
||||||
|
|
||||||
|
**用途**: 完整的版本发布生命周期管理
|
||||||
|
|
||||||
|
**功能特性**:
|
||||||
|
- 🔍 发布前全面检查
|
||||||
|
- ✅ 版本信息验证
|
||||||
|
- ⚙️ 发布参数配置
|
||||||
|
- 🚀 发布执行和监控
|
||||||
|
- 📊 发布后监控分析
|
||||||
|
- 📋 完整发布报告
|
||||||
|
|
||||||
|
**工作流步骤**:
|
||||||
|
1. **发布前检查**: 验证版本格式、平台支持、构建环境、依赖完整性
|
||||||
|
2. **版本验证**: 检查版本冲突、规范性、发布类型
|
||||||
|
3. **发布准备**: 生成发布说明、配置分发参数、设置回滚策略
|
||||||
|
4. **执行发布**: 上传版本包、更新信息、配置分发、激活版本
|
||||||
|
5. **发布监控**: 监控下载成功率、安装成功率、崩溃率等关键指标
|
||||||
|
6. **发布总结**: 生成完整的发布报告和统计信息
|
||||||
|
|
||||||
|
**使用示例**:
|
||||||
|
```typescript
|
||||||
|
await moduleManager.executeWorkflow('version-release-management', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
name: 'v2.1.0', // 版本名称 (必需)
|
||||||
|
description: 'Major update', // 版本描述
|
||||||
|
platform: 'ios', // 目标平台 (必需)
|
||||||
|
rollout: 50, // 发布覆盖率
|
||||||
|
packageVersion: '2.1.0', // 包版本号
|
||||||
|
dryRun: false, // 模拟发布
|
||||||
|
force: false // 强制发布
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
**适用场景**:
|
||||||
|
- 正式版本发布
|
||||||
|
- 灰度发布管理
|
||||||
|
- 发布质量控制
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔗 工作流使用示例
|
||||||
|
|
||||||
|
### 1. 完整发布流程组合
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// 完整的应用发布流程
|
||||||
|
async function completeReleaseFlow() {
|
||||||
|
// 1. 应用初始化
|
||||||
|
await moduleManager.executeWorkflow('app-initialization', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
name: 'ProductionApp',
|
||||||
|
platform: 'ios',
|
||||||
|
force: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2. 智能打包
|
||||||
|
await moduleManager.executeWorkflow('intelligent-bundle', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
platform: 'ios',
|
||||||
|
dev: false,
|
||||||
|
optimize: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 3. 版本发布
|
||||||
|
await moduleManager.executeWorkflow('version-release-management', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
name: 'v1.0.0',
|
||||||
|
platform: 'ios',
|
||||||
|
rollout: 100
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 多平台批量构建
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
async function multiPlatformBuild() {
|
||||||
|
const platforms = ['ios', 'android', 'harmony'];
|
||||||
|
|
||||||
|
for (const platform of platforms) {
|
||||||
|
await moduleManager.executeWorkflow('intelligent-bundle', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
platform,
|
||||||
|
dev: false,
|
||||||
|
optimize: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 增量更新流程
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
async function incrementalUpdateFlow() {
|
||||||
|
// 1. 生成增量包
|
||||||
|
const buildResult = await moduleManager.executeWorkflow('incremental-build', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
platform: 'android',
|
||||||
|
baseVersion: 'v1.0.0'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2. 发布增量更新
|
||||||
|
if (buildResult.success) {
|
||||||
|
await moduleManager.executeWorkflow('version-release-management', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
name: 'v1.0.1',
|
||||||
|
platform: 'android',
|
||||||
|
rollout: 20 // 小范围发布
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📋 最佳实践
|
||||||
|
|
||||||
|
### 1. 工作流选择指南
|
||||||
|
|
||||||
|
| 场景 | 推荐工作流 | 配置建议 |
|
||||||
|
|------|------------|----------|
|
||||||
|
| 新应用创建 | `app-initialization` | 启用force参数避免冲突 |
|
||||||
|
| 生产发布 | `intelligent-bundle` + `version-release-management` | 关闭dev模式,启用优化 |
|
||||||
|
| 热更新 | `incremental-build` | 指定合适的基准版本 |
|
||||||
|
| 批量管理 | `batch-package-processing` | 定期执行包文件清理 |
|
||||||
|
| 灰度发布 | `version-release-management` | 设置合适的rollout比例 |
|
||||||
|
|
||||||
|
### 2. 错误处理策略
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
async function robustWorkflowExecution() {
|
||||||
|
try {
|
||||||
|
const result = await moduleManager.executeWorkflow('app-initialization', {
|
||||||
|
args: [],
|
||||||
|
options: { name: 'MyApp', platform: 'ios' }
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!result.success) {
|
||||||
|
console.error('工作流执行失败:', result.error);
|
||||||
|
// 执行回滚或重试逻辑
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('工作流异常:', error);
|
||||||
|
// 异常处理逻辑
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 工作流监控
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// 工作流执行监控
|
||||||
|
const workflowMonitor = {
|
||||||
|
async executeWithMonitoring(workflowName: string, context: any) {
|
||||||
|
const startTime = Date.now();
|
||||||
|
console.log(`开始执行工作流: ${workflowName}`);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await moduleManager.executeWorkflow(workflowName, context);
|
||||||
|
const duration = Date.now() - startTime;
|
||||||
|
|
||||||
|
console.log(`工作流执行完成: ${workflowName}, 耗时: ${duration}ms`);
|
||||||
|
return result;
|
||||||
|
} catch (error) {
|
||||||
|
const duration = Date.now() - startTime;
|
||||||
|
console.error(`工作流执行失败: ${workflowName}, 耗时: ${duration}ms`, error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 配置管理
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// 工作流配置管理
|
||||||
|
const workflowConfigs = {
|
||||||
|
development: {
|
||||||
|
'intelligent-bundle': { dev: true, optimize: false },
|
||||||
|
'version-release-management': { dryRun: true, rollout: 10 }
|
||||||
|
},
|
||||||
|
production: {
|
||||||
|
'intelligent-bundle': { dev: false, optimize: true },
|
||||||
|
'version-release-management': { dryRun: false, rollout: 100 }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
async function executeWithConfig(workflowName: string, environment: string) {
|
||||||
|
const config = workflowConfigs[environment]?.[workflowName] || {};
|
||||||
|
|
||||||
|
return await moduleManager.executeWorkflow(workflowName, {
|
||||||
|
args: [],
|
||||||
|
options: config
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎯 总结
|
||||||
|
|
||||||
|
这些增强的核心工作流为React Native Update CLI提供了:
|
||||||
|
|
||||||
|
1. **完整的应用生命周期管理** - 从创建到发布的全流程覆盖
|
||||||
|
2. **智能化构建和优化** - 自动环境检测和性能优化
|
||||||
|
3. **高效的增量更新** - 减少更新包大小,提升用户体验
|
||||||
|
4. **批量处理能力** - 提高大规模应用管理效率
|
||||||
|
5. **规范化发布流程** - 确保发布质量和一致性
|
||||||
|
|
||||||
|
每个工作流都经过精心设计,包含详细的步骤、错误处理、进度反馈和结果验证,为开发者提供了强大而可靠的自动化工具。
|
||||||
376
example/README.md
Normal file
376
example/README.md
Normal file
@@ -0,0 +1,376 @@
|
|||||||
|
# Custom Modules and Workflows Examples
|
||||||
|
|
||||||
|
[中文文档](./README.zh-CN.md) | [Chinese Documentation](./README.zh-CN.md)
|
||||||
|
|
||||||
|
This directory contains complete examples of React Native Update CLI custom modules and workflows, demonstrating how to extend the CLI functionality.
|
||||||
|
|
||||||
|
## 📁 Directory Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
example/
|
||||||
|
├── modules/ # Custom module examples
|
||||||
|
│ ├── custom-deploy-module.ts # Custom deployment module
|
||||||
|
│ └── analytics-module.ts # Analytics module
|
||||||
|
├── workflows/ # Custom workflow examples
|
||||||
|
│ └── custom-workflows.ts # Complex workflow collection
|
||||||
|
├── scripts/ # Execution script examples
|
||||||
|
│ ├── register-modules.ts # Module registration and execution
|
||||||
|
│ ├── provider-api-example.ts # Provider API usage examples
|
||||||
|
│ └── workflow-demo.ts # Workflow demonstration script
|
||||||
|
└── README.md # This documentation
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🚀 Quick Start
|
||||||
|
|
||||||
|
### 1. Run Module Registration and Execution Examples
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Compile TypeScript (if needed)
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
# Run module examples
|
||||||
|
npx ts-node example/scripts/register-modules.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Run Provider API Examples
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx ts-node example/scripts/provider-api-example.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Run Workflow Demonstrations
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run all workflow demonstrations
|
||||||
|
npx ts-node example/scripts/workflow-demo.ts
|
||||||
|
|
||||||
|
# Interactive execution of specific workflows
|
||||||
|
npx ts-node example/scripts/workflow-demo.ts interactive canary-deployment --version 1.0.0 --initialRollout 5
|
||||||
|
|
||||||
|
# Multi-environment deployment workflow
|
||||||
|
npx ts-node example/scripts/workflow-demo.ts interactive multi-env-deploy --version 1.0.0
|
||||||
|
|
||||||
|
# Rollback workflow
|
||||||
|
npx ts-node example/scripts/workflow-demo.ts interactive rollback-workflow --targetVersion 0.9.5
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📦 Custom Module Examples
|
||||||
|
|
||||||
|
### 1. Custom Deployment Module (`custom-deploy-module.ts`)
|
||||||
|
|
||||||
|
This module demonstrates how to create a complete deployment management module, including:
|
||||||
|
|
||||||
|
#### Commands:
|
||||||
|
- `deploy-dev`: Deploy to development environment
|
||||||
|
- `deploy-prod`: Deploy to production environment
|
||||||
|
- `rollback`: Rollback to specified version
|
||||||
|
|
||||||
|
#### Workflows:
|
||||||
|
- `full-deploy`: Complete deployment process (development → testing → production)
|
||||||
|
- `hotfix-deploy`: Quick hotfix deployment process
|
||||||
|
|
||||||
|
#### Usage Example:
|
||||||
|
```typescript
|
||||||
|
import { moduleManager } from 'react-native-update-cli';
|
||||||
|
import { customDeployModule } from './modules/custom-deploy-module';
|
||||||
|
|
||||||
|
// Register module
|
||||||
|
moduleManager.registerModule(customDeployModule);
|
||||||
|
|
||||||
|
// Execute development deployment
|
||||||
|
await moduleManager.executeCommand('deploy-dev', {
|
||||||
|
args: [],
|
||||||
|
options: { platform: 'ios', force: true }
|
||||||
|
});
|
||||||
|
|
||||||
|
// Execute complete deployment workflow
|
||||||
|
await moduleManager.executeWorkflow('full-deploy', {
|
||||||
|
args: [],
|
||||||
|
options: { version: '1.2.3' }
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Analytics Module (`analytics-module.ts`)
|
||||||
|
|
||||||
|
Demonstrates how to create analytics and statistics functionality:
|
||||||
|
|
||||||
|
#### Commands:
|
||||||
|
- `track-deployment`: Record deployment statistics
|
||||||
|
- `deployment-report`: Generate deployment reports
|
||||||
|
|
||||||
|
#### Workflows:
|
||||||
|
- `deploy-with-analytics`: Deployment process with analytics
|
||||||
|
|
||||||
|
## 🔄 Custom Workflow Examples
|
||||||
|
|
||||||
|
### 1. Canary Deployment Workflow (`canary-deployment`)
|
||||||
|
|
||||||
|
Implements a complete canary deployment process:
|
||||||
|
|
||||||
|
- ✅ Prepare canary deployment environment
|
||||||
|
- ✅ Initial small-scale deployment
|
||||||
|
- ✅ Monitor key metrics
|
||||||
|
- ✅ Automatically expand deployment based on metrics
|
||||||
|
- ✅ Final validation
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
await moduleManager.executeWorkflow('canary-deployment', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
version: '2.1.0',
|
||||||
|
initialRollout: 10, // 初始10%用户
|
||||||
|
autoExpand: true // 自动扩大范围
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Multi-Environment Deployment Workflow (`multi-env-deploy`)
|
||||||
|
|
||||||
|
Implements a standard multi-environment deployment process:
|
||||||
|
|
||||||
|
- ✅ Deploy to development environment
|
||||||
|
- ✅ Run integration tests
|
||||||
|
- ✅ Deploy to staging environment
|
||||||
|
- ✅ Run end-to-end tests
|
||||||
|
- ✅ Deploy to production environment
|
||||||
|
- ✅ Post-deployment validation
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
await moduleManager.executeWorkflow('multi-env-deploy', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
version: '2.1.0',
|
||||||
|
skipProduction: false, // 不跳过生产部署
|
||||||
|
forceProduction: false // 测试失败时不强制部署
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Rollback Workflow (`rollback-workflow`)
|
||||||
|
|
||||||
|
Safe application rollback process:
|
||||||
|
|
||||||
|
- ✅ Validate target version
|
||||||
|
- ✅ Backup current state
|
||||||
|
- ✅ Execute rollback operation
|
||||||
|
- ✅ Verify rollback results
|
||||||
|
- ✅ Notify relevant personnel
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
await moduleManager.executeWorkflow('rollback-workflow', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
targetVersion: '2.0.5',
|
||||||
|
skipVerification: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🛠️ Provider API Usage Examples
|
||||||
|
|
||||||
|
Provider API provides programmatic interfaces suitable for integration in applications:
|
||||||
|
|
||||||
|
### Basic Usage
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { moduleManager } from 'react-native-update-cli';
|
||||||
|
|
||||||
|
const provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
// Bundle application
|
||||||
|
const bundleResult = await provider.bundle({
|
||||||
|
platform: 'ios',
|
||||||
|
dev: false,
|
||||||
|
sourcemap: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// Publish version
|
||||||
|
const publishResult = await provider.publish({
|
||||||
|
name: 'v1.0.0',
|
||||||
|
description: 'Bug fixes',
|
||||||
|
rollout: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
// Upload file
|
||||||
|
const uploadResult = await provider.upload({
|
||||||
|
filePath: 'app.ipa',
|
||||||
|
platform: 'ios'
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Application Management
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Create application
|
||||||
|
await provider.createApp('MyApp', 'ios');
|
||||||
|
|
||||||
|
// Get current application
|
||||||
|
const { appId, platform } = await provider.getSelectedApp('ios');
|
||||||
|
|
||||||
|
// List versions
|
||||||
|
const versions = await provider.listVersions(appId);
|
||||||
|
|
||||||
|
// Update version
|
||||||
|
await provider.updateVersion(appId, versionId, {
|
||||||
|
name: 'v1.1.0',
|
||||||
|
description: 'New features'
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Automation Service Class
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
class DeploymentService {
|
||||||
|
private provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
async buildAndPublish(platform: Platform, version: string) {
|
||||||
|
// 1. Bundle
|
||||||
|
const bundleResult = await this.provider.bundle({
|
||||||
|
platform, dev: false, sourcemap: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2. Publish
|
||||||
|
const publishResult = await this.provider.publish({
|
||||||
|
name: version, rollout: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
return { bundleResult, publishResult };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🎯 Advanced Features
|
||||||
|
|
||||||
|
### 1. Workflow Validation
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const workflow: CustomWorkflow = {
|
||||||
|
name: 'my-workflow',
|
||||||
|
steps: [...],
|
||||||
|
validate: (context) => {
|
||||||
|
if (!context.options.version) {
|
||||||
|
console.error('Version number must be specified');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Conditional Execution
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const step: WorkflowStep = {
|
||||||
|
name: 'conditional-step',
|
||||||
|
execute: async (context) => { /* ... */ },
|
||||||
|
condition: (context) => {
|
||||||
|
return context.options.environment === 'production';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Error Handling
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
try {
|
||||||
|
const result = await moduleManager.executeCommand('deploy-prod', {
|
||||||
|
args: [],
|
||||||
|
options: {} // Missing required parameters
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Execution failed:', error.message);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Custom Workflow Registration
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
provider.registerWorkflow({
|
||||||
|
name: 'custom-workflow',
|
||||||
|
description: 'Custom workflow',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'step1',
|
||||||
|
execute: async (context, previousResult) => {
|
||||||
|
// Execution logic
|
||||||
|
return { step1: 'completed' };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// Execute workflow
|
||||||
|
await provider.executeWorkflow('custom-workflow', {
|
||||||
|
args: [],
|
||||||
|
options: {}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📝 Best Practices
|
||||||
|
|
||||||
|
### 1. Module Design
|
||||||
|
|
||||||
|
- **Single Responsibility**: Each module focuses on specific functional domains
|
||||||
|
- **Clear Naming**: Use descriptive command and option names
|
||||||
|
- **Complete Documentation**: Provide descriptions for all commands and options
|
||||||
|
- **Error Handling**: Provide clear error messages and recovery suggestions
|
||||||
|
|
||||||
|
### 2. Workflow Design
|
||||||
|
|
||||||
|
- **Atomic Operations**: Each step should be atomic and independently executable
|
||||||
|
- **State Passing**: Properly use previousResult to pass state
|
||||||
|
- **Error Recovery**: Consider cleanup and recovery mechanisms for failures
|
||||||
|
- **Progress Feedback**: Provide clear progress information to users
|
||||||
|
|
||||||
|
### 3. Development Recommendations
|
||||||
|
|
||||||
|
- **Type Safety**: Make full use of the TypeScript type system
|
||||||
|
- **Test Coverage**: Write tests for custom modules
|
||||||
|
- **Documentation Maintenance**: Keep examples and documentation synchronized
|
||||||
|
- **Version Management**: Set appropriate version numbers for modules
|
||||||
|
|
||||||
|
## 🐛 故障排除
|
||||||
|
|
||||||
|
### 常见问题
|
||||||
|
|
||||||
|
1. **模块注册失败**
|
||||||
|
```typescript
|
||||||
|
// 确保模块符合 CLIModule 接口
|
||||||
|
const module: CLIModule = {
|
||||||
|
name: 'my-module',
|
||||||
|
version: '1.0.0',
|
||||||
|
commands: [...],
|
||||||
|
workflows: [...]
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Command Execution Failed**
|
||||||
|
```typescript
|
||||||
|
// Check command name and parameters
|
||||||
|
await moduleManager.executeCommand('correct-command-name', {
|
||||||
|
args: [],
|
||||||
|
options: { requiredParam: 'value' }
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Workflow Validation Failed**
|
||||||
|
```typescript
|
||||||
|
// Ensure all required options are provided
|
||||||
|
await moduleManager.executeWorkflow('workflow-name', {
|
||||||
|
args: [],
|
||||||
|
options: { version: '1.0.0' } // Required parameter
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📖 Related Documentation
|
||||||
|
|
||||||
|
- [Main Project README](../README.md)
|
||||||
|
- [Modular Architecture Documentation](../docs/architecture.md)
|
||||||
|
- [API Reference Documentation](../docs/api-reference.md)
|
||||||
|
- [Contributing Guide](../CONTRIBUTING.md)
|
||||||
|
|
||||||
|
## 🤝 Contributing
|
||||||
|
|
||||||
|
Welcome to submit more examples and improvement suggestions! Please check the main project's contributing guide.
|
||||||
374
example/README.zh-CN.md
Normal file
374
example/README.zh-CN.md
Normal file
@@ -0,0 +1,374 @@
|
|||||||
|
# 自定义模块和工作流示例
|
||||||
|
|
||||||
|
这个目录包含了 React Native Update CLI 自定义模块和工作流的完整示例,演示如何扩展 CLI 的功能。
|
||||||
|
|
||||||
|
## 📁 目录结构
|
||||||
|
|
||||||
|
```
|
||||||
|
example/
|
||||||
|
├── modules/ # 自定义模块示例
|
||||||
|
│ ├── custom-deploy-module.ts # 自定义部署模块
|
||||||
|
│ └── analytics-module.ts # 分析统计模块
|
||||||
|
├── workflows/ # 自定义工作流示例
|
||||||
|
│ └── custom-workflows.ts # 复杂工作流集合
|
||||||
|
├── scripts/ # 执行脚本示例
|
||||||
|
│ ├── register-modules.ts # 模块注册和执行
|
||||||
|
│ ├── provider-api-example.ts # Provider API 使用示例
|
||||||
|
│ └── workflow-demo.ts # 工作流演示脚本
|
||||||
|
└── README.md # 本文档
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🚀 快速开始
|
||||||
|
|
||||||
|
### 1. 运行模块注册和执行示例
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 编译TypeScript (如果需要)
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
# 运行模块示例
|
||||||
|
npx ts-node example/scripts/register-modules.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 运行Provider API示例
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx ts-node example/scripts/provider-api-example.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 运行工作流演示
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 运行所有工作流演示
|
||||||
|
npx ts-node example/scripts/workflow-demo.ts
|
||||||
|
|
||||||
|
# 交互式执行特定工作流
|
||||||
|
npx ts-node example/scripts/workflow-demo.ts interactive canary-deployment --version 1.0.0 --initialRollout 5
|
||||||
|
|
||||||
|
# 多环境部署工作流
|
||||||
|
npx ts-node example/scripts/workflow-demo.ts interactive multi-env-deploy --version 1.0.0
|
||||||
|
|
||||||
|
# 回滚工作流
|
||||||
|
npx ts-node example/scripts/workflow-demo.ts interactive rollback-workflow --targetVersion 0.9.5
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📦 自定义模块示例
|
||||||
|
|
||||||
|
### 1. 自定义部署模块 (`custom-deploy-module.ts`)
|
||||||
|
|
||||||
|
这个模块演示了如何创建一个完整的部署管理模块,包含:
|
||||||
|
|
||||||
|
#### 命令:
|
||||||
|
- `deploy-dev`: 部署到开发环境
|
||||||
|
- `deploy-prod`: 部署到生产环境
|
||||||
|
- `rollback`: 回滚到指定版本
|
||||||
|
|
||||||
|
#### 工作流:
|
||||||
|
- `full-deploy`: 完整部署流程(开发 → 测试 → 生产)
|
||||||
|
- `hotfix-deploy`: 热修复快速部署流程
|
||||||
|
|
||||||
|
#### 使用示例:
|
||||||
|
```typescript
|
||||||
|
import { moduleManager } from 'react-native-update-cli';
|
||||||
|
import { customDeployModule } from './modules/custom-deploy-module';
|
||||||
|
|
||||||
|
// 注册模块
|
||||||
|
moduleManager.registerModule(customDeployModule);
|
||||||
|
|
||||||
|
// 执行开发部署
|
||||||
|
await moduleManager.executeCommand('deploy-dev', {
|
||||||
|
args: [],
|
||||||
|
options: { platform: 'ios', force: true }
|
||||||
|
});
|
||||||
|
|
||||||
|
// 执行完整部署工作流
|
||||||
|
await moduleManager.executeWorkflow('full-deploy', {
|
||||||
|
args: [],
|
||||||
|
options: { version: '1.2.3' }
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 分析统计模块 (`analytics-module.ts`)
|
||||||
|
|
||||||
|
演示如何创建分析和统计功能:
|
||||||
|
|
||||||
|
#### 命令:
|
||||||
|
- `track-deployment`: 记录部署统计信息
|
||||||
|
- `deployment-report`: 生成部署报告
|
||||||
|
|
||||||
|
#### 工作流:
|
||||||
|
- `deploy-with-analytics`: 带统计的部署流程
|
||||||
|
|
||||||
|
## 🔄 自定义工作流示例
|
||||||
|
|
||||||
|
### 1. 灰度发布工作流 (`canary-deployment`)
|
||||||
|
|
||||||
|
实现完整的灰度发布流程:
|
||||||
|
|
||||||
|
- ✅ 准备灰度发布环境
|
||||||
|
- ✅ 初始小范围部署
|
||||||
|
- ✅ 监控关键指标
|
||||||
|
- ✅ 基于指标自动扩大发布范围
|
||||||
|
- ✅ 最终验证
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
await moduleManager.executeWorkflow('canary-deployment', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
version: '2.1.0',
|
||||||
|
initialRollout: 10, // 初始10%用户
|
||||||
|
autoExpand: true // 自动扩大范围
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 多环境发布工作流 (`multi-env-deploy`)
|
||||||
|
|
||||||
|
实现标准的多环境发布流程:
|
||||||
|
|
||||||
|
- ✅ 部署到开发环境
|
||||||
|
- ✅ 运行集成测试
|
||||||
|
- ✅ 部署到预发布环境
|
||||||
|
- ✅ 运行端到端测试
|
||||||
|
- ✅ 部署到生产环境
|
||||||
|
- ✅ 部署后验证
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
await moduleManager.executeWorkflow('multi-env-deploy', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
version: '2.1.0',
|
||||||
|
skipProduction: false, // 不跳过生产部署
|
||||||
|
forceProduction: false // 测试失败时不强制部署
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 回滚工作流 (`rollback-workflow`)
|
||||||
|
|
||||||
|
安全的应用回滚流程:
|
||||||
|
|
||||||
|
- ✅ 验证目标版本
|
||||||
|
- ✅ 备份当前状态
|
||||||
|
- ✅ 执行回滚操作
|
||||||
|
- ✅ 验证回滚结果
|
||||||
|
- ✅ 通知相关人员
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
await moduleManager.executeWorkflow('rollback-workflow', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
targetVersion: '2.0.5',
|
||||||
|
skipVerification: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🛠️ Provider API 使用示例
|
||||||
|
|
||||||
|
Provider API 提供了编程式接口,适合在应用程序中集成:
|
||||||
|
|
||||||
|
### 基本使用
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { moduleManager } from 'react-native-update-cli';
|
||||||
|
|
||||||
|
const provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
// 打包应用
|
||||||
|
const bundleResult = await provider.bundle({
|
||||||
|
platform: 'ios',
|
||||||
|
dev: false,
|
||||||
|
sourcemap: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// 发布版本
|
||||||
|
const publishResult = await provider.publish({
|
||||||
|
name: 'v1.0.0',
|
||||||
|
description: 'Bug fixes',
|
||||||
|
rollout: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
// 上传文件
|
||||||
|
const uploadResult = await provider.upload({
|
||||||
|
filePath: 'app.ipa',
|
||||||
|
platform: 'ios'
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### 应用管理
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// 创建应用
|
||||||
|
await provider.createApp('MyApp', 'ios');
|
||||||
|
|
||||||
|
// 获取当前应用
|
||||||
|
const { appId, platform } = await provider.getSelectedApp('ios');
|
||||||
|
|
||||||
|
// 列出版本
|
||||||
|
const versions = await provider.listVersions(appId);
|
||||||
|
|
||||||
|
// 更新版本
|
||||||
|
await provider.updateVersion(appId, versionId, {
|
||||||
|
name: 'v1.1.0',
|
||||||
|
description: 'New features'
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### 自动化服务类
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
class DeploymentService {
|
||||||
|
private provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
async buildAndPublish(platform: Platform, version: string) {
|
||||||
|
// 1. 打包
|
||||||
|
const bundleResult = await this.provider.bundle({
|
||||||
|
platform, dev: false, sourcemap: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2. 发布
|
||||||
|
const publishResult = await this.provider.publish({
|
||||||
|
name: version, rollout: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
return { bundleResult, publishResult };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🎯 高级特性
|
||||||
|
|
||||||
|
### 1. 工作流验证
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const workflow: CustomWorkflow = {
|
||||||
|
name: 'my-workflow',
|
||||||
|
steps: [...],
|
||||||
|
validate: (context) => {
|
||||||
|
if (!context.options.version) {
|
||||||
|
console.error('必须指定版本号');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 条件执行
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const step: WorkflowStep = {
|
||||||
|
name: 'conditional-step',
|
||||||
|
execute: async (context) => { /* ... */ },
|
||||||
|
condition: (context) => {
|
||||||
|
return context.options.environment === 'production';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 错误处理
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
try {
|
||||||
|
const result = await moduleManager.executeCommand('deploy-prod', {
|
||||||
|
args: [],
|
||||||
|
options: {} // 缺少必需参数
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('执行失败:', error.message);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 自定义工作流注册
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
provider.registerWorkflow({
|
||||||
|
name: 'custom-workflow',
|
||||||
|
description: '自定义工作流',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'step1',
|
||||||
|
execute: async (context, previousResult) => {
|
||||||
|
// 执行逻辑
|
||||||
|
return { step1: 'completed' };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// 执行工作流
|
||||||
|
await provider.executeWorkflow('custom-workflow', {
|
||||||
|
args: [],
|
||||||
|
options: {}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📝 最佳实践
|
||||||
|
|
||||||
|
### 1. 模块设计
|
||||||
|
|
||||||
|
- **单一职责**: 每个模块专注于特定功能领域
|
||||||
|
- **清晰命名**: 使用描述性的命令和选项名称
|
||||||
|
- **完整文档**: 为所有命令和选项提供描述
|
||||||
|
- **错误处理**: 提供清晰的错误信息和恢复建议
|
||||||
|
|
||||||
|
### 2. 工作流设计
|
||||||
|
|
||||||
|
- **原子操作**: 每个步骤应该是原子的,可独立执行
|
||||||
|
- **状态传递**: 合理使用 previousResult 传递状态
|
||||||
|
- **错误恢复**: 考虑失败时的清理和恢复机制
|
||||||
|
- **进度反馈**: 提供清晰的进度信息给用户
|
||||||
|
|
||||||
|
### 3. 开发建议
|
||||||
|
|
||||||
|
- **类型安全**: 充分利用 TypeScript 类型系统
|
||||||
|
- **测试覆盖**: 为自定义模块编写测试
|
||||||
|
- **文档维护**: 保持示例和文档的同步更新
|
||||||
|
- **版本管理**: 为模块设置合适的版本号
|
||||||
|
|
||||||
|
## 🐛 故障排除
|
||||||
|
|
||||||
|
### 常见问题
|
||||||
|
|
||||||
|
1. **模块注册失败**
|
||||||
|
```typescript
|
||||||
|
// 确保模块符合 CLIModule 接口
|
||||||
|
const module: CLIModule = {
|
||||||
|
name: 'my-module',
|
||||||
|
version: '1.0.0',
|
||||||
|
commands: [...],
|
||||||
|
workflows: [...]
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **命令执行失败**
|
||||||
|
```typescript
|
||||||
|
// 检查命令名称和参数
|
||||||
|
await moduleManager.executeCommand('correct-command-name', {
|
||||||
|
args: [],
|
||||||
|
options: { requiredParam: 'value' }
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **工作流验证失败**
|
||||||
|
```typescript
|
||||||
|
// 确保提供所有必需的选项
|
||||||
|
await moduleManager.executeWorkflow('workflow-name', {
|
||||||
|
args: [],
|
||||||
|
options: { version: '1.0.0' } // 必需参数
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📖 相关文档
|
||||||
|
|
||||||
|
- [主项目 README](../README.md)
|
||||||
|
- [模块化架构文档](../docs/architecture.md)
|
||||||
|
- [API 参考文档](../docs/api-reference.md)
|
||||||
|
- [贡献指南](../CONTRIBUTING.md)
|
||||||
|
|
||||||
|
## 🤝 贡献
|
||||||
|
|
||||||
|
欢迎提交更多示例和改进建议!请查看主项目的贡献指南。
|
||||||
53
example/USAGE_CUSTOM_VERSION.md
Normal file
53
example/USAGE_CUSTOM_VERSION.md
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# Custom Version Parameter Usage
|
||||||
|
|
||||||
|
This document demonstrates how to use the `--version` parameter with upload commands to override the version extracted from APK/IPA/APP files.
|
||||||
|
|
||||||
|
## Commands Supporting Custom Version
|
||||||
|
|
||||||
|
- `uploadApk --version <version>`
|
||||||
|
- `uploadIpa --version <version>`
|
||||||
|
- `uploadApp --version <version>`
|
||||||
|
|
||||||
|
## Usage Examples
|
||||||
|
|
||||||
|
### Upload APK with Custom Version
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Upload APK and override version to "1.2.3-custom"
|
||||||
|
cresc uploadApk app-release.apk --version "1.2.3-custom"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Upload IPA with Custom Version
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Upload IPA and override version to "2.0.0-beta"
|
||||||
|
cresc uploadIpa MyApp.ipa --version "2.0.0-beta"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Upload APP with Custom Version
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Upload APP and override version to "3.1.0-harmony"
|
||||||
|
cresc uploadApp MyApp.app --version "3.1.0-harmony"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Behavior
|
||||||
|
|
||||||
|
1. **Without `--version`**: The command uses the version extracted from the package file (APK/IPA/APP)
|
||||||
|
2. **With `--version`**: The command uses the provided custom version instead of the extracted version
|
||||||
|
3. **Console Output**: When using a custom version, the CLI will display "Using custom version: <version>" message
|
||||||
|
|
||||||
|
## Use Cases
|
||||||
|
|
||||||
|
- **Testing**: Upload test builds with specific version identifiers
|
||||||
|
- **Hotfixes**: Override version numbers for emergency releases
|
||||||
|
- **Version Alignment**: Ensure consistent versioning across different platforms
|
||||||
|
- **Manual Override**: When the extracted version is incorrect or inappropriate
|
||||||
|
|
||||||
|
## Example Output
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cresc uploadApk app-release.apk --version "1.2.3-hotfix"
|
||||||
|
Using custom version: 1.2.3-hotfix
|
||||||
|
Successfully uploaded APK native package (id: 12345, version: 1.2.3-hotfix, buildTime: 2024-01-15T10:30:00Z)
|
||||||
|
```
|
||||||
149
example/modules/analytics-module.ts
Normal file
149
example/modules/analytics-module.ts
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
import type {
|
||||||
|
CLIModule,
|
||||||
|
CLIProvider,
|
||||||
|
CommandContext,
|
||||||
|
CommandResult,
|
||||||
|
} from '../../src/types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分析统计模块示例
|
||||||
|
* 演示一个简单的分析统计功能模块
|
||||||
|
*/
|
||||||
|
export const analyticsModule: CLIModule = {
|
||||||
|
name: 'analytics',
|
||||||
|
version: '1.0.0',
|
||||||
|
commands: [
|
||||||
|
{
|
||||||
|
name: 'track-deployment',
|
||||||
|
description: '记录部署统计信息',
|
||||||
|
handler: async (context: CommandContext): Promise<CommandResult> => {
|
||||||
|
console.log('📊 记录部署统计信息...');
|
||||||
|
|
||||||
|
const { platform, environment, version } = context.options;
|
||||||
|
|
||||||
|
const deploymentData = {
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
platform: platform || 'unknown',
|
||||||
|
environment: environment || 'unknown',
|
||||||
|
version: version || 'unknown',
|
||||||
|
success: true,
|
||||||
|
duration: Math.floor(Math.random() * 1000) + 500, // 模拟部署时长
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('✅ 部署统计已记录:');
|
||||||
|
console.log(JSON.stringify(deploymentData, null, 2));
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: deploymentData,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
platform: {
|
||||||
|
hasValue: true,
|
||||||
|
description: '平台',
|
||||||
|
},
|
||||||
|
environment: {
|
||||||
|
hasValue: true,
|
||||||
|
description: '环境',
|
||||||
|
},
|
||||||
|
version: {
|
||||||
|
hasValue: true,
|
||||||
|
description: '版本',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'deployment-report',
|
||||||
|
description: '生成部署报告',
|
||||||
|
handler: async (context: CommandContext): Promise<CommandResult> => {
|
||||||
|
console.log('📈 生成部署报告...');
|
||||||
|
|
||||||
|
const { days = 7 } = context.options;
|
||||||
|
|
||||||
|
// 模拟生成报告数据
|
||||||
|
const report = {
|
||||||
|
period: `最近 ${days} 天`,
|
||||||
|
totalDeployments: Math.floor(Math.random() * 50) + 10,
|
||||||
|
successRate: 95.5,
|
||||||
|
averageDuration: '2.3分钟',
|
||||||
|
platformBreakdown: {
|
||||||
|
ios: 45,
|
||||||
|
android: 38,
|
||||||
|
harmony: 12,
|
||||||
|
},
|
||||||
|
environmentBreakdown: {
|
||||||
|
development: 60,
|
||||||
|
staging: 25,
|
||||||
|
production: 15,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('📊 部署报告:');
|
||||||
|
console.log(JSON.stringify(report, null, 2));
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: report,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
days: {
|
||||||
|
hasValue: true,
|
||||||
|
default: 7,
|
||||||
|
description: '报告天数',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
workflows: [
|
||||||
|
{
|
||||||
|
name: 'deploy-with-analytics',
|
||||||
|
description: '带统计的部署流程',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'pre-deployment',
|
||||||
|
description: '部署前准备',
|
||||||
|
execute: async (context: CommandContext) => {
|
||||||
|
console.log('📋 部署前准备...');
|
||||||
|
return { startTime: Date.now() };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'deployment',
|
||||||
|
description: '执行部署',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('🚀 执行部署...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||||
|
return { ...previousResult, deploymentCompleted: true };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'record-analytics',
|
||||||
|
description: '记录统计信息',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('📊 记录统计信息...');
|
||||||
|
const duration = Date.now() - previousResult.startTime;
|
||||||
|
const analytics = {
|
||||||
|
duration,
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
success: true,
|
||||||
|
};
|
||||||
|
console.log(`✅ 部署完成,耗时 ${duration}ms`);
|
||||||
|
return { ...previousResult, analytics };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
init: (provider: CLIProvider) => {
|
||||||
|
console.log('📊 分析统计模块已初始化');
|
||||||
|
},
|
||||||
|
|
||||||
|
cleanup: () => {
|
||||||
|
console.log('🧹 分析统计模块清理完成');
|
||||||
|
},
|
||||||
|
};
|
||||||
315
example/modules/custom-deploy-module.ts
Normal file
315
example/modules/custom-deploy-module.ts
Normal file
@@ -0,0 +1,315 @@
|
|||||||
|
import type {
|
||||||
|
CLIModule,
|
||||||
|
CLIProvider,
|
||||||
|
CommandContext,
|
||||||
|
CommandDefinition,
|
||||||
|
CommandResult,
|
||||||
|
CustomWorkflow,
|
||||||
|
} from '../../src/types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义部署模块示例
|
||||||
|
* 演示如何创建一个包含多个命令和工作流的自定义模块
|
||||||
|
*/
|
||||||
|
export const customDeployModule: CLIModule = {
|
||||||
|
name: 'custom-deploy',
|
||||||
|
version: '1.0.0',
|
||||||
|
|
||||||
|
commands: [
|
||||||
|
{
|
||||||
|
name: 'deploy-dev',
|
||||||
|
description: '部署到开发环境',
|
||||||
|
handler: async (context: CommandContext): Promise<CommandResult> => {
|
||||||
|
console.log('🚀 开始部署到开发环境...');
|
||||||
|
|
||||||
|
const { platform = 'ios', force = false } = context.options;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 模拟部署逻辑
|
||||||
|
console.log(`📱 平台: ${platform}`);
|
||||||
|
console.log(`🔧 强制部署: ${force ? '是' : '否'}`);
|
||||||
|
|
||||||
|
// 模拟一些部署步骤
|
||||||
|
console.log('1. 检查环境配置...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
|
||||||
|
console.log('2. 构建应用包...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1500));
|
||||||
|
|
||||||
|
console.log('3. 上传到开发服务器...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
|
||||||
|
console.log('✅ 部署到开发环境完成!');
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: {
|
||||||
|
environment: 'development',
|
||||||
|
platform,
|
||||||
|
deployTime: new Date().toISOString(),
|
||||||
|
buildId: `dev-${Date.now()}`,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: error instanceof Error ? error.message : '部署失败',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
platform: {
|
||||||
|
hasValue: true,
|
||||||
|
default: 'ios',
|
||||||
|
description: '目标平台 (ios/android/harmony)',
|
||||||
|
},
|
||||||
|
force: {
|
||||||
|
hasValue: false,
|
||||||
|
default: false,
|
||||||
|
description: '强制部署,跳过确认',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'deploy-prod',
|
||||||
|
description: '部署到生产环境',
|
||||||
|
handler: async (context: CommandContext): Promise<CommandResult> => {
|
||||||
|
console.log('🔥 开始部署到生产环境...');
|
||||||
|
|
||||||
|
const { version, rollout = 100 } = context.options;
|
||||||
|
|
||||||
|
if (!version) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: '生产部署必须指定版本号',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
console.log(`📦 版本: ${version}`);
|
||||||
|
console.log(`📊 发布比例: ${rollout}%`);
|
||||||
|
|
||||||
|
console.log('1. 安全检查...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
|
||||||
|
console.log('2. 生产构建...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||||
|
|
||||||
|
console.log('3. 部署到生产环境...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1500));
|
||||||
|
|
||||||
|
console.log('4. 健康检查...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 800));
|
||||||
|
|
||||||
|
console.log('🎉 生产部署完成!');
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: {
|
||||||
|
environment: 'production',
|
||||||
|
version,
|
||||||
|
rollout,
|
||||||
|
deployTime: new Date().toISOString(),
|
||||||
|
buildId: `prod-${Date.now()}`,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: error instanceof Error ? error.message : '生产部署失败',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
version: {
|
||||||
|
hasValue: true,
|
||||||
|
description: '版本号 (必需)',
|
||||||
|
},
|
||||||
|
rollout: {
|
||||||
|
hasValue: true,
|
||||||
|
default: 100,
|
||||||
|
description: '发布比例 (0-100)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'rollback',
|
||||||
|
description: '回滚到指定版本',
|
||||||
|
handler: async (context: CommandContext): Promise<CommandResult> => {
|
||||||
|
console.log('🔄 开始回滚操作...');
|
||||||
|
|
||||||
|
const { version, immediate = false } = context.options;
|
||||||
|
|
||||||
|
if (!version) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: '回滚操作必须指定目标版本',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
console.log(`🎯 目标版本: ${version}`);
|
||||||
|
console.log(`⚡ 立即回滚: ${immediate ? '是' : '否'}`);
|
||||||
|
|
||||||
|
console.log('1. 验证目标版本...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 800));
|
||||||
|
|
||||||
|
console.log('2. 准备回滚...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
|
||||||
|
console.log('3. 执行回滚...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1200));
|
||||||
|
|
||||||
|
console.log('✅ 回滚完成!');
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: {
|
||||||
|
targetVersion: version,
|
||||||
|
rollbackTime: new Date().toISOString(),
|
||||||
|
immediate,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: error instanceof Error ? error.message : '回滚失败',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
version: {
|
||||||
|
hasValue: true,
|
||||||
|
description: '目标版本号 (必需)',
|
||||||
|
},
|
||||||
|
immediate: {
|
||||||
|
hasValue: false,
|
||||||
|
default: false,
|
||||||
|
description: '立即回滚,不等待确认',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
workflows: [
|
||||||
|
{
|
||||||
|
name: 'full-deploy',
|
||||||
|
description: '完整部署流程:开发 -> 测试 -> 生产',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'deploy-to-dev',
|
||||||
|
description: '部署到开发环境',
|
||||||
|
execute: async (context: CommandContext) => {
|
||||||
|
console.log('🔧 步骤 1: 部署到开发环境');
|
||||||
|
// 这里可以调用其他命令或执行自定义逻辑
|
||||||
|
return { environment: 'dev', status: 'completed' };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'run-tests',
|
||||||
|
description: '运行自动化测试',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('🧪 步骤 2: 运行自动化测试');
|
||||||
|
console.log(' - 单元测试...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
console.log(' - 集成测试...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1500));
|
||||||
|
console.log(' - E2E测试...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||||
|
return { ...previousResult, tests: 'passed' };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'deploy-to-prod',
|
||||||
|
description: '部署到生产环境',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('🚀 步骤 3: 部署到生产环境');
|
||||||
|
if (previousResult.tests !== 'passed') {
|
||||||
|
throw new Error('测试未通过,无法部署到生产环境');
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
environment: 'production',
|
||||||
|
status: 'deployed',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
condition: (context: CommandContext) => {
|
||||||
|
// 只有在非跳过生产部署的情况下才执行
|
||||||
|
return !context.options.skipProd;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
validate: (context: CommandContext) => {
|
||||||
|
if (!context.options.version) {
|
||||||
|
console.error('❌ 完整部署流程需要指定版本号');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
version: {
|
||||||
|
hasValue: true,
|
||||||
|
description: '版本号 (必需)',
|
||||||
|
},
|
||||||
|
skipProd: {
|
||||||
|
hasValue: false,
|
||||||
|
default: false,
|
||||||
|
description: '跳过生产部署',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'hotfix-deploy',
|
||||||
|
description: '热修复快速部署流程',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'validate-hotfix',
|
||||||
|
description: '验证热修复',
|
||||||
|
execute: async (context: CommandContext) => {
|
||||||
|
console.log('🔍 验证热修复内容...');
|
||||||
|
const { hotfixId } = context.options;
|
||||||
|
if (!hotfixId) {
|
||||||
|
throw new Error('缺少热修复ID');
|
||||||
|
}
|
||||||
|
return { hotfixId, validated: true };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'emergency-deploy',
|
||||||
|
description: '紧急部署',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('🚨 执行紧急部署...');
|
||||||
|
console.log('⚡ 快速构建...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 800));
|
||||||
|
console.log('🚀 立即发布...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 600));
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
deployed: true,
|
||||||
|
deployTime: new Date().toISOString(),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
options: {
|
||||||
|
hotfixId: {
|
||||||
|
hasValue: true,
|
||||||
|
description: '热修复ID (必需)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
init: (provider: CLIProvider) => {
|
||||||
|
console.log('🎯 自定义部署模块已初始化');
|
||||||
|
console.log(' 可用命令: deploy-dev, deploy-prod, rollback');
|
||||||
|
console.log(' 可用工作流: full-deploy, hotfix-deploy');
|
||||||
|
},
|
||||||
|
|
||||||
|
cleanup: () => {
|
||||||
|
console.log('🧹 自定义部署模块清理完成');
|
||||||
|
},
|
||||||
|
};
|
||||||
41
example/package.json
Normal file
41
example/package.json
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"name": "react-native-update-cli-examples",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "React Native Update CLI 自定义模块和工作流示例",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc --noEmit --skipLibCheck",
|
||||||
|
"register-modules": "ts-node scripts/register-modules.ts",
|
||||||
|
"provider-demo": "ts-node scripts/provider-api-example.ts",
|
||||||
|
"workflow-demo": "ts-node scripts/workflow-demo.ts",
|
||||||
|
"workflow-interactive": "ts-node scripts/workflow-demo.ts interactive",
|
||||||
|
"enhanced-workflow-demo": "ts-node scripts/enhanced-workflow-demo.ts",
|
||||||
|
"enhanced-workflow-interactive": "ts-node scripts/enhanced-workflow-demo.ts interactive",
|
||||||
|
"demo:all": "npm run register-modules && npm run provider-demo && npm run workflow-demo && npm run enhanced-workflow-demo",
|
||||||
|
"demo:canary": "npm run workflow-interactive canary-deployment -- --version 1.0.0 --initialRollout 5",
|
||||||
|
"demo:multi-env": "npm run workflow-interactive multi-env-deploy -- --version 1.0.0",
|
||||||
|
"demo:rollback": "npm run workflow-interactive rollback-workflow -- --targetVersion 0.9.5",
|
||||||
|
"demo:app-init": "npm run enhanced-workflow-interactive app-initialization -- --name MyApp --platform ios",
|
||||||
|
"demo:smart-bundle": "npm run enhanced-workflow-interactive intelligent-bundle -- --platform android --optimize true",
|
||||||
|
"demo:version-release": "npm run enhanced-workflow-interactive version-release-management -- --name v1.0.0 --platform ios --dryRun true"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"react-native-update-cli": "file:../"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^20.0.0",
|
||||||
|
"ts-node": "^10.9.0",
|
||||||
|
"typescript": "^5.0.0"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"react-native",
|
||||||
|
"update",
|
||||||
|
"cli",
|
||||||
|
"module",
|
||||||
|
"workflow",
|
||||||
|
"example",
|
||||||
|
"custom"
|
||||||
|
],
|
||||||
|
"author": "reactnativecn",
|
||||||
|
"license": "BSD-3-Clause"
|
||||||
|
}
|
||||||
552
example/scripts/enhanced-workflow-demo.ts
Normal file
552
example/scripts/enhanced-workflow-demo.ts
Normal file
@@ -0,0 +1,552 @@
|
|||||||
|
#!/usr/bin/env ts-node
|
||||||
|
|
||||||
|
import { moduleManager } from '../../src/module-manager';
|
||||||
|
import { enhancedCoreWorkflows } from '../workflows/enhanced-core-workflows';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增强核心工作流演示脚本
|
||||||
|
* 展示如何使用为核心模块设计的高级工作流
|
||||||
|
*/
|
||||||
|
|
||||||
|
async function registerEnhancedWorkflows() {
|
||||||
|
console.log('📦 注册增强核心工作流...\n');
|
||||||
|
|
||||||
|
const provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
// 注册所有增强核心工作流
|
||||||
|
enhancedCoreWorkflows.forEach((workflow) => {
|
||||||
|
provider.registerWorkflow(workflow);
|
||||||
|
console.log(`✅ 注册工作流: ${workflow.name}`);
|
||||||
|
console.log(` 描述: ${workflow.description}`);
|
||||||
|
console.log(` 步骤数: ${workflow.steps.length}`);
|
||||||
|
console.log();
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('📋 所有增强核心工作流注册完成\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 演示App模块工作流
|
||||||
|
*/
|
||||||
|
async function demonstrateAppWorkflows() {
|
||||||
|
console.log('📱 演示App模块增强工作流\n');
|
||||||
|
console.log('='.repeat(70));
|
||||||
|
|
||||||
|
// 1. 应用初始化工作流
|
||||||
|
console.log('🚀 应用初始化工作流演示');
|
||||||
|
console.log('-'.repeat(40));
|
||||||
|
|
||||||
|
try {
|
||||||
|
const initResult = await moduleManager.executeWorkflow(
|
||||||
|
'app-initialization',
|
||||||
|
{
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
name: 'MyAwesomeApp',
|
||||||
|
platform: 'ios',
|
||||||
|
downloadUrl: 'https://example.com/download',
|
||||||
|
force: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log('\\n📊 应用初始化结果:');
|
||||||
|
console.log(
|
||||||
|
`创建状态: ${initResult.data?.created ? '✅ 成功' : '❌ 失败'}`,
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
`配置状态: ${initResult.data?.configured ? '✅ 成功' : '❌ 失败'}`,
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
`验证状态: ${initResult.data?.verified ? '✅ 成功' : '❌ 失败'}`,
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
'❌ 应用初始化工作流失败:',
|
||||||
|
error instanceof Error ? error.message : error,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\\n' + '-'.repeat(40));
|
||||||
|
|
||||||
|
// 2. 多平台应用管理工作流
|
||||||
|
console.log('\\n🌍 多平台应用管理工作流演示');
|
||||||
|
console.log('-'.repeat(40));
|
||||||
|
|
||||||
|
try {
|
||||||
|
const managementResult = await moduleManager.executeWorkflow(
|
||||||
|
'multi-platform-app-management',
|
||||||
|
{
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
includeInactive: true,
|
||||||
|
autoOptimize: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log('\\n📊 多平台管理结果:');
|
||||||
|
if (managementResult.data?.analysis) {
|
||||||
|
const analysis = managementResult.data.analysis;
|
||||||
|
console.log(`总应用数: ${analysis.totalApps}`);
|
||||||
|
console.log(`活跃应用: ${analysis.activeApps}`);
|
||||||
|
console.log(`平台分布: ${JSON.stringify(analysis.platformDistribution)}`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
'❌ 多平台应用管理工作流失败:',
|
||||||
|
error instanceof Error ? error.message : error,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\\n' + '='.repeat(70) + '\\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 演示Bundle模块工作流
|
||||||
|
*/
|
||||||
|
async function demonstrateBundleWorkflows() {
|
||||||
|
console.log('📦 演示Bundle模块增强工作流\n');
|
||||||
|
console.log('='.repeat(70));
|
||||||
|
|
||||||
|
// 1. 智能打包工作流
|
||||||
|
console.log('🧠 智能打包工作流演示');
|
||||||
|
console.log('-'.repeat(40));
|
||||||
|
|
||||||
|
try {
|
||||||
|
const bundleResult = await moduleManager.executeWorkflow(
|
||||||
|
'intelligent-bundle',
|
||||||
|
{
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
platform: 'ios',
|
||||||
|
dev: false,
|
||||||
|
sourcemap: true,
|
||||||
|
optimize: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log('\\n📊 智能打包结果:');
|
||||||
|
if (bundleResult.data?.buildResults) {
|
||||||
|
const builds = bundleResult.data.buildResults;
|
||||||
|
builds.forEach((build: any) => {
|
||||||
|
console.log(
|
||||||
|
`${build.platform}: ${build.success ? '✅ 成功' : '❌ 失败'} (${build.buildTime}s, ${build.bundleSize}MB)`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bundleResult.data?.averageScore) {
|
||||||
|
console.log(`平均质量评分: ${bundleResult.data.averageScore}%`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
'❌ 智能打包工作流失败:',
|
||||||
|
error instanceof Error ? error.message : error,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\\n' + '-'.repeat(40));
|
||||||
|
|
||||||
|
// 2. 增量构建工作流
|
||||||
|
console.log('\\n🔄 增量构建工作流演示');
|
||||||
|
console.log('-'.repeat(40));
|
||||||
|
|
||||||
|
try {
|
||||||
|
const incrementalResult = await moduleManager.executeWorkflow(
|
||||||
|
'incremental-build',
|
||||||
|
{
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
platform: 'android',
|
||||||
|
baseVersion: 'v1.0.0',
|
||||||
|
skipValidation: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log('\\n📊 增量构建结果:');
|
||||||
|
if (incrementalResult.data?.diffPackage) {
|
||||||
|
const diff = incrementalResult.data.diffPackage;
|
||||||
|
console.log(`基准版本: ${diff.fromVersion}`);
|
||||||
|
console.log(`目标版本: ${diff.toVersion}`);
|
||||||
|
console.log(`原始大小: ${diff.originalSize}MB`);
|
||||||
|
console.log(`差异包大小: ${diff.diffSize}MB`);
|
||||||
|
console.log(`压缩比: ${diff.compressionRatio}%`);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`验证状态: ${incrementalResult.data?.allValid ? '✅ 通过' : '❌ 失败'}`,
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
'❌ 增量构建工作流失败:',
|
||||||
|
error instanceof Error ? error.message : error,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\\n' + '='.repeat(70) + '\\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 演示Package模块工作流
|
||||||
|
*/
|
||||||
|
async function demonstratePackageWorkflows() {
|
||||||
|
console.log('📄 演示Package模块增强工作流\n');
|
||||||
|
console.log('='.repeat(70));
|
||||||
|
|
||||||
|
// 批量包处理工作流
|
||||||
|
console.log('📦 批量包处理工作流演示');
|
||||||
|
console.log('-'.repeat(40));
|
||||||
|
|
||||||
|
try {
|
||||||
|
const packageResult = await moduleManager.executeWorkflow(
|
||||||
|
'batch-package-processing',
|
||||||
|
{
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
directory: './packages',
|
||||||
|
pattern: '*.{ipa,apk,app}',
|
||||||
|
skipUpload: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log('\\n📊 批量包处理结果:');
|
||||||
|
if (packageResult.data?.report) {
|
||||||
|
const report = packageResult.data.report;
|
||||||
|
console.log(`总包数: ${report.summary.totalPackages}`);
|
||||||
|
console.log(`解析成功: ${report.summary.parsedSuccessfully}`);
|
||||||
|
console.log(`上传成功: ${report.summary.uploadedSuccessfully}`);
|
||||||
|
console.log(`总大小: ${report.summary.totalSize.toFixed(1)}MB`);
|
||||||
|
|
||||||
|
if (report.failedOperations.length > 0) {
|
||||||
|
console.log('\\n❌ 失败操作:');
|
||||||
|
report.failedOperations.forEach((op: any) => {
|
||||||
|
console.log(` ${op.operation}: ${op.file}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
'❌ 批量包处理工作流失败:',
|
||||||
|
error instanceof Error ? error.message : error,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\\n' + '='.repeat(70) + '\\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 演示Version模块工作流
|
||||||
|
*/
|
||||||
|
async function demonstrateVersionWorkflows() {
|
||||||
|
console.log('🏷️ 演示Version模块增强工作流\n');
|
||||||
|
console.log('='.repeat(70));
|
||||||
|
|
||||||
|
// 版本发布管理工作流
|
||||||
|
console.log('🚀 版本发布管理工作流演示');
|
||||||
|
console.log('-'.repeat(40));
|
||||||
|
|
||||||
|
try {
|
||||||
|
const versionResult = await moduleManager.executeWorkflow(
|
||||||
|
'version-release-management',
|
||||||
|
{
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
name: 'v2.1.0',
|
||||||
|
description: 'Major feature update with bug fixes',
|
||||||
|
platform: 'ios',
|
||||||
|
rollout: 50,
|
||||||
|
dryRun: true, // 使用模拟发布
|
||||||
|
force: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log('\\n📊 版本发布结果:');
|
||||||
|
if (versionResult.data?.summary) {
|
||||||
|
const summary = versionResult.data.summary;
|
||||||
|
console.log(`版本: ${summary.version}`);
|
||||||
|
console.log(`平台: ${summary.platform}`);
|
||||||
|
console.log(`发布状态: ${summary.success ? '✅ 成功' : '❌ 失败'}`);
|
||||||
|
console.log(
|
||||||
|
`监控状态: ${summary.monitoringHealthy ? '✅ 正常' : '⚠️ 有警告'}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (summary.releaseId) {
|
||||||
|
console.log(`发布ID: ${summary.releaseId}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (versionResult.data?.dryRun) {
|
||||||
|
console.log('\\n🔍 这是一次模拟发布,未实际执行');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
'❌ 版本发布管理工作流失败:',
|
||||||
|
error instanceof Error ? error.message : error,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\\n' + '='.repeat(70) + '\\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 演示工作流组合使用
|
||||||
|
*/
|
||||||
|
async function demonstrateWorkflowComposition() {
|
||||||
|
console.log('🔗 演示工作流组合使用\n');
|
||||||
|
console.log('='.repeat(70));
|
||||||
|
|
||||||
|
console.log('📋 完整发布流程演示 (应用初始化 → 智能打包 → 版本发布)');
|
||||||
|
console.log('-'.repeat(60));
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 1. 应用初始化
|
||||||
|
console.log('\\n步骤 1: 应用初始化');
|
||||||
|
const appResult = await moduleManager.executeWorkflow(
|
||||||
|
'app-initialization',
|
||||||
|
{
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
name: 'CompositeApp',
|
||||||
|
platform: 'android',
|
||||||
|
force: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!appResult.success) {
|
||||||
|
throw new Error('应用初始化失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 智能打包
|
||||||
|
console.log('\\n步骤 2: 智能打包');
|
||||||
|
const bundleResult = await moduleManager.executeWorkflow(
|
||||||
|
'intelligent-bundle',
|
||||||
|
{
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
platform: 'android',
|
||||||
|
dev: false,
|
||||||
|
optimize: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!bundleResult.success) {
|
||||||
|
throw new Error('智能打包失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 版本发布
|
||||||
|
console.log('\\n步骤 3: 版本发布');
|
||||||
|
const releaseResult = await moduleManager.executeWorkflow(
|
||||||
|
'version-release-management',
|
||||||
|
{
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
name: 'v1.0.0',
|
||||||
|
description: 'Initial release via composition workflow',
|
||||||
|
platform: 'android',
|
||||||
|
rollout: 10,
|
||||||
|
dryRun: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!releaseResult.success) {
|
||||||
|
throw new Error('版本发布失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\\n🎉 完整发布流程执行成功!');
|
||||||
|
console.log('📊 流程总结:');
|
||||||
|
console.log(
|
||||||
|
` ✅ 应用初始化: ${appResult.data?.created ? '成功' : '失败'}`,
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
` ✅ 智能打包: ${bundleResult.data?.allSuccess ? '成功' : '失败'}`,
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
` ✅ 版本发布: ${releaseResult.data?.summary?.success ? '成功' : '失败'}`,
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
'❌ 工作流组合执行失败:',
|
||||||
|
error instanceof Error ? error.message : error,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\\n' + '='.repeat(70) + '\\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列出所有增强工作流及其用途
|
||||||
|
*/
|
||||||
|
async function listEnhancedWorkflows() {
|
||||||
|
console.log('📋 增强核心工作流列表\n');
|
||||||
|
console.log('='.repeat(70));
|
||||||
|
|
||||||
|
const workflowCategories = {
|
||||||
|
App模块工作流: [
|
||||||
|
{
|
||||||
|
name: 'app-initialization',
|
||||||
|
description: '完整应用初始化流程 - 创建、配置、验证',
|
||||||
|
useCase: '新应用创建和设置',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'multi-platform-app-management',
|
||||||
|
description: '多平台应用统一管理工作流',
|
||||||
|
useCase: '跨平台应用管理和优化',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
Bundle模块工作流: [
|
||||||
|
{
|
||||||
|
name: 'intelligent-bundle',
|
||||||
|
description: '智能打包工作流 - 自动优化和多平台构建',
|
||||||
|
useCase: '高效的自动化构建',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'incremental-build',
|
||||||
|
description: '增量构建工作流 - 生成差异包',
|
||||||
|
useCase: '减少更新包大小',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
Package模块工作流: [
|
||||||
|
{
|
||||||
|
name: 'batch-package-processing',
|
||||||
|
description: '批量包处理工作流 - 上传、解析、验证',
|
||||||
|
useCase: '批量处理应用包文件',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
Version模块工作流: [
|
||||||
|
{
|
||||||
|
name: 'version-release-management',
|
||||||
|
description: '版本发布管理工作流 - 完整的版本发布生命周期',
|
||||||
|
useCase: '规范化版本发布流程',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.entries(workflowCategories).forEach(([category, workflows]) => {
|
||||||
|
console.log(`\\n📂 ${category}:`);
|
||||||
|
console.log('-'.repeat(50));
|
||||||
|
|
||||||
|
workflows.forEach((workflow, index) => {
|
||||||
|
console.log(`${index + 1}. ${workflow.name}`);
|
||||||
|
console.log(` 描述: ${workflow.description}`);
|
||||||
|
console.log(` 用途: ${workflow.useCase}`);
|
||||||
|
console.log();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('='.repeat(70) + '\\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主函数
|
||||||
|
*/
|
||||||
|
async function main() {
|
||||||
|
console.log('🎯 增强核心工作流演示脚本\\n');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 1. 注册增强工作流
|
||||||
|
await registerEnhancedWorkflows();
|
||||||
|
|
||||||
|
// 2. 列出所有工作流
|
||||||
|
await listEnhancedWorkflows();
|
||||||
|
|
||||||
|
// 3. 演示各模块工作流
|
||||||
|
await demonstrateAppWorkflows();
|
||||||
|
await demonstrateBundleWorkflows();
|
||||||
|
await demonstratePackageWorkflows();
|
||||||
|
await demonstrateVersionWorkflows();
|
||||||
|
|
||||||
|
// 4. 演示工作流组合
|
||||||
|
await demonstrateWorkflowComposition();
|
||||||
|
|
||||||
|
console.log('🎉 所有增强核心工作流演示完成!');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ 演示过程中发生错误:', error);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交互式工作流执行
|
||||||
|
*/
|
||||||
|
async function interactiveEnhancedWorkflowExecution() {
|
||||||
|
console.log('\\n🎮 交互式增强工作流执行\\n');
|
||||||
|
|
||||||
|
const workflowName = process.argv[3];
|
||||||
|
|
||||||
|
if (!workflowName) {
|
||||||
|
console.log('使用方法:');
|
||||||
|
console.log(' npm run enhanced-workflow-demo [工作流名称]');
|
||||||
|
console.log('\\n可用的增强工作流:');
|
||||||
|
console.log(' App模块:');
|
||||||
|
console.log(' - app-initialization');
|
||||||
|
console.log(' - multi-platform-app-management');
|
||||||
|
console.log(' Bundle模块:');
|
||||||
|
console.log(' - intelligent-bundle');
|
||||||
|
console.log(' - incremental-build');
|
||||||
|
console.log(' Package模块:');
|
||||||
|
console.log(' - batch-package-processing');
|
||||||
|
console.log(' Version模块:');
|
||||||
|
console.log(' - version-release-management');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析命令行参数
|
||||||
|
const options: Record<string, any> = {};
|
||||||
|
for (let i = 4; i < process.argv.length; i += 2) {
|
||||||
|
const key = process.argv[i]?.replace(/^--/, '');
|
||||||
|
const value = process.argv[i + 1];
|
||||||
|
if (key && value) {
|
||||||
|
// 尝试解析布尔值和数字
|
||||||
|
if (value === 'true') options[key] = true;
|
||||||
|
else if (value === 'false') options[key] = false;
|
||||||
|
else if (/^\d+$/.test(value)) options[key] = Number.parseInt(value);
|
||||||
|
else options[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`执行增强工作流: ${workflowName}`);
|
||||||
|
console.log('参数:', options);
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
try {
|
||||||
|
await registerEnhancedWorkflows();
|
||||||
|
|
||||||
|
const result = await moduleManager.executeWorkflow(workflowName, {
|
||||||
|
args: [],
|
||||||
|
options,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('\\n📊 工作流执行结果:');
|
||||||
|
console.log(JSON.stringify(result, null, 2));
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ 工作流执行失败:', error);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行脚本
|
||||||
|
if (require.main === module) {
|
||||||
|
if (process.argv.length > 2 && process.argv[2] === 'interactive') {
|
||||||
|
interactiveEnhancedWorkflowExecution()
|
||||||
|
.then(() => process.exit(0))
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('❌ 交互式执行失败:', error);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
main()
|
||||||
|
.then(() => process.exit(0))
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('❌ 演示脚本执行失败:', error);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
342
example/scripts/provider-api-example.ts
Normal file
342
example/scripts/provider-api-example.ts
Normal file
@@ -0,0 +1,342 @@
|
|||||||
|
#!/usr/bin/env ts-node
|
||||||
|
|
||||||
|
import { moduleManager } from '../../src/module-manager';
|
||||||
|
import type { CLIProvider, Platform } from '../../src/types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provider API 使用示例
|
||||||
|
* 演示如何使用 CLIProvider 进行编程式操作
|
||||||
|
*/
|
||||||
|
|
||||||
|
class DeploymentService {
|
||||||
|
private provider: CLIProvider;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.provider = moduleManager.getProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动化构建和发布流程
|
||||||
|
*/
|
||||||
|
async buildAndPublish(platform: Platform, version: string) {
|
||||||
|
console.log(
|
||||||
|
`🚀 开始 ${platform} 平台的构建和发布流程 (版本: ${version})\n`,
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 1. 打包应用
|
||||||
|
console.log('📦 正在打包应用...');
|
||||||
|
const bundleResult = await this.provider.bundle({
|
||||||
|
platform,
|
||||||
|
dev: false,
|
||||||
|
sourcemap: true,
|
||||||
|
bundleName: `app-${version}.bundle`,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!bundleResult.success) {
|
||||||
|
throw new Error(`打包失败: ${bundleResult.error}`);
|
||||||
|
}
|
||||||
|
console.log('✅ 打包完成');
|
||||||
|
|
||||||
|
// 2. 发布版本
|
||||||
|
console.log('\n📡 正在发布版本...');
|
||||||
|
const publishResult = await this.provider.publish({
|
||||||
|
name: version,
|
||||||
|
description: `自动发布版本 ${version}`,
|
||||||
|
rollout: 100,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!publishResult.success) {
|
||||||
|
throw new Error(`发布失败: ${publishResult.error}`);
|
||||||
|
}
|
||||||
|
console.log('✅ 发布完成');
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
bundleData: bundleResult.data,
|
||||||
|
publishData: publishResult.data,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ 构建发布失败:', error);
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用管理示例
|
||||||
|
*/
|
||||||
|
async manageApp(platform: Platform) {
|
||||||
|
console.log(`📱 管理 ${platform} 应用\n`);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 获取当前选中的应用
|
||||||
|
const { appId } = await this.provider.getSelectedApp(platform);
|
||||||
|
console.log(`当前应用ID: ${appId}`);
|
||||||
|
|
||||||
|
// 列出应用版本
|
||||||
|
const versionsResult = await this.provider.listVersions(appId);
|
||||||
|
if (versionsResult.success && versionsResult.data) {
|
||||||
|
console.log('📋 应用版本列表:');
|
||||||
|
versionsResult.data.forEach((version: any, index: number) => {
|
||||||
|
console.log(` ${index + 1}. ${version.name} (${version.id})`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 列出应用包
|
||||||
|
const packagesResult = await (this.provider as any).listPackages(appId);
|
||||||
|
if (packagesResult.success && packagesResult.data) {
|
||||||
|
console.log('\n📦 应用包列表:');
|
||||||
|
packagesResult.data.forEach((pkg: any, index: number) => {
|
||||||
|
console.log(` ${index + 1}. ${pkg.name} (${pkg.id})`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return { appId, platform };
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ 应用管理失败:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量操作示例
|
||||||
|
*/
|
||||||
|
async batchOperations() {
|
||||||
|
console.log('🔄 批量操作示例\n');
|
||||||
|
|
||||||
|
const platforms: Platform[] = ['ios', 'android'];
|
||||||
|
const results = [];
|
||||||
|
|
||||||
|
for (const platform of platforms) {
|
||||||
|
try {
|
||||||
|
console.log(`--- 处理 ${platform} 平台 ---`);
|
||||||
|
|
||||||
|
// 获取平台信息
|
||||||
|
const platformInfo = await this.provider.getPlatform(platform);
|
||||||
|
console.log(`平台: ${platformInfo}`);
|
||||||
|
|
||||||
|
// 模拟打包操作
|
||||||
|
const bundleResult = await this.provider.bundle({
|
||||||
|
platform,
|
||||||
|
dev: true,
|
||||||
|
sourcemap: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
results.push({
|
||||||
|
platform,
|
||||||
|
success: bundleResult.success,
|
||||||
|
data: bundleResult.data,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`${platform} 处理完成: ${bundleResult.success ? '✅' : '❌'}\n`,
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`${platform} 处理失败:`, error);
|
||||||
|
results.push({
|
||||||
|
platform,
|
||||||
|
success: false,
|
||||||
|
error: error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传示例
|
||||||
|
*/
|
||||||
|
async uploadExample() {
|
||||||
|
console.log('📤 文件上传示例\n');
|
||||||
|
|
||||||
|
// 模拟上传文件路径
|
||||||
|
const mockFilePaths = {
|
||||||
|
ios: '/path/to/app.ipa',
|
||||||
|
android: '/path/to/app.apk',
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
for (const [platform, filePath] of Object.entries(mockFilePaths)) {
|
||||||
|
console.log(`上传 ${platform} 文件: ${filePath}`);
|
||||||
|
|
||||||
|
// 注意:这里是模拟,实际使用时需要真实的文件路径
|
||||||
|
const uploadResult = await this.provider.upload({
|
||||||
|
platform: platform as Platform,
|
||||||
|
filePath,
|
||||||
|
appId: 'mock-app-id',
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`${platform} 上传结果:`,
|
||||||
|
uploadResult.success ? '✅' : '❌',
|
||||||
|
);
|
||||||
|
if (!uploadResult.success) {
|
||||||
|
console.log(`错误: ${uploadResult.error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ 上传过程中发生错误:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高级工作流示例
|
||||||
|
*/
|
||||||
|
async function demonstrateAdvancedWorkflows() {
|
||||||
|
console.log('\n🔧 高级工作流示例\n');
|
||||||
|
|
||||||
|
const provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
// 注册自定义工作流
|
||||||
|
provider.registerWorkflow({
|
||||||
|
name: 'advanced-ci-cd',
|
||||||
|
description: '高级CI/CD流程',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'environment-check',
|
||||||
|
description: '环境检查',
|
||||||
|
execute: async (context) => {
|
||||||
|
console.log('🔍 检查环境配置...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
return { environmentValid: true };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'quality-gate',
|
||||||
|
description: '质量门禁',
|
||||||
|
execute: async (context, previousResult) => {
|
||||||
|
console.log('🛡️ 执行质量门禁检查...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1500));
|
||||||
|
|
||||||
|
// 模拟质量检查
|
||||||
|
const qualityScore = Math.random() * 100;
|
||||||
|
const passed = qualityScore > 80;
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`质量分数: ${qualityScore.toFixed(1)}/100 ${passed ? '✅' : '❌'}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!passed) {
|
||||||
|
throw new Error('质量门禁检查未通过');
|
||||||
|
}
|
||||||
|
|
||||||
|
return { ...previousResult, qualityScore };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'multi-platform-build',
|
||||||
|
description: '多平台构建',
|
||||||
|
execute: async (context, previousResult) => {
|
||||||
|
console.log('🏗️ 多平台并行构建...');
|
||||||
|
|
||||||
|
const platforms: Platform[] = ['ios', 'android'];
|
||||||
|
const buildResults = [];
|
||||||
|
|
||||||
|
// 模拟并行构建
|
||||||
|
for (const platform of platforms) {
|
||||||
|
console.log(` 构建 ${platform}...`);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 800));
|
||||||
|
buildResults.push({ platform, success: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
return { ...previousResult, builds: buildResults };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'deployment-notification',
|
||||||
|
description: '部署通知',
|
||||||
|
execute: async (context, previousResult) => {
|
||||||
|
console.log('📢 发送部署通知...');
|
||||||
|
|
||||||
|
const notification = {
|
||||||
|
message: '部署完成',
|
||||||
|
platforms: previousResult.builds?.map((b: any) => b.platform) || [],
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('通知内容:', JSON.stringify(notification, null, 2));
|
||||||
|
|
||||||
|
return { ...previousResult, notification };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
validate: (context) => {
|
||||||
|
if (!context.options.environment) {
|
||||||
|
console.error('❌ 必须指定环境参数');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
environment: {
|
||||||
|
hasValue: true,
|
||||||
|
description: '部署环境 (必需)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// 执行高级工作流
|
||||||
|
try {
|
||||||
|
const result = await provider.executeWorkflow('advanced-ci-cd', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
environment: 'production',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log('\n🎉 高级工作流执行完成:', result);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ 高级工作流执行失败:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主函数
|
||||||
|
*/
|
||||||
|
async function main() {
|
||||||
|
console.log('🎯 Provider API 使用示例\n');
|
||||||
|
|
||||||
|
const service = new DeploymentService();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 1. 构建和发布示例
|
||||||
|
await service.buildAndPublish('ios', '1.2.3');
|
||||||
|
console.log('\n' + '='.repeat(50) + '\n');
|
||||||
|
|
||||||
|
// 2. 应用管理示例
|
||||||
|
await service.manageApp('ios');
|
||||||
|
console.log('\n' + '='.repeat(50) + '\n');
|
||||||
|
|
||||||
|
// 3. 批量操作示例
|
||||||
|
const batchResults = await service.batchOperations();
|
||||||
|
console.log('批量操作结果:', batchResults);
|
||||||
|
console.log('\n' + '='.repeat(50) + '\n');
|
||||||
|
|
||||||
|
// 4. 文件上传示例
|
||||||
|
await service.uploadExample();
|
||||||
|
console.log('\n' + '='.repeat(50) + '\n');
|
||||||
|
|
||||||
|
// 5. 高级工作流示例
|
||||||
|
await demonstrateAdvancedWorkflows();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ 示例执行失败:', error);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行示例
|
||||||
|
if (require.main === module) {
|
||||||
|
main()
|
||||||
|
.then(() => {
|
||||||
|
console.log('\n✨ Provider API 示例执行完成');
|
||||||
|
process.exit(0);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('❌ 示例执行失败:', error);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
}
|
||||||
155
example/scripts/register-modules.ts
Normal file
155
example/scripts/register-modules.ts
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
#!/usr/bin/env ts-node
|
||||||
|
|
||||||
|
import { moduleManager } from '../../src/module-manager';
|
||||||
|
import { analyticsModule } from '../modules/analytics-module';
|
||||||
|
import { customDeployModule } from '../modules/custom-deploy-module';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块注册和执行示例脚本
|
||||||
|
* 演示如何注册自定义模块并执行命令和工作流
|
||||||
|
*/
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
console.log('🚀 开始模块注册和执行示例\n');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 1. 注册自定义模块
|
||||||
|
console.log('📦 注册自定义模块...');
|
||||||
|
moduleManager.registerModule(customDeployModule);
|
||||||
|
moduleManager.registerModule(analyticsModule);
|
||||||
|
console.log('✅ 模块注册完成\n');
|
||||||
|
|
||||||
|
// 2. 列出所有可用的命令
|
||||||
|
console.log('📋 可用命令列表:');
|
||||||
|
const commands = moduleManager.listCommands();
|
||||||
|
commands.forEach((cmd) => {
|
||||||
|
console.log(` - ${cmd.name}: ${cmd.description || '无描述'}`);
|
||||||
|
});
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
// 3. 列出所有可用的工作流
|
||||||
|
console.log('🔄 可用工作流列表:');
|
||||||
|
const workflows = moduleManager.listWorkflows();
|
||||||
|
workflows.forEach((workflow) => {
|
||||||
|
console.log(` - ${workflow.name}: ${workflow.description || '无描述'}`);
|
||||||
|
});
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
// 4. 执行自定义命令示例
|
||||||
|
console.log('🎯 执行命令示例:\n');
|
||||||
|
|
||||||
|
// 执行开发部署命令
|
||||||
|
console.log('--- 执行 deploy-dev 命令 ---');
|
||||||
|
const devDeployResult = await moduleManager.executeCommand('deploy-dev', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
platform: 'ios',
|
||||||
|
force: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log('结果:', devDeployResult);
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
// 执行分析统计命令
|
||||||
|
console.log('--- 执行 track-deployment 命令 ---');
|
||||||
|
const trackResult = await moduleManager.executeCommand('track-deployment', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
platform: 'android',
|
||||||
|
environment: 'production',
|
||||||
|
version: '1.2.3',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log('结果:', trackResult);
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
// 生成部署报告
|
||||||
|
console.log('--- 执行 deployment-report 命令 ---');
|
||||||
|
const reportResult = await moduleManager.executeCommand(
|
||||||
|
'deployment-report',
|
||||||
|
{
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
days: 30,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
console.log('结果:', reportResult);
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
// 5. 执行工作流示例
|
||||||
|
console.log('🔄 执行工作流示例:\n');
|
||||||
|
|
||||||
|
// 执行带统计的部署工作流
|
||||||
|
console.log('--- 执行 deploy-with-analytics 工作流 ---');
|
||||||
|
const analyticsWorkflowResult = await moduleManager.executeWorkflow(
|
||||||
|
'deploy-with-analytics',
|
||||||
|
{
|
||||||
|
args: [],
|
||||||
|
options: {},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
console.log('工作流结果:', analyticsWorkflowResult);
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
// 执行热修复工作流
|
||||||
|
console.log('--- 执行 hotfix-deploy 工作流 ---');
|
||||||
|
const hotfixWorkflowResult = await moduleManager.executeWorkflow(
|
||||||
|
'hotfix-deploy',
|
||||||
|
{
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
hotfixId: 'HF-2024-001',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
console.log('工作流结果:', hotfixWorkflowResult);
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
console.log('🎉 所有示例执行完成!');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ 执行过程中发生错误:', error);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 错误处理函数
|
||||||
|
async function demonstrateErrorHandling() {
|
||||||
|
console.log('\n🚨 错误处理示例:\n');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 尝试执行不存在的命令
|
||||||
|
console.log('--- 尝试执行不存在的命令 ---');
|
||||||
|
await moduleManager.executeCommand('non-existent-command', {
|
||||||
|
args: [],
|
||||||
|
options: {},
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log('捕获错误:', error instanceof Error ? error.message : error);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 尝试执行缺少必需参数的命令
|
||||||
|
console.log('\n--- 尝试执行缺少必需参数的命令 ---');
|
||||||
|
await moduleManager.executeCommand('deploy-prod', {
|
||||||
|
args: [],
|
||||||
|
options: {}, // 缺少必需的 version 参数
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log('捕获错误:', error instanceof Error ? error.message : error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 主函数执行
|
||||||
|
if (require.main === module) {
|
||||||
|
main()
|
||||||
|
.then(() => demonstrateErrorHandling())
|
||||||
|
.then(() => {
|
||||||
|
console.log('\n✨ 示例脚本执行完成');
|
||||||
|
process.exit(0);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('❌ 脚本执行失败:', error);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
}
|
||||||
290
example/scripts/workflow-demo.ts
Normal file
290
example/scripts/workflow-demo.ts
Normal file
@@ -0,0 +1,290 @@
|
|||||||
|
#!/usr/bin/env ts-node
|
||||||
|
|
||||||
|
import { moduleManager } from '../../src/module-manager';
|
||||||
|
import { customWorkflows } from '../workflows/custom-workflows';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作流演示脚本
|
||||||
|
* 展示如何注册和执行复杂的工作流
|
||||||
|
*/
|
||||||
|
|
||||||
|
async function registerCustomWorkflows() {
|
||||||
|
console.log('📋 注册自定义工作流...\n');
|
||||||
|
|
||||||
|
const provider = moduleManager.getProvider();
|
||||||
|
|
||||||
|
// 注册所有自定义工作流
|
||||||
|
customWorkflows.forEach((workflow) => {
|
||||||
|
provider.registerWorkflow(workflow);
|
||||||
|
console.log(`✅ 注册工作流: ${workflow.name} - ${workflow.description}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('\n📋 所有工作流注册完成\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 演示灰度发布工作流
|
||||||
|
*/
|
||||||
|
async function demonstrateCanaryDeployment() {
|
||||||
|
console.log('🔥 演示灰度发布工作流\n');
|
||||||
|
console.log('='.repeat(60));
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await moduleManager.executeWorkflow('canary-deployment', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
version: '2.1.0',
|
||||||
|
initialRollout: 10,
|
||||||
|
autoExpand: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('\n📊 灰度发布工作流结果:');
|
||||||
|
console.log(JSON.stringify(result, null, 2));
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ 灰度发布工作流执行失败:', error);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\n' + '='.repeat(60) + '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 演示多环境发布工作流
|
||||||
|
*/
|
||||||
|
async function demonstrateMultiEnvironmentDeploy() {
|
||||||
|
console.log('🌍 演示多环境发布工作流\n');
|
||||||
|
console.log('='.repeat(60));
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await moduleManager.executeWorkflow('multi-env-deploy', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
version: '2.1.0',
|
||||||
|
skipProduction: false,
|
||||||
|
forceProduction: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('\n📊 多环境发布工作流结果:');
|
||||||
|
console.log(JSON.stringify(result, null, 2));
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ 多环境发布工作流执行失败:', error);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\n' + '='.repeat(60) + '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 演示回滚工作流
|
||||||
|
*/
|
||||||
|
async function demonstrateRollbackWorkflow() {
|
||||||
|
console.log('🔄 演示回滚工作流\n');
|
||||||
|
console.log('='.repeat(60));
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await moduleManager.executeWorkflow('rollback-workflow', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
targetVersion: '2.0.5',
|
||||||
|
skipVerification: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('\n📊 回滚工作流结果:');
|
||||||
|
console.log(JSON.stringify(result, null, 2));
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ 回滚工作流执行失败:', error);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\n' + '='.repeat(60) + '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 演示工作流验证失败的情况
|
||||||
|
*/
|
||||||
|
async function demonstrateWorkflowValidation() {
|
||||||
|
console.log('⚠️ 演示工作流验证\n');
|
||||||
|
console.log('='.repeat(60));
|
||||||
|
|
||||||
|
// 1. 演示缺少必需参数的情况
|
||||||
|
console.log('--- 测试缺少必需参数 ---');
|
||||||
|
try {
|
||||||
|
await moduleManager.executeWorkflow('canary-deployment', {
|
||||||
|
args: [],
|
||||||
|
options: {}, // 缺少 version 参数
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
'✅ 正确捕获验证错误:',
|
||||||
|
error instanceof Error ? error.message : error,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\n--- 测试回滚工作流验证 ---');
|
||||||
|
try {
|
||||||
|
await moduleManager.executeWorkflow('rollback-workflow', {
|
||||||
|
args: [],
|
||||||
|
options: {}, // 缺少 targetVersion 参数
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
'✅ 正确捕获验证错误:',
|
||||||
|
error instanceof Error ? error.message : error,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\n' + '='.repeat(60) + '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 演示工作流的条件执行
|
||||||
|
*/
|
||||||
|
async function demonstrateConditionalExecution() {
|
||||||
|
console.log('🔀 演示条件执行\n');
|
||||||
|
console.log('='.repeat(60));
|
||||||
|
|
||||||
|
// 演示跳过生产部署
|
||||||
|
console.log('--- 跳过生产环境部署 ---');
|
||||||
|
try {
|
||||||
|
const result = await moduleManager.executeWorkflow('multi-env-deploy', {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
version: '2.1.1',
|
||||||
|
skipProduction: true, // 跳过生产部署
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('📊 跳过生产部署的结果:');
|
||||||
|
console.log(`包含生产部署步骤: ${result.data?.production ? '是' : '否'}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ 条件执行演示失败:', error);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\n' + '='.repeat(60) + '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列出所有可用的工作流
|
||||||
|
*/
|
||||||
|
async function listAvailableWorkflows() {
|
||||||
|
console.log('📋 可用工作流列表\n');
|
||||||
|
console.log('='.repeat(60));
|
||||||
|
|
||||||
|
const workflows = moduleManager.listWorkflows();
|
||||||
|
|
||||||
|
workflows.forEach((workflow, index) => {
|
||||||
|
console.log(`${index + 1}. ${workflow.name}`);
|
||||||
|
console.log(` 描述: ${workflow.description || '无描述'}`);
|
||||||
|
console.log(` 步骤数: ${workflow.steps.length}`);
|
||||||
|
|
||||||
|
if (workflow.options) {
|
||||||
|
console.log(' 选项:');
|
||||||
|
Object.entries(workflow.options).forEach(([key, option]) => {
|
||||||
|
const opt = option as any;
|
||||||
|
const required = opt.hasValue && !opt.default;
|
||||||
|
console.log(
|
||||||
|
` --${key}: ${opt.description || '无描述'} ${required ? '(必需)' : ''}`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
console.log();
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('='.repeat(60) + '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主函数
|
||||||
|
*/
|
||||||
|
async function main() {
|
||||||
|
console.log('🎯 工作流演示脚本\n');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 1. 注册自定义工作流
|
||||||
|
await registerCustomWorkflows();
|
||||||
|
|
||||||
|
// 2. 列出所有可用工作流
|
||||||
|
await listAvailableWorkflows();
|
||||||
|
|
||||||
|
// 3. 演示各种工作流
|
||||||
|
await demonstrateCanaryDeployment();
|
||||||
|
await demonstrateMultiEnvironmentDeploy();
|
||||||
|
await demonstrateRollbackWorkflow();
|
||||||
|
|
||||||
|
// 4. 演示验证和条件执行
|
||||||
|
await demonstrateWorkflowValidation();
|
||||||
|
await demonstrateConditionalExecution();
|
||||||
|
|
||||||
|
console.log('🎉 所有工作流演示完成!');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ 演示过程中发生错误:', error);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交互式工作流执行
|
||||||
|
*/
|
||||||
|
async function interactiveWorkflowExecution() {
|
||||||
|
console.log('\n🎮 交互式工作流执行\n');
|
||||||
|
|
||||||
|
const workflowName = process.argv[3];
|
||||||
|
|
||||||
|
if (!workflowName) {
|
||||||
|
console.log('使用方法:');
|
||||||
|
console.log(' npm run workflow-demo [工作流名称]');
|
||||||
|
console.log('\n可用的工作流:');
|
||||||
|
console.log(' - canary-deployment');
|
||||||
|
console.log(' - multi-env-deploy');
|
||||||
|
console.log(' - rollback-workflow');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析命令行参数
|
||||||
|
const options: Record<string, any> = {};
|
||||||
|
for (let i = 4; i < process.argv.length; i += 2) {
|
||||||
|
const key = process.argv[i]?.replace(/^--/, '');
|
||||||
|
const value = process.argv[i + 1];
|
||||||
|
if (key && value) {
|
||||||
|
options[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`执行工作流: ${workflowName}`);
|
||||||
|
console.log('参数:', options);
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
try {
|
||||||
|
await registerCustomWorkflows();
|
||||||
|
|
||||||
|
const result = await moduleManager.executeWorkflow(workflowName, {
|
||||||
|
args: [],
|
||||||
|
options,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('\n📊 工作流执行结果:');
|
||||||
|
console.log(JSON.stringify(result, null, 2));
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ 工作流执行失败:', error);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行脚本
|
||||||
|
if (require.main === module) {
|
||||||
|
if (process.argv.length > 2 && process.argv[2] === 'interactive') {
|
||||||
|
interactiveWorkflowExecution()
|
||||||
|
.then(() => process.exit(0))
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('❌ 交互式执行失败:', error);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
main()
|
||||||
|
.then(() => process.exit(0))
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('❌ 演示脚本执行失败:', error);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
23
example/tsconfig.json
Normal file
23
example/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "commonjs",
|
||||||
|
"lib": ["ES2020"],
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"strict": false,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"forceConsistentCasingInFileNames": false,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"types": ["node"]
|
||||||
|
},
|
||||||
|
"include": ["**/*.ts"],
|
||||||
|
"exclude": ["node_modules", "dist"],
|
||||||
|
"ts-node": {
|
||||||
|
"transpileOnly": true,
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
582
example/workflows/custom-workflows.ts
Normal file
582
example/workflows/custom-workflows.ts
Normal file
@@ -0,0 +1,582 @@
|
|||||||
|
import type {
|
||||||
|
CLIProvider,
|
||||||
|
CommandContext,
|
||||||
|
CustomWorkflow,
|
||||||
|
} from '../../src/types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义工作流集合
|
||||||
|
* 演示各种复杂的工作流场景
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 灰度发布工作流
|
||||||
|
*/
|
||||||
|
export const canaryDeploymentWorkflow: CustomWorkflow = {
|
||||||
|
name: 'canary-deployment',
|
||||||
|
description: '灰度发布工作流 - 逐步增加用户覆盖率',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'prepare-canary',
|
||||||
|
description: '准备灰度发布',
|
||||||
|
execute: async (context: CommandContext) => {
|
||||||
|
console.log('🔧 准备灰度发布环境...');
|
||||||
|
|
||||||
|
const { version, initialRollout = 5 } = context.options;
|
||||||
|
|
||||||
|
console.log(`📦 版本: ${version}`);
|
||||||
|
console.log(`📊 初始覆盖率: ${initialRollout}%`);
|
||||||
|
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
|
||||||
|
return {
|
||||||
|
version,
|
||||||
|
currentRollout: initialRollout,
|
||||||
|
stage: 'prepared',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'initial-deployment',
|
||||||
|
description: '初始小范围部署',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('🚀 执行初始小范围部署...');
|
||||||
|
|
||||||
|
const { currentRollout } = previousResult;
|
||||||
|
|
||||||
|
console.log(`部署到 ${currentRollout}% 用户...`);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1500));
|
||||||
|
|
||||||
|
console.log('✅ 初始部署完成');
|
||||||
|
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
deploymentTime: new Date().toISOString(),
|
||||||
|
stage: 'initial-deployed',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'monitor-metrics',
|
||||||
|
description: '监控关键指标',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('📊 监控关键指标...');
|
||||||
|
|
||||||
|
// 模拟监控数据
|
||||||
|
const metrics = {
|
||||||
|
crashRate: Math.random() * 0.01, // 0-1%
|
||||||
|
responseTime: 150 + Math.random() * 100, // 150-250ms
|
||||||
|
userSatisfaction: 85 + Math.random() * 10, // 85-95%
|
||||||
|
errorRate: Math.random() * 0.005, // 0-0.5%
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('📈 监控结果:');
|
||||||
|
console.log(` 崩溃率: ${(metrics.crashRate * 100).toFixed(3)}%`);
|
||||||
|
console.log(` 响应时间: ${metrics.responseTime.toFixed(1)}ms`);
|
||||||
|
console.log(` 用户满意度: ${metrics.userSatisfaction.toFixed(1)}%`);
|
||||||
|
console.log(` 错误率: ${(metrics.errorRate * 100).toFixed(3)}%`);
|
||||||
|
|
||||||
|
// 判断是否可以继续扩大范围
|
||||||
|
const canProceed =
|
||||||
|
metrics.crashRate < 0.005 &&
|
||||||
|
metrics.errorRate < 0.003 &&
|
||||||
|
metrics.userSatisfaction > 80;
|
||||||
|
|
||||||
|
console.log(`🔍 健康检查: ${canProceed ? '✅ 通过' : '❌ 未通过'}`);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
metrics,
|
||||||
|
canProceed,
|
||||||
|
stage: 'monitored',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'expand-rollout',
|
||||||
|
description: '扩大发布范围',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
const { canProceed, currentRollout } = previousResult;
|
||||||
|
|
||||||
|
if (!canProceed) {
|
||||||
|
console.log('⚠️ 指标不达标,停止扩大发布范围');
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
stage: 'rollout-stopped',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('📈 扩大发布范围...');
|
||||||
|
|
||||||
|
const newRollout = Math.min(currentRollout * 2, 100);
|
||||||
|
console.log(`覆盖率从 ${currentRollout}% 扩大到 ${newRollout}%`);
|
||||||
|
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1200));
|
||||||
|
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
currentRollout: newRollout,
|
||||||
|
stage: newRollout >= 100 ? 'fully-deployed' : 'expanded',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
condition: (context: CommandContext) => {
|
||||||
|
// 只有在启用自动扩大的情况下才执行
|
||||||
|
return context.options.autoExpand !== false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'final-verification',
|
||||||
|
description: '最终验证',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('🔍 执行最终验证...');
|
||||||
|
|
||||||
|
const { stage, currentRollout } = previousResult;
|
||||||
|
|
||||||
|
if (stage === 'rollout-stopped') {
|
||||||
|
console.log('❌ 灰度发布因指标不达标而停止');
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
finalStatus: 'failed',
|
||||||
|
reason: 'metrics-failed',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('✅ 灰度发布验证完成');
|
||||||
|
console.log(`📊 最终覆盖率: ${currentRollout}%`);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
finalStatus: 'success',
|
||||||
|
completedAt: new Date().toISOString(),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
validate: (context: CommandContext) => {
|
||||||
|
if (!context.options.version) {
|
||||||
|
console.error('❌ 灰度发布必须指定版本号');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
version: {
|
||||||
|
hasValue: true,
|
||||||
|
description: '发布版本号 (必需)',
|
||||||
|
},
|
||||||
|
initialRollout: {
|
||||||
|
hasValue: true,
|
||||||
|
default: 5,
|
||||||
|
description: '初始覆盖率百分比',
|
||||||
|
},
|
||||||
|
autoExpand: {
|
||||||
|
hasValue: false,
|
||||||
|
default: true,
|
||||||
|
description: '自动扩大发布范围',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多环境发布工作流
|
||||||
|
*/
|
||||||
|
export const multiEnvironmentDeployWorkflow: CustomWorkflow = {
|
||||||
|
name: 'multi-env-deploy',
|
||||||
|
description: '多环境依次发布工作流',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'deploy-to-dev',
|
||||||
|
description: '部署到开发环境',
|
||||||
|
execute: async (context: CommandContext) => {
|
||||||
|
console.log('🔧 部署到开发环境...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
|
||||||
|
const devResult = {
|
||||||
|
environment: 'development',
|
||||||
|
deployTime: new Date().toISOString(),
|
||||||
|
success: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('✅ 开发环境部署完成');
|
||||||
|
return { dev: devResult };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'run-integration-tests',
|
||||||
|
description: '运行集成测试',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('🧪 运行集成测试...');
|
||||||
|
|
||||||
|
const testSuites = ['API测试', '数据库测试', '第三方服务测试'];
|
||||||
|
const results = [];
|
||||||
|
|
||||||
|
for (const suite of testSuites) {
|
||||||
|
console.log(` 运行 ${suite}...`);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||||
|
|
||||||
|
const passed = Math.random() > 0.1; // 90% 通过率
|
||||||
|
results.push({ suite, passed });
|
||||||
|
console.log(` ${passed ? '✅' : '❌'} ${suite}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const allPassed = results.every((r) => r.passed);
|
||||||
|
console.log(
|
||||||
|
`🧪 集成测试结果: ${allPassed ? '✅ 全部通过' : '❌ 有失败项'}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
integrationTests: { results, allPassed },
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'deploy-to-staging',
|
||||||
|
description: '部署到预发布环境',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
const { integrationTests } = previousResult;
|
||||||
|
|
||||||
|
if (!integrationTests.allPassed) {
|
||||||
|
throw new Error('集成测试未通过,无法部署到预发布环境');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('🎭 部署到预发布环境...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1500));
|
||||||
|
|
||||||
|
const stagingResult = {
|
||||||
|
environment: 'staging',
|
||||||
|
deployTime: new Date().toISOString(),
|
||||||
|
success: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('✅ 预发布环境部署完成');
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
staging: stagingResult,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'run-e2e-tests',
|
||||||
|
description: '运行端到端测试',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('🎯 运行端到端测试...');
|
||||||
|
|
||||||
|
const e2eTests = [
|
||||||
|
'用户登录流程',
|
||||||
|
'核心业务流程',
|
||||||
|
'支付流程',
|
||||||
|
'数据同步',
|
||||||
|
];
|
||||||
|
|
||||||
|
const results = [];
|
||||||
|
|
||||||
|
for (const test of e2eTests) {
|
||||||
|
console.log(` 测试 ${test}...`);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 800));
|
||||||
|
|
||||||
|
const passed = Math.random() > 0.05; // 95% 通过率
|
||||||
|
results.push({ test, passed });
|
||||||
|
console.log(` ${passed ? '✅' : '❌'} ${test}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const allPassed = results.every((r) => r.passed);
|
||||||
|
console.log(
|
||||||
|
`🎯 E2E测试结果: ${allPassed ? '✅ 全部通过' : '❌ 有失败项'}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
e2eTests: { results, allPassed },
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'deploy-to-production',
|
||||||
|
description: '部署到生产环境',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
const { e2eTests } = previousResult;
|
||||||
|
|
||||||
|
if (!e2eTests.allPassed) {
|
||||||
|
console.log('⚠️ E2E测试未全部通过,需要手动确认是否继续部署');
|
||||||
|
|
||||||
|
if (!context.options.forceProduction) {
|
||||||
|
throw new Error('E2E测试未通过,使用 --force-production 强制部署');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('🚀 部署到生产环境...');
|
||||||
|
|
||||||
|
// 生产部署需要更长时间
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||||
|
|
||||||
|
const productionResult = {
|
||||||
|
environment: 'production',
|
||||||
|
deployTime: new Date().toISOString(),
|
||||||
|
success: true,
|
||||||
|
version: context.options.version,
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('🎉 生产环境部署完成');
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
production: productionResult,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
condition: (context: CommandContext) => {
|
||||||
|
// 只有在非跳过生产部署的情况下才执行
|
||||||
|
return !context.options.skipProduction;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'post-deployment-verification',
|
||||||
|
description: '部署后验证',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('🔍 执行部署后验证...');
|
||||||
|
|
||||||
|
const verifications = [
|
||||||
|
'健康检查',
|
||||||
|
'关键接口测试',
|
||||||
|
'监控数据验证',
|
||||||
|
'用户访问验证',
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const verification of verifications) {
|
||||||
|
console.log(` ${verification}...`);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 300));
|
||||||
|
console.log(` ✅ ${verification} 通过`);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('✅ 部署后验证完成');
|
||||||
|
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
postDeploymentVerification: {
|
||||||
|
completed: true,
|
||||||
|
verifiedAt: new Date().toISOString(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
validate: (context: CommandContext) => {
|
||||||
|
if (!context.options.version) {
|
||||||
|
console.error('❌ 多环境部署必须指定版本号');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
version: {
|
||||||
|
hasValue: true,
|
||||||
|
description: '发布版本号 (必需)',
|
||||||
|
},
|
||||||
|
skipProduction: {
|
||||||
|
hasValue: false,
|
||||||
|
default: false,
|
||||||
|
description: '跳过生产环境部署',
|
||||||
|
},
|
||||||
|
forceProduction: {
|
||||||
|
hasValue: false,
|
||||||
|
default: false,
|
||||||
|
description: '强制部署到生产环境(即使测试未全部通过)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回滚工作流
|
||||||
|
*/
|
||||||
|
export const rollbackWorkflow: CustomWorkflow = {
|
||||||
|
name: 'rollback-workflow',
|
||||||
|
description: '应用回滚工作流',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'validate-target-version',
|
||||||
|
description: '验证目标版本',
|
||||||
|
execute: async (context: CommandContext) => {
|
||||||
|
console.log('🔍 验证目标回滚版本...');
|
||||||
|
|
||||||
|
const { targetVersion } = context.options;
|
||||||
|
|
||||||
|
if (!targetVersion) {
|
||||||
|
throw new Error('必须指定目标回滚版本');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 模拟版本验证
|
||||||
|
console.log(`验证版本 ${targetVersion} 是否存在...`);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 800));
|
||||||
|
|
||||||
|
const versionExists = true; // 模拟版本存在
|
||||||
|
|
||||||
|
if (!versionExists) {
|
||||||
|
throw new Error(`版本 ${targetVersion} 不存在`);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`✅ 版本 ${targetVersion} 验证通过`);
|
||||||
|
|
||||||
|
return {
|
||||||
|
targetVersion,
|
||||||
|
validated: true,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'backup-current-state',
|
||||||
|
description: '备份当前状态',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('💾 备份当前应用状态...');
|
||||||
|
|
||||||
|
const backup = {
|
||||||
|
backupId: `backup-${Date.now()}`,
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
currentVersion: 'current-version', // 在实际应用中获取当前版本
|
||||||
|
configSnapshot: 'config-data', // 在实际应用中获取配置快照
|
||||||
|
};
|
||||||
|
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1500));
|
||||||
|
|
||||||
|
console.log(`✅ 状态备份完成,备份ID: ${backup.backupId}`);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
backup,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'execute-rollback',
|
||||||
|
description: '执行回滚',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('🔄 执行回滚操作...');
|
||||||
|
|
||||||
|
const { targetVersion } = previousResult;
|
||||||
|
|
||||||
|
console.log(`回滚到版本: ${targetVersion}`);
|
||||||
|
|
||||||
|
// 模拟回滚过程
|
||||||
|
const rollbackSteps = [
|
||||||
|
'停止当前服务',
|
||||||
|
'切换到目标版本',
|
||||||
|
'更新配置',
|
||||||
|
'重启服务',
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const step of rollbackSteps) {
|
||||||
|
console.log(` ${step}...`);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 600));
|
||||||
|
console.log(` ✅ ${step} 完成`);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('🎉 回滚执行完成');
|
||||||
|
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
rollbackCompleted: true,
|
||||||
|
rollbackTime: new Date().toISOString(),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'verify-rollback',
|
||||||
|
description: '验证回滚结果',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('🔍 验证回滚结果...');
|
||||||
|
|
||||||
|
const verificationChecks = [
|
||||||
|
'服务可用性检查',
|
||||||
|
'功能完整性检查',
|
||||||
|
'性能基线检查',
|
||||||
|
'数据一致性检查',
|
||||||
|
];
|
||||||
|
|
||||||
|
const results = [];
|
||||||
|
|
||||||
|
for (const check of verificationChecks) {
|
||||||
|
console.log(` ${check}...`);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 400));
|
||||||
|
|
||||||
|
const passed = Math.random() > 0.05; // 95% 通过率
|
||||||
|
results.push({ check, passed });
|
||||||
|
console.log(` ${passed ? '✅' : '❌'} ${check}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const allPassed = results.every((r) => r.passed);
|
||||||
|
|
||||||
|
if (!allPassed) {
|
||||||
|
console.log('⚠️ 部分验证未通过,可能需要进一步检查');
|
||||||
|
} else {
|
||||||
|
console.log('✅ 回滚验证全部通过');
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
verification: { results, allPassed },
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'notify-stakeholders',
|
||||||
|
description: '通知相关人员',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('📧 通知相关人员...');
|
||||||
|
|
||||||
|
const { targetVersion, verification } = previousResult;
|
||||||
|
|
||||||
|
const notification = {
|
||||||
|
type: 'rollback-completed',
|
||||||
|
targetVersion,
|
||||||
|
success: verification.allPassed,
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
notifiedStakeholders: [
|
||||||
|
'开发团队',
|
||||||
|
'运维团队',
|
||||||
|
'产品团队',
|
||||||
|
'测试团队',
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('📬 发送通知给:');
|
||||||
|
notification.notifiedStakeholders.forEach((stakeholder) => {
|
||||||
|
console.log(` - ${stakeholder}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||||
|
|
||||||
|
console.log('✅ 通知发送完成');
|
||||||
|
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
notification,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
validate: (context: CommandContext) => {
|
||||||
|
if (!context.options.targetVersion) {
|
||||||
|
console.error('❌ 回滚操作必须指定目标版本');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
targetVersion: {
|
||||||
|
hasValue: true,
|
||||||
|
description: '目标回滚版本 (必需)',
|
||||||
|
},
|
||||||
|
skipVerification: {
|
||||||
|
hasValue: false,
|
||||||
|
default: false,
|
||||||
|
description: '跳过回滚后验证',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出所有工作流
|
||||||
|
*/
|
||||||
|
export const customWorkflows = [
|
||||||
|
canaryDeploymentWorkflow,
|
||||||
|
multiEnvironmentDeployWorkflow,
|
||||||
|
rollbackWorkflow,
|
||||||
|
];
|
||||||
1552
example/workflows/enhanced-core-workflows.ts
Normal file
1552
example/workflows/enhanced-core-workflows.ts
Normal file
File diff suppressed because it is too large
Load Diff
1863
example/yarn.lock
Normal file
1863
example/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
42
package.json
42
package.json
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-update-cli",
|
"name": "react-native-update-cli",
|
||||||
"version": "1.42.2",
|
"version": "2.2.3",
|
||||||
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
|
"description": "command line tool for react-native-update (remote updates for react native)",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
"pushy": "lib/index.js",
|
"pushy": "lib/index.js",
|
||||||
@@ -14,12 +14,12 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "swc src -d lib --strip-leading-paths",
|
"build": "swc src -d lib --strip-leading-paths",
|
||||||
"prepare": "npm run build && chmod +x lib/index.js",
|
"prepublishOnly": "npm run build && chmod +x lib/index.js",
|
||||||
"lint": "tsc --noEmit & biome check --write ."
|
"lint": "tsc --noEmit & biome check --write ."
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/reactnativecn/react-native-pushy-cli.git"
|
"url": "git+https://github.com/reactnativecn/react-native-update-cli.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native",
|
"react-native",
|
||||||
@@ -31,54 +31,58 @@
|
|||||||
"author": "reactnativecn",
|
"author": "reactnativecn",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/reactnativecn/react-native-pushy/issues"
|
"url": "https://github.com/reactnativecn/react-native-update-cli/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/reactnativecn/react-native-pushy/tree/master/react-native-pushy-cli",
|
"homepage": "https://github.com/reactnativecn/react-native-update-cli",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@badisi/latest-version": "^7.0.12",
|
"@colors/colors": "^1.6.0",
|
||||||
"bplist-parser": "^0.3.2",
|
"bplist-parser": "^0.3.2",
|
||||||
"bytebuffer": "^5.0.1",
|
"bytebuffer": "^5.0.1",
|
||||||
"cgbi-to-png": "^1.0.7",
|
"cgbi-to-png": "^1.0.7",
|
||||||
"chalk": "4",
|
"chalk": "4",
|
||||||
"cli-arguments": "^0.2.1",
|
"cli-arguments": "^0.2.1",
|
||||||
"commander": "^13.1.0",
|
"commander": "^13",
|
||||||
"compare-versions": "^6.1.1",
|
"compare-versions": "^6.1.1",
|
||||||
"filesize-parser": "^1.5.1",
|
"filesize-parser": "^1.5.1",
|
||||||
"form-data": "^4.0.2",
|
"form-data": "^4.0.2",
|
||||||
"fs-extra": "8",
|
"fs-extra": "8",
|
||||||
|
"global-dirs": "^4.0.0",
|
||||||
"gradle-to-js": "^2.0.1",
|
"gradle-to-js": "^2.0.1",
|
||||||
"i18next": "^24.2.3",
|
"i18next": "^24.2.3",
|
||||||
"isomorphic-git": "^1.29.0",
|
"isomorphic-git": "^1.30.1",
|
||||||
"isomorphic-unzip": "^1.1.5",
|
"isomorphic-unzip": "^1.1.5",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
"plist": "^3.1.0",
|
"plist": "^3.1.0",
|
||||||
"progress": "^2.0.3",
|
"progress": "^2.0.3",
|
||||||
"properties": "^1.2.1",
|
"properties": "^1.2.1",
|
||||||
"read": "^4.1.0",
|
"read": "^4.1.0",
|
||||||
"semver": "^7.7.1",
|
"registry-auth-token": "^5.1.0",
|
||||||
|
"semver": "^7.7.2",
|
||||||
"tcp-ping": "^0.1.1",
|
"tcp-ping": "^0.1.1",
|
||||||
"tty-table": "4.2",
|
"tty-table": "4.2",
|
||||||
"update-notifier": "^5.1.0",
|
|
||||||
"yauzl": "^3.2.0",
|
"yauzl": "^3.2.0",
|
||||||
"yazl": "3.3.1"
|
"yazl": "3.3.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 10"
|
"node": ">= 14"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "^1.9.4",
|
"@biomejs/biome": "^1.9.4",
|
||||||
"@swc/cli": "^0.6.0",
|
"@swc/cli": "0.7.7",
|
||||||
"@swc/core": "^1.11.9",
|
"@swc/core": "^1.11.24",
|
||||||
"@types/filesize-parser": "^1.5.3",
|
"@types/filesize-parser": "^1.5.3",
|
||||||
"@types/fs-extra": "^11.0.4",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@types/node": "^22.13.10",
|
"@types/node": "^22.15.18",
|
||||||
"@types/node-fetch": "^2.6.12",
|
"@types/node-fetch": "^2.6.12",
|
||||||
"@types/progress": "^2.0.7",
|
"@types/progress": "^2.0.7",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.7.0",
|
||||||
"@types/tcp-ping": "^0.1.6",
|
"@types/tcp-ping": "^0.1.6",
|
||||||
"@types/update-notifier": "^6.0.8",
|
|
||||||
"@types/yauzl": "^2.10.3",
|
"@types/yauzl": "^2.10.3",
|
||||||
"@types/yazl": "^2.4.6",
|
"@types/yazl": "^2.4.6",
|
||||||
"typescript": "^5.8.2"
|
"typescript": "^5.8.3"
|
||||||
}
|
},
|
||||||
|
"trustedDependencies": [
|
||||||
|
"@biomejs/biome",
|
||||||
|
"@swc/core"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
42
src/api.ts
42
src/api.ts
@@ -1,27 +1,25 @@
|
|||||||
import fetch from 'node-fetch';
|
import fs from 'fs';
|
||||||
import fs from 'node:fs';
|
import path from 'path';
|
||||||
import util from 'node:util';
|
import util from 'util';
|
||||||
import path from 'node:path';
|
|
||||||
import ProgressBar from 'progress';
|
|
||||||
import packageJson from '../package.json';
|
|
||||||
import tcpp from 'tcp-ping';
|
|
||||||
import filesizeParser from 'filesize-parser';
|
import filesizeParser from 'filesize-parser';
|
||||||
import {
|
|
||||||
pricingPageUrl,
|
|
||||||
credentialFile,
|
|
||||||
defaultEndpoint,
|
|
||||||
} from './utils/constants';
|
|
||||||
import type { Session } from 'types';
|
|
||||||
import FormData from 'form-data';
|
import FormData from 'form-data';
|
||||||
|
import fetch from 'node-fetch';
|
||||||
|
import ProgressBar from 'progress';
|
||||||
|
import tcpp from 'tcp-ping';
|
||||||
|
import packageJson from '../package.json';
|
||||||
|
import type { Package, Session } from './types';
|
||||||
|
import {
|
||||||
|
credentialFile,
|
||||||
|
pricingPageUrl,
|
||||||
|
} from './utils/constants';
|
||||||
import { t } from './utils/i18n';
|
import { t } from './utils/i18n';
|
||||||
|
import { getBaseUrl } from 'utils/http-helper';
|
||||||
|
|
||||||
const tcpPing = util.promisify(tcpp.ping);
|
const tcpPing = util.promisify(tcpp.ping);
|
||||||
|
|
||||||
let session: Session | undefined;
|
let session: Session | undefined;
|
||||||
let savedSession: Session | undefined;
|
let savedSession: Session | undefined;
|
||||||
|
|
||||||
const host =
|
|
||||||
process.env.PUSHY_REGISTRY || process.env.RNU_API || defaultEndpoint;
|
|
||||||
|
|
||||||
const userAgent = `react-native-update-cli/${packageJson.version}`;
|
const userAgent = `react-native-update-cli/${packageJson.version}`;
|
||||||
|
|
||||||
@@ -64,7 +62,9 @@ export const closeSession = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
async function query(url: string, options: fetch.RequestInit) {
|
async function query(url: string, options: fetch.RequestInit) {
|
||||||
const resp = await fetch(url, options);
|
const baseUrl = await getBaseUrl;
|
||||||
|
const fullUrl = `${baseUrl}${url}`;
|
||||||
|
const resp = await fetch(fullUrl, options);
|
||||||
const text = await resp.text();
|
const text = await resp.text();
|
||||||
let json: any;
|
let json: any;
|
||||||
try {
|
try {
|
||||||
@@ -83,7 +83,7 @@ async function query(url: string, options: fetch.RequestInit) {
|
|||||||
|
|
||||||
function queryWithoutBody(method: string) {
|
function queryWithoutBody(method: string) {
|
||||||
return (api: string) =>
|
return (api: string) =>
|
||||||
query(host + api, {
|
query(api, {
|
||||||
method,
|
method,
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': userAgent,
|
'User-Agent': userAgent,
|
||||||
@@ -94,7 +94,7 @@ function queryWithoutBody(method: string) {
|
|||||||
|
|
||||||
function queryWithBody(method: string) {
|
function queryWithBody(method: string) {
|
||||||
return (api: string, body?: Record<string, any>) =>
|
return (api: string, body?: Record<string, any>) =>
|
||||||
query(host + api, {
|
query(api, {
|
||||||
method,
|
method,
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': userAgent,
|
'User-Agent': userAgent,
|
||||||
@@ -116,6 +116,7 @@ export async function uploadFile(fn: string, key?: string) {
|
|||||||
});
|
});
|
||||||
let realUrl = url;
|
let realUrl = url;
|
||||||
if (backupUrl) {
|
if (backupUrl) {
|
||||||
|
// @ts-ignore
|
||||||
if (global.USE_ACC_OSS) {
|
if (global.USE_ACC_OSS) {
|
||||||
realUrl = backupUrl;
|
realUrl = backupUrl;
|
||||||
} else {
|
} else {
|
||||||
@@ -177,3 +178,8 @@ export async function uploadFile(fn: string, key?: string) {
|
|||||||
// const body = await response.json();
|
// const body = await response.json();
|
||||||
return { hash: key || formData.key };
|
return { hash: key || formData.key };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getAllPackages = async (appId: string) => {
|
||||||
|
const { data } = await get(`/app/${appId}/package/list?limit=1000`);
|
||||||
|
return data as Package[] | undefined | null;
|
||||||
|
};
|
||||||
|
|||||||
45
src/app.ts
45
src/app.ts
@@ -1,15 +1,20 @@
|
|||||||
import { question } from './utils';
|
import fs from 'fs';
|
||||||
import fs from 'node:fs';
|
|
||||||
import Table from 'tty-table';
|
import Table from 'tty-table';
|
||||||
|
import { question } from './utils';
|
||||||
|
|
||||||
import { post, get, doDelete } from './api';
|
import { doDelete, get, post } from './api';
|
||||||
import type { Platform } from './types';
|
import type { Platform } from './types';
|
||||||
import { t } from './utils/i18n';
|
import { t } from './utils/i18n';
|
||||||
|
|
||||||
const validPlatforms = ['ios', 'android', 'harmony'];
|
const validPlatforms = ['ios', 'android', 'harmony'];
|
||||||
|
|
||||||
|
export async function getPlatform(platform?: string) {
|
||||||
|
return assertPlatform(
|
||||||
|
platform || (await question(t('platformQuestion'))),
|
||||||
|
) as Platform;
|
||||||
|
}
|
||||||
|
|
||||||
export function checkPlatform(platform: Platform) {
|
export function assertPlatform(platform: string) {
|
||||||
if (!validPlatforms.includes(platform)) {
|
if (!validPlatforms.includes(platform)) {
|
||||||
throw new Error(t('unsupportedPlatform', { platform }));
|
throw new Error(t('unsupportedPlatform', { platform }));
|
||||||
}
|
}
|
||||||
@@ -17,7 +22,7 @@ export function checkPlatform(platform: Platform) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getSelectedApp(platform: Platform) {
|
export function getSelectedApp(platform: Platform) {
|
||||||
checkPlatform(platform);
|
assertPlatform(platform);
|
||||||
|
|
||||||
if (!fs.existsSync('update.json')) {
|
if (!fs.existsSync('update.json')) {
|
||||||
throw new Error(t('appNotSelected', { platform }));
|
throw new Error(t('appNotSelected', { platform }));
|
||||||
@@ -61,7 +66,7 @@ export async function chooseApp(platform: Platform) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const commands = {
|
export const appCommands = {
|
||||||
createApp: async function ({
|
createApp: async function ({
|
||||||
options,
|
options,
|
||||||
}: {
|
}: {
|
||||||
@@ -69,9 +74,7 @@ export const commands = {
|
|||||||
}) {
|
}) {
|
||||||
const name = options.name || (await question(t('appNameQuestion')));
|
const name = options.name || (await question(t('appNameQuestion')));
|
||||||
const { downloadUrl } = options;
|
const { downloadUrl } = options;
|
||||||
const platform = checkPlatform(
|
const platform = await getPlatform(options.platform);
|
||||||
options.platform || (await question(t('platformQuestion'))),
|
|
||||||
);
|
|
||||||
const { id } = await post('/app/create', { name, platform, downloadUrl });
|
const { id } = await post('/app/create', { name, platform, downloadUrl });
|
||||||
console.log(t('createAppSuccess', { id }));
|
console.log(t('createAppSuccess', { id }));
|
||||||
await this.selectApp({
|
await this.selectApp({
|
||||||
@@ -79,7 +82,13 @@ export const commands = {
|
|||||||
options: { platform },
|
options: { platform },
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deleteApp: async ({ args, options }: { args: string[]; options: { platform: Platform } }) => {
|
deleteApp: async ({
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: {
|
||||||
|
args: string[];
|
||||||
|
options: { platform: Platform };
|
||||||
|
}) => {
|
||||||
const { platform } = options;
|
const { platform } = options;
|
||||||
const id = args[0] || chooseApp(platform);
|
const id = args[0] || chooseApp(platform);
|
||||||
if (!id) {
|
if (!id) {
|
||||||
@@ -92,15 +101,21 @@ export const commands = {
|
|||||||
const { platform } = options;
|
const { platform } = options;
|
||||||
listApp(platform);
|
listApp(platform);
|
||||||
},
|
},
|
||||||
selectApp: async ({ args, options }: { args: string[]; options: { platform: Platform } }) => {
|
selectApp: async ({
|
||||||
const platform = checkPlatform(
|
args,
|
||||||
options.platform || (await question(t('platformQuestion'))),
|
options,
|
||||||
);
|
}: {
|
||||||
|
args: string[];
|
||||||
|
options: { platform: Platform };
|
||||||
|
}) => {
|
||||||
|
const platform = await getPlatform(options.platform);
|
||||||
const id = args[0]
|
const id = args[0]
|
||||||
? Number.parseInt(args[0])
|
? Number.parseInt(args[0])
|
||||||
: (await chooseApp(platform)).id;
|
: (await chooseApp(platform)).id;
|
||||||
|
|
||||||
let updateInfo: Partial<Record<Platform, { appId: number; appKey: string }>> = {};
|
let updateInfo: Partial<
|
||||||
|
Record<Platform, { appId: number; appKey: string }>
|
||||||
|
> = {};
|
||||||
if (fs.existsSync('update.json')) {
|
if (fs.existsSync('update.json')) {
|
||||||
try {
|
try {
|
||||||
updateInfo = JSON.parse(fs.readFileSync('update.json', 'utf8'));
|
updateInfo = JSON.parse(fs.readFileSync('update.json', 'utf8'));
|
||||||
|
|||||||
374
src/bundle.ts
374
src/bundle.ts
@@ -1,20 +1,31 @@
|
|||||||
import path from 'node:path';
|
import { spawn, spawnSync } from 'child_process';
|
||||||
import { translateOptions } from './utils';
|
import path from 'path';
|
||||||
|
import { satisfies } from 'compare-versions';
|
||||||
import * as fs from 'fs-extra';
|
import * as fs from 'fs-extra';
|
||||||
import { ZipFile } from 'yazl';
|
import {
|
||||||
import { open as openZipFile } from 'yauzl';
|
type Entry,
|
||||||
import { question, checkPlugins } from './utils';
|
type ZipFile as YauzlZipFile,
|
||||||
import { checkPlatform } from './app';
|
open as openZipFile,
|
||||||
import { spawn, spawnSync } from 'node:child_process';
|
} from 'yauzl';
|
||||||
import semverSatisfies from 'semver/functions/satisfies';
|
import { ZipFile as YazlZipFile } from 'yazl';
|
||||||
|
import { getPlatform } from './app';
|
||||||
|
import { translateOptions } from './utils';
|
||||||
|
import { checkPlugins, question } from './utils';
|
||||||
const g2js = require('gradle-to-js/lib/parser');
|
const g2js = require('gradle-to-js/lib/parser');
|
||||||
import os from 'node:os';
|
import os from 'os';
|
||||||
const properties = require('properties');
|
const properties = require('properties');
|
||||||
|
import { addGitIgnore } from './utils/add-gitignore';
|
||||||
|
import { checkLockFiles } from './utils/check-lockfile';
|
||||||
|
import { tempDir } from './utils/constants';
|
||||||
import { depVersions } from './utils/dep-versions';
|
import { depVersions } from './utils/dep-versions';
|
||||||
|
import { t } from './utils/i18n';
|
||||||
|
import { versionCommands } from './versions';
|
||||||
|
|
||||||
let bsdiff;
|
type Diff = (oldSource?: Buffer, newSource?: Buffer) => Buffer;
|
||||||
let hdiff;
|
|
||||||
let diff;
|
let bsdiff: Diff;
|
||||||
|
let hdiff: Diff;
|
||||||
|
let diff: Diff;
|
||||||
try {
|
try {
|
||||||
bsdiff = require('node-bsdiff').diff;
|
bsdiff = require('node-bsdiff').diff;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
@@ -55,9 +66,7 @@ async function runReactNativeBundleCommand({
|
|||||||
if (platform === 'android') {
|
if (platform === 'android') {
|
||||||
gradleConfig = await checkGradleConfig();
|
gradleConfig = await checkGradleConfig();
|
||||||
if (gradleConfig.crunchPngs !== false) {
|
if (gradleConfig.crunchPngs !== false) {
|
||||||
console.warn(
|
console.warn(t('androidCrunchPngsWarning'));
|
||||||
'android 的 crunchPngs 选项似乎尚未禁用(如已禁用则请忽略此提示),这可能导致热更包体积异常增大,具体请参考 https://pushy.reactnative.cn/docs/getting-started.html#%E7%A6%81%E7%94%A8-android-%E7%9A%84-crunch-%E4%BC%98%E5%8C%96 \n',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,15 +75,12 @@ async function runReactNativeBundleCommand({
|
|||||||
const envArgs = process.env.PUSHY_ENV_ARGS;
|
const envArgs = process.env.PUSHY_ENV_ARGS;
|
||||||
|
|
||||||
if (envArgs) {
|
if (envArgs) {
|
||||||
Array.prototype.push.apply(
|
reactNativeBundleArgs.push(...envArgs.trim().split(/\s+/));
|
||||||
reactNativeBundleArgs,
|
|
||||||
envArgs.trim().split(/\s+/),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.emptyDirSync(outputFolder);
|
fs.emptyDirSync(outputFolder);
|
||||||
|
|
||||||
let cliPath: string | undefined;
|
let cliPath = '';
|
||||||
let usingExpo = false;
|
let usingExpo = false;
|
||||||
|
|
||||||
const getExpoCli = () => {
|
const getExpoCli = () => {
|
||||||
@@ -92,10 +98,10 @@ async function runReactNativeBundleCommand({
|
|||||||
.toString(),
|
.toString(),
|
||||||
).version;
|
).version;
|
||||||
// expo cli 0.10.17 (expo 49) 开始支持 bundle:embed
|
// expo cli 0.10.17 (expo 49) 开始支持 bundle:embed
|
||||||
if (semverSatisfies(expoCliVersion, '>= 0.10.17')) {
|
if (satisfies(expoCliVersion, '>= 0.10.17')) {
|
||||||
usingExpo = true;
|
usingExpo = true;
|
||||||
} else {
|
} else {
|
||||||
cliPath = undefined;
|
cliPath = '';
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
};
|
};
|
||||||
@@ -140,6 +146,14 @@ async function runReactNativeBundleCommand({
|
|||||||
const bundleParams = await checkPlugins();
|
const bundleParams = await checkPlugins();
|
||||||
const isSentry = bundleParams.sentry;
|
const isSentry = bundleParams.sentry;
|
||||||
|
|
||||||
|
if (isSentry) {
|
||||||
|
if (platform === 'ios') {
|
||||||
|
process.env.SENTRY_PROPERTIES = 'ios/sentry.properties';
|
||||||
|
} else if (platform === 'android') {
|
||||||
|
process.env.SENTRY_PROPERTIES = 'android/sentry.properties';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let bundleCommand = 'bundle';
|
let bundleCommand = 'bundle';
|
||||||
if (usingExpo) {
|
if (usingExpo) {
|
||||||
bundleCommand = 'export:embed';
|
bundleCommand = 'export:embed';
|
||||||
@@ -149,49 +163,32 @@ async function runReactNativeBundleCommand({
|
|||||||
bundleCommand = 'build';
|
bundleCommand = 'build';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platform === 'harmony') {
|
reactNativeBundleArgs.push(cliPath, bundleCommand);
|
||||||
Array.prototype.push.apply(reactNativeBundleArgs, [
|
|
||||||
cliPath,
|
|
||||||
bundleCommand,
|
|
||||||
'--dev',
|
|
||||||
dev,
|
|
||||||
'--entry-file',
|
|
||||||
entryFile,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (sourcemapOutput) {
|
if (platform !== 'harmony') {
|
||||||
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
|
reactNativeBundleArgs.push(
|
||||||
}
|
'--platform',
|
||||||
|
platform,
|
||||||
if (config) {
|
|
||||||
reactNativeBundleArgs.push('--config', config);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Array.prototype.push.apply(reactNativeBundleArgs, [
|
|
||||||
cliPath,
|
|
||||||
bundleCommand,
|
|
||||||
'--assets-dest',
|
'--assets-dest',
|
||||||
outputFolder,
|
outputFolder,
|
||||||
'--bundle-output',
|
'--bundle-output',
|
||||||
path.join(outputFolder, bundleName),
|
path.join(outputFolder, bundleName),
|
||||||
'--platform',
|
|
||||||
platform,
|
|
||||||
'--reset-cache',
|
'--reset-cache',
|
||||||
]);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (cli.taro) {
|
if (cli.taro) {
|
||||||
reactNativeBundleArgs.push(...['--type', 'rn']);
|
reactNativeBundleArgs.push('--type', 'rn');
|
||||||
} else {
|
} else {
|
||||||
reactNativeBundleArgs.push(...['--dev', dev, '--entry-file', entryFile]);
|
reactNativeBundleArgs.push('--dev', dev, '--entry-file', entryFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sourcemapOutput) {
|
if (sourcemapOutput) {
|
||||||
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
|
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config) {
|
if (config) {
|
||||||
reactNativeBundleArgs.push('--config', config);
|
reactNativeBundleArgs.push('--config', config);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const reactNativeBundleProcess = spawn('node', reactNativeBundleArgs);
|
const reactNativeBundleProcess = spawn('node', reactNativeBundleArgs);
|
||||||
@@ -210,17 +207,13 @@ async function runReactNativeBundleCommand({
|
|||||||
|
|
||||||
reactNativeBundleProcess.on('close', async (exitCode) => {
|
reactNativeBundleProcess.on('close', async (exitCode) => {
|
||||||
if (exitCode) {
|
if (exitCode) {
|
||||||
reject(
|
reject(new Error(t('bundleCommandError', { code: exitCode })));
|
||||||
new Error(
|
|
||||||
`"react-native bundle" command exited with code ${exitCode}.`,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
let hermesEnabled: boolean | undefined = false;
|
let hermesEnabled: boolean | undefined = false;
|
||||||
|
|
||||||
if (disableHermes) {
|
if (disableHermes) {
|
||||||
hermesEnabled = false;
|
hermesEnabled = false;
|
||||||
console.log('Hermes disabled');
|
console.log(t('hermesDisabled'));
|
||||||
} else if (platform === 'android') {
|
} else if (platform === 'android') {
|
||||||
const gradlePropeties = await new Promise<{
|
const gradlePropeties = await new Promise<{
|
||||||
hermesEnabled?: boolean;
|
hermesEnabled?: boolean;
|
||||||
@@ -275,12 +268,52 @@ async function copyHarmonyBundle(outputFolder: string) {
|
|||||||
}
|
}
|
||||||
await fs.remove(path.join(harmonyRawPath, 'update.json'));
|
await fs.remove(path.join(harmonyRawPath, 'update.json'));
|
||||||
await fs.copy('update.json', path.join(harmonyRawPath, 'update.json'));
|
await fs.copy('update.json', path.join(harmonyRawPath, 'update.json'));
|
||||||
|
|
||||||
await fs.ensureDir(outputFolder);
|
await fs.ensureDir(outputFolder);
|
||||||
await fs.copy(harmonyRawPath, outputFolder);
|
|
||||||
|
// Recursively copy files with special handling for assets directory
|
||||||
|
async function copyFilesRecursively(
|
||||||
|
srcDir: string,
|
||||||
|
destDir: string,
|
||||||
|
relativePath = '',
|
||||||
|
) {
|
||||||
|
const fullSrcPath = path.join(srcDir, relativePath);
|
||||||
|
const items = await fs.readdir(fullSrcPath);
|
||||||
|
|
||||||
|
for (const item of items) {
|
||||||
|
const itemRelativePath = path.join(relativePath, item);
|
||||||
|
const itemSrcPath = path.join(srcDir, itemRelativePath);
|
||||||
|
|
||||||
|
// Skip update.json and meta.json at root level
|
||||||
|
if (!relativePath && (item === 'update.json' || item === 'meta.json')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const stat = await fs.stat(itemSrcPath);
|
||||||
|
|
||||||
|
if (stat.isFile()) {
|
||||||
|
// Special handling: remove 'assets/' prefix to move files up one level
|
||||||
|
let itemDestPath = itemRelativePath;
|
||||||
|
if (
|
||||||
|
itemDestPath.startsWith('assets/') ||
|
||||||
|
itemDestPath.startsWith('assets\\')
|
||||||
|
) {
|
||||||
|
itemDestPath = itemDestPath.replace(/^assets[\\/]/, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
const fullDestPath = path.join(destDir, itemDestPath);
|
||||||
|
await fs.ensureDir(path.dirname(fullDestPath));
|
||||||
|
await fs.copy(itemSrcPath, fullDestPath);
|
||||||
|
} else if (stat.isDirectory()) {
|
||||||
|
// Recursively process subdirectories
|
||||||
|
await copyFilesRecursively(srcDir, destDir, itemRelativePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await copyFilesRecursively(harmonyRawPath, outputFolder);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error('copyHarmonyBundle 错误:', error);
|
console.error(t('copyHarmonyBundleError', { error }));
|
||||||
throw new Error(`复制文件失败: ${error.message}`);
|
throw new Error(t('copyFileFailed', { error: error.message }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +354,7 @@ async function compileHermesByteCode(
|
|||||||
sourcemapOutput: string,
|
sourcemapOutput: string,
|
||||||
shouldCleanSourcemap: boolean,
|
shouldCleanSourcemap: boolean,
|
||||||
) {
|
) {
|
||||||
console.log('Hermes enabled, now compiling to hermes bytecode:\n');
|
console.log(t('hermesEnabledCompiling'));
|
||||||
// >= rn 0.69
|
// >= rn 0.69
|
||||||
const rnDir = path.dirname(
|
const rnDir = path.dirname(
|
||||||
require.resolve('react-native', {
|
require.resolve('react-native', {
|
||||||
@@ -351,7 +384,9 @@ async function compileHermesByteCode(
|
|||||||
);
|
);
|
||||||
args.push('-output-source-map');
|
args.push('-output-source-map');
|
||||||
}
|
}
|
||||||
console.log(`Running hermesc: ${hermesCommand} ${args.join(' ')}`);
|
console.log(
|
||||||
|
t('runningHermesc', { command: hermesCommand, args: args.join(' ') }),
|
||||||
|
);
|
||||||
spawnSync(hermesCommand, args, {
|
spawnSync(hermesCommand, args, {
|
||||||
stdio: 'ignore',
|
stdio: 'ignore',
|
||||||
});
|
});
|
||||||
@@ -361,7 +396,7 @@ async function compileHermesByteCode(
|
|||||||
if (!fs.existsSync(composerPath)) {
|
if (!fs.existsSync(composerPath)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('Composing source map');
|
console.log(t('composingSourceMap'));
|
||||||
spawnSync(
|
spawnSync(
|
||||||
'node',
|
'node',
|
||||||
[
|
[
|
||||||
@@ -387,7 +422,7 @@ async function copyDebugidForSentry(
|
|||||||
sourcemapOutput: string,
|
sourcemapOutput: string,
|
||||||
) {
|
) {
|
||||||
if (sourcemapOutput) {
|
if (sourcemapOutput) {
|
||||||
let copyDebugidPath;
|
let copyDebugidPath: string | undefined;
|
||||||
try {
|
try {
|
||||||
copyDebugidPath = require.resolve(
|
copyDebugidPath = require.resolve(
|
||||||
'@sentry/react-native/scripts/copy-debugid.js',
|
'@sentry/react-native/scripts/copy-debugid.js',
|
||||||
@@ -396,16 +431,14 @@ async function copyDebugidForSentry(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(
|
console.error(t('sentryCliNotFound'));
|
||||||
'无法找到 Sentry copy-debugid.js 脚本文件,请确保已正确安装 @sentry/react-native',
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fs.existsSync(copyDebugidPath)) {
|
if (!fs.existsSync(copyDebugidPath)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('Copying debugid');
|
console.log(t('copyingDebugId'));
|
||||||
spawnSync(
|
spawnSync(
|
||||||
'node',
|
'node',
|
||||||
[
|
[
|
||||||
@@ -428,13 +461,13 @@ async function uploadSourcemapForSentry(
|
|||||||
version: string,
|
version: string,
|
||||||
) {
|
) {
|
||||||
if (sourcemapOutput) {
|
if (sourcemapOutput) {
|
||||||
let sentryCliPath;
|
let sentryCliPath: string | undefined;
|
||||||
try {
|
try {
|
||||||
sentryCliPath = require.resolve('@sentry/cli/bin/sentry-cli', {
|
sentryCliPath = require.resolve('@sentry/cli/bin/sentry-cli', {
|
||||||
paths: [process.cwd()],
|
paths: [process.cwd()],
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('无法找到 Sentry CLI 工具,请确保已正确安装 @sentry/cli');
|
console.error(t('sentryCliNotFound'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,9 +482,9 @@ async function uploadSourcemapForSentry(
|
|||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
console.log(`Sentry release created for version: ${version}`);
|
console.log(t('sentryReleaseCreated', { version }));
|
||||||
|
|
||||||
console.log('Uploading sourcemap');
|
console.log(t('uploadingSourcemap'));
|
||||||
spawnSync(
|
spawnSync(
|
||||||
'node',
|
'node',
|
||||||
[
|
[
|
||||||
@@ -473,12 +506,12 @@ async function uploadSourcemapForSentry(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ignorePackingFileNames = ['.', '..', 'index.bundlejs.map'];
|
const ignorePackingFileNames = ['.', '..', 'index.bundlejs.map'];
|
||||||
const ignorePackingExtensions = ['DS_Store'];
|
const ignorePackingExtensions = ['DS_Store', 'txt.map'];
|
||||||
async function pack(dir: string, output: string) {
|
async function pack(dir: string, output: string) {
|
||||||
console.log('Packing');
|
console.log(t('packing'));
|
||||||
fs.ensureDirSync(path.dirname(output));
|
fs.ensureDirSync(path.dirname(output));
|
||||||
await new Promise<void>((resolve, reject) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
const zipfile = new ZipFile();
|
const zipfile = new YazlZipFile();
|
||||||
|
|
||||||
function addDirectory(root: string, rel: string) {
|
function addDirectory(root: string, rel: string) {
|
||||||
if (rel) {
|
if (rel) {
|
||||||
@@ -508,28 +541,28 @@ async function pack(dir: string, output: string) {
|
|||||||
|
|
||||||
zipfile.outputStream.on('error', (err: any) => reject(err));
|
zipfile.outputStream.on('error', (err: any) => reject(err));
|
||||||
zipfile.outputStream.pipe(fs.createWriteStream(output)).on('close', () => {
|
zipfile.outputStream.pipe(fs.createWriteStream(output)).on('close', () => {
|
||||||
resolve();
|
resolve(void 0);
|
||||||
});
|
});
|
||||||
zipfile.end();
|
zipfile.end();
|
||||||
});
|
});
|
||||||
console.log(`ppk热更包已生成并保存到: ${output}`);
|
console.log(t('fileGenerated', { file: output }));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function readEntire(entry: string, zipFile: ZipFile) {
|
export function readEntry(
|
||||||
|
entry: Entry,
|
||||||
|
zipFile: YauzlZipFile,
|
||||||
|
): Promise<Buffer> {
|
||||||
const buffers: Buffer[] = [];
|
const buffers: Buffer[] = [];
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
zipFile.openReadStream(entry, (err: any, stream: any) => {
|
zipFile.openReadStream(entry, (err, stream) => {
|
||||||
stream.pipe({
|
stream.on('data', (chunk: Buffer) => {
|
||||||
write(chunk: Buffer) {
|
buffers.push(chunk);
|
||||||
buffers.push(chunk);
|
});
|
||||||
},
|
stream.on('end', () => {
|
||||||
end() {
|
resolve(Buffer.concat(buffers));
|
||||||
resolve(Buffer.concat(buffers));
|
});
|
||||||
},
|
stream.on('error', (err) => {
|
||||||
prependListener() {},
|
reject(err);
|
||||||
on() {},
|
|
||||||
once() {},
|
|
||||||
emit() {},
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -546,7 +579,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|||||||
const originEntries = {};
|
const originEntries = {};
|
||||||
const originMap = {};
|
const originMap = {};
|
||||||
|
|
||||||
let originSource;
|
let originSource: Buffer | undefined;
|
||||||
|
|
||||||
await enumZipEntries(origin, (entry, zipFile) => {
|
await enumZipEntries(origin, (entry, zipFile) => {
|
||||||
originEntries[entry.fileName] = entry;
|
originEntries[entry.fileName] = entry;
|
||||||
@@ -559,7 +592,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|||||||
entry.fileName === 'bundle.harmony.js'
|
entry.fileName === 'bundle.harmony.js'
|
||||||
) {
|
) {
|
||||||
// This is source.
|
// This is source.
|
||||||
return readEntire(entry, zipFile).then((v) => (originSource = v));
|
return readEntry(entry, zipFile).then((v) => (originSource = v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -571,15 +604,16 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const copies = {};
|
const copies = {};
|
||||||
|
const copiesv2 = {};
|
||||||
|
|
||||||
const zipfile = new ZipFile();
|
const zipfile = new YazlZipFile();
|
||||||
|
|
||||||
const writePromise = new Promise((resolve, reject) => {
|
const writePromise = new Promise((resolve, reject) => {
|
||||||
zipfile.outputStream.on('error', (err) => {
|
zipfile.outputStream.on('error', (err) => {
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
zipfile.outputStream.pipe(fs.createWriteStream(output)).on('close', () => {
|
zipfile.outputStream.pipe(fs.createWriteStream(output)).on('close', () => {
|
||||||
resolve();
|
resolve(void 0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -609,7 +643,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|||||||
}
|
}
|
||||||
} else if (entry.fileName === 'index.bundlejs') {
|
} else if (entry.fileName === 'index.bundlejs') {
|
||||||
//console.log('Found bundle');
|
//console.log('Found bundle');
|
||||||
return readEntire(entry, nextZipfile).then((newSource) => {
|
return readEntry(entry, nextZipfile).then((newSource) => {
|
||||||
//console.log('Begin diff');
|
//console.log('Begin diff');
|
||||||
zipfile.addBuffer(
|
zipfile.addBuffer(
|
||||||
diff(originSource, newSource),
|
diff(originSource, newSource),
|
||||||
@@ -619,7 +653,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|||||||
});
|
});
|
||||||
} else if (entry.fileName === 'bundle.harmony.js') {
|
} else if (entry.fileName === 'bundle.harmony.js') {
|
||||||
//console.log('Found bundle');
|
//console.log('Found bundle');
|
||||||
return readEntire(entry, nextZipfile).then((newSource) => {
|
return readEntry(entry, nextZipfile).then((newSource) => {
|
||||||
//console.log('Begin diff');
|
//console.log('Begin diff');
|
||||||
zipfile.addBuffer(
|
zipfile.addBuffer(
|
||||||
diff(originSource, newSource),
|
diff(originSource, newSource),
|
||||||
@@ -642,6 +676,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|||||||
addEntry(base);
|
addEntry(base);
|
||||||
}
|
}
|
||||||
copies[entry.fileName] = originMap[entry.crc32];
|
copies[entry.fileName] = originMap[entry.crc32];
|
||||||
|
copiesv2[entry.crc32] = entry.fileName;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -656,7 +691,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|||||||
zipfile.addReadStream(readStream, entry.fileName);
|
zipfile.addReadStream(readStream, entry.fileName);
|
||||||
readStream.on('end', () => {
|
readStream.on('end', () => {
|
||||||
//console.log('add finished');
|
//console.log('add finished');
|
||||||
resolve();
|
resolve(void 0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -667,14 +702,14 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|||||||
|
|
||||||
for (const k in originEntries) {
|
for (const k in originEntries) {
|
||||||
if (!newEntries[k]) {
|
if (!newEntries[k]) {
|
||||||
console.log(`Delete ${k}`);
|
console.log(t('deleteFile', { file: k }));
|
||||||
deletes[k] = 1;
|
deletes[k] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log({copies, deletes});
|
//console.log({copies, deletes});
|
||||||
zipfile.addBuffer(
|
zipfile.addBuffer(
|
||||||
Buffer.from(JSON.stringify({ copies, deletes })),
|
Buffer.from(JSON.stringify({ copies, copiesv2, deletes })),
|
||||||
'__diff.json',
|
'__diff.json',
|
||||||
);
|
);
|
||||||
zipfile.end();
|
zipfile.end();
|
||||||
@@ -693,9 +728,9 @@ async function diffFromPackage(
|
|||||||
const originEntries = {};
|
const originEntries = {};
|
||||||
const originMap = {};
|
const originMap = {};
|
||||||
|
|
||||||
let originSource;
|
let originSource: Buffer | undefined;
|
||||||
|
|
||||||
await enumZipEntries(origin, (entry: any, zipFile: any) => {
|
await enumZipEntries(origin, (entry, zipFile) => {
|
||||||
if (!/\/$/.test(entry.fileName)) {
|
if (!/\/$/.test(entry.fileName)) {
|
||||||
const fn = transformPackagePath(entry.fileName);
|
const fn = transformPackagePath(entry.fileName);
|
||||||
if (!fn) {
|
if (!fn) {
|
||||||
@@ -709,7 +744,7 @@ async function diffFromPackage(
|
|||||||
|
|
||||||
if (fn === originBundleName) {
|
if (fn === originBundleName) {
|
||||||
// This is source.
|
// This is source.
|
||||||
return readEntire(entry, zipFile).then((v) => (originSource = v));
|
return readEntry(entry, zipFile).then((v) => (originSource = v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -721,15 +756,16 @@ async function diffFromPackage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const copies = {};
|
const copies = {};
|
||||||
|
const copiesv2 = {};
|
||||||
|
|
||||||
const zipfile = new ZipFile();
|
const zipfile = new YazlZipFile();
|
||||||
|
|
||||||
const writePromise = new Promise((resolve, reject) => {
|
const writePromise = new Promise((resolve, reject) => {
|
||||||
zipfile.outputStream.on('error', (err) => {
|
zipfile.outputStream.on('error', (err) => {
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
zipfile.outputStream.pipe(fs.createWriteStream(output)).on('close', () => {
|
zipfile.outputStream.pipe(fs.createWriteStream(output)).on('close', () => {
|
||||||
resolve();
|
resolve(void 0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -739,7 +775,7 @@ async function diffFromPackage(
|
|||||||
zipfile.addEmptyDirectory(entry.fileName);
|
zipfile.addEmptyDirectory(entry.fileName);
|
||||||
} else if (entry.fileName === 'index.bundlejs') {
|
} else if (entry.fileName === 'index.bundlejs') {
|
||||||
//console.log('Found bundle');
|
//console.log('Found bundle');
|
||||||
return readEntire(entry, nextZipfile).then((newSource) => {
|
return readEntry(entry, nextZipfile).then((newSource) => {
|
||||||
//console.log('Begin diff');
|
//console.log('Begin diff');
|
||||||
zipfile.addBuffer(
|
zipfile.addBuffer(
|
||||||
diff(originSource, newSource),
|
diff(originSource, newSource),
|
||||||
@@ -749,7 +785,7 @@ async function diffFromPackage(
|
|||||||
});
|
});
|
||||||
} else if (entry.fileName === 'bundle.harmony.js') {
|
} else if (entry.fileName === 'bundle.harmony.js') {
|
||||||
//console.log('Found bundle');
|
//console.log('Found bundle');
|
||||||
return readEntire(entry, nextZipfile).then((newSource) => {
|
return readEntry(entry, nextZipfile).then((newSource) => {
|
||||||
//console.log('Begin diff');
|
//console.log('Begin diff');
|
||||||
zipfile.addBuffer(
|
zipfile.addBuffer(
|
||||||
diff(originSource, newSource),
|
diff(originSource, newSource),
|
||||||
@@ -766,6 +802,7 @@ async function diffFromPackage(
|
|||||||
// If moved from other place
|
// If moved from other place
|
||||||
if (originMap[entry.crc32]) {
|
if (originMap[entry.crc32]) {
|
||||||
copies[entry.fileName] = originMap[entry.crc32];
|
copies[entry.fileName] = originMap[entry.crc32];
|
||||||
|
copiesv2[entry.crc32] = entry.fileName;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -777,28 +814,35 @@ async function diffFromPackage(
|
|||||||
zipfile.addReadStream(readStream, entry.fileName);
|
zipfile.addReadStream(readStream, entry.fileName);
|
||||||
readStream.on('end', () => {
|
readStream.on('end', () => {
|
||||||
//console.log('add finished');
|
//console.log('add finished');
|
||||||
resolve();
|
resolve(void 0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
zipfile.addBuffer(Buffer.from(JSON.stringify({ copies })), '__diff.json');
|
zipfile.addBuffer(
|
||||||
|
Buffer.from(JSON.stringify({ copies, copiesv2 })),
|
||||||
|
'__diff.json',
|
||||||
|
);
|
||||||
zipfile.end();
|
zipfile.end();
|
||||||
await writePromise;
|
await writePromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function enumZipEntries(
|
export async function enumZipEntries(
|
||||||
zipFn: string,
|
zipFn: string,
|
||||||
callback: (entry: any, zipFile: any) => void,
|
callback: (
|
||||||
|
entry: Entry,
|
||||||
|
zipFile: YauzlZipFile,
|
||||||
|
nestedPath?: string,
|
||||||
|
) => Promise<any>,
|
||||||
nestedPath = '',
|
nestedPath = '',
|
||||||
) {
|
) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
openZipFile(
|
openZipFile(
|
||||||
zipFn,
|
zipFn,
|
||||||
{ lazyEntries: true },
|
{ lazyEntries: true },
|
||||||
async (err: any, zipfile: ZipFile) => {
|
async (err: any, zipfile: YauzlZipFile) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(err);
|
return reject(err);
|
||||||
}
|
}
|
||||||
@@ -825,7 +869,7 @@ export async function enumZipEntries(
|
|||||||
if (err) return rej(err);
|
if (err) return rej(err);
|
||||||
const writeStream = fs.createWriteStream(tempZipPath);
|
const writeStream = fs.createWriteStream(tempZipPath);
|
||||||
readStream.pipe(writeStream);
|
readStream.pipe(writeStream);
|
||||||
writeStream.on('finish', res);
|
writeStream.on('finish', () => res(void 0));
|
||||||
writeStream.on('error', rej);
|
writeStream.on('error', rej);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -840,7 +884,7 @@ export async function enumZipEntries(
|
|||||||
await result;
|
await result;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('处理文件时出错:', error);
|
console.error(t('processingError', { error }));
|
||||||
}
|
}
|
||||||
|
|
||||||
zipfile.readEntry();
|
zipfile.readEntry();
|
||||||
@@ -852,11 +896,11 @@ export async function enumZipEntries(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function diffArgsCheck(args, options, diffFn) {
|
function diffArgsCheck(args: string[], options: any, diffFn: string) {
|
||||||
const [origin, next] = args;
|
const [origin, next] = args;
|
||||||
|
|
||||||
if (!origin || !next) {
|
if (!origin || !next) {
|
||||||
console.error(`Usage: pushy ${diffFn} <origin> <next>`);
|
console.error(t('usageDiff', { command: diffFn }));
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -888,11 +932,9 @@ function diffArgsCheck(args, options, diffFn) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const commands = {
|
export const bundleCommands = {
|
||||||
bundle: async function ({ options }) {
|
bundle: async ({ options }) => {
|
||||||
const platform = checkPlatform(
|
const platform = await getPlatform(options.platform);
|
||||||
options.platform || (await question('平台(ios/android/harmony):')),
|
|
||||||
);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
bundleName,
|
bundleName,
|
||||||
@@ -905,11 +947,25 @@ export const commands = {
|
|||||||
expo,
|
expo,
|
||||||
rncli,
|
rncli,
|
||||||
disableHermes,
|
disableHermes,
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
metaInfo,
|
||||||
|
packageId,
|
||||||
|
packageVersion,
|
||||||
|
minPackageVersion,
|
||||||
|
maxPackageVersion,
|
||||||
|
packageVersionRange,
|
||||||
|
rollout,
|
||||||
|
dryRun,
|
||||||
} = translateOptions({
|
} = translateOptions({
|
||||||
...options,
|
...options,
|
||||||
|
tempDir,
|
||||||
platform,
|
platform,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
checkLockFiles();
|
||||||
|
addGitIgnore();
|
||||||
|
|
||||||
const bundleParams = await checkPlugins();
|
const bundleParams = await checkPlugins();
|
||||||
const sourcemapPlugin = bundleParams.sourcemap;
|
const sourcemapPlugin = bundleParams.sourcemap;
|
||||||
const isSentry = bundleParams.sentry;
|
const isSentry = bundleParams.sentry;
|
||||||
@@ -919,7 +975,7 @@ export const commands = {
|
|||||||
const realOutput = output.replace(/\$\{time\}/g, `${Date.now()}`);
|
const realOutput = output.replace(/\$\{time\}/g, `${Date.now()}`);
|
||||||
|
|
||||||
if (!platform) {
|
if (!platform) {
|
||||||
throw new Error('Platform must be specified.');
|
throw new Error(t('platformRequired'));
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Bundling with react-native: ${depVersions['react-native']}`);
|
console.log(`Bundling with react-native: ${depVersions['react-native']}`);
|
||||||
@@ -931,24 +987,34 @@ export const commands = {
|
|||||||
outputFolder: intermediaDir,
|
outputFolder: intermediaDir,
|
||||||
platform,
|
platform,
|
||||||
sourcemapOutput: sourcemap || sourcemapPlugin ? sourcemapOutput : '',
|
sourcemapOutput: sourcemap || sourcemapPlugin ? sourcemapOutput : '',
|
||||||
disableHermes,
|
disableHermes: !!disableHermes,
|
||||||
cli: {
|
cli: {
|
||||||
taro,
|
taro: !!taro,
|
||||||
expo,
|
expo: !!expo,
|
||||||
rncli,
|
rncli: !!rncli,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
await pack(path.resolve(intermediaDir), realOutput);
|
await pack(path.resolve(intermediaDir), realOutput);
|
||||||
|
|
||||||
const v = await question('是否现在上传此热更包?(Y/N)');
|
if (name) {
|
||||||
if (v.toLowerCase() === 'y') {
|
const versionName = await versionCommands.publish({
|
||||||
const versionName = await this.publish({
|
|
||||||
args: [realOutput],
|
args: [realOutput],
|
||||||
options: {
|
options: {
|
||||||
platform,
|
platform,
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
metaInfo,
|
||||||
|
packageId,
|
||||||
|
packageVersion,
|
||||||
|
minPackageVersion,
|
||||||
|
maxPackageVersion,
|
||||||
|
packageVersionRange,
|
||||||
|
rollout,
|
||||||
|
dryRun: Boolean(dryRun),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isSentry) {
|
if (isSentry) {
|
||||||
await copyDebugidForSentry(bundleName, intermediaDir, sourcemapOutput);
|
await copyDebugidForSentry(bundleName, intermediaDir, sourcemapOutput);
|
||||||
await uploadSourcemapForSentry(
|
await uploadSourcemapForSentry(
|
||||||
@@ -958,20 +1024,43 @@ export const commands = {
|
|||||||
versionName,
|
versionName,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} else if (!options['no-interactive']) {
|
||||||
|
const v = await question(t('uploadBundlePrompt'));
|
||||||
|
if (v.toLowerCase() === 'y') {
|
||||||
|
const versionName = await versionCommands.publish({
|
||||||
|
args: [realOutput],
|
||||||
|
options: {
|
||||||
|
platform,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (isSentry) {
|
||||||
|
await copyDebugidForSentry(
|
||||||
|
bundleName,
|
||||||
|
intermediaDir,
|
||||||
|
sourcemapOutput,
|
||||||
|
);
|
||||||
|
await uploadSourcemapForSentry(
|
||||||
|
bundleName,
|
||||||
|
intermediaDir,
|
||||||
|
sourcemapOutput,
|
||||||
|
versionName,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async diff({ args, options }) {
|
async diff({ args, options }) {
|
||||||
const { origin, next, realOutput } = diffArgsCheck(args, options, 'diff');
|
const { origin, next, realOutput } = diffArgsCheck(args, options, 'diff');
|
||||||
|
|
||||||
await diffFromPPK(origin, next, realOutput, 'index.bundlejs');
|
await diffFromPPK(origin, next, realOutput);
|
||||||
console.log(`${realOutput} generated.`);
|
console.log(`${realOutput} generated.`);
|
||||||
},
|
},
|
||||||
|
|
||||||
async hdiff({ args, options }) {
|
async hdiff({ args, options }) {
|
||||||
const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiff');
|
const { origin, next, realOutput } = diffArgsCheck(args, options, 'hdiff');
|
||||||
|
|
||||||
await diffFromPPK(origin, next, realOutput, 'index.bundlejs');
|
await diffFromPPK(origin, next, realOutput);
|
||||||
console.log(`${realOutput} generated.`);
|
console.log(`${realOutput} generated.`);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1007,6 +1096,21 @@ export const commands = {
|
|||||||
console.log(`${realOutput} generated.`);
|
console.log(`${realOutput} generated.`);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async diffFromApp({ args, options }) {
|
||||||
|
const { origin, next, realOutput } = diffArgsCheck(
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
'diffFromApp',
|
||||||
|
);
|
||||||
|
await diffFromPackage(
|
||||||
|
origin,
|
||||||
|
next,
|
||||||
|
realOutput,
|
||||||
|
'resources/rawfile/bundle.harmony.js',
|
||||||
|
);
|
||||||
|
console.log(`${realOutput} generated.`);
|
||||||
|
},
|
||||||
|
|
||||||
async hdiffFromApp({ args, options }) {
|
async hdiffFromApp({ args, options }) {
|
||||||
const { origin, next, realOutput } = diffArgsCheck(
|
const { origin, next, realOutput } = diffArgsCheck(
|
||||||
args,
|
args,
|
||||||
|
|||||||
30
src/exports.ts
Normal file
30
src/exports.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
export { moduleManager } from './module-manager';
|
||||||
|
export { CLIProviderImpl } from './provider';
|
||||||
|
|
||||||
|
export type {
|
||||||
|
CLIProvider,
|
||||||
|
CLIModule,
|
||||||
|
CommandDefinition,
|
||||||
|
CustomWorkflow,
|
||||||
|
WorkflowStep,
|
||||||
|
CommandContext,
|
||||||
|
CommandResult,
|
||||||
|
BundleOptions,
|
||||||
|
PublishOptions,
|
||||||
|
UploadOptions,
|
||||||
|
Platform,
|
||||||
|
Session,
|
||||||
|
Version,
|
||||||
|
Package,
|
||||||
|
} from './types';
|
||||||
|
|
||||||
|
export { builtinModules } from './modules';
|
||||||
|
export { bundleModule } from './modules/bundle-module';
|
||||||
|
export { versionModule } from './modules/version-module';
|
||||||
|
export { appModule } from './modules/app-module';
|
||||||
|
export { userModule } from './modules/user-module';
|
||||||
|
export { packageModule } from './modules/package-module';
|
||||||
|
|
||||||
|
export { loadSession, getSession } from './api';
|
||||||
|
export { getPlatform, getSelectedApp } from './app';
|
||||||
|
export { question, saveToLocal } from './utils';
|
||||||
147
src/index.ts
147
src/index.ts
@@ -1,33 +1,81 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
import { loadSession } from './api';
|
import { loadSession } from './api';
|
||||||
import updateNotifier from 'update-notifier';
|
import { appCommands } from './app';
|
||||||
|
import { bundleCommands } from './bundle';
|
||||||
|
import { moduleManager } from './module-manager';
|
||||||
|
import { builtinModules } from './modules';
|
||||||
|
import { packageCommands } from './package';
|
||||||
|
import type { CommandContext } from './types';
|
||||||
|
import { userCommands } from './user';
|
||||||
import { printVersionCommand } from './utils';
|
import { printVersionCommand } from './utils';
|
||||||
import pkg from '../package.json';
|
|
||||||
import { t } from './utils/i18n';
|
import { t } from './utils/i18n';
|
||||||
|
import { versionCommands } from './versions';
|
||||||
|
|
||||||
updateNotifier({ pkg }).notify({
|
function registerBuiltinModules() {
|
||||||
isGlobal: true,
|
for (const module of builtinModules) {
|
||||||
message: t('updateNotifier'),
|
try {
|
||||||
});
|
moduleManager.registerModule(module);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Failed to register module ${module.name}:`, error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function printUsage() {
|
function printUsage() {
|
||||||
// const commandName = args[0];
|
console.log('React Native Update CLI');
|
||||||
// TODO: print usage of commandName, or print global usage.
|
console.log('');
|
||||||
|
console.log('Traditional commands:');
|
||||||
|
|
||||||
|
const legacyCommands = {
|
||||||
|
...userCommands,
|
||||||
|
...bundleCommands,
|
||||||
|
...appCommands,
|
||||||
|
...packageCommands,
|
||||||
|
...versionCommands,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const [name, handler] of Object.entries(legacyCommands)) {
|
||||||
|
console.log(` ${name}: Legacy command`);
|
||||||
|
}
|
||||||
|
|
||||||
console.log('Usage is under development now.');
|
console.log('');
|
||||||
|
console.log('Modular commands:');
|
||||||
|
const commands = moduleManager.getRegisteredCommands();
|
||||||
|
for (const command of commands) {
|
||||||
|
console.log(
|
||||||
|
` ${command.name}: ${command.description || 'No description'}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('');
|
||||||
|
console.log('Available workflows:');
|
||||||
|
const workflows = moduleManager.getRegisteredWorkflows();
|
||||||
|
for (const workflow of workflows) {
|
||||||
|
console.log(
|
||||||
|
` ${workflow.name}: ${workflow.description || 'No description'}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('');
|
||||||
|
console.log('Special commands:');
|
||||||
|
console.log(' list: List all available commands and workflows');
|
||||||
|
console.log(' workflow <name>: Execute a specific workflow');
|
||||||
|
console.log(' help: Show this help message');
|
||||||
|
|
||||||
|
console.log('');
|
||||||
console.log(
|
console.log(
|
||||||
'Visit `https://github.com/reactnativecn/react-native-update` for document.',
|
'Visit `https://github.com/reactnativecn/react-native-update` for document.',
|
||||||
);
|
);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const commands = {
|
const legacyCommands = {
|
||||||
...require('./user').commands,
|
...userCommands,
|
||||||
...require('./bundle').commands,
|
...bundleCommands,
|
||||||
...require('./app').commands,
|
...appCommands,
|
||||||
...require('./package').commands,
|
...packageCommands,
|
||||||
...require('./versions').commands,
|
...versionCommands,
|
||||||
help: printUsage,
|
help: printUsage,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -37,20 +85,71 @@ async function run() {
|
|||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Register builtin modules for modular functionality
|
||||||
|
registerBuiltinModules();
|
||||||
|
|
||||||
const argv = require('cli-arguments').parse(require('../cli.json'));
|
const argv = require('cli-arguments').parse(require('../cli.json'));
|
||||||
global.NO_INTERACTIVE = argv.options['no-interactive'];
|
global.NO_INTERACTIVE = argv.options['no-interactive'];
|
||||||
global.USE_ACC_OSS = argv.options.acc;
|
global.USE_ACC_OSS = argv.options.acc;
|
||||||
|
|
||||||
loadSession()
|
const context: CommandContext = {
|
||||||
.then(() => commands[argv.command](argv))
|
args: argv.args || [],
|
||||||
.catch((err) => {
|
options: argv.options || {},
|
||||||
if (err.status === 401) {
|
};
|
||||||
console.log(t('loginFirst'));
|
|
||||||
return;
|
try {
|
||||||
|
await loadSession();
|
||||||
|
context.session = require('./api').getSession();
|
||||||
|
|
||||||
|
// Handle special modular commands first
|
||||||
|
if (argv.command === 'help') {
|
||||||
|
printUsage();
|
||||||
|
} else if (argv.command === 'list') {
|
||||||
|
moduleManager.listAll();
|
||||||
|
} else if (argv.command === 'workflow') {
|
||||||
|
const workflowName = argv.args[0];
|
||||||
|
if (!workflowName) {
|
||||||
|
console.error('Workflow name is required');
|
||||||
|
process.exit(1);
|
||||||
}
|
}
|
||||||
console.error(err.stack);
|
const result = await moduleManager.executeWorkflow(workflowName, context);
|
||||||
process.exit(-1);
|
if (!result.success) {
|
||||||
});
|
console.error('Workflow execution failed:', result.error);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
console.log('Workflow completed successfully:', result.data);
|
||||||
|
}
|
||||||
|
// Try legacy commands first for backward compatibility
|
||||||
|
else if (legacyCommands[argv.command]) {
|
||||||
|
await legacyCommands[argv.command](argv);
|
||||||
|
}
|
||||||
|
// Fall back to modular commands
|
||||||
|
else {
|
||||||
|
const result = await moduleManager.executeCommand(argv.command, context);
|
||||||
|
if (!result.success) {
|
||||||
|
console.error('Command execution failed:', result.error);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
console.log('Command completed successfully:', result.data);
|
||||||
|
}
|
||||||
|
} catch (err: any) {
|
||||||
|
if (err.status === 401) {
|
||||||
|
console.log(t('loginFirst'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.error(err.stack);
|
||||||
|
process.exit(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export { moduleManager };
|
||||||
|
export { CLIProviderImpl } from './provider';
|
||||||
|
export type {
|
||||||
|
CLIProvider,
|
||||||
|
CLIModule,
|
||||||
|
CommandDefinition,
|
||||||
|
CustomWorkflow,
|
||||||
|
WorkflowStep,
|
||||||
|
} from './types';
|
||||||
|
|
||||||
run();
|
run();
|
||||||
|
|||||||
@@ -1,12 +1,60 @@
|
|||||||
export default {
|
export default {
|
||||||
updateNotifier:
|
addedToGitignore: 'Added {{line}} to .gitignore',
|
||||||
'Run `{updateCommand}` to update the CLI to get continuous improvements in features, performance, and security.',
|
androidCrunchPngsWarning:
|
||||||
loginFirst:
|
'The crunchPngs option of android seems not disabled (Please ignore this warning if already disabled), which may cause abnormal consumption of mobile network traffic. Please refer to https://cresc.dev/docs/getting-started#disable-crunchpngs-on-android \n',
|
||||||
'Not logged in.\nPlease run `cresc login` in the project directory to login.',
|
appId: 'App ID',
|
||||||
lockNotFound:
|
appIdMismatchApk:
|
||||||
'No lock file detected, which may cause inconsistent dependencies and hot-updating issues.',
|
'App ID mismatch! Current APK: {{appIdInPkg}}, current update.json: {{appId}}',
|
||||||
multipleLocksFound:
|
appIdMismatchApp:
|
||||||
'Multiple lock files detected ({lockFiles}), which may cause inconsistent dependencies and hot-updating issues.',
|
'App ID mismatch! Current APP: {{appIdInPkg}}, current update.json: {{appId}}',
|
||||||
|
appIdMismatchIpa:
|
||||||
|
'App ID mismatch! Current IPA: {{appIdInPkg}}, current update.json: {{appId}}',
|
||||||
|
appKeyMismatchApk:
|
||||||
|
'App Key mismatch! Current APK: {{appKeyInPkg}}, current update.json: {{appKey}}',
|
||||||
|
appKeyMismatchApp:
|
||||||
|
'App Key mismatch! Current APP: {{appKeyInPkg}}, current update.json: {{appKey}}',
|
||||||
|
appKeyMismatchIpa:
|
||||||
|
'App Key mismatch! Current IPA: {{appKeyInPkg}}, current update.json: {{appKey}}',
|
||||||
|
appName: 'App Name',
|
||||||
|
appNameQuestion: 'App Name:',
|
||||||
|
appNotSelected:
|
||||||
|
'App not selected. run `cresc selectApp --platform {{platform}}` first!',
|
||||||
|
appUploadSuccess:
|
||||||
|
'Successfully uploaded APP native package (id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
||||||
|
apkUploadSuccess:
|
||||||
|
'Successfully uploaded APK native package (id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
||||||
|
boundTo: ', bound to: {{name}} ({{id}})',
|
||||||
|
buildTimeNotFound:
|
||||||
|
'Cannot get the build timestamp of this package. Please update `react-native-update` to the latest version and re-package and upload.',
|
||||||
|
bundleCommandError:
|
||||||
|
'"react-native bundle" command exited with code {{code}}.',
|
||||||
|
bundleNotFound:
|
||||||
|
'Bundle file not found. Please ensure that this {{packageType}} is a release version and the bundle file name is the default `{{entryFile}}`',
|
||||||
|
bundlingWithRN: 'Bundling with react-native: {{version}}',
|
||||||
|
cancelled: 'Cancelled',
|
||||||
|
composingSourceMap: 'Composing source map',
|
||||||
|
copyFileFailed: 'Failed to copy file: {{error}}',
|
||||||
|
copyHarmonyBundleError: 'Error copying Harmony bundle: {{error}}',
|
||||||
|
copyingDebugId: 'Copying debugid',
|
||||||
|
createAppSuccess: 'App created successfully (id: {{id}})',
|
||||||
|
deleteFile: 'Delete {{- file}}',
|
||||||
|
deletingFile: 'Delete {{- file}}',
|
||||||
|
enterAppIdQuestion: 'Enter AppId:',
|
||||||
|
enterNativePackageId: 'Enter native package ID:',
|
||||||
|
errorInHarmonyApp: 'Error in getEntryFromHarmonyApp: {{error}}',
|
||||||
|
expiredStatus: '(Expired)',
|
||||||
|
failedToParseIcon: '[Warning] failed to parse icon: {{error}}',
|
||||||
|
failedToParseUpdateJson:
|
||||||
|
'Failed to parse file `update.json`. Try to remove it manually.',
|
||||||
|
fileGenerated: '{{- file}} generated.',
|
||||||
|
fileSizeExceeded:
|
||||||
|
'This file size is {{fileSize}} , exceeding the current quota {{maxSize}} . You may consider upgrading to a higher plan to increase this quota. Details can be found at: {{- pricingPageUrl}}',
|
||||||
|
hermesDisabled: 'Hermes disabled',
|
||||||
|
hermesEnabledCompiling: 'Hermes enabled, now compiling to hermes bytecode:\n',
|
||||||
|
ipaUploadSuccess:
|
||||||
|
'Successfully uploaded IPA native package (id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
||||||
|
keyStrings: 'Key strings:',
|
||||||
|
latestVersionTag: '(latest: {{version}})',
|
||||||
lockBestPractice: `
|
lockBestPractice: `
|
||||||
Best practices for lock files:
|
Best practices for lock files:
|
||||||
1. All members of the development team should use the same package manager to maintain a single lock file.
|
1. All members of the development team should use the same package manager to maintain a single lock file.
|
||||||
@@ -14,29 +62,79 @@ Best practices for lock files:
|
|||||||
3. Pay attention to changes in the lock file during code review.
|
3. Pay attention to changes in the lock file during code review.
|
||||||
This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
This can reduce the risk of inconsistent dependencies and supply chain attacks.
|
||||||
`,
|
`,
|
||||||
|
lockNotFound:
|
||||||
|
'No lock file detected, which may cause inconsistent dependencies and hot-updating issues.',
|
||||||
|
loggedOut: 'Logged out',
|
||||||
loginExpired:
|
loginExpired:
|
||||||
'Login information has expired. Please use `cresc login` command to re-login',
|
'Login information has expired. Please use `cresc login` command to re-login',
|
||||||
fileSizeExceeded:
|
loginFirst:
|
||||||
'This file size is {{fileSize}} , exceeding the current quota {{maxSize}} . You may consider upgrading to a higher plan to increase this quota. Details can be found at: {{pricingPageUrl}}',
|
'Not logged in.\nPlease run `cresc login` in the project directory to login.',
|
||||||
bundleNotFound:
|
multipleLocksFound:
|
||||||
'Bundle file not found. Please ensure that this {{packageType}} is a release version and the bundle file name is the default `{{entryFile}}`',
|
'Multiple lock files detected ({{- lockFiles}}), which may cause inconsistent dependencies and hot-updating issues.',
|
||||||
buildTimeNotFound:
|
nativePackageId: 'Native Package ID',
|
||||||
'Cannot get the build timestamp of this package. Please update `react-native-update` to the latest version and re-package and upload.',
|
nativeVersion: 'Native Version',
|
||||||
latestVersionTag: '(latest: {{version}})',
|
nativeVersionNotFoundGte: 'No native version found >= {{version}}',
|
||||||
|
nativeVersionNotFoundLte: 'No native version found <= {{version}}',
|
||||||
|
nativeVersionNotFoundMatch: 'No matching native version found: {{version}}',
|
||||||
|
nativePackageIdNotFound: 'No native package id found: {{id}}',
|
||||||
|
noPackagesFound: 'No packages found. (appId: {{appId}})',
|
||||||
|
offset: 'Offset {{offset}}',
|
||||||
|
operationComplete: 'Operation complete, bound to {{count}} native versions',
|
||||||
|
operationSuccess: 'Operation successful',
|
||||||
|
packageIdRequired: 'Please provide packageId or packageVersion parameter',
|
||||||
|
packageUploadSuccess:
|
||||||
|
'Successfully uploaded new hot update package (id: {{id}})',
|
||||||
|
packing: 'Packing',
|
||||||
|
pausedStatus: '(Paused)',
|
||||||
|
platform: 'Platform',
|
||||||
|
platformPrompt: 'Platform (ios/android/harmony):',
|
||||||
|
platformQuestion: 'Platform(ios/android/harmony):',
|
||||||
|
platformRequired: 'Platform must be specified.',
|
||||||
|
pluginDetectionError: 'error while detecting {{name}} plugin: {{error}}',
|
||||||
|
pluginDetected: 'detected {{name}} plugin',
|
||||||
|
ppkPackageGenerated: 'ppk package generated and saved to: {{- output}}',
|
||||||
|
processingError: 'Error processing file: {{error}}',
|
||||||
|
processingPackage: 'Processing the package {{count}} ...',
|
||||||
|
processingStringPool: 'Processing the string pool ...',
|
||||||
|
publishUsage:
|
||||||
|
'Usage: pushy publish <ppk file> --platform ios|android|harmony',
|
||||||
rnuVersionNotFound:
|
rnuVersionNotFound:
|
||||||
'react-native-update: Cannot get the version number. Please run the command in the project directory',
|
'react-native-update: Cannot get the version number. Please run the command in the project directory',
|
||||||
|
rolloutConfigSet:
|
||||||
|
'Set {{rollout}}% rollout for OTA update {{version}} on native version(s) {{versions}}',
|
||||||
|
rolloutRangeError: 'rollout must be an integer between 1-100',
|
||||||
|
runningHermesc: 'Running hermesc: {{- command}} {{- args}}',
|
||||||
|
sentryCliNotFound:
|
||||||
|
'Cannot find Sentry CLI tool, please make sure @sentry/cli is properly installed',
|
||||||
|
sentryReleaseCreated: 'Sentry release created for version: {{version}}',
|
||||||
|
totalApps: 'Total {{count}} {{platform}} apps',
|
||||||
|
totalPackages: 'Total {{count}} packages',
|
||||||
|
typeStrings: 'Type strings:',
|
||||||
unsupportedPlatform: 'Unsupported platform `{{platform}}`',
|
unsupportedPlatform: 'Unsupported platform `{{platform}}`',
|
||||||
appId: 'App ID',
|
uploadBundlePrompt: 'Upload this bundle now?(Y/N)',
|
||||||
appName: 'App Name',
|
uploadingSourcemap: 'Uploading sourcemap',
|
||||||
platform: 'Platform',
|
usageDiff: 'Usage: cresc {{command}} <origin> <next>',
|
||||||
totalApps: 'Total {{count}} apps',
|
usageParseApk: 'Usage: cresc parseApk <apk file>',
|
||||||
appNotSelected:
|
usageParseApp: 'Usage: cresc parseApp <app file>',
|
||||||
'App not selected. run `cresc selectApp --platform {{platform}}` first!',
|
usageParseIpa: 'Usage: cresc parseIpa <ipa file>',
|
||||||
enterAppIdQuestion: 'Enter AppId:',
|
usageUnderDevelopment: 'Usage is under development now.',
|
||||||
appNameQuestion: 'App Name:',
|
usageUploadApk: 'Usage: cresc uploadApk <apk file>',
|
||||||
platformQuestion: 'Platform(ios/android/harmony):',
|
usageUploadApp: 'Usage: cresc uploadApp <app file>',
|
||||||
createAppSuccess: 'App created successfully (id: {{id}})',
|
usageUploadIpa: 'Usage: cresc uploadIpa <ipa file>',
|
||||||
cancelled: 'Cancelled',
|
versionBind:
|
||||||
operationSuccess: 'Operation successful',
|
'Bound hot update {{version}} to native version {{nativeVersion}} (id: {{id}})',
|
||||||
failedToParseUpdateJson: 'Failed to parse file `update.json`. Try to remove it manually.',
|
welcomeMessage: 'Welcome to Cresc hot update service, {{name}}.',
|
||||||
|
versionNameQuestion: 'Enter OTA update name:',
|
||||||
|
versionDescriptionQuestion: 'Enter OTA update description:',
|
||||||
|
versionMetaInfoQuestion: 'Enter custom meta info:',
|
||||||
|
updateNativePackageQuestion: 'Bind to native package now?(Y/N)',
|
||||||
|
unnamed: '(Unnamed)',
|
||||||
|
dryRun: 'Below is the dry-run result, no actual operation will be performed:',
|
||||||
|
usingCustomVersion: 'Using custom version: {{version}}',
|
||||||
|
confirmDeletePackage:
|
||||||
|
'Confirm delete native package {{packageId}}? This operation cannot be undone (Y/N):',
|
||||||
|
deletePackageSuccess: 'Native package {{packageId}} deleted successfully',
|
||||||
|
deletePackageError:
|
||||||
|
'Failed to delete native package {{packageId}}: {{error}}',
|
||||||
|
usageDeletePackage: 'Usage: cresc deletePackage [packageId] --appId [appId]',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,58 @@
|
|||||||
export default {
|
export default {
|
||||||
updateNotifier:
|
addedToGitignore: '已将 {{line}} 添加到 .gitignore',
|
||||||
'建议运行 `{updateCommand}` 来更新命令行工具以获得功能、性能和安全性的持续改进',
|
androidCrunchPngsWarning:
|
||||||
loginFirst: '尚未登录。\n请在项目目录中运行`pushy login`命令来登录',
|
'android 的 crunchPngs 选项似乎尚未禁用(如已禁用则请忽略此提示),这可能导致热更包体积异常增大,具体请参考 https://pushy.reactnative.cn/docs/getting-started.html#%E7%A6%81%E7%94%A8-android-%E7%9A%84-crunch-%E4%BC%98%E5%8C%96 \n',
|
||||||
lockNotFound:
|
appId: '应用 id',
|
||||||
'没有检测到任何 lock 文件,这可能导致依赖关系不一致而使热更异常。',
|
appIdMismatchApk:
|
||||||
|
'appId不匹配!当前apk: {{appIdInPkg}}, 当前update.json: {{appId}}',
|
||||||
|
appIdMismatchApp:
|
||||||
|
'appId不匹配!当前app: {{appIdInPkg}}, 当前update.json: {{appId}}',
|
||||||
|
appIdMismatchIpa:
|
||||||
|
'appId不匹配!当前ipa: {{appIdInPkg}}, 当前update.json: {{appId}}',
|
||||||
|
appKeyMismatchApk:
|
||||||
|
'appKey不匹配!当前apk: {{appKeyInPkg}}, 当前update.json: {{appKey}}',
|
||||||
|
appKeyMismatchApp:
|
||||||
|
'appKey不匹配!当前app: {{appKeyInPkg}}, 当前update.json: {{appKey}}',
|
||||||
|
appKeyMismatchIpa:
|
||||||
|
'appKey不匹配!当前ipa: {{appKeyInPkg}}, 当前update.json: {{appKey}}',
|
||||||
|
appName: '应用名称',
|
||||||
|
appNameQuestion: '应用名称:',
|
||||||
|
appNotSelected:
|
||||||
|
'尚未选择应用。请先运行 `pushy selectApp --platform {{platform}}` 来选择应用',
|
||||||
|
appUploadSuccess:
|
||||||
|
'已成功上传app原生包(id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
||||||
|
apkUploadSuccess:
|
||||||
|
'已成功上传apk原生包(id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
||||||
|
boundTo: ', 已绑定:{{name}} ({{id}})',
|
||||||
|
buildTimeNotFound:
|
||||||
|
'无法获取此包的编译时间戳。请更新 `react-native-update` 到最新版本后重新打包上传。',
|
||||||
|
bundleCommandError: '"react-native bundle" 命令退出,代码为 {{code}}。',
|
||||||
|
bundleNotFound:
|
||||||
|
'找不到 bundle 文件。请确保此 {{packageType}} 为 release 版本,且 bundle 文件名为默认的 `{{entryFile}}`',
|
||||||
|
bundlingWithRN: '正在使用 react-native {{version}} 打包',
|
||||||
|
cancelled: '已取消',
|
||||||
|
composingSourceMap: '正在生成 source map',
|
||||||
|
copyFileFailed: '复制文件失败:{{error}}',
|
||||||
|
copyHarmonyBundleError: '复制 Harmony bundle 错误:{{error}}',
|
||||||
|
copyingDebugId: '正在复制 debugid',
|
||||||
|
createAppSuccess: '已成功创建应用(id: {{id}})',
|
||||||
|
deleteFile: '删除 {{- file}}',
|
||||||
|
deletingFile: '删除 {{- file}}',
|
||||||
|
enterAppIdQuestion: '输入应用 id:',
|
||||||
|
enterNativePackageId: '输入原生包 id:',
|
||||||
|
errorInHarmonyApp: '获取 Harmony 应用入口时出错:{{error}}',
|
||||||
|
expiredStatus: '(已过期)',
|
||||||
|
failedToParseIcon: '[警告] 解析图标失败:{{error}}',
|
||||||
|
failedToParseUpdateJson: '无法解析文件 `update.json`。请手动删除它。',
|
||||||
|
fileGenerated: '已生成 {{- file}}',
|
||||||
|
fileSizeExceeded:
|
||||||
|
'此文件大小 {{fileSize}} , 超出当前额度 {{maxSize}} 。您可以考虑升级付费业务以提升此额度。详情请访问: {{- pricingPageUrl}}',
|
||||||
|
hermesDisabled: 'Hermes 已禁用',
|
||||||
|
hermesEnabledCompiling: 'Hermes 已启用,正在编译为 hermes 字节码:\n',
|
||||||
|
ipaUploadSuccess:
|
||||||
|
'已成功上传ipa原生包(id: {{id}}, version: {{version}}, buildTime: {{buildTime}})',
|
||||||
|
keyStrings: '键字符串:',
|
||||||
|
latestVersionTag: '(最新:{{version}})',
|
||||||
lockBestPractice: `
|
lockBestPractice: `
|
||||||
关于 lock 文件的最佳实践:
|
关于 lock 文件的最佳实践:
|
||||||
1. 开发团队中的所有成员应该使用相同的包管理器,维护同一份 lock 文件。
|
1. 开发团队中的所有成员应该使用相同的包管理器,维护同一份 lock 文件。
|
||||||
@@ -11,30 +60,73 @@ export default {
|
|||||||
3. 代码审核时应关注 lock 文件的变化。
|
3. 代码审核时应关注 lock 文件的变化。
|
||||||
这样可以最大限度避免因依赖关系不一致而导致的热更异常,也降低供应链攻击等安全隐患。
|
这样可以最大限度避免因依赖关系不一致而导致的热更异常,也降低供应链攻击等安全隐患。
|
||||||
`,
|
`,
|
||||||
multipleLocksFound:
|
lockNotFound:
|
||||||
'检测到多种不同格式的锁文件({lockFiles}),这可能导致依赖关系不一致而使热更异常。',
|
'没有检测到任何 lock 文件,这可能导致依赖关系不一致而使热更异常。',
|
||||||
|
loggedOut: '已退出登录',
|
||||||
loginExpired: '登录信息已过期,请使用 `pushy login` 命令重新登录',
|
loginExpired: '登录信息已过期,请使用 `pushy login` 命令重新登录',
|
||||||
fileSizeExceeded:
|
loginFirst: '尚未登录。\n请在项目目录中运行`pushy login`命令来登录',
|
||||||
'此文件大小 {{fileSize}} , 超出当前额度 {{maxSize}} 。您可以考虑升级付费业务以提升此额度。详情请访问: {{pricingPageUrl}}',
|
multipleLocksFound:
|
||||||
bundleNotFound:
|
'检测到多种不同格式的锁文件({{- lockFiles}}),这可能导致依赖关系不一致而使热更异常。',
|
||||||
'找不到 bundle 文件。请确保此 {{packageType}} 为 release 版本,且 bundle 文件名为默认的 `{{entryFile}}`',
|
nativePackageId: '原生包 Id',
|
||||||
buildTimeNotFound:
|
nativeVersion: '原生版本',
|
||||||
'无法获取此包的编译时间戳。请更新 `react-native-update` 到最新版本后重新打包上传。',
|
nativeVersionNotFoundGte: '未查询到 >= {{version}} 的原生版本',
|
||||||
latestVersionTag: '(最新:{{version}})',
|
nativeVersionNotFoundLte: '未查询到 <= {{version}} 的原生版本',
|
||||||
|
nativeVersionNotFoundMatch: '未查询到匹配原生版本:{{version}}',
|
||||||
|
nativePackageIdNotFound: '未查询到原生包 id: {{id}}',
|
||||||
|
noPackagesFound: '未查询到任何原生包(appId: {{appId}})',
|
||||||
|
offset: '偏移量 {{offset}}',
|
||||||
|
operationComplete: '操作完成,共已绑定 {{count}} 个原生版本',
|
||||||
|
operationSuccess: '操作成功',
|
||||||
|
packageIdRequired: '请提供 packageId 或 packageVersion 参数',
|
||||||
|
packageUploadSuccess: '已成功上传新热更包(id: {{id}})',
|
||||||
|
packing: '正在打包',
|
||||||
|
pausedStatus: '(已暂停)',
|
||||||
|
platform: '平台',
|
||||||
|
platformPrompt: '平台(ios/android/harmony):',
|
||||||
|
platformQuestion: '平台(ios/android/harmony):',
|
||||||
|
platformRequired: '必须指定平台。',
|
||||||
|
pluginDetectionError: '检测 {{name}} 插件时出错:{{error}}',
|
||||||
|
pluginDetected: '检测到 {{name}} 插件',
|
||||||
|
ppkPackageGenerated: 'ppk 热更包已生成并保存到: {{- output}}',
|
||||||
|
processingError: '处理文件时出错:{{error}}',
|
||||||
|
processingPackage: '正在处理包 {{count}}...',
|
||||||
|
processingStringPool: '正在处理字符串池...',
|
||||||
|
publishUsage:
|
||||||
|
'使用方法: pushy publish ppk后缀文件 --platform ios|android|harmony',
|
||||||
rnuVersionNotFound:
|
rnuVersionNotFound:
|
||||||
'react-native-update: 无法获取版本号。请在项目目录中运行命令',
|
'react-native-update: 无法获取版本号。请在项目目录中运行命令',
|
||||||
|
rolloutConfigSet:
|
||||||
|
'已在原生版本 {{versions}} 上设置灰度发布 {{rollout}}% 热更包 {{version}}',
|
||||||
|
rolloutRangeError: 'rollout 必须是 1-100 的整数',
|
||||||
|
runningHermesc: '运行 hermesc:{{- command}} {{- args}}',
|
||||||
|
sentryCliNotFound: '无法找到 Sentry CLI 工具,请确保已正确安装 @sentry/cli',
|
||||||
|
sentryReleaseCreated: '已为版本 {{version}} 创建 Sentry release',
|
||||||
|
totalApps: '共 {{count}} 个 {{platform}} 应用',
|
||||||
|
totalPackages: '共 {{count}} 个包',
|
||||||
|
typeStrings: '类型字符串:',
|
||||||
unsupportedPlatform: '无法识别的平台 `{{platform}}`',
|
unsupportedPlatform: '无法识别的平台 `{{platform}}`',
|
||||||
appId: '应用 id',
|
uploadBundlePrompt: '是否现在上传此热更包?(Y/N)',
|
||||||
appName: '应用名称',
|
uploadingSourcemap: '正在上传 sourcemap',
|
||||||
platform: '平台',
|
usageDiff: '用法:pushy {{command}} <origin> <next>',
|
||||||
totalApps: '共 {{count}} 个{{platform}}应用',
|
usageParseApk: '使用方法: pushy parseApk apk后缀文件',
|
||||||
appNotSelected:
|
usageParseApp: '使用方法: pushy parseApp app后缀文件',
|
||||||
'尚未选择应用。请先运行 `pushy selectApp --platform {{platform}}` 来选择应用',
|
usageParseIpa: '使用方法: pushy parseIpa ipa后缀文件',
|
||||||
enterAppIdQuestion: '输入应用 id:',
|
usageUploadApk: '使用方法: pushy uploadApk apk后缀文件',
|
||||||
appNameQuestion: '应用名称:',
|
usageUploadApp: '使用方法: pushy uploadApp app后缀文件',
|
||||||
platformQuestion: '平台(ios/android/harmony):',
|
usageUploadIpa: '使用方法: pushy uploadIpa ipa后缀文件',
|
||||||
createAppSuccess: '已成功创建应用(id: {{id}})',
|
versionBind:
|
||||||
cancelled: '已取消',
|
'已将热更包 {{version}} 绑定到原生版本 {{nativeVersion}} (id: {{id}})',
|
||||||
operationSuccess: '操作成功',
|
welcomeMessage: '欢迎使用 pushy 热更新服务,{{name}}。',
|
||||||
failedToParseUpdateJson: '无法解析文件 `update.json`。请手动删除它。',
|
versionNameQuestion: '输入版本名称:',
|
||||||
|
versionDescriptionQuestion: '输入版本描述:',
|
||||||
|
versionMetaInfoQuestion: '输入自定义的 meta info:',
|
||||||
|
updateNativePackageQuestion: '是否现在将此热更应用到原生包上?(Y/N)',
|
||||||
|
unnamed: '(未命名)',
|
||||||
|
dryRun: '以下是 dry-run 模拟运行结果,不会实际执行任何操作:',
|
||||||
|
usingCustomVersion: '使用自定义版本:{{version}}',
|
||||||
|
confirmDeletePackage: '确认删除原生包 {{packageId}}? 此操作不可撤销 (Y/N):',
|
||||||
|
deletePackageSuccess: '原生包 {{packageId}} 删除成功',
|
||||||
|
deletePackageError: '删除原生包 {{packageId}} 失败: {{error}}',
|
||||||
|
usageDeletePackage:
|
||||||
|
'使用方法: pushy deletePackage [packageId] --appId [appId]',
|
||||||
};
|
};
|
||||||
|
|||||||
149
src/module-manager.ts
Normal file
149
src/module-manager.ts
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
import { CLIProviderImpl } from './provider';
|
||||||
|
import type {
|
||||||
|
CLIModule,
|
||||||
|
CLIProvider,
|
||||||
|
CommandDefinition,
|
||||||
|
CustomWorkflow,
|
||||||
|
} from './types';
|
||||||
|
|
||||||
|
export class ModuleManager {
|
||||||
|
private modules: Map<string, CLIModule> = new Map();
|
||||||
|
private provider: CLIProvider;
|
||||||
|
private commands: Map<string, CommandDefinition> = new Map();
|
||||||
|
private workflows: Map<string, CustomWorkflow> = new Map();
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.provider = new CLIProviderImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
registerModule(module: CLIModule): void {
|
||||||
|
if (this.modules.has(module.name)) {
|
||||||
|
throw new Error(`Module '${module.name}' is already registered`);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.modules.set(module.name, module);
|
||||||
|
|
||||||
|
if (module.commands) {
|
||||||
|
for (const command of module.commands) {
|
||||||
|
this.registerCommand(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (module.workflows) {
|
||||||
|
for (const workflow of module.workflows) {
|
||||||
|
this.registerWorkflow(workflow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (module.init) {
|
||||||
|
module.init(this.provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log(
|
||||||
|
// `Module '${module.name}' (v${module.version}) registered successfully`,
|
||||||
|
// );
|
||||||
|
}
|
||||||
|
|
||||||
|
unregisterModule(moduleName: string): void {
|
||||||
|
const module = this.modules.get(moduleName);
|
||||||
|
if (!module) {
|
||||||
|
throw new Error(`Module '${moduleName}' is not registered`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (module.commands) {
|
||||||
|
for (const command of module.commands) {
|
||||||
|
this.commands.delete(command.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (module.workflows) {
|
||||||
|
for (const workflow of module.workflows) {
|
||||||
|
this.workflows.delete(workflow.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (module.cleanup) {
|
||||||
|
module.cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.modules.delete(moduleName);
|
||||||
|
console.log(`Module '${moduleName}' unregistered successfully`);
|
||||||
|
}
|
||||||
|
|
||||||
|
registerCommand(command: CommandDefinition): void {
|
||||||
|
if (this.commands.has(command.name)) {
|
||||||
|
throw new Error(`Command '${command.name}' is already registered`);
|
||||||
|
}
|
||||||
|
this.commands.set(command.name, command);
|
||||||
|
}
|
||||||
|
|
||||||
|
registerWorkflow(workflow: CustomWorkflow): void {
|
||||||
|
if (this.workflows.has(workflow.name)) {
|
||||||
|
throw new Error(`Workflow '${workflow.name}' is already registered`);
|
||||||
|
}
|
||||||
|
this.workflows.set(workflow.name, workflow);
|
||||||
|
this.provider.registerWorkflow(workflow);
|
||||||
|
}
|
||||||
|
|
||||||
|
getRegisteredCommands(): CommandDefinition[] {
|
||||||
|
return Array.from(this.commands.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
getRegisteredWorkflows(): CustomWorkflow[] {
|
||||||
|
return Array.from(this.workflows.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
getRegisteredModules(): CLIModule[] {
|
||||||
|
return Array.from(this.modules.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
async executeCommand(commandName: string, context: any): Promise<any> {
|
||||||
|
const command = this.commands.get(commandName);
|
||||||
|
if (!command) {
|
||||||
|
throw new Error(`Command '${commandName}' not found`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return await command.handler(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
async executeWorkflow(workflowName: string, context: any): Promise<any> {
|
||||||
|
return await this.provider.executeWorkflow(workflowName, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
getProvider(): CLIProvider {
|
||||||
|
return this.provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
listCommands(): any[] {
|
||||||
|
return Array.from(this.commands.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
listWorkflows(): CustomWorkflow[] {
|
||||||
|
return Array.from(this.workflows.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
listAll(): void {
|
||||||
|
console.log('\n=== Registered Commands ===');
|
||||||
|
for (const command of this.commands.values()) {
|
||||||
|
console.log(
|
||||||
|
` ${command.name}: ${command.description || 'No description'}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\n=== Registered Workflows ===');
|
||||||
|
for (const workflow of this.workflows.values()) {
|
||||||
|
console.log(
|
||||||
|
` ${workflow.name}: ${workflow.description || 'No description'}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('\n=== Registered Modules ===');
|
||||||
|
for (const module of this.modules.values()) {
|
||||||
|
console.log(
|
||||||
|
` ${module.name} (v${module.version}): ${module.commands?.length || 0} commands, ${module.workflows?.length || 0} workflows`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const moduleManager = new ModuleManager();
|
||||||
205
src/modules/app-module.ts
Normal file
205
src/modules/app-module.ts
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
import { appCommands } from '../app';
|
||||||
|
import type { CLIModule, CommandContext } from '../types';
|
||||||
|
|
||||||
|
export const appModule: CLIModule = {
|
||||||
|
name: 'app',
|
||||||
|
version: '1.0.0',
|
||||||
|
|
||||||
|
commands: [],
|
||||||
|
|
||||||
|
workflows: [
|
||||||
|
{
|
||||||
|
name: 'setup-app',
|
||||||
|
description: 'Setup a new app with initial configuration',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'create',
|
||||||
|
description: 'Create the app',
|
||||||
|
execute: async (context: CommandContext) => {
|
||||||
|
console.log('Creating app in workflow');
|
||||||
|
const { name, downloadUrl, platform } = context.options;
|
||||||
|
await appCommands.createApp({
|
||||||
|
options: {
|
||||||
|
name: name || '',
|
||||||
|
downloadUrl: downloadUrl || '',
|
||||||
|
platform: platform || '',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return { appCreated: true };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'select',
|
||||||
|
description: 'Select the created app',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('Selecting app in workflow');
|
||||||
|
const { platform } = context.options;
|
||||||
|
await appCommands.selectApp({
|
||||||
|
args: [],
|
||||||
|
options: { platform: platform || '' },
|
||||||
|
});
|
||||||
|
return { ...previousResult, appSelected: true };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'manage-apps',
|
||||||
|
description: 'Manage multiple apps',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'list-apps',
|
||||||
|
description: 'List all apps',
|
||||||
|
execute: async (context: CommandContext) => {
|
||||||
|
console.log('Listing all apps');
|
||||||
|
const { platform } = context.options;
|
||||||
|
await appCommands.apps({
|
||||||
|
options: { platform: platform || '' },
|
||||||
|
});
|
||||||
|
return { appsListed: true };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'select-target-app',
|
||||||
|
description: 'Select target app for operations',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('Selecting target app');
|
||||||
|
const { platform } = context.options;
|
||||||
|
await appCommands.selectApp({
|
||||||
|
args: [],
|
||||||
|
options: { platform: platform || '' },
|
||||||
|
});
|
||||||
|
return { ...previousResult, targetAppSelected: true };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'multi-platform-app-management',
|
||||||
|
description: 'Multi-platform app unified management workflow',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'scan-platforms',
|
||||||
|
description: 'Scan apps on all platforms',
|
||||||
|
execute: async (context: CommandContext) => {
|
||||||
|
console.log('🔍 Scanning apps on all platforms...');
|
||||||
|
|
||||||
|
const platforms = ['ios', 'android', 'harmony'];
|
||||||
|
const appsData = {};
|
||||||
|
|
||||||
|
for (const platform of platforms) {
|
||||||
|
console.log(` Scanning ${platform} platform...`);
|
||||||
|
|
||||||
|
// Simulate getting app list
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||||
|
|
||||||
|
const appCount = Math.floor(Math.random() * 5) + 1;
|
||||||
|
const apps = Array.from({ length: appCount }, (_, i) => ({
|
||||||
|
id: `${platform}_app_${i + 1}`,
|
||||||
|
name: `App ${i + 1}`,
|
||||||
|
platform,
|
||||||
|
version: `1.${i}.0`,
|
||||||
|
status: Math.random() > 0.2 ? 'active' : 'inactive',
|
||||||
|
}));
|
||||||
|
|
||||||
|
appsData[platform] = apps;
|
||||||
|
console.log(` ✅ Found ${appCount} apps`);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('✅ Platform scanning completed');
|
||||||
|
|
||||||
|
return { platforms, appsData, scanned: true };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'analyze-apps',
|
||||||
|
description: 'Analyze app status',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('📊 Analyzing app status...');
|
||||||
|
|
||||||
|
const { appsData } = previousResult;
|
||||||
|
const analysis = {
|
||||||
|
totalApps: 0,
|
||||||
|
activeApps: 0,
|
||||||
|
inactiveApps: 0,
|
||||||
|
platformDistribution: {},
|
||||||
|
issues: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const [platform, apps] of Object.entries(appsData)) {
|
||||||
|
const platformApps = apps as any[];
|
||||||
|
analysis.totalApps += platformApps.length;
|
||||||
|
analysis.platformDistribution[platform] = platformApps.length;
|
||||||
|
|
||||||
|
for (const app of platformApps) {
|
||||||
|
if (app.status === 'active') {
|
||||||
|
analysis.activeApps++;
|
||||||
|
} else {
|
||||||
|
analysis.inactiveApps++;
|
||||||
|
analysis.issues.push(
|
||||||
|
`${platform}/${app.name}: App is inactive`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('📈 Analysis results:');
|
||||||
|
console.log(` Total apps: ${analysis.totalApps}`);
|
||||||
|
console.log(` Active apps: ${analysis.activeApps}`);
|
||||||
|
console.log(` Inactive apps: ${analysis.inactiveApps}`);
|
||||||
|
|
||||||
|
if (analysis.issues.length > 0) {
|
||||||
|
console.log('⚠️ Issues found:');
|
||||||
|
analysis.issues.forEach((issue) => console.log(` - ${issue}`));
|
||||||
|
}
|
||||||
|
|
||||||
|
return { ...previousResult, analysis };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'optimize-apps',
|
||||||
|
description: 'Optimize app configuration',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('⚡ Optimizing app configuration...');
|
||||||
|
|
||||||
|
const { analysis } = previousResult;
|
||||||
|
const optimizations = [];
|
||||||
|
|
||||||
|
if (analysis.inactiveApps > 0) {
|
||||||
|
console.log(' Handling inactive apps...');
|
||||||
|
optimizations.push('Reactivate inactive apps');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (analysis.totalApps > 10) {
|
||||||
|
console.log(' Many apps detected, suggest grouping...');
|
||||||
|
optimizations.push('Create app groups');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simulate optimization process
|
||||||
|
for (const optimization of optimizations) {
|
||||||
|
console.log(` Executing: ${optimization}...`);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 800));
|
||||||
|
console.log(` ✅ ${optimization} completed`);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('✅ App optimization completed');
|
||||||
|
|
||||||
|
return { ...previousResult, optimizations, optimized: true };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
options: {
|
||||||
|
includeInactive: {
|
||||||
|
hasValue: false,
|
||||||
|
default: true,
|
||||||
|
description: 'Include inactive apps',
|
||||||
|
},
|
||||||
|
autoOptimize: {
|
||||||
|
hasValue: false,
|
||||||
|
default: true,
|
||||||
|
description: 'Auto optimize configuration',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
202
src/modules/bundle-module.ts
Normal file
202
src/modules/bundle-module.ts
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
import { bundleCommands } from '../bundle';
|
||||||
|
import type { CLIModule, CommandContext } from '../types';
|
||||||
|
|
||||||
|
export const bundleModule: CLIModule = {
|
||||||
|
name: 'bundle',
|
||||||
|
version: '1.0.0',
|
||||||
|
|
||||||
|
commands: [],
|
||||||
|
|
||||||
|
workflows: [
|
||||||
|
{
|
||||||
|
name: 'incremental-build',
|
||||||
|
description: 'Incremental build workflow - generate diff packages',
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'detect-base-version',
|
||||||
|
description: 'Detect base version',
|
||||||
|
execute: async (context: CommandContext) => {
|
||||||
|
console.log('🔍 Detecting base version...');
|
||||||
|
|
||||||
|
const { baseVersion, platform } = context.options;
|
||||||
|
|
||||||
|
if (baseVersion) {
|
||||||
|
console.log(`✅ Using specified base version: ${baseVersion}`);
|
||||||
|
return { baseVersion, specified: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Auto detecting latest version...');
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 800));
|
||||||
|
|
||||||
|
const autoDetectedVersion = `v${Math.floor(Math.random() * 3) + 1}.${Math.floor(Math.random() * 10)}.${Math.floor(Math.random() * 10)}`;
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`✅ Auto detected base version: ${autoDetectedVersion}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
return { baseVersion: autoDetectedVersion, specified: false };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'build-current-version',
|
||||||
|
description: 'Build current version',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('🏗️ Building current version...');
|
||||||
|
|
||||||
|
const {
|
||||||
|
platform,
|
||||||
|
dev = false,
|
||||||
|
sourcemap = false,
|
||||||
|
bundleName = 'index.bundlejs',
|
||||||
|
entryFile = 'index.js',
|
||||||
|
intermediaDir,
|
||||||
|
taro = false,
|
||||||
|
expo = false,
|
||||||
|
rncli = false,
|
||||||
|
disableHermes = false,
|
||||||
|
output,
|
||||||
|
} = context.options;
|
||||||
|
|
||||||
|
console.log(`Building ${platform} platform...`);
|
||||||
|
console.log(` Entry file: ${entryFile}`);
|
||||||
|
console.log(` Bundle name: ${bundleName}`);
|
||||||
|
console.log(` Development mode: ${dev}`);
|
||||||
|
console.log(` Source maps: ${sourcemap}`);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const buildOptions: any = {
|
||||||
|
platform,
|
||||||
|
dev,
|
||||||
|
sourcemap,
|
||||||
|
bundleName,
|
||||||
|
entryFile,
|
||||||
|
taro,
|
||||||
|
expo,
|
||||||
|
rncli,
|
||||||
|
disableHermes,
|
||||||
|
intermediaDir: '${tempDir}/intermedia/${platform}',
|
||||||
|
output: '${tempDir}/output/${platform}.${time}.ppk',
|
||||||
|
};
|
||||||
|
if (intermediaDir) {
|
||||||
|
buildOptions.intermediaDir = intermediaDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
await bundleCommands.bundle({
|
||||||
|
args: [],
|
||||||
|
options: buildOptions,
|
||||||
|
});
|
||||||
|
|
||||||
|
const currentBuild = {
|
||||||
|
version: `v${Math.floor(Math.random() * 3) + 2}.0.0`,
|
||||||
|
platform,
|
||||||
|
bundlePath: `./build/current_${platform}.ppk`,
|
||||||
|
size: Math.floor(Math.random() * 15) + 10,
|
||||||
|
buildTime: Date.now(),
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`✅ Current version build completed: ${currentBuild.version}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
return { ...previousResult, currentBuild };
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ Current version build failed:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
validate: (context: CommandContext) => {
|
||||||
|
if (!context.options.platform) {
|
||||||
|
console.error('❌ Incremental build requires platform specification');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
platform: {
|
||||||
|
hasValue: true,
|
||||||
|
description: 'Target platform (required)',
|
||||||
|
},
|
||||||
|
baseVersion: {
|
||||||
|
hasValue: true,
|
||||||
|
description: 'Base version (auto detect if not specified)',
|
||||||
|
},
|
||||||
|
skipValidation: {
|
||||||
|
hasValue: false,
|
||||||
|
default: false,
|
||||||
|
description: 'Skip diff package validation',
|
||||||
|
},
|
||||||
|
dev: {
|
||||||
|
hasValue: false,
|
||||||
|
default: false,
|
||||||
|
description: 'Development mode build',
|
||||||
|
},
|
||||||
|
bundleName: {
|
||||||
|
hasValue: true,
|
||||||
|
default: 'index.bundlejs',
|
||||||
|
description: 'Bundle file name',
|
||||||
|
},
|
||||||
|
entryFile: {
|
||||||
|
hasValue: true,
|
||||||
|
default: 'index.js',
|
||||||
|
description: 'Entry file',
|
||||||
|
},
|
||||||
|
sourcemap: {
|
||||||
|
hasValue: false,
|
||||||
|
default: false,
|
||||||
|
description: 'Generate source maps',
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
hasValue: true,
|
||||||
|
description: 'Custom output path for diff package',
|
||||||
|
},
|
||||||
|
intermediaDir: {
|
||||||
|
hasValue: true,
|
||||||
|
description: 'Intermediate directory',
|
||||||
|
},
|
||||||
|
taro: {
|
||||||
|
hasValue: false,
|
||||||
|
default: false,
|
||||||
|
description: 'Use Taro CLI',
|
||||||
|
},
|
||||||
|
expo: {
|
||||||
|
hasValue: false,
|
||||||
|
default: false,
|
||||||
|
description: 'Use Expo CLI',
|
||||||
|
},
|
||||||
|
rncli: {
|
||||||
|
hasValue: false,
|
||||||
|
default: false,
|
||||||
|
description: 'Use React Native CLI',
|
||||||
|
},
|
||||||
|
disableHermes: {
|
||||||
|
hasValue: false,
|
||||||
|
default: false,
|
||||||
|
description: 'Disable Hermes',
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
hasValue: true,
|
||||||
|
description: 'Version name for publishing',
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
hasValue: true,
|
||||||
|
description: 'Version description for publishing',
|
||||||
|
},
|
||||||
|
metaInfo: {
|
||||||
|
hasValue: true,
|
||||||
|
description: 'Meta information for publishing',
|
||||||
|
},
|
||||||
|
rollout: {
|
||||||
|
hasValue: true,
|
||||||
|
description: 'Rollout percentage',
|
||||||
|
},
|
||||||
|
dryRun: {
|
||||||
|
hasValue: false,
|
||||||
|
default: false,
|
||||||
|
description: 'Dry run mode',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
19
src/modules/index.ts
Normal file
19
src/modules/index.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { appModule } from './app-module';
|
||||||
|
import { bundleModule } from './bundle-module';
|
||||||
|
import { packageModule } from './package-module';
|
||||||
|
import { userModule } from './user-module';
|
||||||
|
import { versionModule } from './version-module';
|
||||||
|
|
||||||
|
export { bundleModule } from './bundle-module';
|
||||||
|
export { versionModule } from './version-module';
|
||||||
|
export { appModule } from './app-module';
|
||||||
|
export { userModule } from './user-module';
|
||||||
|
export { packageModule } from './package-module';
|
||||||
|
|
||||||
|
export const builtinModules = [
|
||||||
|
bundleModule,
|
||||||
|
versionModule,
|
||||||
|
appModule,
|
||||||
|
userModule,
|
||||||
|
packageModule,
|
||||||
|
];
|
||||||
11
src/modules/package-module.ts
Normal file
11
src/modules/package-module.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { packageCommands } from '../package';
|
||||||
|
import type { CLIModule } from '../types';
|
||||||
|
|
||||||
|
export const packageModule: CLIModule = {
|
||||||
|
name: 'package',
|
||||||
|
version: '1.0.0',
|
||||||
|
|
||||||
|
commands: [],
|
||||||
|
|
||||||
|
workflows: [],
|
||||||
|
};
|
||||||
406
src/modules/user-module.ts
Normal file
406
src/modules/user-module.ts
Normal file
@@ -0,0 +1,406 @@
|
|||||||
|
import { getSession, loadSession } from '../api';
|
||||||
|
import type { CLIModule, CommandContext } from '../types';
|
||||||
|
import { userCommands } from '../user';
|
||||||
|
|
||||||
|
export const userModule: CLIModule = {
|
||||||
|
name: 'user',
|
||||||
|
version: '1.0.0',
|
||||||
|
|
||||||
|
commands: [],
|
||||||
|
|
||||||
|
workflows: [
|
||||||
|
{
|
||||||
|
name: 'auth-check',
|
||||||
|
description: 'Check authentication status and user information',
|
||||||
|
options: {
|
||||||
|
autoLogin: {
|
||||||
|
default: false,
|
||||||
|
description: 'Automatically login if not authenticated',
|
||||||
|
},
|
||||||
|
showDetails: {
|
||||||
|
default: true,
|
||||||
|
description: 'Show detailed user information',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'load-session',
|
||||||
|
description: 'Load existing session from local storage',
|
||||||
|
execute: async (context: CommandContext) => {
|
||||||
|
console.log('Loading session from local storage...');
|
||||||
|
|
||||||
|
try {
|
||||||
|
await loadSession();
|
||||||
|
const session = getSession();
|
||||||
|
|
||||||
|
if (session && session.token) {
|
||||||
|
console.log('✓ Session found in local storage');
|
||||||
|
return {
|
||||||
|
sessionLoaded: true,
|
||||||
|
hasToken: true,
|
||||||
|
session,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
console.log('✗ No valid session found in local storage');
|
||||||
|
return {
|
||||||
|
sessionLoaded: true,
|
||||||
|
hasToken: false,
|
||||||
|
session: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
'✗ Failed to load session:',
|
||||||
|
error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
sessionLoaded: false,
|
||||||
|
hasToken: false,
|
||||||
|
session: null,
|
||||||
|
error: error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'validate-session',
|
||||||
|
description: 'Validate session by calling API',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
if (!previousResult.hasToken) {
|
||||||
|
console.log('No token available, skipping validation');
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
validated: false,
|
||||||
|
reason: 'No token available',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Validating session with server...');
|
||||||
|
|
||||||
|
try {
|
||||||
|
await userCommands.me();
|
||||||
|
console.log('✓ Session is valid');
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
validated: true,
|
||||||
|
reason: 'Session validated successfully',
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
'✗ Session validation failed:',
|
||||||
|
error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
validated: false,
|
||||||
|
reason:
|
||||||
|
error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'get-user-info',
|
||||||
|
description: 'Get current user information',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
if (!previousResult.validated) {
|
||||||
|
console.log('Session not valid, cannot get user info');
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
userInfo: null,
|
||||||
|
reason: 'Session not valid',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Getting user information...');
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { get } = await import('../api');
|
||||||
|
const userInfo = await get('/user/me');
|
||||||
|
|
||||||
|
console.log('✓ User information retrieved successfully');
|
||||||
|
|
||||||
|
if (context.options.showDetails !== false) {
|
||||||
|
console.log('\n=== User Information ===');
|
||||||
|
for (const [key, value] of Object.entries(userInfo)) {
|
||||||
|
if (key !== 'ok') {
|
||||||
|
console.log(`${key}: ${value}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('========================\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
userInfo,
|
||||||
|
reason: 'User info retrieved successfully',
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
'✗ Failed to get user info:',
|
||||||
|
error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
userInfo: null,
|
||||||
|
reason:
|
||||||
|
error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'handle-auth-failure',
|
||||||
|
description: 'Handle authentication failure',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
if (previousResult.validated) {
|
||||||
|
console.log('✓ Authentication check completed successfully');
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
authCheckComplete: true,
|
||||||
|
status: 'authenticated',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('✗ Authentication check failed');
|
||||||
|
|
||||||
|
if (context.options.autoLogin) {
|
||||||
|
console.log('Attempting automatic login...');
|
||||||
|
try {
|
||||||
|
await userCommands.login({ args: [] });
|
||||||
|
console.log('✓ Automatic login successful');
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
authCheckComplete: true,
|
||||||
|
status: 'auto-logged-in',
|
||||||
|
autoLoginSuccess: true,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
'✗ Automatic login failed:',
|
||||||
|
error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
authCheckComplete: true,
|
||||||
|
status: 'failed',
|
||||||
|
autoLoginSuccess: false,
|
||||||
|
autoLoginError:
|
||||||
|
error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('Please run login command to authenticate');
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
authCheckComplete: true,
|
||||||
|
status: 'unauthenticated',
|
||||||
|
suggestion: 'Run login command to authenticate',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'login-flow',
|
||||||
|
description: 'Complete login flow with validation',
|
||||||
|
options: {
|
||||||
|
email: { hasValue: true, description: 'User email' },
|
||||||
|
password: { hasValue: true, description: 'User password' },
|
||||||
|
validateAfterLogin: {
|
||||||
|
default: true,
|
||||||
|
description: 'Validate session after login',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'check-existing-session',
|
||||||
|
description: 'Check if user is already logged in',
|
||||||
|
execute: async (context: CommandContext) => {
|
||||||
|
console.log('Checking existing session...');
|
||||||
|
|
||||||
|
try {
|
||||||
|
await loadSession();
|
||||||
|
const session = getSession();
|
||||||
|
|
||||||
|
if (session && session.token) {
|
||||||
|
try {
|
||||||
|
await userCommands.me();
|
||||||
|
console.log('✓ User is already logged in');
|
||||||
|
return {
|
||||||
|
alreadyLoggedIn: true,
|
||||||
|
session: session,
|
||||||
|
status: 'authenticated',
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
'✗ Existing session is invalid, proceeding with login',
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
alreadyLoggedIn: false,
|
||||||
|
session: null,
|
||||||
|
status: 'session-expired',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('No existing session found');
|
||||||
|
return {
|
||||||
|
alreadyLoggedIn: false,
|
||||||
|
session: null,
|
||||||
|
status: 'no-session',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
'Error checking existing session:',
|
||||||
|
error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
alreadyLoggedIn: false,
|
||||||
|
session: null,
|
||||||
|
status: 'error',
|
||||||
|
error: error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'perform-login',
|
||||||
|
description: 'Perform user login',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
if (previousResult.alreadyLoggedIn) {
|
||||||
|
console.log('Skipping login - user already authenticated');
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
loginPerformed: false,
|
||||||
|
loginSuccess: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Performing login...');
|
||||||
|
|
||||||
|
try {
|
||||||
|
const loginArgs = [];
|
||||||
|
if (context.options.email) {
|
||||||
|
loginArgs.push(context.options.email);
|
||||||
|
}
|
||||||
|
if (context.options.password) {
|
||||||
|
loginArgs.push(context.options.password);
|
||||||
|
}
|
||||||
|
|
||||||
|
await userCommands.login({ args: loginArgs });
|
||||||
|
console.log('✓ Login successful');
|
||||||
|
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
loginPerformed: true,
|
||||||
|
loginSuccess: true,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
'✗ Login failed:',
|
||||||
|
error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
loginPerformed: true,
|
||||||
|
loginSuccess: false,
|
||||||
|
loginError:
|
||||||
|
error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'validate-login',
|
||||||
|
description: 'Validate login by getting user info',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
if (
|
||||||
|
!previousResult.loginSuccess &&
|
||||||
|
!previousResult.alreadyLoggedIn
|
||||||
|
) {
|
||||||
|
console.log('Login failed, skipping validation');
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
validationPerformed: false,
|
||||||
|
validationSuccess: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context.options.validateAfterLogin === false) {
|
||||||
|
console.log('Skipping validation as requested');
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
validationPerformed: false,
|
||||||
|
validationSuccess: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Validating login by getting user information...');
|
||||||
|
|
||||||
|
try {
|
||||||
|
const userInfo = await userCommands.me();
|
||||||
|
console.log('✓ Login validation successful');
|
||||||
|
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
validationPerformed: true,
|
||||||
|
validationSuccess: true,
|
||||||
|
userInfo,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
'✗ Login validation failed:',
|
||||||
|
error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
validationPerformed: true,
|
||||||
|
validationSuccess: false,
|
||||||
|
validationError:
|
||||||
|
error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'login-summary',
|
||||||
|
description: 'Provide login flow summary',
|
||||||
|
execute: async (context: CommandContext, previousResult: any) => {
|
||||||
|
console.log('\n=== Login Flow Summary ===');
|
||||||
|
|
||||||
|
if (previousResult.alreadyLoggedIn) {
|
||||||
|
console.log('Status: Already logged in');
|
||||||
|
console.log('Session: Valid');
|
||||||
|
} else if (previousResult.loginSuccess) {
|
||||||
|
console.log('Status: Login successful');
|
||||||
|
if (previousResult.validationSuccess) {
|
||||||
|
console.log('Validation: Passed');
|
||||||
|
} else {
|
||||||
|
console.log('Validation: Failed');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('Status: Login failed');
|
||||||
|
console.log(
|
||||||
|
'Error:',
|
||||||
|
previousResult.loginError || 'Unknown error',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('==========================\n');
|
||||||
|
|
||||||
|
return {
|
||||||
|
...previousResult,
|
||||||
|
flowComplete: true,
|
||||||
|
finalStatus:
|
||||||
|
previousResult.alreadyLoggedIn || previousResult.loginSuccess
|
||||||
|
? 'success'
|
||||||
|
: 'failed',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
8
src/modules/version-module.ts
Normal file
8
src/modules/version-module.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import type { CLIModule} from '../types';
|
||||||
|
|
||||||
|
export const versionModule: CLIModule = {
|
||||||
|
name: 'version',
|
||||||
|
version: '1.0.0',
|
||||||
|
commands: [],
|
||||||
|
workflows: [],
|
||||||
|
};
|
||||||
213
src/package.ts
213
src/package.ts
@@ -1,79 +1,91 @@
|
|||||||
import { get, post, uploadFile } from './api';
|
import { get, getAllPackages, post, uploadFile, doDelete } from './api';
|
||||||
import { question, saveToLocal } from './utils';
|
import { question, saveToLocal } from './utils';
|
||||||
|
import { t } from './utils/i18n';
|
||||||
|
|
||||||
import { checkPlatform, getSelectedApp } from './app';
|
import { getPlatform, getSelectedApp } from './app';
|
||||||
|
|
||||||
import { getApkInfo, getIpaInfo, getAppInfo } from './utils';
|
|
||||||
import Table from 'tty-table';
|
import Table from 'tty-table';
|
||||||
|
import type { Platform } from './types';
|
||||||
|
import { getApkInfo, getAppInfo, getIpaInfo } from './utils';
|
||||||
import { depVersions } from './utils/dep-versions';
|
import { depVersions } from './utils/dep-versions';
|
||||||
import { getCommitInfo } from './utils/git';
|
import { getCommitInfo } from './utils/git';
|
||||||
import type { Platform } from 'types';
|
|
||||||
|
|
||||||
export async function listPackage(appId: string) {
|
export async function listPackage(appId: string) {
|
||||||
const { data } = await get(`/app/${appId}/package/list?limit=1000`);
|
const allPkgs = await getAllPackages(appId);
|
||||||
|
|
||||||
const header = [{ value: '原生包 Id' }, { value: '原生版本' }];
|
const header = [
|
||||||
|
{ value: t('nativePackageId') },
|
||||||
|
{ value: t('nativeVersion') },
|
||||||
|
];
|
||||||
const rows = [];
|
const rows = [];
|
||||||
for (const pkg of data) {
|
for (const pkg of allPkgs) {
|
||||||
const { version } = pkg;
|
const { version } = pkg;
|
||||||
let versionInfo = '';
|
let versionInfo = '';
|
||||||
if (version) {
|
if (version) {
|
||||||
versionInfo = `, 已绑定:${version.name} (${version.id})`;
|
const versionObj = version as any;
|
||||||
} else {
|
versionInfo = t('boundTo', {
|
||||||
// versionInfo = ' (newest)';
|
name: versionObj.name || version,
|
||||||
|
id: versionObj.id || version,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
let output = pkg.name;
|
let output = pkg.name;
|
||||||
if (pkg.status === 'paused') {
|
if (pkg.status === 'paused') {
|
||||||
output += '(已暂停)';
|
output += t('pausedStatus');
|
||||||
}
|
}
|
||||||
if (pkg.status === 'expired') {
|
if (pkg.status === 'expired') {
|
||||||
output += '(已过期)';
|
output += t('expiredStatus');
|
||||||
}
|
}
|
||||||
output += versionInfo;
|
output += versionInfo;
|
||||||
rows.push([pkg.id, output]);
|
rows.push([pkg.id, output]);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(Table(header, rows).render());
|
console.log(Table(header, rows).render());
|
||||||
console.log(`\n共 ${data.length} 个包`);
|
console.log(t('totalPackages', { count: allPkgs.length }));
|
||||||
return data;
|
return allPkgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function choosePackage(appId: string) {
|
export async function choosePackage(appId: string) {
|
||||||
const list = await listPackage(appId);
|
const list = await listPackage(appId);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const id = await question('输入原生包 id:');
|
const id = await question(t('enterNativePackageId'));
|
||||||
const app = list.find((v) => v.id === Number(id));
|
const app = list.find((v) => v.id.toString() === id);
|
||||||
if (app) {
|
if (app) {
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const commands = {
|
export const packageCommands = {
|
||||||
uploadIpa: async ({ args }: { args: string[] }) => {
|
uploadIpa: async ({
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: {
|
||||||
|
args: string[];
|
||||||
|
options: Record<string, any>;
|
||||||
|
}) => {
|
||||||
const fn = args[0];
|
const fn = args[0];
|
||||||
if (!fn || !fn.endsWith('.ipa')) {
|
if (!fn || !fn.endsWith('.ipa')) {
|
||||||
throw new Error('使用方法: pushy uploadIpa ipa后缀文件');
|
throw new Error(t('usageUploadIpa'));
|
||||||
}
|
}
|
||||||
const {
|
const ipaInfo = await getIpaInfo(fn);
|
||||||
versionName,
|
const { versionName: extractedVersionName, buildTime } = ipaInfo;
|
||||||
buildTime,
|
const appIdInPkg = (ipaInfo as any).appId;
|
||||||
appId: appIdInPkg,
|
const appKeyInPkg = (ipaInfo as any).appKey;
|
||||||
appKey: appKeyInPkg,
|
|
||||||
} = await getIpaInfo(fn);
|
|
||||||
const { appId, appKey } = await getSelectedApp('ios');
|
const { appId, appKey } = await getSelectedApp('ios');
|
||||||
|
|
||||||
if (appIdInPkg && appIdInPkg != appId) {
|
if (appIdInPkg && appIdInPkg != appId) {
|
||||||
throw new Error(
|
throw new Error(t('appIdMismatchIpa', { appIdInPkg, appId }));
|
||||||
`appId不匹配!当前ipa: ${appIdInPkg}, 当前update.json: ${appId}`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (appKeyInPkg && appKeyInPkg !== appKey) {
|
if (appKeyInPkg && appKeyInPkg !== appKey) {
|
||||||
throw new Error(
|
throw new Error(t('appKeyMismatchIpa', { appKeyInPkg, appKey }));
|
||||||
`appKey不匹配!当前ipa: ${appKeyInPkg}, 当前update.json: ${appKey}`,
|
}
|
||||||
);
|
|
||||||
|
// Use custom version if provided, otherwise use extracted version
|
||||||
|
const versionName = options.version || extractedVersionName;
|
||||||
|
if (options.version) {
|
||||||
|
console.log(t('usingCustomVersion', { version: versionName }));
|
||||||
}
|
}
|
||||||
|
|
||||||
const { hash } = await uploadFile(fn);
|
const { hash } = await uploadFile(fn);
|
||||||
@@ -86,33 +98,37 @@ export const commands = {
|
|||||||
commit: await getCommitInfo(),
|
commit: await getCommitInfo(),
|
||||||
});
|
});
|
||||||
saveToLocal(fn, `${appId}/package/${id}.ipa`);
|
saveToLocal(fn, `${appId}/package/${id}.ipa`);
|
||||||
console.log(
|
console.log(t('ipaUploadSuccess', { id, version: versionName, buildTime }));
|
||||||
`已成功上传ipa原生包(id: ${id}, version: ${versionName}, buildTime: ${buildTime})`,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
uploadApk: async ({ args }: { args: string[] }) => {
|
uploadApk: async ({
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: {
|
||||||
|
args: string[];
|
||||||
|
options: Record<string, any>;
|
||||||
|
}) => {
|
||||||
const fn = args[0];
|
const fn = args[0];
|
||||||
if (!fn || !fn.endsWith('.apk')) {
|
if (!fn || !fn.endsWith('.apk')) {
|
||||||
throw new Error('使用方法: pushy uploadApk apk后缀文件');
|
throw new Error(t('usageUploadApk'));
|
||||||
}
|
}
|
||||||
const {
|
const apkInfo = await getApkInfo(fn);
|
||||||
versionName,
|
const { versionName: extractedVersionName, buildTime } = apkInfo;
|
||||||
buildTime,
|
const appIdInPkg = (apkInfo as any).appId;
|
||||||
appId: appIdInPkg,
|
const appKeyInPkg = (apkInfo as any).appKey;
|
||||||
appKey: appKeyInPkg,
|
|
||||||
} = await getApkInfo(fn);
|
|
||||||
const { appId, appKey } = await getSelectedApp('android');
|
const { appId, appKey } = await getSelectedApp('android');
|
||||||
|
|
||||||
if (appIdInPkg && appIdInPkg != appId) {
|
if (appIdInPkg && appIdInPkg != appId) {
|
||||||
throw new Error(
|
throw new Error(t('appIdMismatchApk', { appIdInPkg, appId }));
|
||||||
`appId不匹配!当前apk: ${appIdInPkg}, 当前update.json: ${appId}`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (appKeyInPkg && appKeyInPkg !== appKey) {
|
if (appKeyInPkg && appKeyInPkg !== appKey) {
|
||||||
throw new Error(
|
throw new Error(t('appKeyMismatchApk', { appKeyInPkg, appKey }));
|
||||||
`appKey不匹配!当前apk: ${appKeyInPkg}, 当前update.json: ${appKey}`,
|
}
|
||||||
);
|
|
||||||
|
// Use custom version if provided, otherwise use extracted version
|
||||||
|
const versionName = options.version || extractedVersionName;
|
||||||
|
if (options.version) {
|
||||||
|
console.log(t('usingCustomVersion', { version: versionName }));
|
||||||
}
|
}
|
||||||
|
|
||||||
const { hash } = await uploadFile(fn);
|
const { hash } = await uploadFile(fn);
|
||||||
@@ -125,33 +141,37 @@ export const commands = {
|
|||||||
commit: await getCommitInfo(),
|
commit: await getCommitInfo(),
|
||||||
});
|
});
|
||||||
saveToLocal(fn, `${appId}/package/${id}.apk`);
|
saveToLocal(fn, `${appId}/package/${id}.apk`);
|
||||||
console.log(
|
console.log(t('apkUploadSuccess', { id, version: versionName, buildTime }));
|
||||||
`已成功上传apk原生包(id: ${id}, version: ${versionName}, buildTime: ${buildTime})`,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
uploadApp: async ({ args }: { args: string[] }) => {
|
uploadApp: async ({
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: {
|
||||||
|
args: string[];
|
||||||
|
options: Record<string, any>;
|
||||||
|
}) => {
|
||||||
const fn = args[0];
|
const fn = args[0];
|
||||||
if (!fn || !fn.endsWith('.app')) {
|
if (!fn || !fn.endsWith('.app')) {
|
||||||
throw new Error('使用方法: pushy uploadApp app后缀文件');
|
throw new Error(t('usageUploadApp'));
|
||||||
}
|
}
|
||||||
const {
|
const appInfo = await getAppInfo(fn);
|
||||||
versionName,
|
const { versionName: extractedVersionName, buildTime } = appInfo;
|
||||||
buildTime,
|
const appIdInPkg = (appInfo as any).appId;
|
||||||
appId: appIdInPkg,
|
const appKeyInPkg = (appInfo as any).appKey;
|
||||||
appKey: appKeyInPkg,
|
|
||||||
} = await getAppInfo(fn);
|
|
||||||
const { appId, appKey } = await getSelectedApp('harmony');
|
const { appId, appKey } = await getSelectedApp('harmony');
|
||||||
|
|
||||||
if (appIdInPkg && appIdInPkg != appId) {
|
if (appIdInPkg && appIdInPkg != appId) {
|
||||||
throw new Error(
|
throw new Error(t('appIdMismatchApp', { appIdInPkg, appId }));
|
||||||
`appId不匹配!当前app: ${appIdInPkg}, 当前update.json: ${appId}`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (appKeyInPkg && appKeyInPkg !== appKey) {
|
if (appKeyInPkg && appKeyInPkg !== appKey) {
|
||||||
throw new Error(
|
throw new Error(t('appKeyMismatchApp', { appKeyInPkg, appKey }));
|
||||||
`appKey不匹配!当前app: ${appKeyInPkg}, 当前update.json: ${appKey}`,
|
}
|
||||||
);
|
|
||||||
|
// Use custom version if provided, otherwise use extracted version
|
||||||
|
const versionName = options.version || extractedVersionName;
|
||||||
|
if (options.version) {
|
||||||
|
console.log(t('usingCustomVersion', { version: versionName }));
|
||||||
}
|
}
|
||||||
|
|
||||||
const { hash } = await uploadFile(fn);
|
const { hash } = await uploadFile(fn);
|
||||||
@@ -164,36 +184,81 @@ export const commands = {
|
|||||||
commit: await getCommitInfo(),
|
commit: await getCommitInfo(),
|
||||||
});
|
});
|
||||||
saveToLocal(fn, `${appId}/package/${id}.app`);
|
saveToLocal(fn, `${appId}/package/${id}.app`);
|
||||||
console.log(
|
console.log(t('appUploadSuccess', { id, version: versionName, buildTime }));
|
||||||
`已成功上传app原生包(id: ${id}, version: ${versionName}, buildTime: ${buildTime})`,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
parseApp: async ({ args }: { args: string[] }) => {
|
parseApp: async ({ args }: { args: string[] }) => {
|
||||||
const fn = args[0];
|
const fn = args[0];
|
||||||
if (!fn || !fn.endsWith('.app')) {
|
if (!fn || !fn.endsWith('.app')) {
|
||||||
throw new Error('使用方法: pushy parseApp app后缀文件');
|
throw new Error(t('usageParseApp'));
|
||||||
}
|
}
|
||||||
console.log(await getAppInfo(fn));
|
console.log(await getAppInfo(fn));
|
||||||
},
|
},
|
||||||
parseIpa: async ({ args }: { args: string[] }) => {
|
parseIpa: async ({ args }: { args: string[] }) => {
|
||||||
const fn = args[0];
|
const fn = args[0];
|
||||||
if (!fn || !fn.endsWith('.ipa')) {
|
if (!fn || !fn.endsWith('.ipa')) {
|
||||||
throw new Error('使用方法: pushy parseIpa ipa后缀文件');
|
throw new Error(t('usageParseIpa'));
|
||||||
}
|
}
|
||||||
console.log(await getIpaInfo(fn));
|
console.log(await getIpaInfo(fn));
|
||||||
},
|
},
|
||||||
parseApk: async ({ args }: { args: string[] }) => {
|
parseApk: async ({ args }: { args: string[] }) => {
|
||||||
const fn = args[0];
|
const fn = args[0];
|
||||||
if (!fn || !fn.endsWith('.apk')) {
|
if (!fn || !fn.endsWith('.apk')) {
|
||||||
throw new Error('使用方法: pushy parseApk apk后缀文件');
|
throw new Error(t('usageParseApk'));
|
||||||
}
|
}
|
||||||
console.log(await getApkInfo(fn));
|
console.log(await getApkInfo(fn));
|
||||||
},
|
},
|
||||||
packages: async ({ options }: { options: { platform: Platform } }) => {
|
packages: async ({ options }: { options: { platform: Platform } }) => {
|
||||||
const platform = checkPlatform(
|
const platform = await getPlatform(options.platform);
|
||||||
options.platform || (await question('平台(ios/android/harmony):')),
|
|
||||||
);
|
|
||||||
const { appId } = await getSelectedApp(platform);
|
const { appId } = await getSelectedApp(platform);
|
||||||
await listPackage(appId);
|
await listPackage(appId);
|
||||||
},
|
},
|
||||||
|
deletePackage: async ({
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: {
|
||||||
|
args: string[];
|
||||||
|
options: { appId?: string, packageId?: string, packageVersion?: string };
|
||||||
|
}) => {
|
||||||
|
let { appId, packageId, packageVersion } = options;
|
||||||
|
|
||||||
|
if (!appId) {
|
||||||
|
const platform = await getPlatform();
|
||||||
|
appId = (await getSelectedApp(platform)).appId as string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no packageId provided as argument, let user choose from list
|
||||||
|
if (!packageId) {
|
||||||
|
const allPkgs = await getAllPackages(appId);
|
||||||
|
if (!allPkgs) {
|
||||||
|
throw new Error(t('noPackagesFound', { appId }));
|
||||||
|
}
|
||||||
|
const selectedPackage = allPkgs.find((pkg) => pkg.name === packageVersion);
|
||||||
|
if (!selectedPackage) {
|
||||||
|
throw new Error(t('packageNotFound', { packageVersion }));
|
||||||
|
}
|
||||||
|
packageId = selectedPackage.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Confirm deletion
|
||||||
|
// const confirmDelete = await question(
|
||||||
|
// t('confirmDeletePackage', { packageId }),
|
||||||
|
// );
|
||||||
|
|
||||||
|
// if (
|
||||||
|
// confirmDelete.toLowerCase() !== 'y' &&
|
||||||
|
// confirmDelete.toLowerCase() !== 'yes'
|
||||||
|
// ) {
|
||||||
|
// console.log(t('cancelled'));
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
try {
|
||||||
|
await doDelete(`/app/${appId}/package/${packageId}`);
|
||||||
|
console.log(t('deletePackageSuccess', { packageId }));
|
||||||
|
} catch (error: any) {
|
||||||
|
throw new Error(
|
||||||
|
t('deletePackageError', { packageId, error: error.message }),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
341
src/provider.ts
Normal file
341
src/provider.ts
Normal file
@@ -0,0 +1,341 @@
|
|||||||
|
import { getSession, loadSession } from './api';
|
||||||
|
import { getPlatform, getSelectedApp } from './app';
|
||||||
|
import type {
|
||||||
|
BundleOptions,
|
||||||
|
CLIProvider,
|
||||||
|
CommandContext,
|
||||||
|
CommandResult,
|
||||||
|
CustomWorkflow,
|
||||||
|
Platform,
|
||||||
|
PublishOptions,
|
||||||
|
Session,
|
||||||
|
UploadOptions,
|
||||||
|
Version,
|
||||||
|
} from './types';
|
||||||
|
|
||||||
|
export class CLIProviderImpl implements CLIProvider {
|
||||||
|
private workflows: Map<string, CustomWorkflow> = new Map();
|
||||||
|
private session?: Session;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async init() {
|
||||||
|
try {
|
||||||
|
await loadSession();
|
||||||
|
this.session = getSession();
|
||||||
|
} catch (error) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
async bundle(options: BundleOptions): Promise<CommandResult> {
|
||||||
|
try {
|
||||||
|
const context: CommandContext = {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
dev: options.dev || false,
|
||||||
|
platform: options.platform,
|
||||||
|
bundleName: options.bundleName || 'index.bundlejs',
|
||||||
|
entryFile: options.entryFile || 'index.js',
|
||||||
|
output: options.output || '${tempDir}/output/${platform}.${time}.ppk',
|
||||||
|
sourcemap: options.sourcemap || false,
|
||||||
|
taro: options.taro || false,
|
||||||
|
expo: options.expo || false,
|
||||||
|
rncli: options.rncli || false,
|
||||||
|
disableHermes: options.disableHermes || false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const { bundleCommands } = await import('./bundle');
|
||||||
|
await bundleCommands.bundle(context);
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: { message: 'Bundle created successfully' },
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error:
|
||||||
|
error instanceof Error
|
||||||
|
? error.message
|
||||||
|
: 'Unknown error during bundling',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async publish(options: PublishOptions): Promise<CommandResult> {
|
||||||
|
try {
|
||||||
|
const context: CommandContext = {
|
||||||
|
args: [],
|
||||||
|
options: {
|
||||||
|
name: options.name,
|
||||||
|
description: options.description,
|
||||||
|
metaInfo: options.metaInfo,
|
||||||
|
packageId: options.packageId,
|
||||||
|
packageVersion: options.packageVersion,
|
||||||
|
minPackageVersion: options.minPackageVersion,
|
||||||
|
maxPackageVersion: options.maxPackageVersion,
|
||||||
|
packageVersionRange: options.packageVersionRange,
|
||||||
|
rollout: options.rollout,
|
||||||
|
dryRun: options.dryRun || false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const { versionCommands } = await import('./versions');
|
||||||
|
await versionCommands.publish(context);
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: { message: 'Version published successfully' },
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error:
|
||||||
|
error instanceof Error
|
||||||
|
? error.message
|
||||||
|
: 'Unknown error during publishing',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async upload(options: UploadOptions): Promise<CommandResult> {
|
||||||
|
try {
|
||||||
|
const platform = await this.getPlatform(options.platform);
|
||||||
|
const { appId } = await this.getSelectedApp(platform);
|
||||||
|
|
||||||
|
const filePath = options.filePath;
|
||||||
|
const fileType = filePath.split('.').pop()?.toLowerCase();
|
||||||
|
|
||||||
|
const context: CommandContext = {
|
||||||
|
args: [filePath],
|
||||||
|
options: { platform, appId, version: options.version },
|
||||||
|
};
|
||||||
|
|
||||||
|
const { packageCommands } = await import('./package');
|
||||||
|
|
||||||
|
switch (fileType) {
|
||||||
|
case 'ipa':
|
||||||
|
await packageCommands.uploadIpa(context);
|
||||||
|
break;
|
||||||
|
case 'apk':
|
||||||
|
await packageCommands.uploadApk(context);
|
||||||
|
break;
|
||||||
|
case 'app':
|
||||||
|
await packageCommands.uploadApp(context);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported file type: ${fileType}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: { message: 'File uploaded successfully' },
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error:
|
||||||
|
error instanceof Error
|
||||||
|
? error.message
|
||||||
|
: 'Unknown error during upload',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getSelectedApp(
|
||||||
|
platform?: Platform,
|
||||||
|
): Promise<{ appId: string; platform: Platform }> {
|
||||||
|
const resolvedPlatform = await this.getPlatform(platform);
|
||||||
|
return getSelectedApp(resolvedPlatform);
|
||||||
|
}
|
||||||
|
|
||||||
|
async listApps(platform?: Platform): Promise<CommandResult> {
|
||||||
|
try {
|
||||||
|
const resolvedPlatform = await this.getPlatform(platform);
|
||||||
|
const { appCommands } = await import('./app');
|
||||||
|
await appCommands.apps({ options: { platform: resolvedPlatform } });
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: { message: 'Apps listed successfully' },
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error:
|
||||||
|
error instanceof Error ? error.message : 'Unknown error listing apps',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async createApp(name: string, platform: Platform): Promise<CommandResult> {
|
||||||
|
try {
|
||||||
|
const { appCommands } = await import('./app');
|
||||||
|
await appCommands.createApp({
|
||||||
|
options: {
|
||||||
|
name,
|
||||||
|
platform,
|
||||||
|
downloadUrl: '',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: { message: 'App created successfully' },
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error:
|
||||||
|
error instanceof Error ? error.message : 'Unknown error creating app',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async listVersions(appId: string): Promise<CommandResult> {
|
||||||
|
try {
|
||||||
|
const context: CommandContext = {
|
||||||
|
args: [],
|
||||||
|
options: { appId },
|
||||||
|
};
|
||||||
|
|
||||||
|
const { versionCommands } = await import('./versions');
|
||||||
|
await versionCommands.versions(context);
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: { message: 'Versions listed successfully' },
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error:
|
||||||
|
error instanceof Error
|
||||||
|
? error.message
|
||||||
|
: 'Unknown error listing versions',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateVersion(
|
||||||
|
appId: string,
|
||||||
|
versionId: string,
|
||||||
|
updates: Partial<Version>,
|
||||||
|
): Promise<CommandResult> {
|
||||||
|
try {
|
||||||
|
const context: CommandContext = {
|
||||||
|
args: [versionId],
|
||||||
|
options: {
|
||||||
|
appId,
|
||||||
|
...updates,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const { versionCommands } = await import('./versions');
|
||||||
|
await versionCommands.update(context);
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: { message: 'Version updated successfully' },
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error:
|
||||||
|
error instanceof Error
|
||||||
|
? error.message
|
||||||
|
: 'Unknown error updating version',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getPlatform(platform?: Platform): Promise<Platform> {
|
||||||
|
return getPlatform(platform);
|
||||||
|
}
|
||||||
|
|
||||||
|
async loadSession(): Promise<Session> {
|
||||||
|
await loadSession();
|
||||||
|
this.session = getSession();
|
||||||
|
if (!this.session) {
|
||||||
|
throw new Error('Failed to load session');
|
||||||
|
}
|
||||||
|
return this.session;
|
||||||
|
}
|
||||||
|
|
||||||
|
registerWorkflow(workflow: CustomWorkflow): void {
|
||||||
|
this.workflows.set(workflow.name, workflow);
|
||||||
|
}
|
||||||
|
|
||||||
|
async executeWorkflow(
|
||||||
|
workflowName: string,
|
||||||
|
context: CommandContext,
|
||||||
|
): Promise<CommandResult> {
|
||||||
|
const workflow = this.workflows.get(workflowName);
|
||||||
|
if (!workflow) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: `Workflow '${workflowName}' not found`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
let previousResult: any = null;
|
||||||
|
for (const step of workflow.steps) {
|
||||||
|
if (step.condition && !step.condition(context)) {
|
||||||
|
console.log(`Skipping step '${step.name}' due to condition`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Executing step '${step.name}'`);
|
||||||
|
previousResult = await step.execute(context, previousResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: {
|
||||||
|
message: `Workflow '${workflowName}' completed successfully`,
|
||||||
|
result: previousResult,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error:
|
||||||
|
error instanceof Error
|
||||||
|
? error.message
|
||||||
|
: `Workflow '${workflowName}' failed`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getRegisteredWorkflows(): string[] {
|
||||||
|
return Array.from(this.workflows.keys());
|
||||||
|
}
|
||||||
|
|
||||||
|
async listPackages(appId?: string): Promise<CommandResult> {
|
||||||
|
try {
|
||||||
|
const context: CommandContext = {
|
||||||
|
args: [],
|
||||||
|
options: appId ? { appId } : {},
|
||||||
|
};
|
||||||
|
|
||||||
|
const { listPackage } = await import('./package');
|
||||||
|
const result = await listPackage(appId || '');
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: result,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error:
|
||||||
|
error instanceof Error
|
||||||
|
? error.message
|
||||||
|
: 'Unknown error listing packages',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
138
src/types.ts
138
src/types.ts
@@ -8,3 +8,141 @@ export interface Session {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type Platform = 'ios' | 'android' | 'harmony';
|
export type Platform = 'ios' | 'android' | 'harmony';
|
||||||
|
|
||||||
|
export interface Package {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
version?: string;
|
||||||
|
status?: string;
|
||||||
|
appId?: string;
|
||||||
|
appKey?: string;
|
||||||
|
versionName?: any;
|
||||||
|
buildTime?: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Version {
|
||||||
|
id: string;
|
||||||
|
hash: string;
|
||||||
|
name: string;
|
||||||
|
packages?: Package[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CommandContext {
|
||||||
|
args: string[];
|
||||||
|
options: Record<string, any>;
|
||||||
|
platform?: Platform;
|
||||||
|
appId?: string;
|
||||||
|
session?: Session;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CommandResult {
|
||||||
|
success: boolean;
|
||||||
|
data?: any;
|
||||||
|
error?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CommandDefinition {
|
||||||
|
name: string;
|
||||||
|
description?: string;
|
||||||
|
handler: (context: CommandContext) => Promise<CommandResult>;
|
||||||
|
options?: Record<
|
||||||
|
string,
|
||||||
|
{
|
||||||
|
hasValue?: boolean;
|
||||||
|
default?: any;
|
||||||
|
description?: string;
|
||||||
|
}
|
||||||
|
>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BundleOptions {
|
||||||
|
dev?: boolean;
|
||||||
|
platform?: Platform;
|
||||||
|
bundleName?: string;
|
||||||
|
entryFile?: string;
|
||||||
|
output?: string;
|
||||||
|
sourcemap?: boolean;
|
||||||
|
taro?: boolean;
|
||||||
|
expo?: boolean;
|
||||||
|
rncli?: boolean;
|
||||||
|
disableHermes?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PublishOptions {
|
||||||
|
name?: string;
|
||||||
|
description?: string;
|
||||||
|
metaInfo?: string;
|
||||||
|
packageId?: string;
|
||||||
|
packageVersion?: string;
|
||||||
|
minPackageVersion?: string;
|
||||||
|
maxPackageVersion?: string;
|
||||||
|
packageVersionRange?: string;
|
||||||
|
rollout?: number;
|
||||||
|
dryRun?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UploadOptions {
|
||||||
|
platform?: Platform;
|
||||||
|
filePath: string;
|
||||||
|
appId?: string;
|
||||||
|
version?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WorkflowStep {
|
||||||
|
name: string;
|
||||||
|
description?: string;
|
||||||
|
execute: (context: CommandContext, previousResult?: any) => Promise<any>;
|
||||||
|
condition?: (context: CommandContext) => boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CustomWorkflow {
|
||||||
|
name: string;
|
||||||
|
description?: string;
|
||||||
|
steps: WorkflowStep[];
|
||||||
|
validate?: (context: CommandContext) => boolean;
|
||||||
|
options?: Record<
|
||||||
|
string,
|
||||||
|
{
|
||||||
|
hasValue?: boolean;
|
||||||
|
default?: any;
|
||||||
|
description?: string;
|
||||||
|
}
|
||||||
|
>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CLIProvider {
|
||||||
|
bundle: (options: BundleOptions) => Promise<CommandResult>;
|
||||||
|
publish: (options: PublishOptions) => Promise<CommandResult>;
|
||||||
|
upload: (options: UploadOptions) => Promise<CommandResult>;
|
||||||
|
|
||||||
|
createApp: (name: string, platform: Platform) => Promise<CommandResult>;
|
||||||
|
listApps: (platform?: Platform) => Promise<CommandResult>;
|
||||||
|
getSelectedApp: (
|
||||||
|
platform?: Platform,
|
||||||
|
) => Promise<{ appId: string; platform: Platform }>;
|
||||||
|
|
||||||
|
listVersions: (appId: string) => Promise<CommandResult>;
|
||||||
|
updateVersion: (
|
||||||
|
appId: string,
|
||||||
|
versionId: string,
|
||||||
|
updates: Partial<Version>,
|
||||||
|
) => Promise<CommandResult>;
|
||||||
|
|
||||||
|
getPlatform: (platform?: Platform) => Promise<Platform>;
|
||||||
|
loadSession: () => Promise<Session>;
|
||||||
|
|
||||||
|
registerWorkflow: (workflow: CustomWorkflow) => void;
|
||||||
|
executeWorkflow: (
|
||||||
|
workflowName: string,
|
||||||
|
context: CommandContext,
|
||||||
|
) => Promise<CommandResult>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CLIModule {
|
||||||
|
name: string;
|
||||||
|
version: string;
|
||||||
|
commands?: CommandDefinition[];
|
||||||
|
workflows?: CustomWorkflow[];
|
||||||
|
init?: (provider: CLIProvider) => void;
|
||||||
|
cleanup?: () => void;
|
||||||
|
}
|
||||||
|
|||||||
14
src/user.ts
14
src/user.ts
@@ -1,12 +1,14 @@
|
|||||||
|
import crypto from 'crypto';
|
||||||
|
import type { CommandContext } from 'types';
|
||||||
|
import { closeSession, get, post, replaceSession, saveSession } from './api';
|
||||||
import { question } from './utils';
|
import { question } from './utils';
|
||||||
import { post, get, replaceSession, saveSession, closeSession } from './api';
|
import { t } from './utils/i18n';
|
||||||
import crypto from 'node:crypto';
|
|
||||||
|
|
||||||
function md5(str: string) {
|
function md5(str: string) {
|
||||||
return crypto.createHash('md5').update(str).digest('hex');
|
return crypto.createHash('md5').update(str).digest('hex');
|
||||||
}
|
}
|
||||||
|
|
||||||
export const commands = {
|
export const userCommands = {
|
||||||
login: async ({ args }: { args: string[] }) => {
|
login: async ({ args }: { args: string[] }) => {
|
||||||
const email = args[0] || (await question('email:'));
|
const email = args[0] || (await question('email:'));
|
||||||
const pwd = args[1] || (await question('password:', true));
|
const pwd = args[1] || (await question('password:', true));
|
||||||
@@ -16,11 +18,11 @@ export const commands = {
|
|||||||
});
|
});
|
||||||
replaceSession({ token });
|
replaceSession({ token });
|
||||||
await saveSession();
|
await saveSession();
|
||||||
console.log(`欢迎使用 pushy 热更新服务, ${info.name}.`);
|
console.log(t('welcomeMessage', { name: info.name }));
|
||||||
},
|
},
|
||||||
logout: async () => {
|
logout: async (context: CommandContext) => {
|
||||||
await closeSession();
|
await closeSession();
|
||||||
console.log('已退出登录');
|
console.log(t('loggedOut'));
|
||||||
},
|
},
|
||||||
me: async () => {
|
me: async () => {
|
||||||
const me = await get('/user/me');
|
const me = await get('/user/me');
|
||||||
|
|||||||
35
src/utils/add-gitignore.ts
Normal file
35
src/utils/add-gitignore.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import fs from 'fs';
|
||||||
|
// import path from 'path';
|
||||||
|
import { credentialFile, tempDir } from './constants';
|
||||||
|
import { t } from './i18n';
|
||||||
|
|
||||||
|
export function addGitIgnore() {
|
||||||
|
const shouldIgnore = [credentialFile, tempDir];
|
||||||
|
|
||||||
|
const gitignorePath = '.gitignore';
|
||||||
|
|
||||||
|
if (!fs.existsSync(gitignorePath)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const gitignoreContent = fs.readFileSync(gitignorePath, 'utf-8');
|
||||||
|
|
||||||
|
const gitignoreLines = gitignoreContent.split('\n');
|
||||||
|
|
||||||
|
for (const line of gitignoreLines) {
|
||||||
|
const index = shouldIgnore.indexOf(line.trim());
|
||||||
|
if (index !== -1) {
|
||||||
|
shouldIgnore.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldIgnore.length > 0) {
|
||||||
|
gitignoreLines.push('# react-native-update');
|
||||||
|
for (const line of shouldIgnore) {
|
||||||
|
gitignoreLines.push(line);
|
||||||
|
console.log(t('addedToGitignore', { line }));
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFileSync(gitignorePath, gitignoreLines.join('\n'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,64 +1,74 @@
|
|||||||
const Zip = require('./zip')
|
const Zip = require('./zip');
|
||||||
const { mapInfoResource, findApkIconPath, getBase64FromBuffer } = require('./utils')
|
const {
|
||||||
const ManifestName = /^androidmanifest\.xml$/
|
mapInfoResource,
|
||||||
const ResourceName = /^resources\.arsc$/
|
findApkIconPath,
|
||||||
|
getBase64FromBuffer,
|
||||||
|
} = require('./utils');
|
||||||
|
const ManifestName = /^androidmanifest\.xml$/;
|
||||||
|
const ResourceName = /^resources\.arsc$/;
|
||||||
|
|
||||||
const ManifestXmlParser = require('./xml-parser/manifest')
|
const ManifestXmlParser = require('./xml-parser/manifest');
|
||||||
const ResourceFinder = require('./resource-finder')
|
const ResourceFinder = require('./resource-finder');
|
||||||
|
|
||||||
class ApkParser extends Zip {
|
class ApkParser extends Zip {
|
||||||
/**
|
/**
|
||||||
* parser for parsing .apk file
|
* parser for parsing .apk file
|
||||||
* @param {String | File | Blob} file // file's path in Node, instance of File or Blob in Browser
|
* @param {String | File | Blob} file // file's path in Node, instance of File or Blob in Browser
|
||||||
*/
|
*/
|
||||||
constructor (file) {
|
constructor(file) {
|
||||||
super(file)
|
super(file);
|
||||||
if (!(this instanceof ApkParser)) {
|
if (!(this instanceof ApkParser)) {
|
||||||
return new ApkParser(file)
|
return new ApkParser(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
parse () {
|
parse() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.getEntries([ManifestName, ResourceName]).then(buffers => {
|
this.getEntries([ManifestName, ResourceName])
|
||||||
if (!buffers[ManifestName]) {
|
.then((buffers) => {
|
||||||
throw new Error('AndroidManifest.xml can\'t be found.')
|
if (!buffers[ManifestName]) {
|
||||||
}
|
throw new Error("AndroidManifest.xml can't be found.");
|
||||||
let apkInfo = this._parseManifest(buffers[ManifestName])
|
|
||||||
let resourceMap
|
|
||||||
if (!buffers[ResourceName]) {
|
|
||||||
resolve(apkInfo)
|
|
||||||
} else {
|
|
||||||
// parse resourceMap
|
|
||||||
resourceMap = this._parseResourceMap(buffers[ResourceName])
|
|
||||||
// update apkInfo with resourceMap
|
|
||||||
apkInfo = mapInfoResource(apkInfo, resourceMap)
|
|
||||||
|
|
||||||
// find icon path and parse icon
|
|
||||||
const iconPath = findApkIconPath(apkInfo)
|
|
||||||
if (iconPath) {
|
|
||||||
this.getEntry(iconPath).then(iconBuffer => {
|
|
||||||
apkInfo.icon = iconBuffer ? getBase64FromBuffer(iconBuffer) : null
|
|
||||||
resolve(apkInfo)
|
|
||||||
}).catch(e => {
|
|
||||||
apkInfo.icon = null
|
|
||||||
resolve(apkInfo)
|
|
||||||
console.warn('[Warning] failed to parse icon: ', e)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
apkInfo.icon = null
|
|
||||||
resolve(apkInfo)
|
|
||||||
}
|
}
|
||||||
}
|
let apkInfo = this._parseManifest(buffers[ManifestName]);
|
||||||
}).catch(e => {
|
let resourceMap;
|
||||||
reject(e)
|
if (!buffers[ResourceName]) {
|
||||||
})
|
resolve(apkInfo);
|
||||||
})
|
} else {
|
||||||
|
// parse resourceMap
|
||||||
|
resourceMap = this._parseResourceMap(buffers[ResourceName]);
|
||||||
|
// update apkInfo with resourceMap
|
||||||
|
apkInfo = mapInfoResource(apkInfo, resourceMap);
|
||||||
|
|
||||||
|
// find icon path and parse icon
|
||||||
|
const iconPath = findApkIconPath(apkInfo);
|
||||||
|
if (iconPath) {
|
||||||
|
this.getEntry(iconPath)
|
||||||
|
.then((iconBuffer) => {
|
||||||
|
apkInfo.icon = iconBuffer
|
||||||
|
? getBase64FromBuffer(iconBuffer)
|
||||||
|
: null;
|
||||||
|
resolve(apkInfo);
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
apkInfo.icon = null;
|
||||||
|
resolve(apkInfo);
|
||||||
|
console.warn('[Warning] failed to parse icon: ', e);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
apkInfo.icon = null;
|
||||||
|
resolve(apkInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
reject(e);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Parse manifest
|
* Parse manifest
|
||||||
* @param {Buffer} buffer // manifest file's buffer
|
* @param {Buffer} buffer // manifest file's buffer
|
||||||
*/
|
*/
|
||||||
_parseManifest (buffer) {
|
_parseManifest(buffer) {
|
||||||
try {
|
try {
|
||||||
const parser = new ManifestXmlParser(buffer, {
|
const parser = new ManifestXmlParser(buffer, {
|
||||||
ignore: [
|
ignore: [
|
||||||
@@ -66,25 +76,25 @@ class ApkParser extends Zip {
|
|||||||
'application.service',
|
'application.service',
|
||||||
'application.receiver',
|
'application.receiver',
|
||||||
'application.provider',
|
'application.provider',
|
||||||
'permission-group'
|
'permission-group',
|
||||||
]
|
],
|
||||||
})
|
});
|
||||||
return parser.parse()
|
return parser.parse();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error('Parse AndroidManifest.xml error: ', e)
|
throw new Error('Parse AndroidManifest.xml error: ', e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Parse resourceMap
|
* Parse resourceMap
|
||||||
* @param {Buffer} buffer // resourceMap file's buffer
|
* @param {Buffer} buffer // resourceMap file's buffer
|
||||||
*/
|
*/
|
||||||
_parseResourceMap (buffer) {
|
_parseResourceMap(buffer) {
|
||||||
try {
|
try {
|
||||||
return new ResourceFinder().processResourceTable(buffer)
|
return new ResourceFinder().processResourceTable(buffer);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error('Parser resources.arsc error: ' + e)
|
throw new Error('Parser resources.arsc error: ' + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = ApkParser
|
module.exports = ApkParser;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
const Zip = require('./zip')
|
const Zip = require('./zip');
|
||||||
|
|
||||||
class AppParser extends Zip {
|
class AppParser extends Zip {
|
||||||
/**
|
/**
|
||||||
* parser for parsing .apk file
|
* parser for parsing .apk file
|
||||||
* @param {String | File | Blob} file // file's path in Node, instance of File or Blob in Browser
|
* @param {String | File | Blob} file // file's path in Node, instance of File or Blob in Browser
|
||||||
*/
|
*/
|
||||||
constructor (file) {
|
constructor(file) {
|
||||||
super(file)
|
super(file);
|
||||||
if (!(this instanceof AppParser)) {
|
if (!(this instanceof AppParser)) {
|
||||||
return new AppParser(file)
|
return new AppParser(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = AppParser
|
module.exports = AppParser;
|
||||||
|
|||||||
@@ -1,92 +1,104 @@
|
|||||||
const parsePlist = require('plist').parse
|
const parsePlist = require('plist').parse;
|
||||||
const parseBplist = require('bplist-parser').parseBuffer
|
const parseBplist = require('bplist-parser').parseBuffer;
|
||||||
const cgbiToPng = require('cgbi-to-png')
|
const cgbiToPng = require('cgbi-to-png');
|
||||||
|
|
||||||
const Zip = require('./zip')
|
const Zip = require('./zip');
|
||||||
const { findIpaIconPath, getBase64FromBuffer, isBrowser } = require('./utils')
|
const { findIpaIconPath, getBase64FromBuffer, isBrowser } = require('./utils');
|
||||||
|
|
||||||
const PlistName = new RegExp('payload/[^/]+?.app/info.plist$', 'i')
|
const PlistName = /payload\/[^\/]+?.app\/info.plist$/i;
|
||||||
const ProvisionName = /payload\/.+?\.app\/embedded.mobileprovision/
|
const ProvisionName = /payload\/.+?\.app\/embedded.mobileprovision/;
|
||||||
|
|
||||||
class IpaParser extends Zip {
|
class IpaParser extends Zip {
|
||||||
/**
|
/**
|
||||||
* parser for parsing .ipa file
|
* parser for parsing .ipa file
|
||||||
* @param {String | File | Blob} file // file's path in Node, instance of File or Blob in Browser
|
* @param {String | File | Blob} file // file's path in Node, instance of File or Blob in Browser
|
||||||
*/
|
*/
|
||||||
constructor (file) {
|
constructor(file) {
|
||||||
super(file)
|
super(file);
|
||||||
if (!(this instanceof IpaParser)) {
|
if (!(this instanceof IpaParser)) {
|
||||||
return new IpaParser(file)
|
return new IpaParser(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
parse () {
|
parse() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.getEntries([PlistName, ProvisionName]).then(buffers => {
|
this.getEntries([PlistName, ProvisionName])
|
||||||
if (!buffers[PlistName]) {
|
.then((buffers) => {
|
||||||
throw new Error('Info.plist can\'t be found.')
|
if (!buffers[PlistName]) {
|
||||||
}
|
throw new Error("Info.plist can't be found.");
|
||||||
const plistInfo = this._parsePlist(buffers[PlistName])
|
|
||||||
// parse mobile provision
|
|
||||||
const provisionInfo = this._parseProvision(buffers[ProvisionName])
|
|
||||||
plistInfo.mobileProvision = provisionInfo
|
|
||||||
|
|
||||||
// find icon path and parse icon
|
|
||||||
const iconRegex = new RegExp(findIpaIconPath(plistInfo).toLowerCase())
|
|
||||||
this.getEntry(iconRegex).then(iconBuffer => {
|
|
||||||
try {
|
|
||||||
// In general, the ipa file's icon has been specially processed, should be converted
|
|
||||||
plistInfo.icon = iconBuffer ? getBase64FromBuffer(cgbiToPng.revert(iconBuffer)) : null
|
|
||||||
} catch (err) {
|
|
||||||
if (isBrowser()) {
|
|
||||||
// Normal conversion in other cases
|
|
||||||
plistInfo.icon = iconBuffer ? getBase64FromBuffer(window.btoa(String.fromCharCode(...iconBuffer))) : null
|
|
||||||
} else {
|
|
||||||
plistInfo.icon = null
|
|
||||||
console.warn('[Warning] failed to parse icon: ', err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
resolve(plistInfo)
|
const plistInfo = this._parsePlist(buffers[PlistName]);
|
||||||
}).catch(e => {
|
// parse mobile provision
|
||||||
reject(e)
|
const provisionInfo = this._parseProvision(buffers[ProvisionName]);
|
||||||
|
plistInfo.mobileProvision = provisionInfo;
|
||||||
|
|
||||||
|
// find icon path and parse icon
|
||||||
|
const iconRegex = new RegExp(
|
||||||
|
findIpaIconPath(plistInfo).toLowerCase(),
|
||||||
|
);
|
||||||
|
this.getEntry(iconRegex)
|
||||||
|
.then((iconBuffer) => {
|
||||||
|
try {
|
||||||
|
// In general, the ipa file's icon has been specially processed, should be converted
|
||||||
|
plistInfo.icon = iconBuffer
|
||||||
|
? getBase64FromBuffer(cgbiToPng.revert(iconBuffer))
|
||||||
|
: null;
|
||||||
|
} catch (err) {
|
||||||
|
if (isBrowser()) {
|
||||||
|
// Normal conversion in other cases
|
||||||
|
plistInfo.icon = iconBuffer
|
||||||
|
? getBase64FromBuffer(
|
||||||
|
window.btoa(String.fromCharCode(...iconBuffer)),
|
||||||
|
)
|
||||||
|
: null;
|
||||||
|
} else {
|
||||||
|
plistInfo.icon = null;
|
||||||
|
console.warn('[Warning] failed to parse icon: ', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resolve(plistInfo);
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
reject(e);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
}).catch(e => {
|
.catch((e) => {
|
||||||
reject(e)
|
reject(e);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Parse plist
|
* Parse plist
|
||||||
* @param {Buffer} buffer // plist file's buffer
|
* @param {Buffer} buffer // plist file's buffer
|
||||||
*/
|
*/
|
||||||
_parsePlist (buffer) {
|
_parsePlist(buffer) {
|
||||||
let result
|
let result;
|
||||||
const bufferType = buffer[0]
|
const bufferType = buffer[0];
|
||||||
if (bufferType === 60 || bufferType === '<' || bufferType === 239) {
|
if (bufferType === 60 || bufferType === '<' || bufferType === 239) {
|
||||||
result = parsePlist(buffer.toString())
|
result = parsePlist(buffer.toString());
|
||||||
} else if (bufferType === 98) {
|
} else if (bufferType === 98) {
|
||||||
result = parseBplist(buffer)[0]
|
result = parseBplist(buffer)[0];
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Unknown plist buffer type.')
|
throw new Error('Unknown plist buffer type.');
|
||||||
}
|
}
|
||||||
return result
|
return result;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* parse provision
|
* parse provision
|
||||||
* @param {Buffer} buffer // provision file's buffer
|
* @param {Buffer} buffer // provision file's buffer
|
||||||
*/
|
*/
|
||||||
_parseProvision (buffer) {
|
_parseProvision(buffer) {
|
||||||
let info = {}
|
let info = {};
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
let content = buffer.toString('utf-8')
|
let content = buffer.toString('utf-8');
|
||||||
const firstIndex = content.indexOf('<?xml')
|
const firstIndex = content.indexOf('<?xml');
|
||||||
const endIndex = content.indexOf('</plist>')
|
const endIndex = content.indexOf('</plist>');
|
||||||
content = content.slice(firstIndex, endIndex + 8)
|
content = content.slice(firstIndex, endIndex + 8);
|
||||||
if (content) {
|
if (content) {
|
||||||
info = parsePlist(content)
|
info = parsePlist(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return info
|
return info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = IpaParser
|
module.exports = IpaParser;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* Decode binary file `resources.arsc` from a .apk file to a JavaScript Object.
|
* Decode binary file `resources.arsc` from a .apk file to a JavaScript Object.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var ByteBuffer = require("bytebuffer");
|
var ByteBuffer = require('bytebuffer');
|
||||||
|
|
||||||
var DEBUG = false;
|
var DEBUG = false;
|
||||||
|
|
||||||
@@ -39,13 +39,13 @@ function ResourceFinder() {
|
|||||||
* @param len length
|
* @param len length
|
||||||
* @returns {Buffer}
|
* @returns {Buffer}
|
||||||
*/
|
*/
|
||||||
ResourceFinder.readBytes = function(bb, len) {
|
ResourceFinder.readBytes = (bb, len) => {
|
||||||
var uint8Array = new Uint8Array(len);
|
var uint8Array = new Uint8Array(len);
|
||||||
for (var i = 0; i < len; i++) {
|
for (var i = 0; i < len; i++) {
|
||||||
uint8Array[i] = bb.readUint8();
|
uint8Array[i] = bb.readUint8();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ByteBuffer.wrap(uint8Array, "binary", true);
|
return ByteBuffer.wrap(uint8Array, 'binary', true);
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -54,8 +54,8 @@ ResourceFinder.readBytes = function(bb, len) {
|
|||||||
* @param {ByteBuffer} bb
|
* @param {ByteBuffer} bb
|
||||||
* @return {Map<String, Set<String>>}
|
* @return {Map<String, Set<String>>}
|
||||||
*/
|
*/
|
||||||
ResourceFinder.prototype.processResourceTable = function(resourceBuffer) {
|
ResourceFinder.prototype.processResourceTable = function (resourceBuffer) {
|
||||||
const bb = ByteBuffer.wrap(resourceBuffer, "binary", true);
|
const bb = ByteBuffer.wrap(resourceBuffer, 'binary', true);
|
||||||
|
|
||||||
// Resource table structure
|
// Resource table structure
|
||||||
var type = bb.readShort(),
|
var type = bb.readShort(),
|
||||||
@@ -65,10 +65,10 @@ ResourceFinder.prototype.processResourceTable = function(resourceBuffer) {
|
|||||||
buffer,
|
buffer,
|
||||||
bb2;
|
bb2;
|
||||||
if (type != RES_TABLE_TYPE) {
|
if (type != RES_TABLE_TYPE) {
|
||||||
throw new Error("No RES_TABLE_TYPE found!");
|
throw new Error('No RES_TABLE_TYPE found!');
|
||||||
}
|
}
|
||||||
if (size != bb.limit) {
|
if (size != bb.limit) {
|
||||||
throw new Error("The buffer size not matches to the resource table size.");
|
throw new Error('The buffer size not matches to the resource table size.');
|
||||||
}
|
}
|
||||||
bb.offset = headerSize;
|
bb.offset = headerSize;
|
||||||
|
|
||||||
@@ -90,14 +90,14 @@ ResourceFinder.prototype.processResourceTable = function(resourceBuffer) {
|
|||||||
if (realStringPoolCount == 0) {
|
if (realStringPoolCount == 0) {
|
||||||
// Only the first string pool is processed.
|
// Only the first string pool is processed.
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log("Processing the string pool ...");
|
console.log('Processing the string pool ...');
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer = new ByteBuffer(s);
|
buffer = new ByteBuffer(s);
|
||||||
bb.offset = pos;
|
bb.offset = pos;
|
||||||
bb.prependTo(buffer);
|
bb.prependTo(buffer);
|
||||||
|
|
||||||
bb2 = ByteBuffer.wrap(buffer, "binary", true);
|
bb2 = ByteBuffer.wrap(buffer, 'binary', true);
|
||||||
|
|
||||||
bb2.LE();
|
bb2.LE();
|
||||||
this.valueStringPool = this.processStringPool(bb2);
|
this.valueStringPool = this.processStringPool(bb2);
|
||||||
@@ -106,30 +106,30 @@ ResourceFinder.prototype.processResourceTable = function(resourceBuffer) {
|
|||||||
} else if (t == RES_TABLE_PACKAGE_TYPE) {
|
} else if (t == RES_TABLE_PACKAGE_TYPE) {
|
||||||
// Process the package
|
// Process the package
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log("Processing the package " + realPackageCount + " ...");
|
console.log('Processing the package ' + realPackageCount + ' ...');
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer = new ByteBuffer(s);
|
buffer = new ByteBuffer(s);
|
||||||
bb.offset = pos;
|
bb.offset = pos;
|
||||||
bb.prependTo(buffer);
|
bb.prependTo(buffer);
|
||||||
|
|
||||||
bb2 = ByteBuffer.wrap(buffer, "binary", true);
|
bb2 = ByteBuffer.wrap(buffer, 'binary', true);
|
||||||
bb2.LE();
|
bb2.LE();
|
||||||
this.processPackage(bb2);
|
this.processPackage(bb2);
|
||||||
|
|
||||||
realPackageCount++;
|
realPackageCount++;
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Unsupported type");
|
throw new Error('Unsupported type');
|
||||||
}
|
}
|
||||||
bb.offset = pos + s;
|
bb.offset = pos + s;
|
||||||
if (!bb.remaining()) break;
|
if (!bb.remaining()) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (realStringPoolCount != 1) {
|
if (realStringPoolCount != 1) {
|
||||||
throw new Error("More than 1 string pool found!");
|
throw new Error('More than 1 string pool found!');
|
||||||
}
|
}
|
||||||
if (realPackageCount != packageCount) {
|
if (realPackageCount != packageCount) {
|
||||||
throw new Error("Real package count not equals the declared count.");
|
throw new Error('Real package count not equals the declared count.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.responseMap;
|
return this.responseMap;
|
||||||
@@ -139,7 +139,7 @@ ResourceFinder.prototype.processResourceTable = function(resourceBuffer) {
|
|||||||
*
|
*
|
||||||
* @param {ByteBuffer} bb
|
* @param {ByteBuffer} bb
|
||||||
*/
|
*/
|
||||||
ResourceFinder.prototype.processPackage = function(bb) {
|
ResourceFinder.prototype.processPackage = function (bb) {
|
||||||
// Package structure
|
// Package structure
|
||||||
var type = bb.readShort(),
|
var type = bb.readShort(),
|
||||||
headerSize = bb.readShort(),
|
headerSize = bb.readShort(),
|
||||||
@@ -159,12 +159,12 @@ ResourceFinder.prototype.processPackage = function(bb) {
|
|||||||
|
|
||||||
if (typeStrings != headerSize) {
|
if (typeStrings != headerSize) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"TypeStrings must immediately following the package structure header."
|
'TypeStrings must immediately following the package structure header.',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log("Type strings:");
|
console.log('Type strings:');
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastPosition = bb.offset;
|
var lastPosition = bb.offset;
|
||||||
@@ -175,7 +175,7 @@ ResourceFinder.prototype.processPackage = function(bb) {
|
|||||||
|
|
||||||
// Key strings
|
// Key strings
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log("Key strings:");
|
console.log('Key strings:');
|
||||||
}
|
}
|
||||||
|
|
||||||
bb.offset = keyStrings;
|
bb.offset = keyStrings;
|
||||||
@@ -237,7 +237,7 @@ ResourceFinder.prototype.processPackage = function(bb) {
|
|||||||
*
|
*
|
||||||
* @param {ByteBuffer} bb
|
* @param {ByteBuffer} bb
|
||||||
*/
|
*/
|
||||||
ResourceFinder.prototype.processType = function(bb) {
|
ResourceFinder.prototype.processType = function (bb) {
|
||||||
var type = bb.readShort(),
|
var type = bb.readShort(),
|
||||||
headerSize = bb.readShort(),
|
headerSize = bb.readShort(),
|
||||||
size = bb.readInt(),
|
size = bb.readInt(),
|
||||||
@@ -255,7 +255,7 @@ ResourceFinder.prototype.processType = function(bb) {
|
|||||||
bb.offset = headerSize;
|
bb.offset = headerSize;
|
||||||
|
|
||||||
if (headerSize + entryCount * 4 != entriesStart) {
|
if (headerSize + entryCount * 4 != entriesStart) {
|
||||||
throw new Error("HeaderSize, entryCount and entriesStart are not valid.");
|
throw new Error('HeaderSize, entryCount and entriesStart are not valid.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start to get entry indices
|
// Start to get entry indices
|
||||||
@@ -279,11 +279,11 @@ ResourceFinder.prototype.processType = function(bb) {
|
|||||||
value_dataType,
|
value_dataType,
|
||||||
value_data;
|
value_data;
|
||||||
try {
|
try {
|
||||||
entry_size = bb.readShort()
|
entry_size = bb.readShort();
|
||||||
entry_flag = bb.readShort()
|
entry_flag = bb.readShort();
|
||||||
entry_key = bb.readInt()
|
entry_key = bb.readInt();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the value (simple) or map (complex)
|
// Get the value (simple) or map (complex)
|
||||||
@@ -303,11 +303,11 @@ ResourceFinder.prototype.processType = function(bb) {
|
|||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log(
|
console.log(
|
||||||
"Entry 0x" + idStr + ", key: " + keyStr + ", simple value type: "
|
'Entry 0x' + idStr + ', key: ' + keyStr + ', simple value type: ',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
var key = parseInt(idStr, 16);
|
var key = Number.parseInt(idStr, 16);
|
||||||
|
|
||||||
var entryArr = this.entryMap[key];
|
var entryArr = this.entryMap[key];
|
||||||
if (entryArr == null) {
|
if (entryArr == null) {
|
||||||
@@ -321,20 +321,20 @@ ResourceFinder.prototype.processType = function(bb) {
|
|||||||
data = this.valueStringPool[value_data];
|
data = this.valueStringPool[value_data];
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log(", data: " + this.valueStringPool[value_data] + "");
|
console.log(', data: ' + this.valueStringPool[value_data] + '');
|
||||||
}
|
}
|
||||||
} else if (value_dataType == TYPE_REFERENCE) {
|
} else if (value_dataType == TYPE_REFERENCE) {
|
||||||
var hexIndex = Number(value_data).toString(16);
|
var hexIndex = Number(value_data).toString(16);
|
||||||
|
|
||||||
refKeys[idStr] = value_data;
|
refKeys[idStr] = value_data;
|
||||||
} else {
|
} else {
|
||||||
data = "" + value_data;
|
data = '' + value_data;
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log(", data: " + value_data + "");
|
console.log(', data: ' + value_data + '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.putIntoMap("@" + idStr, data);
|
this.putIntoMap('@' + idStr, data);
|
||||||
} else {
|
} else {
|
||||||
// Complex case
|
// Complex case
|
||||||
var entry_parent = bb.readInt();
|
var entry_parent = bb.readInt();
|
||||||
@@ -350,26 +350,22 @@ ResourceFinder.prototype.processType = function(bb) {
|
|||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log(
|
console.log(
|
||||||
"Entry 0x" +
|
'Entry 0x' +
|
||||||
Number(resource_id).toString(16) +
|
Number(resource_id).toString(16) +
|
||||||
", key: " +
|
', key: ' +
|
||||||
this.keyStringPool[entry_key] +
|
this.keyStringPool[entry_key] +
|
||||||
", complex value, not printed."
|
', complex value, not printed.',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var refK in refKeys) {
|
for (var refK in refKeys) {
|
||||||
var values = this.responseMap[
|
var values =
|
||||||
"@" +
|
this.responseMap['@' + Number(refKeys[refK]).toString(16).toUpperCase()];
|
||||||
Number(refKeys[refK])
|
|
||||||
.toString(16)
|
|
||||||
.toUpperCase()
|
|
||||||
];
|
|
||||||
if (values != null && Object.keys(values).length < 1000) {
|
if (values != null && Object.keys(values).length < 1000) {
|
||||||
for (var value in values) {
|
for (var value in values) {
|
||||||
this.putIntoMap("@" + refK, values[value]);
|
this.putIntoMap('@' + refK, values[value]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -380,7 +376,7 @@ ResourceFinder.prototype.processType = function(bb) {
|
|||||||
* @param {ByteBuffer} bb
|
* @param {ByteBuffer} bb
|
||||||
* @return {Array}
|
* @return {Array}
|
||||||
*/
|
*/
|
||||||
ResourceFinder.prototype.processStringPool = function(bb) {
|
ResourceFinder.prototype.processStringPool = (bb) => {
|
||||||
// String pool structure
|
// String pool structure
|
||||||
//
|
//
|
||||||
var type = bb.readShort(),
|
var type = bb.readShort(),
|
||||||
@@ -407,7 +403,7 @@ ResourceFinder.prototype.processStringPool = function(bb) {
|
|||||||
var pos = stringsStart + offsets[i];
|
var pos = stringsStart + offsets[i];
|
||||||
bb.offset = pos;
|
bb.offset = pos;
|
||||||
|
|
||||||
strings[i] = "";
|
strings[i] = '';
|
||||||
|
|
||||||
if (isUTF_8) {
|
if (isUTF_8) {
|
||||||
u16len = bb.readUint8();
|
u16len = bb.readUint8();
|
||||||
@@ -424,15 +420,15 @@ ResourceFinder.prototype.processStringPool = function(bb) {
|
|||||||
if (u8len > 0) {
|
if (u8len > 0) {
|
||||||
buffer = ResourceFinder.readBytes(bb, u8len);
|
buffer = ResourceFinder.readBytes(bb, u8len);
|
||||||
try {
|
try {
|
||||||
strings[i] = ByteBuffer.wrap(buffer, "utf8", true).toString("utf8");
|
strings[i] = ByteBuffer.wrap(buffer, 'utf8', true).toString('utf8');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
console.log("Error when turning buffer to utf-8 string.");
|
console.log('Error when turning buffer to utf-8 string.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strings[i] = "";
|
strings[i] = '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
u16len = bb.readUint16();
|
u16len = bb.readUint16();
|
||||||
@@ -445,18 +441,18 @@ ResourceFinder.prototype.processStringPool = function(bb) {
|
|||||||
var len = u16len * 2;
|
var len = u16len * 2;
|
||||||
buffer = ResourceFinder.readBytes(bb, len);
|
buffer = ResourceFinder.readBytes(bb, len);
|
||||||
try {
|
try {
|
||||||
strings[i] = ByteBuffer.wrap(buffer, "utf8", true).toString("utf8");
|
strings[i] = ByteBuffer.wrap(buffer, 'utf8', true).toString('utf8');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
console.log("Error when turning buffer to utf-8 string.");
|
console.log('Error when turning buffer to utf-8 string.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log("Parsed value: {0}", strings[i]);
|
console.log('Parsed value: {0}', strings[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,7 +463,7 @@ ResourceFinder.prototype.processStringPool = function(bb) {
|
|||||||
*
|
*
|
||||||
* @param {ByteBuffer} bb
|
* @param {ByteBuffer} bb
|
||||||
*/
|
*/
|
||||||
ResourceFinder.prototype.processTypeSpec = function(bb) {
|
ResourceFinder.prototype.processTypeSpec = function (bb) {
|
||||||
var type = bb.readShort(),
|
var type = bb.readShort(),
|
||||||
headerSize = bb.readShort(),
|
headerSize = bb.readShort(),
|
||||||
size = bb.readInt(),
|
size = bb.readInt(),
|
||||||
@@ -477,7 +473,7 @@ ResourceFinder.prototype.processTypeSpec = function(bb) {
|
|||||||
entryCount = bb.readInt();
|
entryCount = bb.readInt();
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log("Processing type spec " + this.typeStringPool[id - 1] + "...");
|
console.log('Processing type spec ' + this.typeStringPool[id - 1] + '...');
|
||||||
}
|
}
|
||||||
|
|
||||||
var flags = new Array(entryCount);
|
var flags = new Array(entryCount);
|
||||||
@@ -487,12 +483,12 @@ ResourceFinder.prototype.processTypeSpec = function(bb) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ResourceFinder.prototype.putIntoMap = function(resId, value) {
|
ResourceFinder.prototype.putIntoMap = function (resId, value) {
|
||||||
if (this.responseMap[resId.toUpperCase()] == null) {
|
if (this.responseMap[resId.toUpperCase()] == null) {
|
||||||
this.responseMap[resId.toUpperCase()] = []
|
this.responseMap[resId.toUpperCase()] = [];
|
||||||
}
|
}
|
||||||
if(value){
|
if (value) {
|
||||||
this.responseMap[resId.toUpperCase()].push(value)
|
this.responseMap[resId.toUpperCase()].push(value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,27 @@
|
|||||||
function objectType (o) {
|
function objectType(o) {
|
||||||
return Object.prototype.toString.call(o).slice(8, -1).toLowerCase()
|
return Object.prototype.toString.call(o).slice(8, -1).toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
function isArray (o) {
|
function isArray(o) {
|
||||||
return objectType(o) === 'array'
|
return objectType(o) === 'array';
|
||||||
}
|
}
|
||||||
|
|
||||||
function isObject (o) {
|
function isObject(o) {
|
||||||
return objectType(o) === 'object'
|
return objectType(o) === 'object';
|
||||||
}
|
}
|
||||||
|
|
||||||
function isPrimitive (o) {
|
function isPrimitive(o) {
|
||||||
return o === null || ['boolean', 'number', 'string', 'undefined'].includes(objectType(o))
|
return (
|
||||||
|
o === null ||
|
||||||
|
['boolean', 'number', 'string', 'undefined'].includes(objectType(o))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isBrowser () {
|
function isBrowser() {
|
||||||
return (
|
return (
|
||||||
typeof process === 'undefined' ||
|
typeof process === 'undefined' ||
|
||||||
Object.prototype.toString.call(process) !== '[object process]'
|
Object.prototype.toString.call(process) !== '[object process]'
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,48 +29,48 @@ function isBrowser () {
|
|||||||
* @param {Object} apkInfo // json info parsed from .apk file
|
* @param {Object} apkInfo // json info parsed from .apk file
|
||||||
* @param {Object} resourceMap // resourceMap
|
* @param {Object} resourceMap // resourceMap
|
||||||
*/
|
*/
|
||||||
function mapInfoResource (apkInfo, resourceMap) {
|
function mapInfoResource(apkInfo, resourceMap) {
|
||||||
iteratorObj(apkInfo)
|
iteratorObj(apkInfo);
|
||||||
return apkInfo
|
return apkInfo;
|
||||||
function iteratorObj (obj) {
|
function iteratorObj(obj) {
|
||||||
for (const i in obj) {
|
for (const i in obj) {
|
||||||
if (isArray(obj[i])) {
|
if (isArray(obj[i])) {
|
||||||
iteratorArray(obj[i])
|
iteratorArray(obj[i]);
|
||||||
} else if (isObject(obj[i])) {
|
} else if (isObject(obj[i])) {
|
||||||
iteratorObj(obj[i])
|
iteratorObj(obj[i]);
|
||||||
} else if (isPrimitive(obj[i])) {
|
} else if (isPrimitive(obj[i])) {
|
||||||
if (isResources(obj[i])) {
|
if (isResources(obj[i])) {
|
||||||
obj[i] = resourceMap[transKeyToMatchResourceMap(obj[i])]
|
obj[i] = resourceMap[transKeyToMatchResourceMap(obj[i])];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function iteratorArray (array) {
|
function iteratorArray(array) {
|
||||||
const l = array.length
|
const l = array.length;
|
||||||
for (let i = 0; i < l; i++) {
|
for (let i = 0; i < l; i++) {
|
||||||
if (isArray(array[i])) {
|
if (isArray(array[i])) {
|
||||||
iteratorArray(array[i])
|
iteratorArray(array[i]);
|
||||||
} else if (isObject(array[i])) {
|
} else if (isObject(array[i])) {
|
||||||
iteratorObj(array[i])
|
iteratorObj(array[i]);
|
||||||
} else if (isPrimitive(array[i])) {
|
} else if (isPrimitive(array[i])) {
|
||||||
if (isResources(array[i])) {
|
if (isResources(array[i])) {
|
||||||
array[i] = resourceMap[transKeyToMatchResourceMap(array[i])]
|
array[i] = resourceMap[transKeyToMatchResourceMap(array[i])];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isResources (attrValue) {
|
function isResources(attrValue) {
|
||||||
if (!attrValue) return false
|
if (!attrValue) return false;
|
||||||
if (typeof attrValue !== 'string') {
|
if (typeof attrValue !== 'string') {
|
||||||
attrValue = attrValue.toString()
|
attrValue = attrValue.toString();
|
||||||
}
|
}
|
||||||
return attrValue.indexOf('resourceId:') === 0
|
return attrValue.indexOf('resourceId:') === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function transKeyToMatchResourceMap (resourceId) {
|
function transKeyToMatchResourceMap(resourceId) {
|
||||||
return '@' + resourceId.replace('resourceId:0x', '').toUpperCase()
|
return '@' + resourceId.replace('resourceId:0x', '').toUpperCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,62 +78,64 @@ function mapInfoResource (apkInfo, resourceMap) {
|
|||||||
* find .apk file's icon path from json info
|
* find .apk file's icon path from json info
|
||||||
* @param info // json info parsed from .apk file
|
* @param info // json info parsed from .apk file
|
||||||
*/
|
*/
|
||||||
function findApkIconPath (info) {
|
function findApkIconPath(info) {
|
||||||
if (!info.application.icon || !info.application.icon.splice) {
|
if (!info.application.icon || !info.application.icon.splice) {
|
||||||
return ''
|
return '';
|
||||||
}
|
}
|
||||||
const rulesMap = {
|
const rulesMap = {
|
||||||
mdpi: 48,
|
mdpi: 48,
|
||||||
hdpi: 72,
|
hdpi: 72,
|
||||||
xhdpi: 96,
|
xhdpi: 96,
|
||||||
xxdpi: 144,
|
xxdpi: 144,
|
||||||
xxxhdpi: 192
|
xxxhdpi: 192,
|
||||||
}
|
};
|
||||||
const resultMap = {}
|
const resultMap = {};
|
||||||
const maxDpiIcon = { dpi: 120, icon: '' }
|
const maxDpiIcon = { dpi: 120, icon: '' };
|
||||||
|
|
||||||
for (const i in rulesMap) {
|
for (const i in rulesMap) {
|
||||||
info.application.icon.some((icon) => {
|
info.application.icon.some((icon) => {
|
||||||
if (icon && icon.indexOf(i) !== -1) {
|
if (icon && icon.indexOf(i) !== -1) {
|
||||||
resultMap['application-icon-' + rulesMap[i]] = icon
|
resultMap['application-icon-' + rulesMap[i]] = icon;
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
// get the maximal size icon
|
// get the maximal size icon
|
||||||
if (
|
if (
|
||||||
resultMap['application-icon-' + rulesMap[i]] &&
|
resultMap['application-icon-' + rulesMap[i]] &&
|
||||||
rulesMap[i] >= maxDpiIcon.dpi
|
rulesMap[i] >= maxDpiIcon.dpi
|
||||||
) {
|
) {
|
||||||
maxDpiIcon.dpi = rulesMap[i]
|
maxDpiIcon.dpi = rulesMap[i];
|
||||||
maxDpiIcon.icon = resultMap['application-icon-' + rulesMap[i]]
|
maxDpiIcon.icon = resultMap['application-icon-' + rulesMap[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Object.keys(resultMap).length === 0 || !maxDpiIcon.icon) {
|
if (Object.keys(resultMap).length === 0 || !maxDpiIcon.icon) {
|
||||||
maxDpiIcon.dpi = 120
|
maxDpiIcon.dpi = 120;
|
||||||
maxDpiIcon.icon = info.application.icon[0] || ''
|
maxDpiIcon.icon = info.application.icon[0] || '';
|
||||||
resultMap['applicataion-icon-120'] = maxDpiIcon.icon
|
resultMap['applicataion-icon-120'] = maxDpiIcon.icon;
|
||||||
}
|
}
|
||||||
return maxDpiIcon.icon
|
return maxDpiIcon.icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* find .ipa file's icon path from json info
|
* find .ipa file's icon path from json info
|
||||||
* @param info // json info parsed from .ipa file
|
* @param info // json info parsed from .ipa file
|
||||||
*/
|
*/
|
||||||
function findIpaIconPath (info) {
|
function findIpaIconPath(info) {
|
||||||
if (
|
if (
|
||||||
info.CFBundleIcons &&
|
info.CFBundleIcons &&
|
||||||
info.CFBundleIcons.CFBundlePrimaryIcon &&
|
info.CFBundleIcons.CFBundlePrimaryIcon &&
|
||||||
info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles &&
|
info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles &&
|
||||||
info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length
|
info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length
|
||||||
) {
|
) {
|
||||||
return info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles[info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length - 1]
|
return info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles[
|
||||||
|
info.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length - 1
|
||||||
|
];
|
||||||
} else if (info.CFBundleIconFiles && info.CFBundleIconFiles.length) {
|
} else if (info.CFBundleIconFiles && info.CFBundleIconFiles.length) {
|
||||||
return info.CFBundleIconFiles[info.CFBundleIconFiles.length - 1]
|
return info.CFBundleIconFiles[info.CFBundleIconFiles.length - 1];
|
||||||
} else {
|
} else {
|
||||||
return '.app/Icon.png'
|
return '.app/Icon.png';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,20 +143,20 @@ function findIpaIconPath (info) {
|
|||||||
* transform buffer to base64
|
* transform buffer to base64
|
||||||
* @param {Buffer} buffer
|
* @param {Buffer} buffer
|
||||||
*/
|
*/
|
||||||
function getBase64FromBuffer (buffer) {
|
function getBase64FromBuffer(buffer) {
|
||||||
return 'data:image/png;base64,' + buffer.toString('base64')
|
return 'data:image/png;base64,' + buffer.toString('base64');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 去除unicode空字符
|
* 去除unicode空字符
|
||||||
* @param {String} str
|
* @param {String} str
|
||||||
*/
|
*/
|
||||||
function decodeNullUnicode (str) {
|
function decodeNullUnicode(str) {
|
||||||
if (typeof str === 'string') {
|
if (typeof str === 'string') {
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
str = str.replace(/\u0000/g, '')
|
str = str.replace(/\u0000/g, '');
|
||||||
}
|
}
|
||||||
return str
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -163,5 +168,5 @@ module.exports = {
|
|||||||
findApkIconPath,
|
findApkIconPath,
|
||||||
findIpaIconPath,
|
findIpaIconPath,
|
||||||
getBase64FromBuffer,
|
getBase64FromBuffer,
|
||||||
decodeNullUnicode
|
decodeNullUnicode,
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
const NodeType = {
|
const NodeType = {
|
||||||
ELEMENT_NODE: 1,
|
ELEMENT_NODE: 1,
|
||||||
ATTRIBUTE_NODE: 2,
|
ATTRIBUTE_NODE: 2,
|
||||||
CDATA_SECTION_NODE: 4
|
CDATA_SECTION_NODE: 4,
|
||||||
}
|
};
|
||||||
|
|
||||||
const ChunkType = {
|
const ChunkType = {
|
||||||
NULL: 0x0000,
|
NULL: 0x0000,
|
||||||
@@ -20,13 +20,13 @@ const ChunkType = {
|
|||||||
XML_RESOURCE_MAP: 0x0180,
|
XML_RESOURCE_MAP: 0x0180,
|
||||||
TABLE_PACKAGE: 0x0200,
|
TABLE_PACKAGE: 0x0200,
|
||||||
TABLE_TYPE: 0x0201,
|
TABLE_TYPE: 0x0201,
|
||||||
TABLE_TYPE_SPEC: 0x0202
|
TABLE_TYPE_SPEC: 0x0202,
|
||||||
}
|
};
|
||||||
|
|
||||||
const StringFlags = {
|
const StringFlags = {
|
||||||
SORTED: 1 << 0,
|
SORTED: 1 << 0,
|
||||||
UTF8: 1 << 8
|
UTF8: 1 << 8,
|
||||||
}
|
};
|
||||||
|
|
||||||
// Taken from android.util.TypedValue
|
// Taken from android.util.TypedValue
|
||||||
const TypedValue = {
|
const TypedValue = {
|
||||||
@@ -67,381 +67,390 @@ const TypedValue = {
|
|||||||
TYPE_LAST_INT: 0x0000001f,
|
TYPE_LAST_INT: 0x0000001f,
|
||||||
TYPE_NULL: 0x00000000,
|
TYPE_NULL: 0x00000000,
|
||||||
TYPE_REFERENCE: 0x00000001,
|
TYPE_REFERENCE: 0x00000001,
|
||||||
TYPE_STRING: 0x00000003
|
TYPE_STRING: 0x00000003,
|
||||||
}
|
};
|
||||||
|
|
||||||
class BinaryXmlParser {
|
class BinaryXmlParser {
|
||||||
constructor (buffer, options = {}) {
|
constructor(buffer, options = {}) {
|
||||||
this.buffer = buffer
|
this.buffer = buffer;
|
||||||
this.cursor = 0
|
this.cursor = 0;
|
||||||
this.strings = []
|
this.strings = [];
|
||||||
this.resources = []
|
this.resources = [];
|
||||||
this.document = null
|
this.document = null;
|
||||||
this.parent = null
|
this.parent = null;
|
||||||
this.stack = []
|
this.stack = [];
|
||||||
this.debug = options.debug || false
|
this.debug = options.debug || false;
|
||||||
}
|
}
|
||||||
|
|
||||||
readU8 () {
|
readU8() {
|
||||||
this.debug && console.group('readU8')
|
this.debug && console.group('readU8');
|
||||||
this.debug && console.debug('cursor:', this.cursor)
|
this.debug && console.debug('cursor:', this.cursor);
|
||||||
const val = this.buffer[this.cursor]
|
const val = this.buffer[this.cursor];
|
||||||
this.debug && console.debug('value:', val)
|
this.debug && console.debug('value:', val);
|
||||||
this.cursor += 1
|
this.cursor += 1;
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
return val
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
readU16 () {
|
readU16() {
|
||||||
this.debug && console.group('readU16')
|
this.debug && console.group('readU16');
|
||||||
this.debug && console.debug('cursor:', this.cursor)
|
this.debug && console.debug('cursor:', this.cursor);
|
||||||
const val = this.buffer.readUInt16LE(this.cursor)
|
const val = this.buffer.readUInt16LE(this.cursor);
|
||||||
this.debug && console.debug('value:', val)
|
this.debug && console.debug('value:', val);
|
||||||
this.cursor += 2
|
this.cursor += 2;
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
return val
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
readS32 () {
|
readS32() {
|
||||||
this.debug && console.group('readS32')
|
this.debug && console.group('readS32');
|
||||||
this.debug && console.debug('cursor:', this.cursor)
|
this.debug && console.debug('cursor:', this.cursor);
|
||||||
const val = this.buffer.readInt32LE(this.cursor)
|
const val = this.buffer.readInt32LE(this.cursor);
|
||||||
this.debug && console.debug('value:', val)
|
this.debug && console.debug('value:', val);
|
||||||
this.cursor += 4
|
this.cursor += 4;
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
return val
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
readU32 () {
|
readU32() {
|
||||||
this.debug && console.group('readU32')
|
this.debug && console.group('readU32');
|
||||||
this.debug && console.debug('cursor:', this.cursor)
|
this.debug && console.debug('cursor:', this.cursor);
|
||||||
const val = this.buffer.readUInt32LE(this.cursor)
|
const val = this.buffer.readUInt32LE(this.cursor);
|
||||||
this.debug && console.debug('value:', val)
|
this.debug && console.debug('value:', val);
|
||||||
this.cursor += 4
|
this.cursor += 4;
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
return val
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
readLength8 () {
|
readLength8() {
|
||||||
this.debug && console.group('readLength8')
|
this.debug && console.group('readLength8');
|
||||||
let len = this.readU8()
|
let len = this.readU8();
|
||||||
if (len & 0x80) {
|
if (len & 0x80) {
|
||||||
len = (len & 0x7f) << 8
|
len = (len & 0x7f) << 8;
|
||||||
len += this.readU8()
|
len += this.readU8();
|
||||||
}
|
}
|
||||||
this.debug && console.debug('length:', len)
|
this.debug && console.debug('length:', len);
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
return len
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
readLength16 () {
|
readLength16() {
|
||||||
this.debug && console.group('readLength16')
|
this.debug && console.group('readLength16');
|
||||||
let len = this.readU16()
|
let len = this.readU16();
|
||||||
if (len & 0x8000) {
|
if (len & 0x8000) {
|
||||||
len = (len & 0x7fff) << 16
|
len = (len & 0x7fff) << 16;
|
||||||
len += this.readU16()
|
len += this.readU16();
|
||||||
}
|
}
|
||||||
this.debug && console.debug('length:', len)
|
this.debug && console.debug('length:', len);
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
return len
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
readDimension () {
|
readDimension() {
|
||||||
this.debug && console.group('readDimension')
|
this.debug && console.group('readDimension');
|
||||||
|
|
||||||
const dimension = {
|
const dimension = {
|
||||||
value: null,
|
value: null,
|
||||||
unit: null,
|
unit: null,
|
||||||
rawUnit: null
|
rawUnit: null,
|
||||||
}
|
};
|
||||||
|
|
||||||
const value = this.readU32()
|
const value = this.readU32();
|
||||||
const unit = dimension.value & 0xff
|
const unit = dimension.value & 0xff;
|
||||||
|
|
||||||
dimension.value = value >> 8
|
dimension.value = value >> 8;
|
||||||
dimension.rawUnit = unit
|
dimension.rawUnit = unit;
|
||||||
|
|
||||||
switch (unit) {
|
switch (unit) {
|
||||||
case TypedValue.COMPLEX_UNIT_MM:
|
case TypedValue.COMPLEX_UNIT_MM:
|
||||||
dimension.unit = 'mm'
|
dimension.unit = 'mm';
|
||||||
break
|
break;
|
||||||
case TypedValue.COMPLEX_UNIT_PX:
|
case TypedValue.COMPLEX_UNIT_PX:
|
||||||
dimension.unit = 'px'
|
dimension.unit = 'px';
|
||||||
break
|
break;
|
||||||
case TypedValue.COMPLEX_UNIT_DIP:
|
case TypedValue.COMPLEX_UNIT_DIP:
|
||||||
dimension.unit = 'dp'
|
dimension.unit = 'dp';
|
||||||
break
|
break;
|
||||||
case TypedValue.COMPLEX_UNIT_SP:
|
case TypedValue.COMPLEX_UNIT_SP:
|
||||||
dimension.unit = 'sp'
|
dimension.unit = 'sp';
|
||||||
break
|
break;
|
||||||
case TypedValue.COMPLEX_UNIT_PT:
|
case TypedValue.COMPLEX_UNIT_PT:
|
||||||
dimension.unit = 'pt'
|
dimension.unit = 'pt';
|
||||||
break
|
break;
|
||||||
case TypedValue.COMPLEX_UNIT_IN:
|
case TypedValue.COMPLEX_UNIT_IN:
|
||||||
dimension.unit = 'in'
|
dimension.unit = 'in';
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
|
|
||||||
return dimension
|
return dimension;
|
||||||
}
|
}
|
||||||
|
|
||||||
readFraction () {
|
readFraction() {
|
||||||
this.debug && console.group('readFraction')
|
this.debug && console.group('readFraction');
|
||||||
|
|
||||||
const fraction = {
|
const fraction = {
|
||||||
value: null,
|
value: null,
|
||||||
type: null,
|
type: null,
|
||||||
rawType: null
|
rawType: null,
|
||||||
}
|
};
|
||||||
|
|
||||||
const value = this.readU32()
|
const value = this.readU32();
|
||||||
const type = value & 0xf
|
const type = value & 0xf;
|
||||||
|
|
||||||
fraction.value = this.convertIntToFloat(value >> 4)
|
fraction.value = this.convertIntToFloat(value >> 4);
|
||||||
fraction.rawType = type
|
fraction.rawType = type;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TypedValue.COMPLEX_UNIT_FRACTION:
|
case TypedValue.COMPLEX_UNIT_FRACTION:
|
||||||
fraction.type = '%'
|
fraction.type = '%';
|
||||||
break
|
break;
|
||||||
case TypedValue.COMPLEX_UNIT_FRACTION_PARENT:
|
case TypedValue.COMPLEX_UNIT_FRACTION_PARENT:
|
||||||
fraction.type = '%p'
|
fraction.type = '%p';
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
|
|
||||||
return fraction
|
return fraction;
|
||||||
}
|
}
|
||||||
|
|
||||||
readHex24 () {
|
readHex24() {
|
||||||
this.debug && console.group('readHex24')
|
this.debug && console.group('readHex24');
|
||||||
var val = (this.readU32() & 0xffffff).toString(16)
|
var val = (this.readU32() & 0xffffff).toString(16);
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
return val
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
readHex32 () {
|
readHex32() {
|
||||||
this.debug && console.group('readHex32')
|
this.debug && console.group('readHex32');
|
||||||
var val = this.readU32().toString(16)
|
var val = this.readU32().toString(16);
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
return val
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
readTypedValue () {
|
readTypedValue() {
|
||||||
this.debug && console.group('readTypedValue')
|
this.debug && console.group('readTypedValue');
|
||||||
|
|
||||||
const typedValue = {
|
const typedValue = {
|
||||||
value: null,
|
value: null,
|
||||||
type: null,
|
type: null,
|
||||||
rawType: null
|
rawType: null,
|
||||||
}
|
};
|
||||||
|
|
||||||
const start = this.cursor
|
const start = this.cursor;
|
||||||
|
|
||||||
let size = this.readU16()
|
let size = this.readU16();
|
||||||
/* const zero = */ this.readU8()
|
/* const zero = */ this.readU8();
|
||||||
const dataType = this.readU8()
|
const dataType = this.readU8();
|
||||||
|
|
||||||
// Yes, there has been a real world APK where the size is malformed.
|
// Yes, there has been a real world APK where the size is malformed.
|
||||||
if (size === 0) {
|
if (size === 0) {
|
||||||
size = 8
|
size = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedValue.rawType = dataType
|
typedValue.rawType = dataType;
|
||||||
|
|
||||||
switch (dataType) {
|
switch (dataType) {
|
||||||
case TypedValue.TYPE_INT_DEC:
|
case TypedValue.TYPE_INT_DEC:
|
||||||
typedValue.value = this.readS32()
|
typedValue.value = this.readS32();
|
||||||
typedValue.type = 'int_dec'
|
typedValue.type = 'int_dec';
|
||||||
break
|
break;
|
||||||
case TypedValue.TYPE_INT_HEX:
|
case TypedValue.TYPE_INT_HEX:
|
||||||
typedValue.value = this.readS32()
|
typedValue.value = this.readS32();
|
||||||
typedValue.type = 'int_hex'
|
typedValue.type = 'int_hex';
|
||||||
break
|
break;
|
||||||
case TypedValue.TYPE_STRING:
|
case TypedValue.TYPE_STRING:
|
||||||
var ref = this.readS32()
|
var ref = this.readS32();
|
||||||
typedValue.value = ref > 0 ? this.strings[ref] : ''
|
typedValue.value = ref > 0 ? this.strings[ref] : '';
|
||||||
typedValue.type = 'string'
|
typedValue.type = 'string';
|
||||||
break
|
break;
|
||||||
case TypedValue.TYPE_REFERENCE:
|
case TypedValue.TYPE_REFERENCE:
|
||||||
var id = this.readU32()
|
var id = this.readU32();
|
||||||
typedValue.value = `resourceId:0x${id.toString(16)}`
|
typedValue.value = `resourceId:0x${id.toString(16)}`;
|
||||||
typedValue.type = 'reference'
|
typedValue.type = 'reference';
|
||||||
break
|
break;
|
||||||
case TypedValue.TYPE_INT_BOOLEAN:
|
case TypedValue.TYPE_INT_BOOLEAN:
|
||||||
typedValue.value = this.readS32() !== 0
|
typedValue.value = this.readS32() !== 0;
|
||||||
typedValue.type = 'boolean'
|
typedValue.type = 'boolean';
|
||||||
break
|
break;
|
||||||
case TypedValue.TYPE_NULL:
|
case TypedValue.TYPE_NULL:
|
||||||
this.readU32()
|
this.readU32();
|
||||||
typedValue.value = null
|
typedValue.value = null;
|
||||||
typedValue.type = 'null'
|
typedValue.type = 'null';
|
||||||
break
|
break;
|
||||||
case TypedValue.TYPE_INT_COLOR_RGB8:
|
case TypedValue.TYPE_INT_COLOR_RGB8:
|
||||||
typedValue.value = this.readHex24()
|
typedValue.value = this.readHex24();
|
||||||
typedValue.type = 'rgb8'
|
typedValue.type = 'rgb8';
|
||||||
break
|
break;
|
||||||
case TypedValue.TYPE_INT_COLOR_RGB4:
|
case TypedValue.TYPE_INT_COLOR_RGB4:
|
||||||
typedValue.value = this.readHex24()
|
typedValue.value = this.readHex24();
|
||||||
typedValue.type = 'rgb4'
|
typedValue.type = 'rgb4';
|
||||||
break
|
break;
|
||||||
case TypedValue.TYPE_INT_COLOR_ARGB8:
|
case TypedValue.TYPE_INT_COLOR_ARGB8:
|
||||||
typedValue.value = this.readHex32()
|
typedValue.value = this.readHex32();
|
||||||
typedValue.type = 'argb8'
|
typedValue.type = 'argb8';
|
||||||
break
|
break;
|
||||||
case TypedValue.TYPE_INT_COLOR_ARGB4:
|
case TypedValue.TYPE_INT_COLOR_ARGB4:
|
||||||
typedValue.value = this.readHex32()
|
typedValue.value = this.readHex32();
|
||||||
typedValue.type = 'argb4'
|
typedValue.type = 'argb4';
|
||||||
break
|
break;
|
||||||
case TypedValue.TYPE_DIMENSION:
|
case TypedValue.TYPE_DIMENSION:
|
||||||
typedValue.value = this.readDimension()
|
typedValue.value = this.readDimension();
|
||||||
typedValue.type = 'dimension'
|
typedValue.type = 'dimension';
|
||||||
break
|
break;
|
||||||
case TypedValue.TYPE_FRACTION:
|
case TypedValue.TYPE_FRACTION:
|
||||||
typedValue.value = this.readFraction()
|
typedValue.value = this.readFraction();
|
||||||
typedValue.type = 'fraction'
|
typedValue.type = 'fraction';
|
||||||
break
|
break;
|
||||||
default: {
|
default: {
|
||||||
const type = dataType.toString(16)
|
const type = dataType.toString(16);
|
||||||
console.debug(`Not sure what to do with typed value of type 0x${type}, falling back to reading an uint32.`)
|
console.debug(
|
||||||
typedValue.value = this.readU32()
|
`Not sure what to do with typed value of type 0x${type}, falling back to reading an uint32.`,
|
||||||
typedValue.type = 'unknown'
|
);
|
||||||
|
typedValue.value = this.readU32();
|
||||||
|
typedValue.type = 'unknown';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure we consume the whole value
|
// Ensure we consume the whole value
|
||||||
const end = start + size
|
const end = start + size;
|
||||||
if (this.cursor !== end) {
|
if (this.cursor !== end) {
|
||||||
const type = dataType.toString(16)
|
const type = dataType.toString(16);
|
||||||
const diff = end - this.cursor
|
const diff = end - this.cursor;
|
||||||
console.debug(`Cursor is off by ${diff} bytes at ${this.cursor} at supposed end \
|
console.debug(`Cursor is off by ${diff} bytes at ${this.cursor} at supposed end \
|
||||||
of typed value of type 0x${type}. The typed value started at offset ${start} \
|
of typed value of type 0x${type}. The typed value started at offset ${start} \
|
||||||
and is supposed to end at offset ${end}. Ignoring the rest of the value.`)
|
and is supposed to end at offset ${end}. Ignoring the rest of the value.`);
|
||||||
this.cursor = end
|
this.cursor = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
|
|
||||||
return typedValue
|
return typedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://twitter.com/kawasima/status/427730289201139712
|
// https://twitter.com/kawasima/status/427730289201139712
|
||||||
convertIntToFloat (int) {
|
convertIntToFloat(int) {
|
||||||
const buf = new ArrayBuffer(4)
|
const buf = new ArrayBuffer(4);
|
||||||
;(new Int32Array(buf))[0] = int
|
new Int32Array(buf)[0] = int;
|
||||||
return (new Float32Array(buf))[0]
|
return new Float32Array(buf)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
readString (encoding) {
|
readString(encoding) {
|
||||||
this.debug && console.group('readString', encoding)
|
this.debug && console.group('readString', encoding);
|
||||||
switch (encoding) {
|
switch (encoding) {
|
||||||
case 'utf-8':
|
case 'utf-8':
|
||||||
var stringLength = this.readLength8(encoding)
|
var stringLength = this.readLength8(encoding);
|
||||||
this.debug && console.debug('stringLength:', stringLength)
|
this.debug && console.debug('stringLength:', stringLength);
|
||||||
var byteLength = this.readLength8(encoding)
|
var byteLength = this.readLength8(encoding);
|
||||||
this.debug && console.debug('byteLength:', byteLength)
|
this.debug && console.debug('byteLength:', byteLength);
|
||||||
var value = this.buffer.toString(encoding, this.cursor, (this.cursor += byteLength))
|
var value = this.buffer.toString(
|
||||||
this.debug && console.debug('value:', value)
|
encoding,
|
||||||
this.debug && console.groupEnd()
|
this.cursor,
|
||||||
return value
|
(this.cursor += byteLength),
|
||||||
|
);
|
||||||
|
this.debug && console.debug('value:', value);
|
||||||
|
this.debug && console.groupEnd();
|
||||||
|
return value;
|
||||||
case 'ucs2':
|
case 'ucs2':
|
||||||
stringLength = this.readLength16(encoding)
|
stringLength = this.readLength16(encoding);
|
||||||
this.debug && console.debug('stringLength:', stringLength)
|
this.debug && console.debug('stringLength:', stringLength);
|
||||||
byteLength = stringLength * 2
|
byteLength = stringLength * 2;
|
||||||
this.debug && console.debug('byteLength:', byteLength)
|
this.debug && console.debug('byteLength:', byteLength);
|
||||||
value = this.buffer.toString(encoding, this.cursor, (this.cursor += byteLength))
|
value = this.buffer.toString(
|
||||||
this.debug && console.debug('value:', value)
|
encoding,
|
||||||
this.debug && console.groupEnd()
|
this.cursor,
|
||||||
return value
|
(this.cursor += byteLength),
|
||||||
|
);
|
||||||
|
this.debug && console.debug('value:', value);
|
||||||
|
this.debug && console.groupEnd();
|
||||||
|
return value;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unsupported encoding '${encoding}'`)
|
throw new Error(`Unsupported encoding '${encoding}'`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
readChunkHeader () {
|
readChunkHeader() {
|
||||||
this.debug && console.group('readChunkHeader')
|
this.debug && console.group('readChunkHeader');
|
||||||
var header = {
|
var header = {
|
||||||
startOffset: this.cursor,
|
startOffset: this.cursor,
|
||||||
chunkType: this.readU16(),
|
chunkType: this.readU16(),
|
||||||
headerSize: this.readU16(),
|
headerSize: this.readU16(),
|
||||||
chunkSize: this.readU32()
|
chunkSize: this.readU32(),
|
||||||
}
|
};
|
||||||
this.debug && console.debug('startOffset:', header.startOffset)
|
this.debug && console.debug('startOffset:', header.startOffset);
|
||||||
this.debug && console.debug('chunkType:', header.chunkType)
|
this.debug && console.debug('chunkType:', header.chunkType);
|
||||||
this.debug && console.debug('headerSize:', header.headerSize)
|
this.debug && console.debug('headerSize:', header.headerSize);
|
||||||
this.debug && console.debug('chunkSize:', header.chunkSize)
|
this.debug && console.debug('chunkSize:', header.chunkSize);
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
return header
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
readStringPool (header) {
|
readStringPool(header) {
|
||||||
this.debug && console.group('readStringPool')
|
this.debug && console.group('readStringPool');
|
||||||
|
|
||||||
header.stringCount = this.readU32()
|
header.stringCount = this.readU32();
|
||||||
this.debug && console.debug('stringCount:', header.stringCount)
|
this.debug && console.debug('stringCount:', header.stringCount);
|
||||||
header.styleCount = this.readU32()
|
header.styleCount = this.readU32();
|
||||||
this.debug && console.debug('styleCount:', header.styleCount)
|
this.debug && console.debug('styleCount:', header.styleCount);
|
||||||
header.flags = this.readU32()
|
header.flags = this.readU32();
|
||||||
this.debug && console.debug('flags:', header.flags)
|
this.debug && console.debug('flags:', header.flags);
|
||||||
header.stringsStart = this.readU32()
|
header.stringsStart = this.readU32();
|
||||||
this.debug && console.debug('stringsStart:', header.stringsStart)
|
this.debug && console.debug('stringsStart:', header.stringsStart);
|
||||||
header.stylesStart = this.readU32()
|
header.stylesStart = this.readU32();
|
||||||
this.debug && console.debug('stylesStart:', header.stylesStart)
|
this.debug && console.debug('stylesStart:', header.stylesStart);
|
||||||
|
|
||||||
if (header.chunkType !== ChunkType.STRING_POOL) {
|
if (header.chunkType !== ChunkType.STRING_POOL) {
|
||||||
throw new Error('Invalid string pool header')
|
throw new Error('Invalid string pool header');
|
||||||
}
|
}
|
||||||
|
|
||||||
const offsets = []
|
const offsets = [];
|
||||||
for (let i = 0, l = header.stringCount; i < l; ++i) {
|
for (let i = 0, l = header.stringCount; i < l; ++i) {
|
||||||
this.debug && console.debug('offset:', i)
|
this.debug && console.debug('offset:', i);
|
||||||
offsets.push(this.readU32())
|
offsets.push(this.readU32());
|
||||||
}
|
}
|
||||||
|
|
||||||
const sorted = (header.flags & StringFlags.SORTED) === StringFlags.SORTED
|
const sorted = (header.flags & StringFlags.SORTED) === StringFlags.SORTED;
|
||||||
this.debug && console.debug('sorted:', sorted)
|
this.debug && console.debug('sorted:', sorted);
|
||||||
const encoding = (header.flags & StringFlags.UTF8) === StringFlags.UTF8
|
const encoding =
|
||||||
? 'utf-8'
|
(header.flags & StringFlags.UTF8) === StringFlags.UTF8 ? 'utf-8' : 'ucs2';
|
||||||
: 'ucs2'
|
this.debug && console.debug('encoding:', encoding);
|
||||||
this.debug && console.debug('encoding:', encoding)
|
|
||||||
|
|
||||||
const stringsStart = header.startOffset + header.stringsStart
|
const stringsStart = header.startOffset + header.stringsStart;
|
||||||
this.cursor = stringsStart
|
this.cursor = stringsStart;
|
||||||
for (let i = 0, l = header.stringCount; i < l; ++i) {
|
for (let i = 0, l = header.stringCount; i < l; ++i) {
|
||||||
this.debug && console.debug('string:', i)
|
this.debug && console.debug('string:', i);
|
||||||
this.debug && console.debug('offset:', offsets[i])
|
this.debug && console.debug('offset:', offsets[i]);
|
||||||
this.cursor = stringsStart + offsets[i]
|
this.cursor = stringsStart + offsets[i];
|
||||||
this.strings.push(this.readString(encoding))
|
this.strings.push(this.readString(encoding));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip styles
|
// Skip styles
|
||||||
this.cursor = header.startOffset + header.chunkSize
|
this.cursor = header.startOffset + header.chunkSize;
|
||||||
|
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
|
|
||||||
return null
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
readResourceMap (header) {
|
readResourceMap(header) {
|
||||||
this.debug && console.group('readResourceMap')
|
this.debug && console.group('readResourceMap');
|
||||||
const count = Math.floor((header.chunkSize - header.headerSize) / 4)
|
const count = Math.floor((header.chunkSize - header.headerSize) / 4);
|
||||||
for (let i = 0; i < count; ++i) {
|
for (let i = 0; i < count; ++i) {
|
||||||
this.resources.push(this.readU32())
|
this.resources.push(this.readU32());
|
||||||
}
|
}
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
return null
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
readXmlNamespaceStart (/* header */) {
|
readXmlNamespaceStart(/* header */) {
|
||||||
this.debug && console.group('readXmlNamespaceStart')
|
this.debug && console.group('readXmlNamespaceStart');
|
||||||
|
|
||||||
/* const line = */ this.readU32()
|
/* const line = */ this.readU32();
|
||||||
/* const commentRef = */ this.readU32()
|
/* const commentRef = */ this.readU32();
|
||||||
/* const prefixRef = */ this.readS32()
|
/* const prefixRef = */ this.readS32();
|
||||||
/* const uriRef = */ this.readS32()
|
/* const uriRef = */ this.readS32();
|
||||||
|
|
||||||
// We don't currently care about the values, but they could
|
// We don't currently care about the values, but they could
|
||||||
// be accessed like so:
|
// be accessed like so:
|
||||||
@@ -449,18 +458,18 @@ and is supposed to end at offset ${end}. Ignoring the rest of the value.`)
|
|||||||
// namespaceURI.prefix = this.strings[prefixRef] // if prefixRef > 0
|
// namespaceURI.prefix = this.strings[prefixRef] // if prefixRef > 0
|
||||||
// namespaceURI.uri = this.strings[uriRef] // if uriRef > 0
|
// namespaceURI.uri = this.strings[uriRef] // if uriRef > 0
|
||||||
|
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
|
|
||||||
return null
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
readXmlNamespaceEnd (/* header */) {
|
readXmlNamespaceEnd(/* header */) {
|
||||||
this.debug && console.group('readXmlNamespaceEnd')
|
this.debug && console.group('readXmlNamespaceEnd');
|
||||||
|
|
||||||
/* const line = */ this.readU32()
|
/* const line = */ this.readU32();
|
||||||
/* const commentRef = */ this.readU32()
|
/* const commentRef = */ this.readU32();
|
||||||
/* const prefixRef = */ this.readS32()
|
/* const prefixRef = */ this.readS32();
|
||||||
/* const uriRef = */ this.readS32()
|
/* const uriRef = */ this.readS32();
|
||||||
|
|
||||||
// We don't currently care about the values, but they could
|
// We don't currently care about the values, but they could
|
||||||
// be accessed like so:
|
// be accessed like so:
|
||||||
@@ -468,60 +477,60 @@ and is supposed to end at offset ${end}. Ignoring the rest of the value.`)
|
|||||||
// namespaceURI.prefix = this.strings[prefixRef] // if prefixRef > 0
|
// namespaceURI.prefix = this.strings[prefixRef] // if prefixRef > 0
|
||||||
// namespaceURI.uri = this.strings[uriRef] // if uriRef > 0
|
// namespaceURI.uri = this.strings[uriRef] // if uriRef > 0
|
||||||
|
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
|
|
||||||
return null
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
readXmlElementStart (/* header */) {
|
readXmlElementStart(/* header */) {
|
||||||
this.debug && console.group('readXmlElementStart')
|
this.debug && console.group('readXmlElementStart');
|
||||||
|
|
||||||
const node = {
|
const node = {
|
||||||
namespaceURI: null,
|
namespaceURI: null,
|
||||||
nodeType: NodeType.ELEMENT_NODE,
|
nodeType: NodeType.ELEMENT_NODE,
|
||||||
nodeName: null,
|
nodeName: null,
|
||||||
attributes: [],
|
attributes: [],
|
||||||
childNodes: []
|
childNodes: [],
|
||||||
}
|
};
|
||||||
|
|
||||||
/* const line = */ this.readU32()
|
/* const line = */ this.readU32();
|
||||||
/* const commentRef = */ this.readU32()
|
/* const commentRef = */ this.readU32();
|
||||||
const nsRef = this.readS32()
|
const nsRef = this.readS32();
|
||||||
const nameRef = this.readS32()
|
const nameRef = this.readS32();
|
||||||
|
|
||||||
if (nsRef > 0) {
|
if (nsRef > 0) {
|
||||||
node.namespaceURI = this.strings[nsRef]
|
node.namespaceURI = this.strings[nsRef];
|
||||||
}
|
}
|
||||||
|
|
||||||
node.nodeName = this.strings[nameRef]
|
node.nodeName = this.strings[nameRef];
|
||||||
|
|
||||||
/* const attrStart = */ this.readU16()
|
/* const attrStart = */ this.readU16();
|
||||||
/* const attrSize = */ this.readU16()
|
/* const attrSize = */ this.readU16();
|
||||||
const attrCount = this.readU16()
|
const attrCount = this.readU16();
|
||||||
/* const idIndex = */ this.readU16()
|
/* const idIndex = */ this.readU16();
|
||||||
/* const classIndex = */ this.readU16()
|
/* const classIndex = */ this.readU16();
|
||||||
/* const styleIndex = */ this.readU16()
|
/* const styleIndex = */ this.readU16();
|
||||||
|
|
||||||
for (let i = 0; i < attrCount; ++i) {
|
for (let i = 0; i < attrCount; ++i) {
|
||||||
node.attributes.push(this.readXmlAttribute())
|
node.attributes.push(this.readXmlAttribute());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.document) {
|
if (this.document) {
|
||||||
this.parent.childNodes.push(node)
|
this.parent.childNodes.push(node);
|
||||||
this.parent = node
|
this.parent = node;
|
||||||
} else {
|
} else {
|
||||||
this.document = (this.parent = node)
|
this.document = this.parent = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.stack.push(node)
|
this.stack.push(node);
|
||||||
|
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
|
|
||||||
return node
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
readXmlAttribute () {
|
readXmlAttribute() {
|
||||||
this.debug && console.group('readXmlAttribute')
|
this.debug && console.group('readXmlAttribute');
|
||||||
|
|
||||||
const attr = {
|
const attr = {
|
||||||
namespaceURI: null,
|
namespaceURI: null,
|
||||||
@@ -529,146 +538,149 @@ and is supposed to end at offset ${end}. Ignoring the rest of the value.`)
|
|||||||
nodeName: null,
|
nodeName: null,
|
||||||
name: null,
|
name: null,
|
||||||
value: null,
|
value: null,
|
||||||
typedValue: null
|
typedValue: null,
|
||||||
}
|
};
|
||||||
|
|
||||||
const nsRef = this.readS32()
|
const nsRef = this.readS32();
|
||||||
const nameRef = this.readS32()
|
const nameRef = this.readS32();
|
||||||
const valueRef = this.readS32()
|
const valueRef = this.readS32();
|
||||||
|
|
||||||
if (nsRef > 0) {
|
if (nsRef > 0) {
|
||||||
attr.namespaceURI = this.strings[nsRef]
|
attr.namespaceURI = this.strings[nsRef];
|
||||||
}
|
}
|
||||||
|
|
||||||
attr.nodeName = attr.name = this.strings[nameRef]
|
attr.nodeName = attr.name = this.strings[nameRef];
|
||||||
|
|
||||||
if (valueRef > 0) {
|
if (valueRef > 0) {
|
||||||
// some apk have versionName with special characters
|
// some apk have versionName with special characters
|
||||||
if (attr.name === 'versionName') {
|
if (attr.name === 'versionName') {
|
||||||
// only keep printable characters
|
// only keep printable characters
|
||||||
// https://www.ascii-code.com/characters/printable-characters
|
// https://www.ascii-code.com/characters/printable-characters
|
||||||
this.strings[valueRef] = this.strings[valueRef].replace(/[^\x21-\x7E]/g, '')
|
this.strings[valueRef] = this.strings[valueRef].replace(
|
||||||
|
/[^\x21-\x7E]/g,
|
||||||
|
'',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
attr.value = this.strings[valueRef]
|
attr.value = this.strings[valueRef];
|
||||||
}
|
}
|
||||||
|
|
||||||
attr.typedValue = this.readTypedValue()
|
attr.typedValue = this.readTypedValue();
|
||||||
|
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
|
|
||||||
return attr
|
return attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
readXmlElementEnd (/* header */) {
|
readXmlElementEnd(/* header */) {
|
||||||
this.debug && console.group('readXmlCData')
|
this.debug && console.group('readXmlCData');
|
||||||
|
|
||||||
/* const line = */ this.readU32()
|
/* const line = */ this.readU32();
|
||||||
/* const commentRef = */ this.readU32()
|
/* const commentRef = */ this.readU32();
|
||||||
/* const nsRef = */ this.readS32()
|
/* const nsRef = */ this.readS32();
|
||||||
/* const nameRef = */ this.readS32()
|
/* const nameRef = */ this.readS32();
|
||||||
|
|
||||||
this.stack.pop()
|
this.stack.pop();
|
||||||
this.parent = this.stack[this.stack.length - 1]
|
this.parent = this.stack[this.stack.length - 1];
|
||||||
|
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
|
|
||||||
return null
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
readXmlCData (/* header */) {
|
readXmlCData(/* header */) {
|
||||||
this.debug && console.group('readXmlCData')
|
this.debug && console.group('readXmlCData');
|
||||||
|
|
||||||
const cdata = {
|
const cdata = {
|
||||||
namespaceURI: null,
|
namespaceURI: null,
|
||||||
nodeType: NodeType.CDATA_SECTION_NODE,
|
nodeType: NodeType.CDATA_SECTION_NODE,
|
||||||
nodeName: '#cdata',
|
nodeName: '#cdata',
|
||||||
data: null,
|
data: null,
|
||||||
typedValue: null
|
typedValue: null,
|
||||||
}
|
};
|
||||||
|
|
||||||
/* const line = */ this.readU32()
|
/* const line = */ this.readU32();
|
||||||
/* const commentRef = */ this.readU32()
|
/* const commentRef = */ this.readU32();
|
||||||
const dataRef = this.readS32()
|
const dataRef = this.readS32();
|
||||||
|
|
||||||
if (dataRef > 0) {
|
if (dataRef > 0) {
|
||||||
cdata.data = this.strings[dataRef]
|
cdata.data = this.strings[dataRef];
|
||||||
}
|
}
|
||||||
|
|
||||||
cdata.typedValue = this.readTypedValue()
|
cdata.typedValue = this.readTypedValue();
|
||||||
|
|
||||||
this.parent.childNodes.push(cdata)
|
this.parent.childNodes.push(cdata);
|
||||||
|
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
|
|
||||||
return cdata
|
return cdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
readNull (header) {
|
readNull(header) {
|
||||||
this.debug && console.group('readNull')
|
this.debug && console.group('readNull');
|
||||||
this.cursor += header.chunkSize - header.headerSize
|
this.cursor += header.chunkSize - header.headerSize;
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
return null
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
parse () {
|
parse() {
|
||||||
this.debug && console.group('BinaryXmlParser.parse')
|
this.debug && console.group('BinaryXmlParser.parse');
|
||||||
|
|
||||||
const xmlHeader = this.readChunkHeader()
|
const xmlHeader = this.readChunkHeader();
|
||||||
if (xmlHeader.chunkType !== ChunkType.XML) {
|
if (xmlHeader.chunkType !== ChunkType.XML) {
|
||||||
throw new Error('Invalid XML header')
|
throw new Error('Invalid XML header');
|
||||||
}
|
}
|
||||||
|
|
||||||
while (this.cursor < this.buffer.length) {
|
while (this.cursor < this.buffer.length) {
|
||||||
this.debug && console.group('chunk')
|
this.debug && console.group('chunk');
|
||||||
const start = this.cursor
|
const start = this.cursor;
|
||||||
const header = this.readChunkHeader()
|
const header = this.readChunkHeader();
|
||||||
switch (header.chunkType) {
|
switch (header.chunkType) {
|
||||||
case ChunkType.STRING_POOL:
|
case ChunkType.STRING_POOL:
|
||||||
this.readStringPool(header)
|
this.readStringPool(header);
|
||||||
break
|
break;
|
||||||
case ChunkType.XML_RESOURCE_MAP:
|
case ChunkType.XML_RESOURCE_MAP:
|
||||||
this.readResourceMap(header)
|
this.readResourceMap(header);
|
||||||
break
|
break;
|
||||||
case ChunkType.XML_START_NAMESPACE:
|
case ChunkType.XML_START_NAMESPACE:
|
||||||
this.readXmlNamespaceStart(header)
|
this.readXmlNamespaceStart(header);
|
||||||
break
|
break;
|
||||||
case ChunkType.XML_END_NAMESPACE:
|
case ChunkType.XML_END_NAMESPACE:
|
||||||
this.readXmlNamespaceEnd(header)
|
this.readXmlNamespaceEnd(header);
|
||||||
break
|
break;
|
||||||
case ChunkType.XML_START_ELEMENT:
|
case ChunkType.XML_START_ELEMENT:
|
||||||
this.readXmlElementStart(header)
|
this.readXmlElementStart(header);
|
||||||
break
|
break;
|
||||||
case ChunkType.XML_END_ELEMENT:
|
case ChunkType.XML_END_ELEMENT:
|
||||||
this.readXmlElementEnd(header)
|
this.readXmlElementEnd(header);
|
||||||
break
|
break;
|
||||||
case ChunkType.XML_CDATA:
|
case ChunkType.XML_CDATA:
|
||||||
this.readXmlCData(header)
|
this.readXmlCData(header);
|
||||||
break
|
break;
|
||||||
case ChunkType.NULL:
|
case ChunkType.NULL:
|
||||||
this.readNull(header)
|
this.readNull(header);
|
||||||
break
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unsupported chunk type '${header.chunkType}'`)
|
throw new Error(`Unsupported chunk type '${header.chunkType}'`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure we consume the whole chunk
|
// Ensure we consume the whole chunk
|
||||||
const end = start + header.chunkSize
|
const end = start + header.chunkSize;
|
||||||
if (this.cursor !== end) {
|
if (this.cursor !== end) {
|
||||||
const diff = end - this.cursor
|
const diff = end - this.cursor;
|
||||||
const type = header.chunkType.toString(16)
|
const type = header.chunkType.toString(16);
|
||||||
console.debug(`Cursor is off by ${diff} bytes at ${this.cursor} at supposed \
|
console.debug(`Cursor is off by ${diff} bytes at ${this.cursor} at supposed \
|
||||||
end of chunk of type 0x${type}. The chunk started at offset ${start} and is \
|
end of chunk of type 0x${type}. The chunk started at offset ${start} and is \
|
||||||
supposed to end at offset ${end}. Ignoring the rest of the chunk.`)
|
supposed to end at offset ${end}. Ignoring the rest of the chunk.`);
|
||||||
this.cursor = end
|
this.cursor = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.debug && console.groupEnd()
|
this.debug && console.groupEnd();
|
||||||
|
|
||||||
return this.document
|
return this.document;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = BinaryXmlParser
|
module.exports = BinaryXmlParser;
|
||||||
|
|||||||
@@ -1,216 +1,224 @@
|
|||||||
// From https://github.com/openstf/adbkit-apkreader
|
// From https://github.com/openstf/adbkit-apkreader
|
||||||
const BinaryXmlParser = require('./binary')
|
const BinaryXmlParser = require('./binary');
|
||||||
|
|
||||||
const INTENT_MAIN = 'android.intent.action.MAIN'
|
const INTENT_MAIN = 'android.intent.action.MAIN';
|
||||||
const CATEGORY_LAUNCHER = 'android.intent.category.LAUNCHER'
|
const CATEGORY_LAUNCHER = 'android.intent.category.LAUNCHER';
|
||||||
|
|
||||||
class ManifestParser {
|
class ManifestParser {
|
||||||
constructor (buffer, options = {}) {
|
constructor(buffer, options = {}) {
|
||||||
this.buffer = buffer
|
this.buffer = buffer;
|
||||||
this.xmlParser = new BinaryXmlParser(this.buffer, options)
|
this.xmlParser = new BinaryXmlParser(this.buffer, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
collapseAttributes (element) {
|
collapseAttributes(element) {
|
||||||
const collapsed = Object.create(null)
|
const collapsed = Object.create(null);
|
||||||
for (let attr of Array.from(element.attributes)) {
|
for (const attr of Array.from(element.attributes)) {
|
||||||
collapsed[attr.name] = attr.typedValue.value
|
collapsed[attr.name] = attr.typedValue.value;
|
||||||
}
|
}
|
||||||
return collapsed
|
return collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
parseIntents (element, target) {
|
parseIntents(element, target) {
|
||||||
target.intentFilters = []
|
target.intentFilters = [];
|
||||||
target.metaData = []
|
target.metaData = [];
|
||||||
|
|
||||||
return element.childNodes.forEach(element => {
|
return element.childNodes.forEach((element) => {
|
||||||
switch (element.nodeName) {
|
switch (element.nodeName) {
|
||||||
case 'intent-filter': {
|
case 'intent-filter': {
|
||||||
const intentFilter = this.collapseAttributes(element)
|
const intentFilter = this.collapseAttributes(element);
|
||||||
|
|
||||||
intentFilter.actions = []
|
intentFilter.actions = [];
|
||||||
intentFilter.categories = []
|
intentFilter.categories = [];
|
||||||
intentFilter.data = []
|
intentFilter.data = [];
|
||||||
|
|
||||||
element.childNodes.forEach(element => {
|
element.childNodes.forEach((element) => {
|
||||||
switch (element.nodeName) {
|
switch (element.nodeName) {
|
||||||
case 'action':
|
case 'action':
|
||||||
intentFilter.actions.push(this.collapseAttributes(element))
|
intentFilter.actions.push(this.collapseAttributes(element));
|
||||||
break
|
break;
|
||||||
case 'category':
|
case 'category':
|
||||||
intentFilter.categories.push(this.collapseAttributes(element))
|
intentFilter.categories.push(this.collapseAttributes(element));
|
||||||
break
|
break;
|
||||||
case 'data':
|
case 'data':
|
||||||
intentFilter.data.push(this.collapseAttributes(element))
|
intentFilter.data.push(this.collapseAttributes(element));
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
target.intentFilters.push(intentFilter)
|
target.intentFilters.push(intentFilter);
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
case 'meta-data':
|
case 'meta-data':
|
||||||
target.metaData.push(this.collapseAttributes(element))
|
target.metaData.push(this.collapseAttributes(element));
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
parseApplication (element) {
|
parseApplication(element) {
|
||||||
const app = this.collapseAttributes(element)
|
const app = this.collapseAttributes(element);
|
||||||
|
|
||||||
app.activities = []
|
app.activities = [];
|
||||||
app.activityAliases = []
|
app.activityAliases = [];
|
||||||
app.launcherActivities = []
|
app.launcherActivities = [];
|
||||||
app.services = []
|
app.services = [];
|
||||||
app.receivers = []
|
app.receivers = [];
|
||||||
app.providers = []
|
app.providers = [];
|
||||||
app.usesLibraries = []
|
app.usesLibraries = [];
|
||||||
app.metaData = []
|
app.metaData = [];
|
||||||
|
|
||||||
element.childNodes.forEach(element => {
|
element.childNodes.forEach((element) => {
|
||||||
switch (element.nodeName) {
|
switch (element.nodeName) {
|
||||||
case 'activity': {
|
case 'activity': {
|
||||||
const activity = this.collapseAttributes(element)
|
const activity = this.collapseAttributes(element);
|
||||||
this.parseIntents(element, activity)
|
this.parseIntents(element, activity);
|
||||||
app.activities.push(activity)
|
app.activities.push(activity);
|
||||||
if (this.isLauncherActivity(activity)) {
|
if (this.isLauncherActivity(activity)) {
|
||||||
app.launcherActivities.push(activity)
|
app.launcherActivities.push(activity);
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
case 'activity-alias': {
|
case 'activity-alias': {
|
||||||
const activityAlias = this.collapseAttributes(element)
|
const activityAlias = this.collapseAttributes(element);
|
||||||
this.parseIntents(element, activityAlias)
|
this.parseIntents(element, activityAlias);
|
||||||
app.activityAliases.push(activityAlias)
|
app.activityAliases.push(activityAlias);
|
||||||
if (this.isLauncherActivity(activityAlias)) {
|
if (this.isLauncherActivity(activityAlias)) {
|
||||||
app.launcherActivities.push(activityAlias)
|
app.launcherActivities.push(activityAlias);
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
case 'service': {
|
case 'service': {
|
||||||
const service = this.collapseAttributes(element)
|
const service = this.collapseAttributes(element);
|
||||||
this.parseIntents(element, service)
|
this.parseIntents(element, service);
|
||||||
app.services.push(service)
|
app.services.push(service);
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
case 'receiver': {
|
case 'receiver': {
|
||||||
const receiver = this.collapseAttributes(element)
|
const receiver = this.collapseAttributes(element);
|
||||||
this.parseIntents(element, receiver)
|
this.parseIntents(element, receiver);
|
||||||
app.receivers.push(receiver)
|
app.receivers.push(receiver);
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
case 'provider': {
|
case 'provider': {
|
||||||
const provider = this.collapseAttributes(element)
|
const provider = this.collapseAttributes(element);
|
||||||
|
|
||||||
provider.grantUriPermissions = []
|
provider.grantUriPermissions = [];
|
||||||
provider.metaData = []
|
provider.metaData = [];
|
||||||
provider.pathPermissions = []
|
provider.pathPermissions = [];
|
||||||
|
|
||||||
element.childNodes.forEach(element => {
|
element.childNodes.forEach((element) => {
|
||||||
switch (element.nodeName) {
|
switch (element.nodeName) {
|
||||||
case 'grant-uri-permission':
|
case 'grant-uri-permission':
|
||||||
provider.grantUriPermissions.push(this.collapseAttributes(element))
|
provider.grantUriPermissions.push(
|
||||||
break
|
this.collapseAttributes(element),
|
||||||
|
);
|
||||||
|
break;
|
||||||
case 'meta-data':
|
case 'meta-data':
|
||||||
provider.metaData.push(this.collapseAttributes(element))
|
provider.metaData.push(this.collapseAttributes(element));
|
||||||
break
|
break;
|
||||||
case 'path-permission':
|
case 'path-permission':
|
||||||
provider.pathPermissions.push(this.collapseAttributes(element))
|
provider.pathPermissions.push(this.collapseAttributes(element));
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
app.providers.push(provider)
|
app.providers.push(provider);
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
case 'uses-library':
|
case 'uses-library':
|
||||||
app.usesLibraries.push(this.collapseAttributes(element))
|
app.usesLibraries.push(this.collapseAttributes(element));
|
||||||
break
|
break;
|
||||||
case 'meta-data':
|
case 'meta-data':
|
||||||
app.metaData.push(this.collapseAttributes(element))
|
app.metaData.push(this.collapseAttributes(element));
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
return app
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
isLauncherActivity (activity) {
|
isLauncherActivity(activity) {
|
||||||
return activity.intentFilters.some(function (filter) {
|
return activity.intentFilters.some((filter) => {
|
||||||
const hasMain = filter.actions.some(action => action.name === INTENT_MAIN)
|
const hasMain = filter.actions.some(
|
||||||
|
(action) => action.name === INTENT_MAIN,
|
||||||
|
);
|
||||||
if (!hasMain) {
|
if (!hasMain) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
return filter.categories.some(category => category.name === CATEGORY_LAUNCHER)
|
return filter.categories.some(
|
||||||
})
|
(category) => category.name === CATEGORY_LAUNCHER,
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
parse () {
|
parse() {
|
||||||
const document = this.xmlParser.parse()
|
const document = this.xmlParser.parse();
|
||||||
const manifest = this.collapseAttributes(document)
|
const manifest = this.collapseAttributes(document);
|
||||||
|
|
||||||
manifest.usesPermissions = []
|
manifest.usesPermissions = [];
|
||||||
manifest.usesPermissionsSDK23 = []
|
manifest.usesPermissionsSDK23 = [];
|
||||||
manifest.permissions = []
|
manifest.permissions = [];
|
||||||
manifest.permissionTrees = []
|
manifest.permissionTrees = [];
|
||||||
manifest.permissionGroups = []
|
manifest.permissionGroups = [];
|
||||||
manifest.instrumentation = null
|
manifest.instrumentation = null;
|
||||||
manifest.usesSdk = null
|
manifest.usesSdk = null;
|
||||||
manifest.usesConfiguration = null
|
manifest.usesConfiguration = null;
|
||||||
manifest.usesFeatures = []
|
manifest.usesFeatures = [];
|
||||||
manifest.supportsScreens = null
|
manifest.supportsScreens = null;
|
||||||
manifest.compatibleScreens = []
|
manifest.compatibleScreens = [];
|
||||||
manifest.supportsGlTextures = []
|
manifest.supportsGlTextures = [];
|
||||||
manifest.application = Object.create(null)
|
manifest.application = Object.create(null);
|
||||||
|
|
||||||
document.childNodes.forEach(element => {
|
document.childNodes.forEach((element) => {
|
||||||
switch (element.nodeName) {
|
switch (element.nodeName) {
|
||||||
case 'uses-permission':
|
case 'uses-permission':
|
||||||
manifest.usesPermissions.push(this.collapseAttributes(element))
|
manifest.usesPermissions.push(this.collapseAttributes(element));
|
||||||
break
|
break;
|
||||||
case 'uses-permission-sdk-23':
|
case 'uses-permission-sdk-23':
|
||||||
manifest.usesPermissionsSDK23.push(this.collapseAttributes(element))
|
manifest.usesPermissionsSDK23.push(this.collapseAttributes(element));
|
||||||
break
|
break;
|
||||||
case 'permission':
|
case 'permission':
|
||||||
manifest.permissions.push(this.collapseAttributes(element))
|
manifest.permissions.push(this.collapseAttributes(element));
|
||||||
break
|
break;
|
||||||
case 'permission-tree':
|
case 'permission-tree':
|
||||||
manifest.permissionTrees.push(this.collapseAttributes(element))
|
manifest.permissionTrees.push(this.collapseAttributes(element));
|
||||||
break
|
break;
|
||||||
case 'permission-group':
|
case 'permission-group':
|
||||||
manifest.permissionGroups.push(this.collapseAttributes(element))
|
manifest.permissionGroups.push(this.collapseAttributes(element));
|
||||||
break
|
break;
|
||||||
case 'instrumentation':
|
case 'instrumentation':
|
||||||
manifest.instrumentation = this.collapseAttributes(element)
|
manifest.instrumentation = this.collapseAttributes(element);
|
||||||
break
|
break;
|
||||||
case 'uses-sdk':
|
case 'uses-sdk':
|
||||||
manifest.usesSdk = this.collapseAttributes(element)
|
manifest.usesSdk = this.collapseAttributes(element);
|
||||||
break
|
break;
|
||||||
case 'uses-configuration':
|
case 'uses-configuration':
|
||||||
manifest.usesConfiguration = this.collapseAttributes(element)
|
manifest.usesConfiguration = this.collapseAttributes(element);
|
||||||
break
|
break;
|
||||||
case 'uses-feature':
|
case 'uses-feature':
|
||||||
manifest.usesFeatures.push(this.collapseAttributes(element))
|
manifest.usesFeatures.push(this.collapseAttributes(element));
|
||||||
break
|
break;
|
||||||
case 'supports-screens':
|
case 'supports-screens':
|
||||||
manifest.supportsScreens = this.collapseAttributes(element)
|
manifest.supportsScreens = this.collapseAttributes(element);
|
||||||
break
|
break;
|
||||||
case 'compatible-screens':
|
case 'compatible-screens':
|
||||||
element.childNodes.forEach(screen => {
|
element.childNodes.forEach((screen) => {
|
||||||
return manifest.compatibleScreens.push(this.collapseAttributes(screen))
|
return manifest.compatibleScreens.push(
|
||||||
})
|
this.collapseAttributes(screen),
|
||||||
break
|
);
|
||||||
|
});
|
||||||
|
break;
|
||||||
case 'supports-gl-texture':
|
case 'supports-gl-texture':
|
||||||
manifest.supportsGlTextures.push(this.collapseAttributes(element))
|
manifest.supportsGlTextures.push(this.collapseAttributes(element));
|
||||||
break
|
break;
|
||||||
case 'application':
|
case 'application':
|
||||||
manifest.application = this.parseApplication(element)
|
manifest.application = this.parseApplication(element);
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
return manifest
|
return manifest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = ManifestParser
|
module.exports = ManifestParser;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
const Unzip = require('isomorphic-unzip');
|
const Unzip = require('isomorphic-unzip');
|
||||||
const { isBrowser, decodeNullUnicode } = require('./utils');
|
const { isBrowser, decodeNullUnicode } = require('./utils');
|
||||||
import { enumZipEntries, readEntire } from '../../bundle';
|
const { enumZipEntries, readEntry } = require('../../bundle');
|
||||||
|
|
||||||
class Zip {
|
class Zip {
|
||||||
constructor(file) {
|
constructor(file) {
|
||||||
@@ -53,7 +53,7 @@ class Zip {
|
|||||||
let originSource;
|
let originSource;
|
||||||
await enumZipEntries(this.file, (entry, zipFile) => {
|
await enumZipEntries(this.file, (entry, zipFile) => {
|
||||||
if (regex.test(entry.fileName)) {
|
if (regex.test(entry.fileName)) {
|
||||||
return readEntire(entry, zipFile).then((v) => (originSource = v));
|
return readEntry(entry, zipFile).then((v) => (originSource = v));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return originSource;
|
return originSource;
|
||||||
|
|||||||
89
src/utils/check-lockfile.ts
Normal file
89
src/utils/check-lockfile.ts
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
import { t } from './i18n';
|
||||||
|
|
||||||
|
const lockFiles = [
|
||||||
|
'package-lock.json',
|
||||||
|
'yarn.lock',
|
||||||
|
'pnpm-lock.yaml',
|
||||||
|
'bun.lockb',
|
||||||
|
'bun.lock',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Function to check if a package.json has a workspaces field
|
||||||
|
function hasWorkspaces(dir: string): boolean {
|
||||||
|
const pkgPath = path.join(dir, 'package.json');
|
||||||
|
if (fs.existsSync(pkgPath)) {
|
||||||
|
try {
|
||||||
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
||||||
|
return !!pkg.workspaces;
|
||||||
|
} catch (e) {
|
||||||
|
// Ignore parsing errors
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper function to find lock files in a specific directory
|
||||||
|
function findLockFilesInDir(directory: string): string[] {
|
||||||
|
const found: string[] = [];
|
||||||
|
for (const file of lockFiles) {
|
||||||
|
const filePath = path.join(directory, file);
|
||||||
|
if (fs.existsSync(filePath)) {
|
||||||
|
found.push(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function checkLockFiles() {
|
||||||
|
const cwd = process.cwd();
|
||||||
|
let searchDir = cwd;
|
||||||
|
let foundLockFiles = findLockFilesInDir(searchDir);
|
||||||
|
|
||||||
|
// If no lock file in cwd, try to find monorepo root and check there
|
||||||
|
if (foundLockFiles.length === 0) {
|
||||||
|
// Search upwards for package.json with workspaces
|
||||||
|
let currentDir = path.dirname(cwd); // Start searching from parent
|
||||||
|
let projectRootDir: string | null = null;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
if (hasWorkspaces(currentDir)) {
|
||||||
|
projectRootDir = currentDir;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const parentDir = path.dirname(currentDir);
|
||||||
|
if (parentDir === currentDir) {
|
||||||
|
// Reached the filesystem root
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
currentDir = parentDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If a potential root was found, switch search directory and re-check
|
||||||
|
if (projectRootDir) {
|
||||||
|
searchDir = projectRootDir;
|
||||||
|
foundLockFiles = findLockFilesInDir(searchDir);
|
||||||
|
}
|
||||||
|
// If no projectRootDir found, foundLockFiles remains empty and searchDir remains cwd
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle results based on findings in the final searchDir
|
||||||
|
if (foundLockFiles.length === 1) {
|
||||||
|
// Successfully found one lock file in the determined searchDir
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundLockFiles.length > 1) {
|
||||||
|
// Found multiple lock files in the determined searchDir
|
||||||
|
console.warn(t('lockBestPractice'));
|
||||||
|
throw new Error(
|
||||||
|
t('multipleLocksFound', { lockFiles: foundLockFiles.join(', ') }),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we reach here, foundLockFiles.length === 0
|
||||||
|
console.warn(t('lockBestPractice'));
|
||||||
|
// Warn instead of throwing an error if no lock file is found
|
||||||
|
console.warn(t('lockNotFound'));
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { t } from './i18n';
|
||||||
import { plugins } from './plugin-config';
|
import { plugins } from './plugin-config';
|
||||||
|
|
||||||
interface BundleParams {
|
interface BundleParams {
|
||||||
@@ -17,10 +18,12 @@ export async function checkPlugins(): Promise<BundleParams> {
|
|||||||
const isEnabled = await plugin.detect();
|
const isEnabled = await plugin.detect();
|
||||||
if (isEnabled && plugin.bundleParams) {
|
if (isEnabled && plugin.bundleParams) {
|
||||||
Object.assign(params, plugin.bundleParams);
|
Object.assign(params, plugin.bundleParams);
|
||||||
console.log(`detected ${plugin.name} plugin`);
|
console.log(t('pluginDetected', { name: plugin.name }));
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn(`error while detecting ${plugin.name} plugin:`, err);
|
console.warn(
|
||||||
|
t('pluginDetectionError', { name: plugin.name, error: err }),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import path from 'node:path';
|
import path from 'path';
|
||||||
|
|
||||||
const scriptName = path.basename(process.argv[1]) as 'cresc' | 'pushy';
|
const scriptName = path.basename(process.argv[1]) as 'cresc' | 'pushy';
|
||||||
export const IS_CRESC = scriptName === 'cresc';
|
export const IS_CRESC = scriptName === 'cresc';
|
||||||
@@ -10,6 +10,6 @@ export const pricingPageUrl = IS_CRESC
|
|||||||
? 'https://cresc.dev/pricing'
|
? 'https://cresc.dev/pricing'
|
||||||
: 'https://pushy.reactnative.cn/pricing.html';
|
: 'https://pushy.reactnative.cn/pricing.html';
|
||||||
|
|
||||||
export const defaultEndpoint = IS_CRESC
|
export const defaultEndpoints = IS_CRESC
|
||||||
? 'https://api.cresc.dev'
|
? ['https://api.cresc.dev', 'https://api.cresc.app']
|
||||||
: 'https://update.reactnative.cn/api';
|
: ['https://update.reactnative.cn/api', 'https://update.react-native.cn/api'];
|
||||||
|
|||||||
@@ -1,19 +1,30 @@
|
|||||||
const currentPackage = require(`${process.cwd()}/package.json`);
|
let currentPackage = null;
|
||||||
|
try {
|
||||||
const depKeys = Object.keys(currentPackage.dependencies);
|
currentPackage = require(`${process.cwd()}/package.json`);
|
||||||
const devDepKeys = Object.keys(currentPackage.devDependencies);
|
} catch (e) {
|
||||||
const dedupedDeps = [...new Set([...depKeys, ...devDepKeys])];
|
// console.warn('No package.json file were found');
|
||||||
|
}
|
||||||
|
|
||||||
const _depVersions: Record<string, string> = {};
|
const _depVersions: Record<string, string> = {};
|
||||||
|
|
||||||
for (const dep of dedupedDeps) {
|
if (currentPackage) {
|
||||||
try {
|
const depKeys = currentPackage.dependencies
|
||||||
const packageJsonPath = require.resolve(`${dep}/package.json`, {
|
? Object.keys(currentPackage.dependencies)
|
||||||
paths: [process.cwd()],
|
: [];
|
||||||
});
|
const devDepKeys = currentPackage.devDependencies
|
||||||
const version = require(packageJsonPath).version;
|
? Object.keys(currentPackage.devDependencies)
|
||||||
_depVersions[dep] = version;
|
: [];
|
||||||
} catch (e) {}
|
const dedupedDeps = [...new Set([...depKeys, ...devDepKeys])];
|
||||||
|
|
||||||
|
for (const dep of dedupedDeps) {
|
||||||
|
try {
|
||||||
|
const packageJsonPath = require.resolve(`${dep}/package.json`, {
|
||||||
|
paths: [process.cwd()],
|
||||||
|
});
|
||||||
|
const version = require(packageJsonPath).version;
|
||||||
|
_depVersions[dep] = version;
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const depVersions = Object.keys(_depVersions)
|
export const depVersions = Object.keys(_depVersions)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
import git from 'isomorphic-git';
|
import git from 'isomorphic-git';
|
||||||
import fs from 'node:fs';
|
|
||||||
import path from 'node:path';
|
|
||||||
|
|
||||||
export interface CommitInfo {
|
export interface CommitInfo {
|
||||||
hash: string;
|
hash: string;
|
||||||
@@ -41,7 +41,7 @@ export async function getCommitInfo(): Promise<CommitInfo | undefined> {
|
|||||||
message: commit.message,
|
message: commit.message,
|
||||||
author: commit.author.name || commit.committer.name,
|
author: commit.author.name || commit.committer.name,
|
||||||
timestamp: String(commit.committer.timestamp),
|
timestamp: String(commit.committer.timestamp),
|
||||||
origin: origin.url,
|
origin: origin?.url,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
83
src/utils/http-helper.ts
Normal file
83
src/utils/http-helper.ts
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
import { defaultEndpoints } from './constants';
|
||||||
|
|
||||||
|
// const baseUrl = `http://localhost:9000`;
|
||||||
|
// let baseUrl = SERVER.main[0];
|
||||||
|
// const baseUrl = `https://p.reactnative.cn/api`;
|
||||||
|
|
||||||
|
export function promiseAny<T>(promises: Promise<T>[]) {
|
||||||
|
return new Promise<T>((resolve, reject) => {
|
||||||
|
let count = 0;
|
||||||
|
|
||||||
|
for (const promise of promises) {
|
||||||
|
Promise.resolve(promise)
|
||||||
|
.then(resolve)
|
||||||
|
.catch(() => {
|
||||||
|
count++;
|
||||||
|
if (count === promises.length) {
|
||||||
|
reject(new Error('All promises were rejected'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ping = async (url: string) => {
|
||||||
|
let pingFinished = false;
|
||||||
|
return Promise.race([
|
||||||
|
fetch(url, {
|
||||||
|
method: 'HEAD',
|
||||||
|
})
|
||||||
|
.then(({ status, statusText }) => {
|
||||||
|
pingFinished = true;
|
||||||
|
if (status === 200) {
|
||||||
|
// console.log('ping success', url);
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
// console.log('ping failed', url, status, statusText);
|
||||||
|
throw new Error('ping failed');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
pingFinished = true;
|
||||||
|
// console.log('ping error', url, e);
|
||||||
|
throw new Error('ping error');
|
||||||
|
}),
|
||||||
|
new Promise((_, reject) =>
|
||||||
|
setTimeout(() => {
|
||||||
|
reject(new Error('ping timeout'));
|
||||||
|
if (!pingFinished) {
|
||||||
|
// console.log('ping timeout', url);
|
||||||
|
}
|
||||||
|
}, 2000),
|
||||||
|
),
|
||||||
|
]) as Promise<string | null>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const testUrls = async (urls?: string[]) => {
|
||||||
|
if (!urls?.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const ret = await promiseAny(urls.map(ping));
|
||||||
|
if (ret) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
// console.log('all ping failed, use first url:', urls[0]);
|
||||||
|
return urls[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getBaseUrl = (async () => {
|
||||||
|
const testEndpoint = process.env.PUSHY_REGISTRY || process.env.RNU_API;
|
||||||
|
if (testEndpoint) {
|
||||||
|
return testEndpoint;
|
||||||
|
}
|
||||||
|
return testUrls(defaultEndpoints.map((url) => `${url}/status`)).then(
|
||||||
|
(ret) => {
|
||||||
|
let baseUrl = defaultEndpoints[0];
|
||||||
|
if (ret) {
|
||||||
|
// remove /status
|
||||||
|
baseUrl = ret.replace('/status', '');
|
||||||
|
}
|
||||||
|
// console.log('baseUrl', baseUrl);
|
||||||
|
return baseUrl;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
})();
|
||||||
@@ -15,6 +15,9 @@ i18next.init({
|
|||||||
translation: zh,
|
translation: zh,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
interpolation: {
|
||||||
|
escapeValue: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
declare module 'i18next' {
|
declare module 'i18next' {
|
||||||
@@ -31,4 +34,6 @@ declare module 'i18next' {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const t = i18next.t;
|
export function t(key: string, options?: any): string {
|
||||||
|
return i18next.t(key as any, options);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import fs from 'fs-extra';
|
import os from 'os';
|
||||||
import os from 'node:os';
|
import path from 'path';
|
||||||
import path from 'node:path';
|
|
||||||
import pkg from '../../package.json';
|
|
||||||
import AppInfoParser from './app-info-parser';
|
|
||||||
import semverSatisfies from 'semver/functions/satisfies';
|
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import latestVersion from '@badisi/latest-version';
|
import { satisfies } from 'compare-versions';
|
||||||
|
import fs from 'fs-extra';
|
||||||
|
import pkg from '../../package.json';
|
||||||
|
import latestVersion from '../utils/latest-version';
|
||||||
|
import AppInfoParser from './app-info-parser';
|
||||||
import { checkPlugins } from './check-plugin';
|
import { checkPlugins } from './check-plugin';
|
||||||
|
|
||||||
import { read } from 'read';
|
import { read } from 'read';
|
||||||
@@ -88,17 +88,15 @@ export async function getAppInfo(fn: string) {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const updateJsonFile = await appInfoParser.parser.getEntryFromHarmonyApp(
|
const updateJsonFile =
|
||||||
/rawfile\/update.json/,
|
await appInfoParser.parser.getEntryFromHarmonyApp(/rawfile\/update.json/);
|
||||||
);
|
|
||||||
let appCredential = {};
|
let appCredential = {};
|
||||||
if (updateJsonFile) {
|
if (updateJsonFile) {
|
||||||
appCredential = JSON.parse(updateJsonFile.toString()).harmony;
|
appCredential = JSON.parse(updateJsonFile.toString()).harmony;
|
||||||
}
|
}
|
||||||
const metaJsonFile = await appInfoParser.parser.getEntryFromHarmonyApp(
|
const metaJsonFile =
|
||||||
/rawfile\/meta.json/,
|
await appInfoParser.parser.getEntryFromHarmonyApp(/rawfile\/meta.json/);
|
||||||
);
|
let metaData: Record<string, any> = {};
|
||||||
let metaData = {};
|
|
||||||
if (metaJsonFile) {
|
if (metaJsonFile) {
|
||||||
metaData = JSON.parse(metaJsonFile.toString());
|
metaData = JSON.parse(metaJsonFile.toString());
|
||||||
}
|
}
|
||||||
@@ -181,35 +179,32 @@ export async function printVersionCommand() {
|
|||||||
version: chalk.green(latestRnuCliVersion),
|
version: chalk.green(latestRnuCliVersion),
|
||||||
})}`
|
})}`
|
||||||
: '';
|
: '';
|
||||||
console.log(
|
console.log(`react-native-update-cli: ${pkg.version}${latestRnuCliVersion}`);
|
||||||
`react-native-update-cli: ${pkg.version}${latestRnuCliVersion}`,
|
const rnuVersion = depVersions['react-native-update'];
|
||||||
);
|
|
||||||
let rnuVersion = '';
|
|
||||||
rnuVersion = depVersions['react-native-update'];
|
|
||||||
latestRnuVersion = latestRnuVersion
|
|
||||||
? ` ${t('latestVersionTag', { version: chalk.green(latestRnuVersion) })}`
|
|
||||||
: '';
|
|
||||||
console.log(`react-native-update: ${rnuVersion}${latestRnuVersion}`);
|
|
||||||
if (rnuVersion) {
|
if (rnuVersion) {
|
||||||
|
latestRnuVersion = latestRnuVersion
|
||||||
|
? ` ${t('latestVersionTag', { version: chalk.green(latestRnuVersion) })}`
|
||||||
|
: '';
|
||||||
|
console.log(`react-native-update: ${rnuVersion}${latestRnuVersion}`);
|
||||||
if (IS_CRESC) {
|
if (IS_CRESC) {
|
||||||
if (semverSatisfies(rnuVersion, '<10.27.0')) {
|
if (satisfies(rnuVersion, '<10.27.0')) {
|
||||||
console.error(
|
console.error(
|
||||||
'Unsupported version, please update to the latest version: npm i react-native-update@latest',
|
'Unsupported version, please update to the latest version: npm i react-native-update@latest',
|
||||||
);
|
);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (semverSatisfies(rnuVersion, '<8.5.2')) {
|
if (satisfies(rnuVersion, '<8.5.2')) {
|
||||||
console.warn(
|
console.warn(
|
||||||
`当前版本已不再支持,请至少升级到 v8 的最新小版本后重新打包(代码无需改动): npm i react-native-update@8 .
|
`当前版本已不再支持,请至少升级到 v8 的最新小版本后重新打包(代码无需改动): npm i react-native-update@8 .
|
||||||
如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`,
|
如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`,
|
||||||
);
|
);
|
||||||
} else if (semverSatisfies(rnuVersion, '9.0.0 - 9.2.1')) {
|
} else if (satisfies(rnuVersion, '9.0.0 - 9.2.1')) {
|
||||||
console.warn(
|
console.warn(
|
||||||
`当前版本已不再支持,请至少升级到 v9 的最新小版本后重新打包(代码无需改动,可直接热更): npm i react-native-update@9 .
|
`当前版本已不再支持,请至少升级到 v9 的最新小版本后重新打包(代码无需改动,可直接热更): npm i react-native-update@9 .
|
||||||
如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`,
|
如有使用安装 apk 的功能,请注意添加所需权限 https://pushy.reactnative.cn/docs/api#async-function-downloadandinstallapkurl`,
|
||||||
);
|
);
|
||||||
} else if (semverSatisfies(rnuVersion, '10.0.0 - 10.17.0')) {
|
} else if (satisfies(rnuVersion, '10.0.0 - 10.17.0')) {
|
||||||
console.warn(
|
console.warn(
|
||||||
'当前版本已不再支持,请升级到 v10 的最新小版本(代码无需改动,可直接热更): npm i react-native-update@10',
|
'当前版本已不再支持,请升级到 v10 的最新小版本(代码无需改动,可直接热更): npm i react-native-update@10',
|
||||||
);
|
);
|
||||||
|
|||||||
443
src/utils/latest-version/cli.ts
Normal file
443
src/utils/latest-version/cli.ts
Normal file
@@ -0,0 +1,443 @@
|
|||||||
|
import { existsSync, readFileSync } from 'fs';
|
||||||
|
import { dirname } from 'path';
|
||||||
|
import {
|
||||||
|
blue,
|
||||||
|
bold,
|
||||||
|
cyan,
|
||||||
|
gray,
|
||||||
|
green,
|
||||||
|
italic,
|
||||||
|
magenta,
|
||||||
|
red,
|
||||||
|
reset,
|
||||||
|
strip,
|
||||||
|
underline,
|
||||||
|
yellow,
|
||||||
|
} from '@colors/colors/safe';
|
||||||
|
import semverDiff from 'semver/functions/diff';
|
||||||
|
import semverMajor from 'semver/functions/major';
|
||||||
|
import latestVersion, {
|
||||||
|
type Package,
|
||||||
|
type PackageJson,
|
||||||
|
type LatestVersionPackage,
|
||||||
|
type LatestVersionOptions,
|
||||||
|
} from '.';
|
||||||
|
|
||||||
|
interface TableColumn {
|
||||||
|
label: string;
|
||||||
|
attrName: keyof TableRow;
|
||||||
|
align: 'left' | 'center' | 'right';
|
||||||
|
maxLength: number;
|
||||||
|
items: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
type TableRowGroup =
|
||||||
|
| 'patch'
|
||||||
|
| 'minor'
|
||||||
|
| 'major'
|
||||||
|
| 'majorVersionZero'
|
||||||
|
| 'unknown';
|
||||||
|
|
||||||
|
interface TableRow {
|
||||||
|
name: string;
|
||||||
|
location: string;
|
||||||
|
installed: string;
|
||||||
|
tagOrRange: string;
|
||||||
|
separator: string;
|
||||||
|
wanted: string;
|
||||||
|
latest: string;
|
||||||
|
group: TableRowGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
const colorizeDiff = (from: string, to: string): string => {
|
||||||
|
const toParts = to.split('.');
|
||||||
|
|
||||||
|
const diffIndex = from.split('.').findIndex((part, i) => part !== toParts[i]);
|
||||||
|
if (diffIndex !== -1) {
|
||||||
|
let color = magenta;
|
||||||
|
if (toParts[0] !== '0') {
|
||||||
|
color = diffIndex === 0 ? red : diffIndex === 1 ? cyan : green;
|
||||||
|
}
|
||||||
|
const start = toParts.slice(0, diffIndex).join('.');
|
||||||
|
const mid = diffIndex === 0 ? '' : '.';
|
||||||
|
const end = color(toParts.slice(diffIndex).join('.'));
|
||||||
|
return `${start}${mid}${end}`;
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
|
||||||
|
const columnCellRenderer = (column: TableColumn, row: TableRow): string => {
|
||||||
|
let text = row[column.attrName];
|
||||||
|
const gap =
|
||||||
|
text.length < column.maxLength
|
||||||
|
? ' '.repeat(column.maxLength - text.length)
|
||||||
|
: '';
|
||||||
|
|
||||||
|
switch (column.attrName) {
|
||||||
|
case 'name':
|
||||||
|
text = yellow(text);
|
||||||
|
break;
|
||||||
|
case 'installed':
|
||||||
|
case 'separator':
|
||||||
|
text = blue(text);
|
||||||
|
break;
|
||||||
|
case 'location':
|
||||||
|
case 'tagOrRange':
|
||||||
|
text = gray(text);
|
||||||
|
break;
|
||||||
|
case 'wanted':
|
||||||
|
text = colorizeDiff(row.installed, text);
|
||||||
|
break;
|
||||||
|
case 'latest':
|
||||||
|
if (text !== row.wanted) {
|
||||||
|
text = colorizeDiff(row.installed, text);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return column.align === 'right' ? `${gap}${text}` : `${text}${gap}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const columnHeaderRenderer = (column: TableColumn): string => {
|
||||||
|
const text = column.label;
|
||||||
|
const gap =
|
||||||
|
text.length < column.maxLength
|
||||||
|
? ' '.repeat(column.maxLength - text.length)
|
||||||
|
: '';
|
||||||
|
return column.align === 'right'
|
||||||
|
? `${gap}${underline(text)}`
|
||||||
|
: `${underline(text)}${gap}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const drawBox = (
|
||||||
|
lines: string[],
|
||||||
|
color = yellow,
|
||||||
|
horizontalPadding = 3,
|
||||||
|
): void => {
|
||||||
|
const maxLineWidth = lines.reduce(
|
||||||
|
(max, row) => Math.max(max, strip(row).length),
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(color(`┌${'─'.repeat(maxLineWidth + horizontalPadding * 2)}┐`));
|
||||||
|
lines.forEach((row) => {
|
||||||
|
const padding = ' '.repeat(horizontalPadding);
|
||||||
|
const fullRow = `${row}${' '.repeat(maxLineWidth - strip(row).length)}`;
|
||||||
|
console.log(
|
||||||
|
`${color('│')}${padding}${reset(fullRow)}${padding}${color('│')}`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
console.log(color(`└${'─'.repeat(maxLineWidth + horizontalPadding * 2)}┘`));
|
||||||
|
};
|
||||||
|
|
||||||
|
const getTableColumns = (rows: TableRow[]): TableColumn[] => {
|
||||||
|
const columns: TableColumn[] = [
|
||||||
|
{
|
||||||
|
label: 'Package',
|
||||||
|
attrName: 'name',
|
||||||
|
align: 'left',
|
||||||
|
maxLength: 0,
|
||||||
|
items: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Location',
|
||||||
|
attrName: 'location',
|
||||||
|
align: 'left',
|
||||||
|
maxLength: 0,
|
||||||
|
items: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Installed',
|
||||||
|
attrName: 'installed',
|
||||||
|
align: 'right',
|
||||||
|
maxLength: 0,
|
||||||
|
items: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '',
|
||||||
|
attrName: 'separator',
|
||||||
|
align: 'center',
|
||||||
|
maxLength: 0,
|
||||||
|
items: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Range',
|
||||||
|
attrName: 'tagOrRange',
|
||||||
|
align: 'right',
|
||||||
|
maxLength: 0,
|
||||||
|
items: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '',
|
||||||
|
attrName: 'separator',
|
||||||
|
align: 'center',
|
||||||
|
maxLength: 0,
|
||||||
|
items: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Wanted',
|
||||||
|
attrName: 'wanted',
|
||||||
|
align: 'right',
|
||||||
|
maxLength: 0,
|
||||||
|
items: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Latest',
|
||||||
|
attrName: 'latest',
|
||||||
|
align: 'right',
|
||||||
|
maxLength: 0,
|
||||||
|
items: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
rows.forEach((row) => {
|
||||||
|
columns.forEach((column) => {
|
||||||
|
column.maxLength = Math.max(
|
||||||
|
column.label.length,
|
||||||
|
column.maxLength,
|
||||||
|
row[column.attrName].length || 0,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return columns;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getTableRows = (updates: LatestVersionPackage[]): TableRow[] => {
|
||||||
|
return updates.reduce<TableRow[]>((all, pkg) => {
|
||||||
|
const {
|
||||||
|
name,
|
||||||
|
latest,
|
||||||
|
local,
|
||||||
|
globalNpm,
|
||||||
|
globalYarn,
|
||||||
|
wantedTagOrRange,
|
||||||
|
updatesAvailable,
|
||||||
|
} = pkg;
|
||||||
|
const getGroup = (a?: string, b?: string): TableRowGroup => {
|
||||||
|
if (b && semverMajor(b) === 0) {
|
||||||
|
return 'majorVersionZero';
|
||||||
|
} else if (a && b) {
|
||||||
|
const releaseType = semverDiff(a, b) ?? '';
|
||||||
|
if (['major', 'premajor', 'prerelease'].includes(releaseType)) {
|
||||||
|
return 'major';
|
||||||
|
} else if (['minor', 'preminor'].includes(releaseType)) {
|
||||||
|
return 'minor';
|
||||||
|
} else if (['patch', 'prepatch'].includes(releaseType)) {
|
||||||
|
return 'patch';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 'unknown';
|
||||||
|
};
|
||||||
|
const add = (
|
||||||
|
group: TableRowGroup,
|
||||||
|
location: string,
|
||||||
|
installed?: string,
|
||||||
|
wanted?: string,
|
||||||
|
) =>
|
||||||
|
all.push({
|
||||||
|
name: ' ' + name,
|
||||||
|
location,
|
||||||
|
installed: installed ?? 'unknown',
|
||||||
|
latest: latest ?? 'unknown',
|
||||||
|
tagOrRange: wantedTagOrRange ?? 'unknown',
|
||||||
|
separator: '→',
|
||||||
|
wanted: wanted ?? 'unknown',
|
||||||
|
group,
|
||||||
|
});
|
||||||
|
if (updatesAvailable) {
|
||||||
|
if (updatesAvailable.local) {
|
||||||
|
add(
|
||||||
|
getGroup(local, updatesAvailable.local),
|
||||||
|
'local',
|
||||||
|
local,
|
||||||
|
updatesAvailable.local,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (updatesAvailable.globalNpm) {
|
||||||
|
add(
|
||||||
|
getGroup(globalNpm, updatesAvailable.globalNpm),
|
||||||
|
'NPM global',
|
||||||
|
globalNpm,
|
||||||
|
updatesAvailable.globalNpm,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (updatesAvailable.globalYarn) {
|
||||||
|
add(
|
||||||
|
getGroup(globalYarn, updatesAvailable.globalYarn),
|
||||||
|
'YARN global',
|
||||||
|
globalYarn,
|
||||||
|
updatesAvailable.globalYarn,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (local && local !== latest) {
|
||||||
|
add(getGroup(local, latest), 'local', local, pkg.wanted);
|
||||||
|
}
|
||||||
|
if (globalNpm && globalNpm !== latest) {
|
||||||
|
add(getGroup(globalNpm, latest), 'NPM global', globalNpm, pkg.wanted);
|
||||||
|
}
|
||||||
|
if (globalYarn && globalYarn !== latest) {
|
||||||
|
add(
|
||||||
|
getGroup(globalYarn, latest),
|
||||||
|
'YARN global',
|
||||||
|
globalYarn,
|
||||||
|
pkg.wanted,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!local && !globalNpm && !globalYarn) {
|
||||||
|
add('unknown', 'unknown', 'unknown', pkg.wanted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return all;
|
||||||
|
}, []);
|
||||||
|
};
|
||||||
|
|
||||||
|
const displayTable = (latestVersionPackages: LatestVersionPackage[]): void => {
|
||||||
|
const updates = latestVersionPackages.filter((pkg) => pkg.updatesAvailable);
|
||||||
|
if (updates.length) {
|
||||||
|
const rows = getTableRows(updates);
|
||||||
|
const hasUpdates = rows.some((row) => row.installed !== 'unknown');
|
||||||
|
const columns = getTableColumns(rows);
|
||||||
|
const columnGap = 2;
|
||||||
|
|
||||||
|
const getGroupLines = (
|
||||||
|
groupType: TableRowGroup,
|
||||||
|
color: (str: string) => string,
|
||||||
|
title: string,
|
||||||
|
description?: string,
|
||||||
|
): string[] => {
|
||||||
|
const items = rows
|
||||||
|
.filter((row) => row.group === groupType)
|
||||||
|
.sort((a, b) => (a.name > b.name ? 1 : -1));
|
||||||
|
return !items.length
|
||||||
|
? []
|
||||||
|
: [
|
||||||
|
'',
|
||||||
|
color(`${bold(title)} ${italic(`(${description})`)}`),
|
||||||
|
...items.map((row) =>
|
||||||
|
columns
|
||||||
|
.map((column) => columnCellRenderer(column, row))
|
||||||
|
.join(' '.repeat(columnGap)),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||||
|
drawBox(
|
||||||
|
[
|
||||||
|
'',
|
||||||
|
hasUpdates ? yellow('Important updates are available.') : undefined,
|
||||||
|
hasUpdates ? '' : undefined,
|
||||||
|
columns.map(columnHeaderRenderer).join(' '.repeat(columnGap)),
|
||||||
|
...getGroupLines(
|
||||||
|
'patch',
|
||||||
|
green,
|
||||||
|
'Patch',
|
||||||
|
'backwards-compatible bug fixes',
|
||||||
|
),
|
||||||
|
...getGroupLines(
|
||||||
|
'minor',
|
||||||
|
cyan,
|
||||||
|
'Minor',
|
||||||
|
'backwards-compatible features',
|
||||||
|
),
|
||||||
|
...getGroupLines(
|
||||||
|
'major',
|
||||||
|
red,
|
||||||
|
'Major',
|
||||||
|
'potentially breaking API changes',
|
||||||
|
),
|
||||||
|
...getGroupLines(
|
||||||
|
'majorVersionZero',
|
||||||
|
magenta,
|
||||||
|
'Major version zero',
|
||||||
|
'not stable, anything may change',
|
||||||
|
),
|
||||||
|
...getGroupLines('unknown', blue, 'Missing', 'not installed'),
|
||||||
|
'',
|
||||||
|
].filter((line) => line !== undefined) as string[],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
console.log(green('🎉 Packages are up-to-date'));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const checkVersions = async (
|
||||||
|
packages: Package | Package[] | PackageJson,
|
||||||
|
skipMissing: boolean,
|
||||||
|
options: LatestVersionOptions = { useCache: true },
|
||||||
|
): Promise<void> => {
|
||||||
|
const ora = (await import('ora')).default;
|
||||||
|
const spinner = ora({ text: cyan('Checking versions...') });
|
||||||
|
spinner.start();
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
let latestVersionPackages: LatestVersionPackage[] = await latestVersion(
|
||||||
|
packages,
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
if (skipMissing) {
|
||||||
|
latestVersionPackages = latestVersionPackages.filter(
|
||||||
|
(pkg) => pkg.local ?? pkg.globalNpm ?? pkg.globalYarn,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
spinner.stop();
|
||||||
|
displayTable(latestVersionPackages);
|
||||||
|
};
|
||||||
|
|
||||||
|
void (async () => {
|
||||||
|
let args = process.argv.slice(2);
|
||||||
|
|
||||||
|
const skipMissing = args.includes('--skip-missing');
|
||||||
|
|
||||||
|
// Remove any options from the arguments
|
||||||
|
args = args.filter((arg) => !arg.startsWith('-'));
|
||||||
|
|
||||||
|
// If argument is a package.json file
|
||||||
|
if (args.length === 1 && args[0].endsWith('package.json')) {
|
||||||
|
if (existsSync(args[0])) {
|
||||||
|
process.chdir(dirname(args[0]));
|
||||||
|
await checkVersions(
|
||||||
|
JSON.parse(readFileSync(args[0]).toString()) as PackageJson,
|
||||||
|
skipMissing,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
console.log(cyan('No package.json file were found'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// else..
|
||||||
|
else {
|
||||||
|
// Check if a local package.json file exists
|
||||||
|
let localPkgJson: PackageJson | undefined;
|
||||||
|
if (existsSync('package.json')) {
|
||||||
|
localPkgJson = JSON.parse(readFileSync('package.json').toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check given arguments
|
||||||
|
if (args.length) {
|
||||||
|
// Map arguments with any range that could be found in local package.json
|
||||||
|
args = args.map((arg) => {
|
||||||
|
if (localPkgJson?.dependencies?.[arg]) {
|
||||||
|
return `${arg}@${localPkgJson.dependencies?.[arg]}`;
|
||||||
|
}
|
||||||
|
if (localPkgJson?.devDependencies?.[arg]) {
|
||||||
|
return `${arg}@${localPkgJson.devDependencies?.[arg]}`;
|
||||||
|
}
|
||||||
|
if (localPkgJson?.peerDependencies?.[arg]) {
|
||||||
|
return `${arg}@${localPkgJson.peerDependencies?.[arg]}`;
|
||||||
|
}
|
||||||
|
return arg;
|
||||||
|
});
|
||||||
|
await checkVersions(args, skipMissing);
|
||||||
|
}
|
||||||
|
// ...else check the local package.json if any
|
||||||
|
else if (localPkgJson) {
|
||||||
|
await checkVersions(localPkgJson, skipMissing);
|
||||||
|
}
|
||||||
|
// ...else do nothing
|
||||||
|
else {
|
||||||
|
console.log(cyan('No packages were found'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
497
src/utils/latest-version/index.ts
Normal file
497
src/utils/latest-version/index.ts
Normal file
@@ -0,0 +1,497 @@
|
|||||||
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
||||||
|
import type {
|
||||||
|
Agent,
|
||||||
|
RequestOptions as HttpRequestOptions,
|
||||||
|
IncomingMessage,
|
||||||
|
} from 'http';
|
||||||
|
import type { RequestOptions as HttpsRequestOptions } from 'https';
|
||||||
|
import { homedir } from 'os';
|
||||||
|
import { dirname, join, parse, resolve as pathResolve } from 'path';
|
||||||
|
import { URL } from 'url';
|
||||||
|
import { npm, yarn } from 'global-dirs';
|
||||||
|
|
||||||
|
import registryAuthToken from 'registry-auth-token';
|
||||||
|
import getRegistryUrl from 'registry-auth-token/registry-url';
|
||||||
|
import gt from 'semver/functions/gt';
|
||||||
|
import maxSatisfying from 'semver/ranges/max-satisfying';
|
||||||
|
|
||||||
|
interface RegistryVersions {
|
||||||
|
/**
|
||||||
|
* The latest version of the package found on the registry (if found).
|
||||||
|
*/
|
||||||
|
latest?: string;
|
||||||
|
/**
|
||||||
|
* The next version of the package found on the registry (if found).
|
||||||
|
*/
|
||||||
|
next?: string;
|
||||||
|
/**
|
||||||
|
* The latest version of the package found on the registry and satisfied by the wanted tag or version range.
|
||||||
|
*/
|
||||||
|
wanted?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface InstalledVersions {
|
||||||
|
/**
|
||||||
|
* The current local installed version of the package (if installed).
|
||||||
|
*/
|
||||||
|
local?: string;
|
||||||
|
/**
|
||||||
|
* The current npm global installed version of the package (if installed).
|
||||||
|
*/
|
||||||
|
globalNpm?: string;
|
||||||
|
/**
|
||||||
|
* The current yarn global installed version of the package (if installed).
|
||||||
|
*/
|
||||||
|
globalYarn?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface LatestVersionPackage extends InstalledVersions, RegistryVersions {
|
||||||
|
/**
|
||||||
|
* The name of the package.
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* The tag or version range that was provided (if provided).
|
||||||
|
* @default "latest"
|
||||||
|
*/
|
||||||
|
wantedTagOrRange?: string;
|
||||||
|
/**
|
||||||
|
* Whether the local or global installed versions (if any) could be upgraded or not, based on the wanted version.
|
||||||
|
*/
|
||||||
|
updatesAvailable:
|
||||||
|
| {
|
||||||
|
local: string | false;
|
||||||
|
globalNpm: string | false;
|
||||||
|
globalYarn: string | false;
|
||||||
|
}
|
||||||
|
| false;
|
||||||
|
/**
|
||||||
|
* Any error that might have occurred during the process.
|
||||||
|
*/
|
||||||
|
error?: Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RequestOptions {
|
||||||
|
readonly ca?: string | Buffer | Array<string | Buffer>;
|
||||||
|
readonly rejectUnauthorized?: boolean;
|
||||||
|
readonly agent?: Agent | boolean;
|
||||||
|
readonly timeout?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface LatestVersionOptions {
|
||||||
|
/**
|
||||||
|
* Awaiting the api to return might take time, depending on the network, and might impact your package loading performance.
|
||||||
|
* You can use the cache mechanism to improve load performance and reduce unnecessary network requests.
|
||||||
|
* If `useCache` is not supplied, the api will always check for updates and wait for every requests to return before returning itself.
|
||||||
|
* If `useCache` is used, the api will always returned immediately, with either (for each provided packages):
|
||||||
|
* 1) a latest/next version available if a cache was found
|
||||||
|
* 2) no latest/next version available if no cache was found - in such case updates will be fetched in the background and a cache will
|
||||||
|
* be created for each provided packages and made available for the next call to the api.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
readonly useCache?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How long the cache for the provided packages should be used before being refreshed (in milliseconds).
|
||||||
|
* If `useCache` is not supplied, this option has no effect.
|
||||||
|
* If `0` is used, this will force the cache to refresh immediately:
|
||||||
|
* 1) The api will returned immediately (without any latest nor next version available for the provided packages)
|
||||||
|
* 2) New updates will be fetched in the background
|
||||||
|
* 3) The cache for each provided packages will be refreshed and made available for the next call to the api
|
||||||
|
* @default ONE_DAY
|
||||||
|
*/
|
||||||
|
readonly cacheMaxAge?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A JavaScript package registry url that implements the CommonJS Package Registry specification.
|
||||||
|
* @default "Looks at any registry urls in the .npmrc file or fallback to the default npm registry instead"
|
||||||
|
* @example <caption>.npmrc</caption>
|
||||||
|
* registry = 'https://custom-registry.com/'
|
||||||
|
* @pkgscope:registry = 'https://custom-registry.com/'
|
||||||
|
*/
|
||||||
|
readonly registryUrl?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set of options to be passed down to Node.js http/https request.
|
||||||
|
* @example <caption>Behind a proxy with self-signed certificate</caption>
|
||||||
|
* { ca: [ fs.readFileSync('proxy-cert.pem') ] }
|
||||||
|
* @example <caption>Bypassing certificate validation</caption>
|
||||||
|
* { rejectUnauthorized: false }
|
||||||
|
*/
|
||||||
|
readonly requestOptions?: RequestOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface LatestVersion {
|
||||||
|
/**
|
||||||
|
* Get latest versions of packages from of a package json like object.
|
||||||
|
* @param {PackageJson} item - A package json like object (with dependencies, devDependencies and peerDependencies attributes).
|
||||||
|
* @example { dependencies: { 'npm': 'latest' }, devDependencies: { 'npm': '1.3.2' }, peerDependencies: { '@scope/name': '^5.0.2' } }
|
||||||
|
* @param {LatestVersionOptions} [options] - An object optionally specifying the use of the cache, the max age of the cache, the registry url and the http or https options.
|
||||||
|
* If `useCache` is not supplied, the default of `false` is used.
|
||||||
|
* If `cacheMaxAge` is not supplied, the default of `one day` is used.
|
||||||
|
* If `registryUrl` is not supplied, the default from `.npmrc` is used or a fallback to the `npm registry url` instead.
|
||||||
|
* @returns {Promise<LatestVersionPackage[]>}
|
||||||
|
*/
|
||||||
|
(
|
||||||
|
item: PackageJson,
|
||||||
|
options?: LatestVersionOptions,
|
||||||
|
): Promise<LatestVersionPackage[]>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get latest version of a single package.
|
||||||
|
* @param {Package} item - A single package object (represented by a string that should match the following format: `${'@' | ''}${string}@${string}`)
|
||||||
|
* @example 'npm', 'npm@1.3.2', '@scope/name@^5.0.2'
|
||||||
|
* @param {LatestVersionOptions} [options] - An object optionally specifying the use of the cache, the max age of the cache, the registry url and the http or https options.
|
||||||
|
* If `useCache` is not supplied, the default of `false` is used.
|
||||||
|
* If `cacheMaxAge` is not supplied, the default of `one day` is used.
|
||||||
|
* If `registryUrl` is not supplied, the default from `.npmrc` is used or a fallback to the npm registry url instead.
|
||||||
|
* @returns {Promise<LatestVersionPackage>}
|
||||||
|
*/
|
||||||
|
(
|
||||||
|
item: Package,
|
||||||
|
options?: LatestVersionOptions,
|
||||||
|
): Promise<LatestVersionPackage>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get latest versions of a collection of packages.
|
||||||
|
* @param {Package[]} items - A collection of package object (represented by a string that should match the following format: `${'@' | ''}${string}@${string}`)
|
||||||
|
* @example ['npm', 'npm@1.3.2', '@scope/name@^5.0.2']
|
||||||
|
* @param {LatestVersionOptions} [options] - An object optionally specifying the use of the cache, the max age of the cache, the registry url and the http or https options.
|
||||||
|
* If `useCache` is not supplied, the default of `false` is used.
|
||||||
|
* If `cacheMaxAge` is not supplied, the default of `one day` is used.
|
||||||
|
* If `registryUrl` is not supplied, the default from `.npmrc` is used or a fallback to the npm registry url instead.
|
||||||
|
* @returns {Promise<LatestVersionPackage[]>}
|
||||||
|
*/
|
||||||
|
(
|
||||||
|
items: Package[],
|
||||||
|
options?: LatestVersionOptions,
|
||||||
|
): Promise<LatestVersionPackage[]>; // eslint-disable-line @typescript-eslint/unified-signatures
|
||||||
|
}
|
||||||
|
type PackageRange = `${'@' | ''}${string}@${string}`;
|
||||||
|
type Package = PackageRange | string; // eslint-disable-line @typescript-eslint/no-redundant-type-constituents
|
||||||
|
type PackageJsonDependencies = Record<string, string>;
|
||||||
|
type PackageJson = Record<string, any> &
|
||||||
|
(
|
||||||
|
| {
|
||||||
|
dependencies: PackageJsonDependencies;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
devDependencies: PackageJsonDependencies;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
peerDependencies: PackageJsonDependencies;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
interface PackageMetadata {
|
||||||
|
name: string;
|
||||||
|
lastUpdateDate: number;
|
||||||
|
versions: string[];
|
||||||
|
distTags: Record<string, string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ONE_DAY = 1000 * 60 * 60 * 24; // eslint-disable-line @typescript-eslint/naming-convention
|
||||||
|
|
||||||
|
const isPackageJson = (obj: any): obj is PackageJson => {
|
||||||
|
return (
|
||||||
|
(obj as PackageJson).dependencies !== undefined ||
|
||||||
|
(obj as PackageJson).devDependencies !== undefined ||
|
||||||
|
(obj as PackageJson).peerDependencies !== undefined
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const downloadMetadata = (
|
||||||
|
pkgName: string,
|
||||||
|
options?: LatestVersionOptions,
|
||||||
|
): Promise<PackageMetadata> => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const i = pkgName.indexOf('/');
|
||||||
|
const pkgScope = i !== -1 ? pkgName.slice(0, i) : '';
|
||||||
|
const registryUrl = options?.registryUrl ?? getRegistryUrl(pkgScope);
|
||||||
|
const pkgUrl = new URL(
|
||||||
|
encodeURIComponent(pkgName).replace(/^%40/, '@'),
|
||||||
|
registryUrl,
|
||||||
|
);
|
||||||
|
|
||||||
|
let requestOptions: HttpRequestOptions | HttpsRequestOptions = {
|
||||||
|
headers: {
|
||||||
|
accept:
|
||||||
|
'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*',
|
||||||
|
},
|
||||||
|
host: pkgUrl.hostname,
|
||||||
|
path: pkgUrl.pathname,
|
||||||
|
port: pkgUrl.port,
|
||||||
|
};
|
||||||
|
const authInfo = registryAuthToken(pkgUrl.toString(), { recursive: true });
|
||||||
|
if (authInfo && requestOptions.headers) {
|
||||||
|
(requestOptions.headers as any).authorization = `${authInfo.type} ${authInfo.token}`;
|
||||||
|
}
|
||||||
|
if (options?.requestOptions) {
|
||||||
|
requestOptions = { ...requestOptions, ...options.requestOptions };
|
||||||
|
}
|
||||||
|
|
||||||
|
const { get } = require(pkgUrl.protocol === 'https:' ? 'https' : 'http');
|
||||||
|
const request = get(requestOptions, (res: IncomingMessage) => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
let rawData = '';
|
||||||
|
res.setEncoding('utf8');
|
||||||
|
res.on('data', (chunk: string) => (rawData += chunk));
|
||||||
|
res.once('error', (err) => {
|
||||||
|
res.removeAllListeners();
|
||||||
|
reject(`Request error (${err.message}): ${pkgUrl}`);
|
||||||
|
});
|
||||||
|
res.once('end', () => {
|
||||||
|
res.removeAllListeners();
|
||||||
|
try {
|
||||||
|
const pkgMetadata = JSON.parse(rawData);
|
||||||
|
resolve({
|
||||||
|
name: pkgName,
|
||||||
|
lastUpdateDate: Date.now(),
|
||||||
|
versions: Object.keys(pkgMetadata.versions as string[]),
|
||||||
|
distTags: pkgMetadata['dist-tags'],
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
} catch (err) {
|
||||||
|
reject(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
res.removeAllListeners();
|
||||||
|
res.resume(); // consume response data to free up memory
|
||||||
|
reject(`Request error (${res.statusCode}): ${pkgUrl}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const abort = (error: Error | string): void => {
|
||||||
|
request.destroy();
|
||||||
|
reject(error);
|
||||||
|
};
|
||||||
|
request.once('timeout', () => {
|
||||||
|
abort(`Request timed out: ${pkgUrl}`);
|
||||||
|
});
|
||||||
|
request.once('error', (err: Error) => {
|
||||||
|
abort(err);
|
||||||
|
});
|
||||||
|
request.on('close', () => {
|
||||||
|
request.removeAllListeners();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const getCacheDir = (name = '@badisi/latest-version'): string => {
|
||||||
|
const homeDir = homedir();
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return join(homeDir, 'Library', 'Caches', name);
|
||||||
|
case 'win32':
|
||||||
|
return join(
|
||||||
|
process.env.LOCALAPPDATA ?? join(homeDir, 'AppData', 'Local'),
|
||||||
|
name,
|
||||||
|
'Cache',
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return join(process.env.XDG_CACHE_HOME ?? join(homeDir, '.cache'), name);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const saveMetadataToCache = (pkg: PackageMetadata): void => {
|
||||||
|
const filePath = join(getCacheDir(), `${pkg.name}.json`);
|
||||||
|
if (!existsSync(dirname(filePath))) {
|
||||||
|
mkdirSync(dirname(filePath), { recursive: true });
|
||||||
|
}
|
||||||
|
writeFileSync(filePath, JSON.stringify(pkg));
|
||||||
|
};
|
||||||
|
|
||||||
|
const getMetadataFromCache = (
|
||||||
|
pkgName: string,
|
||||||
|
options?: LatestVersionOptions,
|
||||||
|
): PackageMetadata | undefined => {
|
||||||
|
const maxAge = options?.cacheMaxAge ?? ONE_DAY;
|
||||||
|
if (maxAge !== 0) {
|
||||||
|
const pkgCacheFilePath = join(getCacheDir(), `${pkgName}.json`);
|
||||||
|
if (existsSync(pkgCacheFilePath)) {
|
||||||
|
const pkg = JSON.parse(
|
||||||
|
readFileSync(pkgCacheFilePath).toString(),
|
||||||
|
) as PackageMetadata;
|
||||||
|
if (Date.now() - pkg.lastUpdateDate < maxAge) {
|
||||||
|
return pkg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined; // invalidates cache
|
||||||
|
};
|
||||||
|
|
||||||
|
const getRegistryVersions = async (
|
||||||
|
pkgName: string,
|
||||||
|
tagOrRange?: string,
|
||||||
|
options?: LatestVersionOptions,
|
||||||
|
): Promise<RegistryVersions> => {
|
||||||
|
let pkgMetadata: PackageMetadata | undefined;
|
||||||
|
if (pkgName.length && options?.useCache) {
|
||||||
|
pkgMetadata = getMetadataFromCache(pkgName, options);
|
||||||
|
if (!pkgMetadata) {
|
||||||
|
pkgMetadata = await downloadMetadata(pkgName, options);
|
||||||
|
saveMetadataToCache(pkgMetadata);
|
||||||
|
}
|
||||||
|
} else if (pkgName.length) {
|
||||||
|
pkgMetadata = await downloadMetadata(pkgName, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
const versions: RegistryVersions = {
|
||||||
|
latest: pkgMetadata?.distTags.latest,
|
||||||
|
next: pkgMetadata?.distTags.next,
|
||||||
|
};
|
||||||
|
if (tagOrRange && pkgMetadata?.distTags[tagOrRange]) {
|
||||||
|
versions.wanted = pkgMetadata.distTags[tagOrRange];
|
||||||
|
} else if (tagOrRange && pkgMetadata?.versions.length) {
|
||||||
|
versions.wanted =
|
||||||
|
maxSatisfying(pkgMetadata.versions, tagOrRange) ?? undefined;
|
||||||
|
}
|
||||||
|
return versions;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getInstalledVersion = (
|
||||||
|
pkgName: string,
|
||||||
|
location: keyof InstalledVersions = 'local',
|
||||||
|
): string | undefined => {
|
||||||
|
try {
|
||||||
|
if (location === 'globalNpm') {
|
||||||
|
return require(join(npm.packages, pkgName, 'package.json'))
|
||||||
|
?.version as string;
|
||||||
|
} else if (location === 'globalYarn') {
|
||||||
|
// Make sure package is globally installed by Yarn
|
||||||
|
const yarnGlobalPkg = require(
|
||||||
|
pathResolve(yarn.packages, '..', 'package.json'),
|
||||||
|
);
|
||||||
|
if (!yarnGlobalPkg?.dependencies?.[pkgName]) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return require(join(yarn.packages, pkgName, 'package.json'))
|
||||||
|
?.version as string;
|
||||||
|
} else {
|
||||||
|
/**
|
||||||
|
* Compute the local paths manually as require.resolve() and require.resolve.paths()
|
||||||
|
* cannot be trusted anymore.
|
||||||
|
* @see https://github.com/nodejs/node/issues/33460
|
||||||
|
* @see https://github.com/nodejs/loaders/issues/26
|
||||||
|
*/
|
||||||
|
const { root } = parse(process.cwd());
|
||||||
|
let path = process.cwd();
|
||||||
|
const localPaths = [join(path, 'node_modules')];
|
||||||
|
while (path !== root) {
|
||||||
|
path = dirname(path);
|
||||||
|
localPaths.push(join(path, 'node_modules'));
|
||||||
|
}
|
||||||
|
for (const localPath of localPaths) {
|
||||||
|
const pkgPath = join(localPath, pkgName, 'package.json');
|
||||||
|
if (existsSync(pkgPath)) {
|
||||||
|
return require(pkgPath)?.version as string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
} catch {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getInfo = async (
|
||||||
|
pkg: Package,
|
||||||
|
options?: LatestVersionOptions,
|
||||||
|
): Promise<LatestVersionPackage> => {
|
||||||
|
const i = pkg.lastIndexOf('@');
|
||||||
|
let pkgInfo: LatestVersionPackage = {
|
||||||
|
name: i > 1 ? pkg.slice(0, i) : pkg,
|
||||||
|
wantedTagOrRange: i > 1 ? pkg.slice(i + 1) : 'latest',
|
||||||
|
updatesAvailable: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
pkgInfo = {
|
||||||
|
...pkgInfo,
|
||||||
|
local: getInstalledVersion(pkgInfo.name, 'local'),
|
||||||
|
globalNpm: getInstalledVersion(pkgInfo.name, 'globalNpm'),
|
||||||
|
globalYarn: getInstalledVersion(pkgInfo.name, 'globalYarn'),
|
||||||
|
...(await getRegistryVersions(
|
||||||
|
pkgInfo.name,
|
||||||
|
pkgInfo.wantedTagOrRange,
|
||||||
|
options,
|
||||||
|
)),
|
||||||
|
};
|
||||||
|
const local =
|
||||||
|
pkgInfo.local && pkgInfo.wanted
|
||||||
|
? gt(pkgInfo.wanted, pkgInfo.local)
|
||||||
|
? pkgInfo.wanted
|
||||||
|
: false
|
||||||
|
: false;
|
||||||
|
const globalNpm =
|
||||||
|
pkgInfo.globalNpm && pkgInfo.wanted
|
||||||
|
? gt(pkgInfo.wanted, pkgInfo.globalNpm)
|
||||||
|
? pkgInfo.wanted
|
||||||
|
: false
|
||||||
|
: false;
|
||||||
|
const globalYarn =
|
||||||
|
pkgInfo.globalYarn && pkgInfo.wanted
|
||||||
|
? gt(pkgInfo.wanted, pkgInfo.globalYarn)
|
||||||
|
? pkgInfo.wanted
|
||||||
|
: false
|
||||||
|
: false;
|
||||||
|
pkgInfo.updatesAvailable =
|
||||||
|
local || globalNpm || globalYarn
|
||||||
|
? { local, globalNpm, globalYarn }
|
||||||
|
: false;
|
||||||
|
} catch (err: any) {
|
||||||
|
pkgInfo.error = err?.message ?? err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pkgInfo;
|
||||||
|
};
|
||||||
|
|
||||||
|
const latestVersion: LatestVersion = async (
|
||||||
|
arg: Package | Package[] | PackageJson,
|
||||||
|
options?: LatestVersionOptions,
|
||||||
|
): Promise<any> => {
|
||||||
|
const pkgs: Package[] = [];
|
||||||
|
if (typeof arg === 'string') {
|
||||||
|
pkgs.push(arg);
|
||||||
|
} else if (Array.isArray(arg)) {
|
||||||
|
pkgs.push(...arg);
|
||||||
|
} else if (isPackageJson(arg)) {
|
||||||
|
const addDeps = (deps?: PackageJsonDependencies): void => {
|
||||||
|
if (deps) {
|
||||||
|
pkgs.push(
|
||||||
|
...Object.keys(deps).map((key: string) => `${key}@${deps[key]}`),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
addDeps(arg.dependencies as PackageJsonDependencies | undefined);
|
||||||
|
addDeps(arg.devDependencies as PackageJsonDependencies | undefined);
|
||||||
|
addDeps(arg.peerDependencies as PackageJsonDependencies | undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
const jobs = await Promise.allSettled(
|
||||||
|
pkgs.map((pkg) => getInfo(pkg, options)),
|
||||||
|
);
|
||||||
|
const results = jobs.map(
|
||||||
|
(jobResult: PromiseSettledResult<LatestVersionPackage>) =>
|
||||||
|
(jobResult as PromiseFulfilledResult<LatestVersionPackage>).value,
|
||||||
|
);
|
||||||
|
return typeof arg === 'string' ? results[0] : results;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type {
|
||||||
|
LatestVersion,
|
||||||
|
Package,
|
||||||
|
PackageRange,
|
||||||
|
PackageJson,
|
||||||
|
PackageJsonDependencies,
|
||||||
|
RegistryVersions,
|
||||||
|
LatestVersionPackage,
|
||||||
|
RequestOptions,
|
||||||
|
LatestVersionOptions,
|
||||||
|
};
|
||||||
|
export default latestVersion;
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
const lockFiles = [
|
|
||||||
'package-lock.json',
|
|
||||||
'yarn.lock',
|
|
||||||
'pnpm-lock.yaml',
|
|
||||||
'bun.lockb',
|
|
||||||
'bun.lock',
|
|
||||||
];
|
|
||||||
@@ -27,6 +27,6 @@ export const plugins: PluginConfig[] = [
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
402
src/versions.ts
402
src/versions.ts
@@ -1,29 +1,49 @@
|
|||||||
import { get, post, put, uploadFile } from './api';
|
import { get, getAllPackages, post, put, uploadFile } from './api';
|
||||||
import { question, saveToLocal } from './utils';
|
import { question, saveToLocal } from './utils';
|
||||||
|
import { t } from './utils/i18n';
|
||||||
|
|
||||||
import { checkPlatform, getSelectedApp } from './app';
|
import chalk from 'chalk';
|
||||||
|
import { satisfies } from 'compare-versions';
|
||||||
|
import type { Package, Platform, Version } from './types';
|
||||||
|
import { getPlatform, getSelectedApp } from './app';
|
||||||
import { choosePackage } from './package';
|
import { choosePackage } from './package';
|
||||||
import { compare } from 'compare-versions';
|
|
||||||
import { depVersions } from './utils/dep-versions';
|
import { depVersions } from './utils/dep-versions';
|
||||||
import { getCommitInfo } from './utils/git';
|
import { getCommitInfo } from './utils/git';
|
||||||
import { Platform } from 'types';
|
|
||||||
|
interface VersionCommandOptions {
|
||||||
|
appId?: string;
|
||||||
|
name?: string;
|
||||||
|
description?: string;
|
||||||
|
metaInfo?: string;
|
||||||
|
platform?: Platform;
|
||||||
|
versionId?: string;
|
||||||
|
packageId?: string;
|
||||||
|
packageVersion?: string;
|
||||||
|
minPackageVersion?: string;
|
||||||
|
maxPackageVersion?: string;
|
||||||
|
packageVersionRange?: string;
|
||||||
|
rollout?: string;
|
||||||
|
dryRun?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
async function showVersion(appId: string, offset: number) {
|
async function showVersion(appId: string, offset: number) {
|
||||||
const { data, count } = await get(`/app/${appId}/version/list`);
|
const { data, count } = await get(`/app/${appId}/version/list`);
|
||||||
console.log(`Offset ${offset}`);
|
console.log(t('offset', { offset }));
|
||||||
for (const version of data) {
|
for (const version of data) {
|
||||||
let packageInfo = version.packages
|
const pkgCount = version.packages?.length || 0;
|
||||||
.slice(0, 3)
|
let packageInfo = '';
|
||||||
.map((v) => v.name)
|
|
||||||
.join(', ');
|
|
||||||
const pkgCount = version.packages.length;
|
|
||||||
if (pkgCount > 3) {
|
|
||||||
packageInfo += `...and ${pkgCount - 3} more`;
|
|
||||||
}
|
|
||||||
if (pkgCount === 0) {
|
if (pkgCount === 0) {
|
||||||
packageInfo = 'no package';
|
packageInfo = 'no package';
|
||||||
} else {
|
} else {
|
||||||
packageInfo = `[${packageInfo}]`;
|
packageInfo = version.packages
|
||||||
|
?.slice(0, 3)
|
||||||
|
.map((pkg: Package) => pkg.name)
|
||||||
|
.join(', ');
|
||||||
|
if (pkgCount > 3) {
|
||||||
|
packageInfo += `...and ${pkgCount - 3} more`;
|
||||||
|
} else {
|
||||||
|
packageInfo = `[${packageInfo}]`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
console.log(
|
console.log(
|
||||||
`${version.id}) ${version.hash.slice(0, 8)} ${
|
`${version.id}) ${version.hash.slice(0, 8)} ${
|
||||||
@@ -73,7 +93,10 @@ async function chooseVersion(appId: string) {
|
|||||||
offset = 0;
|
offset = 0;
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
const v = data.find((v) => v.id === (cmd | 0));
|
const versionId = Number.parseInt(cmd, 10);
|
||||||
|
const v = data.find(
|
||||||
|
(version: Version) => version.id === String(versionId),
|
||||||
|
);
|
||||||
if (v) {
|
if (v) {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
@@ -82,208 +105,251 @@ async function chooseVersion(appId: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const commands = {
|
export const bindVersionToPackages = async ({
|
||||||
publish: async function ({ args, options }: { args: string[]; options: {
|
appId,
|
||||||
name: string;
|
versionId,
|
||||||
description?: string;
|
pkgs,
|
||||||
metaInfo?: string;
|
rollout,
|
||||||
platform?: Platform;
|
dryRun,
|
||||||
} }) {
|
}: {
|
||||||
|
appId: string;
|
||||||
|
versionId: string;
|
||||||
|
pkgs: Package[];
|
||||||
|
rollout?: number;
|
||||||
|
dryRun?: boolean;
|
||||||
|
}) => {
|
||||||
|
if (dryRun) {
|
||||||
|
console.log(chalk.yellow(t('dryRun')));
|
||||||
|
}
|
||||||
|
if (rollout !== undefined) {
|
||||||
|
const rolloutConfig: Record<string, number> = {};
|
||||||
|
for (const pkg of pkgs) {
|
||||||
|
rolloutConfig[pkg.name] = rollout;
|
||||||
|
}
|
||||||
|
if (!dryRun) {
|
||||||
|
await put(`/app/${appId}/version/${versionId}`, {
|
||||||
|
config: {
|
||||||
|
rollout: rolloutConfig,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
console.log(
|
||||||
|
`${t('rolloutConfigSet', {
|
||||||
|
versions: pkgs.map((pkg: Package) => pkg.name).join(', '),
|
||||||
|
rollout: rollout,
|
||||||
|
})}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
for (const pkg of pkgs) {
|
||||||
|
if (!dryRun) {
|
||||||
|
await put(`/app/${appId}/package/${pkg.id}`, {
|
||||||
|
versionId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
console.log(
|
||||||
|
`${t('versionBind', {
|
||||||
|
version: versionId,
|
||||||
|
nativeVersion: pkg.name,
|
||||||
|
id: pkg.id,
|
||||||
|
})}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
console.log(t('operationComplete', { count: pkgs.length }));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const versionCommands = {
|
||||||
|
publish: async function ({
|
||||||
|
args,
|
||||||
|
options,
|
||||||
|
}: {
|
||||||
|
args: string[];
|
||||||
|
options: VersionCommandOptions;
|
||||||
|
}) {
|
||||||
const fn = args[0];
|
const fn = args[0];
|
||||||
const { name, description, metaInfo } = options;
|
const { name, description, metaInfo } = options;
|
||||||
|
|
||||||
if (!fn || !fn.endsWith('.ppk')) {
|
if (!fn || !fn.endsWith('.ppk')) {
|
||||||
throw new Error(
|
throw new Error(t('publishUsage'));
|
||||||
'使用方法: pushy publish ppk后缀文件 --platform ios|android|harmony',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const platform = checkPlatform(
|
const platform = await getPlatform(options.platform);
|
||||||
options.platform || (await question('平台(ios/android/harmony):')),
|
|
||||||
);
|
|
||||||
const { appId } = await getSelectedApp(platform);
|
const { appId } = await getSelectedApp(platform);
|
||||||
|
|
||||||
const { hash } = await uploadFile(fn);
|
const { hash } = await uploadFile(fn);
|
||||||
|
|
||||||
const versionName =
|
const versionName =
|
||||||
name || (await question('输入版本名称: ')) || '(未命名)';
|
name || (await question(t('versionNameQuestion'))) || t('unnamed');
|
||||||
const { id } = await post(`/app/${appId}/version/create`, {
|
const { id } = await post(`/app/${appId}/version/create`, {
|
||||||
name: versionName,
|
name: versionName,
|
||||||
hash,
|
hash,
|
||||||
description: description || (await question('输入版本描述:')),
|
description:
|
||||||
metaInfo: metaInfo || (await question('输入自定义的 meta info:')),
|
description || (await question(t('versionDescriptionQuestion'))),
|
||||||
|
metaInfo: metaInfo || (await question(t('versionMetaInfoQuestion'))),
|
||||||
deps: depVersions,
|
deps: depVersions,
|
||||||
commit: await getCommitInfo(),
|
commit: await getCommitInfo(),
|
||||||
});
|
});
|
||||||
// TODO local diff
|
// TODO local diff
|
||||||
saveToLocal(fn, `${appId}/ppk/${id}.ppk`);
|
saveToLocal(fn, `${appId}/ppk/${id}.ppk`);
|
||||||
console.log(`已成功上传新热更包(id: ${id})`);
|
console.log(t('packageUploadSuccess', { id }));
|
||||||
|
|
||||||
const v = await question('是否现在将此热更应用到原生包上?(Y/N)');
|
const {
|
||||||
if (v.toLowerCase() === 'y') {
|
packageId,
|
||||||
await this.update({ args: [], options: { versionId: id, platform } });
|
packageVersion,
|
||||||
|
packageVersionRange,
|
||||||
|
minPackageVersion,
|
||||||
|
maxPackageVersion,
|
||||||
|
rollout,
|
||||||
|
dryRun,
|
||||||
|
} = options;
|
||||||
|
|
||||||
|
if (
|
||||||
|
packageId ||
|
||||||
|
packageVersion ||
|
||||||
|
packageVersionRange ||
|
||||||
|
minPackageVersion ||
|
||||||
|
maxPackageVersion
|
||||||
|
) {
|
||||||
|
await this.update({
|
||||||
|
options: {
|
||||||
|
versionId: id,
|
||||||
|
platform,
|
||||||
|
packageId,
|
||||||
|
packageVersion,
|
||||||
|
packageVersionRange,
|
||||||
|
minPackageVersion,
|
||||||
|
maxPackageVersion,
|
||||||
|
rollout,
|
||||||
|
dryRun,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const q = await question(t('updateNativePackageQuestion'));
|
||||||
|
if (q.toLowerCase() === 'y') {
|
||||||
|
await this.update({ options: { versionId: id, platform } });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return versionName;
|
return versionName;
|
||||||
},
|
},
|
||||||
versions: async ({ options }) => {
|
versions: async ({ options }: { options: VersionCommandOptions }) => {
|
||||||
const platform = checkPlatform(
|
const platform = await getPlatform(options.platform);
|
||||||
options.platform || (await question('平台(ios/android/harmony):')),
|
|
||||||
);
|
|
||||||
const { appId } = await getSelectedApp(platform);
|
const { appId } = await getSelectedApp(platform);
|
||||||
await listVersions(appId);
|
await listVersions(appId);
|
||||||
},
|
},
|
||||||
update: async ({ args, options }) => {
|
update: async ({ options }: { options: VersionCommandOptions }) => {
|
||||||
const platform = checkPlatform(
|
const platform = await getPlatform(options.platform);
|
||||||
options.platform || (await question('平台(ios/android/harmony):')),
|
const appId = options.appId || (await getSelectedApp(platform)).appId;
|
||||||
);
|
|
||||||
const { appId } = await getSelectedApp(platform);
|
|
||||||
let versionId = options.versionId || (await chooseVersion(appId)).id;
|
let versionId = options.versionId || (await chooseVersion(appId)).id;
|
||||||
if (versionId === 'null') {
|
if (versionId === 'null') {
|
||||||
versionId = null;
|
versionId = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
let pkgId: string | undefined;
|
let pkgId = options.packageId;
|
||||||
let pkgVersion = options.packageVersion;
|
let pkgVersion = options.packageVersion;
|
||||||
let minPkgVersion = options.minPackageVersion;
|
let minPkgVersion = options.minPackageVersion;
|
||||||
let maxPkgVersion = options.maxPackageVersion;
|
let maxPkgVersion = options.maxPackageVersion;
|
||||||
let rollout = options.rollout;
|
let packageVersionRange = options.packageVersionRange;
|
||||||
if (rollout === undefined) {
|
let rollout: number | undefined = undefined;
|
||||||
rollout = null;
|
|
||||||
} else {
|
if (options.rollout !== undefined) {
|
||||||
try {
|
try {
|
||||||
rollout = Number.parseInt(rollout);
|
rollout = Number.parseInt(options.rollout);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error('rollout 必须是 1-100 的整数');
|
throw new Error(t('rolloutRangeError'));
|
||||||
}
|
}
|
||||||
if (rollout < 1 || rollout > 100) {
|
if (rollout < 1 || rollout > 100) {
|
||||||
throw new Error('rollout 必须是 1-100 的整数');
|
throw new Error(t('rolloutRangeError'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const allPkgs = await getAllPackages(appId);
|
||||||
|
|
||||||
|
if (!allPkgs) {
|
||||||
|
throw new Error(t('noPackagesFound', { appId }));
|
||||||
|
}
|
||||||
|
|
||||||
|
let pkgsToBind: Package[] = [];
|
||||||
|
|
||||||
if (minPkgVersion) {
|
if (minPkgVersion) {
|
||||||
minPkgVersion = String(minPkgVersion).trim();
|
minPkgVersion = String(minPkgVersion).trim();
|
||||||
const { data } = await get(`/app/${appId}/package/list?limit=1000`);
|
pkgsToBind = allPkgs.filter((pkg: Package) =>
|
||||||
const pkgs = data.filter((d) => compare(d.name, minPkgVersion, '>='));
|
satisfies(pkg.name, `>=${minPkgVersion}`),
|
||||||
if (pkgs.length === 0) {
|
|
||||||
throw new Error(`未查询到 >= ${minPkgVersion} 的原生版本`);
|
|
||||||
}
|
|
||||||
if (rollout) {
|
|
||||||
const rolloutConfig = {};
|
|
||||||
for (const pkg of pkgs) {
|
|
||||||
rolloutConfig[pkg.name] = rollout;
|
|
||||||
}
|
|
||||||
await put(`/app/${appId}/version/${versionId}`, {
|
|
||||||
config: {
|
|
||||||
rollout: rolloutConfig,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
console.log(
|
|
||||||
`已在原生版本 ${pkgs
|
|
||||||
.map((p) => p.name)
|
|
||||||
.join(', ')} 上设置灰度发布 ${rollout}% 热更版本 ${versionId}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
for (const pkg of pkgs) {
|
|
||||||
await put(`/app/${appId}/package/${pkg.id}`, {
|
|
||||||
versionId,
|
|
||||||
});
|
|
||||||
console.log(
|
|
||||||
`已将热更版本 ${versionId} 绑定到原生版本 ${pkg.name} (id: ${pkg.id})`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
console.log(`操作完成,共已绑定 ${pkgs.length} 个原生版本`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (maxPkgVersion) {
|
|
||||||
maxPkgVersion = String(maxPkgVersion).trim();
|
|
||||||
const { data } = await get(`/app/${appId}/package/list?limit=1000`);
|
|
||||||
const pkgs = data.filter((d) => compare(d.name, maxPkgVersion, '<='));
|
|
||||||
if (pkgs.length === 0) {
|
|
||||||
throw new Error(`未查询到 <= ${maxPkgVersion} 的原生版本`);
|
|
||||||
}
|
|
||||||
if (rollout) {
|
|
||||||
const rolloutConfig = {};
|
|
||||||
for (const pkg of pkgs) {
|
|
||||||
rolloutConfig[pkg.name] = rollout;
|
|
||||||
}
|
|
||||||
await put(`/app/${appId}/version/${versionId}`, {
|
|
||||||
config: {
|
|
||||||
rollout: rolloutConfig,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
console.log(
|
|
||||||
`已在原生版本 ${pkgs
|
|
||||||
.map((p) => p.name)
|
|
||||||
.join(', ')} 上设置灰度发布 ${rollout}% 热更版本 ${versionId}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
for (const pkg of pkgs) {
|
|
||||||
await put(`/app/${appId}/package/${pkg.id}`, {
|
|
||||||
versionId,
|
|
||||||
});
|
|
||||||
console.log(
|
|
||||||
`已将热更版本 ${versionId} 绑定到原生版本 ${pkg.name} (id: ${pkg.id})`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
console.log(`操作完成,共已绑定 ${pkgs.length} 个原生版本`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { data } = await get(`/app/${appId}/package/list?limit=1000`);
|
|
||||||
if (pkgVersion) {
|
|
||||||
pkgVersion = pkgVersion.trim();
|
|
||||||
const pkg = data.find((d) => d.name === pkgVersion);
|
|
||||||
if (pkg) {
|
|
||||||
pkgId = pkg.id;
|
|
||||||
} else {
|
|
||||||
throw new Error(`未查询到匹配原生版本:${pkgVersion}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!pkgId) {
|
|
||||||
pkgId = options.packageId || (await choosePackage(appId)).id;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pkgId) {
|
|
||||||
throw new Error('请提供 packageId 或 packageVersion 参数');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pkgVersion) {
|
|
||||||
const pkg = data.find((d) => d.id === pkgId);
|
|
||||||
if (pkg) {
|
|
||||||
pkgVersion = pkg.name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rollout) {
|
|
||||||
await put(`/app/${appId}/version/${versionId}`, {
|
|
||||||
config: {
|
|
||||||
rollout: {
|
|
||||||
[pkgVersion]: rollout,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
console.log(
|
|
||||||
`已将在原生版本 ${pkgVersion} (id: ${pkgId}) 上设置灰度发布 ${rollout}% 热更版本 ${versionId} `,
|
|
||||||
);
|
);
|
||||||
|
if (pkgsToBind.length === 0) {
|
||||||
|
throw new Error(
|
||||||
|
t('nativeVersionNotFoundGte', { version: minPkgVersion }),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else if (maxPkgVersion) {
|
||||||
|
maxPkgVersion = String(maxPkgVersion).trim();
|
||||||
|
pkgsToBind = allPkgs.filter((pkg: Package) =>
|
||||||
|
satisfies(pkg.name, `<=${maxPkgVersion}`),
|
||||||
|
);
|
||||||
|
if (pkgsToBind.length === 0) {
|
||||||
|
throw new Error(
|
||||||
|
t('nativeVersionNotFoundLte', { version: maxPkgVersion }),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else if (pkgVersion) {
|
||||||
|
pkgVersion = pkgVersion.trim();
|
||||||
|
const pkg = allPkgs.find((pkg: Package) => pkg.name === pkgVersion);
|
||||||
|
if (pkg) {
|
||||||
|
pkgsToBind = [pkg];
|
||||||
|
} else {
|
||||||
|
throw new Error(
|
||||||
|
t('nativeVersionNotFoundMatch', { version: pkgVersion }),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else if (packageVersionRange) {
|
||||||
|
packageVersionRange = packageVersionRange.trim();
|
||||||
|
pkgsToBind = allPkgs.filter((pkg: Package) =>
|
||||||
|
satisfies(pkg.name, packageVersionRange!),
|
||||||
|
);
|
||||||
|
if (pkgsToBind.length === 0) {
|
||||||
|
throw new Error(
|
||||||
|
t('nativeVersionNotFoundMatch', { version: packageVersionRange }),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!pkgId) {
|
||||||
|
pkgId = (await choosePackage(appId)).id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pkgId) {
|
||||||
|
throw new Error(t('packageIdRequired'));
|
||||||
|
}
|
||||||
|
const pkg = allPkgs.find(
|
||||||
|
(pkg: Package) => String(pkg.id) === String(pkgId),
|
||||||
|
);
|
||||||
|
if (pkg) {
|
||||||
|
pkgsToBind = [pkg];
|
||||||
|
} else {
|
||||||
|
throw new Error(t('nativePackageIdNotFound', { id: pkgId }));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await put(`/app/${appId}/package/${pkgId}`, {
|
|
||||||
|
await bindVersionToPackages({
|
||||||
|
appId,
|
||||||
versionId,
|
versionId,
|
||||||
|
pkgs: pkgsToBind,
|
||||||
|
rollout,
|
||||||
|
dryRun: options.dryRun,
|
||||||
});
|
});
|
||||||
console.log(
|
|
||||||
`已将热更版本 ${versionId} 绑定到原生版本 ${pkgVersion} (id: ${pkgId})`,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
updateVersionInfo: async ({ args, options }) => {
|
updateVersionInfo: async ({
|
||||||
const platform = checkPlatform(
|
options,
|
||||||
options.platform || (await question('平台(ios/android/harmony):')),
|
}: {
|
||||||
);
|
options: VersionCommandOptions;
|
||||||
|
}) => {
|
||||||
|
const platform = await getPlatform(options.platform);
|
||||||
const { appId } = await getSelectedApp(platform);
|
const { appId } = await getSelectedApp(platform);
|
||||||
const versionId = options.versionId || (await chooseVersion(appId)).id;
|
const versionId = options.versionId || (await chooseVersion(appId)).id;
|
||||||
|
|
||||||
const updateParams = {};
|
const updateParams: Record<string, string> = {};
|
||||||
options.name && (updateParams.name = options.name);
|
if (options.name) updateParams.name = options.name;
|
||||||
options.description && (updateParams.description = options.description);
|
if (options.description) updateParams.description = options.description;
|
||||||
options.metaInfo && (updateParams.metaInfo = options.metaInfo);
|
if (options.metaInfo) updateParams.metaInfo = options.metaInfo;
|
||||||
|
|
||||||
await put(`/app/${appId}/version/${versionId}`, updateParams);
|
await put(`/app/${appId}/version/${versionId}`, updateParams);
|
||||||
console.log('操作成功');
|
console.log(t('operationSuccess'));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
79
test-modules.js
Normal file
79
test-modules.js
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
// Simple test script to verify module loading and workflows
|
||||||
|
console.log('🔍 Testing module workflows...\n');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Test app module
|
||||||
|
console.log('=== App Module ===');
|
||||||
|
const { appModule } = require('./lib/modules/app-module');
|
||||||
|
console.log(`✅ Commands: ${appModule.commands.length}`);
|
||||||
|
console.log(`✅ Workflows: ${appModule.workflows.length}`);
|
||||||
|
appModule.workflows.forEach((w) => {
|
||||||
|
console.log(` - ${w.name}: ${w.description}`);
|
||||||
|
console.log(` Steps: ${w.steps.length}`);
|
||||||
|
});
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
// Test bundle module
|
||||||
|
console.log('=== Bundle Module ===');
|
||||||
|
const { bundleModule } = require('./lib/modules/bundle-module');
|
||||||
|
console.log(`✅ Commands: ${bundleModule.commands.length}`);
|
||||||
|
console.log(`✅ Workflows: ${bundleModule.workflows.length}`);
|
||||||
|
bundleModule.workflows.forEach((w) => {
|
||||||
|
console.log(` - ${w.name}: ${w.description}`);
|
||||||
|
console.log(` Steps: ${w.steps.length}`);
|
||||||
|
});
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
// Test package module
|
||||||
|
console.log('=== Package Module ===');
|
||||||
|
const { packageModule } = require('./lib/modules/package-module');
|
||||||
|
console.log(`✅ Commands: ${packageModule.commands.length}`);
|
||||||
|
console.log(`✅ Workflows: ${packageModule.workflows.length}`);
|
||||||
|
packageModule.workflows.forEach((w) => {
|
||||||
|
console.log(` - ${w.name}: ${w.description}`);
|
||||||
|
console.log(` Steps: ${w.steps.length}`);
|
||||||
|
});
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
// Test version module
|
||||||
|
console.log('=== Version Module ===');
|
||||||
|
const { versionModule } = require('./lib/modules/version-module');
|
||||||
|
console.log(`✅ Commands: ${versionModule.commands.length}`);
|
||||||
|
console.log(`✅ Workflows: ${versionModule.workflows.length}`);
|
||||||
|
versionModule.workflows.forEach((w) => {
|
||||||
|
console.log(` - ${w.name}: ${w.description}`);
|
||||||
|
console.log(` Steps: ${w.steps.length}`);
|
||||||
|
});
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
// Test user module
|
||||||
|
console.log('=== User Module ===');
|
||||||
|
const { userModule } = require('./lib/modules/user-module');
|
||||||
|
console.log(`✅ Commands: ${userModule.commands.length}`);
|
||||||
|
console.log(`✅ Workflows: ${userModule.workflows.length}`);
|
||||||
|
userModule.workflows.forEach((w) => {
|
||||||
|
console.log(` - ${w.name}: ${w.description}`);
|
||||||
|
console.log(` Steps: ${w.steps.length}`);
|
||||||
|
});
|
||||||
|
console.log();
|
||||||
|
|
||||||
|
console.log('🎉 All modules loaded successfully with enhanced workflows!');
|
||||||
|
|
||||||
|
// Summary
|
||||||
|
const totalWorkflows = [
|
||||||
|
appModule,
|
||||||
|
bundleModule,
|
||||||
|
packageModule,
|
||||||
|
versionModule,
|
||||||
|
userModule,
|
||||||
|
].reduce((sum, module) => sum + module.workflows.length, 0);
|
||||||
|
|
||||||
|
console.log(`\n📊 Summary:`);
|
||||||
|
console.log(` Total workflows: ${totalWorkflows}`);
|
||||||
|
console.log(` Enhanced modules: 5/5`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('❌ Error testing modules:', error.message);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
@@ -4,7 +4,8 @@
|
|||||||
"target": "ESNext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
|
"target": "ESNext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
|
||||||
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
|
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
|
||||||
"lib": [
|
"lib": [
|
||||||
"ESNext"
|
"ESNext",
|
||||||
|
"DOM"
|
||||||
] /* Specify library files to be included in the compilation. */,
|
] /* Specify library files to be included in the compilation. */,
|
||||||
"allowJs": true /* Allow javascript files to be compiled. */,
|
"allowJs": true /* Allow javascript files to be compiled. */,
|
||||||
// "checkJs": true /* Report errors in .js files. */,
|
// "checkJs": true /* Report errors in .js files. */,
|
||||||
|
|||||||
Reference in New Issue
Block a user