Thank you for your interest in contributing to the LiveTemplate client library!
# Clone the repository
git clone https://github.com/livetemplate/client.git
cd client
# Install dependencies
npm install
# Install git hooks
./scripts/install-hooks.sh
# Run tests
npm test
# Build
npm run build
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fix
# Run all tests
npm test
# Run specific test file
npm test -- focus-manager
# Run with coverage
npm test -- --coverage
# Build to verify no errors
npm run build
The repository has a pre-commit hook that will:
Commits must pass all checks before they can be committed.
git add .
git commit -m "feat: add new feature"
We follow Conventional Commits:
feat: New featurefix: Bug fixdocs: Documentation changestest: Adding or updating testsrefactor: Code refactoringperf: Performance improvementschore: Build process or tooling changesExamples:
feat: add keyboard navigation support
fix: prevent focus loss during updates
docs: update API documentation
test: add tests for modal manager
git push origin feature/your-feature-name
Then create a Pull Request on GitHub.
any types when possibleLiveTemplateClient, FocusManager)sendEvent, morphTree)MAX_RETRIES, DEFAULT_TIMEOUT)_internalState)describe("ComponentName", () => {
describe("method", () => {
it("should do something specific", () => {
// Arrange
const component = new Component();
// Act
const result = component.method();
// Assert
expect(result).toBe(expected);
});
});
});
# All tests
npm test
# Watch mode (for development)
npm test -- --watch
# With coverage
npm test -- --coverage
# Specific file
npm test -- event-delegation.test.ts
Add to dom/ directory:
// dom/my-feature.ts
export class MyFeature {
constructor(private element: HTMLElement) {}
public doSomething(): void {
// Implementation
}
}
Add to state/ directory for features that manage application state.
Add to transport/ directory for network-related features.
If the feature should be part of the main client API, update livetemplate-client.ts:
import { MyFeature } from "./dom/my-feature";
export class LiveTemplateClient {
private myFeature: MyFeature;
constructor(options: LiveTemplateClientOptions) {
// ...
this.myFeature = new MyFeature(this.targetElement);
}
}
The client follows the core library's major.minor version:
Before releasing:
./scripts/release.shReleases are automated via scripts/release.sh:
# Dry run (no changes)
./scripts/release.sh --dry-run
# Actual release
./scripts/release.sh
The script will:
Creating the GitHub release fires the Publish workflow
(.github/workflows/publish.yml), which then:
package.json version matches the tag--provenance
(no NPM_TOKEN secret — npm trusts the GitHub Actions OIDC identity,
configured once on npmjs.com under the package's Trusted Publishers)npm view check with retry/backoffnpm publish step succeeded but the
post-publish npm view verification could not confirm visibility
within ~100s (npm registry replication can lag 10–60s and
occasionally longer). The package IS published — manually confirm
with npm view @livetemplate/client@<version> before taking any
action. Do not deprecate or roll back based on this warning alone.Publish to npm: real publish failure.
Fix and re-run from the Actions UI; no need to recreate the tag.npm unpublish — npm forbids it after 72h and it
breaks downstream installs. Use npm deprecate for bad versions.If the LiveTemplate protocol changes (tree format, WebSocket messages, etc.):
Update for:
Add examples for new features in:
By contributing, you agree that your contributions will be licensed under the MIT License.