diff --git a/packages/gitbook-plugin-copy-code/package.json b/packages/gitbook-plugin-copy-code/package.json index b25ca437b..97147b1ea 100644 --- a/packages/gitbook-plugin-copy-code/package.json +++ b/packages/gitbook-plugin-copy-code/package.json @@ -1,29 +1,29 @@ { - "name": "gitbook-plugin-copy-code", - "description": "Button to copy code blocks", - "main": "index.js", - "browser": "./_assets/plugin.js", - "version": "4.0.0", - "dependencies": { - "copy-to-clipboard": "^3.0.5", - "gitbook-core": "4.0.0" - }, - "devDependencies": { - "gitbook-plugin": "4.0.0" - }, - "engines": { - "gitbook": ">=3.0.0" - }, - "scripts": { - "build-js": "gitbook-plugin build ./src/index.js ./_assets/plugin.js", - "prepublish": "npm run build-js" - }, - "homepage": "https://github.com/GitbookIO/gitbook", - "repository": { - "type": "git", - "url": "https://github.com/GitbookIO/gitbook.git" - }, - "bugs": { - "url": "https://github.com/GitbookIO/gitbook/issues" - } -} + "name": "gitbook-plugin-copy-code", + "description": "Button to copy code blocks", + "main": "index.js", + "browser": "./_assets/plugin.js", + "version": "4.0.0", + "dependencies": { + "copy-to-clipboard": "^3.0.5", + "gitbook-core": "4.0.0" + }, + "devDependencies": { + "gitbook-plugin": "4.0.0" + }, + "engines": { + "gitbook": ">=3.0.0" + }, + "scripts": { + "build-js": "gitbook-plugin build ./src/index.js ./_assets/plugin.js", + "prepublish": "npm run build-js" + }, + "homepage": "https://github.com/GitbookIO/gitbook", + "repository": { + "type": "git", + "url": "https://github.com/GitbookIO/gitbook.git" + }, + "bugs": { + "url": "https://github.com/GitbookIO/gitbook/issues" + } +} \ No newline at end of file diff --git a/packages/gitbook-plugin-livereload/README.md b/packages/gitbook-plugin-livereload/README.md index 5eccd1f28..e2d6f83d4 100644 --- a/packages/gitbook-plugin-livereload/README.md +++ b/packages/gitbook-plugin-livereload/README.md @@ -1,2 +1,3 @@ -Live reloading for GitBook -========================== +# `gitbook-plugin-livereload` + +See [GitBook](https://github.com/GitbookIO/gitbook) for more information. diff --git a/packages/gitbook-plugin-livereload/_assets/plugin.js b/packages/gitbook-plugin-livereload/_assets/plugin.js new file mode 100644 index 000000000..6347fb8f1 --- /dev/null +++ b/packages/gitbook-plugin-livereload/_assets/plugin.js @@ -0,0 +1,26 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.GitBookPlugin = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o { + if (typeof window === 'undefined') { + return; + } + + const newEl = document.createElement('script'); + const firstScriptTag = document.getElementsByTagName('script')[0]; + + if (firstScriptTag) { + newEl.async = 1; + newEl.src = '//' + window.location.hostname + ':35729/livereload.js'; + firstScriptTag.parentNode.insertBefore(newEl, firstScriptTag); + } + } +}); diff --git a/packages/gitbook/package.json b/packages/gitbook/package.json index 6cb3f2cc5..65315366e 100644 --- a/packages/gitbook/package.json +++ b/packages/gitbook/package.json @@ -27,7 +27,7 @@ "gitbook-plugin-copy-code": "4.0.0", "gitbook-plugin-headings": "4.0.0", "gitbook-plugin-highlight": "4.0.0", - "gitbook-plugin-livereload": "0.0.1", + "gitbook-plugin-livereload": "4.0.0", "gitbook-plugin-lunr": "4.0.0", "gitbook-plugin-search": "4.0.0", "gitbook-plugin-sharing": "4.0.0", diff --git a/scripts/bump.js b/scripts/bump.js index 4f21a3f93..53ae7c2af 100755 --- a/scripts/bump.js +++ b/scripts/bump.js @@ -10,6 +10,10 @@ const PACKAGES_DIR = path.resolve(__dirname, '../packages'); const packages = fs.readdirSync(PACKAGES_DIR); function updateDependencies(dependencies) { + if (!dependencies) { + return; + } + Object.keys(dependencies).map((key) => { if (!packages.includes(key)) { return;