rename package from @push.rocks/npmextra to @push.rocks/smartconfig

- Rename all source files from npmextra.* to simpler names (classes.appdata.ts, etc.)
- Rename Npmextra class to Smartconfig
- Config file changed from npmextra.json to smartconfig.json
- KV store path changed from ~/.npmextra/kv to ~/.smartconfig/kv
- Update all imports, tests, and metadata
This commit is contained in:
2026-03-24 14:56:23 +00:00
parent fdc2420238
commit 22a9aa9f3e
23 changed files with 202 additions and 363 deletions

View File

@@ -1,4 +1,4 @@
# @push.rocks/npmextra 🚀
# @push.rocks/smartconfig 🚀
**Supercharge your npm projects with powerful configuration management, tool orchestration, and persistent key-value storage.**
@@ -6,19 +6,19 @@
```bash
# Using npm
npm install @push.rocks/npmextra --save
npm install @push.rocks/smartconfig --save
# Using pnpm (recommended)
pnpm add @push.rocks/npmextra
pnpm add @push.rocks/smartconfig
```
## Overview 🎯
`@push.rocks/npmextra` is your Swiss Army knife for npm project configuration. It eliminates configuration sprawl by centralizing tool settings, providing intelligent key-value storage, and offering powerful environment variable mapping with automatic type conversions.
`@push.rocks/smartconfig` is your Swiss Army knife for npm project configuration. It eliminates configuration sprawl by centralizing tool settings, providing intelligent key-value storage, and offering powerful environment variable mapping with automatic type conversions.
### Why npmextra?
### Why smartconfig?
- **🎛️ Centralized Configuration**: Manage all your tool configs in one `npmextra.json` file
- **🎛️ Centralized Configuration**: Manage all your tool configs in one `smartconfig.json` file
- **💾 Persistent Storage**: Smart key-value store with multiple storage strategies
- **🔐 Environment Mapping**: Sophisticated env var handling with automatic type conversion
- **🏗️ TypeScript First**: Full type safety and IntelliSense support
@@ -27,28 +27,28 @@ pnpm add @push.rocks/npmextra
## Core Concepts 🏗️
### 1. Npmextra Configuration Management
### 1. Smartconfig Configuration Management
Stop scattering configuration across dozens of files. Centralize everything in `npmextra.json`:
Stop scattering configuration across dozens of files. Centralize everything in `smartconfig.json`:
```typescript
import { Npmextra } from '@push.rocks/npmextra';
import { Smartconfig } from '@push.rocks/smartconfig';
// Initialize with current directory
const npmextra = new Npmextra();
const smartconfig = new Smartconfig();
// Or specify a custom path
const npmextra = new Npmextra('/path/to/project');
const smartconfig = new Smartconfig('/path/to/project');
// Get merged configuration for any tool
const eslintConfig = npmextra.dataFor<EslintConfig>('eslint', {
// Default values if not in npmextra.json
const eslintConfig = smartconfig.dataFor<EslintConfig>('eslint', {
// Default values if not in smartconfig.json
extends: 'standard',
rules: {}
});
```
**npmextra.json example:**
**smartconfig.json example:**
```json
{
"eslint": {
@@ -69,7 +69,7 @@ const eslintConfig = npmextra.dataFor<EslintConfig>('eslint', {
A flexible key-value store that persists data between script executions:
```typescript
import { KeyValueStore } from '@push.rocks/npmextra';
import { KeyValueStore } from '@push.rocks/smartconfig';
interface UserSettings {
username: string;
@@ -115,10 +115,10 @@ await kvStore.waitForKeysPresent(['apiKey']);
### 3. AppData - Advanced Environment Management 🌟
The crown jewel of npmextra - sophisticated environment variable mapping with automatic type conversion:
The crown jewel of smartconfig - sophisticated environment variable mapping with automatic type conversion:
```typescript
import { AppData } from '@push.rocks/npmextra';
import { AppData } from '@push.rocks/smartconfig';
interface AppConfig {
apiUrl: string;
@@ -264,7 +264,7 @@ AppData intelligently handles boolean conversions:
AppData provides convenient static methods for directly accessing and converting environment variables without creating an instance:
```typescript
import { AppData } from '@push.rocks/npmextra';
import { AppData } from '@push.rocks/smartconfig';
// Get environment variable as boolean
const isEnabled = await AppData.valueAsBoolean('FEATURE_ENABLED');
@@ -375,10 +375,10 @@ const missingKeys = await appData.logMissingKeys();
## Real-World Example 🌍
Here's a complete example of a CLI tool using npmextra:
Here's a complete example of a CLI tool using smartconfig:
```typescript
import { Npmextra, AppData, KeyValueStore } from '@push.rocks/npmextra';
import { Smartconfig, AppData, KeyValueStore } from '@push.rocks/smartconfig';
interface CliConfig {
githubToken: string;
@@ -391,14 +391,14 @@ interface CliConfig {
}
class MyCLI {
private npmextra: Npmextra;
private smartconfig: Smartconfig;
private appData: AppData<CliConfig>;
private cache: KeyValueStore<{[key: string]: any}>;
async initialize() {
// Load tool configuration
this.npmextra = new Npmextra();
const config = this.npmextra.dataFor<any>('mycli', {
this.smartconfig = new Smartconfig();
const config = this.smartconfig.dataFor<any>('mycli', {
defaultModel: 'gpt-3'
});
@@ -450,10 +450,10 @@ cli.run();
## API Reference 📚
### Npmextra Class
### Smartconfig Class
```typescript
new Npmextra(cwdArg?: string)
new Smartconfig(cwdArg?: string)
```
- `cwdArg`: Optional working directory path