Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wgtechlabs/log-engine",
"version": "2.1.0",
"version": "2.1.1",
"description": "A lightweight, security-first logging utility with automatic data redaction for Node.js applications - the first logging library with built-in PII protection.",
"type": "module",
"keywords": [
Expand All @@ -24,8 +24,21 @@
"contributors": [
"Waren Gonzaga <[email protected]> (https://warengonzaga.com)"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "./dist/cjs/index.cjs",
"module": "./dist/esm/index.js",
"types": "./dist/esm/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.cjs"
}
}
},
"files": [
"dist/**/*",
"README.md",
Expand All @@ -36,8 +49,9 @@
"url": "https://github.com/wgtechlabs/log-engine.git"
},
"scripts": {
"build": "tsc",
"start": "node dist/index.js",
"build": "node scripts/forklift-runner.js --clean",
"build:watch": "node scripts/forklift-runner.js --watch",
"start": "node dist/cjs/index.cjs",
"prepublishOnly": "yarn build",
"test": "jest",
"test:watch": "jest --watch",
Expand Down
62 changes: 62 additions & 0 deletions scripts/forklift-runner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env node

/**
* @wgtechlabs/forklift - Entry Point Runner
*
* This is the main CLI entry point for the Forklift dual build system.
* It provides a lightweight interface that loads and executes the main
* forklift.js module with the appropriate configuration.
*
* When forklift is extracted as a standalone npm package, this file will
* become the `bin` entry point, allowing users to run `npx forklift` or
* install it globally and run `forklift` from anywhere.
*
* @author Waren Gonzaga, WG Technology Labs
* @version 1.0.0
* @license MIT
*/

// Import and run the forklift module
import('./forklift.js').then(async (forklift) => {
// Merge default configuration with runtime overrides
const config = {
...forklift.defaultConfig,
clean: process.argv.includes('--clean'),
watch: process.argv.includes('--watch'),
verbose: process.argv.includes('--verbose') || process.argv.includes('-v'),
dryRun: process.argv.includes('--dry-run') || process.argv.includes('-n'),
};

if (process.argv.includes('--help') || process.argv.includes('-h')) {
console.log(`
🚀 @wgtechlabs/forklift - Dual Build System

Usage: node scripts/forklift-runner.js [options]

Options:
--clean Clean output directory before build
--watch Watch mode (rebuild on file changes)
--verbose, -v Enable verbose logging
--dry-run, -n Show what would be done without building
--help, -h Show this help message
`);
process.exit(0);
}

try {
forklift.validateConfig(config);

if (config.watch) {
await forklift.watchMode(config);
} else {
const success = await forklift.build(config);
process.exit(success ? 0 : 1);
}
} catch (error) {
console.error('❌ Forklift error:', error.message);
process.exit(1);
}
}).catch(error => {
console.error('❌ Failed to load forklift:', error);
process.exit(1);
});
Loading
Loading