This guide will help you migrate from @expressive-tea/commons and @expressive-tea/plugin version 0.0.x to 2.0.0.
Important
These packages (v2.0.0) require @expressive-tea/core >= 2.0.0
- ✅ If using Expressive Tea Core v2.x: Upgrade to these packages v2.0.0
- ❌ If using Expressive Tea Core v1.x: Stay on packages v1.x (or upgrade Core to v2.x first)
Important: You must upgrade both the core framework AND these packages together. Using mismatched versions will cause runtime errors.
📦 Expressive Tea Core: github.com/Expressive-Tea/expresive-tea
Version 2.0.0 is a major modernization release that brings the packages monorepo up to current standards with TypeScript 5, Node.js 18+, comprehensive testing, and improved documentation.
Migration Difficulty: 🟢 Easy - Most changes are internal; public APIs remain largely compatible.
| Change | Impact | Action Required |
|---|---|---|
| @expressive-tea/core >= 2.0.0 required | Upgrade Core framework to v2.x | |
| Node.js 18+ required | Update Node.js version | |
| TypeScript 5+ required | Update TypeScript version | |
Build output moved to dist/ |
🟢 LOW | None (consumers unaffected) |
| Lodash removed | 🟢 LOW | None (internal change) |
| Strict TypeScript mode | 🟢 LOW | Fix type errors if using strict mode |
Before migrating, ensure your project meets these requirements:
- @expressive-tea/core ≥ 2.0.0 ⭐ REQUIRED
- Node.js ≥ 18.0.0 (LTS recommended)
- TypeScript ≥ 5.0.0 (if using TypeScript)
- reflect-metadata 0.2.x
Check your current version:
node --versionIf below v18.0.0, upgrade Node.js:
# Using nvm (recommended)
nvm install 18
nvm use 18
# Or download from https://nodejs.org/Update your package.json:
{
"engines": {
- "node": ">=12.0.0"
+ "node": ">=18.0.0"
}
}Update TypeScript to v5+:
npm install --save-dev typescript@^5.9.3
# or
yarn add -D typescript@^5.9.3Verify your tsconfig.json:
{
"compilerOptions": {
"target": "ES2017",
"module": "commonjs",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
// Recommended for maximum safety
"strict": true,
"strictNullChecks": true,
"noImplicitAny": true
}
}Update package.json dependencies:
{
"dependencies": {
- "@expressive-tea/commons": "^0.0.x",
- "@expressive-tea/plugin": "^0.0.x",
+ "@expressive-tea/commons": "^2.0.0",
+ "@expressive-tea/plugin": "^2.0.0",
"reflect-metadata": "^0.2.0"
}
}Install the updated packages:
npm install
# or
yarn installNo code changes are required for most projects. The public APIs are backward-compatible.
Run your tests:
npm test
# or
yarn testBuild your project:
npm run build
# or
yarn buildIf you enabled TypeScript strict mode, you may encounter new type errors. Common issues:
import { Metadata } from '@expressive-tea/commons';
- const value = Metadata.get('key', target); // Could be undefined
+ const value = Metadata.get('key', target);
+ if (value === undefined) {
+ throw new Error('Metadata not found');
+ }import { Plugin, BOOT_STAGES, Stage } from '@expressive-tea/plugin';
- @Stage(BOOT_STAGES.APPLICATION)
- setup(server) { // Error: Parameter 'server' implicitly has 'any' type
+ setup(server: Express): void {- Comprehensive Testing - 94%+ code coverage with Jest
- Full JSDoc Documentation - All public APIs documented with examples
- ESLint v9 - Modern flat config with type-aware linting
- Prettier Formatting - Consistent code style across packages
- Native Utilities - Removed lodash, using native JavaScript
- Yarn 4 Workspaces - Faster, more reliable builds
- TypeScript Strict Mode - Better type safety and IDE support
- Enhanced Error Messages - More helpful debugging information
- Better IDE Support - Improved autocomplete and inline docs
- Gulp Build System - Replaced with native TypeScript compilation
- TSLint - Replaced with ESLint v9
- Lodash - Replaced with native JavaScript utilities
All public APIs are backward-compatible:
| API | Status | Notes |
|---|---|---|
Metadata.set() |
✅ Compatible | No changes |
Metadata.get() |
✅ Compatible | No changes |
Metadata.has() |
✅ Compatible | No changes |
Metadata.delete() |
✅ Compatible | No changes |
Metadata.getKeys() |
✅ Compatible | No changes |
Metadata.getType() |
✅ Compatible | No changes |
Metadata.getParamTypes() |
✅ Compatible | No changes |
Metadata.getReturnType() |
✅ Compatible | No changes |
getClass() |
✅ Compatible | No changes |
All public APIs are backward-compatible:
| API | Status | Notes |
|---|---|---|
Plugin class |
✅ Compatible | No changes |
@Stage decorator |
✅ Compatible | No changes |
BOOT_STAGES enum |
✅ Compatible | No changes |
DependencyNotFound |
✅ Compatible | No changes |
getRegisteredStage() |
✅ Compatible | No changes |
Internal changes (no impact on consumers):
- Lodash functions replaced with native utilities (
findIndex,size,each) - Build output moved to
dist/directory (package.jsonmainfield updated)
Solution: Ensure you've installed the correct version:
npm install @expressive-tea/commons@^2.0.0Solution: Upgrade to Node.js 18+:
nvm install 18
nvm use 18Solution: Either fix the type errors or disable strict mode temporarily:
{
"compilerOptions": {
"strict": false
}
}Solution: Ensure your TypeScript config is properly set up:
npx tsc --initSolution: Ensure reflect-metadata is imported at the top of your entry file:
import 'reflect-metadata'; // Must be first import
import { Plugin } from '@expressive-tea/plugin';Create a simple test to verify everything works:
import 'reflect-metadata';
import { Metadata } from '@expressive-tea/commons';
import { Plugin, BOOT_STAGES, Stage } from '@expressive-tea/plugin';
import { Express } from 'express';
// Test commons
class TestClass {}
Metadata.set('test', 'value', TestClass);
const value = Metadata.get('test', TestClass);
console.log('✅ Commons working:', value === 'value');
// Test plugin
class TestPlugin extends Plugin {
protected name = 'TestPlugin';
@Stage(BOOT_STAGES.APPLICATION)
setup(server: Express): void {
console.log('✅ Plugin working');
}
}
const plugin = new TestPlugin();
const stages = plugin.getRegisteredStage(BOOT_STAGES.APPLICATION);
console.log('✅ Stage registration working:', stages.length > 0);Run the test:
npx ts-node test-migration.tsExpected output:
✅ Commons working: true
✅ Plugin working
✅ Stage registration working: true
Version 2.0.0 includes several performance optimizations:
| Metric | v0.0.x | v2.0.0 | Improvement |
|---|---|---|---|
| Bundle Size (plugin) | ~45 KB | ~22 KB | -51% smaller |
| TypeScript Compilation | ~2.5s | ~1.3s | 48% faster |
| Test Coverage | 0% | 94%+ | New |
If you encounter issues and need to rollback:
# Revert package versions
npm install @expressive-tea/commons@0.0.x @expressive-tea/plugin@0.0.x
# Or using yarn
yarn add @expressive-tea/commons@0.0.x @expressive-tea/plugin@0.0.xNote: Version 0.0.x is no longer maintained. Please report issues on GitHub so we can help you migrate successfully.
If you need assistance migrating:
- 📖 Documentation
- 💬 Gitter Chat - Real-time support
- 🐛 GitHub Issues - Report problems
- 📧 Email Support - Direct help
No. The Plugin class and @Stage decorator are fully compatible. Your existing plugins will work without changes.
Not recommended. Upgrade to @expressive-tea/core v2.0.0 for full compatibility.
No. The runtime behavior is identical. All changes are internal optimizations and quality improvements.
Yes. If your tests passed with v0.0.x, they should pass with v2.0.0 without modifications.
Please report it on GitHub Issues with:
- Package name and version
- Node.js and TypeScript versions
- Minimal reproduction code
- Error messages and stack traces
After migrating successfully:
-
Read the updated documentation:
-
Explore new features:
- Review the comprehensive JSDoc documentation
- Check out the test files for usage examples
-
Contribute back:
- Report issues or suggest improvements
- Share your plugins with the community
- Help improve the documentation
Migrating to v2.0.0 is straightforward:
- ✅ Upgrade Node.js to 18+
- ✅ Upgrade TypeScript to 5+ (if applicable)
- ✅ Update package versions
- ✅ Run tests and build
No code changes required for most projects!
Welcome to Expressive Tea 2.0! 🍵
Made with ☕ and 🍵 by the Expressive Tea Team