|
| 1 | +# Licia - Project Guide for Code Agents |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Licia is a zero-dependency JavaScript utility library containing 455+ individual utility modules. Each module is independent and can be used standalone via the eustia build tool. |
| 6 | + |
| 7 | +## Tech Stack |
| 8 | + |
| 9 | +- **Language**: JavaScript (ES6+), TypeScript (type declarations) |
| 10 | +- **Build Tool**: eustia (custom module bundler via `licia` CLI) |
| 11 | +- **Test Framework**: Mocha + Chai (Node), Karma (Browser) |
| 12 | +- **Coverage**: nyc + istanbul |
| 13 | +- **Linter**: ESLint 8 |
| 14 | +- **Formatter**: Prettier |
| 15 | +- **Transpiler**: Babel (for ES5 output) |
| 16 | +- **Type Checking**: TypeScript 5.x (for `.d.ts` validation) |
| 17 | +- **Node Types**: @types/node 20 |
| 18 | + |
| 19 | +## Project Structure |
| 20 | + |
| 21 | +``` |
| 22 | +src/ # 455+ utility module source files (one file per module) |
| 23 | +test/ # Test files (mirrors src/ structure, one test per module) |
| 24 | +lib/ # Build scripts and tooling (build, test, lint, format, etc.) |
| 25 | +bin/ # CLI entry point (licia command) |
| 26 | +benchmark/ # Performance benchmarks |
| 27 | +demo/ # Demo files |
| 28 | +i18n/ # Internationalization |
| 29 | +index.json # Module metadata (dependencies, env, description) |
| 30 | +tsconfig.json # TypeScript config (for test:ts) |
| 31 | +eslint.src.js # ESLint config for source/lib |
| 32 | +eslint.release.js # ESLint config for release builds |
| 33 | +``` |
| 34 | + |
| 35 | +## Module Format |
| 36 | + |
| 37 | +Each module in `src/` follows this structure: |
| 38 | + |
| 39 | +```javascript |
| 40 | +/* Description and API documentation (markdown table format) */ |
| 41 | + |
| 42 | +/* example |
| 43 | + * usage examples |
| 44 | + */ |
| 45 | + |
| 46 | +/* module |
| 47 | + * env: all|node|browser |
| 48 | + */ |
| 49 | + |
| 50 | +/* typescript |
| 51 | + * type declarations |
| 52 | + */ |
| 53 | + |
| 54 | +_('dependency1 dependency2'); // declare dependencies on other licia modules |
| 55 | + |
| 56 | +exports = function(...) { ... }; // module export |
| 57 | +``` |
| 58 | + |
| 59 | +## Licia CLI (Global Link) |
| 60 | + |
| 61 | +This repo is globally linked via `npm link`, providing the `licia` command. The CLI supports per-module operations, which is the preferred way to develop and test individual modules: |
| 62 | + |
| 63 | +```bash |
| 64 | +# Format a single module (runs prettier + comment formatting) |
| 65 | +licia format <moduleName> |
| 66 | + |
| 67 | +# Lint a single module (eslint --fix on src and test file) |
| 68 | +licia lint <moduleName> |
| 69 | + |
| 70 | +# Test a single module in Node.js (-s for silent) |
| 71 | +licia test <moduleName> -s |
| 72 | + |
| 73 | +# Test a single module in browser |
| 74 | +licia test <moduleName> -bs |
| 75 | + |
| 76 | +# Test with TypeScript declaration check |
| 77 | +licia test <moduleName> -s --ts |
| 78 | + |
| 79 | +# Build a single module |
| 80 | +licia build <moduleName> |
| 81 | + |
| 82 | +# Run benchmark for a single module |
| 83 | +licia benchmark <moduleName> |
| 84 | +``` |
| 85 | + |
| 86 | +Without a module name, these commands operate on all modules. |
| 87 | + |
| 88 | +### CLI Flags |
| 89 | + |
| 90 | +| Flag | Short | Description | |
| 91 | +|------|-------|-------------| |
| 92 | +| --browser | -b | Run browser tests (Karma) | |
| 93 | +| --silent | -s | Suppress verbose output | |
| 94 | +| --all | -a | Include all modules | |
| 95 | +| --sauce | | Use Sauce Labs for browser tests | |
| 96 | +| --ts | | Include TypeScript declaration test | |
| 97 | +| --release | -r | Test release build | |
| 98 | +| --docker | -d | Use Docker environment | |
| 99 | + |
| 100 | +## npm Scripts (Full Suite) |
| 101 | + |
| 102 | +- `npm run test:node` - Run all Node.js tests |
| 103 | +- `npm run test:browser` - Run all browser tests (Karma + Chrome) |
| 104 | +- `npm run test:ts` - Validate all TypeScript declarations |
| 105 | +- `npm test` - Run all tests (node + browser + release + ts) |
| 106 | +- `npm run lint` - Lint source and lib files |
| 107 | +- `npm run build` - Build release packages |
| 108 | +- `npm run format` - Format all code with Prettier + licia format |
| 109 | + |
| 110 | +## Notes |
| 111 | + |
| 112 | +- Dependencies between modules are declared via `_('moduleName')` syntax, not npm packages. |
| 113 | +- `index.json` contains the full dependency graph and metadata for all modules. |
| 114 | +- The `.licia/` directory is a build output directory (generated, not committed). |
| 115 | +- Each module targets a specific environment: `all`, `node`, or `browser` (declared in the module header). |
0 commit comments