build: configure npm package for publication

Phase 4-5 Complete:
-  Updated package.json to v1.0.0 with proper entry points
-  Added peer dependency on marked.js (^11.0.0 || ^12.0.0 || ^13.0.0)
-  Set module type to ESM to fix Rollup warnings
-  Configured files array for distribution (dist/ only)
-  Added prepublishOnly script (build + test)
-  Created .npmignore to exclude dev files
-  Created CHANGELOG.md following Keep a Changelog format

Package details:
- Main: dist/testdrive-jsui.cjs.js (CommonJS)
- Module: dist/testdrive-jsui.esm.js (ES Module)
- Browser: dist/testdrive-jsui.min.js (107KB minified)
- Style: dist/testdrive-jsui.css
- Total package size: 445.9 KB (13 files)

npm pack --dry-run verified successfully!
This commit is contained in:
2025-12-16 22:46:31 +01:00
parent a7856f4b20
commit fa9ae3b9ff
3 changed files with 173 additions and 19 deletions

58
.npmignore Normal file
View File

@@ -0,0 +1,58 @@
# Development files
js/tests/
tests/
examples/
docs/
node_modules/
coverage/
.nyc_output/
# Source files (we ship dist/ only)
js/
src/
static/
# Build config
rollup.config.js
.eslintrc
.babelrc
jest.config.js
tsconfig.json
# Documentation (except README, LICENSE, CHANGELOG)
CLAUDE.md
MIGRATION_STATUS.md
CLEANUP_REPORT.md
STANDALONE_PLAN.md
NPM_PUBLICATION_PLAN.md
TODO.md
Makefile
pyproject.toml
# Python stuff
__pycache__/
*.py[cod]
*.egg-info/
venv/
.pytest_cache/
src/testdrive_jsui/
# VCS
.git/
.gitignore
.gitattributes
# IDE
.vscode/
.idea/
*.swp
*.swo
*~
# OS
.DS_Store
Thumbs.db
# Misc
*.log
.env

63
CHANGELOG.md Normal file
View File

@@ -0,0 +1,63 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.0] - 2025-12-16
### Added
- Initial public release of TestDrive-JSUI as standalone npm package
- JavaScript-first markdown editor library
- Section-based editing with independent section management
- Interactive UI with compass-positioned control panels
- Support for edit and view modes
- Event-driven API for integration
- Auto-save functionality to localStorage
- Keyboard shortcuts (Ctrl+S to save, Escape to cancel)
- LocalStorage integration for content persistence
- Download markdown as .md file
- Table of contents generation
- Debug panel with logging system
- Status control showing document statistics
- Comprehensive test suite (68 Jest tests + 15 pytest tests)
- Full documentation (README, ARCHITECTURE, NPM_PUBLICATION_PLAN)
### Features
- **Core Library**: Pure JavaScript with marked.js as only peer dependency
- **Bundled Distribution**: Single-file UMD, ESM, and CJS builds
- **CSS Included**: Complete styling with GitHub theme
- **Peer Dependency**: Uses marked.js for markdown parsing
- **Multiple Installation Methods**: npm, CDN (jsdelivr, unpkg), direct download
- **Source Maps**: Available for all builds for debugging
- **Browser Support**: Modern browsers (Chrome 60+, Firefox 60+, Safari 12+, Edge 79+)
### Technical
- Built with Rollup bundler
- Transpiled with Babel for broad browser support
- Minified with Terser (107KB minified)
- CSS processed with PostCSS, autoprefixer, and cssnano
- 68 JavaScript tests passing (Jest)
- 15 Python integration tests passing (pytest)
### Package Details
- **UMD Build**: 217KB (browser-friendly, default)
- **Minified**: 107KB (production-ready)
- **ESM Build**: 199KB (for modern bundlers)
- **CJS Build**: 199KB (for Node.js)
- **CSS**: 6KB (minified, all styles inlined)
### Migration Notes
- Fully migrated from MarkiTect monorepo to standalone capability
- All 24 original JavaScript files consolidated
- Single source of truth in `/capabilities/testdrive-jsui/js/`
- Legacy files cleaned up from main application
## [Unreleased]
Nothing yet.
---
[1.0.0]: https://github.com/markitect/testdrive-jsui/releases/tag/v1.0.0

View File

@@ -1,39 +1,68 @@
{
"name": "testdrive-jsui",
"version": "0.1.0",
"description": "JavaScript UI testing framework capability for MarkiTect",
"main": "js/index.js",
"directories": {
"test": "js/tests"
},
"version": "1.0.0",
"description": "JavaScript-first markdown editor library with interactive UI",
"type": "module",
"main": "dist/testdrive-jsui.cjs.js",
"module": "dist/testdrive-jsui.esm.js",
"browser": "dist/testdrive-jsui.min.js",
"style": "dist/testdrive-jsui.css",
"unpkg": "dist/testdrive-jsui.min.js",
"jsdelivr": "dist/testdrive-jsui.min.js",
"types": "dist/index.d.ts",
"files": [
"dist/",
"README.md",
"LICENSE",
"CHANGELOG.md"
],
"scripts": {
"build": "rollup -c",
"build:watch": "rollup -c -w",
"build:prod": "NODE_ENV=production rollup -c",
"dev": "npm run build:watch",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"test:verbose": "jest --verbose",
"test:specific": "jest --testNamePattern",
"lint": "eslint js/**/*.js",
"lint:fix": "eslint js/**/*.js --fix",
"dev": "npm run test:watch",
"build": "echo 'No build step required for this package'",
"clean": "rm -rf coverage/ .nyc_output/ node_modules/.cache/"
"prepublishOnly": "npm run build:prod && npm test",
"lint": "eslint js/**/*.js src/**/*.js",
"lint:fix": "eslint js/**/*.js src/**/*.js --fix",
"clean": "rm -rf dist/ coverage/ .nyc_output/ node_modules/.cache/",
"size": "npm run build:prod && du -h dist/*"
},
"repository": {
"type": "git",
"url": "https://github.com/markitect/testdrive-jsui.git"
},
"keywords": [
"markdown",
"editor",
"javascript",
"testing",
"ui",
"framework",
"markitect",
"tdd",
"dom",
"components"
"wysiwyg",
"contenteditable",
"section-editing",
"interactive",
"browser",
"frontend",
"marked",
"markdown-editor"
],
"author": "MarkiTect Project",
"author": "MarkiTect Team <team@markitect.dev>",
"license": "MIT",
"bugs": {
"url": "https://github.com/markitect/testdrive-jsui/issues"
},
"homepage": "https://github.com/markitect/testdrive-jsui#readme",
"peerDependencies": {
"marked": "^11.0.0 || ^12.0.0 || ^13.0.0"
},
"peerDependenciesMeta": {
"marked": {
"optional": false
}
},
"devDependencies": {
"@babel/core": "^7.23.0",
"@babel/preset-env": "^7.23.0",
@@ -57,6 +86,10 @@
"dependencies": {
"jsdom": "^23.0.0"
},
"engines": {
"node": ">=14.0.0",
"npm": ">=6.0.0"
},
"jest": {
"testEnvironment": "jsdom",
"testMatch": [