mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-24 03:16:40 +00:00
Adapt plugin livereload for new APIs
This commit is contained in:
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
Live reloading for GitBook
|
||||
==========================
|
||||
# `gitbook-plugin-livereload`
|
||||
|
||||
See [GitBook](https://github.com/GitbookIO/gitbook) for more information.
|
||||
|
||||
@@ -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<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var GitBook = require('gitbook-core');
|
||||
|
||||
module.exports = GitBook.createPlugin({
|
||||
activate: function activate(dispatch, getState, _ref) {
|
||||
var Components = _ref.Components;
|
||||
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var newEl = document.createElement('script');
|
||||
var firstScriptTag = document.getElementsByTagName('script')[0];
|
||||
|
||||
if (firstScriptTag) {
|
||||
newEl.async = 1;
|
||||
newEl.src = '//' + window.location.hostname + ':35729/livereload.js';
|
||||
firstScriptTag.parentNode.insertBefore(newEl, firstScriptTag);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
},{"gitbook-core":"gitbook-core"}]},{},[1])(1)
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
(function() {
|
||||
var newEl = document.createElement('script'),
|
||||
firstScriptTag = document.getElementsByTagName('script')[0];
|
||||
|
||||
if (firstScriptTag) {
|
||||
newEl.async = 1;
|
||||
newEl.src = '//' + window.location.hostname + ':35729/livereload.js';
|
||||
firstScriptTag.parentNode.insertBefore(newEl, firstScriptTag);
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -1,8 +0,0 @@
|
||||
module.exports = {
|
||||
book: {
|
||||
assets: "./book",
|
||||
js: [
|
||||
"plugin.js"
|
||||
]
|
||||
}
|
||||
};
|
||||
@@ -1,18 +1,26 @@
|
||||
{
|
||||
"name": "gitbook-plugin-livereload",
|
||||
"description": "Live reloading for your gitbook",
|
||||
"main": "index.js",
|
||||
"version": "0.0.1",
|
||||
"engines": {
|
||||
"gitbook": "*"
|
||||
},
|
||||
"homepage": "https://github.com/davidagraf/gitbook-plugin-livereload",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/davidagraf/gitbook-plugin-livereload.git"
|
||||
},
|
||||
"license": "Apache 2",
|
||||
"bugs": {
|
||||
"url": "https://github.com/davidagraf/gitbook-plugin-livereload/issues"
|
||||
}
|
||||
}
|
||||
"name": "gitbook-plugin-livereload",
|
||||
"description": "Live reloading for your gitbook",
|
||||
"main": "index.js",
|
||||
"browser": "./_assets/plugin.js",
|
||||
"version": "4.0.0",
|
||||
"engines": {
|
||||
"gitbook": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"gitbook-core": "4.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"
|
||||
},
|
||||
"license": "Apache 2",
|
||||
"bugs": {
|
||||
"url": "https://github.com/GitbookIO/gitbook/issues"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
const GitBook = require('gitbook-core');
|
||||
|
||||
module.exports = GitBook.createPlugin({
|
||||
activate: (dispatch, getState, { Components }) => {
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user