Skip to content

Commit 1aa7523

Browse files
authored
🚀 release: v2.1.1 - Merge pull request #19 from wgtechlabs/dev
2 parents abdcf36 + 74b085f commit 1aa7523

File tree

5 files changed

+1307
-5
lines changed

5 files changed

+1307
-5
lines changed

package.json

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wgtechlabs/log-engine",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "A lightweight, security-first logging utility with automatic data redaction for Node.js applications - the first logging library with built-in PII protection.",
55
"type": "module",
66
"keywords": [
@@ -24,8 +24,21 @@
2424
"contributors": [
2525
"Waren Gonzaga <[email protected]> (https://warengonzaga.com)"
2626
],
27-
"main": "dist/index.js",
28-
"types": "dist/index.d.ts",
27+
"main": "./dist/cjs/index.cjs",
28+
"module": "./dist/esm/index.js",
29+
"types": "./dist/esm/index.d.ts",
30+
"exports": {
31+
".": {
32+
"import": {
33+
"types": "./dist/esm/index.d.ts",
34+
"default": "./dist/esm/index.js"
35+
},
36+
"require": {
37+
"types": "./dist/cjs/index.d.ts",
38+
"default": "./dist/cjs/index.cjs"
39+
}
40+
}
41+
},
2942
"files": [
3043
"dist/**/*",
3144
"README.md",
@@ -36,8 +49,9 @@
3649
"url": "https://github.com/wgtechlabs/log-engine.git"
3750
},
3851
"scripts": {
39-
"build": "tsc",
40-
"start": "node dist/index.js",
52+
"build": "node scripts/forklift-runner.js --clean",
53+
"build:watch": "node scripts/forklift-runner.js --watch",
54+
"start": "node dist/cjs/index.cjs",
4155
"prepublishOnly": "yarn build",
4256
"test": "jest",
4357
"test:watch": "jest --watch",

scripts/forklift-runner.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* @wgtechlabs/forklift - Entry Point Runner
5+
*
6+
* This is the main CLI entry point for the Forklift dual build system.
7+
* It provides a lightweight interface that loads and executes the main
8+
* forklift.js module with the appropriate configuration.
9+
*
10+
* When forklift is extracted as a standalone npm package, this file will
11+
* become the `bin` entry point, allowing users to run `npx forklift` or
12+
* install it globally and run `forklift` from anywhere.
13+
*
14+
* @author Waren Gonzaga, WG Technology Labs
15+
* @version 1.0.0
16+
* @license MIT
17+
*/
18+
19+
// Import and run the forklift module
20+
import('./forklift.js').then(async (forklift) => {
21+
// Merge default configuration with runtime overrides
22+
const config = {
23+
...forklift.defaultConfig,
24+
clean: process.argv.includes('--clean'),
25+
watch: process.argv.includes('--watch'),
26+
verbose: process.argv.includes('--verbose') || process.argv.includes('-v'),
27+
dryRun: process.argv.includes('--dry-run') || process.argv.includes('-n'),
28+
};
29+
30+
if (process.argv.includes('--help') || process.argv.includes('-h')) {
31+
console.log(`
32+
🚀 @wgtechlabs/forklift - Dual Build System
33+
34+
Usage: node scripts/forklift-runner.js [options]
35+
36+
Options:
37+
--clean Clean output directory before build
38+
--watch Watch mode (rebuild on file changes)
39+
--verbose, -v Enable verbose logging
40+
--dry-run, -n Show what would be done without building
41+
--help, -h Show this help message
42+
`);
43+
process.exit(0);
44+
}
45+
46+
try {
47+
forklift.validateConfig(config);
48+
49+
if (config.watch) {
50+
await forklift.watchMode(config);
51+
} else {
52+
const success = await forklift.build(config);
53+
process.exit(success ? 0 : 1);
54+
}
55+
} catch (error) {
56+
console.error('❌ Forklift error:', error.message);
57+
process.exit(1);
58+
}
59+
}).catch(error => {
60+
console.error('❌ Failed to load forklift:', error);
61+
process.exit(1);
62+
});

0 commit comments

Comments
 (0)