From fd1a13c1e28a2e1765cd81e2d0e079d067ee2d94 Mon Sep 17 00:00:00 2001 From: Rodrigo Fernandes Date: Sun, 19 Jan 2020 01:48:00 +0000 Subject: [PATCH] release: New major refactor of diff2html to Typescript :breaking: --- .circleci/config.yml | 7 +++---- README.md | 18 +++++++++++++++--- package.json | 7 ++++--- website/templates/template.handlebars | 2 +- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 68aff2d..d2a673f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,16 +10,15 @@ jobs: - run: name: Get next version command: | - # Hack: Set a unique fake name for the release branch to avoid releasing master as the new 3.x major release for now - export NEXT_VERSION="$(/bin/git-version --folder=$PWD --release-branch=FAKE-RELEASE-BRANCH-NAME)" + export NEXT_VERSION="$(/bin/git-version --folder=$PWD --release-branch=master)" echo "Next version is ${NEXT_VERSION}" echo "${NEXT_VERSION}" > .version - run: name: Get next npm tag name command: | - if [ "${GITHUB_REF#refs/heads/}" = "master" ]; then + if [ "${CIRCLE_BRANCH}" = "master" ]; then export PUBLISH_TAG="latest" - elif [ "${GITHUB_REF#refs/heads/}" = "next" ]; then + elif [ "${CIRCLE_BRANCH}" = "next" ]; then export PUBLISH_TAG="next" else export PUBLISH_TAG="pr" diff --git a/README.md b/README.md index dfca9a4..8baa206 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ [![node](https://img.shields.io/node/v/diff2html.svg)]() [![npm](https://img.shields.io/npm/l/diff2html.svg)]() [![npm](https://img.shields.io/npm/dm/diff2html.svg)](https://www.npmjs.com/package/diff2html) -[![All Contributors](https://img.shields.io/badge/all_contributors-22-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-22-orange.svg?style=flat-square)](#contributors) [![Gitter](https://badges.gitter.im/rtfpessoa/diff2html.svg)](https://gitter.im/rtfpessoa/diff2html?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) diff2html generates pretty HTML diffs from git diff or unified diff output. @@ -25,13 +25,14 @@ diff2html generates pretty HTML diffs from git diff or unified diff output. - [Features](#features) - [Online Example](#online-example) - [Distributions](#distributions) +- [Usage](#usage) - [Diff2Html Usage](#diff2html-usage) - [Diff2Html API](#diff2html-api) - [Diff2Html Configuration](#diff2html-configuration) - [Diff2Html Browser](#diff2html-browser) - [Diff2Html NPM / Node.js Library](#diff2html-npm--nodejs-library) - [Diff2Html Examples](#diff2html-examples) -- [Diff2HtmlUI](#diff2htmlui) +- [Diff2HtmlUI Usage](#diff2htmlui-usage) - [Diff2HtmlUI API](#diff2htmlui-api) - [Diff2HtmlUI Configuration](#diff2htmlui-configuration) - [Diff2HtmlUI Browser](#diff2htmlui-browser) @@ -101,6 +102,17 @@ diff2html generates pretty HTML diffs from git diff or unified diff output. including a `highlight.js` implementation. You can use it without syntax highlight or by passing your own implementation with the languages you prefer +## Usage + +Diff2Html can be used in various ways as listed in the [distributions](#distributions) section. The two main ways are: + +- [Diff2Html](#diff2html-usage): using the parser and html generator directly from the library gives you complete + control about what you can do with the json or html generated. +- [Diff2HtmlUI](#diff2htmlui-usage): using this wrapper makes it easy to inject the html in the DOM and adds some nice + features to the diff, like syntax highlight. + +Bellow you can find more details and exemples about each option. + ## Diff2Html Usage To load correctly in the Browser you always need to include the stylesheet in the final HTML. @@ -266,7 +278,7 @@ export default { ``` -## Diff2HtmlUI +## Diff2HtmlUI Usage > Simple wrapper to ease simple tasks in the browser such as: code highlight and js effects diff --git a/package.json b/package.json index c532a32..7e66e76 100644 --- a/package.json +++ b/package.json @@ -48,8 +48,9 @@ "build:css": "rm -rf ./bundles/css; postcss --config ./postcss.config.js --no-map -o ./bundles/css/diff2html.min.css ./src/ui/css/diff2html.css", "build:templates": "ts-node ./scripts/hulk.ts --wrapper ts --variable 'defaultTemplates' ./src/templates/*.mustache > ./src/diff2html-templates.ts", "build:website": "rm -rf docs; webpack ---display-reasons --display-modules --mode production --config webpack.website.ts", - "build:toc-base": "markdown-toc --maxdepth 3 --bullets='-' -i", - "build:toc": "yarn run build:toc-base README.md", + "gen": "yarn run gen:toc", + "gen:toc-base": "markdown-toc --maxdepth 3 --bullets='-' -i", + "gen:toc": "yarn run gen:toc-base README.md", "test": "is-ci 'test:coverage' 'test:watch'", "test:coverage": "jest --coverage", "test:watch": "jest --watch", @@ -82,7 +83,7 @@ "git add" ], "README.md": [ - "yarn run build:toc-base", + "yarn run gen:toc-base", "git add" ] }, diff --git a/website/templates/template.handlebars b/website/templates/template.handlebars index c7cd6f6..ef72745 100644 --- a/website/templates/template.handlebars +++ b/website/templates/template.handlebars @@ -60,7 +60,7 @@ Getting Started CLI Demo - Docs Support