abc-tool-cli
v0.0.9
Published
CLI tool for managing web applications
Readme
abc-tools
CLI tool for managing web applications in the ABC system. This package provides comprehensive utilities for initializing, configuring, and managing different types of applications.
📦 Installation
pnpm add abc-tools🚀 Key Features
1. Application Management
- Initialize different types of applications (single, state, parent)
- Fetch and update app configurations
- Manage app lists and schemas
2. Database Management
- Update database schemas
- Generate initialization data for service workers
- Sync database models across packages
3. Service Worker Setup
- Configure service workers for different app types
- Generate integrity hashes
- Setup caching strategies
4. Data Fetching
- Fetch app configurations from API
- Retrieve topics and test data
- Get member information and SEO data
5. File Management
- Generate TypeScript and JSON files
- Update environment configurations
- Manage app icons and assets
📚 CLI Commands
tools init
Initialize configuration and fetch apps data.
tools initWhat it does:
- Fetches apps data from API
- Creates
data/listApp.tswith app configurations - Creates
data/schema.tswith database schemas - Updates apps data successfully
tools get-list-app
Setup and update the list of applications.
tools get-list-appWhat it does:
- Fetches current apps data from API
- Updates
data/listApp.tswith latest configurations - Handles different app types (single, state, parent)
tools update-ver
Update version information across the project.
tools update-verWhat it does:
- Updates version information in relevant files
- Syncs version across packages
- Maintains version consistency
tools update-db
Update database schemas and service worker initialization data.
tools update-dbWhat it does:
- Reads database schema from
data/schema.ts - Updates database models in
packages/db/src/model/index.ts - Generates service worker initialization data
- Syncs database version and stores
tools sw <appName>
Setup service worker for a specific application.
tools sw <appName> [options]Options:
-t, --type <type>: Application type (single, parent, state) - default: single
Example:
tools sw asvab --type singleWhat it does:
- Configures service worker for the specified app
- Sets up caching strategies
- Generates necessary files
tools init-app <appName>
Initialize and build an application.
tools init-app <appName> [options]Options:
-e, --env <environment>: Environment (dev, staging, prod) - default: dev-t, --type <type>: Application type (single, parent, state) - default: single
Examples:
# Initialize single app
tools init-app asvab --type single --env dev
# Initialize state app
tools init-app cdl --type state --env staging
# Initialize parent app
tools init-app easyprep --type parent --env prodWhat it does:
- Fetches app configuration and data
- Processes topics and test data
- Generates necessary files and configurations
- Sets up environment variables
- Creates service worker files
🔧 API Functions
Data Fetching
getDataSingleApp(appName)
Fetch app configuration data.
import { getDataSingleApp } from "abc-tools";
const appData = await getDataSingleApp("asvab");getDataTopicsAndTest(appName)
Fetch topics and test data for an app.
import { getDataTopicsAndTest } from "abc-tools";
const { topics, tests } = await getDataTopicsAndTest("asvab");getDataMember()
Fetch member information.
import { getDataMember } from "abc-tools";
const members = await getDataMember();getDataSeo(appName)
Fetch SEO information for an app.
import { getDataSeo } from "abc-tools";
const seoInfo = await getDataSeo("asvab");File Management
saveJSONFile(filePath, data)
Save data as JSON file.
import { saveJSONFile } from "abc-tools";
saveJSONFile("data/config.json", { key: "value" });saveTSFile(filePath, exportName, data)
Save data as TypeScript file with export.
import { saveTSFile } from "abc-tools";
saveTSFile("src/config.ts", "appConfig", { name: "test" });generateIcon(options)
Generate app icon from configuration.
import { generateIcon } from "abc-tools";
const icon = await generateIcon({
appShortName: "asvab",
bucket: "asvab-bucket",
});Environment Management
updateEnv(options)
Update environment configuration.
import { updateEnv } from "abc-tools";
await updateEnv({
appInfo: appData,
environments: "dev",
authSecret: "secret",
type: "single",
integrity: "hash",
});genAuthSecret(environments)
Generate authentication secret.
import { genAuthSecret } from "abc-tools";
const secret = await genAuthSecret("dev");🧪 Development
# Build package
pnpm build
# Development mode
pnpm dev
# Type checking
pnpm type
# Clean dist
pnpm clean📦 Dependencies
Production Dependencies
abc-core- Core functionalitycommander- CLI frameworkaxios- HTTP clientnode-fetch- Fetch APIp-limit- Concurrency controlabc-model- Data modelsuuid- UUID generation
Development Dependencies
@repo/eslint-config- ESLint configuration@types/node- Node.js types
🔄 Workflow
Typical Usage Flow
Initialize Configuration
tools initUpdate Database
tools update-dbSetup Service Worker
tools sw asvab --type singleInitialize Application
tools init-app asvab --type single --env dev
📄 License
MIT
