We welcome contributions to SquibView! Here’s how you can help.
git clone https://github.com/YOUR_USERNAME/squibview.gitnpm installgit checkout -b my-feature-branchgit commit -am "Add some feature"git push origin my-feature-branchSquibView uses a combination of npm version and custom shell scripts to manage versioning, builds, and testing in an integrated way. IMPORTANT: SquibView supports multiple build targets (ESM, UMD, Standalone, React, Vue, CLI) - it’s critical not to break any of these during development.
The canonical version number is stored in package.json. The src/version.js file, which makes the version available at runtime via SquibView.version, is automatically generated from package.json by the build process.
dev-bump-build-test.sh: Recommended for development iterations. This script automates bumping to a development version, building, and testing.
./dev-bump-build-test.sh from the project root.package.json.1.0.5-dev.0), it increments the pre-release part (e.g., to 1.0.5-dev.1).1.0.5), it adds -dev.0 to create the first development version (e.g., 1.0.5-dev.0).node tools/updateVersion.js to update src/version.js.npm run build:esm (fast build for development).npm test -- tests/SquibView.test.js (core tests only).build-and-test.sh: For formal builds when you want to test a specific version.
version in package.json (e.g., npm version patch, npm version minor, or edit directly)../build-and-test.sh.node tools/updateVersion.js to update src/version.js.npm run build (full build of all targets).npm test (all tests).⚠️ WARNING: Full builds take significant time (several minutes), especially standalone builds. Use targeted builds during development.
npm run build:esm - ES Module build (fastest, ~2 seconds)
dist/squibview.esm.js, dist/squibview.esm.min.jsnpm run build:umd - Universal Module Definition build (~3 seconds)
dist/squibview.umd.js, dist/squibview.umd.min.jsnpm run build:standalone - Self-contained build with all dependencies (⚠️ ~30+ seconds)
dist/squibview.standalone.min.js, dist/squibview.standalone.esm.jsnpm run build:react - React component wrapper
dist/squibview-react.js, dist/squibview-react.min.jsnpm run build:cli - Command-line interface
cli/ directory with CLI toolsnpm run build - Builds all library targets (ESM, UMD, Standalone, React, Vue)npm run build:all - Builds library + CLI (complete build)npm run build:fast - ESM build only (for development)npm run updateVersion - Updates src/version.js from package.jsonnpm run minifyCSS - Processes and minifies CSS filesnpm run makeIndexHTML - Generates documentation HTMLtools/updateVersion.js reads package.json and generates src/version.jstools/minifyCSS.cjsdist/ directorySquibView reports its version at runtime via:
console.log(SquibView.version); // e.g., "1.0.5-dev.2"console.log(SquibView.version.version); // Version stringconsole.log(SquibView.version.url); // Repository URLdocs/umd-build-configuration.mdnpm run updateVersion manuallynpm run minifyCSS runs after code changesnpm testnpm test -- tests/SquibView.test.js (or npx jest tests/SquibView.test.js)npm test -- --verbosenpm test -- --watchMost modern IDEs offer excellent Jest integration for debugging.
*.test.js) or the source files (src/*.js).describe or it blocks in your test files.For issues that are hard to reproduce in the JSDOM environment provided by Jest, or for visual/interaction debugging:
debug.html or debug-dev.html: These files in the dev/ directory are set up to load SquibView. You can open them in a browser.debug-dev.html: This file is particularly useful as it often includes more complex setups or specific content to test features under development.
initialContent or inputContentType directly in the script tag within debug-dev.html to load specific Markdown or HTML.debugger; statements in src/squibview.js or other relevant source files where you want the browser’s debugger to pause.console.log, console.warn, etc.).debug-dev.html or a new Jest test case.console.log output: Add console.log statements strategically in squibview.js or HtmlToMarkdown.js to understand the state of variables or the flow of execution.squibview.js -> markdown-it (with custom fence renderers) -> HTML string -> DOM.HtmlToMarkdown.js (which uses Turndown with custom rules) -> Markdown string.npm test, especially the diffs provided by Jest when assertions fail. This often points directly to the problem.hljs, mermaid, Papa) in tests/SquibView.test.js might affect test behavior. Sometimes, unmocking a module or using jest.requireActual is necessary for specific tests.Please follow the existing code style. We generally adhere to common JavaScript best practices.
Thank you for contributing to SquibView!